WIP: v2.0.0 intial commit

This commit is contained in:
Rene
2020-07-14 20:10:26 +02:00
parent 97abdf77ab
commit eedde6b82b
171 changed files with 4327 additions and 71194 deletions
-21
View File
@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2019 Rene Haas
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-102
View File
@@ -1,102 +0,0 @@
<p align="center">
<a href="https://reactjs.org/"><img src="https://kingsora.github.io/OverlayScrollbars/frameworks/react/logo.svg" width="200" height="133" alt="React"></a>
<a href="https://kingsora.github.io/OverlayScrollbars/"><img src="https://kingsora.github.io/OverlayScrollbars/design/logo.svg" width="200" height="133" alt="OverlayScrollbars"></a>
</p>
<h6 align="center">
<a href="https://github.com/facebook/react/"><img src="https://img.shields.io/badge/React-%5E16.4.0-61dafb?style=flat-square&logo=React" alt="React"></a>
<a href="https://github.com/KingSora/OverlayScrollbars"><img src="https://img.shields.io/badge/OverlayScrollbars-%5E1.10.0-36befd?style=flat-square" alt="OverlayScrollbars"></a>
<a href="https://www.npmjs.com/package/overlayscrollbars-react"><img src="https://img.shields.io/npm/dt/overlayscrollbars-react.svg?style=flat-square" alt="Downloads"></a>
<a href="https://github.com/KingSora/OverlayScrollbars/blob/master/packages/overlayscrollbars-react/LICENSE"><img src="https://img.shields.io/github/license/kingsora/overlayscrollbars.svg?style=flat-square" alt="License"></a>
</h6>
<h3 align="center">
<a href="https://kingsora.github.io/OverlayScrollbars/frameworks/react/">Example</a>
&nbsp;&nbsp;&bull;&nbsp;&nbsp;
<a href="https://kingsora.github.io/OverlayScrollbars/#!documentation">Documentation</a>
&nbsp;&nbsp;&bull;&nbsp;&nbsp;
<a href="https://kingsora.github.io/OverlayScrollbars/#!faq">FAQ</a>
</h3>
<h5 align="center">
The official OverlayScrollbars wrapper for React.
</h5>
## Installation
```sh
npm install overlayscrollbars-react
```
## Peer Dependencies
OverlayScrollbars for React has the following **peer dependencies**:
- The vanilla JavaScript library: [overlayscrollbars](https://www.npmjs.com/package/overlayscrollbars)
```
npm install overlayscrollbars
```
- The React framework: [react](https://www.npmjs.com/package/react)
```
npm install react
```
## TypeScript
- In case you are using TypeScript, you have to install the [OverlayScrollbars typings](https://www.npmjs.com/package/@types/overlayscrollbars):
```
npm install @types/overlayscrollbars
```
Since this wrapper is written in TypeScript it comes with its generated typings.<br>
Check out the [recommended](https://github.com/KingSora/OverlayScrollbars#typescript) **tsconfig.json** options.
## Usage
#### CSS
You have to import the `OverlayScrollbars.css` by yourself.<br>
The component **doesn't** do it for you as the styles are **global styles**!<br>
There are different ways to achieve this, in React the most simple way for me was to add [this line](https://github.com/KingSora/OverlayScrollbars/blob/master/packages/overlayscrollbars-react/example/src/index.tsx#L1) in the `index` file:
```js
import 'overlayscrollbars/css/OverlayScrollbars.css';
```
#### Import
Simply import the component into your file(s):
```js
import { OverlayScrollbarsComponent } from 'overlayscrollbars-react';
```
#### Template
After the import you can use it in JSX:
```jsx
<OverlayScrollbarsComponent>
example content
</OverlayScrollbarsComponent>
```
#### Properties
Two properties are accepted: `options` and `extensions`.
- The `options` property accepts a `object` and can be changed at any point in time, and the plugin will adapt.
- The `extensions` property accepts a `string`, `string array` or `object` and is only taken into account if the component gets mounted.
```jsx
<OverlayScrollbarsComponent
options={{ scrollbars: { autoHide: 'scroll' } }}
extensions={['extensionA', 'extensionB']}
>
</OverlayScrollbarsComponent>
```
You can read more about the `options` object [here](https://kingsora.github.io/OverlayScrollbars/#!documentation/options), `extensions` are documented [here](https://kingsora.github.io/OverlayScrollbars/#!documentation/extensions-basics) and [here](https://kingsora.github.io/OverlayScrollbars/#!documentation/initialization).
#### Instance
If you get the component reference, it provides two methods: `osInstance()` and `osTarget()`.
- The `osInstance()` method returns the OverlayScrollbars `instance` of the component, or `null` if the instance isn't initialized yet or already destroyed.
- The `osTarget()` method returns the native `html` element to which the plugin was initialized, or `null` if the the component isn't mounted yet or already unmounted.
## Example App
In case you need a example app for reference, you can use the example app in this repo(`example folder`):
- [Live example](https://kingsora.github.io/OverlayScrollbars/frameworks/react/)
- [Source code](https://github.com/KingSora/OverlayScrollbars/tree/master/packages/overlayscrollbars-react/example)
If you wanna build the example app, run these commands:
```sh
npm run setup
npm run build
npm run example
```
## License
MIT
-150
View File
@@ -1,150 +0,0 @@
const packageName = 'overlayscrollbars-react';
const rollupUmdName = 'OverlayScrollbarsReact';
const filesInfo = {
fileName: packageName,
srcFolder: './src',
distFolder: './dist',
typingsFolder: './dist/types',
exampleFolder: './example',
tsconfigJsonPath: './tsconfig.json',
packageJsonPath: './package.json',
cache: []
}
const packagePaths = {
main: `${filesInfo.distFolder}/${filesInfo.fileName}.js`,
module: `${filesInfo.distFolder}/${filesInfo.fileName}.esm.js`,
typings: `${filesInfo.typingsFolder}/index.d.ts`
}
const rollupUmdGlobals = {
'react': 'React',
'overlayscrollbars': 'OverlayScrollbars'
};
const packageJson = require(filesInfo.packageJsonPath);
const tsconfigJson = require(filesInfo.tsconfigJsonPath);
const path = require('path');
const sh = require('shelljs');
const chalk = require('chalk');
const gulp = require('gulp');
const rollup = require('rollup');
const rollupCommonJs = require('rollup-plugin-commonjs');
const rollupTypeScript = require('rollup-plugin-typescript2');
const rollupResolve = require('rollup-plugin-node-resolve');
const rollupInputConfig = {
input: `${filesInfo.srcFolder}/index.ts`,
external: [...Object.keys(packageJson.devDependencies), ...Object.keys(packageJson.peerDependencies)],
plugins: [
rollupResolve(),
rollupCommonJs()
]
};
const rollupOutputConfig = {
exports: 'named',
sourcemap: true
};
sh.echo(chalk.cyanBright('Start building:'));
gulp.task('prepare', function (done) {
sh.echo(`> Removing ${filesInfo.distFolder}`);
sh.rm('-rf', filesInfo.distFolder);
done();
});
gulp.task('tsconfigJson', function (done) {
sh.echo(`> Prepare ${filesInfo.tsconfigJsonPath}`);
let newTsconfigJson = {
...tsconfigJson,
compilerOptions: {
...tsconfigJson.compilerOptions,
declarationDir: filesInfo.typingsFolder,
outDir: filesInfo.distFolder,
},
include: [filesInfo.srcFolder],
exclude: [filesInfo.distFolder, filesInfo.exampleFolder, 'node_modules']
};
sh.ShellString(JSON.stringify(newTsconfigJson, null, 4)).to(filesInfo.tsconfigJsonPath);
done();
});
gulp.task('packageJson', function (done) {
sh.echo(`> Prepare ${filesInfo.packageJsonPath}`);
let newPackageJson = {
...packageJson,
...packagePaths,
name: packageName,
files: [
path.normalize(filesInfo.srcFolder),
path.normalize(filesInfo.distFolder)
]
};
sh.ShellString(JSON.stringify(newPackageJson, null, 4)).to(filesInfo.packageJsonPath);
done();
});
gulp.task('rollup', function (done) {
sh.echo('> Rollup:');
(async function () {
let rollupTsconfig = {
useTsconfigDeclarationDir: true,
objectHashIgnoreUnknownHack: true,
clean: true,
tsconfig: filesInfo.tsconfigJsonPath,
tsconfigOverride: {
compilerOptions: {
target: 'es5'
}
}
};
rollupTsconfig.tsconfigOverride.compilerOptions.target = 'es5';
let es5umdBundle = await rollup.rollup({
...rollupInputConfig,
plugins: [rollupTypeScript({ ...rollupTsconfig })].concat(rollupInputConfig.plugins)
});
await es5umdBundle.write({
name: rollupUmdName,
globals: rollupUmdGlobals,
file: packagePaths.main,
format: 'umd',
...rollupOutputConfig
});
sh.echo(chalk.yellowBright(` [${rollupTsconfig.tsconfigOverride.compilerOptions.target} & umd]: `) + chalk.greenBright(`${rollupInputConfig.input}${packagePaths.main}`));
rollupTsconfig.tsconfigOverride.compilerOptions.target = 'es6';
let es6esmBundle = await rollup.rollup({
...rollupInputConfig,
plugins: [rollupTypeScript({ ...rollupTsconfig })].concat(rollupInputConfig.plugins)
});
await es6esmBundle.write({
file: packagePaths.module,
format: 'esm',
...rollupOutputConfig
});
sh.echo(chalk.yellowBright(` [${rollupTsconfig.tsconfigOverride.compilerOptions.target} & esm]: `) + chalk.greenBright(`${rollupInputConfig.input}${packagePaths.module}`));
filesInfo.cache.forEach(function (cacheFolder) {
if (sh.test('-d', cacheFolder)) {
sh.rm('-rf', cacheFolder);
}
});
sh.echo(chalk.greenBright('Building finished!'));
done();
})();
});
gulp.task('example', function (done) {
sh.echo();
sh.echo(chalk.cyanBright(`Copy to example → ${filesInfo.exampleFolder}/node_modules/${filesInfo.fileName}`));
sh.mkdir('-p', `${filesInfo.exampleFolder}/node_modules/${filesInfo.fileName}`);
sh.cp('-Rf', [filesInfo.srcFolder, filesInfo.distFolder, filesInfo.packageJsonPath], `${filesInfo.exampleFolder}/node_modules/${filesInfo.fileName}`);
sh.echo(chalk.greenBright('Copying finished!'));
done();
});
gulp.series('prepare', 'tsconfigJson', 'packageJson', 'rollup', 'example')();
@@ -1,89 +0,0 @@
import React, { Component } from 'react';
import OverlayScrollbars from 'overlayscrollbars';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
class OverlayScrollbarsComponent extends Component {
constructor(props) {
super(props);
this._osInstance = null;
this._osTargetRef = React.createRef();
}
osInstance() {
return this._osInstance;
}
osTarget() {
return this._osTargetRef.current || null;
}
componentDidMount() {
this._osInstance = OverlayScrollbars(this.osTarget(), this.props.options || {}, this.props.extensions);
mergeHostClassNames(this._osInstance, this.props.className);
}
componentWillUnmount() {
if (OverlayScrollbars.valid(this._osInstance)) {
this._osInstance.destroy();
this._osInstance = null;
}
}
componentDidUpdate(prevProps) {
if (OverlayScrollbars.valid(this._osInstance)) {
this._osInstance.options(this.props.options);
if (prevProps.className !== this.props.className) {
mergeHostClassNames(this._osInstance, this.props.className);
}
}
}
render() {
const _a = this.props, divProps = __rest(_a, ["options", "extensions", "children", "className"]);
return (React.createElement("div", Object.assign({ className: "os-host" }, divProps, { ref: this._osTargetRef }),
React.createElement("div", { className: "os-resize-observer-host" }),
React.createElement("div", { className: "os-padding" },
React.createElement("div", { className: "os-viewport" },
React.createElement("div", { className: "os-content" }, this.props.children))),
React.createElement("div", { className: "os-scrollbar os-scrollbar-horizontal " },
React.createElement("div", { className: "os-scrollbar-track" },
React.createElement("div", { className: "os-scrollbar-handle" }))),
React.createElement("div", { className: "os-scrollbar os-scrollbar-vertical" },
React.createElement("div", { className: "os-scrollbar-track" },
React.createElement("div", { className: "os-scrollbar-handle" }))),
React.createElement("div", { className: "os-scrollbar-corner" })));
}
}
function mergeHostClassNames(osInstance, className) {
if (OverlayScrollbars.valid(osInstance)) {
const { host } = osInstance.getElements();
const regex = new RegExp(`(^os-host([-_].+|)$)|${osInstance.options().className.replace(/\s/g, "$|")}$`, 'g');
const osClassNames = host.className.split(' ')
.filter(name => name.match(regex))
.join(' ');
host.className = `${osClassNames} ${className || ''}`;
}
}
export { OverlayScrollbarsComponent };
//# sourceMappingURL=overlayscrollbars-react.esm.js.map
File diff suppressed because one or more lines are too long
@@ -1,127 +0,0 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('overlayscrollbars')) :
typeof define === 'function' && define.amd ? define(['exports', 'react', 'overlayscrollbars'], factory) :
(global = global || self, factory(global.OverlayScrollbarsReact = {}, global.React, global.OverlayScrollbars));
}(this, (function (exports, React, OverlayScrollbars) { 'use strict';
var React__default = 'default' in React ? React['default'] : React;
OverlayScrollbars = OverlayScrollbars && Object.prototype.hasOwnProperty.call(OverlayScrollbars, 'default') ? OverlayScrollbars['default'] : OverlayScrollbars;
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
var OverlayScrollbarsComponent = (function (_super) {
__extends(OverlayScrollbarsComponent, _super);
function OverlayScrollbarsComponent(props) {
var _this = _super.call(this, props) || this;
_this._osInstance = null;
_this._osTargetRef = React__default.createRef();
return _this;
}
OverlayScrollbarsComponent.prototype.osInstance = function () {
return this._osInstance;
};
OverlayScrollbarsComponent.prototype.osTarget = function () {
return this._osTargetRef.current || null;
};
OverlayScrollbarsComponent.prototype.componentDidMount = function () {
this._osInstance = OverlayScrollbars(this.osTarget(), this.props.options || {}, this.props.extensions);
mergeHostClassNames(this._osInstance, this.props.className);
};
OverlayScrollbarsComponent.prototype.componentWillUnmount = function () {
if (OverlayScrollbars.valid(this._osInstance)) {
this._osInstance.destroy();
this._osInstance = null;
}
};
OverlayScrollbarsComponent.prototype.componentDidUpdate = function (prevProps) {
if (OverlayScrollbars.valid(this._osInstance)) {
this._osInstance.options(this.props.options);
if (prevProps.className !== this.props.className) {
mergeHostClassNames(this._osInstance, this.props.className);
}
}
};
OverlayScrollbarsComponent.prototype.render = function () {
var _a = this.props, options = _a.options, extensions = _a.extensions, children = _a.children, className = _a.className, divProps = __rest(_a, ["options", "extensions", "children", "className"]);
return (React__default.createElement("div", __assign({ className: "os-host" }, divProps, { ref: this._osTargetRef }),
React__default.createElement("div", { className: "os-resize-observer-host" }),
React__default.createElement("div", { className: "os-padding" },
React__default.createElement("div", { className: "os-viewport" },
React__default.createElement("div", { className: "os-content" }, this.props.children))),
React__default.createElement("div", { className: "os-scrollbar os-scrollbar-horizontal " },
React__default.createElement("div", { className: "os-scrollbar-track" },
React__default.createElement("div", { className: "os-scrollbar-handle" }))),
React__default.createElement("div", { className: "os-scrollbar os-scrollbar-vertical" },
React__default.createElement("div", { className: "os-scrollbar-track" },
React__default.createElement("div", { className: "os-scrollbar-handle" }))),
React__default.createElement("div", { className: "os-scrollbar-corner" })));
};
return OverlayScrollbarsComponent;
}(React.Component));
function mergeHostClassNames(osInstance, className) {
if (OverlayScrollbars.valid(osInstance)) {
var host = osInstance.getElements().host;
var regex_1 = new RegExp("(^os-host([-_].+|)$)|" + osInstance.options().className.replace(/\s/g, "$|") + "$", 'g');
var osClassNames = host.className.split(' ')
.filter(function (name) { return name.match(regex_1); })
.join(' ');
host.className = osClassNames + " " + (className || '');
}
}
exports.OverlayScrollbarsComponent = OverlayScrollbarsComponent;
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=overlayscrollbars-react.js.map
File diff suppressed because one or more lines are too long
@@ -1,20 +0,0 @@
import React, { Component } from 'react';
import OverlayScrollbars from "overlayscrollbars";
export interface OverlayScrollbarsComponentProps extends React.HTMLAttributes<HTMLDivElement> {
children?: any;
options?: OverlayScrollbars.Options;
extensions?: OverlayScrollbars.Extensions;
}
export interface OverlayScrollbarsComponentState {
}
export declare class OverlayScrollbarsComponent extends Component<OverlayScrollbarsComponentProps, OverlayScrollbarsComponentState> {
private _osInstance;
private _osTargetRef;
constructor(props: OverlayScrollbarsComponentProps);
osInstance(): OverlayScrollbars | null;
osTarget(): HTMLDivElement | null;
componentDidMount(): void;
componentWillUnmount(): void;
componentDidUpdate(prevProps: OverlayScrollbarsComponentProps): void;
render(): JSX.Element;
}
@@ -1 +0,0 @@
export * from './OverlayScrollbarsComponent';
@@ -1,23 +0,0 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
@@ -1,44 +0,0 @@
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `npm start`
Runs the app in the development mode.<br>
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.<br>
You will also see any lint errors in the console.
### `npm test`
Launches the test runner in the interactive watch mode.<br>
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `npm run build`
Builds the app for production to the `build` folder.<br>
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.<br>
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `npm run eject`
**Note: this is a one-way operation. Once you `eject`, you cant go back!**
If you arent satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point youre on your own.
You dont have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldnt feel obligated to use this feature. However we understand that this tool wouldnt be useful if you couldnt customize it when you are ready for it.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
File diff suppressed because it is too large Load Diff
@@ -1,40 +0,0 @@
{
"name": "example",
"version": "0.1.0",
"private": true,
"homepage": "/OverlayScrollbars/frameworks/react/",
"dependencies": {
"@types/jest": "24.0.15",
"@types/node": "12.6.8",
"@types/overlayscrollbars": "^1.9.0",
"@types/react": "16.8.23",
"@types/react-dom": "16.8.5",
"overlayscrollbars": "^1.11.0",
"overlayscrollbars-react": "^0.1.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.0.1",
"typescript": ">=3.2.1 <3.5.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

@@ -1,41 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>OverlayScrollvars React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
@@ -1,15 +0,0 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
@@ -1,309 +0,0 @@
.App {
min-width: 600px;
}
.header {
background: #36befd;
background: -moz-linear-gradient(-45deg, #36befd 1%, #6461f6 100%);
background: -webkit-linear-gradient(-45deg, #36befd 1%, #6461f6 100%);
background: linear-gradient(135deg, #36befd 1%, #6461f6 100%);
margin: 0;
color: #fff;
letter-spacing: 0.1pt;
text-shadow: 0px 1px 3px rgba(0, 0, 255, 0.1);
display: flex;
flex-direction: column;
flex-wrap: nowrap;
justify-content: center;
align-items: center;
height: 76px;
box-shadow: 0 15px 20px -15px rgba(57, 120, 253, 0.15), 0 55px 50px -35px rgba(47, 78, 249, 0.12);
position: relative;
z-index: 1;
}
.header code {
border-radius: 4px;
margin: 2px;
display: block;
padding: 0.5em;
background: #fff;
font-size: 10pt;
margin: 0px auto;
box-shadow: 0px 1px 3px rgba(0, 0, 255, 0.15);
}
.header code .code-keyword {
color: #0059FF;
font-weight: bold;
}
.header code .code-char {
color: #4D4D4C;
}
.header code .code-variable {
color: #3778AD;
}
.header code .code-string {
color: #279737;
font-weight: 400;
}
.content {
min-height: calc(100vh - 76px);
position: relative;
display: flex;
flex-direction: column;
flex-flow: column;
flex-wrap: wrap;
}
.content-section {
position: relative;
padding: 40px 0px;
background: #fff;
z-index: 1;
overflow: hidden;
}
.content-section:last-child {
flex-grow: 1;
}
.content-section:before,
.content-section:after {
content: '';
display: block;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: -1;
}
.content-section:nth-child(2n - 1) {
background: #f6f8fb;
}
.content-section:nth-child(2n - 1):before,
.content-section:nth-child(2n - 1):after {
background: #fff;
}
.content-section:nth-child(2n + 0) {
background: #fff;
}
.content-section:nth-child(2n + 0):before,
.content-section:nth-child(2n + 0):after {
background: #f6f8fb;
}
.content-section.skew:before,
.content-section.skew:after {
transform: skewY(-7deg);
}
.content-section.skew + .content-section:before,
.content-section.skew + .content-section:after {
transform: skewY(-7deg);
}
.content-section skew + .content-section.skew:before,
.content-section.skew + .content-section.skew:before {
top: 0;
}
.content-section + .content-section.skew:before {
top: -50vw;
}
.content-section.skew + .content-section:after {
bottom: -50vw;
}
.content-section + .content-section:after {
top: 0;
}
.content-section.skew + .content-section.skew:after {
bottom: 0;
}
.content-section.skew:first-child:before {
top: -50vw !important;
}
.content-section.skew:last-child:after {
bottom: -50vw !important;
}
.content-section-content-framework > span {
font-weight: bold;
font-size: 30pt;
user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
}
.content-section-content-framework > span:not(:nth-child(2)) {
display: inline-block;
color: transparent;
height: 190px;
width: 190px;
vertical-align:middle;
}
.content-section-title {
margin-bottom: 14px;
}
.content-section-title > h2{
text-align: center;
font-size: 26pt;
color: #39547A;
margin: 24px 0px;
}
.content-section-title > table{
text-align: left;
margin: 0px auto;
}
.content-section-title > table tr {
margin: 10px;
}
.content-section-title > table td {
line-height: 18pt;
}
.content-section-title > table td:first-child {
text-align: right;
font-weight: bold;
vertical-align: top;
}
.content-section-title > table td:first-child span{
margin: 0px 6px;
}
.content-section-title > table td:last-child span {
text-align: left;
color: #36befd;
font-weight: bold;
}
.content-section-content {
display: table;
margin: 0px auto;
}
.content-section-content .os-host,
.content-section-content .os-host-textarea {
border: 2px solid #36befd;
width: 480px;
max-height: 300px;
margin: 10px auto 20px auto;
border-radius: 6px;
padding: 10px;
line-height: 16pt;
}
.content-section-content > .os-host .os-host,
.content-section-content > .os-host-textarea .os-host-textarea {
border: 2px solid #6461f6;
width: auto;
height: auto;
margin: 10px auto;
}
.content-section-content .bonus-content {
display: inline-block;
white-space: pre;
background: #f0f3f6;
padding: 0px 5px;
margin: 2px;
border-radius: 4px !important;
border: 1px solid #DDE3ED;
font-size: 10pt;
font-family: "Lucida Console", Monaco, monospace;
color: #39547A;
}
.content-section-content-buttons {
display: table;
margin: 0px auto;
}
.info-span {
background: #F7F7F7;
padding: 2px 5px;
margin: 2px;
white-space: nowrap;
border-radius: 4px;
border: 1px solid #DEDFE0;
font-weight: bold;
font-size: 10pt;
}
a {
display: inline-block;
text-decoration: none;
position: relative;
color: #36befd;
transition: color 0.3s, text-shadow 0.3s;
text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.05);
padding: 0px 1px;
font-weight: 600;
outline: none !important;
cursor: pointer;
z-index: 0;
}
a:hover {
color: #fff;
text-shadow: 0px 1px 6px rgba(0, 0, 0, 0.16);
}
a:before {
content: '';
position: absolute;
display: block;
bottom: 0;
left: 0;
height: 0%;
width: 100%;
background: transparent;
z-index: -1;
border-bottom: 1px dotted #36befd;
transition: height 0.3s, border 0.3s, background-color 0.15s;
}
a:hover:before {
height: 100%;
background: #36befd;
border-bottom: 1px solid #36befd;
}
.buttons {
display: table;
margin: 0px auto;
}
button {
font-size: 10pt;
line-height: 28pt;
font-family: sans-serif;
font-weight: bold;
color: #555E6B;
line-height: 40px;
border: 1px solid #D6D6D6;
border-radius: 6px;
cursor: pointer;
transition: color 0.3s, background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
padding: 0px 14px;
display: block;
float: left;
margin: 5px;
text-align: center;
background: rgba(0, 0, 0, 0.02);
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
min-width: 80px;
outline: none !important;
}
button:hover {
color: #fff;
background: #6461f6;
border-color: #6461f6;
box-shadow: 0 4px 8px -1px rgba(170, 170, 170, 0.45);
}
button:active {
box-shadow: inset 0 4px 9px -1px rgba(0, 0, 0, 0.15);
}
::selection {
color: #fff;
background: #6461f6;
text-shadow: 0px 1px 3px rgba(0, 0, 0, 0.28);
}
img {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
pointer-events: none;
}
.os-logo {
background: transparent url("assets/overlayscrollbars.svg") no-repeat center center;
background-size: 80%;
}
.framework-logo {
background: transparent url("assets/react.svg") no-repeat center center;
background-size: 80%;
}
.custom-class-name-test {
background: rgba(0, 0, 0, 0.03);
}
@@ -1,9 +0,0 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<App />, div);
ReactDOM.unmountComponentAtNode(div);
});
@@ -1,191 +0,0 @@
import './App.css';
import React, { RefObject } from 'react';
import OverlayScrollbars from 'overlayscrollbars';
import { OverlayScrollbarsComponent } from 'overlayscrollbars-react';
export interface AppState {
loremList: Array<string>;
componentContent: string;
osComponentOptions: OverlayScrollbars.Options;
hasCustomClassName: boolean;
}
export default class App extends React.Component<any, AppState> {
framework: string = 'React';
customClassName: string = 'custom-class-name-test'
componentClass: string = 'OverlayScrollbarsComponent';
loremIpsumLong: string = 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.';
loremIpsumMedium: string = 'At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.';
loremIpsumShort: string = 'Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio.';
osComponentRef1: RefObject<OverlayScrollbarsComponent>;
osComponentRef2: RefObject<OverlayScrollbarsComponent>;
constructor(props: any) {
super(props);
this.osComponentRef1 = React.createRef<OverlayScrollbarsComponent>();
this.osComponentRef2 = React.createRef<OverlayScrollbarsComponent>();
this.state = {
hasCustomClassName: false,
componentContent: 'Lorem Ipsum',
loremList: [],
osComponentOptions: {
resize: 'both',
paddingAbsolute: true,
scrollbars: {
autoHide: 'never'
}
}
};
}
componentDidMount() {
console.log(`${this.componentClass} (1)`);
console.log(this.osComponentRef1.current);
console.log(`${this.componentClass} (2)`);
console.log(this.osComponentRef2.current);
}
onBtnScrollRandom(event: React.MouseEvent<HTMLButtonElement, MouseEvent>, refArray: Array<RefObject<OverlayScrollbarsComponent>>) {
if (refArray) {
for (let i = 0; i < refArray.length; i++) {
if (refArray[i] && refArray[i].current) {
const osInstance = refArray[i].current!.osInstance();
if (osInstance) {
osInstance.scrollStop().scroll({
x: Math.floor((Math.random() * osInstance.scroll().max.x) + 0),
y: Math.floor((Math.random() * osInstance.scroll().max.y) + 0)
}, 1000, 'easeOutElastic');
}
}
}
}
}
onBtnChangeOptions() {
this.setState({
hasCustomClassName: !this.state.hasCustomClassName,
osComponentOptions: {
resize: this.state.osComponentOptions.resize === 'both' ? 'none' : 'both',
scrollbars: {
autoHide: this.state.osComponentOptions.scrollbars!.autoHide === 'never' ? 'scroll' : 'never',
}
}
});
}
onBtnChangeContent() {
this.setState({
componentContent: this.state.componentContent + '\r\n' + this.randomIpsum(),
loremList: [...this.state.loremList, this.randomIpsum()]
});
}
onBtnLog() {
console.log(`== ${this.componentClass} (1) ==`);
console.log('Instance:');
console.log(this.osComponentRef1.current!.osInstance());
console.log('Target:');
console.log(this.osComponentRef1.current!.osTarget());
console.log('');
console.log(`== ${this.componentClass} (2) ==`);
console.log('Instance:');
console.log(this.osComponentRef2.current!.osInstance());
console.log('Target:');
console.log(this.osComponentRef2.current!.osTarget());
}
randomIpsum(): string {
const loremIpsums = [this.loremIpsumLong, this.loremIpsumMedium, this.loremIpsumShort];
return loremIpsums[Math.floor(Math.random() * loremIpsums.length)];
}
render() {
return (
<div className="App">
<div className="header">
<code>
<span className="code-keyword">import</span>
<span className="code-char">{' { '}</span>
<span className="code-variable">OverlayScrollbarsComponent</span>
<span className="code-char">{' } '}</span>
<span className="code-keyword">from</span>
<span className="code-string">{" 'overlayscrollbars-react'"}</span>
<span className="code-char">;</span>
</code>
</div>
<div className="content">
<div className="content-section skew">
<div className="content-section-content content-section-content-framework">
<span className="framework-logo"></span>
<span>+</span>
<span className="os-logo"></span>
</div>
</div>
<div className="content-section">
<div className="content-section-title">
<h2>Component</h2>
<table>
<tbody>
<tr>
<td><span>Class:</span></td>
<td><span>{this.componentClass}</span></td>
</tr>
<tr>
<td><span>Description:</span></td>
<td>OverlayScrollbars as a {this.framework}-Component.</td>
</tr>
</tbody>
</table>
</div>
<div className="content-section-content">
<OverlayScrollbarsComponent ref={this.osComponentRef1}
options={this.state.osComponentOptions}
style={{ maxHeight: '350px' }}
className={`${this.framework} ${this.state.hasCustomClassName ? this.customClassName : ''}`}
>
<div className="bonus-content">
{this.state.componentContent}
</div>
{this.loremIpsumShort}
<OverlayScrollbarsComponent ref={this.osComponentRef2}
options={this.state.osComponentOptions}
style={{ maxHeight: '150px' }}
className={this.state.hasCustomClassName ? this.customClassName : ''}
>
<div className="bonus-content">
{this.state.componentContent}
</div>
{this.loremIpsumLong}
<br />
<br />
{this.loremIpsumShort}
</OverlayScrollbarsComponent>
{this.loremIpsumMedium}
<br />
<br />
{this.loremIpsumShort}
<br />
<br />
{this.loremIpsumLong}
{
this.state.loremList.map((item, index) => {
return <div key={index} data-key={index}><br />{item}</div>;
})
}
</OverlayScrollbarsComponent>
<div className="buttons">
<button onClick={(event) => { this.onBtnScrollRandom.call(this, event, [this.osComponentRef1, this.osComponentRef2]) }}>Scroll</button>
<button onClick={() => { this.onBtnChangeOptions.call(this) }}>Change Options</button>
<button onClick={() => { this.onBtnChangeContent.call(this) }}>Change Content</button>
<button onClick={() => { this.onBtnLog.call(this) }}>Log</button>
</div>
</div>
</div>
</div>
</div>
);
}
}
@@ -1,32 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Line" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="702px" height="468px" viewBox="0 0 702 468" enable-background="new 0 0 702 468" xml:space="preserve">
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="1.9951" y1="234" x2="700.0049" y2="234">
<stop offset="0" style="stop-color:#36BEFD"/>
<stop offset="1" style="stop-color:#6461F6"/>
</linearGradient>
<path fill="none" stroke="url(#SVGID_1_)" stroke-width="48" stroke-linecap="round" stroke-miterlimit="10" d="M234.014,337.502
c-9.188,0-18.292-1.193-27.057-3.545c-13.539-3.633-26.531-10.188-37.572-18.955c-10.933-8.682-20.222-19.736-26.863-31.969
c-6.813-12.549-11.024-26.725-12.18-40.996c-1.188-14.668,0.756-29.659,5.62-43.355c4.671-13.151,12.186-25.547,21.73-35.847
c9.515-10.269,21.266-18.694,33.982-24.368c13.146-5.865,27.781-8.966,42.325-8.966c3.586,0,7.203,0.184,10.75,0.547
c14.193,1.452,28.242,5.949,40.627,13.003c12.096,6.889,22.958,16.396,31.414,27.495c8.555,11.229,14.85,24.37,18.203,38.003
c3.509,14.265,3.951,29.467,1.278,43.964c-2.561,13.884-8.109,27.427-16.047,39.163c-7.806,11.541-18.112,21.643-29.805,29.211
c-11.912,7.709-25.592,12.986-39.562,15.258C245.323,337.045,239.656,337.502,234.014,337.502
C234.014,337.502,234.014,337.502,234.014,337.502z M570.998,338h-6.215h-26.65H500.59h-39.085h-31.278h-14.12
c-14.94,0-29.099,6.24-38.846,17.121c-12.376,13.813-16.449,33.305-10.63,50.865c6.084,18.361,22.291,32.152,41.292,35.137
c3.765,0.59,7.247,0.877,10.646,0.877h21.281h35.12h39.608h34.746h20.533c4.154,0,7.918-0.318,11.725-0.674
c11.898-1.107,23.729-4.436,35.166-9.893c21.475-10.246,38.934-27.695,49.156-49.133c10.625-22.271,12.957-47.695,6.57-71.588
c-6.066-22.697-19.951-42.912-39.094-56.922c-17.434-12.762-39.299-19.79-61.566-19.79h-19.836h-37.801h-34.63h-0.238
c-0.064,0-0.128,0-0.192,0c-7.594,0-14.766-0.01-20.863-1.207c-13.334-2.618-25.441-10.797-33.215-22.437
c-3.901-5.841-6.721-12.783-8.154-20.074c-1.492-7.591-0.939-15.579,1.642-23.742c4.497-14.223,14.729-25.905,28.074-32.053
c6.373-2.936,13.886-4.487,21.729-4.487h3.353h22.485h35.71h39.555h34.021h19.109c6.848,0,13.436-1.16,19.578-3.448
c16.672-6.206,29.244-20.975,32.814-38.542c3.609-17.757-2.477-36.397-15.879-48.646C649.65,30.746,637.154,26,623.891,26h-6.633
h-15.867h-23.605h-29.85h-34.594h-37.846h-39.599h-39.858h-38.619h-35.885h-31.655H263.95h-18.707h-9.988
c-13.158,0-23.905,0.728-33.822,2.288c-20.802,3.273-40.457,9.37-58.42,18.12c-18.023,8.778-34.679,20.118-49.506,33.705
c-14.775,13.541-27.499,29.094-37.814,46.228c-10.511,17.454-18.368,36.299-23.354,56.01c-5.159,20.397-7.188,41.485-6.027,62.679
c1.14,20.832,5.375,41.268,12.586,60.732c7.001,18.898,16.719,36.666,28.885,52.811c12.035,15.973,26.277,30.115,42.335,42.037
c16.245,12.059,34.087,21.652,53.04,28.514c19.537,7.074,39.766,11.68,60.63,12.662c3.03,0.145,6.092,0.215,9.211,0.215
c6.56,0,13.266-0.314,20.096-0.945c6.583-0.607,12.544-1.428,18.352-2.508c3.41-0.633,6.481-1.338,9.647-2.152"/>
</svg>

Before

Width:  |  Height:  |  Size: 3.2 KiB

@@ -1,48 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Ebene_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="890.053px" height="792.629px" viewBox="515.064 141.508 890.053 792.629"
enable-background="new 515.064 141.508 890.053 792.629" xml:space="preserve">
<g>
<path fill="#61DAFB" d="M1405.116,537.914c0-58.962-73.838-114.84-187.045-149.491c26.125-115.384,14.514-207.183-36.646-236.573
c-11.793-6.894-25.581-10.16-40.639-10.16v40.457c8.346,0,15.058,1.633,20.682,4.717c24.674,14.151,35.377,68.033,27.032,137.335
c-1.995,17.054-5.262,35.015-9.253,53.338c-35.559-8.708-74.383-15.421-115.202-19.774c-24.491-33.563-49.891-64.042-75.471-90.711
c59.143-54.971,114.658-85.086,152.394-85.086v-40.457c-49.891,0-115.202,35.559-181.24,97.242
c-66.037-61.32-131.349-96.516-181.239-96.516v40.457c37.554,0,93.251,29.935,152.394,84.542
c-25.398,26.669-50.798,56.966-74.927,90.529c-41.001,4.354-79.825,11.066-115.384,19.956c-4.173-18.142-7.257-35.74-9.434-52.612
c-8.527-69.303,1.995-123.185,26.487-137.517c5.442-3.266,12.518-4.717,20.863-4.717v-40.457c-15.239,0-29.027,3.266-41.001,10.16
c-50.979,29.39-62.409,121.008-36.104,236.029c-112.844,34.832-186.319,90.528-186.319,149.31
c0,58.962,73.839,114.839,187.046,149.49c-26.125,115.384-14.514,207.184,36.646,236.573c11.793,6.895,25.58,10.16,40.82,10.16
c49.891,0,115.202-35.559,181.239-97.242c66.037,61.32,131.349,96.517,181.24,96.517c15.239,0,29.027-3.266,41.001-10.16
c50.979-29.391,62.408-121.008,36.103-236.029C1331.642,652.571,1405.117,596.694,1405.116,537.914L1405.116,537.914z
M1168.906,416.906c-6.713,23.402-15.058,47.532-24.491,71.661c-7.438-14.514-15.24-29.027-23.767-43.541
c-8.346-14.514-17.235-28.665-26.125-42.453C1120.285,406.384,1145.14,411.101,1168.906,416.906L1168.906,416.906z
M1085.815,610.119c-14.15,24.492-28.664,47.714-43.723,69.303c-27.031,2.358-54.426,3.629-82.002,3.629
c-27.395,0-54.789-1.271-81.64-3.447c-15.058-21.589-29.753-44.63-43.904-68.939c-13.788-23.767-26.306-47.896-37.735-72.206
c11.248-24.311,23.947-48.621,37.555-72.387c14.15-24.492,28.664-47.714,43.723-69.304c27.031-2.358,54.426-3.628,82.002-3.628
c27.395,0,54.789,1.27,81.64,3.447c15.058,21.589,29.753,44.629,43.903,68.939c13.788,23.767,26.307,47.896,37.736,72.206
C1111.94,562.043,1099.422,586.354,1085.815,610.119L1085.815,610.119z M1144.415,586.534
c9.796,24.311,18.142,48.621,25.035,72.206c-23.766,5.806-48.802,10.704-74.745,14.514c8.89-13.97,17.779-28.302,26.125-42.997
C1129.175,615.743,1136.976,601.048,1144.415,586.534z M960.454,780.111c-16.873-17.417-33.745-36.829-50.436-58.055
c16.328,0.726,33.019,1.27,49.891,1.27c17.054,0,33.926-0.363,50.436-1.27C994.017,743.282,977.145,762.694,960.454,780.111z
M825.477,673.254c-25.763-3.81-50.617-8.527-74.383-14.332c6.712-23.403,15.058-47.532,24.491-71.662
c7.438,14.514,15.24,29.027,23.767,43.542C807.878,645.315,816.587,659.466,825.477,673.254z M959.546,295.716
c16.873,17.417,33.745,36.829,50.436,58.055c-16.328-0.726-33.019-1.271-49.891-1.271c-17.054,0-33.926,0.363-50.436,1.271
C925.983,332.545,942.855,313.133,959.546,295.716z M825.295,402.573c-8.89,13.97-17.779,28.302-26.125,42.997
c-8.345,14.514-16.146,29.027-23.585,43.541c-9.796-24.311-18.142-48.621-25.035-72.206
C774.315,411.281,799.352,406.383,825.295,402.573L825.295,402.573z M661.108,629.713
c-64.223-27.395-105.769-63.316-105.769-91.799c0-28.483,41.546-64.586,105.769-91.8c15.603-6.712,32.656-12.699,50.254-18.323
c10.341,35.559,23.947,72.568,40.82,110.485c-16.691,37.735-30.116,74.564-40.276,109.941
C693.946,642.594,676.893,636.426,661.108,629.713L661.108,629.713z M758.713,888.964c-24.673-14.151-35.377-68.033-27.031-137.336
c1.995-17.054,5.261-35.015,9.252-53.338c35.559,8.708,74.383,15.421,115.203,19.774c24.491,33.563,49.891,64.042,75.471,90.711
c-59.144,54.971-114.658,85.087-152.394,85.087C771.05,893.681,764.156,892.048,758.713,888.964L758.713,888.964z
M1189.044,750.721c8.527,69.303-1.995,123.185-26.487,137.518c-5.442,3.266-12.519,4.717-20.863,4.717
c-37.554,0-93.251-29.935-152.394-84.543c25.398-26.669,50.798-56.966,74.927-90.528c41.001-4.354,79.825-11.067,115.384-19.957
C1183.783,716.251,1187.049,733.849,1189.044,750.721z M1258.892,629.713c-15.603,6.713-32.656,12.699-50.254,18.323
c-10.341-35.559-23.947-72.568-40.82-110.485c16.691-37.735,30.116-74.564,40.276-109.941c17.96,5.624,35.014,11.793,50.979,18.505
c64.223,27.395,105.768,63.316,105.768,91.8C1364.66,566.396,1323.114,602.5,1258.892,629.713L1258.892,629.713z"/>
<circle fill="#61DAFB" cx="959.909" cy="537.914" r="82.91"/>
<path fill="#61DAFB" d="M1140.604,141.69"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 4.7 KiB

@@ -1,11 +0,0 @@
html, body {
margin: 0;
padding: 0;
font-family: sans-serif;
font-size: 11pt;
color: #31485B;
box-sizing: border-box;
}
* {
box-sizing: inherit;
}
@@ -1,16 +0,0 @@
import 'overlayscrollbars/css/OverlayScrollbars.css';
import './index.css';
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import * as serviceWorker from './serviceWorker';
import OverlayScrollbars from 'overlayscrollbars';
ReactDOM.render(<App />, document.getElementById('root'));
serviceWorker.unregister();
OverlayScrollbars(document.body, {
nativeScrollbarsOverlaid: {
initialize: false
}
});
@@ -1 +0,0 @@
/// <reference types="react-scripts" />
@@ -1,143 +0,0 @@
// This optional code is used to register a service worker.
// register() is not called by default.
// This lets the app load faster on subsequent visits in production, and gives
// it offline capabilities. However, it also means that developers (and users)
// will only see deployed updates on subsequent visits to a page, after all the
// existing tabs open on the page have been closed, since previously cached
// resources are updated in the background.
// To learn more about the benefits of this model and instructions on how to
// opt-in, read https://bit.ly/CRA-PWA
const isLocalhost = Boolean(
window.location.hostname === 'localhost' ||
// [::1] is the IPv6 localhost address.
window.location.hostname === '[::1]' ||
// 127.0.0.1/8 is considered localhost for IPv4.
window.location.hostname.match(
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
)
);
type Config = {
onSuccess?: (registration: ServiceWorkerRegistration) => void;
onUpdate?: (registration: ServiceWorkerRegistration) => void;
};
export function register(config?: Config) {
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
// The URL constructor is available in all browsers that support SW.
const publicUrl = new URL(
(process as { env: { [key: string]: string } }).env.PUBLIC_URL,
window.location.href
);
if (publicUrl.origin !== window.location.origin) {
// Our service worker won't work if PUBLIC_URL is on a different origin
// from what our page is served on. This might happen if a CDN is used to
// serve assets; see https://github.com/facebook/create-react-app/issues/2374
return;
}
window.addEventListener('load', () => {
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
if (isLocalhost) {
// This is running on localhost. Let's check if a service worker still exists or not.
checkValidServiceWorker(swUrl, config);
// Add some additional logging to localhost, pointing developers to the
// service worker/PWA documentation.
navigator.serviceWorker.ready.then(() => {
console.log(
'This web app is being served cache-first by a service ' +
'worker. To learn more, visit https://bit.ly/CRA-PWA'
);
});
} else {
// Is not localhost. Just register service worker
registerValidSW(swUrl, config);
}
});
}
}
function registerValidSW(swUrl: string, config?: Config) {
navigator.serviceWorker
.register(swUrl)
.then(registration => {
registration.onupdatefound = () => {
const installingWorker = registration.installing;
if (installingWorker == null) {
return;
}
installingWorker.onstatechange = () => {
if (installingWorker.state === 'installed') {
if (navigator.serviceWorker.controller) {
// At this point, the updated precached content has been fetched,
// but the previous service worker will still serve the older
// content until all client tabs are closed.
console.log(
'New content is available and will be used when all ' +
'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
);
// Execute callback
if (config && config.onUpdate) {
config.onUpdate(registration);
}
} else {
// At this point, everything has been precached.
// It's the perfect time to display a
// "Content is cached for offline use." message.
console.log('Content is cached for offline use.');
// Execute callback
if (config && config.onSuccess) {
config.onSuccess(registration);
}
}
}
};
};
})
.catch(error => {
console.error('Error during service worker registration:', error);
});
}
function checkValidServiceWorker(swUrl: string, config?: Config) {
// Check if the service worker can be found. If it can't reload the page.
fetch(swUrl)
.then(response => {
// Ensure service worker exists, and that we really are getting a JS file.
const contentType = response.headers.get('content-type');
if (
response.status === 404 ||
(contentType != null && contentType.indexOf('javascript') === -1)
) {
// No service worker found. Probably a different app. Reload the page.
navigator.serviceWorker.ready.then(registration => {
registration.unregister().then(() => {
window.location.reload();
});
});
} else {
// Service worker found. Proceed as normal.
registerValidSW(swUrl, config);
}
})
.catch(() => {
console.log(
'No internet connection found. App is running in offline mode.'
);
});
}
export function unregister() {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready.then(registration => {
registration.unregister();
});
}
}
@@ -1,25 +0,0 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve",
"strict": false
},
"include": [
"src"
]
}
File diff suppressed because it is too large Load Diff
@@ -1,52 +0,0 @@
{
"name": "overlayscrollbars-react",
"version": "0.2.2",
"description": "OverlayScrollbars wrapper for React.",
"keywords": [
"overlayscrollbars",
"react"
],
"files": [
"src",
"dist"
],
"homepage": "https://kingsora.github.io/OverlayScrollbars",
"repository": {
"type": "git",
"url": "https://github.com/KingSora/OverlayScrollbars"
},
"bugs": {
"url": "https://github.com/KingSora/OverlayScrollbars/issues"
},
"main": "./dist/overlayscrollbars-react.js",
"module": "./dist/overlayscrollbars-react.esm.js",
"typings": "./dist/types/index.d.ts",
"author": "KingSora | Rene Haas",
"license": "MIT",
"devDependencies": {
"@types/overlayscrollbars": "^1.9.0",
"@types/react": "^16.9.27",
"chalk": "^2.4.2",
"gulp": "^4.0.2",
"gulp-json-editor": "^2.5.4",
"overlayscrollbars": "^1.11.0",
"react": "^16.13.1",
"rollup": "^1.32.1",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-typescript2": "^0.22.0",
"shelljs": "^0.8.3",
"typescript": "^3.8.3"
},
"peerDependencies": {
"react": "^16.4.0",
"overlayscrollbars": "^1.10.0"
},
"scripts": {
"setup": "npm i && cd example && npm i && cd ..",
"build": "node build.js",
"example": "cd example && npm start",
"build-example": "cd example && npm run build",
"test": "echo \"Error: no test specified\" && exit 1"
}
}
@@ -1,95 +0,0 @@
import React, { Component, RefObject } from 'react';
import OverlayScrollbars from "overlayscrollbars";
export interface OverlayScrollbarsComponentProps extends React.HTMLAttributes<HTMLDivElement> {
children?: any;
options?: OverlayScrollbars.Options;
extensions?: OverlayScrollbars.Extensions;
}
export interface OverlayScrollbarsComponentState { }
export class OverlayScrollbarsComponent extends Component<OverlayScrollbarsComponentProps, OverlayScrollbarsComponentState> {
private _osInstance: OverlayScrollbars | null = null;
private _osTargetRef: RefObject<HTMLDivElement>;
constructor(props: OverlayScrollbarsComponentProps) {
super(props);
this._osTargetRef = React.createRef();
}
osInstance(): OverlayScrollbars | null {
return this._osInstance;
}
osTarget(): HTMLDivElement | null {
return this._osTargetRef.current || null;
}
componentDidMount() {
this._osInstance = OverlayScrollbars(this.osTarget(), this.props.options || {}, this.props.extensions);
mergeHostClassNames(this._osInstance, this.props.className);
}
componentWillUnmount() {
if (OverlayScrollbars.valid(this._osInstance)) {
this._osInstance.destroy();
this._osInstance = null;
}
}
componentDidUpdate(prevProps: OverlayScrollbarsComponentProps) {
if (OverlayScrollbars.valid(this._osInstance)) {
this._osInstance.options(this.props.options);
if (prevProps.className !== this.props.className) {
mergeHostClassNames(this._osInstance, this.props.className);
}
}
}
render() {
const {
options,
extensions,
children,
className,
...divProps
} = this.props;
return (
<div className="os-host" {...divProps} ref={this._osTargetRef}>
<div className="os-resize-observer-host"></div>
<div className="os-padding">
<div className="os-viewport">
<div className="os-content">
{this.props.children}
</div>
</div>
</div>
<div className="os-scrollbar os-scrollbar-horizontal ">
<div className="os-scrollbar-track">
<div className="os-scrollbar-handle"></div>
</div>
</div>
<div className="os-scrollbar os-scrollbar-vertical">
<div className="os-scrollbar-track">
<div className="os-scrollbar-handle"></div>
</div>
</div>
<div className="os-scrollbar-corner"></div>
</div>
);
}
}
function mergeHostClassNames(osInstance: OverlayScrollbars, className: string) {
if (OverlayScrollbars.valid(osInstance)) {
const { host } = osInstance.getElements();
const regex = new RegExp(`(^os-host([-_].+|)$)|${osInstance.options().className.replace(/\s/g, "$|")}$`, 'g');
const osClassNames = host.className.split(' ')
.filter(name => name.match(regex))
.join(' ');
host.className = `${osClassNames} ${className || ''}`;
}
}
@@ -1 +0,0 @@
export * from './OverlayScrollbarsComponent';
@@ -1,34 +0,0 @@
{
"compilerOptions": {
"allowJs": false,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"baseUrl": "./",
"outDir": "./dist",
"target": "es5",
"sourceMap": true,
"inlineSources": true,
"jsx": "react",
"lib": [
"es6",
"dom",
"es2016",
"es2017"
],
"declaration": true,
"declarationDir": "./dist/types",
"noImplicitAny": true,
"noImplicitThis": true,
"module": "es2015",
"moduleResolution": "node",
"removeComments": true
},
"include": [
"./src"
],
"exclude": [
"./dist",
"./example",
"node_modules"
]
}