@italia/collapse 1.0.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AUTHORS ADDED
@@ -0,0 +1 @@
1
+ Presidenza del Consiglio dei Ministri
package/LICENSE ADDED
@@ -0,0 +1,11 @@
1
+ Copyright (c) 2025, the respective contributors, as shown by the AUTHORS file.
2
+
3
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
+
5
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
+
7
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
+
9
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10
+
11
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,62 @@
1
+ # \<it-collapse>
2
+
3
+ Web component `it-collapse` del Design System Italia.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm i @italia/collapse
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```html
14
+ <script type="module">
15
+ import '@italia/collapse';
16
+ </script>
17
+
18
+ <it-collapse label="Collapse header" default-open>
19
+ <div slot="content">
20
+ <p>Contenuto del collapse.</p>
21
+ </div>
22
+ </it-collapse>
23
+ ```
24
+
25
+ ## Con trigger personalizzato
26
+
27
+ ```html
28
+ <it-collapse>
29
+ <button slot="trigger">Custom trigger</button>
30
+ <div slot="content">
31
+ <p>Contenuto del collapse.</p>
32
+ </div>
33
+ </it-collapse>
34
+ ```
35
+
36
+ ## Linting and formatting
37
+
38
+ To scan the project for linting and formatting errors, run
39
+
40
+ ```bash
41
+ npm run lint
42
+ ```
43
+
44
+ To automatically fix linting and formatting errors, run
45
+
46
+ ```bash
47
+ npm run format
48
+ ```
49
+
50
+ ## Testing with Web Test Runner
51
+
52
+ To execute a single test run:
53
+
54
+ ```bash
55
+ npm run test
56
+ ```
57
+
58
+ To run the tests in interactive watch mode run:
59
+
60
+ ```bash
61
+ npm run test:watch
62
+ ```
@@ -0,0 +1,1001 @@
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": "ItCollapse",
13
+ "declaration": {
14
+ "name": "ItCollapse",
15
+ "module": "./it-collapse.js"
16
+ }
17
+ },
18
+ {
19
+ "kind": "js",
20
+ "name": "ItCollapseBase",
21
+ "declaration": {
22
+ "name": "ItCollapseBase",
23
+ "module": "./it-collapse-base.js"
24
+ }
25
+ },
26
+ {
27
+ "kind": "js",
28
+ "name": "PressEvent",
29
+ "declaration": {
30
+ "name": "PressEvent",
31
+ "module": "./types.js"
32
+ }
33
+ },
34
+ {
35
+ "kind": "js",
36
+ "name": "TriggerTag",
37
+ "declaration": {
38
+ "name": "TriggerTag",
39
+ "module": "./types.js"
40
+ }
41
+ }
42
+ ]
43
+ },
44
+ {
45
+ "kind": "javascript-module",
46
+ "path": "src/it-collapse-base.ts",
47
+ "declarations": [
48
+ {
49
+ "kind": "class",
50
+ "description": "",
51
+ "name": "ItCollapseBase",
52
+ "members": [
53
+ {
54
+ "kind": "field",
55
+ "name": "shadowRootOptions",
56
+ "type": {
57
+ "text": "object"
58
+ },
59
+ "static": true,
60
+ "default": "{ ...BaseComponent.shadowRootOptions, delegatesFocus: true, }"
61
+ },
62
+ {
63
+ "kind": "field",
64
+ "name": "variant",
65
+ "type": {
66
+ "text": "string"
67
+ },
68
+ "privacy": "private",
69
+ "default": "'primary'",
70
+ "attribute": "variant",
71
+ "reflects": true
72
+ },
73
+ {
74
+ "kind": "field",
75
+ "name": "size",
76
+ "type": {
77
+ "text": "string"
78
+ },
79
+ "privacy": "private",
80
+ "default": "''",
81
+ "attribute": "size",
82
+ "reflects": true
83
+ },
84
+ {
85
+ "kind": "field",
86
+ "name": "outline",
87
+ "type": {
88
+ "text": "boolean"
89
+ },
90
+ "privacy": "private",
91
+ "default": "false",
92
+ "attribute": "outline",
93
+ "reflects": true
94
+ },
95
+ {
96
+ "kind": "field",
97
+ "name": "expanded",
98
+ "type": {
99
+ "text": "boolean"
100
+ },
101
+ "default": "false",
102
+ "attribute": "expanded",
103
+ "reflects": true
104
+ },
105
+ {
106
+ "kind": "field",
107
+ "name": "isAccordion",
108
+ "type": {
109
+ "text": "boolean"
110
+ },
111
+ "privacy": "protected",
112
+ "default": "false"
113
+ },
114
+ {
115
+ "kind": "field",
116
+ "name": "as",
117
+ "type": {
118
+ "text": "string"
119
+ },
120
+ "default": "'button'",
121
+ "attribute": "as",
122
+ "reflects": true
123
+ },
124
+ {
125
+ "kind": "field",
126
+ "name": "defaultOpen",
127
+ "type": {
128
+ "text": "boolean"
129
+ },
130
+ "default": "false",
131
+ "attribute": "default-open",
132
+ "reflects": true
133
+ },
134
+ {
135
+ "kind": "field",
136
+ "name": "contentElement",
137
+ "type": {
138
+ "text": "HTMLElement"
139
+ }
140
+ },
141
+ {
142
+ "kind": "field",
143
+ "name": "triggerElements",
144
+ "type": {
145
+ "text": "HTMLElement[]"
146
+ },
147
+ "privacy": "private"
148
+ },
149
+ {
150
+ "kind": "field",
151
+ "name": "triggerElement",
152
+ "type": {
153
+ "text": "HTMLElement | null"
154
+ },
155
+ "readonly": true
156
+ },
157
+ {
158
+ "kind": "field",
159
+ "name": "isAnimating",
160
+ "type": {
161
+ "text": "boolean"
162
+ },
163
+ "privacy": "private",
164
+ "default": "false"
165
+ },
166
+ {
167
+ "kind": "field",
168
+ "name": "animation",
169
+ "type": {
170
+ "text": "Animation | undefined"
171
+ },
172
+ "privacy": "private"
173
+ },
174
+ {
175
+ "kind": "field",
176
+ "name": "animationDuration",
177
+ "type": {
178
+ "text": "number"
179
+ },
180
+ "privacy": "private",
181
+ "readonly": true,
182
+ "default": "350"
183
+ },
184
+ {
185
+ "kind": "field",
186
+ "name": "_triggerId",
187
+ "privacy": "protected"
188
+ },
189
+ {
190
+ "kind": "field",
191
+ "name": "_contentId",
192
+ "privacy": "protected"
193
+ },
194
+ {
195
+ "kind": "field",
196
+ "name": "handleTriggerAction",
197
+ "privacy": "protected"
198
+ },
199
+ {
200
+ "kind": "method",
201
+ "name": "toggle"
202
+ },
203
+ {
204
+ "kind": "method",
205
+ "name": "setInitialState",
206
+ "privacy": "private"
207
+ },
208
+ {
209
+ "kind": "method",
210
+ "name": "cleanupAnimation",
211
+ "privacy": "private"
212
+ },
213
+ {
214
+ "kind": "method",
215
+ "name": "updateAriaAttributes",
216
+ "privacy": "private"
217
+ },
218
+ {
219
+ "kind": "method",
220
+ "name": "updateBackgroundStyles",
221
+ "privacy": "protected"
222
+ },
223
+ {
224
+ "kind": "method",
225
+ "name": "performExpand",
226
+ "privacy": "private"
227
+ },
228
+ {
229
+ "kind": "method",
230
+ "name": "performCollapse",
231
+ "privacy": "private"
232
+ },
233
+ {
234
+ "kind": "field",
235
+ "name": "_onTriggerSlotChange",
236
+ "privacy": "private"
237
+ },
238
+ {
239
+ "kind": "method",
240
+ "name": "renderDefaultTrigger",
241
+ "privacy": "protected"
242
+ },
243
+ {
244
+ "kind": "method",
245
+ "name": "hasSlottedTrigger",
246
+ "privacy": "private",
247
+ "return": {
248
+ "type": {
249
+ "text": "boolean"
250
+ }
251
+ }
252
+ },
253
+ {
254
+ "kind": "method",
255
+ "name": "isValidTag",
256
+ "privacy": "protected",
257
+ "parameters": [
258
+ {
259
+ "name": "tag",
260
+ "type": {
261
+ "text": "string"
262
+ }
263
+ }
264
+ ]
265
+ }
266
+ ],
267
+ "events": [
268
+ {
269
+ "name": "it-collapse-toggle",
270
+ "type": {
271
+ "text": "CustomEvent"
272
+ }
273
+ }
274
+ ],
275
+ "attributes": [
276
+ {
277
+ "name": "variant",
278
+ "type": {
279
+ "text": "string"
280
+ },
281
+ "default": "'primary'",
282
+ "fieldName": "variant"
283
+ },
284
+ {
285
+ "name": "size",
286
+ "type": {
287
+ "text": "string"
288
+ },
289
+ "default": "''",
290
+ "fieldName": "size"
291
+ },
292
+ {
293
+ "name": "outline",
294
+ "type": {
295
+ "text": "boolean"
296
+ },
297
+ "default": "false",
298
+ "fieldName": "outline"
299
+ },
300
+ {
301
+ "name": "expanded",
302
+ "type": {
303
+ "text": "boolean"
304
+ },
305
+ "default": "false",
306
+ "fieldName": "expanded"
307
+ },
308
+ {
309
+ "name": "as",
310
+ "type": {
311
+ "text": "string"
312
+ },
313
+ "default": "'button'",
314
+ "fieldName": "as"
315
+ },
316
+ {
317
+ "name": "default-open",
318
+ "type": {
319
+ "text": "boolean"
320
+ },
321
+ "default": "false",
322
+ "fieldName": "defaultOpen"
323
+ }
324
+ ],
325
+ "superclass": {
326
+ "name": "BaseComponent",
327
+ "package": "@italia/globals"
328
+ }
329
+ }
330
+ ],
331
+ "exports": [
332
+ {
333
+ "kind": "js",
334
+ "name": "ItCollapseBase",
335
+ "declaration": {
336
+ "name": "ItCollapseBase",
337
+ "module": "src/it-collapse-base.ts"
338
+ }
339
+ }
340
+ ]
341
+ },
342
+ {
343
+ "kind": "javascript-module",
344
+ "path": "src/it-collapse.ts",
345
+ "declarations": [
346
+ {
347
+ "kind": "class",
348
+ "description": "",
349
+ "name": "ItCollapse",
350
+ "superclass": {
351
+ "name": "ItCollapseBase",
352
+ "module": "/src/it-collapse-base.js"
353
+ },
354
+ "tagName": "it-collapse",
355
+ "customElement": true,
356
+ "attributes": [
357
+ {
358
+ "name": "variant",
359
+ "type": {
360
+ "text": "string"
361
+ },
362
+ "default": "'primary'",
363
+ "fieldName": "variant",
364
+ "inheritedFrom": {
365
+ "name": "ItCollapseBase",
366
+ "module": "src/it-collapse-base.ts"
367
+ }
368
+ },
369
+ {
370
+ "name": "size",
371
+ "type": {
372
+ "text": "string"
373
+ },
374
+ "default": "''",
375
+ "fieldName": "size",
376
+ "inheritedFrom": {
377
+ "name": "ItCollapseBase",
378
+ "module": "src/it-collapse-base.ts"
379
+ }
380
+ },
381
+ {
382
+ "name": "outline",
383
+ "type": {
384
+ "text": "boolean"
385
+ },
386
+ "default": "false",
387
+ "fieldName": "outline",
388
+ "inheritedFrom": {
389
+ "name": "ItCollapseBase",
390
+ "module": "src/it-collapse-base.ts"
391
+ }
392
+ },
393
+ {
394
+ "name": "expanded",
395
+ "type": {
396
+ "text": "boolean"
397
+ },
398
+ "default": "false",
399
+ "fieldName": "expanded",
400
+ "inheritedFrom": {
401
+ "name": "ItCollapseBase",
402
+ "module": "src/it-collapse-base.ts"
403
+ }
404
+ },
405
+ {
406
+ "name": "as",
407
+ "type": {
408
+ "text": "string"
409
+ },
410
+ "default": "'button'",
411
+ "fieldName": "as",
412
+ "inheritedFrom": {
413
+ "name": "ItCollapseBase",
414
+ "module": "src/it-collapse-base.ts"
415
+ }
416
+ },
417
+ {
418
+ "name": "default-open",
419
+ "type": {
420
+ "text": "boolean"
421
+ },
422
+ "default": "false",
423
+ "fieldName": "defaultOpen",
424
+ "inheritedFrom": {
425
+ "name": "ItCollapseBase",
426
+ "module": "src/it-collapse-base.ts"
427
+ }
428
+ }
429
+ ],
430
+ "members": [
431
+ {
432
+ "kind": "field",
433
+ "name": "shadowRootOptions",
434
+ "type": {
435
+ "text": "object"
436
+ },
437
+ "static": true,
438
+ "default": "{ ...BaseComponent.shadowRootOptions, delegatesFocus: true, }",
439
+ "inheritedFrom": {
440
+ "name": "ItCollapseBase",
441
+ "module": "src/it-collapse-base.ts"
442
+ }
443
+ },
444
+ {
445
+ "kind": "field",
446
+ "name": "variant",
447
+ "type": {
448
+ "text": "string"
449
+ },
450
+ "privacy": "private",
451
+ "default": "'primary'",
452
+ "attribute": "variant",
453
+ "reflects": true,
454
+ "inheritedFrom": {
455
+ "name": "ItCollapseBase",
456
+ "module": "src/it-collapse-base.ts"
457
+ }
458
+ },
459
+ {
460
+ "kind": "field",
461
+ "name": "size",
462
+ "type": {
463
+ "text": "string"
464
+ },
465
+ "privacy": "private",
466
+ "default": "''",
467
+ "attribute": "size",
468
+ "reflects": true,
469
+ "inheritedFrom": {
470
+ "name": "ItCollapseBase",
471
+ "module": "src/it-collapse-base.ts"
472
+ }
473
+ },
474
+ {
475
+ "kind": "field",
476
+ "name": "outline",
477
+ "type": {
478
+ "text": "boolean"
479
+ },
480
+ "privacy": "private",
481
+ "default": "false",
482
+ "attribute": "outline",
483
+ "reflects": true,
484
+ "inheritedFrom": {
485
+ "name": "ItCollapseBase",
486
+ "module": "src/it-collapse-base.ts"
487
+ }
488
+ },
489
+ {
490
+ "kind": "field",
491
+ "name": "expanded",
492
+ "type": {
493
+ "text": "boolean"
494
+ },
495
+ "default": "false",
496
+ "attribute": "expanded",
497
+ "reflects": true,
498
+ "inheritedFrom": {
499
+ "name": "ItCollapseBase",
500
+ "module": "src/it-collapse-base.ts"
501
+ }
502
+ },
503
+ {
504
+ "kind": "field",
505
+ "name": "isAccordion",
506
+ "type": {
507
+ "text": "boolean"
508
+ },
509
+ "privacy": "protected",
510
+ "default": "false",
511
+ "inheritedFrom": {
512
+ "name": "ItCollapseBase",
513
+ "module": "src/it-collapse-base.ts"
514
+ }
515
+ },
516
+ {
517
+ "kind": "field",
518
+ "name": "as",
519
+ "type": {
520
+ "text": "string"
521
+ },
522
+ "default": "'button'",
523
+ "attribute": "as",
524
+ "reflects": true,
525
+ "inheritedFrom": {
526
+ "name": "ItCollapseBase",
527
+ "module": "src/it-collapse-base.ts"
528
+ }
529
+ },
530
+ {
531
+ "kind": "field",
532
+ "name": "defaultOpen",
533
+ "type": {
534
+ "text": "boolean"
535
+ },
536
+ "default": "false",
537
+ "attribute": "default-open",
538
+ "reflects": true,
539
+ "inheritedFrom": {
540
+ "name": "ItCollapseBase",
541
+ "module": "src/it-collapse-base.ts"
542
+ }
543
+ },
544
+ {
545
+ "kind": "field",
546
+ "name": "contentElement",
547
+ "type": {
548
+ "text": "HTMLElement"
549
+ },
550
+ "inheritedFrom": {
551
+ "name": "ItCollapseBase",
552
+ "module": "src/it-collapse-base.ts"
553
+ }
554
+ },
555
+ {
556
+ "kind": "field",
557
+ "name": "triggerElements",
558
+ "type": {
559
+ "text": "HTMLElement[]"
560
+ },
561
+ "privacy": "private",
562
+ "inheritedFrom": {
563
+ "name": "ItCollapseBase",
564
+ "module": "src/it-collapse-base.ts"
565
+ }
566
+ },
567
+ {
568
+ "kind": "field",
569
+ "name": "triggerElement",
570
+ "type": {
571
+ "text": "HTMLElement | null"
572
+ },
573
+ "readonly": true,
574
+ "inheritedFrom": {
575
+ "name": "ItCollapseBase",
576
+ "module": "src/it-collapse-base.ts"
577
+ }
578
+ },
579
+ {
580
+ "kind": "field",
581
+ "name": "isAnimating",
582
+ "type": {
583
+ "text": "boolean"
584
+ },
585
+ "privacy": "private",
586
+ "default": "false",
587
+ "inheritedFrom": {
588
+ "name": "ItCollapseBase",
589
+ "module": "src/it-collapse-base.ts"
590
+ }
591
+ },
592
+ {
593
+ "kind": "field",
594
+ "name": "animation",
595
+ "type": {
596
+ "text": "Animation | undefined"
597
+ },
598
+ "privacy": "private",
599
+ "inheritedFrom": {
600
+ "name": "ItCollapseBase",
601
+ "module": "src/it-collapse-base.ts"
602
+ }
603
+ },
604
+ {
605
+ "kind": "field",
606
+ "name": "animationDuration",
607
+ "type": {
608
+ "text": "number"
609
+ },
610
+ "privacy": "private",
611
+ "readonly": true,
612
+ "default": "350",
613
+ "inheritedFrom": {
614
+ "name": "ItCollapseBase",
615
+ "module": "src/it-collapse-base.ts"
616
+ }
617
+ },
618
+ {
619
+ "kind": "field",
620
+ "name": "_triggerId",
621
+ "privacy": "protected",
622
+ "inheritedFrom": {
623
+ "name": "ItCollapseBase",
624
+ "module": "src/it-collapse-base.ts"
625
+ }
626
+ },
627
+ {
628
+ "kind": "field",
629
+ "name": "_contentId",
630
+ "privacy": "protected",
631
+ "inheritedFrom": {
632
+ "name": "ItCollapseBase",
633
+ "module": "src/it-collapse-base.ts"
634
+ }
635
+ },
636
+ {
637
+ "kind": "field",
638
+ "name": "handleTriggerAction",
639
+ "privacy": "protected",
640
+ "inheritedFrom": {
641
+ "name": "ItCollapseBase",
642
+ "module": "src/it-collapse-base.ts"
643
+ }
644
+ },
645
+ {
646
+ "kind": "method",
647
+ "name": "toggle",
648
+ "inheritedFrom": {
649
+ "name": "ItCollapseBase",
650
+ "module": "src/it-collapse-base.ts"
651
+ }
652
+ },
653
+ {
654
+ "kind": "method",
655
+ "name": "setInitialState",
656
+ "privacy": "private",
657
+ "inheritedFrom": {
658
+ "name": "ItCollapseBase",
659
+ "module": "src/it-collapse-base.ts"
660
+ }
661
+ },
662
+ {
663
+ "kind": "method",
664
+ "name": "cleanupAnimation",
665
+ "privacy": "private",
666
+ "inheritedFrom": {
667
+ "name": "ItCollapseBase",
668
+ "module": "src/it-collapse-base.ts"
669
+ }
670
+ },
671
+ {
672
+ "kind": "method",
673
+ "name": "updateAriaAttributes",
674
+ "privacy": "private",
675
+ "inheritedFrom": {
676
+ "name": "ItCollapseBase",
677
+ "module": "src/it-collapse-base.ts"
678
+ }
679
+ },
680
+ {
681
+ "kind": "method",
682
+ "name": "updateBackgroundStyles",
683
+ "privacy": "protected",
684
+ "inheritedFrom": {
685
+ "name": "ItCollapseBase",
686
+ "module": "src/it-collapse-base.ts"
687
+ }
688
+ },
689
+ {
690
+ "kind": "method",
691
+ "name": "performExpand",
692
+ "privacy": "private",
693
+ "inheritedFrom": {
694
+ "name": "ItCollapseBase",
695
+ "module": "src/it-collapse-base.ts"
696
+ }
697
+ },
698
+ {
699
+ "kind": "method",
700
+ "name": "performCollapse",
701
+ "privacy": "private",
702
+ "inheritedFrom": {
703
+ "name": "ItCollapseBase",
704
+ "module": "src/it-collapse-base.ts"
705
+ }
706
+ },
707
+ {
708
+ "kind": "field",
709
+ "name": "_onTriggerSlotChange",
710
+ "privacy": "private",
711
+ "inheritedFrom": {
712
+ "name": "ItCollapseBase",
713
+ "module": "src/it-collapse-base.ts"
714
+ }
715
+ },
716
+ {
717
+ "kind": "method",
718
+ "name": "renderDefaultTrigger",
719
+ "privacy": "protected",
720
+ "inheritedFrom": {
721
+ "name": "ItCollapseBase",
722
+ "module": "src/it-collapse-base.ts"
723
+ }
724
+ },
725
+ {
726
+ "kind": "method",
727
+ "name": "hasSlottedTrigger",
728
+ "privacy": "private",
729
+ "return": {
730
+ "type": {
731
+ "text": "boolean"
732
+ }
733
+ },
734
+ "inheritedFrom": {
735
+ "name": "ItCollapseBase",
736
+ "module": "src/it-collapse-base.ts"
737
+ }
738
+ },
739
+ {
740
+ "kind": "method",
741
+ "name": "isValidTag",
742
+ "privacy": "protected",
743
+ "parameters": [
744
+ {
745
+ "name": "tag",
746
+ "type": {
747
+ "text": "string"
748
+ }
749
+ }
750
+ ],
751
+ "inheritedFrom": {
752
+ "name": "ItCollapseBase",
753
+ "module": "src/it-collapse-base.ts"
754
+ }
755
+ }
756
+ ],
757
+ "events": [
758
+ {
759
+ "name": "it-collapse-toggle",
760
+ "type": {
761
+ "text": "CustomEvent"
762
+ },
763
+ "inheritedFrom": {
764
+ "name": "ItCollapseBase",
765
+ "module": "src/it-collapse-base.ts"
766
+ }
767
+ }
768
+ ]
769
+ }
770
+ ],
771
+ "exports": [
772
+ {
773
+ "kind": "js",
774
+ "name": "ItCollapse",
775
+ "declaration": {
776
+ "name": "ItCollapse",
777
+ "module": "src/it-collapse.ts"
778
+ }
779
+ },
780
+ {
781
+ "kind": "custom-element-definition",
782
+ "name": "it-collapse",
783
+ "declaration": {
784
+ "name": "ItCollapse",
785
+ "module": "src/it-collapse.ts"
786
+ }
787
+ }
788
+ ]
789
+ },
790
+ {
791
+ "kind": "javascript-module",
792
+ "path": "src/types.ts",
793
+ "declarations": [
794
+ {
795
+ "kind": "function",
796
+ "name": "isMouseEvent",
797
+ "return": {
798
+ "type": {
799
+ "text": "event is MouseEvent"
800
+ }
801
+ },
802
+ "parameters": [
803
+ {
804
+ "name": "event",
805
+ "type": {
806
+ "text": "PressEvent"
807
+ }
808
+ }
809
+ ]
810
+ },
811
+ {
812
+ "kind": "function",
813
+ "name": "isKeyboardEvent",
814
+ "return": {
815
+ "type": {
816
+ "text": "event is KeyboardEvent"
817
+ }
818
+ },
819
+ "parameters": [
820
+ {
821
+ "name": "event",
822
+ "type": {
823
+ "text": "PressEvent"
824
+ }
825
+ }
826
+ ]
827
+ }
828
+ ],
829
+ "exports": [
830
+ {
831
+ "kind": "js",
832
+ "name": "isMouseEvent",
833
+ "declaration": {
834
+ "name": "isMouseEvent",
835
+ "module": "src/types.ts"
836
+ }
837
+ },
838
+ {
839
+ "kind": "js",
840
+ "name": "isKeyboardEvent",
841
+ "declaration": {
842
+ "name": "isKeyboardEvent",
843
+ "module": "src/types.ts"
844
+ }
845
+ }
846
+ ]
847
+ },
848
+ {
849
+ "kind": "javascript-module",
850
+ "path": "stories/it-collapse.stories.ts",
851
+ "declarations": [
852
+ {
853
+ "kind": "variable",
854
+ "name": "meta",
855
+ "type": {
856
+ "text": "Meta<CollapseProps>"
857
+ },
858
+ "default": "{ title: 'Componenti/Collapse', tags: ['new', 'component'], component: 'it-collapse', args: { // label: 'Toggle collapse', defaultOpen: false, content: CONTENT, variant: 'primary', size: '', outline: false, as: 'button', }, argTypes: { as: { control: 'text', description: 'Tipo di elemento HTML da utilizzare come trigger (es. button, a, div). Utilizza solo tag idonei per il ruolo di pulsante.', table: { defaultValue: { summary: 'button' } }, }, variant: { control: 'select', description: 'Variante di stile del trigger, basata sulle varianti Bootstrap Italia dei pulsanti.', options: BUTTON_VARIANTS, type: 'string', table: { defaultValue: { summary: 'primary' } }, }, size: { control: 'select', description: 'Dimensione del trigger, basata sulle dimensioni Bootstrap Italia dei pulsanti.', options: BUTTON_SIZES, type: 'string', table: { defaultValue: { summary: undefined } }, }, outline: { control: 'boolean', description: 'Se true, applica lo stile outline Bootstrap Italia dei pulsanti al trigger.', table: { defaultValue: { summary: 'false' } }, }, defaultOpen: { control: 'boolean', description: 'Se true, il collapse è aperto di default al primo rendering', table: { defaultValue: { summary: 'false' } }, name: 'default-open', }, content: { control: 'text', description: 'Contenuto del collapse (slot content), solo per playground interattivo.', }, }, parameters: { layout: 'padded', }, }"
859
+ },
860
+ {
861
+ "kind": "variable",
862
+ "name": "Info",
863
+ "type": {
864
+ "text": "Story"
865
+ },
866
+ "default": "{ ...CollapsibleOrHiddenContentGuidelines(), tags: ['!dev'] }"
867
+ },
868
+ {
869
+ "kind": "variable",
870
+ "name": "EsempioInterattivo",
871
+ "type": {
872
+ "text": "Story"
873
+ },
874
+ "default": "{ name: 'Esempio interattivo', tags: ['!autodocs', '!dev'], parameters: { docs: { canvas: { sourceState: 'hidden', }, }, }, render: (args) => renderComponent(args), }"
875
+ },
876
+ {
877
+ "kind": "variable",
878
+ "name": "PersonalizzazioneDegliStili",
879
+ "type": {
880
+ "text": "Story"
881
+ },
882
+ "default": "{ name: 'Personalizzazione degli stili', tags: ['!dev'], render: () => html`<div class=\"hide-preview\"></div>`, }"
883
+ },
884
+ {
885
+ "kind": "variable",
886
+ "name": "Comportamento",
887
+ "type": {
888
+ "text": "Story"
889
+ },
890
+ "default": "{ parameters: {}, render: () => html` <div> ${renderComponent({ label: 'Apri sezione (button)', as: 'button', variant: 'primary', })} ${renderComponent({ label: 'Apri sezione (a)', as: 'a', variant: 'link', })} </div> `, }"
891
+ },
892
+ {
893
+ "kind": "variable",
894
+ "name": "TriggerClassi",
895
+ "type": {
896
+ "text": "Story"
897
+ },
898
+ "default": "{ name: 'Varianti del trigger', parameters: { docs: { description: { story: ` `, }, }, }, render: () => html` <div style=\"display:flex;flex-direction:column;gap:1rem\"> <div style=\"display:flex;flex-wrap:wrap;gap:1rem;flex-grow:1;\"> ${renderComponent({ label: 'Pulsante primary', variant: 'primary', as: 'button' })} ${renderComponent({ label: 'Pulsante secondary', variant: 'secondary', as: 'button' })} ${renderComponent({ label: 'Pulsante success', variant: 'success', as: 'button' })} ${renderComponent({ label: 'Pulsante danger', variant: 'danger', as: 'button' })} ${renderComponent({ label: 'Pulsante warning', variant: 'warning', as: 'button' })} ${renderComponent({ label: 'Pulsante link', variant: 'link', as: 'button' })} </div> <div style=\"display:flex;flex-wrap:wrap;gap:1rem;\"> ${renderComponent({ label: 'Pulsante outline primary', variant: 'primary', outline: true, as: 'button' })} ${renderComponent({ label: 'Pulsante outline secondary', variant: 'secondary', outline: true, as: 'button' })} ${renderComponent({ label: 'Pulsante outline success', variant: 'success', outline: true, as: 'button' })} ${renderComponent({ label: 'Pulsante outline danger', variant: 'danger', outline: true, as: 'button' })} ${renderComponent({ label: 'Pulsante outline warning', variant: 'warning', outline: true, as: 'button' })} </div> <div style=\"display:flex;flex-wrap:wrap;gap:1rem;\"> ${renderComponent({ label: 'Pulsante xs', size: 'xs', variant: 'primary', as: 'button' })} ${renderComponent({ label: 'Pulsante default', size: '', variant: 'primary', as: 'button' })} ${renderComponent({ label: 'Pulsante lg', size: 'lg', variant: 'primary', as: 'button' })} </div> </div> `, }"
899
+ },
900
+ {
901
+ "kind": "variable",
902
+ "name": "Aperto",
903
+ "type": {
904
+ "text": "Story"
905
+ },
906
+ "default": "{ name: 'Stato iniziale aperto', parameters: { docs: { description: { story: ` `, }, }, }, render: () => html` <div> ${renderComponent({ label: 'Apri sezione (espansa di default)', defaultOpen: true, as: 'button', })} ${renderComponent({ label: 'Apri sezione', as: 'button', })} </div> `, }"
907
+ },
908
+ {
909
+ "kind": "variable",
910
+ "name": "LinkCollapse",
911
+ "type": {
912
+ "text": "Story"
913
+ },
914
+ "default": "{ name: 'Link come trigger', parameters: { docs: { description: { story: ` `, }, }, }, render: () => html` ${renderComponent({ label: 'Link per aprire il collapse', as: 'a', })} `, }"
915
+ },
916
+ {
917
+ "kind": "variable",
918
+ "name": "TriggerPersonalizzato",
919
+ "type": {
920
+ "text": "Story"
921
+ },
922
+ "default": "{ name: 'Trigger personalizzato', parameters: { docs: { description: { story: ` `, }, }, }, render: () => html` <it-collapse> <button class=\"my-custom-collapse-button\" slot=\"trigger\"><span slot=\"label\">Trigger custom</span></button> <div slot=\"content\" style=\"padding: 1.5rem 1rem; background-color: #fff;\">${CONTENT}</div> </it-collapse> <style> .my-custom-collapse-button { background-color: #e0e0e0; border: none; padding: 10px 20px; border-radius: 4px; cursor: pointer; font-size: 1rem; } .my-custom-collapse-button:hover { background-color: #d5d5d5; } </style> `, }"
923
+ }
924
+ ],
925
+ "exports": [
926
+ {
927
+ "kind": "js",
928
+ "name": "default",
929
+ "declaration": {
930
+ "name": "meta",
931
+ "module": "stories/it-collapse.stories.ts"
932
+ }
933
+ },
934
+ {
935
+ "kind": "js",
936
+ "name": "Info",
937
+ "declaration": {
938
+ "name": "Info",
939
+ "module": "stories/it-collapse.stories.ts"
940
+ }
941
+ },
942
+ {
943
+ "kind": "js",
944
+ "name": "EsempioInterattivo",
945
+ "declaration": {
946
+ "name": "EsempioInterattivo",
947
+ "module": "stories/it-collapse.stories.ts"
948
+ }
949
+ },
950
+ {
951
+ "kind": "js",
952
+ "name": "PersonalizzazioneDegliStili",
953
+ "declaration": {
954
+ "name": "PersonalizzazioneDegliStili",
955
+ "module": "stories/it-collapse.stories.ts"
956
+ }
957
+ },
958
+ {
959
+ "kind": "js",
960
+ "name": "Comportamento",
961
+ "declaration": {
962
+ "name": "Comportamento",
963
+ "module": "stories/it-collapse.stories.ts"
964
+ }
965
+ },
966
+ {
967
+ "kind": "js",
968
+ "name": "TriggerClassi",
969
+ "declaration": {
970
+ "name": "TriggerClassi",
971
+ "module": "stories/it-collapse.stories.ts"
972
+ }
973
+ },
974
+ {
975
+ "kind": "js",
976
+ "name": "Aperto",
977
+ "declaration": {
978
+ "name": "Aperto",
979
+ "module": "stories/it-collapse.stories.ts"
980
+ }
981
+ },
982
+ {
983
+ "kind": "js",
984
+ "name": "LinkCollapse",
985
+ "declaration": {
986
+ "name": "LinkCollapse",
987
+ "module": "stories/it-collapse.stories.ts"
988
+ }
989
+ },
990
+ {
991
+ "kind": "js",
992
+ "name": "TriggerPersonalizzato",
993
+ "declaration": {
994
+ "name": "TriggerPersonalizzato",
995
+ "module": "stories/it-collapse.stories.ts"
996
+ }
997
+ }
998
+ ]
999
+ }
1000
+ ]
1001
+ }
@@ -0,0 +1,4 @@
1
+ export { ItCollapse } from './it-collapse.js';
2
+ export { ItCollapseBase } from './it-collapse-base.js';
3
+ export type { PressEvent, TriggerTag } from './types.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { I as ItCollapse, a as ItCollapseBase } from '../it-collapse--1EOUaR0.js';
2
+ import 'lit/decorators.js';
3
+ import 'lit/directive.js';
4
+ import 'lit';
5
+ import 'lit/directives/when.js';
6
+ import 'lit/static-html.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
@@ -0,0 +1,45 @@
1
+ import { BaseComponent } from '@italia/globals';
2
+ import { PressEvent } from './types.js';
3
+ export declare class ItCollapseBase extends BaseComponent {
4
+ static styles: import("lit").CSSResultGroup;
5
+ static shadowRootOptions: {
6
+ delegatesFocus: boolean;
7
+ clonable?: boolean;
8
+ customElementRegistry?: CustomElementRegistry;
9
+ mode: ShadowRootMode;
10
+ serializable?: boolean;
11
+ slotAssignment?: SlotAssignmentMode;
12
+ };
13
+ private variant;
14
+ private size;
15
+ private outline;
16
+ expanded: boolean;
17
+ protected isAccordion: boolean;
18
+ as: string;
19
+ defaultOpen: boolean;
20
+ contentElement: HTMLElement;
21
+ private triggerElements;
22
+ get triggerElement(): HTMLElement | null;
23
+ private isAnimating;
24
+ private animation?;
25
+ private readonly animationDuration;
26
+ protected _triggerId: string;
27
+ protected _contentId: string;
28
+ connectedCallback(): void;
29
+ protected handleTriggerAction: (e: PressEvent) => void;
30
+ toggle(): Promise<void>;
31
+ private setInitialState;
32
+ private cleanupAnimation;
33
+ firstUpdated(): void;
34
+ updated(changedProperties: Map<string | number | symbol, unknown>): void;
35
+ private updateAriaAttributes;
36
+ protected updateBackgroundStyles(): void;
37
+ private performExpand;
38
+ private performCollapse;
39
+ private _onTriggerSlotChange;
40
+ protected renderDefaultTrigger(): import("lit").TemplateResult<1>;
41
+ private hasSlottedTrigger;
42
+ protected isValidTag(tag: string): boolean;
43
+ render(): import("lit").TemplateResult<1>;
44
+ }
45
+ //# sourceMappingURL=it-collapse-base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"it-collapse-base.d.ts","sourceRoot":"","sources":["../../src/it-collapse-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAOhD,OAAO,EAAiC,UAAU,EAAE,MAAM,YAAY,CAAC;AAIvE,qBAAa,cAAe,SAAQ,aAAa;IAC/C,MAAM,CAAC,MAAM,+BAAU;IAEvB,OAAgB,iBAAiB;;;;;;;MAG/B;IAEyC,OAAO,CAAC,OAAO,CAAa;IAE5B,OAAO,CAAC,IAAI,CAAM;IAEjB,OAAO,CAAC,OAAO,CAAS;IAGpE,QAAQ,UAAS;IAEjB,SAAS,CAAC,WAAW,EAAE,OAAO,CAAS;IAGvC,EAAE,EAAE,MAAM,CAAY;IAGtB,WAAW,UAAS;IAGpB,cAAc,EAAG,WAAW,CAAC;IAG7B,OAAO,CAAC,eAAe,CAAiB;IAExC,IAAI,cAAc,IAAI,WAAW,GAAG,IAAI,CAEvC;IAED,OAAO,CAAC,WAAW,CAAS;IAE5B,OAAO,CAAC,SAAS,CAAC,CAAY;IAE9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAO;IAEzC,SAAS,CAAC,UAAU,SAA0C;IAE9D,SAAS,CAAC,UAAU,SAA0C;IAErD,iBAAiB;IAQ1B,SAAS,CAAC,mBAAmB,GAAI,GAAG,UAAU,UAa5C;IAEI,MAAM;IAmBZ,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,gBAAgB;IAYf,YAAY;IAMZ,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAgCjF,OAAO,CAAC,oBAAoB;IAwB5B,SAAS,CAAC,sBAAsB;IAEhC,OAAO,CAAC,aAAa;IAgCrB,OAAO,CAAC,eAAe;IAkCvB,OAAO,CAAC,oBAAoB,CAK1B;IAEF,SAAS,CAAC,oBAAoB;IAmC9B,OAAO,CAAC,iBAAiB;IAKzB,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM;IAKhC,MAAM;CA0BP"}
@@ -0,0 +1,9 @@
1
+ import { ItCollapseBase } from './it-collapse-base.js';
2
+ export declare class ItCollapse extends ItCollapseBase {
3
+ }
4
+ declare global {
5
+ interface HTMLElementTagNameMap {
6
+ 'it-collapse': ItCollapse;
7
+ }
8
+ }
9
+ //# sourceMappingURL=it-collapse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"it-collapse.d.ts","sourceRoot":"","sources":["../../src/it-collapse.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGvD,qBACa,UAAW,SAAQ,cAAc;CAE7C;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
@@ -0,0 +1,7 @@
1
+ export { I as ItCollapse } from '../it-collapse--1EOUaR0.js';
2
+ import 'lit/decorators.js';
3
+ import 'lit/directive.js';
4
+ import 'lit';
5
+ import 'lit/directives/when.js';
6
+ import 'lit/static-html.js';
7
+ //# sourceMappingURL=it-collapse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"it-collapse.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
@@ -0,0 +1,5 @@
1
+ export type TriggerTag = keyof HTMLElementTagNameMap;
2
+ export type PressEvent = MouseEvent | KeyboardEvent | PointerEvent;
3
+ export declare const isMouseEvent: (event: PressEvent) => event is MouseEvent;
4
+ export declare const isKeyboardEvent: (event: PressEvent) => event is KeyboardEvent;
5
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,MAAM,qBAAqB,CAAC;AACrD,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,aAAa,GAAG,YAAY,CAAC;AACnE,eAAO,MAAM,YAAY,GAAI,OAAO,UAAU,KAAG,KAAK,IAAI,UAAyC,CAAC;AACpG,eAAO,MAAM,eAAe,GAAI,OAAO,UAAU,KAAG,KAAK,IAAI,aAA+C,CAAC"}
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@italia/collapse",
3
+ "description": "Web component it-collapse del Design system .italia",
4
+ "version": "1.0.0-alpha.4",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "license": "BSD-3-Clause",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/italia/dev-kit-italia.git",
12
+ "directory": "packages/collapse"
13
+ },
14
+ "author": "Presidenza del Consiglio dei Ministri",
15
+ "homepage": "https://italia.github.io/dev-kit-italia",
16
+ "bugs": {
17
+ "url": "https://github.com/italia/dev-kit-italia/issues"
18
+ },
19
+ "type": "module",
20
+ "main": "./dist/src/index.js",
21
+ "module": "./dist/src/index.js",
22
+ "types": "./dist/src/it-collapse.d.ts",
23
+ "exports": {
24
+ ".": "./dist/src/index.js",
25
+ "./it-collapse.js": "./dist/src/it-collapse.js",
26
+ "./it-collapse-base.js": "./dist/src/it-collapse-base.js",
27
+ "./styles/*": "./styles/*"
28
+ },
29
+ "files": [
30
+ "dist/src",
31
+ "README.md",
32
+ "AUTHORS",
33
+ "LICENSE",
34
+ "custom-elements.json",
35
+ "styles"
36
+ ],
37
+ "dependencies": {
38
+ "bootstrap-italia": "github:italia/bootstrap-italia#ba6eddb24194f44d1080deb24701e0603457d176",
39
+ "lit": "^3.3.0",
40
+ "@italia/globals": "^1.0.0-alpha.4"
41
+ },
42
+ "devDependencies": {
43
+ "@custom-elements-manifest/analyzer": "^0.10.3",
44
+ "@open-wc/testing": "^4.0.0",
45
+ "@rollup/plugin-node-resolve": "^16.0.1",
46
+ "@rollup/plugin-typescript": "^12.1.2",
47
+ "@types/mocha": "^10.0.10",
48
+ "@web/test-runner": "^0.18.2",
49
+ "rollup": "^4.42.0",
50
+ "rollup-plugin-scss-lit": "^2.1.0",
51
+ "sass": "^1.89.0",
52
+ "tslib": "^2.6.3",
53
+ "typescript": "^5.5.3",
54
+ "@italia/icon": "^1.0.0-alpha.4",
55
+ "@italia/button": "^1.0.0-alpha.4",
56
+ "@italia/test-config": "^0.0.0",
57
+ "@italia/typescript-config": "^0.0.0"
58
+ },
59
+ "customElements": "custom-elements.json",
60
+ "scripts": {
61
+ "analyze": "cem analyze --litelement --exclude dist",
62
+ "build": "rollup --config rollup.config.js",
63
+ "clean": "rimraf node_modules .turbo .rollup.cache dist coverage",
64
+ "lint": "eslint --ext .ts \"src/**/*.ts\" \"stories/**/*.ts\" \"test/**/*.ts\" && prettier \"src/**/*.ts\" \"stories/**/*.ts\" \"test/**/*.ts\" --check",
65
+ "format": "eslint --ext .ts \"src/**/*.ts\" \"stories/**/*.ts\" \"test/**/*.ts\" --fix && prettier \"src/**/*.ts\" \"stories/**/*.ts\" \"test/**/*.ts\" --write",
66
+ "test": "wtr --coverage --node-resolve --config web-test-runner.config.js"
67
+ }
68
+ }
@@ -0,0 +1,24 @@
1
+ it-collapse {
2
+ &:not(:defined) {
3
+ [slot='content'] {
4
+ display: block;
5
+ }
6
+
7
+ [slot='label'] {
8
+ display: inline-flex;
9
+ height: 44.8px;
10
+ align-items: center;
11
+ padding: 0 1rem;
12
+ border-radius: var(--bs-btn-border-radius, 4px);
13
+ }
14
+
15
+ &:not([default-open]) {
16
+ [slot='content'] {
17
+ height: 0 !important;
18
+ padding: 0 !important;
19
+ visibility: hidden;
20
+ width: 0;
21
+ }
22
+ }
23
+ }
24
+ }