Skip to content

Commit 144c5a7

Browse files
Upgrade to NHS.UK frontend v10.0.0 and support SSR (#267)
* Upgrade to NHS.UK frontend v10.0.0 * Set up environments for NHS.UK frontend v10.0.0 * Prevent clashes with NHS.UK frontend exports * Replace NHS.UK frontend CommonJS workarounds * Prevent unnecessary Babel transforms * Prevent duplicate initialisation * Run Prettier `--write` * Fix Storybook path to Sass * Fix links to NHS.UK frontend repo * Update back link for NHS.UK frontend v10.0.0 * Remove support for `nhsuk-button--disabled` class on buttons * Remove support for `disabled` attribute on button links * Remove support for `debounceTimeout` param on buttons * Update button for NHS.UK frontend v10.0.0 * Change to new "colour" spelling in NHS.UK frontend v10.0.0 * Remove icons not in NHS.UK frontend v10.0.0 * Update icons for NHS.UK frontend v10.0.0 * Update skip link for NHS.UK frontend v10.0.0 * Update action link for NHS.UK frontend v10.0.0 * Remove support for breadcrumb back link `accessiblePrefix` * Update breadcrumb for NHS.UK frontend v10.0.0 * Update radios for NHS.UK frontend v10.0.0 * Update checkboxes for NHS.UK frontend v10.0.0 * Update footer for NHS.UK frontend v10.0.0 * Update header for NHS.UK frontend v10.0.0 * Fix React warning "Use the `defaultValue` or `value` props instead of setting children on <textarea>" * Align character count with NHS.UK frontend * Align warning callout with NHS.UK frontend * Align error message with NHS.UK frontend * Align error summary with NHS.UK frontend * Remove unnecessary comment * Remove support for contents list optional visually hidden text * Remove support for inset text optional visually hidden text * Remove support for care card optional visually hidden text * Remove support for warning callout custom visually hidden text * Fix contents list missing ARIA attributes * Avoid casting date input change event * Always update date input value without change handler * Remove unsupported `autoSelectNext` date input feature * Remove incorrect `pattern` from date inputs * Split out separate `Legend` component * Skip rendering empty form elements * Remove wrapping form groups around fieldsets * Fix date input missing `role="group"` accessibility issue * Consolidate `<FormGroup>` to support fieldsets and legends * Add missing migration guides to storybook * Move display names to exported components * Remove legacy list panel component * Remove automatic sizing from labels and legends * Remove unused `LabelBlock` component * Update types from `HTMLProps` to `ComponentProps` * Remove support for uppercase heading levels * Add default images `alt=""` when not set * Align table caption with NHS.UK frontend * Widen support for `ref`, `as` and `asElement` props * Polyfill TextEncoder/TextDecoder for ReactDOM * Document breaking changes * Allow server-side rendering (SSR) in all components * Add React DOM render tests * Remove support for error lines without error messages * Align table with NHS.UK frontend * Update changelog * Remove Jest globals from utils * Update package version to v6.0.0-beta.0 * Resolve various Sonar issues
1 parent af44420 commit 144c5a7

File tree

289 files changed

+9663
-7195
lines changed

Some content is hidden

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

289 files changed

+9663
-7195
lines changed

.github/workflows/storybook.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ jobs:
1313
uses: actions/checkout@v4
1414
with:
1515
fetch-depth: 0
16-
16+
1717
- name: Set up Node.js
1818
uses: actions/setup-node@v2
1919
with:
2020
node-version-file: .nvmrc
21-
21+
2222
- name: Enable corepack
2323
run: corepack enable
24-
24+
2525
- name: Set Yarn version
2626
run: yarn set version stable
2727

.storybook/manager.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
import { addons } from '@storybook/manager-api';
22
import nhsTheme from './theme';
3-
import { startCase, upperFirst } from "lodash";
3+
import { startCase, upperFirst } from 'lodash';
44

5-
const sentenceCase = string => {
6-
if (typeof string !== 'string') return ''
7-
return upperFirst(startCase(string).toLowerCase())
8-
}
5+
const sentenceCase = (string) => {
6+
if (typeof string !== 'string') return '';
7+
return upperFirst(startCase(string).toLowerCase());
8+
};
99

1010
addons.setConfig({
1111
sidebar: {
12-
renderLabel: ({ name, type }) =>
13-
sentenceCase(name),
12+
renderLabel: ({ name, type }) => sentenceCase(name),
1413
},
15-
theme: nhsTheme
14+
theme: nhsTheme,
1615
});

.storybook/preview-body.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<script>
2+
document.body.className +=
3+
' js-enabled' + ('noModule' in HTMLScriptElement.prototype ? ' nhsuk-frontend-supported' : '');
4+
</script>

.storybook/preview-head.html

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

.storybook/storybook.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Allow current nhsuk styles to override legacy
2-
@import '../node_modules/nhsuk-frontend/packages/nhsuk.scss';
2+
@import 'nhsuk-frontend/dist/nhsuk';
33

44
.tag-wrapper {
55
display: flex;

.vscode/launch.json

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
{
2-
// Use IntelliSense to learn about possible attributes.
3-
// Hover to view descriptions of existing attributes.
4-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5-
"version": "0.2.0",
6-
"configurations": [
7-
{
8-
"type": "node",
9-
"request": "launch",
10-
"name": "Launch Program",
11-
"skipFiles": [
12-
"<node_internals>/**"
13-
],
14-
"program": "${workspaceFolder}/dist/index.js",
15-
"outFiles": [
16-
"${workspaceFolder}/**/*.js"
17-
]
18-
}
19-
]
20-
}
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "node",
9+
"request": "launch",
10+
"name": "Launch Program",
11+
"skipFiles": ["<node_internals>/**"],
12+
"program": "${workspaceFolder}/dist/index.js",
13+
"outFiles": ["${workspaceFolder}/**/*.js"]
14+
}
15+
]
16+
}

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# NHS.UK React components
22

3-
## 5.0.0 - TBC
3+
## 6.0.0-beta.0 - 30 September 2025
4+
5+
This version provides support for nhsuk-frontend version 10.
6+
7+
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).
8+
9+
## 5.0.0 - 4 November 2024
410

511
This version provides support for nhsuk-frontend version 9.
612

bundle-base.tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323
"@navigation/*": ["src/components/navigation/*"],
2424
"@typography/*": ["src/components/typography/*"],
2525
"@util/*": ["src/util/*"],
26-
"@patterns/*": ["src/patterns/*"],
27-
"@resources/*": ["src/resources/*"]
26+
"@patterns/*": ["src/patterns/*"]
2827
}
2928
},
3029
"include": ["src"],

docs/upgrade-to-2.0.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Upgrading to 2.0
22

3-
There are some breaking changes you'll need to be aware of when upgrading to v2. These are mostly related to us upgrading our dependency on [nhsuk-frontend to v4](https://github.com/nhsuk/nhsuk-frontend/blob/master/CHANGELOG.md#400---26-october-2020) which also includes some breaking changes.
3+
There are some breaking changes you'll need to be aware of when upgrading to v2. These are mostly related to us upgrading our dependency on [nhsuk-frontend to v4](https://github.com/nhsuk/nhsuk-frontend/blob/master/CHANGELOG.md#400---26-october-2020) which also includes some breaking changes.
44

55
## New Card Component
66

@@ -59,11 +59,11 @@ The `Panel` and `Promo` components have been removed from `nhsuk-frontend` since
5959

6060
```jsx
6161
// Old Imports
62-
import { Button, Panel, Promo } from "nhsuk-react-components";
62+
import { Button, Panel, Promo } from 'nhsuk-react-components';
6363

6464
// New Imports
65-
import { Button } from "nhsuk-react-components";
66-
import { Panel, Promo } from "nhsuk-react-components/dist/deprecated";
65+
import { Button } from 'nhsuk-react-components';
66+
import { Panel, Promo } from 'nhsuk-react-components/dist/deprecated';
6767
```
6868

6969
A warning is printed to the console in dev environments when using these components, as they are set to be removed in the next major release.
@@ -73,7 +73,7 @@ A warning is printed to the console in dev environments when using these compone
7373
In line with the upstream nhsuk-frontend, NHS Design Kit and GDS recommendations, we now render the input boxes in the date component as follows:
7474

7575
```html
76-
<input type="text" inputType="numeric" pattern="[0-9]*">
76+
<input type="text" inputType="numeric" pattern="[0-9]*" />
7777
```
7878

7979
There is more on this change here:

docs/upgrade-to-3.0.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
> v3.0 is an upcoming release, this page is a work in progress.
44
5-
There are some breaking changes you'll need to be aware of when upgrading to v3. These are mostly related to us upgrading our dependency on [nhsuk-frontend to v5](https://github.com/nhsuk/nhsuk-frontend/blob/main/CHANGELOG.md#500---16-march-2021) which also includes some breaking changes.
5+
There are some breaking changes you'll need to be aware of when upgrading to v3. These are mostly related to us upgrading our dependency on [nhsuk-frontend to v5](https://github.com/nhsuk/nhsuk-frontend/blob/main/CHANGELOG.md#500---16-march-2021) which also includes some breaking changes.
66

77
## Review Date component is now a pattern
88

9-
The `ReviewDate` component has been removed from nhsuk-frontend in version 5.0.0. This component is now a `pattern` in the nhsuk-frontend library.
9+
The `ReviewDate` component has been removed from nhsuk-frontend in version 5.0.0. This component is now a `pattern` in the nhsuk-frontend library.
1010

1111
The only change is that the Default import has a new path.
1212

@@ -16,12 +16,12 @@ There are no functional changes to the component, and it works exactly as it did
1616

1717
```tsx
1818
// Old Import
19-
import { ReviewDate } from "nhsuk-react-components";
20-
import ReviewDate from "nhsuk-react-components/lib/components/review-date";
19+
import { ReviewDate } from 'nhsuk-react-components';
20+
import ReviewDate from 'nhsuk-react-components/lib/components/review-date';
2121

2222
// New Import
23-
import { ReviewDate } from "nhsuk-react-components";
24-
import ReviewDate from "nhsuk-react-components/lib/patterns/review-date";
23+
import { ReviewDate } from 'nhsuk-react-components';
24+
import ReviewDate from 'nhsuk-react-components/lib/patterns/review-date';
2525
```
2626

2727
## NHS Logo PNG Fallback Removed
@@ -38,4 +38,4 @@ In NHS.UK Frontend v5 and above, the header text now defaults to wrapping undern
3838

3939
## The `prefixText` prop has been added to the `DoDontList.Item` component
4040

41-
You can now add prefixed text to each `DoDontList.Item` component by supplying the `prefixText` prop. Items with a `type` of `dont` will automatically have a 'do not' prefix text added in the next major release to align with the NHS.UK frontend library v5.
41+
You can now add prefixed text to each `DoDontList.Item` component by supplying the `prefixText` prop. Items with a `type` of `dont` will automatically have a 'do not' prefix text added in the next major release to align with the NHS.UK frontend library v5.

0 commit comments

Comments
 (0)