@utrecht/form-field-css 1.2.0 → 1.4.0

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @utrecht/form-field-css
2
2
 
3
+ ## 1.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - e497b08: Export CSS string as default export in `dist/index.mjs`.
8
+
9
+ ## 1.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 9ba132c: Add `utrecht-form-field__error-message` class name and mixin.
14
+
15
+ Deprecate the `utrecht-form-field__description--invalid` mixin.
16
+
3
17
  ## 1.2.0
4
18
 
5
19
  ### Minor Changes
package/README.md CHANGED
@@ -2,42 +2,4 @@
2
2
 
3
3
  # Form field
4
4
 
5
- Gebruik het _form field_ component om een alle onderdelen van een formulierveld in te verzamelen: het label, de _form control_, eventueel een extra beschrijving of de status en eventueel een validatiemelding of foutmelding.
6
-
7
- De volgende componenten zijn vaak onderdeel van een _form field_:
8
-
9
- - _form label_ component
10
- - _form field description_ component met extra beschrijving
11
- - _form field description_ component met een validatiemelding
12
- - een form control component zoals bijvoorbeeld:
13
- - _textbox_ component
14
- - _textarea_ component
15
- - _checkbox_ component
16
- - _radio button_ component
17
- - _form select_ component
18
- - etcetera
19
- - _form field description_ component met een foutmelding
20
- - _form field description_ component status van component
21
-
22
- ## HTML
23
-
24
- Gebruik een element `<div>` element voor formuliervelden met één _form control_. Een formulierveld moet meerdere `<p>` elementen kunnen bevatten, gebruik daarom geen `<p>` element voor de form field. Je moet geen _landmark role_ gebruiken voor een formulierveld (dus geen `<section>`) element.
25
-
26
- Voor formuliervelden met meerdere _form controls_ mag je een `<fieldset>` element gebruiken, bijvoorbeeld voor: jaar, maand en dag. Voor CSS is het handig om dan nog steeds een `<div>` om de fieldset heen te hebben: `<div><fieldset>...</fieldset></div>`.
27
-
28
- ## Gebruikte termen
29
-
30
- - `form` komt van `<form>` in HTML en `role="form"` in WAI-ARIA.
31
- - `field` komt van `<fieldset>` in HTML.
32
- - `invalid` komt van `aria-invalid` in WAI-ARIA.
33
- - `radio` komt van `<input type="radio">` in HTML.
34
- - `checkbox` komt van `<input type="checkbox">` in HTML.
35
- - `label` komt van `<label>` in HTML en `aria-labelledby` in WAI-ARIA.
36
- - `description` komt van `aria-describedby` in WAI-ARIA.
37
-
38
- ## Relevante WCAG regels
39
-
40
- - [WCAG eis 2.4.6](https://www.w3.org/TR/WCAG21/#headings-and-labels): de tekst van het label moet duidelijk zijn
41
- - [WCAG eis 3.3.9](https://www.w3.org/TR/WCAG22/#redundant-entry): gebruik niet een formulierveld voor informatie die de gebruiker eerder al heeft ingevuld.
42
- - Vraag gebruikers niet twee keer achter elkaar identieke gegevens in te vullen, bijvoorbeeld om typfouten te herkennen en daarmee fouten te voorkomen. Bied liever een mogelijkheid aan om de gegevens te controleren als laatste stap.
43
- - Vul bestaande gegevens in als standaardwaarde wanneer je de gegevens al hebt maar je graag zeker wilt weken of de oude gegevens nog juist zijn.
5
+ Een invoerveld en bijbehorende onderdelen die helpen bij het invullen.
package/dist/index.css CHANGED
@@ -1,12 +1,8 @@
1
1
  /**
2
2
  * @license EUPL-1.2
3
- * Copyright (c) 2021 Robbert Broersma
3
+ * Copyright (c) 2020-2024 Frameless B.V.
4
+ * Copyright (c) 2021-2024 Gemeente Utrecht
4
5
  */
5
- /**
6
- * @license EUPL-1.2
7
- * Copyright (c) 2021 Robbert Broersma
8
- */
9
- /* stylelint-disable-next-line block-no-empty */
10
6
  .utrecht-form-field {
11
7
  break-inside: avoid;
12
8
  font-family: var(--utrecht-document-font-family, inherit);
@@ -29,16 +25,8 @@
29
25
  .utrecht-form-field--checkbox {
30
26
  display: grid;
31
27
  gap: 0 var(--utrecht-checkbox-margin-inline-end, 12px);
32
- grid-template-areas: "input label" "input description" "input description-invalid";
28
+ grid-template-areas: "input label" "input description" "input error-message";
33
29
  grid-template-columns: var(--utrecht-checkbox-size) 100fr;
34
- /*
35
- .utrecht-form-field__label .utrecht-form-field__input {
36
- margin-inline-start: calc(
37
- -1 * (var(--utrecht-checkbox-size) + var(--utrecht-checkbox-margin-inline-end, 12px))
38
- );
39
- margin-inline-end: var(--utrecht-checkbox-margin-inline-end, 12px);
40
- }
41
- */
42
30
  }
43
31
  .utrecht-form-field--checkbox .utrecht-form-field__label:has(.utrecht-form-field__input) {
44
32
  margin-inline-start: calc(-1 * (var(--utrecht-checkbox-size) + var(--utrecht-checkbox-margin-inline-end, 12px)));
@@ -50,16 +38,8 @@
50
38
  .utrecht-form-field--radio {
51
39
  display: grid;
52
40
  gap: 0 var(--utrecht-radio-button-margin-inline-end, 12px);
53
- grid-template-areas: "input label" "input description" "input description-invalid";
41
+ grid-template-areas: "input label" "input description" "input error-message";
54
42
  grid-template-columns: var(--utrecht-radio-button-size) 100fr;
55
- /*
56
- .utrecht-form-field__label .utrecht-form-field__input {
57
- margin-inline-start: calc(
58
- -1 * (var(--utrecht-checkbox-size) + var(--utrecht-checkbox-margin-inline-end, 12px))
59
- );
60
- margin-inline-end: var(--utrecht-checkbox-margin-inline-end, 12px);
61
- }
62
- */
63
43
  }
64
44
  .utrecht-form-field--radio .utrecht-form-field__label:has(.utrecht-form-field__input) {
65
45
  margin-inline-start: calc(-1 * (var(--utrecht-radio-button-size) + var(--utrecht-radio-button-margin-inline-end, 12px)));
@@ -76,8 +56,6 @@
76
56
  }
77
57
 
78
58
  .utrecht-form-field__label {
79
- /* Assign the margin-block-end to padding instead, so the clickable area of the label increases
80
- and we avoid a small gap between the label and input that cannot be clicked to focus the input. */
81
59
  grid-area: label;
82
60
  margin-block-end: var(--utrecht-form-field-label-margin-block-end);
83
61
  margin-block-start: 0;
@@ -92,7 +70,7 @@
92
70
  }
93
71
 
94
72
  .utrecht-form-field .utrecht-form-field-description--invalid {
95
- grid-area: description-invalid;
73
+ grid-area: error-message;
96
74
  order: 3;
97
75
  }
98
76
 
@@ -106,4 +84,9 @@
106
84
  .utrecht-form-field__description--before {
107
85
  grid-area: description-before;
108
86
  order: 4;
87
+ }
88
+
89
+ .utrecht-form-field__error-message {
90
+ grid-area: error-message;
91
+ order: 3;
109
92
  }
@@ -0,0 +1 @@
1
+ .utrecht-form-field{break-inside:avoid;font-family:var(--utrecht-document-font-family,inherit);margin-block-end:calc(var(--utrecht-space-around, 0)*var(--utrecht-form-field-margin-block-end, 0));margin-block-start:calc(var(--utrecht-space-around, 0)*var(--utrecht-form-field-margin-block-start, 0));page-break-inside:avoid}.utrecht-form-field--distanced{--utrecht-space-around:1}.utrecht-form-field--invalid{border-inline-start-color:var(--utrecht-form-field-invalid-border-inline-start-color);border-inline-start-style:solid;border-inline-start-width:var(--utrecht-form-field-invalid-border-inline-start-width,0);padding-inline-start:var(--utrecht-form-field-invalid-padding-inline-start)}.utrecht-form-field--checkbox{display:grid;gap:0 var(--utrecht-checkbox-margin-inline-end,12px);grid-template-areas:"input label" "input description" "input error-message";grid-template-columns:var(--utrecht-checkbox-size) 100fr}.utrecht-form-field--checkbox .utrecht-form-field__label:has(.utrecht-form-field__input){margin-inline-start:calc((var(--utrecht-checkbox-size) + var(--utrecht-checkbox-margin-inline-end, 12px))*-1)}.utrecht-form-field--checkbox .utrecht-form-field__label .utrecht-form-field__input{margin-inline-end:var(--utrecht-checkbox-margin-inline-end,12px)}.utrecht-form-field--radio{display:grid;gap:0 var(--utrecht-radio-button-margin-inline-end,12px);grid-template-areas:"input label" "input description" "input error-message";grid-template-columns:var(--utrecht-radio-button-size) 100fr}.utrecht-form-field--radio .utrecht-form-field__label:has(.utrecht-form-field__input){margin-inline-start:calc((var(--utrecht-radio-button-size) + var(--utrecht-radio-button-margin-inline-end, 12px))*-1)}.utrecht-form-field--radio .utrecht-form-field__label .utrecht-form-field__input{margin-inline-end:var(--utrecht-radio-button-margin-inline-end,12px)}.utrecht-form-field__input{grid-area:input;margin-block-end:0;margin-block-start:0;order:5}.utrecht-form-field__label{grid-area:label;margin-block-end:var(--utrecht-form-field-label-margin-block-end);margin-block-start:0;order:1}.utrecht-form-field .utrecht-form-field-description{grid-area:description;margin-block-end:var(--utrecht-form-field-description-margin-block-end);margin-block-start:var(--utrecht-form-field-description-margin-block-start);order:2}.utrecht-form-field .utrecht-form-field-description--invalid{grid-area:error-message;order:3}.utrecht-form-field__description{grid-area:description;margin-block-end:var(--utrecht-form-field-description-margin-block-end);margin-block-start:var(--utrecht-form-field-description-margin-block-start);order:2}.utrecht-form-field__description--before{grid-area:description-before;order:4}.utrecht-form-field__error-message{grid-area:error-message;order:3}
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ export default ".utrecht-form-field{break-inside:avoid;font-family:var(--utrecht-document-font-family,inherit);margin-block-end:calc(var(--utrecht-space-around, 0)*var(--utrecht-form-field-margin-block-end, 0));margin-block-start:calc(var(--utrecht-space-around, 0)*var(--utrecht-form-field-margin-block-start, 0));page-break-inside:avoid}.utrecht-form-field--distanced{--utrecht-space-around:1}.utrecht-form-field--invalid{border-inline-start-color:var(--utrecht-form-field-invalid-border-inline-start-color);border-inline-start-style:solid;border-inline-start-width:var(--utrecht-form-field-invalid-border-inline-start-width,0);padding-inline-start:var(--utrecht-form-field-invalid-padding-inline-start)}.utrecht-form-field--checkbox{display:grid;gap:0 var(--utrecht-checkbox-margin-inline-end,12px);grid-template-areas:\"input label\" \"input description\" \"input error-message\";grid-template-columns:var(--utrecht-checkbox-size) 100fr}.utrecht-form-field--checkbox .utrecht-form-field__label:has(.utrecht-form-field__input){margin-inline-start:calc((var(--utrecht-checkbox-size) + var(--utrecht-checkbox-margin-inline-end, 12px))*-1)}.utrecht-form-field--checkbox .utrecht-form-field__label .utrecht-form-field__input{margin-inline-end:var(--utrecht-checkbox-margin-inline-end,12px)}.utrecht-form-field--radio{display:grid;gap:0 var(--utrecht-radio-button-margin-inline-end,12px);grid-template-areas:\"input label\" \"input description\" \"input error-message\";grid-template-columns:var(--utrecht-radio-button-size) 100fr}.utrecht-form-field--radio .utrecht-form-field__label:has(.utrecht-form-field__input){margin-inline-start:calc((var(--utrecht-radio-button-size) + var(--utrecht-radio-button-margin-inline-end, 12px))*-1)}.utrecht-form-field--radio .utrecht-form-field__label .utrecht-form-field__input{margin-inline-end:var(--utrecht-radio-button-margin-inline-end,12px)}.utrecht-form-field__input{grid-area:input;margin-block-end:0;margin-block-start:0;order:5}.utrecht-form-field__label{grid-area:label;margin-block-end:var(--utrecht-form-field-label-margin-block-end);margin-block-start:0;order:1}.utrecht-form-field .utrecht-form-field-description{grid-area:description;margin-block-end:var(--utrecht-form-field-description-margin-block-end);margin-block-start:var(--utrecht-form-field-description-margin-block-start);order:2}.utrecht-form-field .utrecht-form-field-description--invalid{grid-area:error-message;order:3}.utrecht-form-field__description{grid-area:description;margin-block-end:var(--utrecht-form-field-description-margin-block-end);margin-block-start:var(--utrecht-form-field-description-margin-block-start);order:2}.utrecht-form-field__description--before{grid-area:description-before;order:4}.utrecht-form-field__error-message{grid-area:error-message;order:3}";
@@ -0,0 +1,2 @@
1
+ declare const css: string;
2
+ export default css;
@@ -0,0 +1,30 @@
1
+ <!-- @license CC0-1.0 -->
2
+
3
+ # Anatomy
4
+
5
+ Gebruik het _form field_ component om een alle onderdelen van een formulierveld in te verzamelen: het label, de _form control_, eventueel een extra beschrijving of de status en eventueel een validatiemelding of foutmelding.
6
+
7
+ De volgende componenten zijn vaak onderdeel van een _form field_:
8
+
9
+ - _form label_ component
10
+ - _form field description_ component met extra beschrijving
11
+ - _form field description_ component met een validatiemelding
12
+ - een form control component zoals bijvoorbeeld:
13
+ - _textbox_ component
14
+ - _textarea_ component
15
+ - _checkbox_ component
16
+ - _radio button_ component
17
+ - _form select_ component
18
+ - etcetera
19
+ - _form field description_ component met een foutmelding
20
+ - _form field description_ component status van component
21
+
22
+ ## Gebruikte termen
23
+
24
+ - `form` komt van `<form>` in HTML en `role="form"` in WAI-ARIA.
25
+ - `field` komt van `<fieldset>` in HTML.
26
+ - `invalid` komt van `aria-invalid` in WAI-ARIA.
27
+ - `radio` komt van `<input type="radio">` in HTML.
28
+ - `checkbox` komt van `<input type="checkbox">` in HTML.
29
+ - `label` komt van `<label>` in HTML en `aria-labelledby` in WAI-ARIA.
30
+ - `description` komt van `aria-describedby` in WAI-ARIA.
@@ -0,0 +1,7 @@
1
+ <!-- @license CC0-1.0 -->
2
+
3
+ # HTML
4
+
5
+ Gebruik een element `<div>` element voor formuliervelden met één _form control_. Een formulierveld moet meerdere `<p>` elementen kunnen bevatten, gebruik daarom geen `<p>` element voor de form field. Je moet geen _landmark role_ gebruiken voor een formulierveld (dus geen `<section>`) element.
6
+
7
+ Voor formuliervelden met meerdere _form controls_ mag je een `<fieldset>` element gebruiken, bijvoorbeeld voor: jaar, maand en dag. Voor CSS is het handig om dan nog steeds een `<div>` om de fieldset heen te hebben: `<div><fieldset>...</fieldset></div>`.
@@ -0,0 +1,8 @@
1
+ <!-- @license CC0-1.0 -->
2
+
3
+ # Relevante WCAG regels
4
+
5
+ - [WCAG eis 2.4.6](https://www.w3.org/TR/WCAG21/#headings-and-labels): de tekst van het label moet duidelijk zijn
6
+ - [WCAG eis 3.3.9](https://www.w3.org/TR/WCAG22/#redundant-entry): gebruik niet een formulierveld voor informatie die de gebruiker eerder al heeft ingevuld.
7
+ - Vraag gebruikers niet twee keer achter elkaar identieke gegevens in te vullen, bijvoorbeeld om typfouten te herkennen en daarmee fouten te voorkomen. Bied liever een mogelijkheid aan om de gegevens te controleren als laatste stap.
8
+ - Vul bestaande gegevens in als standaardwaarde wanneer je de gegevens al hebt maar je graag zeker wilt weken of de oude gegevens nog juist zijn.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.2.0",
2
+ "version": "1.4.0",
3
3
  "author": "Community for NL Design System",
4
4
  "description": "Form field component for the Municipality of Utrecht based on the NL Design System architecture",
5
5
  "license": "EUPL-1.2",
@@ -12,7 +12,7 @@
12
12
  ],
13
13
  "main": "dist/index.css",
14
14
  "devDependencies": {
15
- "rollup": "4.18.0"
15
+ "@utrecht/build-utils-css": "0.0.1"
16
16
  },
17
17
  "keywords": [
18
18
  "nl-design-system"
@@ -26,7 +26,7 @@
26
26
  "directory": "components/form-field"
27
27
  },
28
28
  "scripts": {
29
- "build": "rollup -c ../rollup.config.mjs",
29
+ "build": "build-css-package",
30
30
  "clean": "rimraf dist"
31
31
  }
32
32
  }
package/src/_mixin.scss CHANGED
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * @license EUPL-1.2
3
- * Copyright (c) 2021 Robbert Broersma
3
+ * Copyright (c) 2020-2024 Frameless B.V.
4
+ * Copyright (c) 2021-2024 Gemeente Utrecht
4
5
  */
5
6
 
6
7
  @mixin reset-p {
@@ -35,7 +36,7 @@
35
36
  --utrecht-space-around: 0;
36
37
 
37
38
  display: grid;
38
- grid-template-areas: "label" "description" "description-before" "description-invalid" "input" "description-after";
39
+ grid-template-areas: "label" "description" "description-before" "error-message" "input" "description-after";
39
40
  }
40
41
 
41
42
  @mixin utrecht-form-field--option {
@@ -83,11 +84,16 @@
83
84
  order: 2;
84
85
  }
85
86
 
86
- @mixin utrecht-form-field__description--invalid {
87
- grid-area: description-invalid;
87
+ @mixin utrecht-form-field__error-message {
88
+ grid-area: error-message;
88
89
  order: 3;
89
90
  }
90
91
 
92
+ /** @deprecated */
93
+ @mixin utrecht-form-field__description--invalid {
94
+ @include utrecht-form-field__error-message;
95
+ }
96
+
91
97
  @mixin utrecht-form-field__description--after {
92
98
  grid-area: description-after;
93
99
  order: 6;
@@ -101,7 +107,7 @@
101
107
  @mixin utrecht-form-field--checkbox {
102
108
  display: grid;
103
109
  gap: 0 var(--utrecht-checkbox-margin-inline-end, 12px);
104
- grid-template-areas: "input label" "input description" "input description-invalid";
110
+ grid-template-areas: "input label" "input description" "input error-message";
105
111
  grid-template-columns: var(--utrecht-checkbox-size) 100fr;
106
112
 
107
113
  /*
@@ -123,7 +129,7 @@
123
129
  @mixin utrecht-form-field--radio {
124
130
  display: grid;
125
131
  gap: 0 var(--utrecht-radio-button-margin-inline-end, 12px);
126
- grid-template-areas: "input label" "input description" "input description-invalid";
132
+ grid-template-areas: "input label" "input description" "input error-message";
127
133
  grid-template-columns: var(--utrecht-radio-button-size) 100fr;
128
134
 
129
135
  /*
package/src/index.scss CHANGED
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * @license EUPL-1.2
3
- * Copyright (c) 2021 Robbert Broersma
3
+ * Copyright (c) 2020-2024 Frameless B.V.
4
+ * Copyright (c) 2021-2024 Gemeente Utrecht
4
5
  */
5
6
 
6
7
  @import "./mixin";
@@ -42,7 +43,7 @@
42
43
  }
43
44
 
44
45
  .utrecht-form-field .utrecht-form-field-description--invalid {
45
- @include utrecht-form-field__description--invalid;
46
+ @include utrecht-form-field__error-message;
46
47
  }
47
48
 
48
49
  .utrecht-form-field__description {
@@ -52,3 +53,7 @@
52
53
  .utrecht-form-field__description--before {
53
54
  @include utrecht-form-field__description--before;
54
55
  }
56
+
57
+ .utrecht-form-field__error-message {
58
+ @include utrecht-form-field__error-message;
59
+ }
package/dist/index.js DELETED
@@ -1 +0,0 @@
1
- var undefined$1 = undefined;export{undefined$1 as default};
@@ -1,4 +0,0 @@
1
- <!-- @license CC0-1.0 -->
2
- <!-- markdownlint-disable MD041 -->
3
-
4
- Als je vraagt om het e-mailadres van een persoon, leg dan uit waar het voor gebruikt zal worden.
@@ -1,6 +0,0 @@
1
- <!-- @license CC0-1.0 -->
2
- <!-- markdownlint-disable MD041 -->
3
-
4
- Gebruik voor een nieuw wachtwoord `autocomplete="new-password"`.
5
-
6
- Gebruik voor een wachtwoord geen `maxlength` attribuut in HTML omdat het problemen veroorzaakt als het niet duidelijk dat een gekozen wachtwoord te lang is. Gebruik een melding wanneer het ingevulde wachtwoord te lang is. Als een gebruiker een wachtwoord plakt of een _password manager_ een wachtwoord invult invult dat langer is dan `maxlength` dan kan het laatste gedeelte ongemerkt ontbreken. Ongemerkt wordt dan een korter wachtwoord opgeslagen, daarna kan de gebruiker niet inloggen met het gekozen wachtwoord.
@@ -1,4 +0,0 @@
1
- <!-- @license CC0-1.0 -->
2
- <!-- markdownlint-disable MD041 -->
3
-
4
- Als je vraagt om het telefoonnumer van een persoon, leg dan uit waar het voor gebruikt zal worden. Niet alle gebruikers kunnen de telefoon beantwoorden, voor deze gebruikers is e-mail vaak een goed alternatief.
@@ -1,215 +0,0 @@
1
- {/* @license CC0-1.0 */}
2
-
3
- import { Canvas, Meta, Story } from "@storybook/blocks";
4
- import { argTypes, defaultArgs, exampleArgs, FormFieldCheckboxGroup } from "../story-template";
5
- import "../../../checkbox/src/index.scss";
6
- import "../../../form-label/src/index.scss";
7
- import "../index.scss";
8
-
9
- <Meta
10
- id="css-form-field--checkbox-group"
11
- title="CSS Component/Form field/with checkbox group"
12
- component={FormFieldCheckboxGroup}
13
- argTypes={argTypes}
14
- args={defaultArgs}
15
- parameters={{
16
- status: {
17
- type: "WORK IN PROGRESS",
18
- },
19
- }}
20
- />
21
-
22
- # Form field with checkbox group
23
-
24
- ## with only a label
25
-
26
- <Canvas>
27
- <Story
28
- name="label"
29
- args={{
30
- ...exampleArgs,
31
- groupId: "0128c307-ead5-40d4-9a99-c91aa6fa4a99",
32
- groupLabel: "Hoe wil je dat wij contact opnemen?",
33
- options: [
34
- {
35
- id: "a374296c-669e-45d0-a26d-e62e959958dd",
36
- name: "phone",
37
- value: "true",
38
- label: "Telefoon",
39
- checked: true,
40
- },
41
- {
42
- id: "714205e8-d33b-40d8-9721-e2ea71c62a20",
43
- name: "email",
44
- value: "true",
45
- label: "E-mail",
46
- },
47
- {
48
- id: "67fa8ea7-6b75-4049-ae4f-ebaa816e4c35",
49
- name: "mail",
50
- value: "true",
51
- label: "Brief",
52
- },
53
- ],
54
- }}
55
- >
56
- {FormFieldCheckboxGroup.bind({})}
57
- </Story>
58
- </Canvas>
59
-
60
- ## with an checkbox group description
61
-
62
- <Canvas>
63
- <Story
64
- name="group description"
65
- args={{
66
- ...exampleArgs,
67
- groupId: "d7218515-bf54-45c1-ba57-a72af5d7fd42",
68
- groupDescription: "Kies één of meerdere opties.",
69
- groupLabel: "Hoe wil je dat wij contact opnemen?",
70
- options: [
71
- {
72
- id: "2a5524f5-6ee8-4be1-90a1-87d0d619d2ee",
73
- name: "phone",
74
- value: "true",
75
- label: "Telefoon",
76
- checked: true,
77
- },
78
- {
79
- id: "1fe84cc2-16fc-4e9b-9498-856583652181",
80
- name: "email",
81
- value: "true",
82
- label: "E-mail",
83
- },
84
- {
85
- id: "96493bfe-2caa-4cb3-80ce-a4a46fc69c10",
86
- name: "mail",
87
- value: "true",
88
- label: "Brief",
89
- },
90
- ],
91
- }}
92
- >
93
- {FormFieldCheckboxGroup.bind({})}
94
- </Story>
95
- </Canvas>
96
-
97
- ## with checkbox option descriptions
98
-
99
- <Canvas>
100
- <Story
101
- name="option description"
102
- args={{
103
- ...exampleArgs,
104
- groupId: "764bacdd-94b4-4774-be40-89e9e5f82c19",
105
- groupLabel: "Hoe wil je dat wij contact opnemen?",
106
- options: [
107
- {
108
- id: "28a9109b-eb9c-4119-abaa-02d09e8f359b",
109
- name: "phone",
110
- value: "true",
111
- label: "Telefoon",
112
- description: "We bellen je op (085) 555 0000",
113
- checked: true,
114
- },
115
- {
116
- id: "3bdeeba2-199f-44e9-9184-ed8dbfb2fc37",
117
- name: "email",
118
- description: "Web mailen je op info@example.com",
119
- value: "true",
120
- label: "E-mail",
121
- },
122
- {
123
- id: "2bb862c1-114e-4529-975e-1776df23f055",
124
- name: "mail",
125
- value: "true",
126
- label: "Brief",
127
- description: "Je ontvangt een brief op Stadhuisplein 1, Amsterdam",
128
- },
129
- ],
130
- }}
131
- >
132
- {FormFieldCheckboxGroup.bind({})}
133
- </Story>
134
- </Canvas>
135
-
136
- ## with checkbox invalid option descriptions
137
-
138
- <Canvas>
139
- <Story
140
- name="option invalid"
141
- args={{
142
- ...exampleArgs,
143
- groupId: "73a3f2c1-00e7-48b8-9ebb-1f51b6550f42",
144
- groupLabel: "Hoe wil je dat wij contact opnemen?",
145
- options: [
146
- {
147
- checked: true,
148
- id: "c0972ecc-6eef-4bf9-80ab-c535fc0229b5",
149
- invalid: true,
150
- invalidDescription: "Wij hebben geen telefoonnumer van je. Vul eerst je profiel aan.",
151
- label: "Telefoon",
152
- name: "phone",
153
- value: "true",
154
- },
155
- {
156
- checked: true,
157
- id: "714d33fd-4cc4-4113-9887-4c38e77a6532",
158
- invalid: true,
159
- invalidDescription: "Wij hebben geen e-mailadres van je. Vul eerst je profiel aan.",
160
- label: "E-mail",
161
- name: "email",
162
- value: "true",
163
- },
164
- {
165
- checked: true,
166
- id: "10ee620a-af7e-4c67-9f6d-5519b3c45c6d",
167
- invalid: true,
168
- invalidDescription: "Wij hebben geen postadres van je. Vul eerst je profiel aan.",
169
- label: "Brief",
170
- name: "mail",
171
- value: "true",
172
- },
173
- ],
174
- }}
175
- >
176
- {FormFieldCheckboxGroup.bind({})}
177
- </Story>
178
- </Canvas>
179
-
180
- ## with checkbox invalid grou description
181
-
182
- <Canvas>
183
- <Story
184
- name="group invalid"
185
- args={{
186
- ...exampleArgs,
187
- groupId: "707b7bd8-d476-472c-ac9d-3c1a4caac4c2",
188
- groupLabel: "Hoe wil je dat wij contact opnemen?",
189
- groupInvalid: true,
190
- groupInvalidDescription: "Fout: je hebt geen keuze gemaakt. Kies één of meerdere opties.",
191
- options: [
192
- {
193
- id: "80d14d58-bc99-4c53-824e-36473d6506c7",
194
- label: "Telefoon",
195
- name: "phone",
196
- value: "true",
197
- },
198
- {
199
- id: "0b4aea63-ec5b-4259-b008-ba8eaf8b03e3",
200
- label: "E-mail",
201
- name: "email",
202
- value: "true",
203
- },
204
- {
205
- id: "9360080d-3a48-444d-bc2c-1cd1a40940f9",
206
- label: "Brief",
207
- name: "mail",
208
- value: "true",
209
- },
210
- ],
211
- }}
212
- >
213
- {FormFieldCheckboxGroup.bind({})}
214
- </Story>
215
- </Canvas>