@italia/checkbox 1.0.0-alpha.4
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/AUTHORS +3 -0
- package/LICENSE +11 -0
- package/README.md +75 -0
- package/custom-elements.json +687 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +10 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/it-checkbox-group.d.ts +49 -0
- package/dist/src/it-checkbox-group.d.ts.map +1 -0
- package/dist/src/it-checkbox-group.js +1206 -0
- package/dist/src/it-checkbox-group.js.map +1 -0
- package/dist/src/it-checkbox.d.ts +38 -0
- package/dist/src/it-checkbox.d.ts.map +1 -0
- package/dist/src/it-checkbox.js +1215 -0
- package/dist/src/it-checkbox.js.map +1 -0
- package/package.json +69 -0
- package/styles/globals.scss +21 -0
|
@@ -0,0 +1,687 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "1.0.0",
|
|
3
|
+
"readme": "",
|
|
4
|
+
"modules": [
|
|
5
|
+
{
|
|
6
|
+
"kind": "javascript-module",
|
|
7
|
+
"path": "src/index.ts",
|
|
8
|
+
"declarations": [],
|
|
9
|
+
"exports": [
|
|
10
|
+
{
|
|
11
|
+
"kind": "js",
|
|
12
|
+
"name": "ItCheckbox",
|
|
13
|
+
"declaration": {
|
|
14
|
+
"name": "ItCheckbox",
|
|
15
|
+
"module": "./it-checkbox.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"kind": "js",
|
|
20
|
+
"name": "ItCheckboxGroup",
|
|
21
|
+
"declaration": {
|
|
22
|
+
"name": "ItCheckboxGroup",
|
|
23
|
+
"module": "./it-checkbox-group.js"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"kind": "javascript-module",
|
|
30
|
+
"path": "src/it-checkbox-group.ts",
|
|
31
|
+
"declarations": [
|
|
32
|
+
{
|
|
33
|
+
"kind": "class",
|
|
34
|
+
"description": "",
|
|
35
|
+
"name": "ItCheckboxGroup",
|
|
36
|
+
"members": [
|
|
37
|
+
{
|
|
38
|
+
"kind": "field",
|
|
39
|
+
"name": "required",
|
|
40
|
+
"type": {
|
|
41
|
+
"text": "boolean"
|
|
42
|
+
},
|
|
43
|
+
"default": "false",
|
|
44
|
+
"attribute": "required",
|
|
45
|
+
"reflects": true
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"kind": "field",
|
|
49
|
+
"name": "inline",
|
|
50
|
+
"type": {
|
|
51
|
+
"text": "boolean"
|
|
52
|
+
},
|
|
53
|
+
"default": "false",
|
|
54
|
+
"description": "Draws checkboxes inline, side by side.",
|
|
55
|
+
"attribute": "inline",
|
|
56
|
+
"reflects": true
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"kind": "field",
|
|
60
|
+
"name": "group",
|
|
61
|
+
"type": {
|
|
62
|
+
"text": "boolean"
|
|
63
|
+
},
|
|
64
|
+
"default": "false",
|
|
65
|
+
"description": "Draws checkboxes in groups.",
|
|
66
|
+
"attribute": "group",
|
|
67
|
+
"reflects": true
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"kind": "field",
|
|
71
|
+
"name": "name",
|
|
72
|
+
"type": {
|
|
73
|
+
"text": "string"
|
|
74
|
+
},
|
|
75
|
+
"default": "''",
|
|
76
|
+
"attribute": "name",
|
|
77
|
+
"reflects": true
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"kind": "field",
|
|
81
|
+
"name": "checkboxes",
|
|
82
|
+
"type": {
|
|
83
|
+
"text": "ItCheckbox[]"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"kind": "field",
|
|
88
|
+
"name": "_label",
|
|
89
|
+
"type": {
|
|
90
|
+
"text": "HTMLElement[]"
|
|
91
|
+
},
|
|
92
|
+
"privacy": "private"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"kind": "field",
|
|
96
|
+
"name": "formControlController",
|
|
97
|
+
"type": {
|
|
98
|
+
"text": "FormControlController"
|
|
99
|
+
},
|
|
100
|
+
"privacy": "protected",
|
|
101
|
+
"readonly": true,
|
|
102
|
+
"default": "new FormControlController(this, { // Il valore è un array dei valori delle checkbox selezionate value: (control: FormControl) => (control as ItCheckboxGroup).checkboxes.filter((cb) => cb.checked).map((cb) => cb.value || 'true'), // Il name è quello del gruppo name: (control: FormControl) => (control as ItCheckboxGroup).name, // La validità è gestita da noi con checkValidity di gruppo checkValidity: (control: FormControl) => (control as ItCheckboxGroup).checkValidity(), reportValidity: (control: FormControl) => (control as ItCheckboxGroup).reportValidity(), // Non implementiamo setValue qui, gestito dalle singole checkbox setValue: () => {}, // Ascoltiamo l'input su tutti i cambi di stato delle checkbox assumeInteractionOn: ['it-change'], })"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"kind": "field",
|
|
106
|
+
"name": "_groupValid",
|
|
107
|
+
"type": {
|
|
108
|
+
"text": "boolean"
|
|
109
|
+
},
|
|
110
|
+
"privacy": "private",
|
|
111
|
+
"default": "true"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"kind": "field",
|
|
115
|
+
"name": "selectedValues",
|
|
116
|
+
"type": {
|
|
117
|
+
"text": "string[]"
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"kind": "method",
|
|
122
|
+
"name": "has",
|
|
123
|
+
"privacy": "public",
|
|
124
|
+
"parameters": [
|
|
125
|
+
{
|
|
126
|
+
"name": "v",
|
|
127
|
+
"type": {
|
|
128
|
+
"text": "string"
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"kind": "field",
|
|
135
|
+
"name": "validity",
|
|
136
|
+
"type": {
|
|
137
|
+
"text": "ValidityState"
|
|
138
|
+
},
|
|
139
|
+
"description": "Override: Custom validity check for radio group",
|
|
140
|
+
"readonly": true
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"kind": "method",
|
|
144
|
+
"name": "_handleGroupChange",
|
|
145
|
+
"privacy": "private"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"kind": "method",
|
|
149
|
+
"name": "checkValidity",
|
|
150
|
+
"return": {
|
|
151
|
+
"type": {
|
|
152
|
+
"text": "boolean"
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
"description": "Override di checkValidity per la logica di gruppo."
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"kind": "method",
|
|
159
|
+
"name": "reportValidity",
|
|
160
|
+
"return": {
|
|
161
|
+
"type": {
|
|
162
|
+
"text": "boolean"
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
"description": "Override di reportValidity per mostrare l'errore a livello di gruppo."
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"kind": "method",
|
|
169
|
+
"name": "handleValidationMessages",
|
|
170
|
+
"privacy": "protected",
|
|
171
|
+
"description": "Il tuo FormControl ha già un handleValidationMessages che\nsetta this.validationMessage. Aggiorniamolo per la logica di gruppo."
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"kind": "method",
|
|
175
|
+
"name": "_syncGroupStateToChildren",
|
|
176
|
+
"privacy": "private",
|
|
177
|
+
"description": "Sync group state (name, grouped, inline, required, disabled, checked) to child checkboxes\nThis replaces the need for requestUpdate() calls"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"kind": "method",
|
|
181
|
+
"name": "setCustomValidity",
|
|
182
|
+
"privacy": "public",
|
|
183
|
+
"parameters": [
|
|
184
|
+
{
|
|
185
|
+
"name": "message",
|
|
186
|
+
"type": {
|
|
187
|
+
"text": "string"
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
]
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"kind": "method",
|
|
194
|
+
"name": "_handleSlotChange",
|
|
195
|
+
"privacy": "private"
|
|
196
|
+
}
|
|
197
|
+
],
|
|
198
|
+
"attributes": [
|
|
199
|
+
{
|
|
200
|
+
"name": "required",
|
|
201
|
+
"type": {
|
|
202
|
+
"text": "boolean"
|
|
203
|
+
},
|
|
204
|
+
"default": "false",
|
|
205
|
+
"fieldName": "required"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"name": "inline",
|
|
209
|
+
"type": {
|
|
210
|
+
"text": "boolean"
|
|
211
|
+
},
|
|
212
|
+
"default": "false",
|
|
213
|
+
"description": "Draws checkboxes inline, side by side.",
|
|
214
|
+
"fieldName": "inline"
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"name": "group",
|
|
218
|
+
"type": {
|
|
219
|
+
"text": "boolean"
|
|
220
|
+
},
|
|
221
|
+
"default": "false",
|
|
222
|
+
"description": "Draws checkboxes in groups.",
|
|
223
|
+
"fieldName": "group"
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"name": "name",
|
|
227
|
+
"type": {
|
|
228
|
+
"text": "string"
|
|
229
|
+
},
|
|
230
|
+
"default": "''",
|
|
231
|
+
"fieldName": "name"
|
|
232
|
+
}
|
|
233
|
+
],
|
|
234
|
+
"superclass": {
|
|
235
|
+
"name": "FormControl",
|
|
236
|
+
"package": "@italia/globals"
|
|
237
|
+
},
|
|
238
|
+
"tagName": "it-checkbox-group",
|
|
239
|
+
"customElement": true
|
|
240
|
+
}
|
|
241
|
+
],
|
|
242
|
+
"exports": [
|
|
243
|
+
{
|
|
244
|
+
"kind": "js",
|
|
245
|
+
"name": "ItCheckboxGroup",
|
|
246
|
+
"declaration": {
|
|
247
|
+
"name": "ItCheckboxGroup",
|
|
248
|
+
"module": "src/it-checkbox-group.ts"
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
"kind": "custom-element-definition",
|
|
253
|
+
"name": "it-checkbox-group",
|
|
254
|
+
"declaration": {
|
|
255
|
+
"name": "ItCheckboxGroup",
|
|
256
|
+
"module": "src/it-checkbox-group.ts"
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
]
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"kind": "javascript-module",
|
|
263
|
+
"path": "src/it-checkbox.ts",
|
|
264
|
+
"declarations": [
|
|
265
|
+
{
|
|
266
|
+
"kind": "class",
|
|
267
|
+
"description": "",
|
|
268
|
+
"name": "ItCheckbox",
|
|
269
|
+
"members": [
|
|
270
|
+
{
|
|
271
|
+
"kind": "field",
|
|
272
|
+
"name": "formControlController",
|
|
273
|
+
"type": {
|
|
274
|
+
"text": "FormControlController"
|
|
275
|
+
},
|
|
276
|
+
"privacy": "protected",
|
|
277
|
+
"readonly": true,
|
|
278
|
+
"default": "new FormControlController(this, { value: (control: FormControl) => (control as ItCheckbox).checked ? (control as ItCheckbox).value || 'true' : undefined, setValue: (control: FormControl, value: unknown) => { const checkbox = control as ItCheckbox; checkbox.checked = Boolean(value); }, })"
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"kind": "field",
|
|
282
|
+
"name": "type",
|
|
283
|
+
"type": {
|
|
284
|
+
"text": "string"
|
|
285
|
+
},
|
|
286
|
+
"default": "'checkbox'",
|
|
287
|
+
"description": "The type of input. Works the same as a native `<input>` element, but only a subset of types are supported. Defaults\nto `text`."
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
"kind": "field",
|
|
291
|
+
"name": "checked",
|
|
292
|
+
"type": {
|
|
293
|
+
"text": "boolean"
|
|
294
|
+
},
|
|
295
|
+
"default": "false",
|
|
296
|
+
"description": "Draws the checkbox in a checked state.",
|
|
297
|
+
"attribute": "checked",
|
|
298
|
+
"reflects": true
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
"kind": "field",
|
|
302
|
+
"name": "inline",
|
|
303
|
+
"type": {
|
|
304
|
+
"text": "boolean"
|
|
305
|
+
},
|
|
306
|
+
"default": "false",
|
|
307
|
+
"description": "Draws checkboxes inline, side by side.",
|
|
308
|
+
"attribute": "inline",
|
|
309
|
+
"reflects": true
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
"kind": "field",
|
|
313
|
+
"name": "group",
|
|
314
|
+
"type": {
|
|
315
|
+
"text": "boolean"
|
|
316
|
+
},
|
|
317
|
+
"default": "false",
|
|
318
|
+
"description": "Draws checkboxes in groups.",
|
|
319
|
+
"attribute": "group",
|
|
320
|
+
"reflects": true
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
"kind": "field",
|
|
324
|
+
"name": "indeterminate",
|
|
325
|
+
"type": {
|
|
326
|
+
"text": "boolean"
|
|
327
|
+
},
|
|
328
|
+
"default": "false",
|
|
329
|
+
"description": "Draws the checkbox in an indeterminate state. This is usually applied to checkboxes that represents a \"select\nall/none\" behavior when associated checkboxes have a mix of checked and unchecked states.",
|
|
330
|
+
"attribute": "indeterminate",
|
|
331
|
+
"reflects": true
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
"kind": "field",
|
|
335
|
+
"name": "labelElements",
|
|
336
|
+
"type": {
|
|
337
|
+
"text": "HTMLElement[]"
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
"kind": "field",
|
|
342
|
+
"name": "label",
|
|
343
|
+
"type": {
|
|
344
|
+
"text": "string"
|
|
345
|
+
},
|
|
346
|
+
"readonly": true
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
"kind": "field",
|
|
350
|
+
"name": "supportText",
|
|
351
|
+
"type": {
|
|
352
|
+
"text": "string"
|
|
353
|
+
},
|
|
354
|
+
"default": "''",
|
|
355
|
+
"description": "The input's help text.",
|
|
356
|
+
"attribute": "support-text"
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
"kind": "method",
|
|
360
|
+
"name": "click",
|
|
361
|
+
"description": "Simulates a click on the checkbox."
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
"kind": "method",
|
|
365
|
+
"name": "_handleClick",
|
|
366
|
+
"privacy": "protected",
|
|
367
|
+
"return": {
|
|
368
|
+
"type": {
|
|
369
|
+
"text": "void"
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
"parameters": [
|
|
373
|
+
{
|
|
374
|
+
"name": "e",
|
|
375
|
+
"type": {
|
|
376
|
+
"text": "Event"
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
]
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
"kind": "method",
|
|
383
|
+
"name": "_renderInput",
|
|
384
|
+
"privacy": "private",
|
|
385
|
+
"parameters": [
|
|
386
|
+
{
|
|
387
|
+
"name": "supportTextId",
|
|
388
|
+
"type": {
|
|
389
|
+
"text": "string"
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
"name": "invalid",
|
|
394
|
+
"type": {
|
|
395
|
+
"text": "boolean"
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
"name": "validityMessage",
|
|
400
|
+
"type": {
|
|
401
|
+
"text": "string"
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
]
|
|
405
|
+
}
|
|
406
|
+
],
|
|
407
|
+
"events": [
|
|
408
|
+
{
|
|
409
|
+
"name": "change",
|
|
410
|
+
"type": {
|
|
411
|
+
"text": "Event"
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
],
|
|
415
|
+
"attributes": [
|
|
416
|
+
{
|
|
417
|
+
"name": "checked",
|
|
418
|
+
"type": {
|
|
419
|
+
"text": "boolean"
|
|
420
|
+
},
|
|
421
|
+
"default": "false",
|
|
422
|
+
"description": "Draws the checkbox in a checked state.",
|
|
423
|
+
"fieldName": "checked"
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
"name": "inline",
|
|
427
|
+
"type": {
|
|
428
|
+
"text": "boolean"
|
|
429
|
+
},
|
|
430
|
+
"default": "false",
|
|
431
|
+
"description": "Draws checkboxes inline, side by side.",
|
|
432
|
+
"fieldName": "inline"
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
"name": "group",
|
|
436
|
+
"type": {
|
|
437
|
+
"text": "boolean"
|
|
438
|
+
},
|
|
439
|
+
"default": "false",
|
|
440
|
+
"description": "Draws checkboxes in groups.",
|
|
441
|
+
"fieldName": "group"
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
"name": "indeterminate",
|
|
445
|
+
"type": {
|
|
446
|
+
"text": "boolean"
|
|
447
|
+
},
|
|
448
|
+
"default": "false",
|
|
449
|
+
"description": "Draws the checkbox in an indeterminate state. This is usually applied to checkboxes that represents a \"select\nall/none\" behavior when associated checkboxes have a mix of checked and unchecked states.",
|
|
450
|
+
"fieldName": "indeterminate"
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
"name": "support-text",
|
|
454
|
+
"type": {
|
|
455
|
+
"text": "string"
|
|
456
|
+
},
|
|
457
|
+
"default": "''",
|
|
458
|
+
"description": "The input's help text.",
|
|
459
|
+
"fieldName": "supportText"
|
|
460
|
+
}
|
|
461
|
+
],
|
|
462
|
+
"superclass": {
|
|
463
|
+
"name": "FormControl",
|
|
464
|
+
"package": "@italia/globals"
|
|
465
|
+
},
|
|
466
|
+
"tagName": "it-checkbox",
|
|
467
|
+
"customElement": true
|
|
468
|
+
}
|
|
469
|
+
],
|
|
470
|
+
"exports": [
|
|
471
|
+
{
|
|
472
|
+
"kind": "js",
|
|
473
|
+
"name": "ItCheckbox",
|
|
474
|
+
"declaration": {
|
|
475
|
+
"name": "ItCheckbox",
|
|
476
|
+
"module": "src/it-checkbox.ts"
|
|
477
|
+
}
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
"kind": "custom-element-definition",
|
|
481
|
+
"name": "it-checkbox",
|
|
482
|
+
"declaration": {
|
|
483
|
+
"name": "ItCheckbox",
|
|
484
|
+
"module": "src/it-checkbox.ts"
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
]
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
"kind": "javascript-module",
|
|
491
|
+
"path": "stories/it-checkbox.stories.ts",
|
|
492
|
+
"declarations": [
|
|
493
|
+
{
|
|
494
|
+
"kind": "variable",
|
|
495
|
+
"name": "meta",
|
|
496
|
+
"default": "{ title: 'Componenti/Form/Checkbox', tags: ['new', 'a11y-ok', 'web-component'], component: 'it-checkbox', args: { id: '', label: 'Checkbox di esempio', name: 'esempio', value: undefined, checked: false, indeterminate: false, disabled: false, form: undefined, customValidation: false, validityMessage: '', required: false, inline: false, group: false, supportText: '', }, argTypes: { id: { control: 'text', description: 'ID del campo', type: 'string', }, label: { control: 'text', description: 'Etichetta del campo', type: 'string', }, name: { control: 'text', type: 'string', }, value: { control: 'text', description: 'Valore del campo', type: 'string', }, checked: { control: 'boolean', type: 'boolean', table: { defaultValue: { summary: 'false' } }, }, indeterminate: { control: 'boolean', type: 'boolean', table: { defaultValue: { summary: 'false' } }, }, disabled: { control: 'boolean', type: 'boolean', table: { defaultValue: { summary: 'false' } }, }, form: { control: 'text', type: 'string', description: \"ID html del form a cui è associato il campo, se il campo non si trova all'interno di una form \", }, customValidation: { name: 'custom-validation', control: 'boolean', type: 'boolean', table: { defaultValue: { summary: 'false' } }, description: 'Se la validazione del campo è fatta esternamente (lato server o con plugin js - validazione custom), impostare questo attributo a `true`.', }, validityMessage: { name: 'validity-message', control: 'text', type: 'string', description: \"Messaggio da mostrare quando il campo è invalido nel caso di validazione esterna (validazione custom). Se impostato a '' (stringa vuota) il campo viene considerato valido.\", }, required: { control: 'boolean', type: 'boolean', table: { defaultValue: { summary: 'false' } }, }, inline: { control: 'boolean', type: 'boolean', description: 'Se si vogliono mostrare più checkbox affiancate orizzontalmente', table: { defaultValue: { summary: 'false' } }, }, group: { control: 'boolean', type: 'boolean', description: 'Se si vogliono mostrare più checkbox raggruppate visivamente', table: { defaultValue: { summary: 'false' } }, }, supportText: { name: 'support-text', control: 'text', description: 'Testo di supporto', type: 'string', }, }, } satisfies Meta<CheckboxProps>"
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
"kind": "variable",
|
|
500
|
+
"name": "EsempioInterattivo",
|
|
501
|
+
"type": {
|
|
502
|
+
"text": "Story"
|
|
503
|
+
},
|
|
504
|
+
"default": "{ ...meta, name: 'Esempio interattivo', tags: ['!dev'], parameters: { docs: { canvas: { sourceState: 'shown', }, }, }, render: (params) => html`${renderComponent({ ...params, })} `, }"
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
"kind": "variable",
|
|
508
|
+
"name": "Disabilitato",
|
|
509
|
+
"type": {
|
|
510
|
+
"text": "Story"
|
|
511
|
+
},
|
|
512
|
+
"default": "{ ...meta, // name: 'Disabilitato', args: { disabled: true }, render: (params) => html` <it-checkbox-group name=${params.name} ?required=${params.required} ?disabled=${params.disabled}> <span slot=\"legend\">Gruppo di checkbox</span> ${renderComponent({ ...params, required: undefined, disabled: undefined, label: 'Checkbox non selezionato', className: 'mb-2', })} ${renderComponent({ ...params, required: undefined, disabled: undefined, label: 'Checkbox selezionato', checked: true, })} </it-checkbox-group> `, }"
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
"kind": "variable",
|
|
516
|
+
"name": "Indeterminate",
|
|
517
|
+
"type": {
|
|
518
|
+
"text": "Story"
|
|
519
|
+
},
|
|
520
|
+
"default": "{ ...meta, name: 'Indeterminato (mixed)', args: { indeterminate: true }, render: (params) => html` ${renderComponent({ ...params, label: 'Checkbox indeterminato', })} `, }"
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
"kind": "variable",
|
|
524
|
+
"name": "Inline",
|
|
525
|
+
"type": {
|
|
526
|
+
"text": "Story"
|
|
527
|
+
},
|
|
528
|
+
"default": "{ ...meta, // name: 'Inline', args: { inline: true }, argTypes: { ...Object.fromEntries( Object.entries(meta.argTypes).map(([key, value]) => key !== 'inline' ? [key, { ...value, table: { ...value.table, disable: true } }] : [key, { ...value }], ), ), }, render: (params) => html` <it-checkbox-group name=${params.name} ?required=${params.required} ?group=${params.group} ?inline=${params.inline}> <span slot=\"legend\">Gruppo di checkbox</span> ${renderComponent({ ...params, required: undefined, name: undefined, group: undefined, inline: undefined, label: 'Checkbox non selezionato', })} ${renderComponent({ ...params, required: undefined, name: undefined, group: undefined, inline: undefined, label: 'Checkbox selezionato', checked: true, })} </it-checkbox-group> `, }"
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
"kind": "variable",
|
|
532
|
+
"name": "Group",
|
|
533
|
+
"type": {
|
|
534
|
+
"text": "Story"
|
|
535
|
+
},
|
|
536
|
+
"default": "{ ...meta, name: 'Gruppo di checkbox', args: { group: true }, render: (params) => html` <div class=\"row\"> <it-checkbox-group name=${params.name} ?required=${params.required} ?group=${params.group} ?inline=${params.inline} ?disabled=${params.disabled} class=\"col-12 col-md-6\" > <span slot=\"legend\">Gruppo di checkbox</span> ${renderComponent({ ...params, required: undefined, name: undefined, group: undefined, inline: undefined, label: 'Checkbox selezionato', checked: true, })} ${renderComponent({ ...params, required: undefined, name: undefined, group: undefined, inline: undefined, label: 'Checkbox non selezionato', })} ${renderComponent({ ...params, required: undefined, name: undefined, group: undefined, inline: undefined, disabled: true, label: 'Checkbox disabilitato non selezionato', })} </it-checkbox-group> <it-checkbox-group name=${params.name} ?required=${params.required} ?group=${params.group} ?inline=${params.inline} ?disabled=${Group.disabled} class=\"col-12 col-md-6\" > <span slot=\"legend\">Gruppo di checkbox</span> ${renderComponent({ ...params, required: undefined, name: undefined, group: undefined, inline: undefined, label: 'Checkbox selezionato', checked: true, supportText: \"Testo descrittivo di supporto per l'opzione selezionabile\", })} ${renderComponent({ ...params, required: undefined, name: undefined, group: undefined, inline: undefined, label: 'Checkbox non selezionato', supportText: \"Testo descrittivo di supporto per l'opzione selezionabile\", })} ${renderComponent({ ...params, required: undefined, name: undefined, group: undefined, inline: undefined, disabled: true, label: 'Checkbox disabilitato non selezionato', supportText: \"Testo descrittivo di supporto per l'opzione selezionabile\", })} </it-checkbox-group> </div> `, }"
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
"kind": "variable",
|
|
540
|
+
"name": "GroupInitValue",
|
|
541
|
+
"type": {
|
|
542
|
+
"text": "Story"
|
|
543
|
+
},
|
|
544
|
+
"default": "{ ...meta, name: 'Valore iniziale del gruppo', args: { group: true, name: 'checkboxgroup' }, render: (params) => html` <it-checkbox-group name=${params.name} ?required=${params.required} ?group=${params.group} ?inline=${params.inline} ?disabled=${params.disabled} value='[\"opt_1\",\"opt_3\"]' > <span slot=\"legend\">Gruppo di checkbox</span> ${renderComponent({ ...params, required: undefined, name: undefined, group: undefined, inline: undefined, disabled: undefined, label: 'Opzione numero 1', value: 'opt_1', })} ${renderComponent({ ...params, required: undefined, name: undefined, group: undefined, inline: undefined, disabled: undefined, label: 'Opzione numero 2', value: 'opt_2', })} ${renderComponent({ ...params, required: undefined, name: undefined, group: undefined, inline: undefined, disabled: undefined, label: 'Opzione numero 3', value: 'opt_3', })} </it-checkbox-group> `, }"
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
"kind": "variable",
|
|
548
|
+
"name": "SupportText",
|
|
549
|
+
"type": {
|
|
550
|
+
"text": "Story"
|
|
551
|
+
},
|
|
552
|
+
"default": "{ ...meta, name: 'Testo di supporto', args: { supportText: \"Testo descrittivo di supporto per l'opzione selezionabile\" }, render: (params) => html` ${renderComponent({ ...params, label: 'Checkbox con testo di supporto selezionato', })} `, }"
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
"kind": "variable",
|
|
556
|
+
"name": "ValidazioneNativa",
|
|
557
|
+
"type": {
|
|
558
|
+
"text": "Story"
|
|
559
|
+
},
|
|
560
|
+
"default": "{ ...meta, name: 'Validazione nativa', args: { required: true }, render: (params) => html` <form> <div class=\"row mb-4\"> <div class=\"col-md-6 d-flex align-items-center\"> ${renderComponent({ ...params, label: 'Checkbox singola obbligatoria', name: 'single-required-example', id: 'single-required-example', })} </div> <div class=\"col-md-6\"> <it-checkbox-group name=\"multiple-required-example\" ?required=${params.required} ?group=${params.group} ?inline=${params.inline} ?disabled=${params.disabled} > <span slot=\"legend\">Gruppo di checkbox obbligatorio</span> ${renderComponent({ ...params, required: undefined, name: undefined, group: undefined, inline: undefined, disabled: undefined, label: 'Valore 1', value: 'valore_1', })} ${renderComponent({ ...params, required: undefined, name: undefined, group: undefined, inline: undefined, disabled: undefined, label: 'Valore 2', value: 'valore_2', })} ${renderComponent({ ...params, required: undefined, name: undefined, group: undefined, inline: undefined, disabled: undefined, label: 'Valore 3', value: 'valore_3', })} </it-checkbox-group> </div> </div> <div class=\"text-center\"> <it-button type=\"submit\" variant=\"primary\">Invia</it-button> </div> </form> `, }"
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
"kind": "variable",
|
|
564
|
+
"name": "ValidazioneCustom",
|
|
565
|
+
"type": {
|
|
566
|
+
"text": "Story"
|
|
567
|
+
},
|
|
568
|
+
"default": "{ ...meta, name: 'Validazione custom', args: { customValidation: true, validityMessage: 'Questo campo è obbligatorio!!!' }, render: (params) => html` <div class=\"row\"> <div class=\"col-md-6 d-flex align-items-center\"> ${renderComponent({ ...params, required: undefined, label: 'Checkbox singola obbligatoria', name: 'external-validation-single-example', id: 'external-validation-single-example', })} </div> <div class=\"col-md-6\"> <it-checkbox-group name=\"external-validation-multiple-example\" ?group=${params.group} ?inline=${params.inline} ?disabled=${params.disabled} ?custom-validation=${params.customValidation} validity-message=\"${ifDefined(params.validityMessage || undefined)}\" > <span slot=\"legend\">Gruppo di checkbox obbligatorio</span> ${renderComponent({ ...params, required: undefined, name: undefined, group: undefined, inline: undefined, disabled: undefined, customValidation: undefined, validityMessage: undefined, label: 'Valore 1', value: 'valore_1', })} ${renderComponent({ ...params, required: undefined, name: undefined, group: undefined, inline: undefined, disabled: undefined, customValidation: undefined, validityMessage: undefined, label: 'Valore 2', value: 'valore_2', })} ${renderComponent({ ...params, required: undefined, name: undefined, group: undefined, inline: undefined, disabled: undefined, customValidation: undefined, validityMessage: undefined, label: 'Valore 3', value: 'valore_3', })} </it-checkbox-group> </div> </div> </form> `, }"
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
"kind": "variable",
|
|
572
|
+
"name": "GestioneEventi",
|
|
573
|
+
"type": {
|
|
574
|
+
"text": "Story"
|
|
575
|
+
},
|
|
576
|
+
"default": "{ ...meta, name: 'Gestione degli eventi', parameters: { docs: { description: { story: `È possibile gestire gli eventi di \\`it-input\\`, \\`it-blur\\`, \\`it-change\\`, \\`it-focus\\`, \\`it-click\\` per effettuare operazioni personalizzate, come la validazione esterna o l'aggiornamento di altri campi. <br/><br/> È sufficiente aggiungere un event listener al componente \\`<it-checkbox>\\` o al componente \\`<it-checkbox-group>\\` per intercettare gli eventi desiderati. Ad esempio, per gestire l'evento di change, è possibile utilizzare il seguente codice: \\`\\`\\`js document.querySelector('it-checkbox#event-checkbox-example').addEventListener('it-change', (event) => { console.log('Checkbox event:', event); alert('Checkbox event'); }); \\`\\`\\` Il componente, emette anche un evento di tipo \\`it-input-ready\\` quando l'input è pronto e caricato nel DOM: \\`\\`\\`js document.querySelector('it-checkbox#event-checkbox-example').addEventListener('it-input-ready', (event) => { console.log('Checkbox ready:', event); }); \\`\\`\\` `, }, }, }, args: { type: 'text', label: 'Prova evento di change', name: 'event-checkbox-example', id: 'event-checkbox-example', }, render: (params) => html` <script> document.querySelector('it-checkbox#event-checkbox-example').addEventListener('it-change', (event) => { console.log('Checkbox event:', event); alert('Checkbox event'); }); document.querySelector('it-checkbox#event-checkbox-example').addEventListener('it-input-ready', (event) => { console.log('Checkbox ready:', event); }); </script> ${renderComponent({ ...params, })} `, }"
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
"kind": "variable",
|
|
580
|
+
"name": "MetodiEPropPubblici",
|
|
581
|
+
"type": {
|
|
582
|
+
"text": "Story"
|
|
583
|
+
},
|
|
584
|
+
"default": "{ ...StoryFormControlMethodAndProps({ componentName: 'it-checkbox', otherMethods: `|\\`click()\\`| Triggera l'evento di click sull'input reale | - |`, }), tags: ['!dev'], }"
|
|
585
|
+
}
|
|
586
|
+
],
|
|
587
|
+
"exports": [
|
|
588
|
+
{
|
|
589
|
+
"kind": "js",
|
|
590
|
+
"name": "default",
|
|
591
|
+
"declaration": {
|
|
592
|
+
"name": "meta",
|
|
593
|
+
"module": "stories/it-checkbox.stories.ts"
|
|
594
|
+
}
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
"kind": "js",
|
|
598
|
+
"name": "EsempioInterattivo",
|
|
599
|
+
"declaration": {
|
|
600
|
+
"name": "EsempioInterattivo",
|
|
601
|
+
"module": "stories/it-checkbox.stories.ts"
|
|
602
|
+
}
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
"kind": "js",
|
|
606
|
+
"name": "Disabilitato",
|
|
607
|
+
"declaration": {
|
|
608
|
+
"name": "Disabilitato",
|
|
609
|
+
"module": "stories/it-checkbox.stories.ts"
|
|
610
|
+
}
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
"kind": "js",
|
|
614
|
+
"name": "Indeterminate",
|
|
615
|
+
"declaration": {
|
|
616
|
+
"name": "Indeterminate",
|
|
617
|
+
"module": "stories/it-checkbox.stories.ts"
|
|
618
|
+
}
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
"kind": "js",
|
|
622
|
+
"name": "Inline",
|
|
623
|
+
"declaration": {
|
|
624
|
+
"name": "Inline",
|
|
625
|
+
"module": "stories/it-checkbox.stories.ts"
|
|
626
|
+
}
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
"kind": "js",
|
|
630
|
+
"name": "Group",
|
|
631
|
+
"declaration": {
|
|
632
|
+
"name": "Group",
|
|
633
|
+
"module": "stories/it-checkbox.stories.ts"
|
|
634
|
+
}
|
|
635
|
+
},
|
|
636
|
+
{
|
|
637
|
+
"kind": "js",
|
|
638
|
+
"name": "GroupInitValue",
|
|
639
|
+
"declaration": {
|
|
640
|
+
"name": "GroupInitValue",
|
|
641
|
+
"module": "stories/it-checkbox.stories.ts"
|
|
642
|
+
}
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
"kind": "js",
|
|
646
|
+
"name": "SupportText",
|
|
647
|
+
"declaration": {
|
|
648
|
+
"name": "SupportText",
|
|
649
|
+
"module": "stories/it-checkbox.stories.ts"
|
|
650
|
+
}
|
|
651
|
+
},
|
|
652
|
+
{
|
|
653
|
+
"kind": "js",
|
|
654
|
+
"name": "ValidazioneNativa",
|
|
655
|
+
"declaration": {
|
|
656
|
+
"name": "ValidazioneNativa",
|
|
657
|
+
"module": "stories/it-checkbox.stories.ts"
|
|
658
|
+
}
|
|
659
|
+
},
|
|
660
|
+
{
|
|
661
|
+
"kind": "js",
|
|
662
|
+
"name": "ValidazioneCustom",
|
|
663
|
+
"declaration": {
|
|
664
|
+
"name": "ValidazioneCustom",
|
|
665
|
+
"module": "stories/it-checkbox.stories.ts"
|
|
666
|
+
}
|
|
667
|
+
},
|
|
668
|
+
{
|
|
669
|
+
"kind": "js",
|
|
670
|
+
"name": "GestioneEventi",
|
|
671
|
+
"declaration": {
|
|
672
|
+
"name": "GestioneEventi",
|
|
673
|
+
"module": "stories/it-checkbox.stories.ts"
|
|
674
|
+
}
|
|
675
|
+
},
|
|
676
|
+
{
|
|
677
|
+
"kind": "js",
|
|
678
|
+
"name": "MetodiEPropPubblici",
|
|
679
|
+
"declaration": {
|
|
680
|
+
"name": "MetodiEPropPubblici",
|
|
681
|
+
"module": "stories/it-checkbox.stories.ts"
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
]
|
|
685
|
+
}
|
|
686
|
+
]
|
|
687
|
+
}
|