From b361863188aecd1e106ed857e38e43fb86604a6c Mon Sep 17 00:00:00 2001 From: Colin Rotherham Date: Wed, 15 Oct 2025 17:42:14 +0100 Subject: [PATCH 1/6] Use `defaultValue` and `defaultChecked` without change handlers --- stories/Form Elements/Radios.stories.tsx | 6 +++--- stories/Form Elements/Select.stories.tsx | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/stories/Form Elements/Radios.stories.tsx b/stories/Form Elements/Radios.stories.tsx index 67c4dd63..34e75b68 100644 --- a/stories/Form Elements/Radios.stories.tsx +++ b/stories/Form Elements/Radios.stories.tsx @@ -19,7 +19,7 @@ export const StandardRadios: Story = { id="standard-example" > Yes - + No @@ -37,7 +37,7 @@ export const InlineRadios: Story = { inline > Yes - + No @@ -168,7 +168,7 @@ export const RadiosWithError: Story = { Yes - + No diff --git a/stories/Form Elements/Select.stories.tsx b/stories/Form Elements/Select.stories.tsx index bfb6ed24..b8a9dcc1 100644 --- a/stories/Form Elements/Select.stories.tsx +++ b/stories/Form Elements/Select.stories.tsx @@ -11,11 +11,9 @@ type Story = StoryObj; export const Standard: Story = { render: (args) => ( - NHS.UK frontend option 1 - - NHS.UK frontend option 2 - + NHS.UK frontend option 2 NHS.UK frontend option 3 From 9da0890f40fe25663037e44ed0ad4e87c63502a3 Mon Sep 17 00:00:00 2001 From: Colin Rotherham Date: Wed, 15 Oct 2025 17:56:53 +0100 Subject: [PATCH 2/6] Update form examples with `isPageHeading` --- stories/Form Elements/Checkboxes.stories.tsx | 31 +++++--------------- stories/Form Elements/DateInput.stories.tsx | 16 +++++----- stories/Form Elements/Fieldset.stories.tsx | 30 ++++++++++--------- stories/Form Elements/Label.stories.tsx | 8 ++--- stories/Form Elements/Radios.stories.tsx | 14 ++++----- stories/Form Elements/Select.stories.tsx | 20 ++++++++++--- stories/Form Elements/TextInput.stories.tsx | 19 +----------- stories/Form Elements/Textarea.stories.tsx | 13 ++------ 8 files changed, 61 insertions(+), 90 deletions(-) diff --git a/stories/Form Elements/Checkboxes.stories.tsx b/stories/Form Elements/Checkboxes.stories.tsx index 54ea1909..747269e6 100644 --- a/stories/Form Elements/Checkboxes.stories.tsx +++ b/stories/Form Elements/Checkboxes.stories.tsx @@ -48,7 +48,7 @@ export const Standard: Story = {
( - + ( - - - Waste from animal carcasses - Waste from mines or quarries - Farm or agricultural waste - - - ), -}; - export const WithExclusiveNoneOption: Story = { render: (args) => (
Component console.log(e.target.value)} /> @@ -41,7 +41,7 @@ export const StandardWithError: Story = {
Component
console.log(e.target.value)} @@ -51,7 +51,7 @@ export const StandardWithError: Story = { console.log(e.target.value)} > @@ -71,7 +71,7 @@ export const PrePopulatedIndividualComponents: Story = {
Component
@@ -91,7 +91,7 @@ export const PrePopulatedWrapper: Story = {
Component
@@ -108,7 +108,7 @@ export const ControlledElementIndividualComponents: Story = {
Component
@@ -128,7 +128,7 @@ export const ControlledElementWrapper: Story = {
Component
@@ -148,7 +148,7 @@ export const ChangeableControlledElement: Story = { return ( setValue(e.currentTarget.value)} diff --git a/stories/Form Elements/Fieldset.stories.tsx b/stories/Form Elements/Fieldset.stories.tsx index 9441b6c0..e1d68378 100644 --- a/stories/Form Elements/Fieldset.stories.tsx +++ b/stories/Form Elements/Fieldset.stories.tsx @@ -20,7 +20,7 @@ import { Fieldset, TextInput } from '#components'; * const Element = () => { * return ( *
- * What is your address? + * What is your address? *
* ); * } @@ -36,7 +36,9 @@ type Story = StoryObj; export const Standard: Story = { render: (args) => (
- What is your address? + + What is your address? + ( -
- What is your address? -
- ), -}; - export const WithCustomLegendSizeS: Story = { name: 'With Bold Text (S)', render: (args) => (
- What is your address? + + What is your address? +
), }; @@ -88,7 +84,9 @@ export const WithCustomLegendSizeM: Story = { name: 'With Custom Size (M)', render: (args) => (
- What is your address? + + What is your address? +
), }; @@ -97,7 +95,9 @@ export const WithCustomLegendSizeL: Story = { name: 'With Custom Size (L)', render: (args) => (
- What is your address? + + What is your address? +
), }; @@ -106,7 +106,9 @@ export const WithCustomLegendSizeXL: Story = { name: 'With Custom Size (XL)', render: (args) => (
- What is your address? + + What is your address? +
), }; diff --git a/stories/Form Elements/Label.stories.tsx b/stories/Form Elements/Label.stories.tsx index bf8a793b..a9a559ef 100644 --- a/stories/Form Elements/Label.stories.tsx +++ b/stories/Form Elements/Label.stories.tsx @@ -7,7 +7,7 @@ const meta: Meta = { args: { children: 'National Insurance Number', size: undefined, - isPageHeading: false, + isPageHeading: true, }, argTypes: { size: { control: 'select', options: [undefined, 's', 'm', 'l', 'xl'] }, @@ -16,11 +16,9 @@ const meta: Meta = { export default meta; type Story = StoryObj; -export const Standard: Story = {}; - -export const AsPageHeading: Story = { +export const Standard: Story = { args: { - isPageHeading: true, + size: 'l', }, }; diff --git a/stories/Form Elements/Radios.stories.tsx b/stories/Form Elements/Radios.stories.tsx index 34e75b68..5eb53994 100644 --- a/stories/Form Elements/Radios.stories.tsx +++ b/stories/Form Elements/Radios.stories.tsx @@ -13,7 +13,7 @@ export const StandardRadios: Story = { render: (args) => ( ( ( ( @@ -123,7 +123,7 @@ export const RadiosWithHintsOnItems: Story = { render: (args) => ( @@ -160,7 +160,7 @@ export const RadiosWithError: Story = { <> ; export const Standard: Story = { render: (args) => ( - NHS.UK frontend option 1 NHS.UK frontend option 2 @@ -23,7 +27,11 @@ export const Standard: Story = { export const SelectWithHintText: Story = { render: (args) => ( - NHS.UK frontend option 1 NHS.UK frontend option 2 NHS.UK frontend option 3 @@ -36,7 +44,11 @@ export const SelectWithError: Story = { const [error, setError] = useState('Error message goes here'); return ( <> - NHS.UK frontend option 1 NHS.UK frontend option 2 NHS.UK frontend option 3 @@ -56,7 +68,7 @@ export const SelectWithErrorAndHintString: Story = { <>