Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
af5d9aa
Preserve build output (non-minified) for all modules
colinrotherham Oct 7, 2025
37853ff
Fix TypeScript "Type 'NodeListOf<HTMLElement>' must have a '[Symbol.i…
colinrotherham Oct 3, 2025
e19629c
Make sure source maps include original sources
colinrotherham Oct 3, 2025
0cf266c
Configure Babel with Browserslist
colinrotherham Oct 7, 2025
75f2886
Use named exports, package imports and verbatim syntax
colinrotherham Oct 3, 2025
bf4bd56
Fix missing README upgrade link
colinrotherham Oct 2, 2025
1ea1b80
Configure Rollup build with Babel
colinrotherham Oct 6, 2025
872cc0a
Switch to modern JSX runtime
colinrotherham Oct 3, 2025
c90c69b
Fix tests that relied on classic JSX runtime
colinrotherham Oct 3, 2025
5154a99
Fix deprecated Jest assertions
colinrotherham Oct 6, 2025
c7e2e9b
Avoid circular dependencies
colinrotherham Oct 6, 2025
1fc5f0e
Remove unused packages
colinrotherham Oct 7, 2025
11068eb
Remove unused Jest mock
colinrotherham Oct 7, 2025
72342c2
Update test packages
colinrotherham Oct 7, 2025
25e3db0
Update snapshots
colinrotherham Oct 3, 2025
42cc58c
Use package imports for stories
colinrotherham Oct 7, 2025
cfdef2e
Use correct file extensions for exported modules
colinrotherham Oct 6, 2025
5dfc2aa
Always export util types and guards
colinrotherham Oct 6, 2025
5331066
Fix TypeScript compiler issues
colinrotherham Oct 6, 2025
7aecf20
Set up TypeScript references
colinrotherham Oct 7, 2025
c5cad39
Add mandatory ES module file extensions to sources
colinrotherham Oct 7, 2025
0f2a13f
Remove mandatory ES module file extensions for Jest
colinrotherham Oct 7, 2025
8676bf4
Remove mostly duplicate `:ci` npm scripts
colinrotherham Oct 6, 2025
485956b
Split out ESLint only `lint:js` npm script
colinrotherham Oct 6, 2025
21b775b
Split out TypeScript only `lint:types` npm script
colinrotherham Oct 6, 2025
4109f7d
Split out Prettier only `lint:prettier` npm script
colinrotherham Oct 6, 2025
f4f5acb
Enable Prettier `"quoteProps": "consistent"`
colinrotherham Oct 6, 2025
fa0583c
Update to ESLint v9
colinrotherham Oct 3, 2025
6473ba7
Enable ESLint editor validation for JSX
colinrotherham Oct 3, 2025
933e48d
Remove ESLint rules we should fix instead
colinrotherham Oct 3, 2025
5e3be37
Turn off ESLint rules handled by TypeScript
colinrotherham Oct 6, 2025
4b087d3
Fix ESLint "Cannot reassign variables declared outside of the compone…
colinrotherham Oct 6, 2025
b7719fe
Fix ESLint missing React hook dependencies
colinrotherham Oct 3, 2025
7312da4
Fix ESLint unnecessary disable comments
colinrotherham Oct 6, 2025
55c0933
Fix ESLint remaining issues
colinrotherham Oct 6, 2025
df2ef3e
Fix missing lodash package
colinrotherham Oct 7, 2025
5069930
Upgrade to latest Yarn stable
colinrotherham Oct 7, 2025
2d4cd4d
Upgrade TypeScript with resolutions
colinrotherham Oct 7, 2025
4b72027
Require React v18.2 minimum version
colinrotherham Oct 6, 2025
e92a71f
Upgrade to React v19
colinrotherham Oct 7, 2025
0dc68ed
Upgrade to React v19 compatible packages
colinrotherham Oct 7, 2025
629cc59
Restore `'use client'` for Next.js
colinrotherham Oct 6, 2025
2bcc3a0
Merge pull request #273 from NHSDigital/react
colinrotherham Oct 7, 2025
95ef36b
Merge pull request #272 from NHSDigital/eslint
colinrotherham Oct 7, 2025
7350569
Updating component library to latest Storybook for React
Oct 7, 2025
ee8a3fb
Merge pull request #270 from NHSDigital/NCRS-4111/NCRS-4106/Upgrade-o…
colinrotherham Oct 7, 2025
a79f910
Update changelog for previous fixes
colinrotherham Oct 7, 2025
222b10a
Add panel component
colinrotherham Oct 7, 2025
7fa8604
Add changelog entry
colinrotherham Oct 7, 2025
dbb64be
Update package version to v6.0.0-beta.1
colinrotherham Oct 7, 2025
b28239c
Add JSDoc types
colinrotherham Oct 6, 2025
1f8cc39
Merge pull request #274 from NHSDigital/panel-component
colinrotherham Oct 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[javascripts]
supports es6-module

[node]
node 22
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

41 changes: 0 additions & 41 deletions .eslintrc.js

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
- name: Yarn Install
run: yarn
- name: Lint
run: yarn lint:ci
run: yarn lint
- name: Jest Tests
run: yarn test:ci
run: yarn test --coverage
- name: Typescript build
run: yarn build
- name: Storybook build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ jobs:
run: yarn

- name: Lint
run: yarn lint:ci
run: yarn lint

- name: Jest Tests
run: yarn test:ci
run: yarn test --coverage

- name: Typescript build
run: yarn build
Expand Down
12 changes: 12 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Node.js modules
node_modules/

# Test coverage
coverage/

# Build output
dist/

# Files to ignore
.yarnrc.yml
package-lock.json
7 changes: 4 additions & 3 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"printWidth": 100,
"quoteProps": "consistent",
"semi": true,
"trailingComma": "all",
"singleQuote": true,
"printWidth": 100,
"tabWidth": 2
"tabWidth": 2,
"trailingComma": "all"
}
16 changes: 12 additions & 4 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,29 @@ import tsConfigPaths from 'vite-tsconfig-paths';

const config: StorybookConfig = {
stories: ['../stories/**/*.stories.@(ts|tsx)', '../stories/**/*.mdx'],
addons: ['@storybook/addon-links', '@storybook/addon-essentials'],
addons: ['@storybook/addon-links', '@storybook/addon-docs'],
framework: {
name: '@storybook/react-vite',
options: {},
},
docs: {
autodocs: true,
},

typescript: {
reactDocgen: 'react-docgen-typescript',
},

viteFinal(config) {
return mergeConfig(config, {
plugins: [tsConfigPaths()],
css: {
preprocessorOptions: {
scss: {
quietDeps: true,
loadPaths: ['node_modules'],
},
},
},
});
},
};

export default config;
13 changes: 8 additions & 5 deletions .storybook/manager.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { addons } from '@storybook/manager-api';
import { addons } from 'storybook/manager-api';
import nhsTheme from './theme';
import { startCase, upperFirst } from 'lodash';

const sentenceCase = (string) => {
if (typeof string !== 'string') return '';
return upperFirst(startCase(string).toLowerCase());
const sentenceCase = (name = '') => {
if (!name || typeof name !== 'string') {
return '';
}

return upperFirst(startCase(name).toLowerCase());
};

addons.setConfig({
sidebar: {
renderLabel: ({ name, type }) => sentenceCase(name),
renderLabel: ({ name }) => sentenceCase(name),
},
theme: nhsTheme,
});
5 changes: 4 additions & 1 deletion .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import './storybook.scss';
import { Preview } from '@storybook/react';
import { type Preview } from '@storybook/react-vite';

const preview: Preview = {
parameters: {
Expand All @@ -18,5 +18,8 @@ const preview: Preview = {
},
},
},

tags: ['autodocs'],
};

export default preview;
3 changes: 1 addition & 2 deletions .storybook/storybook.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Allow current nhsuk styles to override legacy
@import 'nhsuk-frontend/dist/nhsuk';
@forward 'nhsuk-frontend/dist/nhsuk';

.tag-wrapper {
display: flex;
Expand Down
6 changes: 3 additions & 3 deletions .storybook/theme.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { create } from '@storybook/theming/create';
const version = require('../package.json').version;
import { create } from 'storybook/theming/create';
import packageJson from '../package.json' with { type: 'json' };

export default create({
base: 'light',
Expand Down Expand Up @@ -31,6 +31,6 @@ export default create({
inputTextColor: '#212b32',
inputBorderRadius: 4,

brandTitle: `NHS.UK React Components (v${version})`,
brandTitle: `NHS.UK React Components (v${packageJson.version})`,
brandUrl: 'https://github.com/NHSDigital/nhsuk-react-components',
});
4 changes: 1 addition & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
"source.fixAll": "explicit",
"source.fixAll.eslint": "explicit"
},
"eslint.validate": ["javascript", "typescript"],
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
"eslint.codeAction.showDocumentation": {
"enable": true
},
"eslint.alwaysShowStatus": true,
"eslint.workingDirectories": ["src"],
"typescript.tsdk": "node_modules/typescript/lib"
}
17 changes: 16 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
nodeLinker: node-modules
npmRegistryServer: https://registry.yarnpkg.com

npmRegistryServer: "https://registry.yarnpkg.com"

packageExtensions:
"@storybook/addon-docs@*":
peerDependencies:
"@types/react": "*"
"@types/react-dom": "*"

"@storybook/react-vite@*":
peerDependencies:
typescript: "*"

"storybook@*":
peerDependencies:
"@testing-library/dom": "*"
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# NHS.UK React components

## 6.0.0-beta.1 - 8 October 2025

This version adds the panel component from NHS.UK frontend v9.3.0 and supports React v19.

For a full list of changes in this release please refer to the [migration doc](https://github.com/NHSDigital/nhsuk-react-components/blob/main/docs/upgrade-to-6.0.md).

## 6.0.0-beta.0 - 30 September 2025

This version provides support for nhsuk-frontend version 10.
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ yarn add nhsuk-react-components
## Usage

```jsx
import React, { PureComponent } from 'react';
import { PureComponent } from 'react';

// You can import components from the global module
import { Button } from 'nhsuk-react-components';

// Or you can import components directly
import Button from 'nhsuk-react-components/lib/components/button';
import { Button } from 'nhsuk-react-components/dist/esm/components/button';

class GetStartedButton extends PureComponent {
render() {
Expand All @@ -43,6 +43,7 @@ class GetStartedButton extends PureComponent {
- [Upgrading to 3.0](/docs/upgrade-to-3.0.md)
- [Upgrading to 4.0](/docs/upgrade-to-4.0.md)
- [Upgrading to 5.0](/docs/upgrade-to-5.0.md)
- [Upgrading to 6.0](/docs/upgrade-to-6.0.md)

## Maintainers

Expand Down
69 changes: 69 additions & 0 deletions babel.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
const { NODE_ENV } = process.env;

/**
* Babel config
*
* @type {TransformOptions}
*/
module.exports = {
browserslistEnv: 'javascripts',
presets: [
[
'@babel/preset-env',
{
// Apply bug fixes to avoid transforms
bugfixes: true,

// Apply smaller "loose" transforms for browsers
loose: true,

// Apply ES module transforms for Jest
// https://jestjs.io/docs/ecmascript-modules
modules: NODE_ENV === 'test' ? 'auto' : false,
},
],
[
'@babel/preset-react',
{
development: NODE_ENV === 'development',
runtime: 'automatic',
useBuiltIns: true,
},
],
'@babel/preset-typescript',
],
env: {
test: {
browserslistEnv: 'node',
plugins: [
// Override package.json "imports" for Jest to use sources
// otherwise a build step to output `./dist` is necessary
[
'module-resolver',
{
alias: {
'#components': './src/components',
'#patterns': './src/patterns',
'#util': './src/util',
'nhsuk-react-components': './src/index.ts',
},
},
],
// Remove mandatory ES module file extensions for Jest
// https://nodejs.org/api/esm.html#mandatory-file-extensions
[
'replace-import-extension',
{
extMapping: {
'.js': '',
},
},
],
],
},
},
};

/**
* @import { TransformOptions } from '@babel/core'
*/
31 changes: 0 additions & 31 deletions bundle-base.tsconfig.json

This file was deleted.

Loading