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

feat: update to support nhsuk-frontend v9 #136

Merged
merged 16 commits into from
Sep 27, 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
7 changes: 7 additions & 0 deletions .changeset/happy-pianos-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"nhsuk-frontend-react": major
---

feat(nhsuk-frontend-react): replace form group error line prop

BREAKING CHANGE: replace disableErrorLine with withErrorLine
7 changes: 7 additions & 0 deletions .changeset/metal-zebras-yell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"nhsuk-frontend-react": patch
---

refactor(nhsuk-frontend-react): update breadcrumb component

update component to remove the nhsuk-width-container inside the breadcrumb
8 changes: 8 additions & 0 deletions .changeset/ninety-brooms-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"nhsuk-frontend-react": major
"nhsuk-frontend-react-extension": major
---

chore: update nhsuk-frontend to v9

BREAKING CHANGE: update nhsuk-frontend to v9
18 changes: 18 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"mode": "exit",
"tag": "next",
"initialVersions": {
"nhsuk-frontend-react": "3.5.8",
"nhsuk-frontend-react-extension": "0.1.7"
},
"changesets": [
"happy-pianos-glow",
"metal-zebras-yell",
"ninety-brooms-obey",
"quick-planets-visit",
"silly-eagles-dance",
"sweet-months-look",
"ten-keys-refuse",
"witty-olives-sort"
]
}
5 changes: 5 additions & 0 deletions .changeset/quick-planets-visit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"nhsuk-frontend-react": minor
---

feat(nhsuk-frontend-react): update possible sizes for form element labels
5 changes: 5 additions & 0 deletions .changeset/silly-eagles-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"nhsuk-frontend-react-extension": patch
---

docs(nhsuk-frontend-react-extension): fix readme table header
5 changes: 5 additions & 0 deletions .changeset/sweet-months-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"nhsuk-frontend-react": minor
---

feat(nhsuk-frontend-react): update date input to accept name prefix
6 changes: 6 additions & 0 deletions .changeset/ten-keys-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"nhsuk-frontend-react": patch
"nhsuk-frontend-react-extension": patch
---

fix: update peer dependency version
6 changes: 6 additions & 0 deletions .changeset/witty-olives-sort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"nhsuk-frontend-react": patch
"nhsuk-frontend-react-extension": patch
---

chore: version packages (next)
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
publish_storybook:
runs-on: ubuntu-latest
needs: publish
if: ${{ needs.publish.outputs.published == 'true' }}
if: ${{ needs.publish.outputs.published == 'true' && github.ref == 'refs/heads/main' }}
permissions:
contents: write
steps:
Expand Down
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ This implementation supports the latest version of the NHS.UK Frontend library a

## Version compatibility

| nhsuk-frontend | nhsuk-frontend-react |
| -------------- | -------------------- |
| `8.x.x` | `3.x.x` |
| `9.x.x` | `4.x.x` |
With the release of v9 of the NHS.UK Frontend library, the version of this library has been bumped to v4. The following table shows the compatibility between the NHS.UK Frontend library and `nhsuk-frontend-react`:

| nhsuk-frontend | nhsuk-frontend-react | branch |
| -------------- | -------------------- | ------------------------------------------------------------- |
| `8.x.x` | `3.x.x` | [v3](https://github.com/rowellx68/nhs-components/tree/v3) |
| `9.x.x` | `4.x.x` | [main](https://github.com/rowellx68/nhs-components/tree/main) |

## Features

Expand Down Expand Up @@ -83,11 +85,6 @@ export const AppHeader = () => (

</details>

## Requirements

- [nhsuk-frontend v8+](https://github.com/nhsuk/nhsuk-frontend)
- [React v18.\*](https://reactjs.org/)

## Installation

```bash
Expand Down
22 changes: 22 additions & 0 deletions packages/nhsuk-frontend-react-extension/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# nhsuk-frontend-react-extension

## 1.0.0-next.2

### Patch Changes

- [`203c0e1`](https://github.com/rowellx68/nhs-components/commit/203c0e142b5b56b5a7a2b75001107afb065a4d4f) Thanks [@rowellx68](https://github.com/rowellx68)! - docs(nhsuk-frontend-react-extension): fix readme table header

- [`203c0e1`](https://github.com/rowellx68/nhs-components/commit/203c0e142b5b56b5a7a2b75001107afb065a4d4f) Thanks [@rowellx68](https://github.com/rowellx68)! - chore: version packages (next)

## 1.0.0-next.1

### Patch Changes

- [`ca65799`](https://github.com/rowellx68/nhs-components/commit/ca657998cdbd26e1e699c959ea9c04ab0f11df3a) Thanks [@rowellx68](https://github.com/rowellx68)! - fix: update peer dependency version

## 1.0.0-next.0

### Major Changes

- [`26a4962`](https://github.com/rowellx68/nhs-components/commit/26a4962845636e9193280f05595832572e93b9f4) Thanks [@rowellx68](https://github.com/rowellx68)! - chore: update nhsuk-frontend to v9

BREAKING CHANGE: update nhsuk-frontend to v9

## 0.1.8

### Patch Changes
Expand Down
13 changes: 5 additions & 8 deletions packages/nhsuk-frontend-react-extension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@ This is a collection of components not found in the NHS.UK Frontend library but

## Version compatibility

| nhsuk-frontend | nhsuk-frontend-react-extension |
| -------------- | ------------------------------ |
| `8.x.x` | `0.x.x` |
| `9.x.x` | `1.x.x` |
With the release of v9 of the NHS.UK Frontend library, the version of this library has been bumped to v4. The following table shows the compatibility between the NHS.UK Frontend library and `nhsuk-frontend-react-extension`:

## Requirements

- [nhsuk-frontend v8+](https://github.com/nhsuk/nhsuk-frontend)
- [React v18.\*](https://reactjs.org/)
| nhsuk-frontend | nhsuk-frontend-react-extension | branch |
| -------------- | ------------------------------ | ------------------------------------------------------------- |
| `8.x.x` | `0.x.x` | [v3](https://github.com/rowellx68/nhs-components/tree/v3) |
| `9.x.x` | `4.x.x` | [main](https://github.com/rowellx68/nhs-components/tree/main) |

## Installation

Expand Down
4 changes: 2 additions & 2 deletions packages/nhsuk-frontend-react-extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nhsuk-frontend-react-extension",
"version": "0.1.8",
"version": "1.0.0-next.2",
"homepage": "https://github.com/rowellx68/nhs-components",
"repository": {
"type": "git",
Expand Down Expand Up @@ -85,7 +85,7 @@
"clsx": "^2.1.1"
},
"peerDependencies": {
"nhsuk-frontend": "^8.0.0",
"nhsuk-frontend": "^9.0.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"tslib": "^2.6.2"
Expand Down
38 changes: 38 additions & 0 deletions packages/nhsuk-frontend-react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,43 @@
# CHANGELOG

## 4.0.0-next.2

### Minor Changes

- [`203c0e1`](https://github.com/rowellx68/nhs-components/commit/203c0e142b5b56b5a7a2b75001107afb065a4d4f) Thanks [@rowellx68](https://github.com/rowellx68)! - feat(nhsuk-frontend-react): update possible sizes for form element labels

### Patch Changes

- [`203c0e1`](https://github.com/rowellx68/nhs-components/commit/203c0e142b5b56b5a7a2b75001107afb065a4d4f) Thanks [@rowellx68](https://github.com/rowellx68)! - chore: version packages (next)

## 4.0.0-next.1

### Patch Changes

- [`ca65799`](https://github.com/rowellx68/nhs-components/commit/ca657998cdbd26e1e699c959ea9c04ab0f11df3a) Thanks [@rowellx68](https://github.com/rowellx68)! - fix: update peer dependency version

## 4.0.0-next.0

### Major Changes

- [`26a4962`](https://github.com/rowellx68/nhs-components/commit/26a4962845636e9193280f05595832572e93b9f4) Thanks [@rowellx68](https://github.com/rowellx68)! - feat(nhsuk-frontend-react): replace form group error line prop

BREAKING CHANGE: replace disableErrorLine with withErrorLine

- [`26a4962`](https://github.com/rowellx68/nhs-components/commit/26a4962845636e9193280f05595832572e93b9f4) Thanks [@rowellx68](https://github.com/rowellx68)! - chore: update nhsuk-frontend to v9

BREAKING CHANGE: update nhsuk-frontend to v9

### Minor Changes

- [`26a4962`](https://github.com/rowellx68/nhs-components/commit/26a4962845636e9193280f05595832572e93b9f4) Thanks [@rowellx68](https://github.com/rowellx68)! - feat(nhsuk-frontend-react): update date input to accept name prefix

### Patch Changes

- [`26a4962`](https://github.com/rowellx68/nhs-components/commit/26a4962845636e9193280f05595832572e93b9f4) Thanks [@rowellx68](https://github.com/rowellx68)! - refactor(nhsuk-frontend-react): update breadcrumb component

update component to remove the nhsuk-width-container inside the breadcrumb

## 3.6.3

### Patch Changes
Expand Down
15 changes: 6 additions & 9 deletions packages/nhsuk-frontend-react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ This implementation supports the latest version of the NHS.UK Frontend library a

## Version compatibility

| nhsuk-frontend | nhsuk-frontend-react |
| -------------- | -------------------- |
| `8.x.x` | `3.x.x` |
| `9.x.x` | `4.x.x` |
With the release of v9 of the NHS.UK Frontend library, the version of this library has been bumped to v4. The following table shows the compatibility between the NHS.UK Frontend library and `nhsuk-frontend-react`:

| nhsuk-frontend | nhsuk-frontend-react | branch |
| -------------- | -------------------- | ------------------------------------------------------------- |
| `8.x.x` | `3.x.x` | [v3](https://github.com/rowellx68/nhs-components/tree/v3) |
| `9.x.x` | `4.x.x` | [main](https://github.com/rowellx68/nhs-components/tree/main) |

## Features

Expand Down Expand Up @@ -83,11 +85,6 @@ export const AppHeader = () => (

</details>

## Requirements

- [nhsuk-frontend v8+](https://github.com/nhsuk/nhsuk-frontend)
- [React v18.\*](https://reactjs.org/)

## Installation

```bash
Expand Down
4 changes: 2 additions & 2 deletions packages/nhsuk-frontend-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nhsuk-frontend-react",
"version": "3.6.3",
"version": "4.0.0-next.2",
"homepage": "https://github.com/rowellx68/nhs-components",
"repository": {
"type": "git",
Expand Down Expand Up @@ -82,7 +82,7 @@
"clsx": "^2.1.1"
},
"peerDependencies": {
"nhsuk-frontend": "^8.0.0",
"nhsuk-frontend": "^9.0.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"tslib": "^2.6.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,9 @@ import { ElementProps } from '@/types/shared';
import { Factory, factory } from '@/internal/factory/factory';
import initDetails from '@/resources/details/details';

export type DetailsProps = (
| {
/**
* @deprecated Use `variant` instead.
*/
expander: true;
variant?: 'expander';
}
| {
/**
* @deprecated Use `variant` instead.
*/
expander?: true;
variant: 'expander';
}
| {
/**
* @deprecated Use `variant` instead.
*/
expander?: false;
variant?: 'default';
}
) &
ElementProps<'details'>;
export type DetailsProps = {
variant?: 'default' | 'expander';
} & ElementProps<'details'>;

type DetailsFactory = Factory<{
props: DetailsProps;
Expand All @@ -41,7 +20,7 @@ type DetailsFactory = Factory<{
}>;

const Details = factory<DetailsFactory>(
({ expander, variant, className, ...props }: DetailsProps, ref) => {
({ variant, className, ...props }: DetailsProps, ref) => {
const internalRef = useRef<HTMLDetailsElement>(null);

useImperativeHandle(ref, () => internalRef.current as HTMLDetailsElement);
Expand All @@ -64,7 +43,7 @@ const Details = factory<DetailsFactory>(
<details
className={clsx(
'nhsuk-details',
{ 'nhsuk-expander': expander || variant === 'expander' },
{ 'nhsuk-expander': variant === 'expander' },
className,
)}
{...props}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,10 @@ const TableBody = ({ className, ...props }: TableBodyProps) => (
<tbody className={clsx('nhsuk-table__body', className)} {...props} />
);

export type TableRowProps = {
/**
* @deprecated Will be removed in a future release. It now automatically detects the variant based on the context. This is now unused within the component.
*/
variant?: 'default' | 'head';
} & ElementProps<'tr'>;
export type TableRowProps = ElementProps<'tr'>;

const TableRow = ({
role = 'row',
variant,
className,
children,
...props
Expand All @@ -129,7 +123,7 @@ const TableRow = ({
const { head } = useTableHeadContext();

useEffect(() => {
if ((variant === 'head' || head) && tableVariant === 'responsive') {
if (head && tableVariant === 'responsive') {
const _headings: ReactNode[] = [];
Children.forEach(children, (child) => {
if (isValidElement(child) && child.type === TableCell) {
Expand All @@ -149,18 +143,18 @@ const TableRow = ({

let _children = children;

if ((variant === 'default' || !head) && tableVariant === 'responsive') {
_children = Children.map(children, (child, index) => {
if (isValidElement(child) && child.type === TableCell) {
return cloneElement(child as ReactElement<TableCellProps>, {
__responsiveHeading: responsiveHeadings[index] ?? '',
});
}
return child;
});
}
if (!head) {
if (tableVariant === 'responsive') {
_children = Children.map(children, (child, index) => {
if (isValidElement(child) && child.type === TableCell) {
return cloneElement(child as ReactElement<TableCellProps>, {
__responsiveHeading: responsiveHeadings[index] ?? '',
});
}
return child;
});
}

if (variant === 'default' || !head) {
_children = Children.map(_children, (child, index) => {
if (isValidElement(child) && child.type === TableCell) {
return cloneElement(child as ReactElement<TableCellProps>, {
Expand All @@ -176,7 +170,7 @@ const TableRow = ({
className={
clsx(
{
'nhsuk-table__row': variant === 'default' || !head,
'nhsuk-table__row': !head,
},
className,
) || undefined
Expand Down
Loading