@developer-overheid-nl/don-register-components 1.3.1 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/CHANGELOG.md +170 -130
  2. package/LICENSE.md +291 -291
  3. package/README.md +20 -20
  4. package/package.json +10 -6
  5. package/src/Introduction.mdx +31 -0
  6. package/src/alert/Alert.stories.tsx +57 -0
  7. package/src/alert/Alert.tsx +19 -19
  8. package/src/alert/styles.module.css +3 -3
  9. package/src/alignBox/AlignBox.stories.tsx +84 -0
  10. package/src/alignBox/AlignBox.tsx +114 -114
  11. package/src/alignBox/styles.module.css +110 -110
  12. package/src/amountLabel/AmountLabel.stories.tsx +28 -0
  13. package/src/amountLabel/AmountLabel.tsx +21 -16
  14. package/src/amountLabel/styles.module.css +11 -11
  15. package/src/analytics/PiwikPro.tsx +94 -94
  16. package/src/analytics/index.ts +1 -1
  17. package/src/article/Article.stories.tsx +53 -0
  18. package/src/article/Article.tsx +10 -10
  19. package/src/badgeList/BadgeList.tsx +34 -34
  20. package/src/badgeList/styles.module.css +37 -37
  21. package/src/block/Block.stories.tsx +58 -0
  22. package/src/block/Block.tsx +35 -35
  23. package/src/block/styles.module.css +29 -29
  24. package/src/button/Button.stories.tsx +56 -0
  25. package/src/button/Button.tsx +3 -3
  26. package/src/button/ButtonAction.stories.tsx +62 -0
  27. package/src/button/ButtonAction.tsx +51 -0
  28. package/src/cardAsLink/CardAsLink.stories.tsx +81 -0
  29. package/src/cardAsLink/CardAsLink.tsx +21 -21
  30. package/src/cardAsLink/styles.module.css +23 -23
  31. package/src/cardsList/CardsList.tsx +56 -56
  32. package/src/cardsList/styles.module.css +18 -19
  33. package/src/client.ts +7 -7
  34. package/src/container/Container.stories.tsx +21 -0
  35. package/src/container/Container.tsx +10 -10
  36. package/src/container/styles.module.css +28 -28
  37. package/src/copyButton/CopyButton.stories.tsx +41 -0
  38. package/src/copyButton/CopyButton.tsx +45 -39
  39. package/src/copyButton/styles.module.css +13 -13
  40. package/src/dataBadgeLink/DataBadgeLink.stories.tsx +137 -0
  41. package/src/dataBadgeLink/DataBadgeLink.tsx +59 -53
  42. package/src/dataBadgeLink/styles.module.css +89 -89
  43. package/src/dataSummary/DataSummary.tsx +22 -22
  44. package/src/dataSummary/DataSummaryItem.tsx +21 -21
  45. package/src/dataSummary/styles.module.css +75 -75
  46. package/src/facetFilters/FacetFilters.stories.tsx +93 -0
  47. package/src/facetFilters/FacetFilters.tsx +424 -419
  48. package/src/facetFilters/styles.module.css +3 -3
  49. package/src/fieldset/FieldSet.stories.tsx +45 -0
  50. package/src/fieldset/FieldSet.tsx +3 -3
  51. package/src/filters/Filters.stories.tsx +45 -0
  52. package/src/filters/Filters.tsx +116 -116
  53. package/src/filters/styles.module.css +26 -26
  54. package/src/footer/Footer.stories.tsx +127 -0
  55. package/src/footer/Footer.tsx +81 -76
  56. package/src/footer/styles.module.css +103 -103
  57. package/src/formFieldCheckboxGroup/FormFieldCheckboxGroup.stories.tsx +48 -0
  58. package/src/formFieldCheckboxGroup/FormFieldCheckboxGroup.tsx +16 -16
  59. package/src/formFieldCheckboxGroup/styles.module.css +5 -5
  60. package/src/formFieldCheckboxOption/FormFieldCheckboxOption.stories.tsx +61 -0
  61. package/src/formFieldCheckboxOption/FormFieldCheckboxOption.tsx +26 -26
  62. package/src/formFieldCheckboxOption/styles.module.css +22 -22
  63. package/src/formFieldLabel/FormFieldLabel.stories.tsx +21 -0
  64. package/src/formFieldLabel/FormFieldLabel.tsx +23 -23
  65. package/src/formFieldRadioGroup/FormFieldRadioGroup.stories.tsx +57 -0
  66. package/src/formFieldRadioGroup/FormFieldRadioGroup.tsx +13 -13
  67. package/src/formFieldRadioGroup/styles.module.css +5 -5
  68. package/src/formFieldRadioOption/FormFieldRadioOption.stories.tsx +48 -0
  69. package/src/formFieldRadioOption/FormFieldRadioOption.tsx +75 -75
  70. package/src/formFieldRadioOption/styles.module.css +49 -49
  71. package/src/formFieldSwitch/FormFieldSwitch.stories.tsx +61 -0
  72. package/src/formFieldSwitch/FormFieldSwitch.tsx +82 -79
  73. package/src/formFieldSwitch/styles.module.css +32 -32
  74. package/src/formFieldTextInput/FormFieldTextInput.stories.tsx +45 -0
  75. package/src/formFieldTextInput/FormFieldTextInput.tsx +3 -3
  76. package/src/grid/Grid.stories.tsx +37 -0
  77. package/src/grid/Grid.tsx +48 -0
  78. package/src/grid/styles.module.css +24 -0
  79. package/src/header/Header.stories.tsx +54 -0
  80. package/src/header/Header.tsx +137 -137
  81. package/src/header/styles.module.css +71 -71
  82. package/src/heading/Heading.stories.tsx +60 -0
  83. package/src/heading/Heading.tsx +15 -15
  84. package/src/headingGroup/HeadingGroup.stories.tsx +57 -0
  85. package/src/headingGroup/HeadingGroup.tsx +48 -48
  86. package/src/headingGroup/styles.module.css +3 -3
  87. package/src/i18n.ts +24 -25
  88. package/src/iconBadge/IconBadge.stories.tsx +46 -0
  89. package/src/iconBadge/IconBadge.tsx +35 -35
  90. package/src/iconBadge/getAppearance.ts +53 -53
  91. package/src/iconBadge/styles.module.css +19 -19
  92. package/src/iconsSprite/Icon.stories.tsx +73 -0
  93. package/src/iconsSprite/Icon.tsx +17 -17
  94. package/src/iconsSprite/IconsSprite.tsx +5 -5
  95. package/src/index.ts +117 -107
  96. package/src/infoButton/InfoButton.stories.tsx +52 -0
  97. package/src/infoButton/InfoButton.tsx +45 -45
  98. package/src/infoButton/styles.module.css +43 -43
  99. package/src/link/Link.stories.tsx +49 -0
  100. package/src/link/Link.tsx +10 -10
  101. package/src/markdown/Markdown.stories.tsx +48 -0
  102. package/src/markdown/Markdown.tsx +42 -42
  103. package/src/overlay/Overlay.stories.tsx +38 -0
  104. package/src/overlay/Overlay.tsx +18 -18
  105. package/src/overlay/styles.module.css +15 -15
  106. package/src/pagination/Pagination.stories.tsx +91 -0
  107. package/src/pagination/Pagination.tsx +267 -267
  108. package/src/pagination/styles.module.css +28 -28
  109. package/src/paragraph/Paragraph.stories.tsx +45 -0
  110. package/src/paragraph/Paragraph.tsx +24 -24
  111. package/src/paragraph/styles.module.css +6 -6
  112. package/src/pillBadge/PillBadge.examples.tsx +107 -107
  113. package/src/pillBadge/PillBadge.stories.tsx +257 -0
  114. package/src/pillBadge/PillBadge.tsx +60 -51
  115. package/src/pillBadge/styles.module.css +214 -214
  116. package/src/readOnlyTextInput/ReadOnlyTextInput.stories.tsx +49 -0
  117. package/src/readOnlyTextInput/ReadOnlyTextInput.tsx +24 -24
  118. package/src/readOnlyTextInput/styles.module.css +19 -19
  119. package/src/scoreBadge/ScoreBadge.stories.tsx +45 -0
  120. package/src/scoreBadge/ScoreBadge.tsx +135 -133
  121. package/src/search/Search.stories.tsx +65 -0
  122. package/src/search/Search.tsx +82 -82
  123. package/src/search/styles.module.css +40 -39
  124. package/src/siteLogo/ExampleLogo.stories.tsx +40 -0
  125. package/src/siteLogo/SiteLogo.stories.tsx +28 -0
  126. package/src/siteLogo/SiteLogo.tsx +24 -24
  127. package/src/sortForm/SortForm.stories.tsx +111 -0
  128. package/src/sortForm/SortForm.tsx +121 -0
  129. package/src/sortForm/styles.module.css +40 -0
  130. package/src/switch/Switch.stories.tsx +68 -0
  131. package/src/switch/Switch.tsx +152 -86
  132. package/src/switch/styles.module.css +54 -7
  133. package/src/toolTip/ToolTip.stories.tsx +131 -0
  134. package/src/toolTip/ToolTip.tsx +55 -55
  135. package/src/toolTip/styles.module.css +49 -49
  136. package/src/topNavigation/TopNavigation.stories.tsx +71 -0
  137. package/src/topNavigation/TopNavigation.tsx +67 -67
  138. package/src/topNavigation/styles.module.css +54 -54
  139. package/tsconfig.json +122 -121
@@ -1,103 +1,103 @@
1
- .footer {
2
- --utrecht-page-footer-padding-block-end: 2rem;
3
- --utrecht-page-footer-padding-block-start: 1rem;
4
- --utrecht-page-footer-padding-inline-end: var(
5
- --rhc-nav-bar-link-padding-inline-end
6
- );
7
- --utrecht-page-footer-padding-inline-start: var(
8
- --rhc-nav-bar-link-padding-inline-start
9
- );
10
- --rhc-page-footer-outlined-color: #154273;
11
- --rhc-page-footer-outlined-border-color: var(--rhc-nav-bar-border-color);
12
- --rhc-page-footer-border-block-start-width: var(
13
- --rhc-nav-bar-border-block-end-width
14
- );
15
- }
16
-
17
- .footer {
18
- :global(.utrecht-column-layout) {
19
- display: flex;
20
- justify-content: space-between;
21
- inline-size: 100%;
22
-
23
- > * {
24
- flex-grow: 0;
25
- flex-shrink: 0;
26
- }
27
- }
28
-
29
- &.numColumns,
30
- &.numColumns1 {
31
- :global(.utrecht-column-layout) {
32
- row-gap: 0.5rem;
33
-
34
- > * {
35
- flex-basis: 100%;
36
- }
37
- }
38
- }
39
-
40
- &.numColumns2 {
41
- :global(.utrecht-column-layout) {
42
- > * {
43
- flex-basis: calc(50% - var(--utrecht-column-layout-gap, 2em));
44
- }
45
- }
46
- }
47
-
48
- &.numColumns3 {
49
- :global(.utrecht-column-layout) {
50
- > * {
51
- flex-basis: calc(33.333% - var(--utrecht-column-layout-gap, 2em));
52
- }
53
- }
54
- }
55
- &.numColumns4 {
56
- :global(.utrecht-column-layout) {
57
- flex-wrap: wrap;
58
-
59
- > * {
60
- flex-basis: calc(25% - var(--utrecht-column-layout-gap, 2em));
61
- }
62
- }
63
- }
64
-
65
- :global(.utrecht-link-list__link) {
66
- align-items: center;
67
- :global(.don-icon-externe-link-inline) {
68
- order: 1;
69
- }
70
- }
71
- }
72
-
73
- @media (--xs-and-below-viewport) {
74
- .footer.footer {
75
- :global(.utrecht-column-layout) {
76
- row-gap: 0.5rem;
77
-
78
- > * {
79
- flex-basis: calc(50% - var(--utrecht-column-layout-gap, 2em));
80
- }
81
- }
82
- }
83
- }
84
-
85
- @media (--xxs-and-below-viewport) {
86
- .footer.footer {
87
- :global(.utrecht-column-layout) {
88
- row-gap: 0.5rem;
89
-
90
- > * {
91
- flex-basis: 100%;
92
- }
93
- }
94
- }
95
- }
96
-
97
- :global(.rhc-page-prefooter.rhc-page-prefooter) {
98
- margin-block-start: 2rem;
99
-
100
- &:before {
101
- background-color: var(--rhc-nav-bar-border-color);
102
- }
103
- }
1
+ .footer {
2
+ --utrecht-page-footer-padding-block-end: 2rem;
3
+ --utrecht-page-footer-padding-block-start: 1rem;
4
+ --utrecht-page-footer-padding-inline-end: var(
5
+ --rhc-nav-bar-link-padding-inline-end
6
+ );
7
+ --utrecht-page-footer-padding-inline-start: var(
8
+ --rhc-nav-bar-link-padding-inline-start
9
+ );
10
+ --rhc-page-footer-outlined-color: #154273;
11
+ --rhc-page-footer-outlined-border-color: var(--rhc-nav-bar-border-color);
12
+ --rhc-page-footer-border-block-start-width: var(
13
+ --rhc-nav-bar-border-block-end-width
14
+ );
15
+ }
16
+
17
+ .footer {
18
+ :global(.utrecht-column-layout) {
19
+ display: flex;
20
+ justify-content: space-between;
21
+ inline-size: 100%;
22
+
23
+ > * {
24
+ flex-grow: 0;
25
+ flex-shrink: 0;
26
+ }
27
+ }
28
+
29
+ &.numColumns,
30
+ &.numColumns1 {
31
+ :global(.utrecht-column-layout) {
32
+ row-gap: 0.5rem;
33
+
34
+ > * {
35
+ flex-basis: 100%;
36
+ }
37
+ }
38
+ }
39
+
40
+ &.numColumns2 {
41
+ :global(.utrecht-column-layout) {
42
+ > * {
43
+ flex-basis: calc(50% - var(--utrecht-column-layout-gap, 2em));
44
+ }
45
+ }
46
+ }
47
+
48
+ &.numColumns3 {
49
+ :global(.utrecht-column-layout) {
50
+ > * {
51
+ flex-basis: calc(33.333% - var(--utrecht-column-layout-gap, 2em));
52
+ }
53
+ }
54
+ }
55
+ &.numColumns4 {
56
+ :global(.utrecht-column-layout) {
57
+ flex-wrap: wrap;
58
+
59
+ > * {
60
+ flex-basis: calc(25% - var(--utrecht-column-layout-gap, 2em));
61
+ }
62
+ }
63
+ }
64
+
65
+ :global(.utrecht-link-list__link) {
66
+ align-items: center;
67
+ :global(.don-icon-externe-link-inline) {
68
+ order: 1;
69
+ }
70
+ }
71
+ }
72
+
73
+ @media (--xs-and-below-viewport) {
74
+ .footer.footer {
75
+ :global(.utrecht-column-layout) {
76
+ row-gap: 0.5rem;
77
+
78
+ > * {
79
+ flex-basis: calc(50% - var(--utrecht-column-layout-gap, 2em));
80
+ }
81
+ }
82
+ }
83
+ }
84
+
85
+ @media (--xxs-and-below-viewport) {
86
+ .footer.footer {
87
+ :global(.utrecht-column-layout) {
88
+ row-gap: 0.5rem;
89
+
90
+ > * {
91
+ flex-basis: 100%;
92
+ }
93
+ }
94
+ }
95
+ }
96
+
97
+ :global(.rhc-page-prefooter.rhc-page-prefooter) {
98
+ margin-block-start: 2rem;
99
+
100
+ &:before {
101
+ background-color: var(--rhc-nav-bar-border-color);
102
+ }
103
+ }
@@ -0,0 +1,48 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import FormFieldCheckboxOption from "../formFieldCheckboxOption/FormFieldCheckboxOption";
3
+ import FormFieldCheckboxGroup from "./FormFieldCheckboxGroup";
4
+
5
+ const organisationOptions = [
6
+ { value: "kadaster", label: "Kadaster", count: 12, selected: true },
7
+ { value: "geonovum", label: "Geonovum", count: 8, selected: false },
8
+ { value: "logius", label: "Logius", count: 5, selected: false },
9
+ ];
10
+
11
+ /**
12
+ * FormFieldCheckboxGroup groepeert een set `FormFieldCheckboxOption`-velden
13
+ * onder een gezamenlijk label, beschrijving en foutmelding.
14
+ *
15
+ * ## Wijzigingen tov RHC:
16
+ * - Alleen een extra CSS-klasse; geen wijzigingen in props.
17
+ */
18
+ const meta = {
19
+ title: "Components/Form/FormFieldCheckboxGroup",
20
+ component: FormFieldCheckboxGroup,
21
+ tags: ["autodocs", "re-export", "remixed"],
22
+ args: {
23
+ label: "Organisatie",
24
+ description: "Filter op eigenaar of beheerder van de registratie.",
25
+ children: organisationOptions.map((option) => (
26
+ <FormFieldCheckboxOption
27
+ key={option.value}
28
+ name="organisation"
29
+ value={option.value}
30
+ label={option.label}
31
+ amount={option.count}
32
+ defaultChecked={option.selected}
33
+ />
34
+ )),
35
+ },
36
+ } satisfies Meta<typeof FormFieldCheckboxGroup>;
37
+
38
+ export default meta;
39
+ type Story = StoryObj<typeof meta>;
40
+
41
+ export const Default: Story = {};
42
+
43
+ export const Invalid: Story = {
44
+ args: {
45
+ invalid: true,
46
+ errorMessage: "Kies minimaal één organisatie.",
47
+ },
48
+ };
@@ -1,16 +1,16 @@
1
- import {
2
- type FormFieldCheckboxGroupProps,
3
- FormFieldCheckboxGroup as RHCFormFieldCheckboxGroup,
4
- } from "@rijkshuisstijl-community/components-react";
5
- import styles from "./styles.module.css";
6
-
7
- const FormFieldCheckboxGroup = (props: FormFieldCheckboxGroupProps) => {
8
- return (
9
- <RHCFormFieldCheckboxGroup
10
- className={styles.formFieldCheckboxGroup}
11
- {...props}
12
- />
13
- );
14
- };
15
-
16
- export default FormFieldCheckboxGroup;
1
+ import {
2
+ type FormFieldCheckboxGroupProps,
3
+ FormFieldCheckboxGroup as RHCFormFieldCheckboxGroup,
4
+ } from "@rijkshuisstijl-community/components-react";
5
+ import styles from "./styles.module.css";
6
+
7
+ const FormFieldCheckboxGroup = (props: FormFieldCheckboxGroupProps) => {
8
+ return (
9
+ <RHCFormFieldCheckboxGroup
10
+ className={styles.formFieldCheckboxGroup}
11
+ {...props}
12
+ />
13
+ );
14
+ };
15
+
16
+ export default FormFieldCheckboxGroup;
@@ -1,5 +1,5 @@
1
- .formFieldCheckboxGroup {
2
- :global(& > .utrecht-form-field__label) {
3
- display: none;
4
- }
5
- }
1
+ .formFieldCheckboxGroup {
2
+ :global(& > .utrecht-form-field__label) {
3
+ display: none;
4
+ }
5
+ }
@@ -0,0 +1,61 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import FormFieldCheckboxOption from "./FormFieldCheckboxOption";
3
+
4
+ /**
5
+ * FormFieldCheckboxOption is een enkele checkbox binnen een
6
+ * `FormFieldCheckboxGroup`, bijvoorbeeld voor een meerkeuze-filteroptie.
7
+ *
8
+ * ## Wijzigingen tov RHC:
9
+ * - Voegt een `amount`-prop toe, getoond tussen haakjes achter het label
10
+ * (via `AmountLabel`).
11
+ * - `children` worden getoond als extra info naast de optie (bijv. voor een
12
+ * ToolTip).
13
+ */
14
+ const meta = {
15
+ title: "Components/Form/FormFieldCheckboxOption",
16
+ component: FormFieldCheckboxOption,
17
+ tags: ["autodocs", "remixed"],
18
+ args: {
19
+ label: "Kadaster",
20
+ name: "organisation",
21
+ value: "kadaster",
22
+ },
23
+ argTypes: {
24
+ checked: { control: "boolean" },
25
+ defaultChecked: { control: "boolean" },
26
+ disabled: { control: "boolean" },
27
+ invalid: { control: "boolean" },
28
+ },
29
+ } satisfies Meta<typeof FormFieldCheckboxOption>;
30
+
31
+ export default meta;
32
+ type Story = StoryObj<typeof meta>;
33
+
34
+ export const Default: Story = {};
35
+
36
+ export const WithAmount: Story = {
37
+ args: {
38
+ amount: 12,
39
+ },
40
+ };
41
+
42
+ export const Checked: Story = {
43
+ args: {
44
+ amount: 12,
45
+ defaultChecked: true,
46
+ },
47
+ };
48
+
49
+ export const Disabled: Story = {
50
+ args: {
51
+ amount: 12,
52
+ disabled: true,
53
+ },
54
+ };
55
+
56
+ export const Invalid: Story = {
57
+ args: {
58
+ amount: 12,
59
+ invalid: true,
60
+ },
61
+ };
@@ -1,26 +1,26 @@
1
- import {
2
- FormFieldCheckboxOption as RHCFormFieldCheckboxOption,
3
- type FormFieldCheckboxOptionProps as RHCFormFieldCheckboxOptionProps,
4
- } from "@rijkshuisstijl-community/components-react";
5
- import clsx from "clsx";
6
- import AmountLabel, { type AmountLabelProps } from "../amountLabel/AmountLabel";
7
- import styles from "./styles.module.css";
8
-
9
- export interface FormFieldCheckboxOptionProps
10
- extends Omit<RHCFormFieldCheckboxOptionProps, "label">,
11
- AmountLabelProps {}
12
-
13
- const FormFieldCheckboxOption = (props: FormFieldCheckboxOptionProps) => {
14
- const { amount, label, className, children, ...restProps } = props;
15
- return (
16
- <RHCFormFieldCheckboxOption
17
- className={clsx(styles.checkbox, className)}
18
- label={<AmountLabel label={label} amount={amount} />}
19
- {...restProps}
20
- >
21
- <span className={styles.info}>{children}</span>
22
- </RHCFormFieldCheckboxOption>
23
- );
24
- };
25
-
26
- export default FormFieldCheckboxOption;
1
+ import {
2
+ FormFieldCheckboxOption as RHCFormFieldCheckboxOption,
3
+ type FormFieldCheckboxOptionProps as RHCFormFieldCheckboxOptionProps,
4
+ } from "@rijkshuisstijl-community/components-react";
5
+ import clsx from "clsx";
6
+ import AmountLabel, { type AmountLabelProps } from "../amountLabel/AmountLabel";
7
+ import styles from "./styles.module.css";
8
+
9
+ export interface FormFieldCheckboxOptionProps
10
+ extends Omit<RHCFormFieldCheckboxOptionProps, "label">,
11
+ AmountLabelProps {}
12
+
13
+ const FormFieldCheckboxOption = (props: FormFieldCheckboxOptionProps) => {
14
+ const { amount, label, className, children, ...restProps } = props;
15
+ return (
16
+ <RHCFormFieldCheckboxOption
17
+ className={clsx(styles.checkbox, className)}
18
+ label={<AmountLabel label={label} amount={amount} />}
19
+ {...restProps}
20
+ >
21
+ <span className={styles.info}>{children}</span>
22
+ </RHCFormFieldCheckboxOption>
23
+ );
24
+ };
25
+
26
+ export default FormFieldCheckboxOption;
@@ -1,22 +1,22 @@
1
- .checkbox.checkbox {
2
- --utrecht-form-field-label-margin-block-end: 0;
3
-
4
- grid-template-areas:
5
- 'input label info'
6
- 'input description description'
7
- 'input error-message error-message'
8
- 'input status status';
9
-
10
- :global(.utrecht-form-label) {
11
- display: flex;
12
- }
13
-
14
- :global(.utrecht-checkbox) {
15
- order: initial;
16
- margin-block-start: 0;
17
- }
18
- }
19
-
20
- .info {
21
- grid-area: info;
22
- }
1
+ .checkbox.checkbox {
2
+ --utrecht-form-field-label-margin-block-end: 0;
3
+
4
+ grid-template-areas:
5
+ 'input label info'
6
+ 'input description description'
7
+ 'input error-message error-message'
8
+ 'input status status';
9
+
10
+ :global(.utrecht-form-label) {
11
+ display: flex;
12
+ }
13
+
14
+ :global(.utrecht-checkbox) {
15
+ order: initial;
16
+ margin-block-start: 0;
17
+ }
18
+ }
19
+
20
+ .info {
21
+ grid-area: info;
22
+ }
@@ -0,0 +1,21 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import FormFieldLabel from "./FormFieldLabel";
3
+
4
+ /**
5
+ * FormFieldLabel is een label voor een formulierveld, met de
6
+ * `utrecht-form-label`-stijl van RHC.
7
+ */
8
+ const meta = {
9
+ title: "Components/Form/FormFieldLabel",
10
+ component: FormFieldLabel,
11
+ tags: ["autodocs", "custom"],
12
+ args: {
13
+ children: "E-mailadres",
14
+ htmlFor: "email",
15
+ },
16
+ } satisfies Meta<typeof FormFieldLabel>;
17
+
18
+ export default meta;
19
+ type Story = StoryObj<typeof meta>;
20
+
21
+ export const Default: Story = {};
@@ -1,23 +1,23 @@
1
- import clsx from "clsx";
2
- import type React from "react";
3
-
4
- interface FormFieldLabelProps {
5
- htmlFor?: string;
6
- children: React.ReactNode;
7
- required?: boolean;
8
- className?: string;
9
- }
10
-
11
- const FormFieldLabel: React.FC<FormFieldLabelProps> = ({
12
- htmlFor,
13
- children,
14
- className,
15
- }) => {
16
- return (
17
- <label htmlFor={htmlFor} className={clsx("utrecht-form-label", className)}>
18
- {children}
19
- </label>
20
- );
21
- };
22
-
23
- export default FormFieldLabel;
1
+ import clsx from "clsx";
2
+ import type React from "react";
3
+
4
+ export interface FormFieldLabelProps {
5
+ htmlFor?: string;
6
+ children: React.ReactNode;
7
+ required?: boolean;
8
+ className?: string;
9
+ }
10
+
11
+ const FormFieldLabel: React.FC<FormFieldLabelProps> = ({
12
+ htmlFor,
13
+ children,
14
+ className,
15
+ }) => {
16
+ return (
17
+ <label htmlFor={htmlFor} className={clsx("utrecht-form-label", className)}>
18
+ {children}
19
+ </label>
20
+ );
21
+ };
22
+
23
+ export default FormFieldLabel;
@@ -0,0 +1,57 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import FormFieldRadioOption from "../formFieldRadioOption/FormFieldRadioOption";
3
+ import FormFieldRadioGroup from "./FormFieldRadioGroup";
4
+
5
+ const lifecycleOptions = [
6
+ { value: "active", label: "Actief", count: 18, selected: true },
7
+ { value: "deprecated", label: "Verouderd", count: 2, selected: false },
8
+ ];
9
+
10
+ /**
11
+ * FormFieldRadioGroup groepeert een set `FormFieldRadioOption`-velden onder
12
+ * een gezamenlijk label, beschrijving en foutmelding.
13
+ *
14
+ * ## Wijzigingen tov RHC:
15
+ * - Alleen een extra CSS-klasse; geen wijzigingen in props.
16
+ */
17
+ const meta = {
18
+ title: "Components/Form/FormFieldRadioGroup",
19
+ component: FormFieldRadioGroup,
20
+ tags: ["autodocs", "remixed"],
21
+ args: {
22
+ label: "Levensfase",
23
+ description: "Toon alleen registraties met deze levensfase.",
24
+ children: (
25
+ <>
26
+ <FormFieldRadioOption
27
+ key="none"
28
+ name="lifecycle"
29
+ value=""
30
+ label="Alles"
31
+ />
32
+ {lifecycleOptions.map((option) => (
33
+ <FormFieldRadioOption
34
+ key={option.value}
35
+ name="lifecycle"
36
+ value={option.value}
37
+ label={option.label}
38
+ amount={option.count}
39
+ defaultChecked={option.selected}
40
+ />
41
+ ))}
42
+ </>
43
+ ),
44
+ },
45
+ } satisfies Meta<typeof FormFieldRadioGroup>;
46
+
47
+ export default meta;
48
+ type Story = StoryObj<typeof meta>;
49
+
50
+ export const Default: Story = {};
51
+
52
+ export const Invalid: Story = {
53
+ args: {
54
+ invalid: true,
55
+ errorMessage: "Kies een levensfase.",
56
+ },
57
+ };
@@ -1,13 +1,13 @@
1
- import {
2
- type FormFieldRadioGroupProps,
3
- FormFieldRadioGroup as RHCFormFieldRadioGroup,
4
- } from "@rijkshuisstijl-community/components-react";
5
- import styles from "./styles.module.css";
6
-
7
- const FormFieldRadioGroup = (props: FormFieldRadioGroupProps) => {
8
- return (
9
- <RHCFormFieldRadioGroup className={styles.formFieldRadioGroup} {...props} />
10
- );
11
- };
12
-
13
- export default FormFieldRadioGroup;
1
+ import {
2
+ type FormFieldRadioGroupProps,
3
+ FormFieldRadioGroup as RHCFormFieldRadioGroup,
4
+ } from "@rijkshuisstijl-community/components-react";
5
+ import styles from "./styles.module.css";
6
+
7
+ const FormFieldRadioGroup = (props: FormFieldRadioGroupProps) => {
8
+ return (
9
+ <RHCFormFieldRadioGroup className={styles.formFieldRadioGroup} {...props} />
10
+ );
11
+ };
12
+
13
+ export default FormFieldRadioGroup;
@@ -1,5 +1,5 @@
1
- .formFieldRadioGroup {
2
- :global(& > .utrecht-form-field__label) {
3
- display: none;
4
- }
5
- }
1
+ .formFieldRadioGroup {
2
+ :global(& > .utrecht-form-field__label) {
3
+ display: none;
4
+ }
5
+ }
@@ -0,0 +1,48 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import FormFieldRadioOption from "./FormFieldRadioOption";
3
+
4
+ /**
5
+ * FormFieldRadioOption is een enkele radiobutton binnen een
6
+ * `FormFieldRadioGroup`, bijvoorbeeld voor een enkelvoudige filteroptie. Het
7
+ * label toont optioneel een aantal tussen haakjes (via `AmountLabel`).
8
+ */
9
+ const meta = {
10
+ title: "Components/Form/FormFieldRadioOption",
11
+ component: FormFieldRadioOption,
12
+ tags: ["autodocs", "custom"],
13
+ args: {
14
+ label: "Actief",
15
+ name: "lifecycle",
16
+ value: "active",
17
+ },
18
+ argTypes: {
19
+ checked: { control: "boolean" },
20
+ defaultChecked: { control: "boolean" },
21
+ invalid: { control: "boolean" },
22
+ },
23
+ } satisfies Meta<typeof FormFieldRadioOption>;
24
+
25
+ export default meta;
26
+ type Story = StoryObj<typeof meta>;
27
+
28
+ export const Default: Story = {};
29
+
30
+ export const WithAmount: Story = {
31
+ args: {
32
+ amount: 18,
33
+ },
34
+ };
35
+
36
+ export const Checked: Story = {
37
+ args: {
38
+ amount: 18,
39
+ defaultChecked: true,
40
+ },
41
+ };
42
+
43
+ export const Invalid: Story = {
44
+ args: {
45
+ amount: 18,
46
+ invalid: true,
47
+ },
48
+ };