Skip to content

Commit 727ba0a

Browse files
authored
Migrate to nhsuk-frontend v9 (#258)
1 parent 6d09861 commit 727ba0a

File tree

47 files changed

+585
-276
lines changed

Some content is hidden

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

47 files changed

+585
-276
lines changed

CHANGELOG.md

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,66 @@
11
# NHS.UK React components
22

3-
## Unreleased
3+
## 5.0.0 - TBC
4+
5+
This version provides support for nhsuk-frontend version 9.
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-5.0.md).
8+
9+
## 4.1.3 - 23 September 2024
410

511
:wrench: **Fixes**
6-
* Remove the unnecessary aria-labelledby tags from radio items. PR [#253](https://github.com/NHSDigital/nhsuk-react-components/pull/253)
712

13+
- Remove the unnecessary aria-labelledby tags from radio items. PR [#253](https://github.com/NHSDigital/nhsuk-react-components/pull/253)
814

915
## 4.1.2 - 3 September 2024
1016

1117
:wrench: **Fixes**
1218

13-
* Fix issues with SkipLink (always set the href) and bring into line with NHSUK frontend. PR [#248](https://github.com/NHSDigital/nhsuk-react-components/pull/248)
19+
- Fix issues with SkipLink (always set the href) and bring into line with NHSUK frontend. PR [#248](https://github.com/NHSDigital/nhsuk-react-components/pull/248)
1420

1521
## 4.1.1 - 9 August 2024
1622

1723
:wrench: **Fixes**
1824

19-
* Remove the unnecessary aria-labelledby tags from DateInput fields. PR [#246](https://github.com/NHSDigital/nhsuk-react-components/pull/246)
25+
- Remove the unnecessary aria-labelledby tags from DateInput fields. PR [#246](https://github.com/NHSDigital/nhsuk-react-components/pull/246)
2026

2127
## 4.1.0 - 11 June 2024
2228

2329
:wrench: **Fixes**
2430

25-
* Add js shims for buttons. PR [#231](https://github.com/NHSDigital/nhsuk-react-components/pull/231), Fixes [#218](https://github.com/NHSDigital/nhsuk-react-components/issues/218)
26-
* Fix errors not being linked to inputs. PR [#230](https://github.com/NHSDigital/nhsuk-react-components/pull/230), Fixes [#227](https://github.com/NHSDigital/nhsuk-react-components/issues/227)
27-
* Fix inputs incorrectly using `aria-labelledby`. PR [#230](https://github.com/NHSDigital/nhsuk-react-components/pull/230), Fixes [#212](https://github.com/NHSDigital/nhsuk-react-components/issues/212)
28-
* Update Storybook docs for several components.
31+
- Add js shims for buttons. PR [#231](https://github.com/NHSDigital/nhsuk-react-components/pull/231), Fixes [#218](https://github.com/NHSDigital/nhsuk-react-components/issues/218)
32+
- Fix errors not being linked to inputs. PR [#230](https://github.com/NHSDigital/nhsuk-react-components/pull/230), Fixes [#227](https://github.com/NHSDigital/nhsuk-react-components/issues/227)
33+
- Fix inputs incorrectly using `aria-labelledby`. PR [#230](https://github.com/NHSDigital/nhsuk-react-components/pull/230), Fixes [#212](https://github.com/NHSDigital/nhsuk-react-components/issues/212)
34+
- Update Storybook docs for several components.
2935

3036
:new: **New features**
3137

32-
* Added a CHANGELOG to keep track of changes between releases. [Keep a changelog](https://keepachangelog.com)
33-
* Added support for `preventDoubleClick` debouncing on buttons. PR [#231](https://github.com/NHSDigital/nhsuk-react-components/pull/231)
34-
* Error summaries now automatically set role, tabindex, and aria-labelledby. PR [#229](https://github.com/NHSDigital/nhsuk-react-components/pull/237), Fixes [#228](https://github.com/NHSDigital/nhsuk-react-components/issues/229)
35-
* Storybook link in readme now points to latest version. PR [#226](https://github.com/NHSDigital/nhsuk-react-components/pull/226)
38+
- Added a CHANGELOG to keep track of changes between releases. [Keep a changelog](https://keepachangelog.com)
39+
- Added support for `preventDoubleClick` debouncing on buttons. PR [#231](https://github.com/NHSDigital/nhsuk-react-components/pull/231)
40+
- Error summaries now automatically set role, tabindex, and aria-labelledby. PR [#229](https://github.com/NHSDigital/nhsuk-react-components/pull/237), Fixes [#228](https://github.com/NHSDigital/nhsuk-react-components/issues/229)
41+
- Storybook link in readme now points to latest version. PR [#226](https://github.com/NHSDigital/nhsuk-react-components/pull/226)
3642

3743
## 4.0.2 - 21 May 2024
3844

3945
:wrench: **Fixes**
4046

41-
* Fix error message role by @edwardhorsford in [#219](https://github.com/NHSDigital/nhsuk-react-components/pull/219)
47+
- Fix error message role by @edwardhorsford in [#219](https://github.com/NHSDigital/nhsuk-react-components/pull/219)
4248

4349
## 4.0.1 - 20 May 2024
4450

4551
:wrench: **Fixes**
4652

47-
* Fix issue with the footer copyright not being rendered in the correct location if there are multiple link columns by @jakeb-nhs in [#223](https://github.com/NHSDigital/nhsuk-react-components/pull/223)
53+
- Fix issue with the footer copyright not being rendered in the correct location if there are multiple link columns by @jakeb-nhs in [#223](https://github.com/NHSDigital/nhsuk-react-components/pull/223)
4854

4955
## 4.0.0 - 15 May 2024
5056

5157
This version updates nhsuk-frontend to version 8.
5258

53-
For a full list of changes in this release please refer to the [migration doc](https://github.com/NHSDigital/nhsuk-react-components/blob/feature/nhsuk-frontend-v8/docs/upgrade-to-4.0.md).
59+
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-4.0.md).
5460

55-
* Migrate enzyme to react-testing-library by @JoshuaBates-NHS in [#198](https://github.com/NHSDigital/nhsuk-react-components/pull/198)
56-
* Allow support for module directives in build process by @JoshuaBates-NHS in [#199](https://github.com/NHSDigital/nhsuk-react-components/pull/199)
57-
* Update modified components since NHS UK frontend v5 by @jakeb-nhs in [#197](https://github.com/NHSDigital/nhsuk-react-components/pull/197)
58-
* Add new components since NHS UK frontend v5 by @jakeb-nhs in [#202](https://github.com/NHSDigital/nhsuk-react-components/pull/202)
59-
* Migrate some patterns to components, rework removed components from frontend v8 by @jakeb-nhs in [#203](https://github.com/NHSDigital/nhsuk-react-components/pull/203)
60-
* Improve unit test coverage by @jakeb-nhs in [#204](https://github.com/NHSDigital/nhsuk-react-components/pull/204)
61+
- Migrate enzyme to react-testing-library by @JoshuaBates-NHS in [#198](https://github.com/NHSDigital/nhsuk-react-components/pull/198)
62+
- Allow support for module directives in build process by @JoshuaBates-NHS in [#199](https://github.com/NHSDigital/nhsuk-react-components/pull/199)
63+
- Update modified components since NHS UK frontend v5 by @jakeb-nhs in [#197](https://github.com/NHSDigital/nhsuk-react-components/pull/197)
64+
- Add new components since NHS UK frontend v5 by @jakeb-nhs in [#202](https://github.com/NHSDigital/nhsuk-react-components/pull/202)
65+
- Migrate some patterns to components, rework removed components from frontend v8 by @jakeb-nhs in [#203](https://github.com/NHSDigital/nhsuk-react-components/pull/203)
66+
- Improve unit test coverage by @jakeb-nhs in [#204](https://github.com/NHSDigital/nhsuk-react-components/pull/204)

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,11 @@ class GetStartedButton extends PureComponent {
3838

3939
## Upgrading
4040

41-
* [Upgrading to 1.0](/docs/upgrade-to-1.0.md)
42-
* [Upgrading to 2.0](/docs/upgrade-to-2.0.md)
43-
* [Upgrading to 3.0](/docs/upgrade-to-3.0.md)
44-
* [Upgrading to 4.0](/docs/upgrade-to-4.0.md)
41+
- [Upgrading to 1.0](/docs/upgrade-to-1.0.md)
42+
- [Upgrading to 2.0](/docs/upgrade-to-2.0.md)
43+
- [Upgrading to 3.0](/docs/upgrade-to-3.0.md)
44+
- [Upgrading to 4.0](/docs/upgrade-to-4.0.md)
45+
- [Upgrading to 5.0](/docs/upgrade-to-5.0.md)
4546

4647
## Maintainers
4748

@@ -53,7 +54,6 @@ class GetStartedButton extends PureComponent {
5354
- Kevin Kuszyk ([GitHub](https://github.com/kevinkuszyk))
5455
- Kai Spencer ([GitHub](https://github.com/KaiSpencer))
5556
- Ed Horsford ([GitHub](https://github.com/edwardhorsford))
56-
- Jake Barton ([GitHub](https://github.com/jakeb-nhs))
5757

5858
## Preparing releases
5959

docs/upgrade-to-5.0.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Upgrading to 5.0
2+
3+
There are some breaking changes you'll need to be aware of when upgrading to v5. These are mostly related to us upgrading our dependency on [nhsuk-frontend to v9](https://github.com/nhsuk/nhsuk-frontend/blob/main/CHANGELOG.md#901---9-october-2024) which also includes breaking changes.
4+
5+
## Breaking changes
6+
7+
### Breadcrumbs
8+
9+
The `Breadcrumbs` component no longer contains its own `<Container>` container component.
10+
11+
Instead, `Breadcrumbs` should be moved inside the existing `<Container>` or `<div class="nhsuk-width-container">` for your overall page, but before the `<main>` tag.
12+
13+
This means that instead of this:
14+
15+
```
16+
<Breadcrumb>
17+
<Breadcrumb.Item href="#">Home</Breadcrumb.Item>
18+
</Breadcrumb>
19+
<Container>
20+
<main class="nhsuk-main-wrapper" id="maincontent" role="main">
21+
...
22+
</main>
23+
</Container>
24+
```
25+
26+
You should have this:
27+
28+
```
29+
<Container>
30+
<Breadcrumb>
31+
<Breadcrumb.Item href="#">Home</Breadcrumb.Item>
32+
</Breadcrumb>
33+
<main class="nhsuk-main-wrapper" id="maincontent" role="main">
34+
...
35+
</main>
36+
</Container>
37+
```
38+
39+
### Back link
40+
41+
Although no changes were needed in this library, nhsuk-frontend library has a breaking change for consumers of the `BackLink` component. See the [Changelog](https://github.com/nhsuk/nhsuk-frontend/blob/main/CHANGELOG.md#updated-back-link-and-breadcrumbs-pr-1002)
42+
43+
## New Features
44+
45+
### Warning Button
46+
47+
A new Warning Button variant has been added to the `Button` component. To use this, set the `warning` prop on `Button`, e.g.
48+
49+
```
50+
<Button warning>Delete</Button>
51+
```
52+
53+
## Fixes
54+
55+
- Add aria-hidden to responsive table cells that show on small screens, to avoid screenreaders calling out the labels/column headings twice.
56+
- Ensure that headers are aligned to expected standards (if there are fewer than 4 links on the header, the content is left-aligned).

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nhsuk-react-components",
3-
"version": "4.1.2",
3+
"version": "5.0.0",
44
"author": {
55
"name": "NHS England"
66
},
@@ -66,7 +66,7 @@
6666
"jest": "^29.7.0",
6767
"jest-axe": "^8.0.0",
6868
"jest-environment-jsdom": "^29.7.0",
69-
"nhsuk-frontend": "8.1.0",
69+
"nhsuk-frontend": "^9.0.1",
7070
"prettier": "^3.2.5",
7171
"react": "^18.2.0",
7272
"react-dom": "^18.2.0",
@@ -87,7 +87,7 @@
8787
"classnames": "^2.2.6"
8888
},
8989
"peerDependencies": {
90-
"nhsuk-frontend": ">=8.0.0 <9.0.0",
90+
"nhsuk-frontend": ">=9.0.0 <10.0.0",
9191
"react": ">=16.8.0",
9292
"react-dom": ">=16.8.0"
9393
},

src/__tests__/index.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ describe('Index', () => {
3636
'Fieldset',
3737
'Footer',
3838
'Form',
39+
'FormGroup',
3940
'Header',
4041
'Hero',
4142
'HintText',

src/components/content-presentation/do-and-dont-list/DoAndDontList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import React, { FC, HTMLProps, createContext, useContext, ReactNode } from 'react';
33
import classNames from 'classnames';
44
import { Tick, Cross } from '@components/content-presentation/icons';
5-
import HeadingLevel, { HeadingLevelType } from '@util/HeadingLevel';
5+
import HeadingLevel, { HeadingLevelType } from '@components/utils/HeadingLevel';
66

77
type ListType = 'do' | 'dont';
88

src/components/content-presentation/hero/Hero.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { FC, HTMLProps } from 'react';
22
import classNames from 'classnames';
33
import { Container, Row, Col } from '../../layout';
4-
import HeadingLevel, { HeadingLevelType } from '@util/HeadingLevel';
4+
import HeadingLevel, { HeadingLevelType } from '@components/utils/HeadingLevel';
55

66
interface HeroContentProps extends HTMLProps<HTMLDivElement> {
77
hasImage: boolean;

src/components/content-presentation/table/components/TableCell.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ const TableCell: FC<TableCellProps> = ({
3535
) : (
3636
<td className={classes} role={_responsive ? 'cell' : undefined} {...rest}>
3737
{_responsive && (
38-
<span className="nhsuk-table-responsive__heading">{_responsiveHeading}</span>
38+
<span className="nhsuk-table-responsive__heading" aria-hidden>
39+
{_responsiveHeading}
40+
</span>
3941
)}
4042
{children}
4143
</td>

src/components/content-presentation/table/components/TablePanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { FC, ComponentProps, HTMLProps } from 'react';
22
import classNames from 'classnames';
3-
import HeadingLevel from '@util/HeadingLevel';
3+
import HeadingLevel from '@components/utils/HeadingLevel';
44

55
export interface TablePanelProps extends HTMLProps<HTMLDivElement> {
66
heading?: string;

src/components/content-presentation/tabs/Tabs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use client';
22
import classNames from 'classnames';
33
import React, { FC, HTMLAttributes, useEffect } from 'react';
4-
import HeadingLevel, { HeadingLevelType } from '@util/HeadingLevel';
4+
import HeadingLevel, { HeadingLevelType } from '@components/utils/HeadingLevel';
55
import TabsJs from '@resources/tabs';
66

77
type TabsProps = HTMLAttributes<HTMLDivElement>;

0 commit comments

Comments
 (0)