Skip to content

Commit 3037181

Browse files
authored
Added React 19 compability and Tree shaking support (#40)
1 parent 74b2d3b commit 3037181

File tree

48 files changed

+2047
-8542
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2047
-8542
lines changed

.storybook/main.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
1-
import type { StorybookConfig } from '@storybook/react-webpack5';
1+
import type { StorybookConfig } from '@storybook/react-vite'
22

33
const config: StorybookConfig = {
44
framework: {
5-
name: '@storybook/react-webpack5',
6-
options: {
7-
builder: {
8-
useSWC: true,
9-
},
10-
},
5+
name: '@storybook/react-vite',
6+
options: {},
117
},
128

139
stories: [`${process.cwd()}/stories/**/*.stories.@(js|tsx)`],
14-
addons: ['@storybook/addon-essentials', '@storybook/addon-links', '@storybook/preset-scss', '@storybook/addon-webpack5-compiler-swc'],
15-
16-
docs: {
17-
autodocs: false,
18-
},
10+
addons: ['@storybook/addon-links'],
1911
};
2012

2113
export default config;

.swcrc

Lines changed: 0 additions & 19 deletions
This file was deleted.

__mocks__/fileMock.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

babel.config.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

jest.config.ts

Lines changed: 0 additions & 29 deletions
This file was deleted.

jest.setup.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

package.json

Lines changed: 36 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,32 @@
22
"name": "react-linear-gradient-picker",
33
"version": "4.0.0",
44
"description": "React linear gradient picker",
5-
"main": "dist/index.js",
6-
"types": "dist/src/index.d.ts",
5+
"module": "./dist/index.mjs",
6+
"main": "./dist/index.js",
7+
"types": "./dist/index.d.ts",
8+
"files": [
9+
"dist"
10+
],
11+
"exports": {
12+
".": {
13+
"types": "./dist/index.d.ts",
14+
"import": "./dist/index.mjs",
15+
"require": "./dist/index.js"
16+
},
17+
"./index.css": "./dist/index.css",
18+
"./package.json": "./package.json",
19+
"./dist/*": "./dist/*"
20+
},
721
"scripts": {
822
"storybook": "storybook dev -p 7006",
923
"build-storybook": "storybook build",
10-
"test": "jest",
11-
"test:watch": "jest --watch",
24+
"test": "vitest run",
25+
"test:watch": "vitest",
1226
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
1327
"lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
1428
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md,scss}\"",
1529
"fix": "yarn format && yarn lint:fix",
16-
"build": "rspack build",
30+
"build": "vite build",
1731
"typecheck": "tsc --noEmit",
1832
"ci": "yarn lint && yarn typecheck && yarn test && yarn build",
1933
"deploy-storybook": "storybook-to-ghpages",
@@ -35,59 +49,41 @@
3549
},
3650
"homepage": "https://github.com/odedglas/react-linear-gradient-picker#readme",
3751
"peerDependencies": {
38-
"react": "^16.9.0 || ^17.0.0 || ^18.0.0",
39-
"react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0"
52+
"react": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
53+
"react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
4054
},
4155
"devDependencies": {
42-
"@babel/core": "^7.18.0",
43-
"@babel/plugin-transform-runtime": "^7.18.0",
44-
"@babel/preset-env": "^7.18.0",
45-
"@babel/preset-react": "^7.17.0",
46-
"@babel/preset-typescript": "^7.23.3",
47-
"@rspack/cli": "^1.2.8",
48-
"@rspack/core": "^1.2.8",
49-
"@storybook/addon-essentials": "^7.6.17",
50-
"@storybook/addon-links": "^7.6.17",
51-
"@storybook/addon-webpack5-compiler-swc": "^3.0.0",
52-
"@storybook/cli": "^7.6.17",
53-
"@storybook/preset-scss": "^1.0.3",
54-
"@storybook/react": "^7.6.17",
55-
"@storybook/react-webpack5": "^7.6.17",
56+
"@storybook/addon-links": "^9.1.5",
57+
"@storybook/react-vite": "^9.1.5",
5658
"@storybook/storybook-deployer": "^2.8.1",
57-
"@swc/helpers": "^0.5.3",
58-
"@testing-library/jest-dom": "^6.1.5",
59-
"@testing-library/react": "^14.1.2",
60-
"@testing-library/user-event": "^14.5.1",
61-
"@types/jest": "^29.5.12",
59+
"@testing-library/dom": "^10.4.1",
60+
"@testing-library/jest-dom": "^6.8.0",
61+
"@testing-library/react": "^16.3.0",
62+
"@testing-library/user-event": "^14.6.1",
6263
"@types/node": "^22.13.14",
6364
"@types/react": "^19.0.12",
6465
"@types/react-color": "^3.0.13",
6566
"@types/react-dom": "^19.0.4",
6667
"@typescript-eslint/eslint-plugin": "^8.28.0",
6768
"@typescript-eslint/parser": "^8.28.0",
68-
"babel-jest": "^29.7.0",
69-
"classnames": "^2.3.1",
70-
"css-loader": "^6.7.1",
69+
"@vitejs/plugin-react": "^4.6.0",
7170
"eslint": "^8.57.0",
7271
"eslint-config-prettier": "^9.1.0",
7372
"eslint-plugin-import": "^2.29.1",
7473
"eslint-plugin-react": "^7.34.0",
7574
"eslint-plugin-react-hooks": "^4.6.0",
76-
"identity-obj-proxy": "^3.0.0",
77-
"jest": "^29.7.0",
78-
"jest-environment-jsdom": "^29.7.0",
75+
"jsdom": "^26.1.0",
7976
"prettier": "^3.2.5",
80-
"prop-types": "^15.7.2",
8177
"rc-color-picker": "^1.1.5",
8278
"react": "^18.2.0",
8379
"react-color": "^2.12.0",
8480
"react-dom": "^18.2.0",
8581
"sass": "^1.52.1",
86-
"sass-loader": "^8.0.2",
87-
"storybook": "^7.6.17",
88-
"style-loader": "^1.0.0",
89-
"svg-url-loader": "^3.0.2",
90-
"ts-node": "^10.9.2",
91-
"typescript": "^5.8.2"
92-
}
82+
"storybook": "^9.1.5",
83+
"typescript": "^5.8.2",
84+
"vite": "^7.1.5",
85+
"vite-plugin-dts": "^4.5.4",
86+
"vitest": "^3.2.4"
87+
},
88+
"packageManager": "[email protected]+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
9389
}

rspack.config.js

Lines changed: 0 additions & 72 deletions
This file was deleted.

src/components/ColorPicker/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Color } from './types';
1+
import type { Color } from './types';
22

33
export const COLORS: Color[] = [
44
{ value: '#000000', name: 'black' },

src/components/ColorPicker/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { COLORS } from './constants';
3-
import { ColorPickerProps } from './types';
3+
import type { ColorPickerProps } from './types';
44
import './index.scss';
55

66
const ColorPicker: React.FC<ColorPickerProps> = ({ onSelect }) => (

0 commit comments

Comments
 (0)