add overlayscrollbars-react package

This commit is contained in:
Rene Haas
2022-10-20 13:41:50 +02:00
parent 3f1d8bc8d3
commit 2b02daa3ac
22 changed files with 23241 additions and 216 deletions
+7056 -176
View File
File diff suppressed because it is too large Load Diff
+6 -3
View File
@@ -53,16 +53,19 @@
},
"scripts": {
"test": "npm run test --workspace=overlayscrollbars",
"test:ngx": "npm run test --workspace=overlayscrollbars-ngx",
"test:react": "npm run test --workspace=overlayscrollbars-react",
"test:vue": "npm run test --workspace=overlayscrollbars-vue",
"test:ngx": "npm run test --workspace=overlayscrollbars-ngx",
"jest": "npm run jest --workspace=overlayscrollbars",
"playwright": "npm run playwright --workspace=overlayscrollbars",
"playwright:dev": "npm run test:playwright:dev --workspace=overlayscrollbars",
"build": "npm run build --workspace=overlayscrollbars",
"build:ngx": "npm run build --workspace=overlayscrollbars-ngx",
"build:react": "npm run build --workspace=overlayscrollbars-react",
"build:vue": "npm run build --workspace=overlayscrollbars-vue",
"example:ngx": "npm run build:ngx && cd examples/overlayscrollbars-ngx && npm i --install-links && npm run start",
"build:ngx": "npm run build --workspace=overlayscrollbars-ngx",
"example:react": "npm run build:react && cd examples/overlayscrollbars-react && npm i --install-links && npm run dev",
"example:vue": "npm run build:vue && cd examples/overlayscrollbars-vue && npm i --install-links && npm run dev",
"example:ngx": "npm run build:ngx && cd examples/overlayscrollbars-ngx && npm i --install-links && npm run start",
"lint": "eslint ./packages/**/{src,test}/**/*.{js,jsx,ts,tsx}",
"lint:fix": "eslint --fix ./packages/**/{src,test}/**/*.{js,jsx,ts,tsx}",
"prettier": "prettier --check ./packages/**/{src,test}/**/*.{js,jsx,ts,tsx}",
@@ -0,0 +1,8 @@
# Compiled output
/dist
# Node
/node_modules
# Miscellaneous
/.coverage
@@ -0,0 +1,46 @@
# Getting Started with Create React App
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.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.\
You will also see any lint errors in the console.
### `npm test`
Launches the test runner in the interactive watch mode.\
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.\
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.\
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/).
@@ -0,0 +1 @@
module.exports = require('@~local/config/jest-babel');
@@ -0,0 +1,7 @@
/** @type {import('jest').Config} */
module.exports = {
coverageDirectory: './.coverage',
testEnvironment: 'jsdom',
testMatch: ['**/test/**/*.test.[jt]s?(x)'],
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
};
@@ -0,0 +1 @@
import '@testing-library/jest-dom';
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,49 @@
{
"name": "overlayscrollbars-react",
"private": true,
"version": "0.4.0",
"files": [
"src",
"dist",
"README.md"
],
"main": "./dist/overlayscrollbars-react.umd.js",
"module": "./dist/overlayscrollbars-react.es.js",
"types": "./dist/overlayscrollbars-react.d.ts",
"exports": {
".": {
"require": "./dist/overlayscrollbars-react.umd.js",
"import": "./dist/overlayscrollbars-react.es.js",
"types": "./dist/overlayscrollbars-react.d.ts"
}
},
"peerDependencies": {
"react": ">=16.4.0"
},
"devDependencies": {
"@babel/preset-env": "^7.19.4",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.5.2",
"@types/node": "^16.11.68",
"@types/react": "^18.0.21",
"@types/react-dom": "^18.0.6",
"@vitejs/plugin-react": "^2.1.0",
"babel-jest": "^29.2.1",
"jest": "^27.5.1",
"npm-run-all": "^4.1.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"typescript": "^4.8.4",
"vite": "^3.1.8"
},
"scripts": {
"build": "run-p build-js build-types",
"build-js": "vite build",
"build-types": "tsc --emitDeclarationOnly -p tsconfig.types.json",
"test": "jest"
}
}
@@ -0,0 +1,24 @@
export interface OverlayScrollbarsComponentsProps {
msg: string;
}
export const OverlayScrollbarsComponents = (
props: OverlayScrollbarsComponentsProps
) => {
const { msg } = props;
return (
<div className="App">
<header className="App-header">
<p>{msg}</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
);
};
@@ -0,0 +1 @@
export * from './OverlayScrollbarsComponent';
@@ -0,0 +1,9 @@
import React from "react";
import { render, screen } from "@testing-library/react";
import { OverlayScrollbarsComponents } from "../src/overlayscrollbars-react";
test("renders learn react link", () => {
render(<OverlayScrollbarsComponents msg="hi" />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"target": "ES6",
"allowSyntheticDefaultImports": true,
"lib": ["dom", "dom.iterable", "esnext"],
"strict": true,
"module": "ES2015",
"moduleResolution": "node",
"jsx": "react-jsx"
},
"include": ["src/**/*"]
}
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"rootDir": "./src/",
"outDir": "dist",
"declaration": true,
"types": ["react"]
}
}
@@ -0,0 +1,30 @@
import { resolve } from 'node:path';
import { fileURLToPath, URL } from 'node:url';
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
export default defineConfig({
build: {
lib: {
entry: resolve(__dirname, 'src/overlayscrollbars-react.ts'),
name: 'OverlayScrollbarsReact',
fileName: (format) => `overlayscrollbars-react.${format}.js`,
},
rollupOptions: {
external: ['react'],
output: {
sourcemap: true,
dir: 'dist',
globals: {
react: 'React',
},
},
},
},
resolve: {
alias: {
'~': fileURLToPath(new URL('./src', import.meta.url)),
},
},
plugins: [react({ jsxRuntime: 'classic' })],
});
+6 -25
View File
@@ -1,27 +1,8 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
# Compiled output
/dist
node_modules
.DS_Store
dist
dist-ssr
*.local
# Node
/node_modules
/cypress/videos/
/cypress/screenshots/
# Editor directories and files
.vscode
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# Miscellaneous
/.coverage
+6 -6
View File
@@ -17,12 +17,6 @@
"types": "./dist/overlayscrollbars-vue.d.ts"
}
},
"scripts": {
"build": "run-p build-js build-types",
"test": "vitest --environment jsdom",
"build-js": "vite build",
"build-types": "vue-tsc --emitDeclarationOnly -p tsconfig.types.json --composite false"
},
"peerDependencies": {
"vue": "^3.2.25"
},
@@ -40,5 +34,11 @@
"vitest": "^0.18.1",
"vue": "^3.2.25",
"vue-tsc": "^1.0.8"
},
"scripts": {
"build": "run-p build-js build-types",
"test": "vitest --environment jsdom",
"build-js": "vite build",
"build-types": "vue-tsc --emitDeclarationOnly -p tsconfig.types.json --composite false"
}
}
@@ -1 +1 @@
export { default as OverlayScrollbarsComponent } from './overlayscrollbars.vue';
export { default as OverlayScrollbarsComponent } from './OverlayScrollbarsComponent.vue';
@@ -1,6 +1,6 @@
import { describe, it, expect } from 'vitest';
import { mount } from '@vue/test-utils';
import OverlayScrollbarsComponent from '~/overlayscrollbars.vue';
import OverlayScrollbarsComponent from '~/OverlayScrollbarsComponent.vue';
describe('OverlayScrollbarsComponent', () => {
it('renders properly', () => {
+2 -2
View File
@@ -1,10 +1,10 @@
{
"extends": "@vue/tsconfig/tsconfig.web.json",
"compilerOptions": {
"composite": true,
"baseUrl": ".",
"paths": {
"~/*": ["./src/*"]
}
}
},
"include": ["src/**/*"]
}
@@ -1,10 +1,9 @@
{
"extends": "./tsconfig.json",
"include": ["src/**/*"],
"compilerOptions": {
"rootDir": "./src/",
"outDir": "dist",
"declaration": true,
"composite": true,
"types": []
}
}