desy-html 12.0.1 → 13.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/docs/_include.template-header.njk +320 -326
  2. package/docs/_macro.example-render.njk +8 -8
  3. package/docs/ds/_ds.example.textos.njk +1 -1
  4. package/docs/ds/_ds.section.espaciado.njk +2 -2
  5. package/docs/ds/_ds.section.textos.njk +1 -1
  6. package/docs/ds/_ds.section.typography.njk +1 -1
  7. package/docs/index.html +14 -0
  8. package/docs/pagina-accesibilidad.html +1 -1
  9. package/docs/pagina-mapa-web.html +1 -1
  10. package/docs/plantilla-con-header-advanced.html +1 -1
  11. package/docs/plantilla-editar-con-cabecera-fija-y-sidebar-sticky.html +1 -1
  12. package/docs/plantilla-editar-con-cabecera-fija.html +1 -1
  13. package/docs/plantilla-logueado-con-cabecera-fija-headroom.html +1 -1
  14. package/docs/plantilla-logueado-con-cabecera-fija.html +1 -1
  15. package/docs/plantilla-logueado-con-selector-de-app-y-sidebar.html +1 -1
  16. package/docs/plantilla-logueado-con-selector-de-app-y-subheader.html +1 -1
  17. package/docs/plantilla-logueado-con-selector-de-app.html +1 -1
  18. package/docs/plantilla-logueado-con-titulo-de-app.html +1 -1
  19. package/docs/plantilla-sin-loguear.html +1 -1
  20. package/package.json +1 -1
  21. package/src/js/aria/MenuNavigation.js +4 -1
  22. package/src/js/aria/MenubarAction.js +100 -25
  23. package/src/js/aria/listbox.js +1 -1
  24. package/src/js/aria/tabs.js +0 -2
  25. package/src/js/desy-html.js +3 -11
  26. package/src/js/index.js +0 -2
  27. package/src/templates/components/accordion/_template.accordion.njk +7 -7
  28. package/src/templates/components/accordion-history/_template.accordion-history.njk +17 -17
  29. package/src/templates/components/alert/_examples.alert.njk +3 -3
  30. package/src/templates/components/breadcrumbs/_examples.breadcrumbs.njk +27 -27
  31. package/src/templates/components/breadcrumbs/_styles.breadcrumbs.css +7 -4
  32. package/src/templates/components/breadcrumbs/_template.breadcrumbs.njk +1 -1
  33. package/src/templates/components/button/_examples.button.njk +12 -13
  34. package/src/templates/components/button-loader/_examples.button-loader.njk +5 -5
  35. package/src/templates/components/button-loader/_template.button-loader.njk +1 -1
  36. package/src/templates/components/card/_examples.card.njk +25 -22
  37. package/src/templates/components/card/_template.card.njk +10 -10
  38. package/src/templates/components/character-count/_examples.character-count.njk +1 -1
  39. package/src/templates/components/checkboxes/_template.checkboxes.njk +2 -3
  40. package/src/templates/components/date-input/_template.date-input.njk +0 -1
  41. package/src/templates/components/datepicker/_template.datepicker.njk +1 -2
  42. package/src/templates/components/dropdown/_template.dropdown.njk +1 -1
  43. package/src/templates/components/error-summary/_template.error-summary.njk +1 -1
  44. package/src/templates/components/file-upload/_examples.file-upload.njk +6 -6
  45. package/src/templates/components/file-upload/_template.file-upload.njk +0 -1
  46. package/src/templates/components/footer/_template.footer.njk +2 -1
  47. package/src/templates/components/header/_examples.header.njk +5 -4
  48. package/src/templates/components/header/_template.header.header__navigation.njk +24 -26
  49. package/src/templates/components/header/_template.header.njk +1 -0
  50. package/src/templates/components/header-advanced/_examples.header-advanced.njk +63 -52
  51. package/src/templates/components/header-mini/_examples.header-mini.njk +1 -1
  52. package/src/templates/components/input/_template.input.njk +1 -2
  53. package/src/templates/components/input-group/_examples.input-group.njk +2 -2
  54. package/src/templates/components/input-group/_template.input-group.njk +1 -2
  55. package/src/templates/components/item/_examples.item.njk +13 -2
  56. package/src/templates/components/item/_template.item.njk +3 -3
  57. package/src/templates/components/links-list/_examples.links-list.njk +32 -0
  58. package/src/templates/components/listbox/_template.listbox.njk +3 -3
  59. package/src/templates/components/menu-horizontal/_examples.menu-horizontal.njk +34 -19
  60. package/src/templates/components/menu-horizontal/_styles.menu-horizontal.css +2 -1
  61. package/src/templates/components/menu-horizontal/_template.menu-horizontal.njk +4 -4
  62. package/src/templates/components/menu-navigation/_examples.menu-navigation.njk +0 -23
  63. package/src/templates/components/menu-navigation/_template.menu-navigation.njk +3 -5
  64. package/src/templates/components/menu-vertical/_template.menu-vertical.njk +2 -2
  65. package/src/templates/components/menubar/_styles.menubar.css +10 -0
  66. package/src/templates/components/menubar/_template.menubar.njk +2 -1
  67. package/src/templates/components/nav/_template.nav.njk +1 -1
  68. package/src/templates/components/notification/_template.notification.njk +2 -2
  69. package/src/templates/components/pagination/_template.pagination.njk +6 -6
  70. package/src/templates/components/pill/_examples.pill.njk +6 -6
  71. package/src/templates/components/radios/_template.radios.njk +1 -2
  72. package/src/templates/components/searchbar/_template.searchbar.njk +0 -1
  73. package/src/templates/components/select/_template.select.njk +0 -3
  74. package/src/templates/components/spinner/_template.spinner.njk +4 -0
  75. package/src/templates/components/status-item/_examples.status-item.njk +1 -1
  76. package/src/templates/components/table/_examples.table.njk +21 -298
  77. package/src/templates/components/table/_template.table.njk +2 -2
  78. package/src/templates/components/table/params.table.yaml +4 -0
  79. package/src/templates/components/table-advanced/_examples.table-advanced.njk +4 -184
  80. package/src/templates/components/table-advanced/_template.table-advanced.njk +5 -2
  81. package/src/templates/components/textarea/_template.textarea.njk +0 -1
  82. package/src/templates/components/toggle/_examples.toggle.njk +12 -12
  83. package/src/templates/components/tooltip/_template.tooltip.njk +1 -1
  84. package/src/js/aria/HeaderNavigation.js +0 -55
@@ -645,7 +645,7 @@
645
645
  "firstCellIsHeader": true,
646
646
  "head": [
647
647
  {
648
- "text": "Número de fila"
648
+ "text": "Identificador"
649
649
  },
650
650
  {
651
651
  "text": "Mes de pago",
@@ -713,7 +713,7 @@
713
713
  "rows": [
714
714
  [
715
715
  {
716
- "text": "Primera fila"
716
+ "text": "A"
717
717
  },
718
718
  {
719
719
  "text": "Enero"
@@ -729,7 +729,7 @@
729
729
  ],
730
730
  [
731
731
  {
732
- "text": "Segunda fila"
732
+ "text": "B"
733
733
  },
734
734
  {
735
735
  "text": "Febrero"
@@ -745,7 +745,7 @@
745
745
  ],
746
746
  [
747
747
  {
748
- "text": "Tercera fila"
748
+ "text": "C"
749
749
  },
750
750
  {
751
751
  "text": "Marzo"
@@ -781,185 +781,5 @@
781
781
  ],
782
782
  "classes": "min-w-full"
783
783
  }
784
- },
785
- {
786
- "name": "tabla con columnas sticky",
787
- "description": "Con <code>orderBy</code>, <code>hasCheckboxes</code>, <code>hasFilter</code> y <code>firstCellIsHeader</code>",
788
- "data": {
789
- "idPrefix": "table-with-sticky-columns",
790
- "hasCheckboxes": true,
791
- "checkboxesClasses": "sticky left-0 z-10 w-0 bg-white",
792
- "firstCellIsHeader": true,
793
- "head": [
794
- {
795
- "text": "Número de fila",
796
- "classes": "sticky left-16 z-10 w-60 bg-white"
797
- },
798
- {
799
- "text": "Mes de pago",
800
- "orderBy": "none",
801
- "hasFilter": true
802
- },
803
- {
804
- "text": "Primer pago",
805
- "orderBy": "none",
806
- "classes": "text-right",
807
- "hasFilter": true
808
- },
809
- {
810
- "text": "Segundo pago",
811
- "orderBy": "none",
812
- "classes": "text-right",
813
- "hasFilter": true
814
- },
815
- {
816
- "text": "Rate for column A",
817
- "orderBy": "none",
818
- "classes": "text-right",
819
- "hasFilter": true
820
- },
821
- {
822
- "text": "Rate for column B",
823
- "orderBy": "none",
824
- "classes": "text-right",
825
- "hasFilter": true
826
- },
827
- {
828
- "text": "Rate for column C",
829
- "orderBy": "none",
830
- "classes": "text-right",
831
- "hasFilter": true
832
- },
833
- {
834
- "text": "Rate for column D",
835
- "orderBy": "none",
836
- "classes": "text-right",
837
- "hasFilter": true
838
- },
839
- {
840
- "text": "Rate for column E",
841
- "orderBy": "none",
842
- "classes": "text-right sticky right-0 z-10 w-60 bg-white",
843
- "hasFilter": true
844
- }
845
- ],
846
- "rows": [
847
- [
848
- {
849
- "text": "First row",
850
- "classes": "sticky left-16 z-10 w-60 bg-white"
851
- },
852
- {
853
- "text": "Enero"
854
- },
855
- {
856
- "text": "85€",
857
- "classes": "text-right"
858
- },
859
- {
860
- "text": "95€",
861
- "classes": "text-right"
862
- },
863
- {
864
- "text": "85€",
865
- "classes": "text-right"
866
- },
867
- {
868
- "text": "95€",
869
- "classes": "text-right"
870
- },
871
- {
872
- "text": "95€",
873
- "classes": "text-right"
874
- },
875
- {
876
- "text": "95€",
877
- "classes": "text-right"
878
- },
879
- {
880
- "text": "95€",
881
- "classes": "text-right sticky z-10 right-0 w-60 bg-white"
882
- }
883
- ],
884
- [
885
- {
886
- "text": "Second row",
887
- "classes": "sticky left-16 z-10 w-60 bg-white"
888
- },
889
- {
890
- "text": "Febrero"
891
- },
892
- {
893
- "text": "75€",
894
- "classes": "text-right"
895
- },
896
- {
897
- "text": "55€",
898
- "classes": "text-right"
899
- },
900
- {
901
- "text": "85€",
902
- "classes": "text-right"
903
- },
904
- {
905
- "text": "95€",
906
- "classes": "text-right"
907
- },
908
- {
909
- "text": "95€",
910
- "classes": "text-right"
911
- },
912
- {
913
- "text": "95€",
914
- "classes": "text-right"
915
- },
916
- {
917
- "text": "95€",
918
- "classes": "text-right sticky right-0 z-10 w-60 bg-white"
919
- }
920
- ],
921
- [
922
- {
923
- "text": "Third row",
924
- "classes": "sticky left-16 z-10 w-60 bg-white"
925
- },
926
- {
927
- "text": "Marzo"
928
- },
929
- {
930
- "text": "165€",
931
- "classes": "text-right"
932
- },
933
- {
934
- "text": "125€",
935
- "classes": "text-right"
936
- },
937
- {
938
- "text": "85€",
939
- "classes": "text-right"
940
- },
941
- {
942
- "text": "95€",
943
- "classes": "text-right"
944
- },
945
- {
946
- "text": "95€",
947
- "classes": "text-right"
948
- },
949
- {
950
- "text": "95€",
951
- "classes": "text-right"
952
- },
953
- {
954
- "text": "95€",
955
- "classes": "text-right sticky z-10 right-0 w-60 bg-white"
956
- }
957
- ]
958
- ],
959
- "wrapper": {
960
- "classes": "overflow-x-auto pb-base"
961
- },
962
- "classes": "relative whitespace-nowrap min-w-full"
963
- }
964
784
  }
965
785
  ] %}
@@ -6,20 +6,23 @@
6
6
  {% set idPrefix = params.idPrefix if params.idPrefix else 'id-table-row' %}
7
7
  {% set hasFilters = false %}
8
8
  {% set hasSelects = false %}
9
+ {% set hasFiltersOrSelects = false %}
9
10
 
10
11
  {% for item in params.head %}
11
12
  {% if item.hasFilter %}
12
13
  {% set hasFilters = true %}
14
+ {% set hasFiltersOrSelects = true %}
13
15
  {% endif %}
14
16
  {% if item.select %}
15
17
  {% set hasSelects = true %}
18
+ {% set hasFiltersOrSelects = true %}
16
19
  {% endif %}
17
20
  {% endfor %}
18
21
 
19
22
  {#- Capture the HTML so we can optionally nest it in a wrapper -#}
20
23
  {% set innerHtml %}
21
24
  <table class="c-table-advanced border-t-2 border-b-2 border-neutral-base
22
- {%- if params.classes %} {{ params.classes }}{% endif %}"{% for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %} data-module="c-table-advanced" role="grid">
25
+ {%- if params.classes %} {{ params.classes }}{% endif %}"{% for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %} data-module="c-table-advanced" role="grid" aria-readonly="true">
23
26
  {% if params.caption %}
24
27
  <caption {%- if params.captionClasses %} class="{{ params.captionClasses }}"{% endif %}>{{ params.caption }}</caption>
25
28
  {% endif %}
@@ -127,7 +130,7 @@
127
130
  <input 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-light disabled:border-neutral-base text-primary-base" id="{{ idCheckbox }}" name="{{ idCheckbox }}" type="checkbox" value="table-checkbox">
128
131
  </div>
129
132
  <div class="pt-0.5 leading-5">
130
- <label class="sr-only block text-sm -mt-1" for="{{ idCheckbox }}">Selecciona fila {{ loop.index + 1 }}</label>
133
+ <label class="sr-only block text-sm -mt-1" for="{{ idCheckbox }}">Selecciona fila {% if hasFiltersOrSelects %}{{ loop.index + 2 }}{% else %}{{ loop.index + 1 }}{% endif %}</label>
131
134
  </div>
132
135
  </div>
133
136
  </div>
@@ -28,7 +28,6 @@
28
28
  {% endif %}
29
29
  {% if params.errorMessage %}
30
30
  {% set errorId = params.id + '-error' %}
31
- {% set describedBy = describedBy + " " + errorId if describedBy else errorId %}
32
31
  {{ componentErrorMessage({
33
32
  id: errorId,
34
33
  classes: params.errorMessage.classes,
@@ -110,15 +110,15 @@
110
110
  "description": "Apariencia de Switch con <code>'isSwitch': true</code>, sin cambio en el texto, sólo cambia su estado visual. Necesita un elemento externo con un <code>id</code> para referenciarlo con su <code>aria-labelledby</code>.",
111
111
  "data": {
112
112
  "id": "toggle-isswitch",
113
- "classes": "focus:bg-warning-base focus:outline-none focus:shadow-outline-focus focus:text-black",
113
+ "classes": "focus:bg-warning-base focus:outline-none focus:shadow-outline-focus focus:text-black group",
114
114
  "isSwitch": true,
115
115
  "offState": {
116
116
  "classes": "",
117
- "html": "<span class='flex align-center justify-between gap-xs'><span class='text-sm' aria-hidden='true'>Off</span><span class='bg-neutral-base relative inline-flex flex-shrink-0 h-5 w-9 border-2 border-neutral-base rounded-full cursor-pointer 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-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><span class='text-sm' aria-hidden='true'>On</span></span>"
117
+ "html": "<span class='flex align-center justify-between gap-xs'><span class='text-sm group-focus:text-black' aria-hidden='true'>Desactivado</span><span class='bg-neutral-base group-focus:bg-black relative inline-flex flex-shrink-0 h-5 w-9 border-2 border-neutral-base group-focus:border-black rounded-full cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75'><span class='sr-only'>Desactivado</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><span class='text-sm' aria-hidden='true'>Activado</span></span>"
118
118
  },
119
119
  "onState": {
120
120
  "classes": "",
121
- "html": "<span class='flex align-center justify-between gap-xs'><span class='text-sm' aria-hidden='true'>Off</span><span class='bg-primary-base relative inline-flex flex-shrink-0 h-5 w-9 border-2 border-primary-base rounded-full cursor-pointer 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-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><span class='text-sm' aria-hidden='true'>On</span></span>"
121
+ "html": "<span class='flex align-center justify-between gap-xs'><span class='text-sm group-focus:text-black' aria-hidden='true'>Desactivado</span><span class='bg-primary-base relative inline-flex flex-shrink-0 h-5 w-9 border-2 border-primary-base rounded-full cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75'><span class='sr-only'>Activado</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><span class='text-sm' aria-hidden='true'>Activado</span></span>"
122
122
  },
123
123
  "attributes": {
124
124
  "aria-labelledby": "id-text"
@@ -130,16 +130,16 @@
130
130
  "description": "Usa <code>'pressed': true</code> para activarlo inicialmente.",
131
131
  "data": {
132
132
  "id": "toggle-isswitch-pressed",
133
- "classes": "focus:bg-warning-base focus:outline-none focus:shadow-outline-focus focus:text-black",
133
+ "classes": "focus:bg-warning-base focus:outline-none focus:shadow-outline-focus focus:text-black group",
134
134
  "pressed": true,
135
135
  "isSwitch": true,
136
136
  "offState": {
137
137
  "classes": "",
138
- "html": "<span class='flex align-center justify-between gap-xs'><span class='text-sm' aria-hidden='true'>Off</span><span class='bg-neutral-base relative inline-flex flex-shrink-0 h-5 w-9 border-2 border-neutral-base rounded-full cursor-pointer 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-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><span class='text-sm' aria-hidden='true'>On</span></span>"
138
+ "html": "<span class='flex align-center justify-between gap-xs'><span class='text-sm group-focus:text-black' aria-hidden='true'>Desactivado</span><span class='bg-neutral-base group-focus:bg-black relative inline-flex flex-shrink-0 h-5 w-9 border-2 border-neutral-base group-focus:border-black rounded-full cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75'><span class='sr-only'>Desactivado</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><span class='text-sm' aria-hidden='true'>Activado</span></span>"
139
139
  },
140
140
  "onState": {
141
141
  "classes": "",
142
- "html": "<span class='flex align-center justify-between gap-xs'><span class='text-sm' aria-hidden='true'>Off</span><span class='bg-primary-base relative inline-flex flex-shrink-0 h-5 w-9 border-2 border-primary-base rounded-full cursor-pointer 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-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><span class='text-sm' aria-hidden='true'>On</span></span>"
142
+ "html": "<span class='flex align-center justify-between gap-xs'><span class='text-sm group-focus:text-black' aria-hidden='true'>Desactivado</span><span class='bg-primary-base relative inline-flex flex-shrink-0 h-5 w-9 border-2 border-primary-base rounded-full cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75'><span class='sr-only'>Activado</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><span class='text-sm' aria-hidden='true'>Activado</span></span>"
143
143
  },
144
144
  "attributes": {
145
145
  "aria-labelledby": "id-text"
@@ -150,16 +150,16 @@
150
150
  "name": "isSwitch con JavaScript",
151
151
  "description": "También puedes usar con javascript la función global <code>activateItemToggle(element, toggle)</code>, para modificar el estado del Switch, usando su id, el parámetro <code>toggle</code> admite <code>true</code> o <code>false</code>, si le pasamos true se mostrará activado, y si le pasamos false se mostrará desactivado. Ej: Abre la consola del navegador y escribe <code>activateItemToggle('toggle-switch-js', true)</code> para mostrar el switch activado.",
152
152
  "data": {
153
- "classes": "focus:bg-warning-base focus:outline-none focus:shadow-outline-focus focus:text-black",
153
+ "classes": "focus:bg-warning-base focus:outline-none focus:shadow-outline-focus focus:text-black group",
154
154
  "id": "toggle-switch-js",
155
155
  "isSwitch": true,
156
156
  "offState": {
157
157
  "classes": "",
158
- "html": "<span class='flex align-center justify-between gap-xs'><span class='text-sm' aria-hidden='true'>Off</span><span class='bg-neutral-base relative inline-flex flex-shrink-0 h-5 w-9 border-2 border-neutral-base rounded-full cursor-pointer 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-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><span class='text-sm' aria-hidden='true'>On</span></span>"
158
+ "html": "<span class='flex align-center justify-between gap-xs'><span class='text-sm group-focus:text-black' aria-hidden='true'>Desactivado</span><span class='bg-neutral-base group-focus:bg-black relative inline-flex flex-shrink-0 h-5 w-9 border-2 border-neutral-base group-focus:border-black rounded-full cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75'><span class='sr-only'>Desactivado</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><span class='text-sm' aria-hidden='true'>Activado</span></span>"
159
159
  },
160
160
  "onState": {
161
161
  "classes": "",
162
- "html": "<span class='flex align-center justify-between gap-xs'><span class='text-sm' aria-hidden='true'>Off</span><span class='bg-primary-base relative inline-flex flex-shrink-0 h-5 w-9 border-2 border-primary-base rounded-full cursor-pointer 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-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><span class='text-sm' aria-hidden='true'>On</span></span>"
162
+ "html": "<span class='flex align-center justify-between gap-xs'><span class='text-sm group-focus:text-black' aria-hidden='true'>Desactivado</span><span class='bg-primary-base relative inline-flex flex-shrink-0 h-5 w-9 border-2 border-primary-base rounded-full cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75'><span class='sr-only'>Activado</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><span class='text-sm' aria-hidden='true'>Activado</span></span>"
163
163
  },
164
164
  "attributes": {
165
165
  "aria-labelledby": "id-text"
@@ -170,15 +170,15 @@
170
170
  "name": "isSwitch peque",
171
171
  "data": {
172
172
  "id": "toggle-small",
173
- "classes": "focus:bg-warning-base focus:outline-none focus:shadow-outline-focus focus:text-black",
173
+ "classes": "mb-sm focus:bg-warning-base focus:outline-none focus:shadow-outline-focus focus:text-black group",
174
174
  "isSwitch": true,
175
175
  "offState": {
176
176
  "classes": "",
177
- "html": "<span class='flex align-center justify-between gap-xs'><span class='text-xs' aria-hidden='true'>Off</span><span class='bg-neutral-base relative inline-flex flex-shrink-0 h-4 w-8 border-2 border-neutral-base rounded-full cursor-pointer 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-0 pointer-events-none inline-block h-3 w-3 rounded-full bg-white shadow-lg transform ring-0 transition ease-in-out duration-200'></span></span><span class='text-xs' aria-hidden='true'>On</span></span>"
177
+ "html": "<span class='flex align-center justify-between gap-xs'><span class='text-xs group-focus:text-black' aria-hidden='true'>Desactivado</span><span class='bg-neutral-base group-focus:bg-black relative inline-flex flex-shrink-0 h-4 w-8 border-2 border-neutral-base group-focus:border-black rounded-full cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75'><span class='sr-only'>Desactivado</span><span aria-hidden='true' class='translate-x-0 pointer-events-none inline-block h-3 w-3 rounded-full bg-white shadow-lg transform ring-0 transition ease-in-out duration-200'></span></span><span class='text-xs' aria-hidden='true'>Activado</span></span>"
178
178
  },
179
179
  "onState": {
180
180
  "classes": "",
181
- "html": "<span class='flex align-center justify-between gap-xs'><span class='text-xs' aria-hidden='true'>Off</span><span class='bg-primary-base relative inline-flex flex-shrink-0 h-4 w-8 border-2 border-primary-base rounded-full cursor-pointer 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-4 pointer-events-none inline-block h-3 w-3 rounded-full bg-white shadow-lg transform ring-0 transition ease-in-out duration-200'></span></span><span class='text-xs' aria-hidden='true'>On</span></span>"
181
+ "html": "<span class='flex align-center justify-between gap-xs'><span class='text-xs group-focus:text-black' aria-hidden='true'>Desactivado</span><span class='bg-primary-base relative inline-flex flex-shrink-0 h-4 w-8 border-2 border-primary-base rounded-full cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75'><span class='sr-only'>Activado</span><span aria-hidden='true' class='translate-x-4 pointer-events-none inline-block h-3 w-3 rounded-full bg-white shadow-lg transform ring-0 transition ease-in-out duration-200'></span></span><span class='text-xs' aria-hidden='true'>Activado</span></span>"
182
182
  },
183
183
  "attributes": {
184
184
  "aria-labelledby": "id-text"
@@ -2,7 +2,7 @@
2
2
  {% set idButton = params.id + "-button" %}
3
3
  {% set idTooltip = params.id + "-tooltip" %}
4
4
  <div id="{{ params.id }}" data-module="c-tooltip" {% if params.classes %}class="{{ params.classes }}"{% endif %} {%- if params.attributes %}{% for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}{% endif %}>
5
- <div id="{{ idButton }}" data-module="c-tooltip-button" {%- if params.complex %} data-type="c-tooltip-button-complex"{% endif %} class="inline-flex items-center focus:bg-warning-base focus:outline-none focus:shadow-outline-focus focus:text-black" tabindex="0" role="button" aria-labelledby="{{ idButton }}" aria-describedby="{{ idTooltip }}">
5
+ <div id="{{ idButton }}" data-module="c-tooltip-button" {%- if params.complex %} data-type="c-tooltip-button-complex"{% endif %} class="inline-flex items-center p-xs focus:bg-warning-base focus:outline-none focus:shadow-outline-focus focus:text-black" tabindex="0" role="button" aria-labelledby="{{ idButton }}" aria-describedby="{{ idTooltip }}">
6
6
  {% if params.text or params.html %}
7
7
  {% if params.html %}
8
8
  {{ params.html | filterquotes | safe }}
@@ -1,55 +0,0 @@
1
- export function HeaderNavigation(aria) {
2
- (function () {
3
- aria.HeaderNavigation = function (domNode) {
4
- this.domNode = domNode;
5
- };
6
-
7
- aria.HeaderNavigation.prototype.init = function () {
8
- this.valueActive = this.domNode.dataset.menuActive;
9
- if (this.valueActive) {
10
- this.activateElement(this.valueActive);
11
- }
12
- };
13
-
14
- aria.HeaderNavigation.prototype.activateElement = function (elementActive) {
15
- this.domNode.querySelectorAll('li').forEach((element) => {
16
- const getLink = element.querySelector('a') || element.querySelector('span');
17
- if (getLink) {
18
- if (getLink.id === elementActive) {
19
- this.wrapActiveElement(getLink);
20
- } else {
21
- this.deactivateElement(getLink);
22
- }
23
- }
24
- });
25
- };
26
-
27
- aria.HeaderNavigation.prototype.wrapActiveElement = function (elementActive) {
28
- elementActive.setAttribute('aria-current', 'page');
29
- elementActive.innerHTML = `<strong class="font-bold">${elementActive.textContent}</strong>`;
30
- };
31
-
32
- aria.HeaderNavigation.prototype.deactivateElement = function (elementDeactivated) {
33
- elementDeactivated.removeAttribute('aria-current');
34
- elementDeactivated.innerHTML = elementDeactivated.textContent;
35
- };
36
-
37
- window.activateItemHeaderNavigation = function (menuId, activeItemId) {
38
- const menu = document.getElementById(menuId);
39
- if (menu) {
40
- const activeItem = document.querySelector(`#${menuId} #${activeItemId}`);
41
- if (activeItem) {
42
- const menuInstance = new aria.HeaderNavigation(menu);
43
- menuInstance.activateElement(activeItemId);
44
- return [menu, activeItem];
45
- } else {
46
- console.log('There is no element with this id in the menu.');
47
- return null;
48
- }
49
- } else {
50
- console.log('There is no menu with this id in the document.');
51
- return null;
52
- }
53
- };
54
- }());
55
- }