Skip to content

Commit a8e38ff

Browse files
richard smithcolinrotherham
authored andcommitted
updating compoment library to react 19
1 parent d270b8e commit a8e38ff

File tree

120 files changed

+6565
-5650
lines changed

Some content is hidden

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

120 files changed

+6565
-5650
lines changed

.eslintignore

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

.eslintrc.js

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

.storybook/main.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,29 @@ import tsConfigPaths from 'vite-tsconfig-paths';
44

55
const config: StorybookConfig = {
66
stories: ['../stories/**/*.stories.@(ts|tsx)', '../stories/**/*.mdx'],
7-
addons: ['@storybook/addon-links', '@storybook/addon-essentials'],
7+
addons: ['@storybook/addon-links', '@storybook/addon-docs'],
88
framework: {
99
name: '@storybook/react-vite',
1010
options: {},
1111
},
12-
docs: {
13-
autodocs: true,
14-
},
12+
1513
typescript: {
1614
reactDocgen: 'react-docgen-typescript',
1715
},
16+
1817
viteFinal(config) {
1918
return mergeConfig(config, {
2019
plugins: [tsConfigPaths()],
20+
css: {
21+
preprocessorOptions: {
22+
scss: {
23+
quietDeps: true,
24+
loadPaths: ['node_modules'],
25+
},
26+
},
27+
},
2128
});
2229
},
2330
};
31+
2432
export default config;

.storybook/manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { addons } from '@storybook/manager-api';
1+
import { addons } from 'storybook/manager-api';
22
import nhsTheme from './theme';
33
import { startCase, upperFirst } from 'lodash';
44

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import './storybook.scss';
2-
import { Preview } from '@storybook/react';
2+
import { Preview } from '@storybook/react-vite';
33

44
const preview: Preview = {
55
parameters: {
@@ -18,5 +18,7 @@ const preview: Preview = {
1818
},
1919
},
2020
},
21+
22+
tags: ['autodocs']
2123
};
2224
export default preview;

.storybook/storybook.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// Allow current nhsuk styles to override legacy
2-
@import 'nhsuk-frontend/dist/nhsuk';
1+
@forward 'nhsuk-frontend/dist/nhsuk';
32

43
.tag-wrapper {
54
display: flex;

.storybook/theme.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
import { create } from '@storybook/theming/create';
2-
const version = require('../package.json').version;
1+
import { create } from 'storybook/theming/create';
2+
import packageJson from '../package.json' assert { type: 'json' };
3+
4+
const version = packageJson.version;
5+
36

47
export default create({
58
base: 'light',

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
"eslint.alwaysShowStatus": true,
1414
"eslint.workingDirectories": ["src"],
1515
"typescript.tsdk": "node_modules/typescript/lib"
16-
}
16+
}

eslint.config.mjs

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import js from '@eslint/js';
2+
import typescript from '@typescript-eslint/eslint-plugin';
3+
import typescriptParser from '@typescript-eslint/parser';
4+
import react from 'eslint-plugin-react';
5+
import reactHooks from 'eslint-plugin-react-hooks';
6+
import jsxA11y from 'eslint-plugin-jsx-a11y';
7+
import importPlugin from 'eslint-plugin-import';
8+
import storybook from 'eslint-plugin-storybook';
9+
import globals from 'globals';
10+
11+
export default [
12+
js.configs.recommended,
13+
{
14+
ignores: ['jest.config.js', '.eslintrc.js', 'rollup.config.mjs', 'dist/**/*'],
15+
},
16+
{
17+
files: ['src/**/*.{js,ts,tsx}', 'stories/**/*.{js,ts,tsx}'],
18+
languageOptions: {
19+
parser: typescriptParser,
20+
parserOptions: {
21+
project: './tsconfig.json',
22+
ecmaFeatures: {
23+
jsx: true,
24+
},
25+
},
26+
globals: {
27+
...globals.browser,
28+
...globals.jest,
29+
...globals.node,
30+
},
31+
},
32+
plugins: {
33+
'@typescript-eslint': typescript,
34+
react,
35+
'react-hooks': reactHooks,
36+
'jsx-a11y': jsxA11y,
37+
import: importPlugin,
38+
storybook,
39+
},
40+
settings: {
41+
'import/resolver': {
42+
typescript: {
43+
project: './tsconfig.json',
44+
},
45+
},
46+
react: {
47+
version: 'detect',
48+
},
49+
},
50+
rules: {
51+
...typescript.configs.recommended.rules,
52+
...react.configs.recommended.rules,
53+
...reactHooks.configs.recommended.rules,
54+
...jsxA11y.configs.recommended.rules,
55+
'react/prop-types': 0,
56+
'react/react-in-jsx-scope': 0,
57+
'jsx-a11y/anchor-has-content': 0,
58+
'jsx-a11y/alt-text': 0,
59+
'jsx-a11y/heading-has-content': 0,
60+
'react-hooks/exhaustive-deps': 0,
61+
'no-redeclare': 'off',
62+
},
63+
},
64+
{
65+
files: ['*.stories.tsx'],
66+
rules: {
67+
'@typescript-eslint/no-unused-vars': 'off',
68+
},
69+
},
70+
];

package.json

Lines changed: 70 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -9,88 +9,106 @@
99
"lib"
1010
],
1111
"main": "dist/cjs/index.js",
12-
"module": "dist/esm",
12+
"module": "dist/esm/index.js",
1313
"types": "dist/index.d.ts",
14+
"exports": {
15+
".": {
16+
"types": "./dist/index.d.ts",
17+
"import": "./dist/esm/index.js",
18+
"require": "./dist/cjs/index.js"
19+
}
20+
},
21+
"sideEffects": false,
1422
"scripts": {
15-
"cleanup": "rm -rf dist/ > /dev/null && rm -rf lib/ > /dev/null",
16-
"storybook": "storybook dev -p 6006",
23+
"cleanup": "rm -rf dist/ lib/ >/dev/null 2>&1 || true",
1724
"build": "yarn cleanup && rollup -c",
25+
"storybook": "storybook dev -p 6006",
26+
"build-storybook": "storybook build",
1827
"test": "jest",
1928
"test:watch": "jest --watch",
2029
"test:ci": "jest --coverage",
2130
"lint": "eslint 'src/**/*.{js,ts,tsx}' 'stories/**/*.{js,ts,tsx}'",
2231
"lint:fix": "eslint 'src/**/*.{js,ts,tsx}' 'stories/**/*.{js,ts,tsx}' --fix",
2332
"lint:ci": "eslint 'src/**/*.{js,ts,tsx}' 'stories/**/*.{js,ts,tsx}'",
24-
"build-storybook": "storybook build",
2533
"prepublishOnly": "yarn lint:ci && yarn test:ci && yarn storybook --smoke-test"
2634
},
27-
"license": "MIT",
35+
"peerDependencies": {
36+
"nhsuk-frontend": ">=10.0.0 <11.0.0",
37+
"react": "^19.0.0",
38+
"react-dom": "^19.0.0"
39+
},
2840
"devDependencies": {
2941
"@babel/core": "^7.24.1",
30-
"@babel/plugin-transform-modules-commonjs": "^7.23.3",
42+
"@babel/plugin-transform-modules-commonjs": "^7.27.1",
43+
"@babel/preset-env": "^7.28.3",
44+
"@babel/preset-react": "^7.27.1",
45+
"@babel/preset-typescript": "^7.27.1",
46+
"@eslint/js": "^9.36.0",
3147
"@rollup/plugin-commonjs": "^25.0.7",
3248
"@rollup/plugin-node-resolve": "^15.2.3",
3349
"@rollup/plugin-terser": "^0.4.4",
3450
"@rollup/plugin-typescript": "^11.1.6",
35-
"@storybook/addon-actions": "^8.0.5",
36-
"@storybook/addon-essentials": "^8.0.5",
37-
"@storybook/addon-links": "^8.0.5",
38-
"@storybook/blocks": "^8.0.5",
39-
"@storybook/manager-api": "^8.0.5",
40-
"@storybook/preview-api": "^8.0.5",
41-
"@storybook/react": "^8.0.5",
42-
"@storybook/react-vite": "^8.0.5",
43-
"@storybook/theming": "^8.0.5",
44-
"@testing-library/jest-dom": "^6.4.2",
45-
"@testing-library/react": "^14.2.1",
46-
"@types/babel__core": "^7",
47-
"@types/jest": "^29.5.12",
51+
"@storybook/addon-docs": "9.1.3",
52+
"@storybook/addon-links": "^9.1.3",
53+
"@storybook/react-vite": "^9.1.3",
54+
"@testing-library/dom": "^10.4.1",
55+
"@testing-library/jest-dom": "^6.8.0",
56+
"@testing-library/react": "^16.3.0",
57+
"@types/babel__preset-env": "^7",
58+
"@types/eslint-plugin-jsx-a11y": "^6",
59+
"@types/jest": "^30.0.0",
4860
"@types/jest-axe": "^3.5.9",
49-
"@types/node": "^15.0.2",
50-
"@types/react": "^18.2.60",
51-
"@types/react-dom": "^18.2.19",
52-
"@types/rollup-plugin-peer-deps-external": "^2.2.1",
61+
"@types/lodash": "^4",
62+
"@types/react": "^19.1.12",
63+
"@types/react-dom": "^19",
64+
"@types/stylus": "^0",
5365
"@typescript-eslint/eslint-plugin": "^7.1.0",
5466
"@typescript-eslint/parser": "^7.1.0",
55-
"babel-jest": "^29.7.0",
56-
"chromatic": "^6.17.3",
57-
"eslint": "^8.57.0",
58-
"eslint-config-airbnb": "^19.0.4",
59-
"eslint-config-prettier": "^9.1.0",
60-
"eslint-import-resolver-typescript": "^3.6.1",
61-
"eslint-plugin-import": "^2.29.1",
62-
"eslint-plugin-jsx-a11y": "^6.8.0",
63-
"eslint-plugin-prettier": "^5.1.3",
64-
"eslint-plugin-react": "^7.33.2",
65-
"eslint-plugin-react-hooks": "^4.6.0",
66-
"jest": "^29.7.0",
67-
"jest-axe": "^8.0.0",
68-
"jest-environment-jsdom": "^29.7.0",
67+
"babel-jest": "^30.2.0",
68+
"eslint": "^9.36.0",
69+
"eslint-config-prettier": "^10.1.8",
70+
"eslint-import-resolver-typescript": "^4.4.4",
71+
"eslint-plugin-import": "^2.32.0",
72+
"eslint-plugin-jsx-a11y": "^6.10.2",
73+
"eslint-plugin-react": "^7.37.5",
74+
"eslint-plugin-react-hooks": "^5.2.0",
75+
"eslint-plugin-storybook": "9.1.3",
76+
"globals": "^16.4.0",
77+
"jest": "^30.1.3",
78+
"jest-axe": "^10.0.0",
79+
"jest-environment-jsdom": "^30.1.2",
6980
"nhsuk-frontend": "^10.0.0",
7081
"outdent": "^0.8.0",
71-
"prettier": "^3.2.5",
72-
"react": "^18.2.0",
73-
"react-dom": "^18.2.0",
74-
"regenerator-runtime": "^0.13.7",
82+
"react": "^19.1.1",
83+
"react-dom": "^19.1.1",
7584
"rollup": "^4.13.0",
7685
"rollup-plugin-dts": "^6.1.0",
7786
"rollup-plugin-peer-deps-external": "^2.2.4",
7887
"rollup-plugin-preserve-directives": "^0.4.0",
7988
"rollup-plugin-tsconfig-paths": "^1.5.2",
80-
"sass": "^1.53.0",
81-
"storybook": "^8.0.5",
82-
"ts-jest": "^29.1.2",
89+
"sass-embedded": "^1.93.2",
90+
"storybook": "^9.1.3",
91+
"stylus": "^0.64.0",
92+
"ts-jest": "^29.4.4",
93+
"tslib": "^2.8.1",
8394
"typescript": "5.3.3",
84-
"vite": "^4.5.3",
95+
"vite": "^7.1.3",
8596
"vite-tsconfig-paths": "^4.3.2"
8697
},
98+
"license": "MIT",
99+
"packageManager": "[email protected]",
87100
"dependencies": {
88-
"classnames": "^2.2.6"
89-
},
90-
"peerDependencies": {
91-
"nhsuk-frontend": ">=10.0.0 <11.0.0",
92-
"react": ">=16.8.0",
93-
"react-dom": ">=16.8.0"
101+
"chalk": "^5.6.2",
102+
"classnames": "^2.5.1",
103+
"i": "^0.3.7",
104+
"lodash": "^4.17.21",
105+
"npm": "^11.6.0"
94106
},
95-
"packageManager": "[email protected]"
107+
"typesVersions": {
108+
"*": {
109+
"react": [
110+
"node_modules/react/index.d.ts"
111+
]
112+
}
113+
}
96114
}

0 commit comments

Comments
 (0)