@italia/input 0.1.0-alpha.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.
@@ -0,0 +1,1045 @@
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": "ItInput",
13
+ "declaration": {
14
+ "name": "ItInput",
15
+ "module": "./it-input.js"
16
+ }
17
+ }
18
+ ]
19
+ },
20
+ {
21
+ "kind": "javascript-module",
22
+ "path": "src/it-input.ts",
23
+ "declarations": [
24
+ {
25
+ "kind": "class",
26
+ "description": "",
27
+ "name": "ItInput",
28
+ "members": [
29
+ {
30
+ "kind": "field",
31
+ "name": "formAssociated",
32
+ "static": true,
33
+ "readonly": true
34
+ },
35
+ {
36
+ "kind": "field",
37
+ "name": "internals",
38
+ "attribute": "internals"
39
+ },
40
+ {
41
+ "kind": "field",
42
+ "name": "slotted",
43
+ "type": {
44
+ "text": "boolean"
45
+ },
46
+ "default": "false",
47
+ "attribute": "slotted"
48
+ },
49
+ {
50
+ "kind": "field",
51
+ "name": "invalid",
52
+ "type": {
53
+ "text": "boolean"
54
+ },
55
+ "default": "false",
56
+ "attribute": "invalid",
57
+ "reflects": true
58
+ },
59
+ {
60
+ "kind": "field",
61
+ "name": "customValidation",
62
+ "type": {
63
+ "text": "boolean"
64
+ },
65
+ "default": "false",
66
+ "attribute": "custom-validation",
67
+ "reflects": true
68
+ },
69
+ {
70
+ "kind": "field",
71
+ "name": "required",
72
+ "type": {
73
+ "text": "boolean"
74
+ },
75
+ "default": "false",
76
+ "attribute": "required",
77
+ "reflects": true
78
+ },
79
+ {
80
+ "kind": "field",
81
+ "name": "validationText",
82
+ "type": {
83
+ "text": "string"
84
+ },
85
+ "default": "''",
86
+ "attribute": "validity-message"
87
+ },
88
+ {
89
+ "kind": "field",
90
+ "name": "_inputElement",
91
+ "type": {
92
+ "text": "HTMLInputElement"
93
+ },
94
+ "privacy": "protected"
95
+ },
96
+ {
97
+ "kind": "field",
98
+ "name": "size",
99
+ "type": {
100
+ "text": "Sizes | undefined"
101
+ },
102
+ "attribute": "size"
103
+ },
104
+ {
105
+ "kind": "field",
106
+ "name": "label",
107
+ "type": {
108
+ "text": "string"
109
+ },
110
+ "default": "''",
111
+ "attribute": "label"
112
+ },
113
+ {
114
+ "kind": "field",
115
+ "name": "labelHidden",
116
+ "type": {
117
+ "text": "boolean"
118
+ },
119
+ "default": "false",
120
+ "attribute": "label-hidden"
121
+ },
122
+ {
123
+ "kind": "field",
124
+ "name": "type",
125
+ "type": {
126
+ "text": "InputType"
127
+ },
128
+ "default": "'text'",
129
+ "attribute": "type"
130
+ },
131
+ {
132
+ "kind": "field",
133
+ "name": "name",
134
+ "type": {
135
+ "text": "string"
136
+ },
137
+ "default": "''",
138
+ "attribute": "name"
139
+ },
140
+ {
141
+ "kind": "field",
142
+ "name": "placeholder",
143
+ "type": {
144
+ "text": "string"
145
+ },
146
+ "default": "''",
147
+ "attribute": "placeholder"
148
+ },
149
+ {
150
+ "kind": "field",
151
+ "name": "supportText",
152
+ "type": {
153
+ "text": "string"
154
+ },
155
+ "default": "''",
156
+ "attribute": "support-text"
157
+ },
158
+ {
159
+ "kind": "field",
160
+ "name": "disabled",
161
+ "type": {
162
+ "text": "boolean"
163
+ },
164
+ "default": "false",
165
+ "attribute": "disabled"
166
+ },
167
+ {
168
+ "kind": "field",
169
+ "name": "plaintext",
170
+ "type": {
171
+ "text": "boolean"
172
+ },
173
+ "default": "false",
174
+ "attribute": "plaintext"
175
+ },
176
+ {
177
+ "kind": "field",
178
+ "name": "readonly",
179
+ "type": {
180
+ "text": "boolean"
181
+ },
182
+ "default": "false",
183
+ "attribute": "readonly"
184
+ },
185
+ {
186
+ "kind": "field",
187
+ "name": "passwordStrengthMeter",
188
+ "type": {
189
+ "text": "boolean"
190
+ },
191
+ "default": "false",
192
+ "attribute": "strength-meter"
193
+ },
194
+ {
195
+ "kind": "field",
196
+ "name": "suggestions",
197
+ "type": {
198
+ "text": "boolean"
199
+ },
200
+ "default": "false",
201
+ "attribute": "suggestions"
202
+ },
203
+ {
204
+ "kind": "field",
205
+ "name": "minlength",
206
+ "type": {
207
+ "text": "number"
208
+ },
209
+ "default": "-1",
210
+ "attribute": "minlength"
211
+ },
212
+ {
213
+ "kind": "field",
214
+ "name": "maxlength",
215
+ "type": {
216
+ "text": "number"
217
+ },
218
+ "default": "-1",
219
+ "attribute": "maxlength"
220
+ },
221
+ {
222
+ "kind": "field",
223
+ "name": "pattern",
224
+ "type": {
225
+ "text": "string | undefined"
226
+ },
227
+ "privacy": "public",
228
+ "description": "Pattern the `value` must match to be valid",
229
+ "attribute": "pattern"
230
+ },
231
+ {
232
+ "kind": "field",
233
+ "name": "_passwordVisible",
234
+ "type": {
235
+ "text": "boolean"
236
+ },
237
+ "privacy": "private",
238
+ "default": "false"
239
+ },
240
+ {
241
+ "kind": "field",
242
+ "name": "_strengthInfos",
243
+ "type": {
244
+ "text": "string"
245
+ },
246
+ "privacy": "private",
247
+ "default": "''"
248
+ },
249
+ {
250
+ "kind": "field",
251
+ "name": "_score",
252
+ "type": {
253
+ "text": "number"
254
+ },
255
+ "privacy": "private",
256
+ "default": "0"
257
+ },
258
+ {
259
+ "kind": "field",
260
+ "name": "_value",
261
+ "type": {
262
+ "text": "string"
263
+ },
264
+ "default": "''"
265
+ },
266
+ {
267
+ "kind": "field",
268
+ "name": "_touched",
269
+ "type": {
270
+ "text": "boolean"
271
+ },
272
+ "default": "false"
273
+ },
274
+ {
275
+ "kind": "field",
276
+ "name": "validityMessage",
277
+ "type": {
278
+ "text": "string"
279
+ },
280
+ "privacy": "public",
281
+ "default": "''",
282
+ "attribute": "validityMessage"
283
+ },
284
+ {
285
+ "kind": "field",
286
+ "name": "value",
287
+ "attribute": "value",
288
+ "reflects": true
289
+ },
290
+ {
291
+ "kind": "field",
292
+ "name": "inputElement",
293
+ "readonly": true
294
+ },
295
+ {
296
+ "kind": "method",
297
+ "name": "_handleFormdata",
298
+ "parameters": [
299
+ {
300
+ "name": "event",
301
+ "type": {
302
+ "text": "FormDataEvent"
303
+ }
304
+ }
305
+ ]
306
+ },
307
+ {
308
+ "kind": "method",
309
+ "name": "_handleInput",
310
+ "privacy": "private",
311
+ "parameters": [
312
+ {
313
+ "name": "e",
314
+ "type": {
315
+ "text": "Event"
316
+ }
317
+ }
318
+ ]
319
+ },
320
+ {
321
+ "kind": "method",
322
+ "name": "checkValidity"
323
+ },
324
+ {
325
+ "kind": "method",
326
+ "name": "_handleBlur"
327
+ },
328
+ {
329
+ "kind": "method",
330
+ "name": "_togglePasswordVisibility",
331
+ "privacy": "private"
332
+ },
333
+ {
334
+ "kind": "method",
335
+ "name": "_checkPasswordStrength",
336
+ "privacy": "private",
337
+ "parameters": [
338
+ {
339
+ "name": "value",
340
+ "type": {
341
+ "text": "string"
342
+ }
343
+ }
344
+ ]
345
+ },
346
+ {
347
+ "kind": "method",
348
+ "name": "_getPasswordConfig",
349
+ "privacy": "private"
350
+ },
351
+ {
352
+ "kind": "method",
353
+ "name": "_updateStrengthInfos",
354
+ "privacy": "private"
355
+ },
356
+ {
357
+ "kind": "method",
358
+ "name": "_renderTogglePasswordButton",
359
+ "privacy": "private"
360
+ },
361
+ {
362
+ "kind": "method",
363
+ "name": "_renderSuggestions",
364
+ "privacy": "private"
365
+ },
366
+ {
367
+ "kind": "method",
368
+ "name": "_renderpasswordStrengthMeter",
369
+ "privacy": "private"
370
+ },
371
+ {
372
+ "kind": "method",
373
+ "name": "_renderInput",
374
+ "privacy": "private",
375
+ "parameters": [
376
+ {
377
+ "name": "supportTextId",
378
+ "type": {
379
+ "text": "string"
380
+ }
381
+ }
382
+ ]
383
+ }
384
+ ],
385
+ "events": [
386
+ {
387
+ "name": "on-input",
388
+ "type": {
389
+ "text": "CustomEvent"
390
+ }
391
+ },
392
+ {
393
+ "name": "input-ready",
394
+ "type": {
395
+ "text": "CustomEvent"
396
+ }
397
+ }
398
+ ],
399
+ "attributes": [
400
+ {
401
+ "name": "internals",
402
+ "fieldName": "internals"
403
+ },
404
+ {
405
+ "name": "slotted",
406
+ "type": {
407
+ "text": "boolean"
408
+ },
409
+ "default": "false",
410
+ "fieldName": "slotted"
411
+ },
412
+ {
413
+ "name": "invalid",
414
+ "type": {
415
+ "text": "boolean"
416
+ },
417
+ "default": "false",
418
+ "fieldName": "invalid"
419
+ },
420
+ {
421
+ "name": "custom-validation",
422
+ "type": {
423
+ "text": "boolean"
424
+ },
425
+ "default": "false",
426
+ "fieldName": "customValidation"
427
+ },
428
+ {
429
+ "name": "required",
430
+ "type": {
431
+ "text": "boolean"
432
+ },
433
+ "default": "false",
434
+ "fieldName": "required"
435
+ },
436
+ {
437
+ "name": "validity-message",
438
+ "type": {
439
+ "text": "string"
440
+ },
441
+ "default": "''",
442
+ "fieldName": "validationText"
443
+ },
444
+ {
445
+ "name": "size",
446
+ "type": {
447
+ "text": "Sizes | undefined"
448
+ },
449
+ "fieldName": "size"
450
+ },
451
+ {
452
+ "name": "label",
453
+ "type": {
454
+ "text": "string"
455
+ },
456
+ "default": "''",
457
+ "fieldName": "label"
458
+ },
459
+ {
460
+ "name": "label-hidden",
461
+ "type": {
462
+ "text": "boolean"
463
+ },
464
+ "default": "false",
465
+ "fieldName": "labelHidden"
466
+ },
467
+ {
468
+ "name": "type",
469
+ "type": {
470
+ "text": "InputType"
471
+ },
472
+ "default": "'text'",
473
+ "fieldName": "type"
474
+ },
475
+ {
476
+ "name": "name",
477
+ "type": {
478
+ "text": "string"
479
+ },
480
+ "default": "''",
481
+ "fieldName": "name"
482
+ },
483
+ {
484
+ "name": "placeholder",
485
+ "type": {
486
+ "text": "string"
487
+ },
488
+ "default": "''",
489
+ "fieldName": "placeholder"
490
+ },
491
+ {
492
+ "name": "support-text",
493
+ "type": {
494
+ "text": "string"
495
+ },
496
+ "default": "''",
497
+ "fieldName": "supportText"
498
+ },
499
+ {
500
+ "name": "disabled",
501
+ "type": {
502
+ "text": "boolean"
503
+ },
504
+ "default": "false",
505
+ "fieldName": "disabled"
506
+ },
507
+ {
508
+ "name": "plaintext",
509
+ "type": {
510
+ "text": "boolean"
511
+ },
512
+ "default": "false",
513
+ "fieldName": "plaintext"
514
+ },
515
+ {
516
+ "name": "readonly",
517
+ "type": {
518
+ "text": "boolean"
519
+ },
520
+ "default": "false",
521
+ "fieldName": "readonly"
522
+ },
523
+ {
524
+ "name": "strength-meter",
525
+ "type": {
526
+ "text": "boolean"
527
+ },
528
+ "default": "false",
529
+ "fieldName": "passwordStrengthMeter"
530
+ },
531
+ {
532
+ "name": "suggestions",
533
+ "type": {
534
+ "text": "boolean"
535
+ },
536
+ "default": "false",
537
+ "fieldName": "suggestions"
538
+ },
539
+ {
540
+ "name": "minlength",
541
+ "type": {
542
+ "text": "number"
543
+ },
544
+ "default": "-1",
545
+ "fieldName": "minlength"
546
+ },
547
+ {
548
+ "name": "maxlength",
549
+ "type": {
550
+ "text": "number"
551
+ },
552
+ "default": "-1",
553
+ "fieldName": "maxlength"
554
+ },
555
+ {
556
+ "name": "pattern",
557
+ "type": {
558
+ "text": "string | undefined"
559
+ },
560
+ "description": "Pattern the `value` must match to be valid",
561
+ "fieldName": "pattern"
562
+ },
563
+ {
564
+ "name": "validityMessage",
565
+ "type": {
566
+ "text": "string"
567
+ },
568
+ "default": "''",
569
+ "fieldName": "validityMessage"
570
+ },
571
+ {
572
+ "name": "value",
573
+ "fieldName": "value"
574
+ }
575
+ ],
576
+ "mixins": [
577
+ {
578
+ "name": "ValidityMixin",
579
+ "package": "@italia/globals"
580
+ },
581
+ {
582
+ "name": "FormMixin",
583
+ "package": "@italia/globals"
584
+ }
585
+ ],
586
+ "superclass": {
587
+ "name": "BaseLocalizedComponent",
588
+ "package": "@italia/globals"
589
+ },
590
+ "tagName": "it-input",
591
+ "customElement": true
592
+ }
593
+ ],
594
+ "exports": [
595
+ {
596
+ "kind": "js",
597
+ "name": "ItInput",
598
+ "declaration": {
599
+ "name": "ItInput",
600
+ "module": "src/it-input.ts"
601
+ }
602
+ },
603
+ {
604
+ "kind": "custom-element-definition",
605
+ "name": "it-input",
606
+ "declaration": {
607
+ "name": "ItInput",
608
+ "module": "src/it-input.ts"
609
+ }
610
+ }
611
+ ]
612
+ },
613
+ {
614
+ "kind": "javascript-module",
615
+ "path": "src/types.ts",
616
+ "declarations": [
617
+ {
618
+ "kind": "variable",
619
+ "name": "INPUT_TYPES",
620
+ "type": {
621
+ "text": "array"
622
+ },
623
+ "default": "['text', 'email', 'number', 'tel', 'time', 'password', 'textarea']"
624
+ },
625
+ {
626
+ "kind": "variable",
627
+ "name": "INPUT_SIZES",
628
+ "type": {
629
+ "text": "array"
630
+ },
631
+ "default": "['sm', undefined, 'lg']"
632
+ }
633
+ ],
634
+ "exports": [
635
+ {
636
+ "kind": "js",
637
+ "name": "INPUT_TYPES",
638
+ "declaration": {
639
+ "name": "INPUT_TYPES",
640
+ "module": "src/types.ts"
641
+ }
642
+ },
643
+ {
644
+ "kind": "js",
645
+ "name": "INPUT_SIZES",
646
+ "declaration": {
647
+ "name": "INPUT_SIZES",
648
+ "module": "src/types.ts"
649
+ }
650
+ }
651
+ ]
652
+ },
653
+ {
654
+ "kind": "javascript-module",
655
+ "path": "stories/it-input.stories.ts",
656
+ "declarations": [
657
+ {
658
+ "kind": "variable",
659
+ "name": "meta",
660
+ "default": "{ title: 'Componenti/Form/Input', tags: ['autodocs'], component: 'it-input', args: { id: '', label: 'Nome', type: 'text', name: 'nome', disabled: false, invalid: false, required: false, validityMessage: '', customValidation: false, placeholder: '', supportText: '', value: '', size: undefined, readonly: false, plaintext: false, slotted: false, labelHidden: false, passwordStrengthMeter: false, minlength: undefined, maxlength: undefined, suggestions: false, }, argTypes: { label: { control: 'text', description: 'Etichetta del campo', }, type: { control: 'select', options: INPUT_TYPES, table: { defaultValue: { summary: 'text' } }, }, name: { control: 'text', }, disabled: { control: 'boolean', type: 'boolean', table: { defaultValue: { summary: 'false' } }, }, invalid: { control: 'boolean', type: 'boolean', table: { defaultValue: { summary: 'false' } }, }, required: { control: 'boolean', type: 'boolean', table: { defaultValue: { summary: 'false' } }, }, validityMessage: { name: 'validity-message', control: 'text', description: 'Messaggio che viene mostrato quando il campo è invalido', }, 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), impostare questo attributo a `true`.', }, placeholder: { control: 'text', description: 'Testo segnaposto', }, supportText: { name: 'support-text', control: 'text', description: 'Testo di supporto', }, value: { control: 'text', description: 'Valore del campo', }, size: { control: 'select', options: INPUT_SIZES, description: \"Dimensione del campo: 'sm' | (stringa vuota) | 'lg' \", table: { defaultValue: { summary: undefined } }, }, readonly: { control: 'boolean', type: 'boolean', table: { defaultValue: { summary: 'false' } }, }, plaintext: { control: 'boolean', type: 'boolean', table: { defaultValue: { summary: 'false' } }, description: \"Se il campo è readonly, con l'attributo 'plaintext' il campo assume l'aspetto di testo normalizzato.\", }, slotted: { control: 'boolean', type: 'boolean', description: \"Se vengono usati gli slot per mostrare l'icona o il bottone, questo attributo deve avere valore 'true'\", table: { defaultValue: { summary: 'false' } }, }, labelHidden: { name: 'label-hidden', control: 'boolean', type: 'boolean', description: 'Se si vuole nascondere la label. Risulterà comunque accessibile per i lettori di schermo.', table: { defaultValue: { summary: 'false' } }, }, passwordStrengthMeter: { name: 'strength-meter', control: 'boolean', type: 'boolean', description: \"Se si vuole mostrare o meno il misuratore di robustezza della password nel caso di type='password'\", table: { defaultValue: { summary: 'false' } }, }, minlength: { type: 'number', description: 'Lunghezza minima del valore da inserire. Usato anche per validare la robustezza della password', table: { defaultValue: { summary: 'undefined. Se type=\"password\": 8' } }, }, maxlength: { type: 'number', description: 'Lunghezza massima del valore da inserire.', }, suggestions: { name: 'suggestions', control: 'boolean', type: 'boolean', description: \"Se si vogliono mostrare i suggerimenti per l'insderimento di una password sicura.\", table: { defaultValue: { summary: 'false' } }, }, }, parameters: { docs: { description: { component: ` <Description>Input accessibile e responsivo.</Description> Per il corretto funzionamento degli elementi di tipo \\`<it-input>\\` è di fondamentale importanza l’utilizzo uno degli appositi attributi \\`type\\` (ad esempio, \"email\" per l’inserimento di indirizzi email o \"number\" per informazioni numeriche), in modo da sfruttare i controlli nativi dei browser più recenti come la verifica dell’email, l’utilizzo di metodo di input numerico ed altro. <div class=\"callout callout-success\"><div class=\"callout-inner\"><div class=\"callout-title\"><span class=\"text\">Accessibilità</span></div> <p> Tutti gli attributi \\`aria-*\\` passati a \\`<it-input>\\` vengono applicati all'input generato. </p></div></div> `, }, }, }, } satisfies Meta<InputProps>"
661
+ },
662
+ {
663
+ "kind": "variable",
664
+ "name": "EsempioInterattivo",
665
+ "type": {
666
+ "text": "Story"
667
+ },
668
+ "default": "{ ...meta, name: 'Esempio interattivo', tags: ['!autodocs', '!dev'], parameters: { docs: { canvas: { sourceState: 'shown', }, }, }, render: (params) => html`${renderComponent({ ...params, type: 'text', label: 'Campo di testo', name: 'testo', id: 'exampleInputText', })} ${renderComponent({ ...params, type: 'email', label: 'Campo email', name: 'email', id: 'exampleInputEmail', })} ${renderComponent({ ...params, type: 'number', label: 'Campo numerico', name: 'number', id: 'exampleInputNumber', })} ${renderComponent({ ...params, type: 'tel', label: 'Campo telefonico', name: 'telefono', id: 'exampleInputTel', })} ${renderComponent({ ...params, type: 'time', label: 'Campo orario', name: 'orario', id: 'exampleInputTime', })}`, }"
669
+ },
670
+ {
671
+ "kind": "variable",
672
+ "name": "Placeholder",
673
+ "type": {
674
+ "text": "Story"
675
+ },
676
+ "default": "{ ...meta, name: 'Testo segnaposto', args: { type: 'text', placeholder: 'Testo segnaposto', label: 'Etichetta', name: 'placeholder-example', id: 'placeholder-example', }, parameters: { docs: { description: { story: ` È possibile abbinare al componente \\`<it-input>\\` un testo segnaposto (placeholder) per fornire indicazioni sul tipo di contenuto atteso. Questo testo non sostituisce l’etichetta, ma fornisce informazioni aggiuntive. `, }, }, }, render: (params) => html` ${renderComponent({ ...params, })} `, }"
677
+ },
678
+ {
679
+ "kind": "variable",
680
+ "name": "TestoDiSupporto",
681
+ "type": {
682
+ "text": "Story"
683
+ },
684
+ "default": "{ ...meta, name: 'Testo di supporto', args: { type: 'text', label: 'Etichetta', placeholder: 'Testo segnaposto', name: 'supportText-example', id: 'supportText-example', supportText: 'Testo di supporto', }, parameters: { docs: { description: { story: `In caso di necessità, è anche possibile utilizzare un ulteriore contenuto testuale sotto il campo di testo, indicando nell'attributo \\`support-text\\` il testo da visualizzare.`, }, }, }, render: (params) => html` ${renderComponent({ ...params, })} `, }"
685
+ },
686
+ {
687
+ "kind": "variable",
688
+ "name": "LabelHidden",
689
+ "type": {
690
+ "text": "Story"
691
+ },
692
+ "default": "{ ...meta, name: 'Etichetta nascosta', args: { placeholder: 'Cerca...', label: 'Cerca nel sito', labelHidden: true }, parameters: { docs: { description: { story: `Se si vuole nascondere l'etichetta, come ad esempio nei campi di ricerca, è sufficiente passare l'attributo \\`label-hidden\\`.`, }, }, }, render: (params) => html` ${renderComponent({ ...params, })} `, }"
693
+ },
694
+ {
695
+ "kind": "variable",
696
+ "name": "IconeOPulsanti",
697
+ "type": {
698
+ "text": "Story"
699
+ },
700
+ "default": "{ ...meta, name: 'Icone o pulsanti', args: { placeholder: 'Icone o pulsanti', type: 'text', label: 'Campo con icona', name: 'field-icon-example', id: 'field-icon-example', slotted: true, supportText: 'Testo di supporto', }, parameters: { docs: { description: { story: `<div class=\"callout callout-success\"><div class=\"callout-inner\"><div class=\"callout-title\"><span class=\"text\">Accessibilità delle icone</span></div><p>Nel caso in cui l’icona è semanticamente rilevante e non spiegata dal testo che la segue, occorre passare al componente \\`<it-icon>\\` l'attributo \\`label\\` che ne spieghi il significato (nel formato \\`<it-icon .... label=\"Significato dell'icona\"/>\\`)</p></div></div>`, }, }, }, render: (params) => html` ${renderComponent({ ...params, children: html`<it-icon name=\"it-pencil\" slot=\"icon\" size=\"sm\"></it-icon> <it-button variant=\"primary\" slot=\"append\">Invio</it-button>`, })} `, }"
701
+ },
702
+ {
703
+ "kind": "variable",
704
+ "name": "Dimensioni",
705
+ "type": {
706
+ "text": "Story"
707
+ },
708
+ "default": "{ ...meta, parameters: { docs: { description: { story: `L'input di base ha una dimensione media che non necessita di alcuna classe aggiuntiva. Per modificare questa dimensione, è possiible utilizzare l'attributo \\`size\\` il cui valore può essere \\`sm\\` oppure \\`lg\\`. Per modificare invece la dimensione dell’icona, è possibile utilizzare l'attributo \\`size\\` sull'icona in questo modo: <table> <thead> <tr><th>Dimensione input</th><th>Attributo size (di it-input)</th><th>Dimensione icona</th></tr> </thead> <tbody> <tr><td>Grande</td><td>\\`lg\\`</td><td>\\`md\\`</td></tr> <tr><td>Base (default)</td><td></td><td>\\`sm\\`</td></tr> <tr><td>Piccola</td><td>\\`sm\\`</td><td>\\`xs\\`</td></tr> </tbody> </table> `, }, }, }, args: { type: 'text', placeholder: 'Testo segnaposto', slotted: true, }, render: (params) => html` ${renderComponent({ ...params, label: 'Campo di dimensione grande', name: 'field-big-example', id: 'field-big-example', size: 'lg', children: html`<it-icon name=\"it-pencil\" slot=\"icon\" size=\"md\"></it-icon> <it-button variant=\"primary\" slot=\"append\">Invio</it-button>`, })} ${renderComponent({ ...params, label: 'Campo di dimensione base', name: 'field-sizebase-example', id: 'field-sizebase-example', placeholder: 'Testo segnaposto', children: html`<it-icon name=\"it-pencil\" slot=\"icon\" size=\"sm\"></it-icon> <it-button variant=\"primary\" slot=\"append\">Invio</it-button>`, })} ${renderComponent({ ...params, label: 'Campo di dimensione piccola', name: 'field-small-example', id: 'field-small-example', size: 'sm', children: html`<it-icon name=\"it-pencil\" slot=\"icon\" size=\"xs\"></it-icon> <it-button variant=\"primary\" slot=\"append\">Invio</it-button>`, })} `, }"
709
+ },
710
+ {
711
+ "kind": "variable",
712
+ "name": "Disabilitato",
713
+ "type": {
714
+ "text": "Story"
715
+ },
716
+ "default": "{ ...meta, parameters: { docs: { description: { story: `Aggiungi l’attributo \\`disabled\\` ad un \\`<it-input>\\` per impedire la modifica del valore contenuto e non inviare i dati in esso contenuti.`, }, }, }, args: { type: 'text', label: 'Campo disabilitato', name: 'field-disabled-example', id: 'field-disabled-example', disabled: true, }, render: (params) => html` ${renderComponent({ ...params, })} `, }"
717
+ },
718
+ {
719
+ "kind": "variable",
720
+ "name": "Readonly",
721
+ "type": {
722
+ "text": "Story"
723
+ },
724
+ "default": "{ ...meta, parameters: { docs: { description: { story: `Aggiungi l’attributo \\`readonly\\` ad un \\`<it-input>\\` per impedire la modifica del valore contenuto. <br/><br/><h4>Readonly normalizzato</h4>Se per qualche motivo vuoi avere gli elementi input readonly nella forma stilizzata come testo, aggiungi l'attributo \\`plaintext\\` a \\`<it-input>\\`.`, }, }, }, args: { type: 'text', readonly: true, value: 'Contenuto in sola lettura' }, render: (params) => html` ${renderComponent({ ...params, label: 'Campo readonly', name: 'field-readonly-example', id: 'field-readonly-example', })} ${renderComponent({ ...params, label: 'Campo readonly normalizzato come plaintext', name: 'field-readonlyplaintext-example', id: 'field-readonlyplaintext-example', plaintext: true, })} `, }"
725
+ },
726
+ {
727
+ "kind": "variable",
728
+ "name": "Password",
729
+ "type": {
730
+ "text": "Story"
731
+ },
732
+ "default": "{ ...meta, parameters: { docs: { description: { story: `Per semplificare l’inserimento della password, il componente \\`<it-input>\\` di tipo password include un pulsante che mostra i caratteri digitati. È inoltre possibile aggiungere un testo di supporto che aiuti nella compilazione, attraverso l’attributo \\`support-text\\`. <br/><br/> <h4>Misuratore sicurezza e suggerimenti</h4> Nel caso di un campo per la scelta di una nuova password, è possibile abbinare controlli per segnalare quanto la password che si sta inserendo segua alcuni suggerimenti di sicurezza, come la lunghezza minima o l’uso di caratteri speciali, attraverso gli attributi \\`strength-meter=\"true\"\\` e \\`minlength\\` per modificare la lunghezza minima richiesta per la password. Inoltre, è possibile restituire all’utente una lista dei suggerimenti, con indicati quelli che sono stati soddisfatti, attraverso l’attributo \\`suggestions=\"true\"\\`. `, }, }, }, args: { type: 'password', label: 'Campo password', supportText: 'Inserisci almeno 8 caratteri e alcuni caratteri speciali.', minlength: 8, }, render: (params) => html` ${renderComponent({ ...params, name: 'field-password-example', id: 'field-password-example', })} ${renderComponent({ ...params, name: 'field-password-strength-example', id: 'field-password-strength-example', passwordStrengthMeter: true, suggestions: true, })} `, }"
733
+ },
734
+ {
735
+ "kind": "variable",
736
+ "name": "Textarea",
737
+ "type": {
738
+ "text": "Story"
739
+ },
740
+ "default": "{ ...meta, name: 'Area di testo', parameters: { docs: { description: { story: `Per permettere agli utenti di inserire un testo esteso (ad esempio per lasciare commenti o informazioni), è bene utilizzare un elemento \\`<it-input>\\` con \\`type=\"textarea\"\\`.`, }, }, }, args: { type: 'textarea', label: 'Area di testo', name: 'textarea-example', id: 'textarea-example', placeholder: 'Testo segnaposto', }, render: (params) => html` ${renderComponent({ ...params, })} `, }"
741
+ },
742
+ {
743
+ "kind": "variable",
744
+ "name": "GestioneErrori",
745
+ "type": {
746
+ "text": "Story"
747
+ },
748
+ "default": "{ ...meta, name: 'Gestione degli errori', parameters: { docs: { description: { story: `Se sono stati impostati uno di questi attributi <ul><li>\\`required\\`</li><li>\\`pattern\\`</li><li>\\`minlength\\`</li></ul> viene effettuata una validazione interna al componente. <br/><br/><h4>Personalizzazione dei messaggi di errore</h4>E' possibile personalizzare i messaggi di errore tramite l'attributo \\`translations\\` a seconda che: <ul><li>il campo è required e non è compilato: impostando il valore di \\`validityRequired\\` in \\`translations\\`</li> <li>il campo non rispetta il pattern: impostando il valore di \\`validityPattern\\` in \\`translations\\`</li> <li>il campo è troppo corto: impostando il valore di \\`validityMinlength\\` in \\`translations\\`</li> <li>il campo ha un valore non valido: impostando il valore di \\`validityInvalid\\` in \\`translations\\`</li></ul> <h4>Validazione esterna</h4> E' inoltre possibile validare il campo esternamente (via js ad esempio, o lato server), impostando l' attributo \\`custom-validation=\"true\"\\`. In questo modo la validazione di defautl effettuata internamente al componente è disabilitata. <br/>Nel caso il campo non sia valido, è necessario invalidare il campo impostando il messaggio di errore da visualizzare attraverso l'attributo \\`validity-message=\"Messaggio di errore\"\\`.`, }, }, }, args: { type: 'text', placeholder: 'Testo segnaposto', translations: undefined }, render: (params) => html` ${renderComponent({ ...params, label: 'Campo obbligatorio', name: 'required-example', id: 'required-example', translations: { validityRequired: 'Questo campo è obbligatorio. Inserisci un valore.', }, required: true, })} ${renderComponent({ ...params, label: 'Validazione esterna', name: 'external-validation-example', id: 'external-validation-example', validityMessage: 'Questo campo è obbligatorio!', customValidation: true, required: undefined, })} `, }"
749
+ },
750
+ {
751
+ "kind": "variable",
752
+ "name": "GestioneEventi",
753
+ "type": {
754
+ "text": "Story"
755
+ },
756
+ "default": "{ ...meta, name: 'Gestione degli eventi', parameters: { docs: { description: { story: `E' possibile gestire gli eventi di \\`on-input\\`, \\`blur\\`, \\`change\\`, \\`focus\\`, \\`click\\` per effettuare operazioni personalizzate, come la validazione esterna o l'aggiornamento di altri campi. <br/><br/> E' sufficiente aggiungere un event listener al componente \\`<it-input>\\` per intercettare gli eventi desiderati. Ad esempio, per gestire l'evento di input, è possibile utilizzare il seguente codice: \\`\\`\\`js document.querySelector('it-input#event-input-example').addEventListener('on-input', (event) => { console.log('Input event:', event); alert('Input event); }); \\`\\`\\` Il componente, emette anche un evento di tipo \\`input-ready\\` quando l'input è pronto e caricato nel DOM: \\`\\`\\`js document.querySelector('it-input#event-input-example').addEventListener('input-ready', (event) => { console.log('Input ready:', event); }); \\`\\`\\` `, }, }, }, args: { type: 'text', label: 'Prova evento di input', name: 'event-input-example', id: 'event-input-example', placeholder: 'Testo segnaposto', translations: undefined, }, render: (params) => html` <script> document.querySelector('it-input#event-input-example').addEventListener('on-input', (event) => { console.log('Input event:', event); alert('Input event'); }); document.querySelector('it-input#event-input-example').addEventListener('input-ready', (event) => { console.log('Input ready:', event); }); </script> ${renderComponent({ ...params, })} `, }"
757
+ },
758
+ {
759
+ "kind": "variable",
760
+ "name": "I18n",
761
+ "type": {
762
+ "text": "Story"
763
+ },
764
+ "default": "{ name: 'i18n', tags: ['!dev'], render: () => html`<div class=\"hide-preview\"></div>`, parameters: { viewMode: 'docs', // assicura che si apra la tab Docs anziché Canvas docs: { description: { story: ` Per questo componente sono disponibili alcune stringhe traducibili tramite l'[utility di internazionalizzazione](/docs/i18n-internazionalizzazione--documentazione). \\`\\`\\`js const translation = { ${JSON.stringify(i18nIT).replaceAll('{\"', '\"').replaceAll('\",', '\",\\n\\t').replaceAll('\"}', '\"')} } \\`\\`\\` `, }, }, }, }"
765
+ }
766
+ ],
767
+ "exports": [
768
+ {
769
+ "kind": "js",
770
+ "name": "default",
771
+ "declaration": {
772
+ "name": "meta",
773
+ "module": "stories/it-input.stories.ts"
774
+ }
775
+ },
776
+ {
777
+ "kind": "js",
778
+ "name": "EsempioInterattivo",
779
+ "declaration": {
780
+ "name": "EsempioInterattivo",
781
+ "module": "stories/it-input.stories.ts"
782
+ }
783
+ },
784
+ {
785
+ "kind": "js",
786
+ "name": "Placeholder",
787
+ "declaration": {
788
+ "name": "Placeholder",
789
+ "module": "stories/it-input.stories.ts"
790
+ }
791
+ },
792
+ {
793
+ "kind": "js",
794
+ "name": "TestoDiSupporto",
795
+ "declaration": {
796
+ "name": "TestoDiSupporto",
797
+ "module": "stories/it-input.stories.ts"
798
+ }
799
+ },
800
+ {
801
+ "kind": "js",
802
+ "name": "LabelHidden",
803
+ "declaration": {
804
+ "name": "LabelHidden",
805
+ "module": "stories/it-input.stories.ts"
806
+ }
807
+ },
808
+ {
809
+ "kind": "js",
810
+ "name": "IconeOPulsanti",
811
+ "declaration": {
812
+ "name": "IconeOPulsanti",
813
+ "module": "stories/it-input.stories.ts"
814
+ }
815
+ },
816
+ {
817
+ "kind": "js",
818
+ "name": "Dimensioni",
819
+ "declaration": {
820
+ "name": "Dimensioni",
821
+ "module": "stories/it-input.stories.ts"
822
+ }
823
+ },
824
+ {
825
+ "kind": "js",
826
+ "name": "Disabilitato",
827
+ "declaration": {
828
+ "name": "Disabilitato",
829
+ "module": "stories/it-input.stories.ts"
830
+ }
831
+ },
832
+ {
833
+ "kind": "js",
834
+ "name": "Readonly",
835
+ "declaration": {
836
+ "name": "Readonly",
837
+ "module": "stories/it-input.stories.ts"
838
+ }
839
+ },
840
+ {
841
+ "kind": "js",
842
+ "name": "Password",
843
+ "declaration": {
844
+ "name": "Password",
845
+ "module": "stories/it-input.stories.ts"
846
+ }
847
+ },
848
+ {
849
+ "kind": "js",
850
+ "name": "Textarea",
851
+ "declaration": {
852
+ "name": "Textarea",
853
+ "module": "stories/it-input.stories.ts"
854
+ }
855
+ },
856
+ {
857
+ "kind": "js",
858
+ "name": "GestioneErrori",
859
+ "declaration": {
860
+ "name": "GestioneErrori",
861
+ "module": "stories/it-input.stories.ts"
862
+ }
863
+ },
864
+ {
865
+ "kind": "js",
866
+ "name": "GestioneEventi",
867
+ "declaration": {
868
+ "name": "GestioneEventi",
869
+ "module": "stories/it-input.stories.ts"
870
+ }
871
+ },
872
+ {
873
+ "kind": "js",
874
+ "name": "I18n",
875
+ "declaration": {
876
+ "name": "I18n",
877
+ "module": "stories/it-input.stories.ts"
878
+ }
879
+ }
880
+ ]
881
+ },
882
+ {
883
+ "kind": "javascript-module",
884
+ "path": "src/helpers/password.ts",
885
+ "declarations": [
886
+ {
887
+ "kind": "function",
888
+ "name": "calculateScore",
889
+ "parameters": [
890
+ {
891
+ "name": "password",
892
+ "type": {
893
+ "text": "string"
894
+ }
895
+ },
896
+ {
897
+ "name": "lmin",
898
+ "type": {
899
+ "text": "number"
900
+ }
901
+ },
902
+ {
903
+ "description": "password The password to be checked.",
904
+ "name": "string"
905
+ }
906
+ ],
907
+ "description": "Returns a value between -1 and 100 to score\nthe user's password.",
908
+ "return": {
909
+ "type": {
910
+ "text": ""
911
+ }
912
+ }
913
+ },
914
+ {
915
+ "kind": "function",
916
+ "name": "scoreColor",
917
+ "parameters": [
918
+ {
919
+ "name": "score",
920
+ "type": {
921
+ "text": "number"
922
+ }
923
+ }
924
+ ]
925
+ },
926
+ {
927
+ "kind": "function",
928
+ "name": "scoreText",
929
+ "parameters": [
930
+ {
931
+ "name": "score",
932
+ "type": {
933
+ "text": "number"
934
+ }
935
+ },
936
+ {
937
+ "name": "messages",
938
+ "type": {
939
+ "text": "any"
940
+ }
941
+ }
942
+ ]
943
+ },
944
+ {
945
+ "kind": "variable",
946
+ "name": "suggestionsConfig",
947
+ "type": {
948
+ "text": "Array<Suggestion>"
949
+ },
950
+ "default": "[ { key: 'length', text: (config) => config.suggestionLength.replace('{minLength}', config.minimumLength.toString()), test: (password, config) => password.length >= config.minimumLength, }, { key: 'uppercase', text: (config) => config.suggestionUppercase, test: (password) => /[A-Z]/.test(password), }, { key: 'lowercase', text: (config) => config.suggestionLowercase, test: (password) => /[a-z]/.test(password), }, { key: 'number', text: (config) => config.suggestionNumber, test: (password) => /[0-9]/.test(password), }, { key: 'special', text: (config) => config.suggestionSpecial, test: (password) => /[^A-Za-z0-9]/.test(password), }, ]"
951
+ },
952
+ {
953
+ "kind": "function",
954
+ "name": "calcCompletedSuggestions",
955
+ "parameters": [
956
+ {
957
+ "name": "_suggestions",
958
+ "type": {
959
+ "text": "Array<Suggestion>"
960
+ }
961
+ },
962
+ {
963
+ "name": "password",
964
+ "type": {
965
+ "text": "string"
966
+ }
967
+ },
968
+ {
969
+ "name": "config",
970
+ "type": {
971
+ "text": "Record<string, any>"
972
+ }
973
+ }
974
+ ]
975
+ }
976
+ ],
977
+ "exports": [
978
+ {
979
+ "kind": "js",
980
+ "name": "calculateScore",
981
+ "declaration": {
982
+ "name": "calculateScore",
983
+ "module": "src/helpers/password.ts"
984
+ }
985
+ },
986
+ {
987
+ "kind": "js",
988
+ "name": "scoreColor",
989
+ "declaration": {
990
+ "name": "scoreColor",
991
+ "module": "src/helpers/password.ts"
992
+ }
993
+ },
994
+ {
995
+ "kind": "js",
996
+ "name": "scoreText",
997
+ "declaration": {
998
+ "name": "scoreText",
999
+ "module": "src/helpers/password.ts"
1000
+ }
1001
+ },
1002
+ {
1003
+ "kind": "js",
1004
+ "name": "suggestionsConfig",
1005
+ "declaration": {
1006
+ "name": "suggestionsConfig",
1007
+ "module": "src/helpers/password.ts"
1008
+ }
1009
+ },
1010
+ {
1011
+ "kind": "js",
1012
+ "name": "calcCompletedSuggestions",
1013
+ "declaration": {
1014
+ "name": "calcCompletedSuggestions",
1015
+ "module": "src/helpers/password.ts"
1016
+ }
1017
+ }
1018
+ ]
1019
+ },
1020
+ {
1021
+ "kind": "javascript-module",
1022
+ "path": "src/locales/it.ts",
1023
+ "declarations": [
1024
+ {
1025
+ "kind": "variable",
1026
+ "name": "translation",
1027
+ "type": {
1028
+ "text": "DefaultTranslation"
1029
+ },
1030
+ "default": "{ $code: 'it', $name: 'Italiano', $dir: 'ltr', showHidePassword: 'Mostra/Nascondi Password.', shortPass: 'Password troppo breve.', badPass: 'Password debole.', goodPass: 'Password abbastanza sicura.', strongPass: 'Password sicura.', ariaLabelPasswordMeter: 'Robustezza della password', passwordSuggestionsLabel: 'Suggerimenti per una buona password:', passwordSuggestionLength: 'Almeno {minLength} caratteri.', passwordSuggestionUppercase: 'Una o più maiuscole.', passwordSuggestionLowercase: 'Una o più minuscole.', passwordSuggestionNumber: 'Uno o più numeri.', passwordSuggestionSpecial: 'Uno o più caratteri speciali.', passwordSuggestionFollowed: 'suggerimenti seguiti', passwordSuggestionFollowedPlural: 'suggerimenti seguiti', passwordSuggestionOf: 'di', passwordSuggestionMetLabel: 'Soddisfatto:', validityRequired: 'Questo campo è obbligatorio.', validityInvalid: 'Il valore non è corretto.', validityPattern: 'Il valore non corrisponde al formato richiesto.', validityMinlength: 'Il valore deve essere lungo almeno {minlength} caratteri.', validityMaxlength: 'Il valore deve essere lungo al massimo {maxlength} caratteri.', }"
1031
+ }
1032
+ ],
1033
+ "exports": [
1034
+ {
1035
+ "kind": "js",
1036
+ "name": "default",
1037
+ "declaration": {
1038
+ "name": "translation",
1039
+ "module": "src/locales/it.ts"
1040
+ }
1041
+ }
1042
+ ]
1043
+ }
1044
+ ]
1045
+ }