@utrecht/form-field-css 1.3.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 +6 -0
- package/dist/index.css +2 -25
- package/dist/index.min.css +1 -0
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.d.ts +2 -0
- package/package.json +3 -3
- package/src/_mixin.scss +2 -1
- package/src/index.scss +2 -1
- package/dist/index.js +0 -1
- package/src/stories/_email.md +0 -4
- package/src/stories/_new-password.md +0 -6
- package/src/stories/_tel.md +0 -4
- package/src/stories/checkbox-group.stories.mdx +0 -215
- package/src/stories/checkbox.stories.mdx +0 -136
- package/src/stories/example.stories.mdx +0 -292
- package/src/stories/radio-group.stories.mdx +0 -162
- package/src/stories/readme.stories.mdx +0 -6
- package/src/stories/rtl.stories.mdx +0 -404
- package/src/stories/textbox.stories.mdx +0 -128
- package/src/stories/voorvoegsels-tabel-36.json +0 -335
- package/src/story-template.jsx +0 -352
|
@@ -1,335 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
"A",
|
|
3
|
-
"a",
|
|
4
|
-
"aan",
|
|
5
|
-
"Aan",
|
|
6
|
-
"aan de",
|
|
7
|
-
"Aan de",
|
|
8
|
-
"aan den",
|
|
9
|
-
"Aan den",
|
|
10
|
-
"aan der",
|
|
11
|
-
"Aan der",
|
|
12
|
-
"Aan het",
|
|
13
|
-
"aan het",
|
|
14
|
-
"Aan t",
|
|
15
|
-
"aan t",
|
|
16
|
-
"aan 't",
|
|
17
|
-
"Aan 't",
|
|
18
|
-
"Af",
|
|
19
|
-
"af",
|
|
20
|
-
"al",
|
|
21
|
-
"Al",
|
|
22
|
-
"am",
|
|
23
|
-
"Am",
|
|
24
|
-
"am de",
|
|
25
|
-
"Am de",
|
|
26
|
-
"auf",
|
|
27
|
-
"Auf",
|
|
28
|
-
"auf dem",
|
|
29
|
-
"Auf dem",
|
|
30
|
-
"auf den",
|
|
31
|
-
"Auf den",
|
|
32
|
-
"auf der",
|
|
33
|
-
"Auf der",
|
|
34
|
-
"auf ter",
|
|
35
|
-
"Auf ter",
|
|
36
|
-
"Aus",
|
|
37
|
-
"aus",
|
|
38
|
-
"aus dem",
|
|
39
|
-
"Aus dem",
|
|
40
|
-
"Aus den",
|
|
41
|
-
"aus den",
|
|
42
|
-
"Aus der",
|
|
43
|
-
"aus der",
|
|
44
|
-
"aus m",
|
|
45
|
-
"Aus m",
|
|
46
|
-
"Aus 'm",
|
|
47
|
-
"aus 'm",
|
|
48
|
-
"Ben",
|
|
49
|
-
"ben",
|
|
50
|
-
"bij",
|
|
51
|
-
"Bij",
|
|
52
|
-
"Bij de",
|
|
53
|
-
"bij de",
|
|
54
|
-
"bij den",
|
|
55
|
-
"Bij den",
|
|
56
|
-
"Bij het",
|
|
57
|
-
"bij het",
|
|
58
|
-
"bij t",
|
|
59
|
-
"Bij t",
|
|
60
|
-
"bij 't",
|
|
61
|
-
"Bij 't",
|
|
62
|
-
"bin",
|
|
63
|
-
"Bin",
|
|
64
|
-
"boven d",
|
|
65
|
-
"Boven d",
|
|
66
|
-
"boven d'",
|
|
67
|
-
"Boven d'",
|
|
68
|
-
"d",
|
|
69
|
-
"D",
|
|
70
|
-
"D'",
|
|
71
|
-
"d'",
|
|
72
|
-
"Da",
|
|
73
|
-
"da",
|
|
74
|
-
"Dal",
|
|
75
|
-
"dal",
|
|
76
|
-
"dal'",
|
|
77
|
-
"Dal'",
|
|
78
|
-
"Dalla",
|
|
79
|
-
"dalla",
|
|
80
|
-
"das",
|
|
81
|
-
"Das",
|
|
82
|
-
"de",
|
|
83
|
-
"De",
|
|
84
|
-
"de die",
|
|
85
|
-
"De die",
|
|
86
|
-
"de die le",
|
|
87
|
-
"De die le",
|
|
88
|
-
"de l",
|
|
89
|
-
"De l",
|
|
90
|
-
"de l'",
|
|
91
|
-
"De l'",
|
|
92
|
-
"de la",
|
|
93
|
-
"De la",
|
|
94
|
-
"de las",
|
|
95
|
-
"De las",
|
|
96
|
-
"De le",
|
|
97
|
-
"de le",
|
|
98
|
-
"de van der",
|
|
99
|
-
"De van der",
|
|
100
|
-
"deca",
|
|
101
|
-
"Deca",
|
|
102
|
-
"Degli",
|
|
103
|
-
"degli",
|
|
104
|
-
"Dei",
|
|
105
|
-
"dei",
|
|
106
|
-
"del",
|
|
107
|
-
"Del",
|
|
108
|
-
"Della",
|
|
109
|
-
"della",
|
|
110
|
-
"den",
|
|
111
|
-
"Den",
|
|
112
|
-
"Der",
|
|
113
|
-
"der",
|
|
114
|
-
"des",
|
|
115
|
-
"Des",
|
|
116
|
-
"di",
|
|
117
|
-
"Di",
|
|
118
|
-
"die le",
|
|
119
|
-
"Die le",
|
|
120
|
-
"do",
|
|
121
|
-
"Do",
|
|
122
|
-
"don",
|
|
123
|
-
"Don",
|
|
124
|
-
"dos",
|
|
125
|
-
"Dos",
|
|
126
|
-
"du",
|
|
127
|
-
"Du",
|
|
128
|
-
"el",
|
|
129
|
-
"El",
|
|
130
|
-
"Het",
|
|
131
|
-
"het",
|
|
132
|
-
"i",
|
|
133
|
-
"I",
|
|
134
|
-
"im",
|
|
135
|
-
"Im",
|
|
136
|
-
"In",
|
|
137
|
-
"in",
|
|
138
|
-
"In de",
|
|
139
|
-
"in de",
|
|
140
|
-
"In den",
|
|
141
|
-
"in den",
|
|
142
|
-
"in der",
|
|
143
|
-
"In der",
|
|
144
|
-
"in het",
|
|
145
|
-
"In het",
|
|
146
|
-
"in t",
|
|
147
|
-
"In t",
|
|
148
|
-
"In 't",
|
|
149
|
-
"in 't",
|
|
150
|
-
"L",
|
|
151
|
-
"l",
|
|
152
|
-
"L'",
|
|
153
|
-
"l'",
|
|
154
|
-
"la",
|
|
155
|
-
"La",
|
|
156
|
-
"Las",
|
|
157
|
-
"las",
|
|
158
|
-
"le",
|
|
159
|
-
"Le",
|
|
160
|
-
"les",
|
|
161
|
-
"Les",
|
|
162
|
-
"lo",
|
|
163
|
-
"Lo",
|
|
164
|
-
"Los",
|
|
165
|
-
"los",
|
|
166
|
-
"Of",
|
|
167
|
-
"of",
|
|
168
|
-
"Onder",
|
|
169
|
-
"onder",
|
|
170
|
-
"onder de",
|
|
171
|
-
"Onder de",
|
|
172
|
-
"onder den",
|
|
173
|
-
"Onder den",
|
|
174
|
-
"onder het",
|
|
175
|
-
"Onder het",
|
|
176
|
-
"onder t",
|
|
177
|
-
"Onder t",
|
|
178
|
-
"onder 't",
|
|
179
|
-
"Onder 't",
|
|
180
|
-
"op",
|
|
181
|
-
"Op",
|
|
182
|
-
"op de",
|
|
183
|
-
"Op de",
|
|
184
|
-
"Op den",
|
|
185
|
-
"op den",
|
|
186
|
-
"op der",
|
|
187
|
-
"Op der",
|
|
188
|
-
"Op gen",
|
|
189
|
-
"op gen",
|
|
190
|
-
"op het",
|
|
191
|
-
"Op het",
|
|
192
|
-
"op t",
|
|
193
|
-
"Op t",
|
|
194
|
-
"op 't",
|
|
195
|
-
"Op 't",
|
|
196
|
-
"op ten",
|
|
197
|
-
"Op ten",
|
|
198
|
-
"Over",
|
|
199
|
-
"over",
|
|
200
|
-
"over de",
|
|
201
|
-
"Over de",
|
|
202
|
-
"over den",
|
|
203
|
-
"Over den",
|
|
204
|
-
"over het",
|
|
205
|
-
"Over het",
|
|
206
|
-
"over t",
|
|
207
|
-
"Over t",
|
|
208
|
-
"over 't",
|
|
209
|
-
"Over 't",
|
|
210
|
-
"s",
|
|
211
|
-
"S",
|
|
212
|
-
"'s",
|
|
213
|
-
"'S",
|
|
214
|
-
"s'",
|
|
215
|
-
"S'",
|
|
216
|
-
"t",
|
|
217
|
-
"T",
|
|
218
|
-
"'t",
|
|
219
|
-
"'T",
|
|
220
|
-
"Te",
|
|
221
|
-
"te",
|
|
222
|
-
"ten",
|
|
223
|
-
"Ten",
|
|
224
|
-
"ter",
|
|
225
|
-
"Ter",
|
|
226
|
-
"Tho",
|
|
227
|
-
"tho",
|
|
228
|
-
"Thoe",
|
|
229
|
-
"thoe",
|
|
230
|
-
"thor",
|
|
231
|
-
"Thor",
|
|
232
|
-
"to",
|
|
233
|
-
"To",
|
|
234
|
-
"Toe",
|
|
235
|
-
"toe",
|
|
236
|
-
"Tot",
|
|
237
|
-
"tot",
|
|
238
|
-
"uijt",
|
|
239
|
-
"Uijt",
|
|
240
|
-
"Uijt de",
|
|
241
|
-
"uijt de",
|
|
242
|
-
"Uijt den",
|
|
243
|
-
"uijt den",
|
|
244
|
-
"Uijt 't",
|
|
245
|
-
"uijt 't",
|
|
246
|
-
"uijt te de",
|
|
247
|
-
"Uijt te de",
|
|
248
|
-
"uijt ten",
|
|
249
|
-
"Uijt ten",
|
|
250
|
-
"uit",
|
|
251
|
-
"Uit",
|
|
252
|
-
"Uit de",
|
|
253
|
-
"uit de",
|
|
254
|
-
"uit den",
|
|
255
|
-
"Uit den",
|
|
256
|
-
"uit het",
|
|
257
|
-
"Uit het",
|
|
258
|
-
"uit t",
|
|
259
|
-
"Uit t",
|
|
260
|
-
"uit 't",
|
|
261
|
-
"Uit 't",
|
|
262
|
-
"Uit te de",
|
|
263
|
-
"uit te de",
|
|
264
|
-
"Uit ten",
|
|
265
|
-
"uit ten",
|
|
266
|
-
"Unter",
|
|
267
|
-
"unter",
|
|
268
|
-
"van",
|
|
269
|
-
"Van",
|
|
270
|
-
"Van de",
|
|
271
|
-
"van De",
|
|
272
|
-
"van de",
|
|
273
|
-
"van de l",
|
|
274
|
-
"Van de l",
|
|
275
|
-
"Van de l'",
|
|
276
|
-
"van de l'",
|
|
277
|
-
"van den",
|
|
278
|
-
"Van Den",
|
|
279
|
-
"Van den",
|
|
280
|
-
"van der",
|
|
281
|
-
"Van der",
|
|
282
|
-
"Van Der",
|
|
283
|
-
"van gen",
|
|
284
|
-
"Van gen",
|
|
285
|
-
"van het",
|
|
286
|
-
"Van het",
|
|
287
|
-
"van la",
|
|
288
|
-
"Van la",
|
|
289
|
-
"van t",
|
|
290
|
-
"Van t",
|
|
291
|
-
"Van 't",
|
|
292
|
-
"van 't",
|
|
293
|
-
"Van ter",
|
|
294
|
-
"van ter",
|
|
295
|
-
"Van van de",
|
|
296
|
-
"van van de",
|
|
297
|
-
"ver",
|
|
298
|
-
"Ver",
|
|
299
|
-
"Vom",
|
|
300
|
-
"vom",
|
|
301
|
-
"von",
|
|
302
|
-
"Von",
|
|
303
|
-
"von dem",
|
|
304
|
-
"Von dem",
|
|
305
|
-
"von den",
|
|
306
|
-
"Von den",
|
|
307
|
-
"Von der",
|
|
308
|
-
"von der",
|
|
309
|
-
"Von t",
|
|
310
|
-
"von t",
|
|
311
|
-
"Von 't",
|
|
312
|
-
"von 't",
|
|
313
|
-
"voor",
|
|
314
|
-
"Voor",
|
|
315
|
-
"Voor de",
|
|
316
|
-
"voor de",
|
|
317
|
-
"Voor den",
|
|
318
|
-
"voor den",
|
|
319
|
-
"voor in t",
|
|
320
|
-
"Voor in t",
|
|
321
|
-
"voor in 't",
|
|
322
|
-
"Voor in 't",
|
|
323
|
-
"Voor 't",
|
|
324
|
-
"voor 't",
|
|
325
|
-
"vor",
|
|
326
|
-
"Vor",
|
|
327
|
-
"vor der",
|
|
328
|
-
"Vor der",
|
|
329
|
-
"Zu",
|
|
330
|
-
"zu",
|
|
331
|
-
"zum",
|
|
332
|
-
"Zum",
|
|
333
|
-
"zur",
|
|
334
|
-
"Zur"
|
|
335
|
-
]
|
package/src/story-template.jsx
DELETED
|
@@ -1,352 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license EUPL-1.2
|
|
3
|
-
* Copyright (c) 2020-2022 Gemeente Utrecht
|
|
4
|
-
* Copyright (c) 2020-2022 Frameless B.V.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import clsx from 'clsx';
|
|
8
|
-
import React from 'react';
|
|
9
|
-
import { Checkbox } from '../../checkbox/src/story-template';
|
|
10
|
-
import { FormFieldDescription } from '../../form-field-description/src/story-template';
|
|
11
|
-
import { FormFieldset, FormFieldsetLegend } from '../../form-fieldset/src/story-template';
|
|
12
|
-
import { FormLabel } from '../../form-label/src/story-template';
|
|
13
|
-
import { Heading1 } from '../../heading-1/src/story-template';
|
|
14
|
-
import { Heading2 } from '../../heading-2/src/story-template';
|
|
15
|
-
import { Heading3 } from '../../heading-3/src/story-template';
|
|
16
|
-
import { Heading4 } from '../../heading-4/src/story-template';
|
|
17
|
-
import { Heading5 } from '../../heading-5/src/story-template';
|
|
18
|
-
import { Heading6 } from '../../heading-6/src/story-template';
|
|
19
|
-
import { RadioButton } from '../../radio-button/src/story-template';
|
|
20
|
-
import { Textarea } from '../../textarea/src/story-template';
|
|
21
|
-
import { Textbox } from '../../textbox/src/story-template';
|
|
22
|
-
|
|
23
|
-
export const argTypes = {
|
|
24
|
-
invalid: {
|
|
25
|
-
description: 'Invalid',
|
|
26
|
-
control: 'boolean',
|
|
27
|
-
},
|
|
28
|
-
label: {
|
|
29
|
-
description: 'Set the content of the label',
|
|
30
|
-
control: 'text',
|
|
31
|
-
},
|
|
32
|
-
headingLevel: {
|
|
33
|
-
description: 'Heading level',
|
|
34
|
-
control: { type: 'select' },
|
|
35
|
-
options: ['', '1', '2', '3', '4', '5', '6'],
|
|
36
|
-
},
|
|
37
|
-
type: {
|
|
38
|
-
description: 'Type',
|
|
39
|
-
control: { type: 'select' },
|
|
40
|
-
options: ['', 'checkbox', 'radio', 'text'],
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export const defaultArgs = {
|
|
45
|
-
invalid: false,
|
|
46
|
-
label: '',
|
|
47
|
-
headingLevel: '',
|
|
48
|
-
type: '',
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export const exampleArgs = {
|
|
52
|
-
name: 'subject',
|
|
53
|
-
label: 'Onderwerp',
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export const Heading = ({ children, level }) => {
|
|
57
|
-
const HeadingComponent =
|
|
58
|
-
level === 1
|
|
59
|
-
? Heading1
|
|
60
|
-
: level === 2
|
|
61
|
-
? Heading2
|
|
62
|
-
: level === 3
|
|
63
|
-
? Heading3
|
|
64
|
-
: level === 4
|
|
65
|
-
? Heading4
|
|
66
|
-
: level === 5
|
|
67
|
-
? Heading5
|
|
68
|
-
: level === 6
|
|
69
|
-
? Heading6
|
|
70
|
-
: Heading1;
|
|
71
|
-
|
|
72
|
-
return <HeadingComponent>{children}</HeadingComponent>;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export const FormField = ({ children, id, invalid, type }) => (
|
|
76
|
-
<div
|
|
77
|
-
id={id}
|
|
78
|
-
className={clsx('utrecht-form-field', {
|
|
79
|
-
'utrecht-form-field--invalid': invalid,
|
|
80
|
-
'utrecht-form-field--checkbox': type === 'checkbox',
|
|
81
|
-
'utrecht-form-field--radio': type === 'radio',
|
|
82
|
-
'utrecht-form-field--text': !type || type === 'text',
|
|
83
|
-
})}
|
|
84
|
-
>
|
|
85
|
-
{children}
|
|
86
|
-
</div>
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
export const FormFieldTextbox = ({
|
|
90
|
-
id = defaultArgs.id,
|
|
91
|
-
name = defaultArgs.name,
|
|
92
|
-
label = defaultArgs.label,
|
|
93
|
-
value = defaultArgs.value,
|
|
94
|
-
description = defaultArgs.description,
|
|
95
|
-
invalid = defaultArgs.invalid,
|
|
96
|
-
invalidDescription = defaultArgs.invalidDescription,
|
|
97
|
-
headingLevel = null,
|
|
98
|
-
FormComponent = Textbox,
|
|
99
|
-
autoComplete,
|
|
100
|
-
inputMode,
|
|
101
|
-
dir,
|
|
102
|
-
placeholder,
|
|
103
|
-
placeholderDir,
|
|
104
|
-
type,
|
|
105
|
-
}) => {
|
|
106
|
-
const descriptionId = description ? `${id}-description` : null;
|
|
107
|
-
const invalidDescriptionId = invalidDescription ? `${id}-invalid-description` : null;
|
|
108
|
-
return (
|
|
109
|
-
<FormField invalid={invalid} type="textbox">
|
|
110
|
-
{headingLevel ? (
|
|
111
|
-
<Heading level={headingLevel} className="utrecht-form-field__label" htmlFor={id}>
|
|
112
|
-
<FormLabel htmlFor={id}>{label}</FormLabel>
|
|
113
|
-
</Heading>
|
|
114
|
-
) : (
|
|
115
|
-
<FormLabel className="utrecht-form-field__label" htmlFor={id}>
|
|
116
|
-
{label}
|
|
117
|
-
</FormLabel>
|
|
118
|
-
)}
|
|
119
|
-
{description ? (
|
|
120
|
-
<FormFieldDescription id={descriptionId} className="utrecht-form-field__description">
|
|
121
|
-
{description}
|
|
122
|
-
</FormFieldDescription>
|
|
123
|
-
) : undefined}
|
|
124
|
-
{invalidDescription ? (
|
|
125
|
-
<FormFieldDescription id={invalidDescriptionId} status="invalid" className="utrecht-form-field__description">
|
|
126
|
-
{invalidDescription}
|
|
127
|
-
</FormFieldDescription>
|
|
128
|
-
) : undefined}
|
|
129
|
-
<FormComponent
|
|
130
|
-
className="utrecht-form-field__input"
|
|
131
|
-
id={id}
|
|
132
|
-
value={value}
|
|
133
|
-
name={name}
|
|
134
|
-
autoComplete={autoComplete}
|
|
135
|
-
type={type}
|
|
136
|
-
inputMode={inputMode}
|
|
137
|
-
dir={dir}
|
|
138
|
-
placeholder={placeholder}
|
|
139
|
-
placeholderDir={placeholderDir}
|
|
140
|
-
aria-describedby={[descriptionId, invalidDescriptionId].filter(Boolean).join(' ') || null}
|
|
141
|
-
/>
|
|
142
|
-
</FormField>
|
|
143
|
-
);
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
export default FormFieldTextbox;
|
|
147
|
-
|
|
148
|
-
export const FormFieldCheckbox = ({
|
|
149
|
-
id = defaultArgs.id,
|
|
150
|
-
invalid = defaultArgs.invalid,
|
|
151
|
-
name = defaultArgs.name,
|
|
152
|
-
label = defaultArgs.label,
|
|
153
|
-
required = defaultArgs.required,
|
|
154
|
-
value = defaultArgs.value,
|
|
155
|
-
description = defaultArgs.description,
|
|
156
|
-
implicitLabel = true,
|
|
157
|
-
invalidDescription = defaultArgs.invalidDescription,
|
|
158
|
-
}) => {
|
|
159
|
-
const descriptionId = description ? `${id}-description` : null;
|
|
160
|
-
const invalidDescriptionId = invalidDescription ? `${id}-invalid-description` : null;
|
|
161
|
-
const checkbox = (
|
|
162
|
-
<Checkbox
|
|
163
|
-
aria-describedby={[descriptionId, invalidDescriptionId].filter(Boolean).join(' ') || null}
|
|
164
|
-
className="utrecht-form-field__input"
|
|
165
|
-
custom={true}
|
|
166
|
-
id={id}
|
|
167
|
-
invalid={invalid}
|
|
168
|
-
required={required}
|
|
169
|
-
name={name}
|
|
170
|
-
value={value}
|
|
171
|
-
/>
|
|
172
|
-
);
|
|
173
|
-
|
|
174
|
-
return (
|
|
175
|
-
<FormField invalid={invalid} type="checkbox">
|
|
176
|
-
<p className="utrecht-form-field__label utrecht-form-field__label--checkbox">
|
|
177
|
-
<FormLabel type="checkbox" htmlFor={id}>
|
|
178
|
-
{implicitLabel && checkbox}
|
|
179
|
-
{label}
|
|
180
|
-
</FormLabel>
|
|
181
|
-
</p>
|
|
182
|
-
{description ? (
|
|
183
|
-
<FormFieldDescription id={descriptionId} className="utrecht-form-field__description">
|
|
184
|
-
{description}
|
|
185
|
-
</FormFieldDescription>
|
|
186
|
-
) : undefined}
|
|
187
|
-
{invalidDescription ? (
|
|
188
|
-
<FormFieldDescription id={invalidDescriptionId} status="invalid" className="utrecht-form-field__description">
|
|
189
|
-
{invalidDescription}
|
|
190
|
-
</FormFieldDescription>
|
|
191
|
-
) : undefined}
|
|
192
|
-
{!implicitLabel && checkbox}
|
|
193
|
-
</FormField>
|
|
194
|
-
);
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
export const FormFieldCheckboxGroup = ({
|
|
198
|
-
groupId,
|
|
199
|
-
groupLabel,
|
|
200
|
-
groupDescription,
|
|
201
|
-
groupInvalidDescription = defaultArgs.invalidDescription,
|
|
202
|
-
groupName,
|
|
203
|
-
invalid = defaultArgs.invalid,
|
|
204
|
-
implicitLabel = true,
|
|
205
|
-
options = [],
|
|
206
|
-
headingLevel,
|
|
207
|
-
}) => {
|
|
208
|
-
const groupDescriptionId = groupId && groupDescription ? `${groupId}-description` : null;
|
|
209
|
-
const groupInvalidDescriptionId = groupInvalidDescription ? `${groupId}-invalid-description` : null;
|
|
210
|
-
const groupDescribedByIds = [groupDescriptionId, groupInvalidDescriptionId].filter(Boolean).join(' ');
|
|
211
|
-
return (
|
|
212
|
-
<FormFieldset id={groupId} aria-describedby={groupDescribedByIds} invalid={invalid}>
|
|
213
|
-
<FormFieldsetLegend>
|
|
214
|
-
{headingLevel ? <Heading level={headingLevel}>{groupLabel}</Heading> : groupLabel}
|
|
215
|
-
</FormFieldsetLegend>
|
|
216
|
-
{groupDescriptionId ? (
|
|
217
|
-
<FormFieldDescription id={groupDescriptionId}>{groupDescription}</FormFieldDescription>
|
|
218
|
-
) : undefined}
|
|
219
|
-
{groupInvalidDescriptionId ? (
|
|
220
|
-
<FormFieldDescription id={groupInvalidDescriptionId} status="invalid">
|
|
221
|
-
{groupInvalidDescription}
|
|
222
|
-
</FormFieldDescription>
|
|
223
|
-
) : undefined}
|
|
224
|
-
{options.map(({ description, checked, id, invalid, invalidDescription, label, name, value }) => {
|
|
225
|
-
const descriptionId = `${id}-description`;
|
|
226
|
-
const invalidDescriptionId = invalid ? `${id}-invalid-description` : null;
|
|
227
|
-
const checkbox = (
|
|
228
|
-
<Checkbox
|
|
229
|
-
className="utrecht-form-field__input"
|
|
230
|
-
id={id}
|
|
231
|
-
value={value}
|
|
232
|
-
name={name || groupName}
|
|
233
|
-
defaultChecked={checked}
|
|
234
|
-
custom={true}
|
|
235
|
-
aria-describedby={[descriptionId, invalidDescriptionId].filter(Boolean).join(' ') || null}
|
|
236
|
-
/>
|
|
237
|
-
);
|
|
238
|
-
return (
|
|
239
|
-
<FormField invalid={invalid} type="checkbox" key={id}>
|
|
240
|
-
<p className="utrecht-form-field__label utrecht-form-field__label--checkbox">
|
|
241
|
-
<FormLabel type="checkbox" htmlFor={id}>
|
|
242
|
-
{implicitLabel && checkbox}
|
|
243
|
-
{label}
|
|
244
|
-
</FormLabel>
|
|
245
|
-
</p>
|
|
246
|
-
{description ? (
|
|
247
|
-
<FormFieldDescription id={descriptionId} className="utrecht-form-field__description">
|
|
248
|
-
{description}
|
|
249
|
-
</FormFieldDescription>
|
|
250
|
-
) : undefined}
|
|
251
|
-
{invalidDescription ? (
|
|
252
|
-
<FormFieldDescription
|
|
253
|
-
id={invalidDescriptionId}
|
|
254
|
-
status="invalid"
|
|
255
|
-
className="utrecht-form-field__description"
|
|
256
|
-
>
|
|
257
|
-
{invalidDescription}
|
|
258
|
-
</FormFieldDescription>
|
|
259
|
-
) : undefined}
|
|
260
|
-
{!implicitLabel && checkbox}
|
|
261
|
-
</FormField>
|
|
262
|
-
);
|
|
263
|
-
})}
|
|
264
|
-
</FormFieldset>
|
|
265
|
-
);
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
export const FormFieldRadioGroup = ({
|
|
269
|
-
name = defaultArgs.name,
|
|
270
|
-
groupId = defaultArgs.id,
|
|
271
|
-
groupLabel,
|
|
272
|
-
groupDescription,
|
|
273
|
-
invalid = defaultArgs.invalid,
|
|
274
|
-
groupInvalidDescription,
|
|
275
|
-
implicitLabel = true,
|
|
276
|
-
options,
|
|
277
|
-
headingLevel,
|
|
278
|
-
}) => {
|
|
279
|
-
const groupDescriptionId = groupDescription ? `${groupId}-description` : null;
|
|
280
|
-
const groupInvalidDescriptionId = groupInvalidDescription ? `${groupId}-invalid-description` : null;
|
|
281
|
-
const groupDescribedByIds = [groupDescriptionId, groupInvalidDescriptionId].filter(Boolean);
|
|
282
|
-
const groupDescribedBy = groupDescribedByIds.length ? groupDescribedByIds.join(' ') : undefined;
|
|
283
|
-
return (
|
|
284
|
-
<FormFieldset role="radiogroup" id={groupId} aria-describedby={groupDescribedBy} invalid={invalid}>
|
|
285
|
-
<FormFieldsetLegend>
|
|
286
|
-
{headingLevel ? <Heading level={headingLevel}>{groupLabel}</Heading> : groupLabel}
|
|
287
|
-
</FormFieldsetLegend>
|
|
288
|
-
{groupDescription ? (
|
|
289
|
-
<FormFieldDescription id={groupDescriptionId}>{groupDescription}</FormFieldDescription>
|
|
290
|
-
) : undefined}
|
|
291
|
-
{groupInvalidDescription ? (
|
|
292
|
-
<FormFieldDescription status="invalid" id={groupInvalidDescriptionId}>
|
|
293
|
-
{groupInvalidDescription}
|
|
294
|
-
</FormFieldDescription>
|
|
295
|
-
) : undefined}
|
|
296
|
-
{options.map(({ id, label, description, invalidDescription, value }) => {
|
|
297
|
-
const descriptionId = description ? `${id}-description` : null;
|
|
298
|
-
const invalidDescriptionId = invalidDescription ? `${id}-invalid-description` : null;
|
|
299
|
-
const input = (
|
|
300
|
-
<RadioButton
|
|
301
|
-
className="utrecht-form-field__input"
|
|
302
|
-
id={id}
|
|
303
|
-
value={value}
|
|
304
|
-
name={name}
|
|
305
|
-
custom={true}
|
|
306
|
-
aria-describedby={[descriptionId, invalidDescriptionId].filter(Boolean).join(' ') || null}
|
|
307
|
-
/>
|
|
308
|
-
);
|
|
309
|
-
return (
|
|
310
|
-
<FormField type="radio" key={id}>
|
|
311
|
-
<p className="utrecht-form-field__label utrecht-form-field__label--radio">
|
|
312
|
-
<FormLabel type="radio" htmlFor={id}>
|
|
313
|
-
{implicitLabel && input}
|
|
314
|
-
{label}
|
|
315
|
-
</FormLabel>
|
|
316
|
-
</p>
|
|
317
|
-
{description ? (
|
|
318
|
-
<FormFieldDescription id={descriptionId} className="utrecht-form-field__description">
|
|
319
|
-
{description}
|
|
320
|
-
</FormFieldDescription>
|
|
321
|
-
) : undefined}
|
|
322
|
-
{invalidDescription ? (
|
|
323
|
-
<FormFieldDescription
|
|
324
|
-
id={invalidDescriptionId}
|
|
325
|
-
status="invalid"
|
|
326
|
-
className="utrecht-form-field__description"
|
|
327
|
-
>
|
|
328
|
-
{invalidDescription}
|
|
329
|
-
</FormFieldDescription>
|
|
330
|
-
) : undefined}
|
|
331
|
-
{!implicitLabel && input}
|
|
332
|
-
</FormField>
|
|
333
|
-
);
|
|
334
|
-
})}
|
|
335
|
-
</FormFieldset>
|
|
336
|
-
);
|
|
337
|
-
};
|
|
338
|
-
|
|
339
|
-
export const FormFieldExample = ({ control, ...restProps }) => {
|
|
340
|
-
if (control === 'text' || control === 'textarea') {
|
|
341
|
-
let component = control === 'textarea' ? Textarea : Textbox;
|
|
342
|
-
return FormFieldTextbox({ ...restProps, component });
|
|
343
|
-
} else {
|
|
344
|
-
return <></>;
|
|
345
|
-
}
|
|
346
|
-
};
|
|
347
|
-
|
|
348
|
-
export const arabicDecorator = (Story) => (
|
|
349
|
-
<div dir="rtl" lang="ar">
|
|
350
|
-
{Story()}
|
|
351
|
-
</div>
|
|
352
|
-
);
|