desy-html 4.1.3 → 5.0.1
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/docs/_include.template-header.njk +47 -47
- package/docs/ds/_ds.example.header.njk +1 -1
- package/docs/ds/_ds.example.menubar-en-uso.njk +6 -18
- package/docs/ds/_ds.example.menubar-variaciones.njk +51 -121
- package/docs/index.html +25 -0
- package/package.json +1 -1
- package/src/js/desy-html.js +63 -4
- package/src/templates/components/alert/_template.alert.njk +2 -2
- package/src/templates/components/checkboxes/_examples.checkboxes.njk +22 -0
- package/src/templates/components/checkboxes/_template.checkboxes.njk +4 -3
- package/src/templates/components/checkboxes/params.checkboxes.yaml +8 -0
- package/src/templates/components/description-list/_examples.description-list.njk +63 -0
- package/src/templates/components/dropdown/_styles.dropdown.css +1 -0
- package/src/templates/components/dropdown/params.dropdown.yaml +6 -6
- package/src/templates/components/header/_examples.header.njk +35 -3
- package/src/templates/components/header/_template.header.header__dropdown.njk +17 -18
- package/src/templates/components/header/_template.header.header__offcanvas.njk +1 -1
- package/src/templates/components/header/_template.header.header__subnav.njk +16 -20
- package/src/templates/components/header/_template.header.njk +42 -30
- package/src/templates/components/header/params.header.yaml +45 -5
- package/src/templates/components/menu-horizontal/_examples.menu-horizontal.njk +2 -1
- package/src/templates/components/menu-horizontal/_template.menu-horizontal.njk +1 -1
- package/src/templates/components/menubar/_examples.menubar.njk +349 -143
- package/src/templates/components/menubar/_styles.menubar.css +1 -0
- package/src/templates/components/menubar/_template.menubar.njk +2 -2
- package/src/templates/components/menubar/params.menubar.yaml +8 -0
|
@@ -6,13 +6,14 @@
|
|
|
6
6
|
</div>
|
|
7
7
|
<div class="col-span-4">
|
|
8
8
|
{{ componentMenubar({
|
|
9
|
-
"id": "with-all-parent-items",
|
|
9
|
+
"id": "with-all-parent-items-1",
|
|
10
10
|
"idPrefix": "parent-example",
|
|
11
|
+
"ariaLabel":"Menubar description",
|
|
11
12
|
"items": [
|
|
12
13
|
{
|
|
13
14
|
"text": "Menuitem",
|
|
14
15
|
"ariaLabel": "Menuitem",
|
|
15
|
-
"id": "menuitems-example-item-1",
|
|
16
|
+
"id": "menuitems-example-item-1-1",
|
|
16
17
|
"sub": {
|
|
17
18
|
"items": [
|
|
18
19
|
{
|
|
@@ -27,17 +28,14 @@
|
|
|
27
28
|
"role": "menuitem",
|
|
28
29
|
"text": "Subitem 3"
|
|
29
30
|
}
|
|
30
|
-
]
|
|
31
|
-
"attributes": {
|
|
32
|
-
"aria-labelledby": "menuitems-example-item-1"
|
|
33
|
-
}
|
|
31
|
+
]
|
|
34
32
|
},
|
|
35
33
|
"classes": "mb-base mr-base"
|
|
36
34
|
},
|
|
37
35
|
{
|
|
38
36
|
"text": "Menuitemcheckbox",
|
|
39
37
|
"ariaLabel": "Menuitemcheckbox",
|
|
40
|
-
"id": "menuitems-example-item-2",
|
|
38
|
+
"id": "menuitems-example-item-2-1",
|
|
41
39
|
"classes": "mb-base mr-base",
|
|
42
40
|
"sub": {
|
|
43
41
|
"items": [
|
|
@@ -53,21 +51,18 @@
|
|
|
53
51
|
"role": "menuitemcheckbox",
|
|
54
52
|
"text": "Subitem 3"
|
|
55
53
|
}
|
|
56
|
-
]
|
|
57
|
-
"attributes": {
|
|
58
|
-
"aria-labelledby": "menuitems-example-item-2"
|
|
59
|
-
}
|
|
54
|
+
]
|
|
60
55
|
}
|
|
61
56
|
},
|
|
62
57
|
{
|
|
63
58
|
"text": "Menuitemradio",
|
|
64
59
|
"ariaLabel": "Menuitemradio",
|
|
65
|
-
"id": "menuitems-example-item-3",
|
|
60
|
+
"id": "menuitems-example-item-3-1",
|
|
66
61
|
"sub": {
|
|
67
62
|
"items": [
|
|
68
63
|
{
|
|
69
64
|
"role": "group",
|
|
70
|
-
"
|
|
65
|
+
"ariaLabel": "group label",
|
|
71
66
|
"items": [
|
|
72
67
|
{
|
|
73
68
|
"role": "menuitemradio",
|
|
@@ -83,17 +78,14 @@
|
|
|
83
78
|
}
|
|
84
79
|
]
|
|
85
80
|
}
|
|
86
|
-
]
|
|
87
|
-
"attributes": {
|
|
88
|
-
"aria-labelledby": "menuitems-example-item-3"
|
|
89
|
-
}
|
|
81
|
+
]
|
|
90
82
|
},
|
|
91
83
|
"classes": "mb-base mr-base"
|
|
92
84
|
},
|
|
93
85
|
{
|
|
94
86
|
"text": "Mixed items",
|
|
95
87
|
"ariaLabel": "Mixeditems",
|
|
96
|
-
"id": "menuitems-example-item-4",
|
|
88
|
+
"id": "menuitems-example-item-4-1",
|
|
97
89
|
"sub": {
|
|
98
90
|
"items": [
|
|
99
91
|
{
|
|
@@ -148,24 +140,18 @@
|
|
|
148
140
|
}
|
|
149
141
|
]
|
|
150
142
|
}
|
|
151
|
-
]
|
|
152
|
-
"attributes": {
|
|
153
|
-
"aria-labelledby": "menuitems-example-item-4"
|
|
154
|
-
}
|
|
143
|
+
]
|
|
155
144
|
},
|
|
156
145
|
"classes": "mb-base mr-base"
|
|
157
146
|
},
|
|
158
147
|
{
|
|
159
148
|
"text": "Menuitem solo",
|
|
160
149
|
"ariaLabel": "Menuitem solo",
|
|
161
|
-
"id": "menuitems-example-item-6",
|
|
150
|
+
"id": "menuitems-example-item-6-1",
|
|
162
151
|
"classes": "c-menubar__button--transparent mb-base mr-base",
|
|
163
152
|
"href": "#"
|
|
164
153
|
}
|
|
165
|
-
]
|
|
166
|
-
"attributes": {
|
|
167
|
-
"aria-label": "Menubar description of use"
|
|
168
|
-
}
|
|
154
|
+
]
|
|
169
155
|
}) }}
|
|
170
156
|
</div>
|
|
171
157
|
</div>
|
|
@@ -177,6 +163,7 @@
|
|
|
177
163
|
{{ componentMenubar({
|
|
178
164
|
"id": "transparent-items",
|
|
179
165
|
"idPrefix": "transparent-example",
|
|
166
|
+
"ariaLabel":"Menubar description",
|
|
180
167
|
"items": [
|
|
181
168
|
{
|
|
182
169
|
"text": "Menuitem",
|
|
@@ -196,10 +183,7 @@
|
|
|
196
183
|
"role": "menuitem",
|
|
197
184
|
"text": "Subitem 3"
|
|
198
185
|
}
|
|
199
|
-
]
|
|
200
|
-
"attributes": {
|
|
201
|
-
"aria-labelledby": "transparent-example-item-1"
|
|
202
|
-
}
|
|
186
|
+
]
|
|
203
187
|
},
|
|
204
188
|
"classes": "c-menubar__button--transparent mb-sm mr-sm"
|
|
205
189
|
},
|
|
@@ -223,10 +207,7 @@
|
|
|
223
207
|
"role": "menuitemcheckbox",
|
|
224
208
|
"text": "Subitem 3"
|
|
225
209
|
}
|
|
226
|
-
]
|
|
227
|
-
"attributes": {
|
|
228
|
-
"aria-labelledby": "transparent-example-item-2"
|
|
229
|
-
}
|
|
210
|
+
]
|
|
230
211
|
}
|
|
231
212
|
},
|
|
232
213
|
{
|
|
@@ -237,7 +218,7 @@
|
|
|
237
218
|
"items": [
|
|
238
219
|
{
|
|
239
220
|
"role": "group",
|
|
240
|
-
"
|
|
221
|
+
"ariaLabel": "group label",
|
|
241
222
|
"items": [
|
|
242
223
|
{
|
|
243
224
|
"role": "menuitemradio",
|
|
@@ -254,10 +235,7 @@
|
|
|
254
235
|
}
|
|
255
236
|
]
|
|
256
237
|
}
|
|
257
|
-
]
|
|
258
|
-
"attributes": {
|
|
259
|
-
"aria-labelledby": "transparent-example-item-3"
|
|
260
|
-
}
|
|
238
|
+
]
|
|
261
239
|
},
|
|
262
240
|
"classes": "c-menubar__button--transparent mb-sm mr-sm"
|
|
263
241
|
},
|
|
@@ -319,10 +297,7 @@
|
|
|
319
297
|
}
|
|
320
298
|
]
|
|
321
299
|
}
|
|
322
|
-
]
|
|
323
|
-
"attributes": {
|
|
324
|
-
"aria-labelledby": "transparent-example-item-4"
|
|
325
|
-
}
|
|
300
|
+
]
|
|
326
301
|
},
|
|
327
302
|
"classes": "c-menubar__button--transparent mb-sm mr-sm"
|
|
328
303
|
},
|
|
@@ -333,10 +308,7 @@
|
|
|
333
308
|
"classes": "c-menubar__button--transparent mb-sm mr-sm",
|
|
334
309
|
"href": "#"
|
|
335
310
|
}
|
|
336
|
-
]
|
|
337
|
-
"attributes": {
|
|
338
|
-
"aria-label": "Menubar description of use"
|
|
339
|
-
}
|
|
311
|
+
]
|
|
340
312
|
}) }}
|
|
341
313
|
</div>
|
|
342
314
|
</div>
|
|
@@ -348,6 +320,7 @@
|
|
|
348
320
|
{{ componentMenubar({
|
|
349
321
|
"id": "header-items",
|
|
350
322
|
"idPrefix": "header-example",
|
|
323
|
+
"ariaLabel":"Menubar description",
|
|
351
324
|
"items": [
|
|
352
325
|
{
|
|
353
326
|
"text": "Menuitem",
|
|
@@ -367,10 +340,7 @@
|
|
|
367
340
|
"role": "menuitem",
|
|
368
341
|
"text": "Subitem 3"
|
|
369
342
|
}
|
|
370
|
-
]
|
|
371
|
-
"attributes": {
|
|
372
|
-
"aria-labelledby": "header-example-item-1"
|
|
373
|
-
}
|
|
343
|
+
]
|
|
374
344
|
},
|
|
375
345
|
"classes": "c-menubar__button--header mr-base"
|
|
376
346
|
},
|
|
@@ -394,10 +364,7 @@
|
|
|
394
364
|
"role": "menuitemcheckbox",
|
|
395
365
|
"text": "Subitem 3"
|
|
396
366
|
}
|
|
397
|
-
]
|
|
398
|
-
"attributes": {
|
|
399
|
-
"aria-labelledby": "header-example-item-2"
|
|
400
|
-
}
|
|
367
|
+
]
|
|
401
368
|
}
|
|
402
369
|
},
|
|
403
370
|
{
|
|
@@ -408,7 +375,7 @@
|
|
|
408
375
|
"items": [
|
|
409
376
|
{
|
|
410
377
|
"role": "group",
|
|
411
|
-
"
|
|
378
|
+
"ariaLabel": "group label",
|
|
412
379
|
"items": [
|
|
413
380
|
{
|
|
414
381
|
"role": "menuitemradio",
|
|
@@ -425,10 +392,7 @@
|
|
|
425
392
|
}
|
|
426
393
|
]
|
|
427
394
|
}
|
|
428
|
-
]
|
|
429
|
-
"attributes": {
|
|
430
|
-
"aria-labelledby": "header-example-item-3"
|
|
431
|
-
}
|
|
395
|
+
]
|
|
432
396
|
},
|
|
433
397
|
"classes": "c-menubar__button--header mr-base"
|
|
434
398
|
},
|
|
@@ -490,10 +454,7 @@
|
|
|
490
454
|
}
|
|
491
455
|
]
|
|
492
456
|
}
|
|
493
|
-
]
|
|
494
|
-
"attributes": {
|
|
495
|
-
"aria-labelledby": "header-example-item-4"
|
|
496
|
-
}
|
|
457
|
+
]
|
|
497
458
|
},
|
|
498
459
|
"classes": "c-menubar__button--header mr-base"
|
|
499
460
|
},
|
|
@@ -505,10 +466,7 @@
|
|
|
505
466
|
"href": "#"
|
|
506
467
|
}
|
|
507
468
|
],
|
|
508
|
-
"classes": "bg-black"
|
|
509
|
-
"attributes": {
|
|
510
|
-
"aria-label": "Menubar description of use"
|
|
511
|
-
}
|
|
469
|
+
"classes": "bg-black"
|
|
512
470
|
}) }}
|
|
513
471
|
</div>
|
|
514
472
|
</div>
|
|
@@ -520,6 +478,7 @@
|
|
|
520
478
|
{{ componentMenubar({
|
|
521
479
|
"id": "small-items",
|
|
522
480
|
"idPrefix": "small-example",
|
|
481
|
+
"ariaLabel":"Menubar description",
|
|
523
482
|
"items": [
|
|
524
483
|
{
|
|
525
484
|
"text": "Menuitem",
|
|
@@ -539,10 +498,7 @@
|
|
|
539
498
|
"role": "menuitem",
|
|
540
499
|
"text": "Subitem 3"
|
|
541
500
|
}
|
|
542
|
-
]
|
|
543
|
-
"attributes": {
|
|
544
|
-
"aria-labelledby": "small-example-item-1"
|
|
545
|
-
}
|
|
501
|
+
]
|
|
546
502
|
},
|
|
547
503
|
"classes": "c-menubar__button--sm mb-sm mr-sm"
|
|
548
504
|
},
|
|
@@ -566,10 +522,7 @@
|
|
|
566
522
|
"role": "menuitemcheckbox",
|
|
567
523
|
"text": "Subitem 3"
|
|
568
524
|
}
|
|
569
|
-
]
|
|
570
|
-
"attributes": {
|
|
571
|
-
"aria-labelledby": "small-example-item-2"
|
|
572
|
-
}
|
|
525
|
+
]
|
|
573
526
|
}
|
|
574
527
|
},
|
|
575
528
|
{
|
|
@@ -580,7 +533,7 @@
|
|
|
580
533
|
"items": [
|
|
581
534
|
{
|
|
582
535
|
"role": "group",
|
|
583
|
-
"
|
|
536
|
+
"ariaLabel": "group label",
|
|
584
537
|
"items": [
|
|
585
538
|
{
|
|
586
539
|
"role": "menuitemradio",
|
|
@@ -597,10 +550,7 @@
|
|
|
597
550
|
}
|
|
598
551
|
]
|
|
599
552
|
}
|
|
600
|
-
]
|
|
601
|
-
"attributes": {
|
|
602
|
-
"aria-labelledby": "small-example-item-3"
|
|
603
|
-
}
|
|
553
|
+
]
|
|
604
554
|
},
|
|
605
555
|
"classes": "c-menubar__button--sm mb-sm mr-sm"
|
|
606
556
|
},
|
|
@@ -662,10 +612,7 @@
|
|
|
662
612
|
}
|
|
663
613
|
]
|
|
664
614
|
}
|
|
665
|
-
]
|
|
666
|
-
"attributes": {
|
|
667
|
-
"aria-labelledby": "small-example-item-4"
|
|
668
|
-
}
|
|
615
|
+
]
|
|
669
616
|
},
|
|
670
617
|
"classes": "c-menubar__button--sm mb-sm mr-sm"
|
|
671
618
|
},
|
|
@@ -676,10 +623,7 @@
|
|
|
676
623
|
"classes": "c-menubar__button--transparent c-menubar__button--sm mb-sm mr-sm",
|
|
677
624
|
"href": "#"
|
|
678
625
|
}
|
|
679
|
-
]
|
|
680
|
-
"attributes": {
|
|
681
|
-
"aria-label": "Menubar description of use"
|
|
682
|
-
}
|
|
626
|
+
]
|
|
683
627
|
}) }}
|
|
684
628
|
</div>
|
|
685
629
|
</div>
|
|
@@ -689,13 +633,14 @@
|
|
|
689
633
|
</div>
|
|
690
634
|
<div class="col-span-4">
|
|
691
635
|
{{ componentMenubar({
|
|
692
|
-
"id": "
|
|
693
|
-
"idPrefix": "
|
|
636
|
+
"id": "small-items-selection",
|
|
637
|
+
"idPrefix": "small-example-selection",
|
|
638
|
+
"ariaLabel":"Menubar description",
|
|
694
639
|
"items": [
|
|
695
640
|
{
|
|
696
641
|
"text": "Menuitem",
|
|
697
642
|
"ariaLabel": "Menuitem",
|
|
698
|
-
"id": "
|
|
643
|
+
"id": "small-example-selection-item-1",
|
|
699
644
|
"sub": {
|
|
700
645
|
"items": [
|
|
701
646
|
{
|
|
@@ -710,18 +655,15 @@
|
|
|
710
655
|
"role": "menuitem",
|
|
711
656
|
"text": "Subitem 3"
|
|
712
657
|
}
|
|
713
|
-
]
|
|
714
|
-
"attributes": {
|
|
715
|
-
"aria-labelledby": "menuitems-example-item-1"
|
|
716
|
-
}
|
|
658
|
+
]
|
|
717
659
|
},
|
|
718
|
-
"classes": "c-menubar__button--sm mb-sm mr-sm"
|
|
660
|
+
"classes": "c-menubar__button--has-selection c-menubar__button--sm mb-sm mr-sm"
|
|
719
661
|
},
|
|
720
662
|
{
|
|
721
663
|
"text": "Menuitemcheckbox",
|
|
722
664
|
"ariaLabel": "Menuitemcheckbox",
|
|
723
|
-
"id": "
|
|
724
|
-
"classes": "c-menubar__button--
|
|
665
|
+
"id": "small-example-selection-item-2",
|
|
666
|
+
"classes": "c-menubar__button--sm mb-sm mr-sm",
|
|
725
667
|
"sub": {
|
|
726
668
|
"items": [
|
|
727
669
|
{
|
|
@@ -737,21 +679,18 @@
|
|
|
737
679
|
"role": "menuitemcheckbox",
|
|
738
680
|
"text": "Subitem 3"
|
|
739
681
|
}
|
|
740
|
-
]
|
|
741
|
-
"attributes": {
|
|
742
|
-
"aria-labelledby": "menuitems-example-item-2"
|
|
743
|
-
}
|
|
682
|
+
]
|
|
744
683
|
}
|
|
745
684
|
},
|
|
746
685
|
{
|
|
747
686
|
"text": "Menuitemradio",
|
|
748
687
|
"ariaLabel": "Menuitemradio",
|
|
749
|
-
"id": "
|
|
688
|
+
"id": "small-example-selection-item-3",
|
|
750
689
|
"sub": {
|
|
751
690
|
"items": [
|
|
752
691
|
{
|
|
753
692
|
"role": "group",
|
|
754
|
-
"
|
|
693
|
+
"ariaLabel": "group label",
|
|
755
694
|
"items": [
|
|
756
695
|
{
|
|
757
696
|
"role": "menuitemradio",
|
|
@@ -768,17 +707,14 @@
|
|
|
768
707
|
}
|
|
769
708
|
]
|
|
770
709
|
}
|
|
771
|
-
]
|
|
772
|
-
"attributes": {
|
|
773
|
-
"aria-labelledby": "menuitems-example-item-3"
|
|
774
|
-
}
|
|
710
|
+
]
|
|
775
711
|
},
|
|
776
712
|
"classes": "c-menubar__button--has-selection c-menubar__button--sm mb-sm mr-sm"
|
|
777
713
|
},
|
|
778
714
|
{
|
|
779
715
|
"text": "Mixed items",
|
|
780
716
|
"ariaLabel": "Mixeditems",
|
|
781
|
-
"id": "
|
|
717
|
+
"id": "small-example-selection-item-4",
|
|
782
718
|
"sub": {
|
|
783
719
|
"items": [
|
|
784
720
|
{
|
|
@@ -833,24 +769,18 @@
|
|
|
833
769
|
}
|
|
834
770
|
]
|
|
835
771
|
}
|
|
836
|
-
]
|
|
837
|
-
"attributes": {
|
|
838
|
-
"aria-labelledby": "menuitems-example-item-4"
|
|
839
|
-
}
|
|
772
|
+
]
|
|
840
773
|
},
|
|
841
|
-
"classes": "c-menubar__button--
|
|
774
|
+
"classes": "c-menubar__button--sm mb-sm mr-sm"
|
|
842
775
|
},
|
|
843
776
|
{
|
|
844
777
|
"text": "Menuitem solo",
|
|
845
778
|
"ariaLabel": "Menuitem solo",
|
|
846
|
-
"id": "
|
|
779
|
+
"id": "small-example-selection-item-6",
|
|
847
780
|
"classes": "c-menubar__button--transparent c-menubar__button--sm mb-sm mr-sm",
|
|
848
781
|
"href": "#"
|
|
849
782
|
}
|
|
850
|
-
]
|
|
851
|
-
"attributes": {
|
|
852
|
-
"aria-label": "Menubar description of use"
|
|
853
|
-
}
|
|
783
|
+
]
|
|
854
784
|
}) }}
|
|
855
785
|
</div>
|
|
856
786
|
</div>
|
package/docs/index.html
CHANGED
|
@@ -38,6 +38,31 @@
|
|
|
38
38
|
|
|
39
39
|
<h2>Changelog (English)</h2>
|
|
40
40
|
<p>What's new in the latest version of desy-html</p>
|
|
41
|
+
<h3>v.5.0.1</h3>
|
|
42
|
+
<ul class="text-sm">
|
|
43
|
+
<li>Fixed accesibility bad semantics in subnav. Added dropdown contentHtml rendering and example.</li>
|
|
44
|
+
</ul><h3>v.5.0.0</h3>
|
|
45
|
+
<ul class="text-sm">
|
|
46
|
+
<li>Header now uses correct dropdown params.</li>
|
|
47
|
+
</ul>
|
|
48
|
+
<h3>v.4.3.0</h3>
|
|
49
|
+
<ul class="text-sm">
|
|
50
|
+
<li>Added disabled and active param in menubar and fixed accesibility issues.</li>
|
|
51
|
+
<li>Accesibility fixes in menu horizontal.</li>
|
|
52
|
+
<li>Minor improvements in documentation.</li>
|
|
53
|
+
</ul>
|
|
54
|
+
<h3>v.4.2.1</h3>
|
|
55
|
+
<ul class="text-sm">
|
|
56
|
+
<li>Minor fixes.</li>
|
|
57
|
+
</ul>
|
|
58
|
+
<h3>v.4.2.0</h3>
|
|
59
|
+
<ul class="text-sm">
|
|
60
|
+
<li>Checkboxes can be indeterminate at init.</li>
|
|
61
|
+
<li>Fixes in alert. Now it's read by screen readers.</li>
|
|
62
|
+
<li>Header now uses dropdowns.</li>
|
|
63
|
+
<li>Dropdowns, listboxes and tooltips now closes when loosing focus.</li>
|
|
64
|
+
<li>Minor improvements in documentation.</li>
|
|
65
|
+
</ul>
|
|
41
66
|
<h3>v.4.1.3</h3>
|
|
42
67
|
<ul class="text-sm">
|
|
43
68
|
<li>Minor improvements.</li>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "desy-html",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "desy-html contains the code you need to start building a user interface for Gobierno de Aragón government webapps.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Desy (SDA Servicios Digitales de Aragón)",
|
package/src/js/desy-html.js
CHANGED
|
@@ -34,6 +34,26 @@ export function dropdownComponent(aria) {
|
|
|
34
34
|
const buttonDropdown = modules[item].querySelector('[data-module = "c-dropdown-button"]');
|
|
35
35
|
const tooltip = modules[item].querySelector('[data-module = "c-dropdown-tooltip"]');
|
|
36
36
|
if(buttonDropdown && tooltip) {
|
|
37
|
+
const hideOnPopperBlur = {
|
|
38
|
+
/* https://atomiks.github.io/tippyjs/v6/plugins/#hideonpopperblur */
|
|
39
|
+
name: 'hideOnPopperBlur',
|
|
40
|
+
defaultValue: true,
|
|
41
|
+
fn(instance) {
|
|
42
|
+
return {
|
|
43
|
+
onCreate() {
|
|
44
|
+
instance.popper.addEventListener('focusout', (event) => {
|
|
45
|
+
if (
|
|
46
|
+
instance.props.hideOnPopperBlur &&
|
|
47
|
+
event.relatedTarget &&
|
|
48
|
+
!instance.popper.contains(event.relatedTarget)
|
|
49
|
+
) {
|
|
50
|
+
instance.hide();
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
};
|
|
37
57
|
const hideOnEsc = {
|
|
38
58
|
/* https://atomiks.github.io/tippyjs/v6/plugins/#hideonesc */
|
|
39
59
|
name: 'hideOnEsc',
|
|
@@ -68,7 +88,7 @@ export function dropdownComponent(aria) {
|
|
|
68
88
|
arrow: false,
|
|
69
89
|
offset: [0, -10],
|
|
70
90
|
theme: '',
|
|
71
|
-
plugins: [hideOnEsc],
|
|
91
|
+
plugins: [hideOnEsc,hideOnPopperBlur],
|
|
72
92
|
role: false,
|
|
73
93
|
aria: {
|
|
74
94
|
content: 'auto'
|
|
@@ -96,7 +116,26 @@ export function listboxComponent(aria) {
|
|
|
96
116
|
|
|
97
117
|
if(buttonListbox && tooltip) {
|
|
98
118
|
const listbox = new aria.Listbox(list);
|
|
99
|
-
|
|
119
|
+
const hideOnPopperBlur = {
|
|
120
|
+
/* https://atomiks.github.io/tippyjs/v6/plugins/#hideonpopperblur */
|
|
121
|
+
name: 'hideOnPopperBlur',
|
|
122
|
+
defaultValue: true,
|
|
123
|
+
fn(instance) {
|
|
124
|
+
return {
|
|
125
|
+
onCreate() {
|
|
126
|
+
instance.popper.addEventListener('focusout', (event) => {
|
|
127
|
+
if (
|
|
128
|
+
instance.props.hideOnPopperBlur &&
|
|
129
|
+
event.relatedTarget &&
|
|
130
|
+
!instance.popper.contains(event.relatedTarget)
|
|
131
|
+
) {
|
|
132
|
+
instance.hide();
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
},
|
|
138
|
+
};
|
|
100
139
|
const hideOnEscOrEnter = {
|
|
101
140
|
/* https://atomiks.github.io/tippyjs/v6/plugins/#hideonesc */
|
|
102
141
|
name: 'hideOnEsc',
|
|
@@ -131,7 +170,7 @@ export function listboxComponent(aria) {
|
|
|
131
170
|
arrow: false,
|
|
132
171
|
offset: [0, -10],
|
|
133
172
|
theme: '',
|
|
134
|
-
plugins: [hideOnEscOrEnter],
|
|
173
|
+
plugins: [hideOnEscOrEnter,hideOnPopperBlur],
|
|
135
174
|
role: false,
|
|
136
175
|
aria: {
|
|
137
176
|
content: 'auto'
|
|
@@ -210,6 +249,26 @@ export function tooltipComponent(aria) {
|
|
|
210
249
|
const ariaContent = tooltipButton.matches('[data-type = "c-tooltip-button-complex"]') ? 'describedby' : 'labelledby';
|
|
211
250
|
const tooltipTooltip = modules[item].querySelector('[data-module = "c-tooltip-tooltip"]');
|
|
212
251
|
if(tooltipButton && tooltipTooltip) {
|
|
252
|
+
const hideOnPopperBlur = {
|
|
253
|
+
/* https://atomiks.github.io/tippyjs/v6/plugins/#hideonpopperblur */
|
|
254
|
+
name: 'hideOnPopperBlur',
|
|
255
|
+
defaultValue: true,
|
|
256
|
+
fn(instance) {
|
|
257
|
+
return {
|
|
258
|
+
onCreate() {
|
|
259
|
+
instance.popper.addEventListener('focusout', (event) => {
|
|
260
|
+
if (
|
|
261
|
+
instance.props.hideOnPopperBlur &&
|
|
262
|
+
event.relatedTarget &&
|
|
263
|
+
!instance.popper.contains(event.relatedTarget)
|
|
264
|
+
) {
|
|
265
|
+
instance.hide();
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
},
|
|
269
|
+
};
|
|
270
|
+
},
|
|
271
|
+
};
|
|
213
272
|
const hideOnEsc = {
|
|
214
273
|
/* https://atomiks.github.io/tippyjs/v6/plugins/#hideonesc */
|
|
215
274
|
name: 'hideOnEsc',
|
|
@@ -241,7 +300,7 @@ export function tooltipComponent(aria) {
|
|
|
241
300
|
trigger: 'mouseenter focus',
|
|
242
301
|
hideOnClick: false,
|
|
243
302
|
theme: '',
|
|
244
|
-
plugins: [hideOnEsc],
|
|
303
|
+
plugins: [hideOnEsc,hideOnPopperBlur],
|
|
245
304
|
role: 'tooltip',
|
|
246
305
|
aria: {
|
|
247
306
|
content: ariaContent
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
{{ componentButton(params.button) }}
|
|
6
6
|
<div id="{{ params.id }}" {%- if params.classes %} class="{{ params.classes }}"{% endif %} {%- for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}>
|
|
7
7
|
</div>
|
|
8
|
-
<
|
|
8
|
+
<div class="hidden" id="{{ 'template-' + params.id }}">
|
|
9
9
|
{% if caller %}
|
|
10
10
|
{{ caller() }} {#- if statement allows usage of `call` to be optional -#}
|
|
11
11
|
{% elseif params.caller %}
|
|
12
12
|
{{ params.caller | safe }}
|
|
13
13
|
{% endif %}
|
|
14
|
-
</
|
|
14
|
+
</div>
|
|
15
15
|
</div>
|
|
16
16
|
<!-- /alert -->
|
|
@@ -609,5 +609,27 @@
|
|
|
609
609
|
}
|
|
610
610
|
]
|
|
611
611
|
}
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
"name": "indeterminate cheched",
|
|
615
|
+
"description": "isIndeterminate: true, indeterminateChecked: true",
|
|
616
|
+
"data": {
|
|
617
|
+
"idPrefix": "indeterminate-checked",
|
|
618
|
+
"name": "indeterminate-checked",
|
|
619
|
+
"classes": "c-checkboxes--sm",
|
|
620
|
+
"items": [
|
|
621
|
+
{
|
|
622
|
+
"value": "indeterminate-checked-item",
|
|
623
|
+
"text": "1 elemento seleccionado",
|
|
624
|
+
"isIndeterminate": true,
|
|
625
|
+
"indeterminateChecked": true,
|
|
626
|
+
"checked": false,
|
|
627
|
+
"classes": "-mt-base",
|
|
628
|
+
"label": {
|
|
629
|
+
"classes": "text-sm -mt-1"
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
]
|
|
633
|
+
}
|
|
612
634
|
}
|
|
613
635
|
] %}
|
|
@@ -70,17 +70,18 @@
|
|
|
70
70
|
{% set itemHintId = id + "-item-hint" if hasHint else "" %}
|
|
71
71
|
{% set itemDescribedBy = describedBy if not hasFieldset else "" %}
|
|
72
72
|
{% set itemDescribedBy = (itemDescribedBy + " " + itemHintId) | trim %}
|
|
73
|
-
<div x-data="{ isChecked: {% if not item.checked %}false{% else %}true{% endif %} }" class="{%- if params.hasDividers %} border-t border-b border-neutral-base -mb-px{% endif %} {%- if item.classes %} {{ item.classes }}{% endif %}">
|
|
73
|
+
<div x-data="{ isChecked: {% if not item.checked %}false{% else %}true{% endif %} }" {%- if item.indeterminateChecked %} x-init="$refs.inputCheck.indeterminate=$refs.inputCheck.readOnly=true"{% endif %} class="{%- if params.hasDividers %} border-t border-b border-neutral-base -mb-px{% endif %} {%- if item.classes %} {{ item.classes }}{% endif %}">
|
|
74
74
|
<div class="relative flex items-start py-base">
|
|
75
75
|
<div class="flex items-center mx-sm">
|
|
76
|
-
<input x-model="isChecked" class="w-6 h-6 transition duration-150 ease-in-out border-black focus:border-black focus:shadow-outline-focus-input focus:ring-4 focus:ring-offset-0 focus:ring-warning-base disabled:bg-neutral-base disabled:border-neutral-base text-primary-base" id="{{ id }}" name="{{ name }}" type="checkbox" value="{{ item.value }}"
|
|
76
|
+
<input x-model="isChecked" x-ref="inputCheck" class="w-6 h-6 transition duration-150 ease-in-out border-black focus:border-black focus:shadow-outline-focus-input focus:ring-4 focus:ring-offset-0 focus:ring-warning-base disabled:bg-neutral-base disabled:border-neutral-base text-primary-base" id="{{ id }}" name="{{ name }}" type="checkbox" value="{{ item.value }}"
|
|
77
77
|
{{-" checked" if item.checked }}
|
|
78
78
|
{{-" disabled" if item.disabled }}
|
|
79
79
|
{%- if item.conditional.html %} aria-controls="{{ conditionalId }}"{% endif -%}
|
|
80
80
|
{%- if itemDescribedBy %} aria-describedby="{{ itemDescribedBy }}"{% endif -%}
|
|
81
81
|
{%- if params.errorMessage %} aria-invalid="true"{% endif -%}
|
|
82
82
|
{%- for attribute, value in item.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}
|
|
83
|
-
{%- if item.isIndeterminate %} onclick="if (this.readOnly) this.checked=this.readOnly=false; else if (!this.checked) this.readOnly=this.indeterminate=true;"{% endif %}
|
|
83
|
+
{%- if item.isIndeterminate %} onclick="if (this.readOnly) this.checked=this.readOnly=false; else if (!this.checked) this.readOnly=this.indeterminate=true;"{% endif %}
|
|
84
|
+
{%- if item.indeterminateChecked %} onclick="if (this.readOnly) this.checked=this.readOnly=false; else if (!this.checked) this.readOnly=this.indeterminate=true;"{% endif %}>
|
|
84
85
|
</div>
|
|
85
86
|
<div class="pt-0.5 leading-5">
|
|
86
87
|
{{ componentLabel({
|
|
@@ -74,6 +74,14 @@ params:
|
|
|
74
74
|
type: boolean
|
|
75
75
|
required: false
|
|
76
76
|
description: If true, checkbox will be checked.
|
|
77
|
+
- name: isIndeterminate
|
|
78
|
+
type: boolean
|
|
79
|
+
required: false
|
|
80
|
+
description: If true, the checkbox will have an additional indeterminate state to show a partial true.
|
|
81
|
+
- name: indeterminateChecked
|
|
82
|
+
type: boolean
|
|
83
|
+
required: false
|
|
84
|
+
description: If true, the checkbox will have an indeterminate checked initial state. This will override isChecked value.
|
|
77
85
|
- name: conditional
|
|
78
86
|
type: boolean
|
|
79
87
|
required: false
|