Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nhsuk-react-components version 5 #258

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 27 additions & 21 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,66 @@
# NHS.UK React components

## Unreleased
## 5.0.0 - TBC

This version provides support for nhsuk-frontend version 9.

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).

## 4.1.3 - 23 September 2024

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

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

## 4.1.2 - 3 September 2024

:wrench: **Fixes**

* 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)
- 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)

## 4.1.1 - 9 August 2024

:wrench: **Fixes**

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

## 4.1.0 - 11 June 2024

:wrench: **Fixes**

* 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)
* 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)
* 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)
* Update Storybook docs for several components.
- 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)
- 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)
- 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)
- Update Storybook docs for several components.

:new: **New features**

* Added a CHANGELOG to keep track of changes between releases. [Keep a changelog](https://keepachangelog.com)
* Added support for `preventDoubleClick` debouncing on buttons. PR [#231](https://github.com/NHSDigital/nhsuk-react-components/pull/231)
* 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)
* Storybook link in readme now points to latest version. PR [#226](https://github.com/NHSDigital/nhsuk-react-components/pull/226)
- Added a CHANGELOG to keep track of changes between releases. [Keep a changelog](https://keepachangelog.com)
- Added support for `preventDoubleClick` debouncing on buttons. PR [#231](https://github.com/NHSDigital/nhsuk-react-components/pull/231)
- 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)
- Storybook link in readme now points to latest version. PR [#226](https://github.com/NHSDigital/nhsuk-react-components/pull/226)

## 4.0.2 - 21 May 2024

:wrench: **Fixes**

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

## 4.0.1 - 20 May 2024

:wrench: **Fixes**

* 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)
- 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)

## 4.0.0 - 15 May 2024

This version updates nhsuk-frontend to version 8.

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).
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).

* Migrate enzyme to react-testing-library by @JoshuaBates-NHS in [#198](https://github.com/NHSDigital/nhsuk-react-components/pull/198)
* Allow support for module directives in build process by @JoshuaBates-NHS in [#199](https://github.com/NHSDigital/nhsuk-react-components/pull/199)
* Update modified components since NHS UK frontend v5 by @jakeb-nhs in [#197](https://github.com/NHSDigital/nhsuk-react-components/pull/197)
* Add new components since NHS UK frontend v5 by @jakeb-nhs in [#202](https://github.com/NHSDigital/nhsuk-react-components/pull/202)
* 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)
* Improve unit test coverage by @jakeb-nhs in [#204](https://github.com/NHSDigital/nhsuk-react-components/pull/204)
- Migrate enzyme to react-testing-library by @JoshuaBates-NHS in [#198](https://github.com/NHSDigital/nhsuk-react-components/pull/198)
- Allow support for module directives in build process by @JoshuaBates-NHS in [#199](https://github.com/NHSDigital/nhsuk-react-components/pull/199)
- Update modified components since NHS UK frontend v5 by @jakeb-nhs in [#197](https://github.com/NHSDigital/nhsuk-react-components/pull/197)
- Add new components since NHS UK frontend v5 by @jakeb-nhs in [#202](https://github.com/NHSDigital/nhsuk-react-components/pull/202)
- 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)
- Improve unit test coverage by @jakeb-nhs in [#204](https://github.com/NHSDigital/nhsuk-react-components/pull/204)
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ class GetStartedButton extends PureComponent {

## Upgrading

* [Upgrading to 1.0](/docs/upgrade-to-1.0.md)
* [Upgrading to 2.0](/docs/upgrade-to-2.0.md)
* [Upgrading to 3.0](/docs/upgrade-to-3.0.md)
* [Upgrading to 4.0](/docs/upgrade-to-4.0.md)
- [Upgrading to 1.0](/docs/upgrade-to-1.0.md)
- [Upgrading to 2.0](/docs/upgrade-to-2.0.md)
- [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)

## Maintainers

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

## Preparing releases

Expand Down
56 changes: 56 additions & 0 deletions docs/upgrade-to-5.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Upgrading to 5.0

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.

## Breaking changes

### Breadcrumbs

The `Breadcrumbs` component no longer contains its own `<Container>` container component.

Instead, `Breadcrumbs` should be moved inside the existing `<Container>` or `<div class="nhsuk-width-container">` for your overall page, but before the `<main>` tag.

This means that instead of this:

```
<Breadcrumb>
<Breadcrumb.Item href="#">Home</Breadcrumb.Item>
</Breadcrumb>
<Container>
<main class="nhsuk-main-wrapper" id="maincontent" role="main">
...
</main>
</Container>
```

You should have this:

```
<Container>
<Breadcrumb>
<Breadcrumb.Item href="#">Home</Breadcrumb.Item>
</Breadcrumb>
<main class="nhsuk-main-wrapper" id="maincontent" role="main">
...
</main>
</Container>
```

### Back link

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)

## New Features

### Warning Button

A new Warning Button variant has been added to the `Button` component. To use this, set the `warning` prop on `Button`, e.g.

```
<Button warning>Delete</Button>
```

## Fixes

- Add aria-hidden to responsive table cells that show on small screens, to avoid screenreaders calling out the labels/column headings twice.
- Ensure that headers are aligned to expected standards (if there are fewer than 4 links on the header, the content is left-aligned).
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nhsuk-react-components",
"version": "4.1.2",
"version": "5.0.0",
"author": {
"name": "NHS England"
},
Expand Down Expand Up @@ -66,7 +66,7 @@
"jest": "^29.7.0",
"jest-axe": "^8.0.0",
"jest-environment-jsdom": "^29.7.0",
"nhsuk-frontend": "8.1.0",
"nhsuk-frontend": "^9.0.1",
"prettier": "^3.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand All @@ -87,7 +87,7 @@
"classnames": "^2.2.6"
},
"peerDependencies": {
"nhsuk-frontend": ">=8.0.0 <9.0.0",
"nhsuk-frontend": ">=9.0.0 <10.0.0",
"react": ">=16.8.0",
"react-dom": ">=16.8.0"
},
Expand Down
1 change: 1 addition & 0 deletions src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ describe('Index', () => {
'Fieldset',
'Footer',
'Form',
'FormGroup',
'Header',
'Hero',
'HintText',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import React, { FC, HTMLProps, createContext, useContext, ReactNode } from 'react';
import classNames from 'classnames';
import { Tick, Cross } from '@components/content-presentation/icons';
import HeadingLevel, { HeadingLevelType } from '@util/HeadingLevel';
import HeadingLevel, { HeadingLevelType } from '@components/utils/HeadingLevel';

type ListType = 'do' | 'dont';

Expand Down
2 changes: 1 addition & 1 deletion src/components/content-presentation/hero/Hero.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { FC, HTMLProps } from 'react';
import classNames from 'classnames';
import { Container, Row, Col } from '../../layout';
import HeadingLevel, { HeadingLevelType } from '@util/HeadingLevel';
import HeadingLevel, { HeadingLevelType } from '@components/utils/HeadingLevel';

interface HeroContentProps extends HTMLProps<HTMLDivElement> {
hasImage: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ const TableCell: FC<TableCellProps> = ({
) : (
<td className={classes} role={_responsive ? 'cell' : undefined} {...rest}>
{_responsive && (
<span className="nhsuk-table-responsive__heading">{_responsiveHeading}</span>
<span className="nhsuk-table-responsive__heading" aria-hidden>
{_responsiveHeading}
</span>
)}
{children}
</td>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { FC, ComponentProps, HTMLProps } from 'react';
import classNames from 'classnames';
import HeadingLevel from '@util/HeadingLevel';
import HeadingLevel from '@components/utils/HeadingLevel';

export interface TablePanelProps extends HTMLProps<HTMLDivElement> {
heading?: string;
Expand Down
2 changes: 1 addition & 1 deletion src/components/content-presentation/tabs/Tabs.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';
import classNames from 'classnames';
import React, { FC, HTMLAttributes, useEffect } from 'react';
import HeadingLevel, { HeadingLevelType } from '@util/HeadingLevel';
import HeadingLevel, { HeadingLevelType } from '@components/utils/HeadingLevel';
import TabsJs from '@resources/tabs';

type TabsProps = HTMLAttributes<HTMLDivElement>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { fireEvent, render } from '@testing-library/react';
import Tabs from '../Tabs';
import { HeadingLevelType } from '@util/HeadingLevel';
import { HeadingLevelType } from '@components/utils/HeadingLevel';

describe('The tabs component', () => {
it('Matches the snapshot', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { FC, HTMLProps } from 'react';
import classNames from 'classnames';
import HeadingLevel, { HeadingLevelType } from '@util/HeadingLevel';
import HeadingLevel, { HeadingLevelType } from '@components/utils/HeadingLevel';

interface WarningCalloutLabelProps extends HTMLProps<HTMLHeadingElement> {
headingLevel?: HeadingLevelType;
Expand Down
Loading
Loading