desy-html 5.0.1 → 5.2.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 +8 -0
- package/docs/_macro.example-render.njk +8 -0
- package/docs/componentes.html +6 -0
- package/docs/ds/_ds.example.menu-vertical.njk +3 -3
- package/docs/ds/_ds.example.toggle.njk +56 -0
- package/docs/ds/_ds.example.tree.njk +457 -0
- package/docs/ds/_ds.section.forms.njk +5 -0
- package/docs/ds/_ds.section.mostrar-ocultar.njk +5 -0
- package/docs/examples-toggle.html +5 -0
- package/docs/examples-tree.html +5 -0
- package/docs/index.html +20 -1
- package/package.json +1 -1
- package/src/css/styles.css +1 -0
- package/src/js/aria/tree.js +245 -0
- package/src/js/aria/treeitem.js +260 -0
- package/src/js/desy-html.js +28 -0
- package/src/js/index.js +3 -1
- package/src/templates/components/checkboxes/_template.checkboxes.njk +1 -2
- package/src/templates/components/menubar/_examples.menubar.njk +169 -0
- package/src/templates/components/pagination/_examples.pagination.njk +32 -0
- package/src/templates/components/pagination/_template.pagination.njk +1 -0
- package/src/templates/components/toggle/_examples.toggle.njk +52 -0
- package/src/templates/components/toggle/_macro.toggle.njk +3 -0
- package/src/templates/components/toggle/_template.toggle.njk +37 -0
- package/src/templates/components/toggle/params.toggle.yaml +57 -0
- package/src/templates/components/tree/_examples.tree.njk +1171 -0
- package/src/templates/components/tree/_macro.tree.njk +3 -0
- package/src/templates/components/tree/_styles.tree.css +45 -0
- package/src/templates/components/tree/_template.tree.njk +178 -0
- package/src/templates/components/tree/params.tree.yaml +163 -0
|
@@ -614,6 +614,175 @@
|
|
|
614
614
|
]
|
|
615
615
|
}
|
|
616
616
|
},
|
|
617
|
+
{
|
|
618
|
+
"name": "With one disabled parent item",
|
|
619
|
+
"data": {
|
|
620
|
+
"id": "with-disabled",
|
|
621
|
+
"idPrefix": "disabled-example",
|
|
622
|
+
"ariaLabel":"Menubar description",
|
|
623
|
+
"items": [
|
|
624
|
+
{
|
|
625
|
+
"text": "Menuitem",
|
|
626
|
+
"ariaLabel": "Menuitem",
|
|
627
|
+
"id": "menuitems-disabled-example-item-1-2",
|
|
628
|
+
"disabled": true,
|
|
629
|
+
"sub": {
|
|
630
|
+
"items": [
|
|
631
|
+
{
|
|
632
|
+
"role": "menuitem",
|
|
633
|
+
"text": "Subitem 1"
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
"role": "menuitem",
|
|
637
|
+
"text": "Subitem 2"
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
"role": "menuitem",
|
|
641
|
+
"text": "Subitem 3"
|
|
642
|
+
}
|
|
643
|
+
],
|
|
644
|
+
"attributes": {
|
|
645
|
+
"aria-labelledby": "menuitems-disabled-example-item-1-2"
|
|
646
|
+
}
|
|
647
|
+
},
|
|
648
|
+
"classes": "mb-base mr-base"
|
|
649
|
+
},
|
|
650
|
+
{
|
|
651
|
+
"text": "Menuitemcheckbox",
|
|
652
|
+
"ariaLabel": "Menuitemcheckbox",
|
|
653
|
+
"id": "menuitems-disabled-example-item-2-2",
|
|
654
|
+
"classes": "mb-base mr-base",
|
|
655
|
+
"sub": {
|
|
656
|
+
"items": [
|
|
657
|
+
{
|
|
658
|
+
"role": "menuitemcheckbox",
|
|
659
|
+
"text": "Subitem 1"
|
|
660
|
+
},
|
|
661
|
+
{
|
|
662
|
+
"role": "menuitemcheckbox",
|
|
663
|
+
"text": "Subitem 2",
|
|
664
|
+
"checked": true
|
|
665
|
+
},
|
|
666
|
+
{
|
|
667
|
+
"role": "menuitemcheckbox",
|
|
668
|
+
"text": "Subitem 3"
|
|
669
|
+
}
|
|
670
|
+
],
|
|
671
|
+
"attributes": {
|
|
672
|
+
"aria-labelledby": "menuitems-disabled-example-item-2-2"
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
},
|
|
676
|
+
{
|
|
677
|
+
"text": "Menuitemradio",
|
|
678
|
+
"ariaLabel": "Menuitemradio",
|
|
679
|
+
"id": "menuitems-disabled-example-item-3-2",
|
|
680
|
+
"sub": {
|
|
681
|
+
"items": [
|
|
682
|
+
{
|
|
683
|
+
"role": "group",
|
|
684
|
+
"text": "Group",
|
|
685
|
+
"items": [
|
|
686
|
+
{
|
|
687
|
+
"role": "menuitemradio",
|
|
688
|
+
"text": "Radio 1"
|
|
689
|
+
},
|
|
690
|
+
{
|
|
691
|
+
"role": "menuitemradio",
|
|
692
|
+
"text": "Radio 2",
|
|
693
|
+
"checked": true
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
"role": "menuitemradio",
|
|
697
|
+
"text": "Radio 3"
|
|
698
|
+
}
|
|
699
|
+
]
|
|
700
|
+
}
|
|
701
|
+
],
|
|
702
|
+
"attributes": {
|
|
703
|
+
"aria-labelledby": "menuitems-disabled-example-item-3-2"
|
|
704
|
+
}
|
|
705
|
+
},
|
|
706
|
+
"classes": "mb-base mr-base"
|
|
707
|
+
},
|
|
708
|
+
{
|
|
709
|
+
"text": "Mixed items",
|
|
710
|
+
"ariaLabel": "Mixeditems",
|
|
711
|
+
"id": "menuitems-disabled-example-item-4-2",
|
|
712
|
+
"sub": {
|
|
713
|
+
"items": [
|
|
714
|
+
{
|
|
715
|
+
"role": "group",
|
|
716
|
+
"ariaLabel": "Tamaño de letra",
|
|
717
|
+
"items": [
|
|
718
|
+
{
|
|
719
|
+
"role": "menuitem",
|
|
720
|
+
"text": "Tamaño mayor"
|
|
721
|
+
},
|
|
722
|
+
{
|
|
723
|
+
"role": "menuitem",
|
|
724
|
+
"text": "Tamaño menor"
|
|
725
|
+
}
|
|
726
|
+
]
|
|
727
|
+
},
|
|
728
|
+
{
|
|
729
|
+
"role": "separator"
|
|
730
|
+
},
|
|
731
|
+
{
|
|
732
|
+
"role": "group",
|
|
733
|
+
"ariaLabel": "Estilo de letra",
|
|
734
|
+
"items": [
|
|
735
|
+
{
|
|
736
|
+
"role": "menuitemcheckbox",
|
|
737
|
+
"text": "Negritas"
|
|
738
|
+
},
|
|
739
|
+
{
|
|
740
|
+
"role": "menuitemcheckbox",
|
|
741
|
+
"text": "Itálicas"
|
|
742
|
+
}
|
|
743
|
+
]
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
"role": "separator"
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
"role": "group",
|
|
750
|
+
"ariaLabel": "Estilo de texto",
|
|
751
|
+
"items": [
|
|
752
|
+
{
|
|
753
|
+
"role": "menuitemradio",
|
|
754
|
+
"text": "Ninguno"
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
"role": "menuitemradio",
|
|
758
|
+
"text": "Tachado"
|
|
759
|
+
},
|
|
760
|
+
{
|
|
761
|
+
"role": "menuitemradio",
|
|
762
|
+
"text": "Subrayado"
|
|
763
|
+
}
|
|
764
|
+
]
|
|
765
|
+
}
|
|
766
|
+
],
|
|
767
|
+
"attributes": {
|
|
768
|
+
"aria-labelledby": "menuitems-disabled-example-item-4-2"
|
|
769
|
+
}
|
|
770
|
+
},
|
|
771
|
+
"classes": "mb-base mr-base"
|
|
772
|
+
},
|
|
773
|
+
{
|
|
774
|
+
"text": "Menuitem solo",
|
|
775
|
+
"ariaLabel": "Menuitem solo",
|
|
776
|
+
"id": "menuitems-disabled-example-item-6-2",
|
|
777
|
+
"classes": "c-menubar__button--transparent mb-base mr-base",
|
|
778
|
+
"href": "#"
|
|
779
|
+
}
|
|
780
|
+
],
|
|
781
|
+
"attributes": {
|
|
782
|
+
"aria-label": "Menubar description of use"
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
},
|
|
617
786
|
{
|
|
618
787
|
"name": "Small",
|
|
619
788
|
"description": "Using modifier classes in items.",
|
|
@@ -73,6 +73,38 @@
|
|
|
73
73
|
{
|
|
74
74
|
"href": "#",
|
|
75
75
|
"text": 6
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"href": "#",
|
|
79
|
+
"text": 7
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"href": "#",
|
|
83
|
+
"text": 8
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"href": "#",
|
|
87
|
+
"text": 9
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"href": "#",
|
|
91
|
+
"text": 10
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"href": "#",
|
|
95
|
+
"text": 11
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"href": "#",
|
|
99
|
+
"text": 12
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"href": "#",
|
|
103
|
+
"text": 13
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"href": "#",
|
|
107
|
+
"text": 14
|
|
76
108
|
}
|
|
77
109
|
],
|
|
78
110
|
"hasPrevious": true,
|
|
@@ -95,6 +95,7 @@
|
|
|
95
95
|
"idPrefix": params.idPrefix,
|
|
96
96
|
"text": "Página " + params.items[activePosition].text,
|
|
97
97
|
"classes": "c-listbox--sm c-listbox--transparent mr-xs",
|
|
98
|
+
"classesTooltip": "max-h-52 overflow-y-auto",
|
|
98
99
|
"doesChangeButtonText": true,
|
|
99
100
|
"label": {
|
|
100
101
|
"text": "Selecciona una página para cargar datos",
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{% set exampleComponent = "toggle" %}
|
|
2
|
+
{% set examples = [
|
|
3
|
+
{
|
|
4
|
+
"name": "default",
|
|
5
|
+
"description": "Button like appearance, no change of button text, only changes in visual state",
|
|
6
|
+
"data": {
|
|
7
|
+
"classes": "c-button c-button--transparent no-underline",
|
|
8
|
+
"offState": {
|
|
9
|
+
"classes": "",
|
|
10
|
+
"html": '<span class="inline-flex"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" class="self-center mr-2" aria-hidden="true" width="1em" height="1em"><path d="M13.714 42.857A6.857 6.857 0 0 1 8.4 40.183L.857 31.646a3.429 3.429 0 0 1 .309-4.869A3.429 3.429 0 0 1 6 27.12l7.063 7.989a.72.72 0 0 0 .617.308.789.789 0 0 0 .617-.274L42.103 6.206a3.429 3.429 0 0 1 4.937 4.731L18.926 40.526a6.651 6.651 0 0 1-5.212 2.331Z" fill="currentColor"/></svg>Notificar por correo electrónico</span>'
|
|
11
|
+
},
|
|
12
|
+
"onState": {
|
|
13
|
+
"classes": "",
|
|
14
|
+
"html": 'Notificar por correo electrónico'
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "2 icons",
|
|
20
|
+
"description": "Button like appearance, changes of button text, but no text changes for screenreaders",
|
|
21
|
+
"data": {
|
|
22
|
+
"classes": "c-button c-button--sm c-button--transparent no-underline",
|
|
23
|
+
"offState": {
|
|
24
|
+
"classes": "",
|
|
25
|
+
"html": '<span class="inline-flex"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" class="self-center mr-2" aria-hidden="true" focusable="false" width="1em" height="1em"><path d="M13.33 5.5c-.2-.21-.43-.46-.69-.72a.25.25 0 0 0-.18-.08.26.26 0 0 0-.17.07l-1.07 1.07a.24.24 0 0 0 0 .35c.21.21.41.42.61.64a.25.25 0 0 1 0 .34C10.57 8.53 9.11 9.93 7.16 10a.28.28 0 0 0-.17.07l-1.38 1.38a.25.25 0 0 0-.06.25.24.24 0 0 0 .19.17A6.4 6.4 0 0 0 7 12c3.1 0 5.2-2.28 6.33-3.5l.14-.15a2 2 0 0 0 0-2.7ZM13.78.22a.75.75 0 0 0-1.06 0l-2.47 2.47a.26.26 0 0 1-.29 0A6.51 6.51 0 0 0 7 2C3.9 2 1.8 4.28.67 5.5l-.14.15a2 2 0 0 0 0 2.7l.14.15a18.42 18.42 0 0 0 1.71 1.67.21.21 0 0 1 .09.18.23.23 0 0 1-.07.19L.22 12.72a.75.75 0 0 0 0 1.06.75.75 0 0 0 1.06 0l12.5-12.5a.75.75 0 0 0 0-1.06Zm-11.61 7a.25.25 0 0 1 0-.34C3.49 5.41 5 4 7 4a4.18 4.18 0 0 1 1.24.18.26.26 0 0 1 .17.18.27.27 0 0 1-.07.24L4.18 8.76a.26.26 0 0 1-.33 0 16 16 0 0 1-1.68-1.59Z" fill="currentColor" transform="scale(3.42857)"/></svg><span aria-hidden="true">Ocultar heredados del servicio</span><span class="sr-only">Mostrar heredados del servicio</span></span>'
|
|
26
|
+
},
|
|
27
|
+
"onState": {
|
|
28
|
+
"classes": "",
|
|
29
|
+
"html": '<span class="inline-flex"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" class="self-center mr-2" aria-hidden="true" focusable="false" width="1em" height="1em"><g transform="scale(3.42857)"><circle cx="7" cy="7" r="2" fill="currentColor" /><path d="m13.47 5.65-.14-.15C12.2 4.28 10.1 2 7 2S1.8 4.28.67 5.5l-.14.15a2 2 0 0 0 0 2.7l.14.15C1.8 9.72 3.9 12 7 12s5.2-2.28 6.33-3.5l.14-.15a2 2 0 0 0 0-2.7Zm-1.64 1.52C10.53 8.57 9 10 7 10S3.47 8.57 2.17 7.17a.25.25 0 0 1 0-.34C3.49 5.41 5 4 7 4s3.51 1.41 4.83 2.83a.25.25 0 0 1 0 .34Z" fill="currentColor"/></g></svg>Mostrar heredados del servicio</span>'
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "isSwitch",
|
|
35
|
+
"description": "Switch appearance, no change of button text, only changes in visual state. It needs an outer element with an id to use it with its aria-labelledby.",
|
|
36
|
+
"data": {
|
|
37
|
+
"classes": "",
|
|
38
|
+
"isSwitch": true,
|
|
39
|
+
"offState": {
|
|
40
|
+
"classes": "",
|
|
41
|
+
"html": '<span class="bg-neutral-base relative inline-flex flex-shrink-0 h-5 w-9 border-2 border-neutral-base rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75"><span class="sr-only">on</span><span aria-hidden="true" class="translate-x-0 pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow-lg transform ring-0 transition ease-in-out duration-200" /></span></span>'
|
|
42
|
+
},
|
|
43
|
+
"onState": {
|
|
44
|
+
"classes": "",
|
|
45
|
+
"html": '<span class="bg-primary-base relative inline-flex flex-shrink-0 h-5 w-9 border-2 border-primary-base rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75"><span class="sr-only">off</span><span aria-hidden="true" class="translate-x-4 pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow-lg transform ring-0 transition ease-in-out duration-200" /></span></span>'
|
|
46
|
+
},
|
|
47
|
+
"attributes": {
|
|
48
|
+
"aria-labelledby": "id-text"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
] %}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<div
|
|
2
|
+
x-data="{
|
|
3
|
+
pressed: {{ params.pressed if params.pressed else 'false' }},
|
|
4
|
+
offClasses: '{{ params.offState.classes if params.offState.classes else '' }}',
|
|
5
|
+
onClasses: '{{ params.onState.classes if params.onState.classes else '' }}',
|
|
6
|
+
toggle() {
|
|
7
|
+
if (this.pressed) {
|
|
8
|
+
return this.unpress()
|
|
9
|
+
}
|
|
10
|
+
this.pressed = true
|
|
11
|
+
},
|
|
12
|
+
unpress() {
|
|
13
|
+
this.pressed = false
|
|
14
|
+
}
|
|
15
|
+
}"
|
|
16
|
+
x-id="['toggle-button']"
|
|
17
|
+
class="relative"
|
|
18
|
+
>
|
|
19
|
+
<!-- Button -->
|
|
20
|
+
<button
|
|
21
|
+
x-ref="button"
|
|
22
|
+
x-on:click="toggle()"
|
|
23
|
+
{% if params.isSwitch %}
|
|
24
|
+
role = "switch"
|
|
25
|
+
:aria-checked="pressed ? 'true' : 'false'"
|
|
26
|
+
{% else %}
|
|
27
|
+
:aria-pressed="pressed ? 'true' : 'false'"
|
|
28
|
+
{% endif %}
|
|
29
|
+
type="button"
|
|
30
|
+
class="{{ params.classes if params.classes else '' }}"
|
|
31
|
+
:class="pressed ? onClasses : offClasses"
|
|
32
|
+
{%- for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}
|
|
33
|
+
>
|
|
34
|
+
<span :class="pressed ? 'hidden' : ''">{{ params.offState.html | safe if params.offState.html else params.offState.text }}</span>
|
|
35
|
+
<span :class="pressed ? '' : 'hidden'">{{ params.onState.html | safe if params.onState.html else params.onState.text }}</span>
|
|
36
|
+
</button>
|
|
37
|
+
</div>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
params:
|
|
2
|
+
- name: isSwitch
|
|
3
|
+
type: boolean
|
|
4
|
+
required: false
|
|
5
|
+
description: Defaults to `false`. If `true` the button has role `switch` and has `aria-checked` instead of `aria-pressed`.
|
|
6
|
+
- name: pressed
|
|
7
|
+
type: boolean
|
|
8
|
+
required: false
|
|
9
|
+
description: Defaults to `false`. If `true` the button informs the screenreader that the button is pressed.
|
|
10
|
+
- name: onState
|
|
11
|
+
type: object
|
|
12
|
+
required: true
|
|
13
|
+
description: On state elements
|
|
14
|
+
- name: text
|
|
15
|
+
type: string
|
|
16
|
+
required: true
|
|
17
|
+
description: If `html` is set, this is not required. Text to use within the state. If `html` is provided, the `text` argument will be ignored.
|
|
18
|
+
- name: html
|
|
19
|
+
type: string
|
|
20
|
+
required: true
|
|
21
|
+
description: If `text` is set, this is not required. HTML to use within the state. If `html` is provided, the `text` argument will be ignored.
|
|
22
|
+
- name: classes
|
|
23
|
+
type: string
|
|
24
|
+
required: false
|
|
25
|
+
description: Classes to add to the state span tag.
|
|
26
|
+
- name: attributes
|
|
27
|
+
type: object
|
|
28
|
+
required: false
|
|
29
|
+
description: HTML attributes (for example data attributes) to add to the state span tag.
|
|
30
|
+
- name: offState
|
|
31
|
+
type: object
|
|
32
|
+
required: true
|
|
33
|
+
description: Off state elements
|
|
34
|
+
- name: text
|
|
35
|
+
type: string
|
|
36
|
+
required: true
|
|
37
|
+
description: If `html` is set, this is not required. Text to use within the state. If `html` is provided, the `text` argument will be ignored.
|
|
38
|
+
- name: html
|
|
39
|
+
type: string
|
|
40
|
+
required: true
|
|
41
|
+
description: If `text` is set, this is not required. HTML to use within the state. If `html` is provided, the `text` argument will be ignored.
|
|
42
|
+
- name: classes
|
|
43
|
+
type: string
|
|
44
|
+
required: false
|
|
45
|
+
description: Classes to add to the state span tag.
|
|
46
|
+
- name: attributes
|
|
47
|
+
type: object
|
|
48
|
+
required: false
|
|
49
|
+
description: HTML attributes (for example data attributes) to add to the state span tag.
|
|
50
|
+
- name: classes
|
|
51
|
+
type: string
|
|
52
|
+
required: false
|
|
53
|
+
description: Classes to add to the test component span tag.
|
|
54
|
+
- name: attributes
|
|
55
|
+
type: object
|
|
56
|
+
required: false
|
|
57
|
+
description: HTML attributes (for example data attributes) to add to the test component span tag.
|