Skip to content

Commit d1a9149

Browse files
committed
Migrate to nhsuk-frontend v9
1 parent 6d09861 commit d1a9149

File tree

43 files changed

+522
-247
lines changed

Some content is hidden

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

43 files changed

+522
-247
lines changed

CHANGELOG.md

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,59 +2,65 @@
22

33
## Unreleased
44

5+
This version updates nhsuk-frontend to 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
10+
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 & 4 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

docs/upgrade-to-5.0.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
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+
### FormGroup
54+
55+
In order to provide consumers of this library more control over when to render fieldsets, some behaviour of the previous `Fieldset` component has been extracted into a new `FormGroup` component. This makes `FormGroup` responsible for rendering the error decorator line for groups of inputs, and `Fieldset` is now a simpler component which makes use of this component.
56+
57+
No changes are required for existing usages of `Fieldset`. For examples of the usage of `FormGroup`, please see storybook.
58+
59+
For example, this:
60+
61+
```
62+
<Fieldset>
63+
<Fieldset.Legend>What is your address?</Fieldset.Legend>
64+
<TextInput id="address-1" />
65+
<TextInput id="address-2" />
66+
</Fieldset>
67+
```
68+
69+
Would become this:
70+
71+
```
72+
<InputGroup>
73+
<Fieldset>
74+
<Fieldset.Legend>What is your address?</Fieldset.Legend>
75+
<TextInput id="address-1" />
76+
<TextInput id="address-2" />
77+
</Fieldset>
78+
</InputGroup>
79+
```
80+
81+
Which also allows consumers to omit the `Fieldset` if rendering a single input:
82+
83+
```
84+
<InputGroup>
85+
<HeadingLevel headingLevel="h3">What is your address?</HeadingLevel>
86+
<TextInput id="address-1" />
87+
</InputGroup>
88+
```

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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/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>;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import { fireEvent, render } from '@testing-library/react';
33
import Tabs from '../Tabs';
4-
import { HeadingLevelType } from '@util/HeadingLevel';
4+
import { HeadingLevelType } from '@components/utils/HeadingLevel';
55

66
describe('The tabs component', () => {
77
it('Matches the snapshot', () => {

0 commit comments

Comments
 (0)