@developer-overheid-nl/don-register-components 1.2.0 → 1.3.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 (89) hide show
  1. package/CHANGELOG.md +130 -85
  2. package/LICENSE.md +291 -291
  3. package/README.md +20 -20
  4. package/package.json +5 -7
  5. package/src/alert/Alert.tsx +19 -19
  6. package/src/alert/styles.module.css +3 -3
  7. package/src/alignBox/AlignBox.tsx +114 -114
  8. package/src/alignBox/styles.module.css +110 -110
  9. package/src/amountLabel/AmountLabel.tsx +16 -16
  10. package/src/amountLabel/styles.module.css +11 -11
  11. package/src/analytics/PiwikPro.tsx +94 -94
  12. package/src/analytics/index.ts +1 -1
  13. package/src/article/Article.tsx +10 -10
  14. package/src/badgeList/BadgeList.tsx +34 -26
  15. package/src/badgeList/styles.module.css +37 -24
  16. package/src/block/Block.tsx +35 -35
  17. package/src/block/styles.module.css +29 -29
  18. package/src/button/Button.tsx +3 -3
  19. package/src/cardAsLink/CardAsLink.tsx +21 -21
  20. package/src/cardAsLink/styles.module.css +23 -23
  21. package/src/cardsList/CardsList.tsx +56 -54
  22. package/src/cardsList/styles.module.css +19 -19
  23. package/src/client.ts +7 -7
  24. package/src/container/Container.tsx +10 -10
  25. package/src/container/styles.module.css +28 -28
  26. package/src/copyButton/CopyButton.tsx +39 -39
  27. package/src/copyButton/styles.module.css +13 -13
  28. package/src/dataBadgeLink/DataBadgeLink.tsx +53 -53
  29. package/src/dataBadgeLink/styles.module.css +89 -69
  30. package/src/dataSummary/DataSummary.tsx +22 -22
  31. package/src/dataSummary/DataSummaryItem.tsx +21 -21
  32. package/src/dataSummary/styles.module.css +75 -75
  33. package/src/facetFilters/FacetFilters.tsx +419 -313
  34. package/src/facetFilters/styles.module.css +3 -3
  35. package/src/fieldset/FieldSet.tsx +3 -3
  36. package/src/filters/Filters.tsx +116 -115
  37. package/src/filters/styles.module.css +26 -26
  38. package/src/footer/Footer.tsx +76 -76
  39. package/src/footer/styles.module.css +103 -103
  40. package/src/formFieldCheckboxGroup/FormFieldCheckboxGroup.tsx +16 -16
  41. package/src/formFieldCheckboxGroup/styles.module.css +5 -5
  42. package/src/formFieldCheckboxOption/FormFieldCheckboxOption.tsx +26 -26
  43. package/src/formFieldCheckboxOption/styles.module.css +22 -22
  44. package/src/formFieldLabel/FormFieldLabel.tsx +23 -23
  45. package/src/formFieldRadioGroup/FormFieldRadioGroup.tsx +13 -13
  46. package/src/formFieldRadioGroup/styles.module.css +5 -5
  47. package/src/formFieldRadioOption/FormFieldRadioOption.tsx +75 -75
  48. package/src/formFieldRadioOption/styles.module.css +49 -49
  49. package/src/formFieldSwitch/FormFieldSwitch.tsx +79 -79
  50. package/src/formFieldSwitch/styles.module.css +32 -32
  51. package/src/formFieldTextInput/FormFieldTextInput.tsx +3 -3
  52. package/src/header/Header.tsx +137 -137
  53. package/src/header/styles.module.css +71 -71
  54. package/src/heading/Heading.tsx +15 -15
  55. package/src/headingGroup/HeadingGroup.tsx +48 -48
  56. package/src/headingGroup/styles.module.css +3 -3
  57. package/src/i18n.ts +25 -25
  58. package/src/iconBadge/IconBadge.tsx +35 -35
  59. package/src/iconBadge/getAppearance.ts +53 -53
  60. package/src/iconBadge/styles.module.css +19 -19
  61. package/src/iconsSprite/Icon.tsx +17 -17
  62. package/src/iconsSprite/IconsSprite.tsx +5 -5
  63. package/src/index.ts +107 -106
  64. package/src/infoButton/InfoButton.tsx +45 -45
  65. package/src/infoButton/styles.module.css +43 -43
  66. package/src/link/Link.tsx +10 -10
  67. package/src/markdown/Markdown.tsx +42 -42
  68. package/src/overlay/Overlay.tsx +18 -18
  69. package/src/overlay/styles.module.css +15 -15
  70. package/src/pagination/Pagination.tsx +267 -144
  71. package/src/pagination/styles.module.css +28 -13
  72. package/src/paragraph/Paragraph.tsx +24 -24
  73. package/src/paragraph/styles.module.css +6 -6
  74. package/src/pillBadge/PillBadge.examples.tsx +107 -107
  75. package/src/pillBadge/PillBadge.tsx +51 -51
  76. package/src/pillBadge/styles.module.css +214 -214
  77. package/src/readOnlyTextInput/ReadOnlyTextInput.tsx +24 -24
  78. package/src/readOnlyTextInput/styles.module.css +19 -19
  79. package/src/scoreBadge/ScoreBadge.tsx +133 -133
  80. package/src/search/Search.tsx +82 -66
  81. package/src/search/styles.module.css +39 -39
  82. package/src/siteLogo/SiteLogo.tsx +24 -24
  83. package/src/switch/Switch.tsx +86 -86
  84. package/src/switch/styles.module.css +7 -7
  85. package/src/toolTip/ToolTip.tsx +55 -55
  86. package/src/toolTip/styles.module.css +49 -48
  87. package/src/topNavigation/TopNavigation.tsx +67 -67
  88. package/src/topNavigation/styles.module.css +54 -54
  89. package/tsconfig.json +121 -121
@@ -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
+ }
@@ -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
+ }
@@ -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
+ 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,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
+ }
@@ -1,75 +1,75 @@
1
- import {
2
- type CustomFormFieldProps,
3
- FormField,
4
- Radio as RHCRadio,
5
- } from "@rijkshuisstijl-community/components-react";
6
- import clsx from "clsx";
7
- import { Fragment, useId } from "react";
8
- import AmountLabel, { type AmountLabelProps } from "../amountLabel/AmountLabel";
9
- import styles from "./styles.module.css";
10
-
11
- export interface FormFieldRadioOptionProps
12
- extends Omit<
13
- CustomFormFieldProps,
14
- "label" | "statusId" | "errorMessageId" | "descriptionId" | "input"
15
- >,
16
- AmountLabelProps {
17
- name: string;
18
- value: string;
19
- checked?: boolean;
20
- defaultChecked?: boolean;
21
- statusId?: CustomFormFieldProps["statusId"];
22
- errorMessageId?: CustomFormFieldProps["errorMessageId"];
23
- descriptionId?: CustomFormFieldProps["descriptionId"];
24
- onChange?: React.ChangeEventHandler<HTMLInputElement>;
25
- }
26
-
27
- const FormFieldRadioOption = (props: FormFieldRadioOptionProps) => {
28
- const genId = useId();
29
- const {
30
- id = genId,
31
- statusId = genId,
32
- errorMessageId = genId,
33
- descriptionId = genId,
34
- name,
35
- value,
36
- defaultChecked,
37
- checked,
38
- amount,
39
- label,
40
- className,
41
- children,
42
- onChange,
43
- ...restProps
44
- } = props;
45
-
46
- return (
47
- <FormField
48
- type="radio" // although not exposed by RHC
49
- className={clsx("utrecht-form-field--radio", styles.radio, className)}
50
- statusId={statusId}
51
- errorMessageId={errorMessageId}
52
- descriptionId={descriptionId}
53
- label={
54
- <Fragment>
55
- <RHCRadio
56
- id={id}
57
- name={name}
58
- value={value}
59
- checked={checked}
60
- defaultChecked={defaultChecked}
61
- className="utrecht-checkbox--custom utrecht-form-field__input"
62
- onChange={onChange}
63
- />
64
- <AmountLabel label={label} amount={amount} />
65
- </Fragment>
66
- }
67
- input={null}
68
- {...restProps}
69
- >
70
- <span className={styles.info}>{children}</span>
71
- </FormField>
72
- );
73
- };
74
-
75
- export default FormFieldRadioOption;
1
+ import {
2
+ type CustomFormFieldProps,
3
+ FormField,
4
+ Radio as RHCRadio,
5
+ } from "@rijkshuisstijl-community/components-react";
6
+ import clsx from "clsx";
7
+ import { Fragment, useId } from "react";
8
+ import AmountLabel, { type AmountLabelProps } from "../amountLabel/AmountLabel";
9
+ import styles from "./styles.module.css";
10
+
11
+ export interface FormFieldRadioOptionProps
12
+ extends Omit<
13
+ CustomFormFieldProps,
14
+ "label" | "statusId" | "errorMessageId" | "descriptionId" | "input"
15
+ >,
16
+ AmountLabelProps {
17
+ name: string;
18
+ value: string;
19
+ checked?: boolean;
20
+ defaultChecked?: boolean;
21
+ statusId?: CustomFormFieldProps["statusId"];
22
+ errorMessageId?: CustomFormFieldProps["errorMessageId"];
23
+ descriptionId?: CustomFormFieldProps["descriptionId"];
24
+ onChange?: React.ChangeEventHandler<HTMLInputElement>;
25
+ }
26
+
27
+ const FormFieldRadioOption = (props: FormFieldRadioOptionProps) => {
28
+ const genId = useId();
29
+ const {
30
+ id = genId,
31
+ statusId = genId,
32
+ errorMessageId = genId,
33
+ descriptionId = genId,
34
+ name,
35
+ value,
36
+ defaultChecked,
37
+ checked,
38
+ amount,
39
+ label,
40
+ className,
41
+ children,
42
+ onChange,
43
+ ...restProps
44
+ } = props;
45
+
46
+ return (
47
+ <FormField
48
+ type="radio" // although not exposed by RHC
49
+ className={clsx("utrecht-form-field--radio", styles.radio, className)}
50
+ statusId={statusId}
51
+ errorMessageId={errorMessageId}
52
+ descriptionId={descriptionId}
53
+ label={
54
+ <Fragment>
55
+ <RHCRadio
56
+ id={id}
57
+ name={name}
58
+ value={value}
59
+ checked={checked}
60
+ defaultChecked={defaultChecked}
61
+ className="utrecht-checkbox--custom utrecht-form-field__input"
62
+ onChange={onChange}
63
+ />
64
+ <AmountLabel label={label} amount={amount} />
65
+ </Fragment>
66
+ }
67
+ input={null}
68
+ {...restProps}
69
+ >
70
+ <span className={styles.info}>{children}</span>
71
+ </FormField>
72
+ );
73
+ };
74
+
75
+ export default FormFieldRadioOption;
@@ -1,49 +1,49 @@
1
- .radio.radio {
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-field--radio .utrecht-form-field__label) {
11
- display: block;
12
- }
13
-
14
- :global(.utrecht-form-label) {
15
- /* like checkbox */
16
- display: flex;
17
- font-weight: var(
18
- --utrecht-form-label-checkbox-font-weight,
19
- var(--utrecht-form-label-font-weight)
20
- );
21
- color: var(
22
- --utrecht-form-label-checkbox-color,
23
- var(--utrecht-form-label-color)
24
- );
25
- cursor: var(--utrecht-action-activate-cursor, revert);
26
- }
27
-
28
- :global(.utrecht-radio-button) {
29
- order: initial;
30
- margin-block-start: 0;
31
- }
32
-
33
- :global(
34
- .utrecht-form-field--radio
35
- .utrecht-form-field__label:has(.utrecht-form-field__input)
36
- ) {
37
- margin-inline-start: calc(
38
- -1 *
39
- (
40
- var(--utrecht-radio-button-size) +
41
- var(--utrecht-checkbox-margin-inline-end, 12px)
42
- )
43
- );
44
- }
45
- }
46
-
47
- .info {
48
- grid-area: info;
49
- }
1
+ .radio.radio {
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-field--radio .utrecht-form-field__label) {
11
+ display: block;
12
+ }
13
+
14
+ :global(.utrecht-form-label) {
15
+ /* like checkbox */
16
+ display: flex;
17
+ font-weight: var(
18
+ --utrecht-form-label-checkbox-font-weight,
19
+ var(--utrecht-form-label-font-weight)
20
+ );
21
+ color: var(
22
+ --utrecht-form-label-checkbox-color,
23
+ var(--utrecht-form-label-color)
24
+ );
25
+ cursor: var(--utrecht-action-activate-cursor, revert);
26
+ }
27
+
28
+ :global(.utrecht-radio-button) {
29
+ order: initial;
30
+ margin-block-start: 0;
31
+ }
32
+
33
+ :global(
34
+ .utrecht-form-field--radio
35
+ .utrecht-form-field__label:has(.utrecht-form-field__input)
36
+ ) {
37
+ margin-inline-start: calc(
38
+ -1 *
39
+ (
40
+ var(--utrecht-radio-button-size) +
41
+ var(--utrecht-checkbox-margin-inline-end, 12px)
42
+ )
43
+ );
44
+ }
45
+ }
46
+
47
+ .info {
48
+ grid-area: info;
49
+ }
@@ -1,79 +1,79 @@
1
- import {
2
- type CustomFormFieldProps,
3
- FormField,
4
- } from "@rijkshuisstijl-community/components-react";
5
- import clsx from "clsx";
6
- import { useId } from "react";
7
- import AmountLabel, { type AmountLabelProps } from "../amountLabel/AmountLabel";
8
- import Switch, { type SwitchLabels } from "../switch/Switch";
9
- import styles from "./styles.module.css";
10
-
11
- export interface FormFieldSwitchProps
12
- extends Omit<
13
- CustomFormFieldProps,
14
- "label" | "statusId" | "errorMessageId" | "descriptionId" | "input"
15
- >,
16
- AmountLabelProps {
17
- name: string;
18
- value: string;
19
- checked?: boolean;
20
- defaultChecked?: boolean;
21
- statusId?: CustomFormFieldProps["statusId"];
22
- errorMessageId?: CustomFormFieldProps["errorMessageId"];
23
- descriptionId?: CustomFormFieldProps["descriptionId"];
24
- labelledById?: string;
25
- labels?: SwitchLabels;
26
- onChange?: React.ChangeEventHandler<HTMLInputElement>;
27
- }
28
-
29
- const FormFieldSwitch = (props: FormFieldSwitchProps) => {
30
- const genId = useId();
31
- const {
32
- id = genId,
33
- statusId = genId,
34
- errorMessageId = genId,
35
- descriptionId = genId,
36
- labelledById,
37
- name,
38
- value,
39
- defaultChecked,
40
- checked,
41
- amount,
42
- label,
43
- labels,
44
- onChange,
45
- className,
46
- children,
47
- ...restProps
48
- } = props;
49
-
50
- return (
51
- <FormField
52
- id={id}
53
- type="checkbox"
54
- className={clsx("utrecht-form-field--checkbox", styles.switch, className)}
55
- statusId={statusId}
56
- errorMessageId={errorMessageId}
57
- descriptionId={descriptionId}
58
- label={<AmountLabel label={label} amount={amount} />}
59
- input={
60
- <Switch
61
- id={id}
62
- name={name}
63
- value={value}
64
- checked={checked}
65
- defaultChecked={defaultChecked}
66
- className="utrecht-form-field__input"
67
- labels={labels}
68
- aria-labelledby={`${labelledById} ${id}`}
69
- onChange={onChange}
70
- />
71
- }
72
- {...restProps}
73
- >
74
- <span className={styles.info}>{children}</span>
75
- </FormField>
76
- );
77
- };
78
-
79
- export default FormFieldSwitch;
1
+ import {
2
+ type CustomFormFieldProps,
3
+ FormField,
4
+ } from "@rijkshuisstijl-community/components-react";
5
+ import clsx from "clsx";
6
+ import { useId } from "react";
7
+ import AmountLabel, { type AmountLabelProps } from "../amountLabel/AmountLabel";
8
+ import Switch, { type SwitchLabels } from "../switch/Switch";
9
+ import styles from "./styles.module.css";
10
+
11
+ export interface FormFieldSwitchProps
12
+ extends Omit<
13
+ CustomFormFieldProps,
14
+ "label" | "statusId" | "errorMessageId" | "descriptionId" | "input"
15
+ >,
16
+ AmountLabelProps {
17
+ name?: string;
18
+ value: string;
19
+ checked?: boolean;
20
+ defaultChecked?: boolean;
21
+ statusId?: CustomFormFieldProps["statusId"];
22
+ errorMessageId?: CustomFormFieldProps["errorMessageId"];
23
+ descriptionId?: CustomFormFieldProps["descriptionId"];
24
+ labelledById?: string;
25
+ labels?: SwitchLabels;
26
+ onChange?: React.ChangeEventHandler<HTMLInputElement>;
27
+ }
28
+
29
+ const FormFieldSwitch = (props: FormFieldSwitchProps) => {
30
+ const genId = useId();
31
+ const {
32
+ id = genId,
33
+ statusId = genId,
34
+ errorMessageId = genId,
35
+ descriptionId = genId,
36
+ labelledById,
37
+ name,
38
+ value,
39
+ defaultChecked,
40
+ checked,
41
+ amount,
42
+ label,
43
+ labels,
44
+ onChange,
45
+ className,
46
+ children,
47
+ ...restProps
48
+ } = props;
49
+
50
+ return (
51
+ <FormField
52
+ id={id}
53
+ type="checkbox"
54
+ className={clsx("utrecht-form-field--checkbox", styles.switch, className)}
55
+ statusId={statusId}
56
+ errorMessageId={errorMessageId}
57
+ descriptionId={descriptionId}
58
+ label={<AmountLabel label={label} amount={amount} />}
59
+ input={
60
+ <Switch
61
+ id={id}
62
+ name={name}
63
+ value={value}
64
+ checked={checked}
65
+ defaultChecked={defaultChecked}
66
+ className="utrecht-form-field__input"
67
+ labels={labels}
68
+ aria-labelledby={`${labelledById} ${id}`}
69
+ onChange={onChange}
70
+ />
71
+ }
72
+ {...restProps}
73
+ >
74
+ <span className={styles.info}>{children}</span>
75
+ </FormField>
76
+ );
77
+ };
78
+
79
+ export default FormFieldSwitch;