@italia/upload 1.0.0-alpha.10

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,1546 @@
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": "ItUpload",
13
+ "declaration": {
14
+ "name": "ItUpload",
15
+ "module": "./it-upload.js"
16
+ }
17
+ },
18
+ {
19
+ "kind": "js",
20
+ "name": "ItUploadAvatar",
21
+ "declaration": {
22
+ "name": "ItUploadAvatar",
23
+ "module": "./it-upload-avatar.js"
24
+ }
25
+ },
26
+ {
27
+ "kind": "js",
28
+ "name": "ItUploadDragDrop",
29
+ "declaration": {
30
+ "name": "ItUploadDragDrop",
31
+ "module": "./it-upload-drag-drop.js"
32
+ }
33
+ },
34
+ {
35
+ "kind": "js",
36
+ "name": "UploadFile",
37
+ "declaration": {
38
+ "name": "UploadFile",
39
+ "module": "./types.js"
40
+ }
41
+ },
42
+ {
43
+ "kind": "js",
44
+ "name": "UploadFileStatus",
45
+ "declaration": {
46
+ "name": "UploadFileStatus",
47
+ "module": "./types.js"
48
+ }
49
+ },
50
+ {
51
+ "kind": "js",
52
+ "name": "UploadVariant",
53
+ "declaration": {
54
+ "name": "UploadVariant",
55
+ "module": "./types.js"
56
+ }
57
+ }
58
+ ]
59
+ },
60
+ {
61
+ "kind": "javascript-module",
62
+ "path": "src/it-upload-avatar.ts",
63
+ "declarations": [
64
+ {
65
+ "kind": "class",
66
+ "description": "",
67
+ "name": "ItUploadAvatar",
68
+ "members": [
69
+ {
70
+ "kind": "field",
71
+ "name": "shadowRootOptions",
72
+ "type": {
73
+ "text": "object"
74
+ },
75
+ "static": true,
76
+ "default": "{ ...FormControl.shadowRootOptions, delegatesFocus: true, }"
77
+ },
78
+ {
79
+ "kind": "field",
80
+ "name": "formControlController",
81
+ "type": {
82
+ "text": "FormControlController"
83
+ },
84
+ "privacy": "protected",
85
+ "readonly": true,
86
+ "default": "new FormControlController(this, { value: (el) => (el as ItUploadAvatar)._currentFile ?? ((el as ItUploadAvatar)._currentSrc || null), assumeInteractionOn: ['it-change'], })"
87
+ },
88
+ {
89
+ "kind": "field",
90
+ "name": "inputElement",
91
+ "type": {
92
+ "text": "HTMLInputElement"
93
+ }
94
+ },
95
+ {
96
+ "kind": "field",
97
+ "name": "src",
98
+ "type": {
99
+ "text": "string"
100
+ },
101
+ "default": "''",
102
+ "description": "Current image source URL displayed in the avatar",
103
+ "attribute": "src",
104
+ "reflects": true
105
+ },
106
+ {
107
+ "kind": "field",
108
+ "name": "alt",
109
+ "type": {
110
+ "text": "string"
111
+ },
112
+ "default": "''",
113
+ "description": "Alt text for the current avatar image",
114
+ "attribute": "alt",
115
+ "reflects": true
116
+ },
117
+ {
118
+ "kind": "field",
119
+ "name": "size",
120
+ "type": {
121
+ "text": "'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'"
122
+ },
123
+ "default": "'xxl'",
124
+ "description": "Size of the avatar. Accepts any BSI avatar size token.",
125
+ "attribute": "size",
126
+ "reflects": true
127
+ },
128
+ {
129
+ "kind": "field",
130
+ "name": "accept",
131
+ "type": {
132
+ "text": "string"
133
+ },
134
+ "default": "'image/*'",
135
+ "description": "Accepted file types, e.g. \"image/*\"",
136
+ "attribute": "accept"
137
+ },
138
+ {
139
+ "kind": "field",
140
+ "name": "overlayLabel",
141
+ "type": {
142
+ "text": "string | undefined"
143
+ },
144
+ "description": "Text shown inside the desktop hover/focus overlay.\nDefaults to the i18n key `upload_avatar_overlay_label` (\"Aggiorna\" / \"Update\").",
145
+ "attribute": "overlay-label"
146
+ },
147
+ {
148
+ "kind": "field",
149
+ "name": "disabled",
150
+ "type": {
151
+ "text": "boolean"
152
+ },
153
+ "default": "false",
154
+ "description": "If true, the upload button is disabled",
155
+ "attribute": "disabled",
156
+ "reflects": true
157
+ },
158
+ {
159
+ "kind": "field",
160
+ "name": "_currentSrc",
161
+ "type": {
162
+ "text": "string"
163
+ },
164
+ "privacy": "private",
165
+ "default": "''"
166
+ },
167
+ {
168
+ "kind": "field",
169
+ "name": "_currentFile",
170
+ "type": {
171
+ "text": "File | null"
172
+ },
173
+ "privacy": "private",
174
+ "default": "null",
175
+ "description": "The currently selected File (null until a new file is chosen)."
176
+ },
177
+ {
178
+ "kind": "method",
179
+ "name": "_handleFileChange",
180
+ "privacy": "private",
181
+ "parameters": [
182
+ {
183
+ "name": "e",
184
+ "type": {
185
+ "text": "Event"
186
+ }
187
+ }
188
+ ]
189
+ }
190
+ ],
191
+ "events": [
192
+ {
193
+ "name": "it-change",
194
+ "type": {
195
+ "text": "CustomEvent"
196
+ }
197
+ }
198
+ ],
199
+ "attributes": [
200
+ {
201
+ "name": "src",
202
+ "type": {
203
+ "text": "string"
204
+ },
205
+ "default": "''",
206
+ "description": "Current image source URL displayed in the avatar",
207
+ "fieldName": "src"
208
+ },
209
+ {
210
+ "name": "alt",
211
+ "type": {
212
+ "text": "string"
213
+ },
214
+ "default": "''",
215
+ "description": "Alt text for the current avatar image",
216
+ "fieldName": "alt"
217
+ },
218
+ {
219
+ "name": "size",
220
+ "type": {
221
+ "text": "'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'"
222
+ },
223
+ "default": "'xxl'",
224
+ "description": "Size of the avatar. Accepts any BSI avatar size token.",
225
+ "fieldName": "size"
226
+ },
227
+ {
228
+ "name": "accept",
229
+ "type": {
230
+ "text": "string"
231
+ },
232
+ "default": "'image/*'",
233
+ "description": "Accepted file types, e.g. \"image/*\"",
234
+ "fieldName": "accept"
235
+ },
236
+ {
237
+ "name": "overlay-label",
238
+ "type": {
239
+ "text": "string | undefined"
240
+ },
241
+ "description": "Text shown inside the desktop hover/focus overlay.\nDefaults to the i18n key `upload_avatar_overlay_label` (\"Aggiorna\" / \"Update\").",
242
+ "fieldName": "overlayLabel"
243
+ },
244
+ {
245
+ "name": "disabled",
246
+ "type": {
247
+ "text": "boolean"
248
+ },
249
+ "default": "false",
250
+ "description": "If true, the upload button is disabled",
251
+ "fieldName": "disabled"
252
+ }
253
+ ],
254
+ "superclass": {
255
+ "name": "FormControl",
256
+ "package": "@italia/globals"
257
+ },
258
+ "tagName": "it-upload-avatar",
259
+ "customElement": true
260
+ }
261
+ ],
262
+ "exports": [
263
+ {
264
+ "kind": "js",
265
+ "name": "ItUploadAvatar",
266
+ "declaration": {
267
+ "name": "ItUploadAvatar",
268
+ "module": "src/it-upload-avatar.ts"
269
+ }
270
+ },
271
+ {
272
+ "kind": "custom-element-definition",
273
+ "name": "it-upload-avatar",
274
+ "declaration": {
275
+ "name": "ItUploadAvatar",
276
+ "module": "src/it-upload-avatar.ts"
277
+ }
278
+ }
279
+ ]
280
+ },
281
+ {
282
+ "kind": "javascript-module",
283
+ "path": "src/it-upload-drag-drop.ts",
284
+ "declarations": [
285
+ {
286
+ "kind": "class",
287
+ "description": "",
288
+ "name": "ItUploadDragDrop",
289
+ "members": [
290
+ {
291
+ "kind": "field",
292
+ "name": "formControlController",
293
+ "type": {
294
+ "text": "FormControlController"
295
+ },
296
+ "privacy": "protected",
297
+ "readonly": true,
298
+ "default": "new FormControlController(this, { value: (el) => (el as ItUploadDragDrop)._currentFile, assumeInteractionOn: ['it-change'], })"
299
+ },
300
+ {
301
+ "kind": "field",
302
+ "name": "inputElement",
303
+ "type": {
304
+ "text": "HTMLInputElement"
305
+ }
306
+ },
307
+ {
308
+ "kind": "field",
309
+ "name": "accept",
310
+ "type": {
311
+ "text": "string | undefined"
312
+ },
313
+ "description": "Accepted file types, e.g. \"image/*,.pdf\"",
314
+ "attribute": "accept"
315
+ },
316
+ {
317
+ "kind": "field",
318
+ "name": "illustration",
319
+ "type": {
320
+ "text": "string | undefined"
321
+ },
322
+ "description": "Custom illustration URL. If not set, the built-in illustration is used.",
323
+ "attribute": "illustration"
324
+ },
325
+ {
326
+ "kind": "field",
327
+ "name": "_currentFile",
328
+ "type": {
329
+ "text": "File | null"
330
+ },
331
+ "privacy": "private",
332
+ "default": "null",
333
+ "description": "The currently selected File (null until file is chosen/dropped)."
334
+ },
335
+ {
336
+ "kind": "field",
337
+ "name": "_state",
338
+ "type": {
339
+ "text": "DragDropState"
340
+ },
341
+ "privacy": "private",
342
+ "default": "'idle'"
343
+ },
344
+ {
345
+ "kind": "field",
346
+ "name": "_progress",
347
+ "type": {
348
+ "text": "number"
349
+ },
350
+ "privacy": "private",
351
+ "default": "0"
352
+ },
353
+ {
354
+ "kind": "field",
355
+ "name": "_fileName",
356
+ "type": {
357
+ "text": "string"
358
+ },
359
+ "privacy": "private",
360
+ "default": "''"
361
+ },
362
+ {
363
+ "kind": "field",
364
+ "name": "_fileWeight",
365
+ "type": {
366
+ "text": "string"
367
+ },
368
+ "privacy": "private",
369
+ "default": "''"
370
+ },
371
+ {
372
+ "kind": "field",
373
+ "name": "_fileType",
374
+ "type": {
375
+ "text": "string"
376
+ },
377
+ "privacy": "private",
378
+ "default": "''"
379
+ },
380
+ {
381
+ "kind": "field",
382
+ "name": "_indeterminate",
383
+ "type": {
384
+ "text": "boolean"
385
+ },
386
+ "privacy": "private",
387
+ "default": "false"
388
+ },
389
+ {
390
+ "kind": "field",
391
+ "name": "_autoStarted",
392
+ "type": {
393
+ "text": "boolean"
394
+ },
395
+ "privacy": "private",
396
+ "default": "false"
397
+ },
398
+ {
399
+ "kind": "field",
400
+ "name": "_formClass",
401
+ "type": {
402
+ "text": "string"
403
+ },
404
+ "privacy": "private",
405
+ "readonly": true
406
+ },
407
+ {
408
+ "kind": "method",
409
+ "name": "progress",
410
+ "privacy": "public",
411
+ "parameters": [
412
+ {
413
+ "name": "value",
414
+ "type": {
415
+ "text": "number"
416
+ }
417
+ }
418
+ ],
419
+ "description": "Advance the donut progress. Value must be between 0 and 1."
420
+ },
421
+ {
422
+ "kind": "method",
423
+ "name": "start",
424
+ "privacy": "public",
425
+ "description": "Transition to the loading state, starting the progress animation."
426
+ },
427
+ {
428
+ "kind": "method",
429
+ "name": "success",
430
+ "privacy": "public",
431
+ "description": "Mark upload as successful."
432
+ },
433
+ {
434
+ "kind": "method",
435
+ "name": "reset",
436
+ "privacy": "public",
437
+ "description": "Reset to idle state with progress at 0."
438
+ },
439
+ {
440
+ "kind": "method",
441
+ "name": "_extractFileType",
442
+ "privacy": "private",
443
+ "return": {
444
+ "type": {
445
+ "text": "string"
446
+ }
447
+ },
448
+ "parameters": [
449
+ {
450
+ "name": "fileName",
451
+ "type": {
452
+ "text": "string"
453
+ }
454
+ }
455
+ ]
456
+ },
457
+ {
458
+ "kind": "method",
459
+ "name": "_preventEvent",
460
+ "privacy": "private",
461
+ "parameters": [
462
+ {
463
+ "name": "e",
464
+ "type": {
465
+ "text": "DragEvent"
466
+ }
467
+ }
468
+ ]
469
+ },
470
+ {
471
+ "kind": "method",
472
+ "name": "_onDragEnter",
473
+ "privacy": "private",
474
+ "parameters": [
475
+ {
476
+ "name": "e",
477
+ "type": {
478
+ "text": "DragEvent"
479
+ }
480
+ }
481
+ ]
482
+ },
483
+ {
484
+ "kind": "method",
485
+ "name": "_onDragOver",
486
+ "privacy": "private",
487
+ "parameters": [
488
+ {
489
+ "name": "e",
490
+ "type": {
491
+ "text": "DragEvent"
492
+ }
493
+ }
494
+ ]
495
+ },
496
+ {
497
+ "kind": "method",
498
+ "name": "_onDragLeave",
499
+ "privacy": "private",
500
+ "parameters": [
501
+ {
502
+ "name": "e",
503
+ "type": {
504
+ "text": "DragEvent"
505
+ }
506
+ }
507
+ ]
508
+ },
509
+ {
510
+ "kind": "method",
511
+ "name": "_onDragEnd",
512
+ "privacy": "private",
513
+ "parameters": [
514
+ {
515
+ "name": "e",
516
+ "type": {
517
+ "text": "DragEvent"
518
+ }
519
+ }
520
+ ]
521
+ },
522
+ {
523
+ "kind": "method",
524
+ "name": "_onDrop",
525
+ "privacy": "private",
526
+ "parameters": [
527
+ {
528
+ "name": "e",
529
+ "type": {
530
+ "text": "DragEvent"
531
+ }
532
+ }
533
+ ]
534
+ },
535
+ {
536
+ "kind": "method",
537
+ "name": "_onFileInputChange",
538
+ "privacy": "private",
539
+ "parameters": [
540
+ {
541
+ "name": "e",
542
+ "type": {
543
+ "text": "Event"
544
+ }
545
+ }
546
+ ]
547
+ },
548
+ {
549
+ "kind": "method",
550
+ "name": "_getStatusText",
551
+ "privacy": "private",
552
+ "return": {
553
+ "type": {
554
+ "text": "string"
555
+ }
556
+ }
557
+ },
558
+ {
559
+ "kind": "method",
560
+ "name": "_renderTextContent",
561
+ "privacy": "private"
562
+ }
563
+ ],
564
+ "events": [
565
+ {
566
+ "name": "it-dd-start",
567
+ "type": {
568
+ "text": "CustomEvent"
569
+ }
570
+ },
571
+ {
572
+ "name": "it-dd-drop",
573
+ "type": {
574
+ "text": "CustomEvent"
575
+ }
576
+ },
577
+ {
578
+ "name": "it-change",
579
+ "type": {
580
+ "text": "CustomEvent"
581
+ }
582
+ }
583
+ ],
584
+ "attributes": [
585
+ {
586
+ "name": "accept",
587
+ "type": {
588
+ "text": "string | undefined"
589
+ },
590
+ "description": "Accepted file types, e.g. \"image/*,.pdf\"",
591
+ "fieldName": "accept"
592
+ },
593
+ {
594
+ "name": "illustration",
595
+ "type": {
596
+ "text": "string | undefined"
597
+ },
598
+ "description": "Custom illustration URL. If not set, the built-in illustration is used.",
599
+ "fieldName": "illustration"
600
+ }
601
+ ],
602
+ "superclass": {
603
+ "name": "FormControl",
604
+ "package": "@italia/globals"
605
+ },
606
+ "tagName": "it-upload-drag-drop",
607
+ "customElement": true
608
+ }
609
+ ],
610
+ "exports": [
611
+ {
612
+ "kind": "js",
613
+ "name": "ItUploadDragDrop",
614
+ "declaration": {
615
+ "name": "ItUploadDragDrop",
616
+ "module": "src/it-upload-drag-drop.ts"
617
+ }
618
+ },
619
+ {
620
+ "kind": "custom-element-definition",
621
+ "name": "it-upload-drag-drop",
622
+ "declaration": {
623
+ "name": "ItUploadDragDrop",
624
+ "module": "src/it-upload-drag-drop.ts"
625
+ }
626
+ }
627
+ ]
628
+ },
629
+ {
630
+ "kind": "javascript-module",
631
+ "path": "src/it-upload.ts",
632
+ "declarations": [
633
+ {
634
+ "kind": "class",
635
+ "description": "",
636
+ "name": "ItUpload",
637
+ "members": [
638
+ {
639
+ "kind": "field",
640
+ "name": "formControlController",
641
+ "type": {
642
+ "text": "FormControlController"
643
+ },
644
+ "privacy": "protected",
645
+ "readonly": true,
646
+ "default": "new FormControlController(this, { value: (el) => (el as ItUpload)._files.map((f) => f._raw), assumeInteractionOn: ['it-change'], })"
647
+ },
648
+ {
649
+ "kind": "field",
650
+ "name": "inputElement",
651
+ "type": {
652
+ "text": "HTMLInputElement"
653
+ }
654
+ },
655
+ {
656
+ "kind": "field",
657
+ "name": "labelElements",
658
+ "type": {
659
+ "text": "HTMLElement[]"
660
+ }
661
+ },
662
+ {
663
+ "kind": "field",
664
+ "name": "label",
665
+ "type": {
666
+ "text": "string"
667
+ },
668
+ "readonly": true
669
+ },
670
+ {
671
+ "kind": "field",
672
+ "name": "multiple",
673
+ "type": {
674
+ "text": "boolean"
675
+ },
676
+ "default": "false",
677
+ "description": "Allow multiple file selection",
678
+ "attribute": "multiple",
679
+ "reflects": true
680
+ },
681
+ {
682
+ "kind": "field",
683
+ "name": "accept",
684
+ "type": {
685
+ "text": "string | undefined"
686
+ },
687
+ "description": "Accepted file types, e.g. \"image/*,.pdf\"",
688
+ "attribute": "accept"
689
+ },
690
+ {
691
+ "kind": "field",
692
+ "name": "imagePreview",
693
+ "type": {
694
+ "text": "boolean"
695
+ },
696
+ "default": "false",
697
+ "description": "Show image thumbnails in the file list",
698
+ "attribute": "image-preview"
699
+ },
700
+ {
701
+ "kind": "field",
702
+ "name": "variant",
703
+ "type": {
704
+ "text": "UploadVariant"
705
+ },
706
+ "default": "'default'",
707
+ "description": "Layout variant: 'default' shows a vertical file list, 'gallery' shows a pictures-wall grid",
708
+ "attribute": "variant",
709
+ "reflects": true
710
+ },
711
+ {
712
+ "kind": "field",
713
+ "name": "supportText",
714
+ "type": {
715
+ "text": "string"
716
+ },
717
+ "default": "''",
718
+ "description": "Support text displayed below the upload button",
719
+ "attribute": "support-text"
720
+ },
721
+ {
722
+ "kind": "field",
723
+ "name": "autoSuccess",
724
+ "type": {
725
+ "text": "boolean"
726
+ },
727
+ "default": "false",
728
+ "description": "If true, files transition to 'success' automatically as soon as they are added\n(useful for purely client-side scenarios).\nLeave false (default) when you need to call setFileStatus() after a real HTTP upload.",
729
+ "attribute": "auto-success"
730
+ },
731
+ {
732
+ "kind": "field",
733
+ "name": "_files",
734
+ "type": {
735
+ "text": "UploadInternalFile[]"
736
+ },
737
+ "privacy": "private",
738
+ "default": "[]"
739
+ },
740
+ {
741
+ "kind": "field",
742
+ "name": "files",
743
+ "type": {
744
+ "text": "UploadFile[]"
745
+ },
746
+ "description": "Returns a copy of the current file list",
747
+ "readonly": true
748
+ },
749
+ {
750
+ "kind": "method",
751
+ "name": "addFile",
752
+ "return": {
753
+ "type": {
754
+ "text": "string"
755
+ }
756
+ },
757
+ "parameters": [
758
+ {
759
+ "name": "file",
760
+ "type": {
761
+ "text": "File"
762
+ }
763
+ }
764
+ ],
765
+ "description": "Programmatically add a file to the list with an initial status of 'loading'.\nReturns the generated id for use with setFileStatus / removeFile."
766
+ },
767
+ {
768
+ "kind": "method",
769
+ "name": "setFileStatus",
770
+ "parameters": [
771
+ {
772
+ "name": "id",
773
+ "type": {
774
+ "text": "string"
775
+ }
776
+ },
777
+ {
778
+ "name": "status",
779
+ "type": {
780
+ "text": "UploadFileStatus"
781
+ }
782
+ },
783
+ {
784
+ "name": "progress",
785
+ "optional": true,
786
+ "type": {
787
+ "text": "number"
788
+ }
789
+ }
790
+ ],
791
+ "description": "Update the status (and optional progress 0–100) of a file by id. No-op for unknown ids."
792
+ },
793
+ {
794
+ "kind": "method",
795
+ "name": "setFileThumbnail",
796
+ "parameters": [
797
+ {
798
+ "name": "id",
799
+ "type": {
800
+ "text": "string"
801
+ }
802
+ },
803
+ {
804
+ "name": "dataUrl",
805
+ "type": {
806
+ "text": "string"
807
+ }
808
+ }
809
+ ],
810
+ "description": "Set a thumbnail data URL for a file entry by id. No-op for unknown ids."
811
+ },
812
+ {
813
+ "kind": "method",
814
+ "name": "removeFile",
815
+ "parameters": [
816
+ {
817
+ "name": "id",
818
+ "type": {
819
+ "text": "string"
820
+ }
821
+ }
822
+ ],
823
+ "description": "Remove a file entry by id. No-op for unknown ids."
824
+ },
825
+ {
826
+ "kind": "method",
827
+ "name": "checkValidity",
828
+ "return": {
829
+ "type": {
830
+ "text": "boolean"
831
+ }
832
+ }
833
+ },
834
+ {
835
+ "kind": "method",
836
+ "name": "handleValidationMessages",
837
+ "privacy": "protected",
838
+ "description": "Override to prevent string-level validation messages from FormControl base"
839
+ },
840
+ {
841
+ "kind": "method",
842
+ "name": "_validateFiles",
843
+ "privacy": "private"
844
+ },
845
+ {
846
+ "kind": "field",
847
+ "name": "validity",
848
+ "type": {
849
+ "text": "ValidityState"
850
+ },
851
+ "readonly": true
852
+ },
853
+ {
854
+ "kind": "method",
855
+ "name": "_handleFileChange",
856
+ "privacy": "private",
857
+ "parameters": [
858
+ {
859
+ "name": "e",
860
+ "type": {
861
+ "text": "Event"
862
+ }
863
+ }
864
+ ]
865
+ },
866
+ {
867
+ "kind": "method",
868
+ "name": "_handleRemove",
869
+ "privacy": "private",
870
+ "parameters": [
871
+ {
872
+ "name": "id",
873
+ "type": {
874
+ "text": "string"
875
+ }
876
+ },
877
+ {
878
+ "name": "name",
879
+ "type": {
880
+ "text": "string"
881
+ }
882
+ }
883
+ ]
884
+ },
885
+ {
886
+ "kind": "method",
887
+ "name": "_getStatusLabel",
888
+ "privacy": "private",
889
+ "return": {
890
+ "type": {
891
+ "text": "string"
892
+ }
893
+ },
894
+ "parameters": [
895
+ {
896
+ "name": "status",
897
+ "type": {
898
+ "text": "UploadFileStatus"
899
+ }
900
+ }
901
+ ]
902
+ },
903
+ {
904
+ "kind": "method",
905
+ "name": "_getRemoveLabel",
906
+ "privacy": "private",
907
+ "return": {
908
+ "type": {
909
+ "text": "string"
910
+ }
911
+ },
912
+ "parameters": [
913
+ {
914
+ "name": "f",
915
+ "type": {
916
+ "text": "UploadInternalFile"
917
+ }
918
+ }
919
+ ]
920
+ },
921
+ {
922
+ "kind": "method",
923
+ "name": "_iconForStatus",
924
+ "privacy": "private",
925
+ "parameters": [
926
+ {
927
+ "name": "status",
928
+ "type": {
929
+ "text": "UploadFileStatus"
930
+ }
931
+ }
932
+ ]
933
+ },
934
+ {
935
+ "kind": "method",
936
+ "name": "_colorForStatus",
937
+ "privacy": "private",
938
+ "return": {
939
+ "type": {
940
+ "text": "string"
941
+ }
942
+ },
943
+ "parameters": [
944
+ {
945
+ "name": "status",
946
+ "type": {
947
+ "text": "UploadFileStatus"
948
+ }
949
+ }
950
+ ]
951
+ },
952
+ {
953
+ "kind": "method",
954
+ "name": "_actionIconForStatus",
955
+ "privacy": "private",
956
+ "return": {
957
+ "type": {
958
+ "text": "string"
959
+ }
960
+ },
961
+ "parameters": [
962
+ {
963
+ "name": "status",
964
+ "type": {
965
+ "text": "UploadFileStatus"
966
+ }
967
+ }
968
+ ]
969
+ },
970
+ {
971
+ "kind": "method",
972
+ "name": "_renderFileItem",
973
+ "privacy": "private",
974
+ "parameters": [
975
+ {
976
+ "name": "f",
977
+ "type": {
978
+ "text": "UploadInternalFile"
979
+ }
980
+ }
981
+ ]
982
+ },
983
+ {
984
+ "kind": "method",
985
+ "name": "_renderGalleryItem",
986
+ "privacy": "private",
987
+ "parameters": [
988
+ {
989
+ "name": "f",
990
+ "type": {
991
+ "text": "UploadInternalFile"
992
+ }
993
+ }
994
+ ]
995
+ },
996
+ {
997
+ "kind": "method",
998
+ "name": "_renderFileList",
999
+ "privacy": "private"
1000
+ },
1001
+ {
1002
+ "kind": "method",
1003
+ "name": "_renderUploadInput",
1004
+ "privacy": "private"
1005
+ }
1006
+ ],
1007
+ "events": [
1008
+ {
1009
+ "name": "it-upload-add",
1010
+ "type": {
1011
+ "text": "CustomEvent"
1012
+ }
1013
+ },
1014
+ {
1015
+ "name": "it-change",
1016
+ "type": {
1017
+ "text": "CustomEvent"
1018
+ }
1019
+ },
1020
+ {
1021
+ "name": "it-upload-remove",
1022
+ "type": {
1023
+ "text": "CustomEvent"
1024
+ }
1025
+ }
1026
+ ],
1027
+ "attributes": [
1028
+ {
1029
+ "name": "multiple",
1030
+ "type": {
1031
+ "text": "boolean"
1032
+ },
1033
+ "default": "false",
1034
+ "description": "Allow multiple file selection",
1035
+ "fieldName": "multiple"
1036
+ },
1037
+ {
1038
+ "name": "accept",
1039
+ "type": {
1040
+ "text": "string | undefined"
1041
+ },
1042
+ "description": "Accepted file types, e.g. \"image/*,.pdf\"",
1043
+ "fieldName": "accept"
1044
+ },
1045
+ {
1046
+ "name": "image-preview",
1047
+ "type": {
1048
+ "text": "boolean"
1049
+ },
1050
+ "default": "false",
1051
+ "description": "Show image thumbnails in the file list",
1052
+ "fieldName": "imagePreview"
1053
+ },
1054
+ {
1055
+ "name": "variant",
1056
+ "type": {
1057
+ "text": "UploadVariant"
1058
+ },
1059
+ "default": "'default'",
1060
+ "description": "Layout variant: 'default' shows a vertical file list, 'gallery' shows a pictures-wall grid",
1061
+ "fieldName": "variant"
1062
+ },
1063
+ {
1064
+ "name": "support-text",
1065
+ "type": {
1066
+ "text": "string"
1067
+ },
1068
+ "default": "''",
1069
+ "description": "Support text displayed below the upload button",
1070
+ "fieldName": "supportText"
1071
+ },
1072
+ {
1073
+ "name": "auto-success",
1074
+ "type": {
1075
+ "text": "boolean"
1076
+ },
1077
+ "default": "false",
1078
+ "description": "If true, files transition to 'success' automatically as soon as they are added\n(useful for purely client-side scenarios).\nLeave false (default) when you need to call setFileStatus() after a real HTTP upload.",
1079
+ "fieldName": "autoSuccess"
1080
+ }
1081
+ ],
1082
+ "superclass": {
1083
+ "name": "FormControl",
1084
+ "package": "@italia/globals"
1085
+ },
1086
+ "tagName": "it-upload",
1087
+ "customElement": true
1088
+ },
1089
+ {
1090
+ "kind": "variable",
1091
+ "name": "id",
1092
+ "default": "`upload-file-${Math.random().toString(36).slice(2)}`"
1093
+ }
1094
+ ],
1095
+ "exports": [
1096
+ {
1097
+ "kind": "js",
1098
+ "name": "ItUpload",
1099
+ "declaration": {
1100
+ "name": "ItUpload",
1101
+ "module": "src/it-upload.ts"
1102
+ }
1103
+ },
1104
+ {
1105
+ "kind": "custom-element-definition",
1106
+ "name": "it-upload",
1107
+ "declaration": {
1108
+ "name": "ItUpload",
1109
+ "module": "src/it-upload.ts"
1110
+ }
1111
+ }
1112
+ ]
1113
+ },
1114
+ {
1115
+ "kind": "javascript-module",
1116
+ "path": "src/types.ts",
1117
+ "declarations": [],
1118
+ "exports": []
1119
+ },
1120
+ {
1121
+ "kind": "javascript-module",
1122
+ "path": "src/utils.ts",
1123
+ "declarations": [
1124
+ {
1125
+ "kind": "function",
1126
+ "name": "formatSize",
1127
+ "return": {
1128
+ "type": {
1129
+ "text": "string"
1130
+ }
1131
+ },
1132
+ "parameters": [
1133
+ {
1134
+ "name": "bytes",
1135
+ "type": {
1136
+ "text": "number"
1137
+ }
1138
+ }
1139
+ ],
1140
+ "description": "Format a byte count into a human-readable string (B, KB, MB, GB).\nShared by it-upload and it-upload-drag-drop."
1141
+ }
1142
+ ],
1143
+ "exports": [
1144
+ {
1145
+ "kind": "js",
1146
+ "name": "formatSize",
1147
+ "declaration": {
1148
+ "name": "formatSize",
1149
+ "module": "src/utils.ts"
1150
+ }
1151
+ }
1152
+ ]
1153
+ },
1154
+ {
1155
+ "kind": "javascript-module",
1156
+ "path": "stories/it-upload.stories.ts",
1157
+ "declarations": [
1158
+ {
1159
+ "kind": "class",
1160
+ "description": "Populates an inner <it-upload> with files in loading, success and error states.",
1161
+ "name": "StoryUploadFileStates",
1162
+ "superclass": {
1163
+ "name": "HTMLElement"
1164
+ },
1165
+ "tagName": "story-upload-file-states",
1166
+ "customElement": true
1167
+ },
1168
+ {
1169
+ "kind": "class",
1170
+ "description": "Sets a drag-drop to loading state at a given progress value (0-1).",
1171
+ "name": "StoryUploadDDLoading",
1172
+ "superclass": {
1173
+ "name": "HTMLElement"
1174
+ },
1175
+ "tagName": "story-upload-dd-loading",
1176
+ "customElement": true
1177
+ },
1178
+ {
1179
+ "kind": "class",
1180
+ "description": "Sets a drag-drop to success state.",
1181
+ "name": "StoryUploadDDSuccess",
1182
+ "superclass": {
1183
+ "name": "HTMLElement"
1184
+ },
1185
+ "tagName": "story-upload-dd-success",
1186
+ "customElement": true
1187
+ },
1188
+ {
1189
+ "kind": "class",
1190
+ "description": "Adds a \"Simula Upload\" button above the drag-drop component.\nClicking it (or dropping/selecting a file) triggers auto-progress simulation\nat +10% every 300 ms — mirroring the Angular reference demo.",
1191
+ "name": "StoryUploadDDInteractive",
1192
+ "members": [
1193
+ {
1194
+ "kind": "field",
1195
+ "name": "_timer",
1196
+ "type": {
1197
+ "text": "ReturnType<typeof setInterval> | undefined"
1198
+ },
1199
+ "privacy": "private"
1200
+ },
1201
+ {
1202
+ "kind": "method",
1203
+ "name": "_simulate",
1204
+ "privacy": "private"
1205
+ }
1206
+ ],
1207
+ "superclass": {
1208
+ "name": "HTMLElement"
1209
+ },
1210
+ "tagName": "story-upload-dd-interactive",
1211
+ "customElement": true
1212
+ },
1213
+ {
1214
+ "kind": "class",
1215
+ "description": "Populates an inner <it-upload> (gallery variant) with 2 pre-loaded images.",
1216
+ "name": "StoryUploadGalleryPrefilled",
1217
+ "superclass": {
1218
+ "name": "HTMLElement"
1219
+ },
1220
+ "tagName": "story-upload-gallery-prefilled",
1221
+ "customElement": true
1222
+ },
1223
+ {
1224
+ "kind": "variable",
1225
+ "name": "meta",
1226
+ "default": "{ title: 'Componenti/Form/Upload', tags: ['a11y-ok', 'web-component'], component: 'it-upload', parameters: { docs: { description: { component: ` Elementi dei form dedicati al caricamento file. Il componente Upload consente l'upload di file attraverso diverse modalità: lista verticale, anteprima immagini, gallery, avatar, o drag & drop. [Approfondisci come e quando usare il componente Upload](https://designers.italia.it/design-system/componenti/upload/) `, }, }, }, } satisfies Meta"
1227
+ },
1228
+ {
1229
+ "kind": "variable",
1230
+ "name": "EsempioInterattivoUpload",
1231
+ "type": {
1232
+ "text": "Story"
1233
+ },
1234
+ "default": "{ name: 'Esempio interattivo', tags: ['!autodocs', '!dev'], args: { variant: 'default', multiple: false, 'image-preview': false, accept: '', 'support-text': '', disabled: false, required: false, 'auto-success': true, }, argTypes: { variant: { description: 'Layout del componente.', control: { type: 'select' }, options: ['default', 'gallery'], table: { defaultValue: { summary: 'default' } }, }, multiple: { description: 'Consente la selezione multipla di file.', control: 'boolean', table: { defaultValue: { summary: 'false' } }, }, 'image-preview': { description: \"Mostra un'anteprima thumbnail per le immagini caricate.\", control: 'boolean', table: { defaultValue: { summary: 'false' } }, }, accept: { description: 'Tipi di file accettati, es. \"image/*,.pdf\".', control: 'text', }, 'support-text': { description: 'Testo di supporto visualizzato sotto il pulsante.', control: 'text', }, disabled: { description: 'Disabilita il componente.', control: 'boolean', table: { defaultValue: { summary: 'false' } }, }, required: { description: 'Rende il campo obbligatorio nella validazione del form.', control: 'boolean', table: { defaultValue: { summary: 'false' } }, }, 'auto-success': { description: 'I file passano automaticamente allo stato success appena selezionati.', control: 'boolean', table: { defaultValue: { summary: 'false' } }, }, }, parameters: { docs: { canvas: { sourceState: 'closed' }, }, }, render: (params) => renderUpload(params as Partial<UploadProps>), }"
1235
+ },
1236
+ {
1237
+ "kind": "variable",
1238
+ "name": "EsempioInterattivoAvatar",
1239
+ "type": {
1240
+ "text": "Story"
1241
+ },
1242
+ "default": "{ name: 'Esempio interattivo Avatar', tags: ['!autodocs', '!dev'], args: { src: 'https://randomuser.me/api/portraits/men/21.jpg', alt: 'Mario Rossi', size: 'xxl' as AvatarSize, disabled: false, required: false, }, argTypes: { src: { description: \"URL dell'immagine avatar corrente.\", control: 'text', }, alt: { description: \"Testo alternativo per l'immagine.\", control: 'text', }, size: { description: 'Dimensione del componente.', control: { type: 'select' }, options: ['xl', 'xxl'], table: { defaultValue: { summary: 'xxl' } }, }, disabled: { description: 'Disabilita il componente.', control: 'boolean', table: { defaultValue: { summary: 'false' } }, }, required: { description: 'Rende il campo obbligatorio nella validazione del form. Se src è già valorizzato, il requisito è soddisfatto.', control: 'boolean', table: { defaultValue: { summary: 'false' } }, }, }, parameters: { docs: { canvas: { sourceState: 'closed' }, }, }, render: (params) => renderUploadAvatar(params as Partial<UploadAvatarProps>), }"
1243
+ },
1244
+ {
1245
+ "kind": "variable",
1246
+ "name": "EsempioInterattivoDragDrop",
1247
+ "type": {
1248
+ "text": "Story"
1249
+ },
1250
+ "default": "{ name: 'Esempio interattivo Drag & Drop', tags: ['!autodocs', '!dev'], args: { accept: '', illustration: '', disabled: false, required: false, }, argTypes: { accept: { description: 'Tipi di file accettati, es. \"image/*,.pdf\".', control: 'text', }, illustration: { description: 'URL illustrazione personalizzata. Se omesso viene usata quella predefinita.', control: 'text', }, disabled: { description: 'Disabilita il componente.', control: 'boolean', table: { defaultValue: { summary: 'false' } }, }, required: { description: 'Rende il campo obbligatorio nella validazione del form.', control: 'boolean', table: { defaultValue: { summary: 'false' } }, }, }, parameters: { docs: { canvas: { sourceState: 'closed' }, }, }, render: (params) => renderUploadDragDrop(params as Partial<UploadDragDropProps>), }"
1251
+ },
1252
+ {
1253
+ "kind": "variable",
1254
+ "name": "UploadConListaDiFile",
1255
+ "type": {
1256
+ "text": "Story"
1257
+ },
1258
+ "default": "{ name: 'Upload con lista di file', parameters: { docs: { description: { story: 'Upload base che mostra i file caricati in una lista verticale con icone sostituite da thumbnail (image-preview).', }, source: { language: 'html', code: ` <it-upload name=\"upload-list\" multiple accept=\"image/*\" image-preview auto-success> <span slot=\"label\">Carica file</span> </it-upload> <script> const uploadList = document.querySelector('it-upload[name=\"upload-list\"]'); // Ascolta le modifiche alla lista dei file uploadList.addEventListener('it-change', (event) => { console.log('File aggiornati:', event.detail.files); }); </script> `, }, }, }, render: () => html` ${renderUpload({ name: 'upload-list', multiple: true, accept: 'image/*', 'image-preview': true, 'auto-success': true, })} `, }",
1259
+ "description": "Upload con lista di file — visualizza i file caricati in una lista verticale\ncon possibilità di rimozione singola. Supporta i seguenti stati: loading, success, error."
1260
+ },
1261
+ {
1262
+ "kind": "variable",
1263
+ "name": "UploadConStatoFile",
1264
+ "type": {
1265
+ "text": "Story"
1266
+ },
1267
+ "default": "{ name: 'Upload con lista di file - stati', parameters: { docs: { description: { story: \"Esempio con file pre-caricati in tutti gli stati supportati: `success` (caricato), `loading` al 43% di avanzamento, `error` (fallito), e `loading` a 0% (avvio). I file in stato `success` mostrano un'icona di conferma e un pulsante X separato: l'utente può rimuoverli anche dopo il caricamento, senza dover ricaricare il form.\", }, source: { language: 'html', code: ` <it-upload id=\"upload-states\" multiple image-preview name=\"upload-states\"> <span slot=\"label\">Carica file</span> </it-upload> <script> const upload = document.getElementById('upload-states'); // 1. Aggiungi i file (genera gli ID interni) const id1 = upload.addFile(new File([''], 'nome-file-01.jpg', { type: 'image/jpeg' })); const id2 = upload.addFile(new File([''], 'nome-file-02-nome-file-lungo-per-ellissi.jpg', { type: 'image/jpeg' })); const id3 = upload.addFile(new File([''], 'nome-file-03.jpg', { type: 'image/jpeg' })); const id4 = upload.addFile(new File([''], 'nome-file-04.jpg', { type: 'image/jpeg' })); // 2. Imposta lo stato e il progresso upload.setFileStatus(id1, 'success'); upload.setFileStatus(id2, 'success'); upload.setFileStatus(id3, 'loading', 43); // 43% upload.setFileStatus(id4, 'error'); // 3. Imposta le thumbnail upload.setFileThumbnail(id1, 'https://picsum.photos/seed/upload1/128/128'); upload.setFileThumbnail(id2, 'https://picsum.photos/seed/upload2/128/128'); upload.setFileThumbnail(id3, 'https://picsum.photos/seed/upload3/128/128'); upload.setFileThumbnail(id4, 'https://picsum.photos/seed/upload4/128/128'); </script> `, }, }, }, render: () => html` <story-upload-file-states> ${renderUpload({ name: 'upload-states', multiple: true, 'image-preview': true, })} </story-upload-file-states> `, }",
1268
+ "description": "Mostra la lista file con esempi di tutti gli stati: loading (con progresso), success ed error."
1269
+ },
1270
+ {
1271
+ "kind": "variable",
1272
+ "name": "UploadGallery",
1273
+ "type": {
1274
+ "text": "Story"
1275
+ },
1276
+ "default": "{ parameters: { docs: { description: { story: 'Con `variant=\"gallery\"` le foto caricate vengono visualizzate in una griglia a \"pictures wall\", ideale per gestire upload multipli di immagini.', }, source: { language: 'html', code: ` <it-upload id=\"upload-gallery\" variant=\"gallery\" multiple accept=\"image/*\" name=\"upload-gallery\"> <span slot=\"label\">Carica immagini</span> </it-upload> <script> const gallery = document.getElementById('upload-gallery'); // Aggiungi programmaticamente le immagini alla galleria const id1 = gallery.addFile(new File([''], 'foto-01.jpg', { type: 'image/jpeg' })); const id2 = gallery.addFile(new File([''], 'foto-02.jpg', { type: 'image/jpeg' })); // Imposta le thumbnail e segnale come completate gallery.setFileThumbnail(id1, 'https://picsum.photos/seed/upload1/128/128'); gallery.setFileThumbnail(id2, 'https://picsum.photos/seed/upload2/128/128'); gallery.setFileStatus(id1, 'success'); gallery.setFileStatus(id2, 'success'); </script> `, }, }, }, render: () => html` <div style=\"display: flex; flex-direction: column; gap: 3rem;\"> <div> ${renderUpload({ name: 'upload-gallery', variant: 'gallery', multiple: true, accept: 'image/*', })} </div> <div> <h5>Esempio immagini caricate</h5> <story-upload-gallery-prefilled> ${renderUpload({ name: 'upload-gallery-filled', variant: 'gallery', multiple: true, accept: 'image/*', })} </story-upload-gallery-prefilled> </div> </div> `, }",
1277
+ "description": "Upload Gallery — visualizza le foto in una griglia a \"pictures wall\""
1278
+ },
1279
+ {
1280
+ "kind": "variable",
1281
+ "name": "UploadConAvatar",
1282
+ "type": {
1283
+ "text": "Story"
1284
+ },
1285
+ "default": "{ name: 'Upload con Avatar', parameters: { docs: { description: { story: 'Questo elemento combina la visualizzazione di un Avatar con un input file per permettere il caricamento di una foto profilo. Disponibile in due dimensioni: standard e piccola (sm).', }, source: { language: 'html', code: ` <div style=\"display: flex; gap: 3rem; flex-wrap: wrap; align-items: flex-start;\"> <div> <h5 style=\"margin-top: 0;\">Dimensione Standard</h5> <it-upload-avatar src=\"https://randomuser.me/api/portraits/men/21.jpg\" alt=\"Mario Rossi\" size=\"xxl\" name=\"avatar-standard\" ></it-upload-avatar> </div> <div> <h5 style=\"margin-top: 0;\">Dimensione Piccola</h5> <it-upload-avatar src=\"https://randomuser.me/api/portraits/women/21.jpg\" alt=\"Laura Bianchi\" size=\"xl\" name=\"avatar-sm\" ></it-upload-avatar> </div> </div> <script> const avatarStandard = document.querySelector('it-upload-avatar[name=\"avatar-standard\"]'); // Recupera il file selezionato dall'utente per effettuare l'upload avatarStandard.addEventListener('it-change', (event) => { const newAvatarFile = event.detail.files[0]; console.log('Nuovo avatar selezionato:', newAvatarFile); }); </script> `, }, }, }, render: () => html` <div style=\"display: flex; gap: 3rem; flex-wrap: wrap; align-items: flex-start;\"> <div> <h5 style=\"margin-top: 0;\">Dimensione Standard</h5> ${renderUploadAvatar({ src: 'https://randomuser.me/api/portraits/men/21.jpg', alt: 'Mario Rossi', size: 'xxl', name: 'avatar-standard', })} </div> <div> <h5 style=\"margin-top: 0;\">Dimensione Piccola</h5> ${renderUploadAvatar({ src: 'https://randomuser.me/api/portraits/women/21.jpg', alt: 'Laura Bianchi', size: 'xl', name: 'avatar-sm', })} </div> </div> `, }",
1286
+ "description": "Upload con Avatar — combina un avatar con input file per upload foto profilo"
1287
+ },
1288
+ {
1289
+ "kind": "variable",
1290
+ "name": "UploadDragDrop",
1291
+ "type": {
1292
+ "text": "Story"
1293
+ },
1294
+ "default": "{ name: 'Upload Drag & Drop', parameters: { docs: { description: { story: \"Componente per il caricamento tramite trascinamento. Mostra diversi stati: idle (inattivo), dragover (file trascinato), loading (caricamento), success (completato).\\nL'avanzamento è visualizzato con un indicatore di progresso a ciambella.\", }, source: { language: 'html', code: ` <div style=\"display: flex; flex-direction: column; gap: 3rem;\"> <div> <h5>Default</h5> <it-upload-drag-drop name=\"upload-dd-idle\"></it-upload-drag-drop> </div> <div> <h5>Simula caricamento</h5> <it-upload-drag-drop id=\"dd-loading\" name=\"upload-dd-loading\"></it-upload-drag-drop> </div> <div> <h5>Processo completato</h5> <it-upload-drag-drop id=\"dd-success\" name=\"upload-dd-success\"></it-upload-drag-drop> </div> <div> <h5>Esempio animato</h5> <button type=\"button\" id=\"btn-simulate\" class=\"btn btn-primary mb-3\">Simula Upload</button> <it-upload-drag-drop id=\"dd-interactive\" name=\"upload-dd-demo\"></it-upload-drag-drop> </div> </div> <script> // -- 2. Setup Loading State -- const ddLoading = document.getElementById('dd-loading'); ddLoading.start(); // -- 3. Setup Success State -- const ddSuccess = document.getElementById('dd-success'); ddSuccess.start(); ddSuccess.progress(1); ddSuccess.success(); // -- 4. Setup Interactive/Animated -- const ddInteractive = document.getElementById('dd-interactive'); const btnSimulate = document.getElementById('btn-simulate'); let simulationTimer; const startSimulation = () => { clearInterval(simulationTimer); ddInteractive.reset(); ddInteractive.start(); let p = 0; simulationTimer = setInterval(() => { p = Math.min(1, p + 0.1); ddInteractive.progress(p); if (p >= 1) { clearInterval(simulationTimer); setTimeout(() => ddInteractive.success(), 500); } }, 300); }; // Avvia l'animazione al click del bottone o quando l'utente seleziona/trascina un file reale btnSimulate.addEventListener('click', startSimulation); ddInteractive.addEventListener('it-dd-drop', (e) => { e.preventDefault(); startSimulation(); }); </script> `, }, }, }, render: () => html` <div style=\"display: flex; flex-direction: column; gap: 3rem;\"> <div> <h5>Default</h5> ${renderUploadDragDrop({ name: 'upload-dd-idle', accept: '' })} </div> <div> <h5>Simula caricamento</h5> <story-upload-dd-loading> <it-upload-drag-drop name=\"upload-dd-loading\"></it-upload-drag-drop> </story-upload-dd-loading> </div> <div> <h5>Processo completato</h5> <story-upload-dd-success> <it-upload-drag-drop name=\"upload-dd-success\"></it-upload-drag-drop> </story-upload-dd-success> </div> <div> <h5>Esempio animato</h5> <story-upload-dd-interactive style=\"display: flex; flex-direction: column; align-items: flex-start; gap: 1rem;\"> <it-upload-drag-drop name=\"upload-dd-demo\"></it-upload-drag-drop> </story-upload-dd-interactive> </div> </div> `, }",
1295
+ "description": "Upload Drag & Drop — caricamento tramite trascinamento"
1296
+ },
1297
+ {
1298
+ "kind": "variable",
1299
+ "name": "UploadFormIntegrazione",
1300
+ "type": {
1301
+ "text": "Story"
1302
+ },
1303
+ "default": "{ name: 'Integrazione form e validazione', parameters: { docs: { description: { story: \"Esempio con tutti e tre i componenti upload obbligatori all'interno di un form. \" + \"`<it-upload>` e `<it-upload-drag-drop>` e `<it-upload-avatar>` richiedono che l'utente selezioni un file. \" + '\\nProva a inviare il form per vedere la validazione in azione.', }, source: { language: 'html', code: ` <form id=\"demo-form\" style=\"display: flex; flex-direction: column; gap: 2rem;\"> <div> <h5>Lista file (obbligatorio)</h5> <it-upload name=\"allegati\" required multiple accept=\"image/*,.pdf\"> <span slot=\"label\">Allega documenti</span> </it-upload> </div> <div> <h5>Avatar (obbligatorio)</h5> <it-upload-avatar name=\"foto-profilo\" required alt=\"Mario Rossi\" ></it-upload-avatar> </div> <div> <h5>Drag &amp; Drop (obbligatorio)</h5> <it-upload-drag-drop name=\"documento\" required></it-upload-drag-drop> </div> <div> <it-button type=\"submit\" variant=\"primary\">Invia</it-button> </div> </form> <script> document.getElementById('demo-form').addEventListener('submit', (event) => { event.preventDefault(); alert('Form inviato con successo!'); }); </script> `, }, }, }, render: () => html` <form style=\"display: flex; flex-direction: column; gap: 2rem;\"> <div> <h5>Lista file (obbligatorio)</h5> <it-upload name=\"allegati\" required multiple accept=\"image/*,.pdf\"> <span slot=\"label\">Allega documenti</span> </it-upload> </div> <div> <h5>Avatar (obbligatorio)</h5> <it-upload-avatar name=\"foto-profilo\" required alt=\"Mario Rossi\"></it-upload-avatar> </div> <div> <h5>Drag &amp; Drop (obbligatorio)</h5> <it-upload-drag-drop name=\"documento\" required></it-upload-drag-drop> </div> <div style=\"margin-top: 0.5rem;\"> <it-button type=\"submit\" variant=\"primary\">Invia</it-button> </div> </form> `, }",
1304
+ "description": "Integrazione in un form HTML con validazione nativa required."
1305
+ },
1306
+ {
1307
+ "kind": "variable",
1308
+ "name": "MetodiEPropUpload",
1309
+ "type": {
1310
+ "text": "Story"
1311
+ },
1312
+ "default": "{ ...StoryFormControlMethodAndProps({ componentName: 'it-upload', otherProps: `|\\`files\\`| Array di sola lettura dei file caricati (\\`UploadFile[]\\`). | |\\`auto-success\\`| Se presente, i file passano automaticamente allo stato \\`success\\` appena selezionati. | |\\`variant\\`| Layout: \\`default\\` (lista verticale) oppure \\`gallery\\` (griglia immagini). | |\\`multiple\\`| Consente la selezione di più file contemporaneamente. | |\\`accept\\`| Tipi di file accettati, es. \\`\"image/*,.pdf\"\\`. | |\\`image-preview\\`| Mostra thumbnail in anteprima al posto dell'icona file (consigliato per immagini). | |\\`support-text\\`| Testo di supporto visualizzato sotto il pulsante. |`, otherMethods: `|\\`addFile(file)\\`| Aggiunge un file con stato \\`loading\\`. Ritorna l'id interno generato. | file: File | |\\`setFileStatus(id, status, progress?)\\`| Aggiorna lo stato (\\`loading\\`, \\`success\\`, \\`error\\`) e il progresso (0–100) di un file. | id, status, progress? | |\\`setFileThumbnail(id, dataUrl)\\`| Imposta una thumbnail (data URL) per un file. | id, dataUrl | |\\`removeFile(id)\\`| Rimuove un file dalla lista. | id |`, otherEvents: `|\\`it-upload-add\\`| Emesso quando uno o più file vengono selezionati. \\`detail: { files: File[], name, id }\\` | |\\`it-upload-remove\\`| Emesso quando un file viene rimosso. \\`detail: { id, name, componentName, componentId }\\` | |\\`it-change\\`| Emesso a ogni modifica alla lista. \\`detail: { files: File[], name, id }\\` |`, }), tags: ['!dev'], }",
1313
+ "description": "Proprietà, Metodi e Eventi di `<it-upload>`"
1314
+ },
1315
+ {
1316
+ "kind": "variable",
1317
+ "name": "MetodiEPropAvatar",
1318
+ "type": {
1319
+ "text": "Story"
1320
+ },
1321
+ "default": "{ ...StoryFormControlMethodAndProps({ componentName: 'it-upload-avatar', otherProps: `|\\`src\\`| URL dell'immagine avatar corrente. Se valorizzato soddisfa il requisito \\`required\\`. | |\\`alt\\`| Testo alternativo per l'immagine avatar. | |\\`size\\`| Dimensione del componente: \\`xxl\\` (standard) oppure \\`xl\\` (piccola). | |\\`accept\\`| Tipi di file accettati (default: \\`image/*\\`). | |\\`overlay-label\\`| Testo dell'overlay al passaggio del mouse / focus. Default: \"Aggiorna\" (i18n). | |\\`files\\`| Array di sola lettura: contiene il file selezionato (\\`UploadFile[]\\`). |`, otherMethods: '', otherEvents: `|\\`it-change\\`| Emesso quando l'utente seleziona un nuovo file. \\`detail: { files: File[], name, id }\\` |`, }), tags: ['!dev'], }",
1322
+ "description": "Proprietà, Metodi e Eventi di `<it-upload-avatar>`"
1323
+ },
1324
+ {
1325
+ "kind": "variable",
1326
+ "name": "MetodiEPropDragDrop",
1327
+ "type": {
1328
+ "text": "Story"
1329
+ },
1330
+ "default": "{ ...StoryFormControlMethodAndProps({ componentName: 'it-upload-drag-drop', otherProps: `|\\`accept\\`| Tipi di file accettati, es. \\`\"image/*,.pdf\"\\`. | |\\`illustration\\`| URL illustrazione personalizzata. Se omesso viene usata quella predefinita inclusa nel bundle. | |\\`files\\`| Array di sola lettura: contiene il file selezionato (\\`UploadFile[]\\`). |`, otherMethods: `|\\`start()\\`| Avvia lo stato di caricamento mostrando il progress circolare. | - | |\\`progress(value)\\`| Aggiorna il progresso (valore 0–1). | value: number | |\\`success()\\`| Segna il caricamento come completato. | - | |\\`reset()\\`| Ripristina lo stato iniziale. | - |`, otherEvents: `|\\`it-dd-start\\`| Emesso al dragenter. Annullabile via \\`preventDefault()\\`: se non annullato parte \\`start()\\` automaticamente. \\`detail: {}\\` | |\\`it-dd-drop\\`| Emesso al drop o selezione da file input. Annullabile via \\`preventDefault()\\`: se non annullato parte \\`start()\\` + progress indeterminato automaticamente. \\`detail: { file: File, name, id }\\` | |\\`it-change\\`| Emesso sempre al drop/selezione (retrocompatibilità). \\`detail: { file: File, name, id }\\` |`, }), tags: ['!dev'], }",
1331
+ "description": "Proprietà, Metodi e Eventi di `<it-upload-drag-drop>`"
1332
+ },
1333
+ {
1334
+ "kind": "variable",
1335
+ "name": "I18n",
1336
+ "type": {
1337
+ "text": "Story"
1338
+ },
1339
+ "default": "{ name: 'i18n', tags: ['!dev'], render: () => html`<div class=\"hide-preview\"></div>`, parameters: { viewMode: 'docs', docs: { description: { story: ` Per questi componenti sono disponibili alcune stringhe traducibili tramite l'[utility di internazionalizzazione](/docs/i18n-internazionalizzazione--documentazione). \\`\\`\\`js const translation = ${JSON.stringify(i18nIT, null, 2)} \\`\\`\\` `, }, }, }, }"
1340
+ }
1341
+ ],
1342
+ "exports": [
1343
+ {
1344
+ "kind": "custom-element-definition",
1345
+ "name": "story-upload-file-states",
1346
+ "declaration": {
1347
+ "name": "StoryUploadFileStates",
1348
+ "module": "stories/it-upload.stories.ts"
1349
+ }
1350
+ },
1351
+ {
1352
+ "kind": "custom-element-definition",
1353
+ "name": "story-upload-dd-loading",
1354
+ "declaration": {
1355
+ "name": "StoryUploadDDLoading",
1356
+ "module": "stories/it-upload.stories.ts"
1357
+ }
1358
+ },
1359
+ {
1360
+ "kind": "custom-element-definition",
1361
+ "name": "story-upload-dd-success",
1362
+ "declaration": {
1363
+ "name": "StoryUploadDDSuccess",
1364
+ "module": "stories/it-upload.stories.ts"
1365
+ }
1366
+ },
1367
+ {
1368
+ "kind": "custom-element-definition",
1369
+ "name": "story-upload-dd-interactive",
1370
+ "declaration": {
1371
+ "name": "StoryUploadDDInteractive",
1372
+ "module": "stories/it-upload.stories.ts"
1373
+ }
1374
+ },
1375
+ {
1376
+ "kind": "custom-element-definition",
1377
+ "name": "story-upload-gallery-prefilled",
1378
+ "declaration": {
1379
+ "name": "StoryUploadGalleryPrefilled",
1380
+ "module": "stories/it-upload.stories.ts"
1381
+ }
1382
+ },
1383
+ {
1384
+ "kind": "js",
1385
+ "name": "default",
1386
+ "declaration": {
1387
+ "name": "meta",
1388
+ "module": "stories/it-upload.stories.ts"
1389
+ }
1390
+ },
1391
+ {
1392
+ "kind": "js",
1393
+ "name": "EsempioInterattivoUpload",
1394
+ "declaration": {
1395
+ "name": "EsempioInterattivoUpload",
1396
+ "module": "stories/it-upload.stories.ts"
1397
+ }
1398
+ },
1399
+ {
1400
+ "kind": "js",
1401
+ "name": "EsempioInterattivoAvatar",
1402
+ "declaration": {
1403
+ "name": "EsempioInterattivoAvatar",
1404
+ "module": "stories/it-upload.stories.ts"
1405
+ }
1406
+ },
1407
+ {
1408
+ "kind": "js",
1409
+ "name": "EsempioInterattivoDragDrop",
1410
+ "declaration": {
1411
+ "name": "EsempioInterattivoDragDrop",
1412
+ "module": "stories/it-upload.stories.ts"
1413
+ }
1414
+ },
1415
+ {
1416
+ "kind": "js",
1417
+ "name": "UploadConListaDiFile",
1418
+ "declaration": {
1419
+ "name": "UploadConListaDiFile",
1420
+ "module": "stories/it-upload.stories.ts"
1421
+ }
1422
+ },
1423
+ {
1424
+ "kind": "js",
1425
+ "name": "UploadConStatoFile",
1426
+ "declaration": {
1427
+ "name": "UploadConStatoFile",
1428
+ "module": "stories/it-upload.stories.ts"
1429
+ }
1430
+ },
1431
+ {
1432
+ "kind": "js",
1433
+ "name": "UploadGallery",
1434
+ "declaration": {
1435
+ "name": "UploadGallery",
1436
+ "module": "stories/it-upload.stories.ts"
1437
+ }
1438
+ },
1439
+ {
1440
+ "kind": "js",
1441
+ "name": "UploadConAvatar",
1442
+ "declaration": {
1443
+ "name": "UploadConAvatar",
1444
+ "module": "stories/it-upload.stories.ts"
1445
+ }
1446
+ },
1447
+ {
1448
+ "kind": "js",
1449
+ "name": "UploadDragDrop",
1450
+ "declaration": {
1451
+ "name": "UploadDragDrop",
1452
+ "module": "stories/it-upload.stories.ts"
1453
+ }
1454
+ },
1455
+ {
1456
+ "kind": "js",
1457
+ "name": "UploadFormIntegrazione",
1458
+ "declaration": {
1459
+ "name": "UploadFormIntegrazione",
1460
+ "module": "stories/it-upload.stories.ts"
1461
+ }
1462
+ },
1463
+ {
1464
+ "kind": "js",
1465
+ "name": "MetodiEPropUpload",
1466
+ "declaration": {
1467
+ "name": "MetodiEPropUpload",
1468
+ "module": "stories/it-upload.stories.ts"
1469
+ }
1470
+ },
1471
+ {
1472
+ "kind": "js",
1473
+ "name": "MetodiEPropAvatar",
1474
+ "declaration": {
1475
+ "name": "MetodiEPropAvatar",
1476
+ "module": "stories/it-upload.stories.ts"
1477
+ }
1478
+ },
1479
+ {
1480
+ "kind": "js",
1481
+ "name": "MetodiEPropDragDrop",
1482
+ "declaration": {
1483
+ "name": "MetodiEPropDragDrop",
1484
+ "module": "stories/it-upload.stories.ts"
1485
+ }
1486
+ },
1487
+ {
1488
+ "kind": "js",
1489
+ "name": "I18n",
1490
+ "declaration": {
1491
+ "name": "I18n",
1492
+ "module": "stories/it-upload.stories.ts"
1493
+ }
1494
+ }
1495
+ ]
1496
+ },
1497
+ {
1498
+ "kind": "javascript-module",
1499
+ "path": "src/locales/en.ts",
1500
+ "declarations": [
1501
+ {
1502
+ "kind": "variable",
1503
+ "name": "translation",
1504
+ "type": {
1505
+ "text": "DefaultTranslation"
1506
+ },
1507
+ "default": "{ $code: 'en', $name: 'English', $dir: 'ltr', upload_label: 'Upload file', upload_file_list_label: 'Uploaded files', upload_remove_loading: 'Cancel upload of {name}', upload_remove_done: 'Remove uploaded file {name}', upload_remove_error: 'Retry upload of {name}', upload_status_loading: 'Uploading file', upload_status_success: 'File uploaded:', upload_status_error: 'Upload error:', upload_gallery_label: 'Upload photo', upload_avatar_label: 'Update avatar photo', upload_avatar_overlay_label: 'Update', upload_dd_title: 'Drag file here to upload', upload_dd_description: 'or select it from your device', upload_dd_select: 'select it from your device', upload_dd_progress_label: 'Upload progress', upload_dd_status_dragover: 'File ready to drop', upload_dd_status_loading: 'Loading...', upload_dd_status_success: 'Upload complete', validityRequired: 'Please select at least one file.', }"
1508
+ }
1509
+ ],
1510
+ "exports": [
1511
+ {
1512
+ "kind": "js",
1513
+ "name": "default",
1514
+ "declaration": {
1515
+ "name": "translation",
1516
+ "module": "src/locales/en.ts"
1517
+ }
1518
+ }
1519
+ ]
1520
+ },
1521
+ {
1522
+ "kind": "javascript-module",
1523
+ "path": "src/locales/it.ts",
1524
+ "declarations": [
1525
+ {
1526
+ "kind": "variable",
1527
+ "name": "translation",
1528
+ "type": {
1529
+ "text": "DefaultTranslation"
1530
+ },
1531
+ "default": "{ $code: 'it', $name: 'Italiano', $dir: 'ltr', upload_label: 'Carica file', upload_file_list_label: 'File caricati', upload_remove_loading: 'Annulla caricamento file {name}', upload_remove_done: 'Rimuovi file {name}', upload_remove_error: 'Riprova caricamento file {name}', upload_status_loading: 'Caricamento file:', upload_status_success: 'File caricato:', upload_status_error: 'Errore caricamento file:', upload_gallery_label: 'Carica foto', upload_avatar_label: \"Aggiorna foto dell'avatar\", upload_avatar_overlay_label: 'Aggiorna', upload_dd_title: 'Trascina il file per caricarlo', upload_dd_description: 'oppure selezionalo dal dispositivo', upload_dd_select: 'selezionalo dal dispositivo', upload_dd_progress_label: 'Avanzamento caricamento', upload_dd_status_dragover: 'File pronto per il rilascio', upload_dd_status_loading: 'Caricamento in corso...', upload_dd_status_success: 'Caricamento completato', validityRequired: 'Seleziona almeno un file.', }"
1532
+ }
1533
+ ],
1534
+ "exports": [
1535
+ {
1536
+ "kind": "js",
1537
+ "name": "default",
1538
+ "declaration": {
1539
+ "name": "translation",
1540
+ "module": "src/locales/it.ts"
1541
+ }
1542
+ }
1543
+ ]
1544
+ }
1545
+ ]
1546
+ }