desy-html 8.6.0 → 8.8.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 (37) hide show
  1. package/docs/_macro.show-code-from-file.njk +3 -3
  2. package/docs/_macro.show-html-from-file.njk +3 -2
  3. package/docs/ds/_ds.example.layout-escritorio.njk +12 -12
  4. package/docs/ds/_ds.example.layout-movil.njk +4 -4
  5. package/docs/ds/_ds.example.layout-sidebar.njk +1 -1
  6. package/docs/ds/_ds.example.typography.njk +1 -1
  7. package/docs/ds/_ds.macro.code-snippet.njk +1 -1
  8. package/docs/ds/_ds.macro.section-title.njk +1 -1
  9. package/docs/ds/_ds.macro.subsection-title.njk +1 -1
  10. package/docs/ds/_ds.section.espaciado.njk +154 -16
  11. package/docs/ds/_ds.section.textos.njk +216 -142
  12. package/docs/index.html +13 -0
  13. package/package.json +1 -1
  14. package/src/js/aria/MenuHorizontal.js +58 -0
  15. package/src/js/aria/MenubarAction.js +210 -164
  16. package/src/js/aria/accordion.js +46 -2
  17. package/src/js/aria/listbox.js +68 -7
  18. package/src/js/aria/tabs.js +11 -9
  19. package/src/js/desy-html.js +47 -12
  20. package/src/js/index.js +2 -0
  21. package/src/templates/components/accordion/_examples.accordion.njk +10 -4
  22. package/src/templates/components/accordion/_template.accordion.njk +2 -1
  23. package/src/templates/components/accordion-history/_examples.accordion-history.njk +11 -5
  24. package/src/templates/components/accordion-history/_template.accordion-history.njk +2 -1
  25. package/src/templates/components/header/_template.header.header__offcanvas.njk +1 -0
  26. package/src/templates/components/header/_template.header.header__offcanvasButton.njk +1 -0
  27. package/src/templates/components/listbox/_examples.listbox.njk +11 -4
  28. package/src/templates/components/listbox/_template.listbox.njk +2 -2
  29. package/src/templates/components/menu-horizontal/_examples.menu-horizontal.njk +5 -3
  30. package/src/templates/components/menu-horizontal/_template.menu-horizontal.njk +2 -2
  31. package/src/templates/components/menubar/_examples.menubar.njk +156 -3
  32. package/src/templates/components/menubar/_template.menubar.njk +2 -2
  33. package/src/templates/components/modal/_template.modal.njk +1 -1
  34. package/src/templates/components/notification/_template.notification.njk +1 -1
  35. package/src/templates/components/pagination/_template.pagination.njk +12 -6
  36. package/src/templates/components/tabs/_examples.tabs.njk +4 -1
  37. package/src/templates/pages/_template.with-header-advanced.njk +218 -37
@@ -18,8 +18,9 @@ import { notification } from './aria/notification.js';
18
18
  import { RadioButton } from './aria/radioButton.js';
19
19
  import { CheckBox } from './aria/checkBoxes.js';
20
20
  import { MenuVertical } from './aria/MenuVertical.js';
21
- import { MenuNavigation } from './aria/MenuNavigation.js';
22
21
  import { HeaderNavigation } from './aria/HeaderNavigation.js';
22
+ import { MenuHorizontal } from './aria/MenuHorizontal.js';
23
+ import { MenuNavigation } from './aria/MenuNavigation.js';
23
24
  import { Nav } from './aria/Nav.js';
24
25
 
25
26
 
@@ -125,17 +126,36 @@ export function dropdownComponent(aria) {
125
126
  export function listboxComponent(aria) {
126
127
  listbox(aria);
127
128
  const modules = document.querySelectorAll('[data-module]');
129
+ let activeButton;
128
130
  for (const item in modules) if (modules.hasOwnProperty(item)) {
129
131
  const moduleValue = modules[item].getAttribute('data-module');
130
132
 
131
-
132
133
  if (moduleValue == 'c-listbox'){
133
134
  const buttonListbox = modules[item].querySelector('[data-module = "c-listbox-button"]');
134
135
  const tooltip = modules[item].querySelector('[data-module = "c-listbox-tooltip"]');
135
136
  const list = modules[item].querySelector('[data-module = "c-listbox-list"]');
136
-
137
137
  if(buttonListbox && tooltip) {
138
138
  const listbox = new aria.Listbox(list);
139
+ const hideOnClick = {
140
+ name: 'hideOnClick',
141
+ defaultValue: true,
142
+ fn(instance) {
143
+ return {
144
+ onCreate() {
145
+ buttonListbox.addEventListener("click", (event) => {
146
+ if(!buttonListbox.classList.contains('open')){
147
+ instance.show();
148
+ list.focus()
149
+ buttonListbox.classList.add('open');
150
+ } else {
151
+ list.blur();
152
+ instance.hide();
153
+ }
154
+ });
155
+ },
156
+ };
157
+ },
158
+ };
139
159
  const hideOnPopperBlur = {
140
160
  /* https://atomiks.github.io/tippyjs/v6/plugins/#hideonpopperblur */
141
161
  name: 'hideOnPopperBlur',
@@ -184,34 +204,40 @@ export function listboxComponent(aria) {
184
204
  inlinePositioning: true,
185
205
  content: tooltip,
186
206
  allowHTML: true, // Make sure you are sanitizing any user data if rendering HTML to prevent XSS attacks.
187
- trigger: 'click',
188
- hideOnClick: true,
207
+ trigger: 'manual',
189
208
  interactive: true,
190
209
  arrow: false,
191
210
  offset: [0, -10],
192
211
  theme: '',
193
- plugins: [hideOnEscOrEnter,hideOnPopperBlur],
212
+ plugins: [hideOnEscOrEnter,hideOnPopperBlur, hideOnClick],
194
213
  role: false,
195
214
  aria: {
196
215
  content: 'auto'
197
216
  },
198
- onShown(instance) {
199
- list.focus();
217
+ onMount(instance) {
200
218
  if (list.querySelectorAll('[aria-selected="true"]')[0]) {
201
219
  listbox.focusItem(list.querySelectorAll('[aria-selected="true"]')[0]);
202
220
  }
203
221
  },
204
- onHidden(instance) {
205
- buttonListbox.focus();
222
+ onHidden(instance){
223
+ buttonListbox.classList.remove('open');
206
224
  }
207
225
  });
208
226
 
209
227
  listbox.setHandleFocusChange(function(evt){
210
- if ((!list.hasAttribute('aria-multiselectable'))&&(buttonListbox.getAttribute('data-change')=='change')){
228
+ if ((!list.hasAttribute('aria-multiselectable')) && (buttonListbox.getAttribute('data-change')=='change')){
211
229
  buttonListbox.firstElementChild.innerHTML = evt.innerHTML;
212
230
  }
213
231
  });
214
232
 
233
+ const getMultiSelectable = buttonListbox.getAttribute('aria-labelledby');
234
+ const allowMultiple = getMultiSelectable.includes('is-multiselectable-label');
235
+
236
+ if(!allowMultiple) {
237
+ list.addEventListener("click", (event) => {
238
+ buttonListbox.click();
239
+ })
240
+ }
215
241
  }
216
242
  }
217
243
  }
@@ -375,12 +401,21 @@ export function MenuVerticalComponent(aria) {
375
401
  });
376
402
  }
377
403
 
404
+ export function MenuHorizontalComponent(aria) {
405
+ MenuHorizontal(aria);
406
+ const modules = document.querySelectorAll('[data-module="c-menu-horizontal"]');
407
+ [...modules].forEach((module) => {
408
+ const MenuHorizontal = new aria.MenuHorizontal(module);
409
+ MenuHorizontal.init(null);
410
+ });
411
+ }
412
+
378
413
  export function MenuNavigationComponent(aria) {
379
414
  MenuNavigation(aria);
380
415
  const modules = document.querySelectorAll('[data-module="c-menu-navigation"]');
381
416
  [...modules].forEach((module) => {
382
417
  const menuNavigation = new aria.MenuNavigation(module);
383
- menuNavigation.init();
418
+ menuNavigation.init(null);
384
419
  });
385
420
  }
386
421
 
package/src/js/index.js CHANGED
@@ -21,6 +21,7 @@ import {
21
21
  radioButtonComponent,
22
22
  checkBoxComponent,
23
23
  MenuVerticalComponent,
24
+ MenuHorizontalComponent,
24
25
  MenuNavigationComponent,
25
26
  HeaderNavigationComponent,
26
27
  NavComponent
@@ -45,6 +46,7 @@ notificationComponent(aria);
45
46
  radioButtonComponent(aria);
46
47
  checkBoxComponent(aria);
47
48
  MenuVerticalComponent(aria);
49
+ MenuHorizontalComponent(aria);
48
50
  MenuNavigationComponent(aria);
49
51
  HeaderNavigationComponent(aria);
50
52
  NavComponent(aria);
@@ -70,7 +70,7 @@
70
70
  },
71
71
  {
72
72
  "name": "Con un item abierto",
73
- "description": 'Podemos abrir inicialmente un item si le añadimos el parámetro <code>"open": true</code>.',
73
+ "description": 'Podemos abrir inicialmente un item si le añadimos el parámetro <code>"open": true</code>. También puedes usar con javascript la función global <code>activateItemAccordion(elementMenu, activeItemId)</code> para abrir un item, usando sus ids. Ej: Abre la consola del navegador y escribe <code>activateItemAccordion("accordion", "with-one-item-opened-example-1-title")</code> para cerrar el item actual y abrir el primer item de este ejemplo.',
74
74
  "data": {
75
75
  "idPrefix": "with-one-item-opened-example",
76
76
  "headingLevel": 3,
@@ -89,12 +89,15 @@
89
89
  "headerText": "Item de acordeón 3",
90
90
  "html": '<div class="w-48 p-2"><div class="border-4 border-dashed border-neutral-light rounded-lg h-40"></div></div>'
91
91
  }
92
- ]
92
+ ],
93
+ "attributes": {
94
+ "id": "accordion"
95
+ }
93
96
  }
94
97
  },
95
98
  {
96
99
  "name": "Con 2 items abiertos",
97
- "description": 'Podemos abrir inicialmente items si les añadimos el parámetro <code>"open": true</code>.',
100
+ "description": 'Podemos abrir inicialmente items si les añadimos el parámetro <code>"open": true</code>. También puedes usar con javascript la función global <code>activateItemAccordion(elementMenu, activeItemsIds)</code> para abrir varios items, usando sus ids. Ej: Abre la consola del navegador y escribe <code>activateItemAccordion("accordion-multiple", ["with-2-items-opened-example-2-title", "with-2-items-opened-example-3-title"])</code>.',
98
101
  "data": {
99
102
  "idPrefix": "with-2-items-opened-example",
100
103
  "headingLevel": 3,
@@ -114,7 +117,10 @@
114
117
  "html": '<div class="w-48 p-2"><div class="border-4 border-dashed border-neutral-light rounded-lg h-40"></div></div>',
115
118
  "open": true
116
119
  }
117
- ]
120
+ ],
121
+ "attributes": {
122
+ "id": "accordion-multiple"
123
+ }
118
124
  }
119
125
  },
120
126
  {
@@ -38,7 +38,7 @@
38
38
  {% endif %}
39
39
  {% endif %}
40
40
  {% if params.showControl %}
41
- <button class="c-accordion__toggle-all ml-auto py-base text-sm text-neutral-dark underline focus:text-black focus:bg-warning-base focus:outline-none focus:shadow-outline-focus text-right">
41
+ <button class="c-accordion__toggle-all ml-auto py-base text-sm text-neutral-dark underline focus:text-black focus:bg-warning-base focus:outline-none focus:shadow-outline-focus text-right" type="button">
42
42
  Mostrar todo
43
43
  </button>
44
44
  {% endif %}
@@ -57,6 +57,7 @@
57
57
 
58
58
  <button
59
59
  id="{{ id }}-title"
60
+ type="button"
60
61
  class="c-accordion__trigger group relative w-full py-sm font-semibold text-left cursor-pointer focus:bg-warning-base focus:outline-none focus:shadow-outline-focus focus:text-black {%- if item.disabled %} cursor-not-allowed{% endif %}"
61
62
  aria-controls="{{ id }}"
62
63
  {% if item.open %}
@@ -106,7 +106,7 @@
106
106
  },
107
107
  {
108
108
  "name": "Con un item abierto",
109
- "description": 'Podemos abrir inicialmente un item si le añadimos el parámetro <code>"open": true</code>.',
109
+ "description": 'Podemos abrir inicialmente un item si le añadimos el parámetro <code>"open": true</code>. También puedes usar con javascript la función global <code>activateItemAccordion(elementMenu, activeItemId)</code> para abrir un item, usando sus ids. Ej: Abre la consola del navegador y escribe <code>activateItemAccordion("accordion-history", "with-one-item-opened-example-1-title")</code> para cerrar el item actual y abrir el primer item de este ejemplo.',
110
110
  "data": {
111
111
  "idPrefix": "with-one-item-opened-example",
112
112
  "headingLevel": 3,
@@ -125,12 +125,15 @@
125
125
  "headerText": "Item de acordeón 3",
126
126
  "html": '<div class="w-48 p-2"><div class="border-4 border-dashed border-neutral-light rounded-lg h-40"></div></div>'
127
127
  }
128
- ]
128
+ ],
129
+ "attributes": {
130
+ "id": "accordion-history"
131
+ }
129
132
  }
130
133
  },
131
134
  {
132
135
  "name": "Con 2 items abiertos",
133
- "description": 'Podemos abrir inicialmente items si les añadimos el parámetro <code>"open": true</code>.',
136
+ "description": 'Podemos abrir inicialmente items si les añadimos el parámetro <code>"open": true</code>. También puedes usar con javascript la función global <code>activateItemAccordion(elementMenu, activeItemsIds)</code> para abrir varios items, usando sus ids. Ej: Abre la consola del navegador y escribe <code>activateItemAccordion("accordion-history-multiple", ["with-2-items-opened-example-2-title", "with-2-items-opened-example-3-title"])</code>.',
134
137
  "data": {
135
138
  "idPrefix": "with-2-items-opened-example",
136
139
  "headingLevel": 3,
@@ -150,7 +153,10 @@
150
153
  "html": '<div class="w-48 p-2"><div class="border-4 border-dashed border-neutral-light rounded-lg h-40"></div></div>',
151
154
  "open": true
152
155
  }
153
- ]
156
+ ],
157
+ "attributes": {
158
+ "id": "accordion-history-multiple"
159
+ }
154
160
  }
155
161
  },
156
162
  {
@@ -380,4 +386,4 @@
380
386
  ]
381
387
  }
382
388
  }
383
- ] %}
389
+ ] %}
@@ -39,7 +39,7 @@
39
39
  {% endif %}
40
40
  {% endif %}
41
41
  {% if params.showControl %}
42
- <button class="c-accordion__toggle-all ml-auto py-base text-sm text-neutral-dark underline focus:text-black focus:bg-warning-base focus:outline-none focus:shadow-outline-focus text-right">
42
+ <button class="c-accordion__toggle-all ml-auto py-base text-sm text-neutral-dark underline focus:text-black focus:bg-warning-base focus:outline-none focus:shadow-outline-focus text-right" type="button">
43
43
  Mostrar todo
44
44
  </button>
45
45
  {% endif %}
@@ -58,6 +58,7 @@
58
58
 
59
59
  <button
60
60
  id="{{ id }}-title"
61
+ type="button"
61
62
  class="c-accordion__trigger group relative w-full py-sm font-semibold text-left cursor-pointer focus:bg-warning-base focus:outline-none focus:shadow-outline-focus focus:text-black {%- if item.disabled %} cursor-not-allowed{% endif %}"
62
63
  aria-controls="{{ id }}"
63
64
  {% if item.open %}
@@ -6,6 +6,7 @@
6
6
  <button
7
7
  onclick="closeDialog(this)"
8
8
  id="header-offcanvas-button-close"
9
+ type="button"
9
10
  class="c-button c-button--sm c-button--transparent m-sm">{{ params.text }} <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14" width="14" height="14" class="self-center ml-2" aria-hidden="true"><path fill="currentColor" d="M8.591 7.177a.25.25 0 010-.354l4.616-4.616A1 1 0 1011.793.793L7.177 5.409a.25.25 0 01-.354 0L2.207.793A1 1 0 00.793 2.207l4.616 4.616a.25.25 0 010 .354L.793 11.793a1 1 0 001.414 1.414l4.616-4.616a.25.25 0 01.354 0l4.616 4.616a1 1 0 001.414-1.414z"/></svg></button>
10
11
  </div>
11
12
  {% if caller %}
@@ -1,6 +1,7 @@
1
1
  <!-- header__offcanvasButton -->
2
2
  <div class="{{ params.classes if params.classes else '-mr-2 flex lg:hidden' }}">
3
3
  <button id="header-offcanvas-button"
4
+ type="button"
4
5
  onclick="openDialog('header-offcanvas', this)"
5
6
  tabindex="0"
6
7
  class="inline-flex items-center px-3 py-4 text-sm text-black focus:outline-none focus:shadow-outline-black focus:bg-warning-base" aria-haspopup="true">
@@ -444,6 +444,7 @@
444
444
  },
445
445
  {
446
446
  "name": "con item activo",
447
+ "description": 'Podemos seleccionar inicialmente un item si le añadimos el parámetro <code>"active": true</code>. También puedes usar con javascript la función global <code>activateItemListBox(elementMenu, activeItemId)</code> para seleccionar un item, usando sus ids. Ej: Abre la consola del navegador y escribe <code>activateItemListBox("listbox", "with-active-item-listbox-item-2")</code> para seleccionar el segundo item de este ejemplo.',
447
448
  "data": {
448
449
  "id": "with-active-item",
449
450
  "text": "con item activo",
@@ -472,12 +473,15 @@
472
473
  "href": "#",
473
474
  "text": "Opción 5"
474
475
  }
475
- ]
476
+ ],
477
+ "attributes": {
478
+ "id": "listbox"
479
+ }
476
480
  }
477
481
  },
478
482
  {
479
483
  "name": "Permite selecciones múltiples",
480
- "description": 'Usa el parámetro <code>"isMultiselectable": true</code>.',
484
+ "description": 'Usa el parámetro <code>"isMultiselectable": true</code>. En este caso al seleccionar un item el elemento no se cerrará. También puedes usar con javascript la función global <code>activateItemListBox(elementMenu, activeItemId)</code> para seleccionar varios items, usando sus ids. Ej: Abre la consola del navegador y escribe <code>activateItemListBox("listbox-multiple", ["is-multiselectable-listbox-item-2", "is-multiselectable-listbox-item-3"])</code> para seleccionar el segundo y el tercer item de este ejemplo.',
481
485
  "data": {
482
486
  "id": "is-multiselectable",
483
487
  "isMultiselectable": true,
@@ -506,7 +510,10 @@
506
510
  "href": "#",
507
511
  "text": "Opción 5"
508
512
  }
509
- ]
513
+ ],
514
+ "attributes": {
515
+ "id": "listbox-multiple"
516
+ }
510
517
  }
511
518
  },
512
519
  {
@@ -609,4 +616,4 @@
609
616
  ]
610
617
  }
611
618
  }
612
- ] %}
619
+ ] %}
@@ -66,7 +66,7 @@ treat it as an interactive element - without this it will be
66
66
  {% endset -%}
67
67
 
68
68
  <!-- listbox -->
69
- <div data-module="c-listbox" class="{% if params.classesContainer %}{{ params.classesContainer }}{% else %} relative{% endif %}">
69
+ <div data-module="c-listbox" class="{% if params.classesContainer %}{{ params.classesContainer }}{% else %} relative{% endif %}" {%- for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}>
70
70
  {% if params.label %}
71
71
  <div id="{{ params.id }}-label" class="mb-sm {%- if params.label.classes %} {{ params.label.classes }}{% endif %}">
72
72
  {% if params.label.html %}
@@ -87,4 +87,4 @@ treat it as an interactive element - without this it will be
87
87
  </ul>
88
88
  </div>
89
89
  </div>
90
- <!-- /listbox -->
90
+ <!-- /listbox -->
@@ -63,6 +63,7 @@
63
63
  },
64
64
  {
65
65
  "name": "con item activo",
66
+ "description": 'Añade active: true a un item para mostrarlo activo inicialmente. También puedes usar con javascript la función global <code>activateItemMenuHorizontal(elementMenu, idItemSeleccionado)</code> para seleccionar un item de un menú, usando sus ids. Ej: Abre la consola del navegador y escribe <code>activateItemMenuHorizontal("mi-menu-horizontal", "menu-item-2")</code> para desactivar el item actual y activar el segundo item de este ejemplo.',
66
67
  "data": {
67
68
  "items": [
68
69
  {
@@ -79,7 +80,7 @@
79
80
  },
80
81
  {
81
82
  "href": "http://www.google.com",
82
- "text": "Opción 4 activa",
83
+ "text": "Opción 4",
83
84
  "active": true
84
85
  },
85
86
  {
@@ -88,7 +89,8 @@
88
89
  }
89
90
  ],
90
91
  "attributes": {
91
- "aria-label": "Menu horizontal"
92
+ "aria-label": "Menu horizontal",
93
+ "id":"mi-menu-horizontal"
92
94
  }
93
95
  }
94
96
  },
@@ -311,4 +313,4 @@
311
313
  ]
312
314
  }
313
315
  }
314
- ] %}
316
+ ] %}
@@ -3,7 +3,7 @@
3
3
  {% set idPrefix = params.idPrefix if params.idPrefix else "menu-item" %}
4
4
 
5
5
  <!-- menu-horizontal -->
6
- <nav class="c-menu-horizontal {%- if params.classes %} {{ params.classes }}{% endif -%}"
6
+ <nav data-module="c-menu-horizontal" class="c-menu-horizontal {%- if params.classes %} {{ params.classes }}{% endif -%}"
7
7
  {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}>
8
8
  <ul class="c-menu-horizontal__list lg:flex lg:flex-wrap">
9
9
  {% for item in params.items %}
@@ -33,4 +33,4 @@
33
33
  {% endfor %}
34
34
  </ul>
35
35
  </nav>
36
- <!-- /menu-horizontal -->
36
+ <!-- /menu-horizontal -->
@@ -2,7 +2,7 @@
2
2
  {% set examples = [
3
3
  {
4
4
  "name": "Por defecto",
5
- "description": "El menubar se usa para interactuar con él y realizar cambios en otra parte de la página, no como menú de navegación. Si necesitas una navegación con enlaces, debes usas el componente Menu navigation en vez de este Menubar. Este ejmplo muestra parámetros mixtos.",
5
+ "description": "El menubar se usa para interactuar con él y realizar cambios en otra parte de la página, no como menú de navegación. Si necesitas una navegación con enlaces, debes usas el componente Menu navigation en vez de este Menubar. Este ejemplo muestra parámetros mixtos.",
6
6
  "data": {
7
7
  "id": "with-all-parent-items-1",
8
8
  "idPrefix": "parent-example",
@@ -154,7 +154,7 @@
154
154
  },
155
155
  {
156
156
  "name": "Tiene selección en items padres",
157
- "description": "Cuando se ha seleccionado algún elemento hijo, el padre se muestra con color.",
157
+ "description": "Cuando se ha seleccionado algún elemento hijo, si se desea, el padre se puede mostrar con color usando la clase <code>.c-menubar__button--has-selection</code>.",
158
158
  "data": {
159
159
  "id": "with-all-parent-items-2",
160
160
  "idPrefix": "parent-example",
@@ -306,6 +306,159 @@
306
306
  ]
307
307
  }
308
308
  },
309
+ {
310
+ "name": "Con sub-item activo",
311
+ "description": "Cuando se ha seleccionado algún elemento hijo, el padre se muestra con color. Añade <code>active: true</code> a un sub-item para mostrarlo activo inicialmente. También puedes usar con javascript la función global <code>activateItemMenuBarAction(elementMenu, idItemSeleccionado)</code> para seleccionar un sub-item o varios sub-items de un menú, usando sus ids. Ej: Abre la consola del navegador y escribe <code>activateItemMenuBarAction('mi-menubar', 'sub-sub-menuitems-example-item-3-2-1-1')</code> para desactivar el sub-item actual y activar el primer sub-item del tercer menú de este ejemplo. Si quieres activar varios sub-items, abre la consola del navegador y escribe <code>activateItemMenuBarAction('mi-menubar', ['sub-menuitems-example-item-2-2-1', 'sub-menuitems-example-item-2-2-2', 'sub-menuitems-example-item-2-2-3'])</code>.",
312
+ "data": {
313
+ "id": "mi-menubar",
314
+ "idPrefix": "parent-example",
315
+ "ariaLabel":"Menubar descrición",
316
+ "items": [
317
+ {
318
+ "text": "Menuitem",
319
+ "ariaLabel": "Menuitem",
320
+ "id": "menuitems-example-item-1-2",
321
+ "sub": {
322
+ "items": [
323
+ {
324
+ "role": "menuitem",
325
+ "text": "Subitem 1"
326
+ },
327
+ {
328
+ "role": "menuitem",
329
+ "text": "Subitem 2"
330
+ },
331
+ {
332
+ "role": "menuitem",
333
+ "text": "Subitem 3"
334
+ }
335
+ ]
336
+ },
337
+ "classes": "mb-base mr-base"
338
+ },
339
+ {
340
+ "text": "Menuitemcheckbox",
341
+ "ariaLabel": "Menuitemcheckbox",
342
+ "id": "menuitems-example-item-2-2",
343
+ "classes": "mb-base mr-base",
344
+ "sub": {
345
+ "items": [
346
+ {
347
+ "role": "menuitemcheckbox",
348
+ "text": "Subitem 1"
349
+ },
350
+ {
351
+ "role": "menuitemcheckbox",
352
+ "text": "Subitem 2",
353
+ "active": true
354
+ },
355
+ {
356
+ "role": "menuitemcheckbox",
357
+ "text": "Subitem 3"
358
+ }
359
+ ]
360
+ }
361
+ },
362
+ {
363
+ "text": "Menuitemradio",
364
+ "ariaLabel": "Menuitemradio",
365
+ "id": "menuitems-example-item-3-2",
366
+ "sub": {
367
+ "items": [
368
+ {
369
+ "role": "group",
370
+ "ariaLabel": "group label",
371
+ "items": [
372
+ {
373
+ "role": "menuitemradio",
374
+ "text": "Radio 1"
375
+ },
376
+ {
377
+ "role": "menuitemradio",
378
+ "text": "Radio 2"
379
+ },
380
+ {
381
+ "role": "menuitemradio",
382
+ "text": "Radio 3"
383
+ }
384
+ ]
385
+ }
386
+ ]
387
+ },
388
+ "classes": "mb-base mr-base"
389
+ },
390
+ {
391
+ "text": "Items mixtos",
392
+ "ariaLabel": "Items mixtos",
393
+ "id": "menuitems-example-item-4-2",
394
+ "sub": {
395
+ "items": [
396
+ {
397
+ "role": "group",
398
+ "ariaLabel": "Tamaño de letra",
399
+ "items": [
400
+ {
401
+ "role": "menuitem",
402
+ "text": "Tamaño mayor"
403
+ },
404
+ {
405
+ "role": "menuitem",
406
+ "text": "Tamaño menor"
407
+ }
408
+ ]
409
+ },
410
+ {
411
+ "role": "separator"
412
+ },
413
+ {
414
+ "role": "group",
415
+ "ariaLabel": "Estilo de letra",
416
+ "items": [
417
+ {
418
+ "role": "menuitemcheckbox",
419
+ "text": "Negritas"
420
+ },
421
+ {
422
+ "role": "menuitemcheckbox",
423
+ "text": "Itálicas"
424
+ }
425
+ ]
426
+ },
427
+ {
428
+ "role": "separator"
429
+ },
430
+ {
431
+ "role": "group",
432
+ "ariaLabel": "Estilo de texto",
433
+ "items": [
434
+ {
435
+ "role": "menuitemradio",
436
+ "text": "Ninguno"
437
+ },
438
+ {
439
+ "role": "menuitemradio",
440
+ "text": "Tachado"
441
+ },
442
+ {
443
+ "role": "menuitemradio",
444
+ "text": "Subrayado"
445
+ }
446
+ ]
447
+ }
448
+ ]
449
+ },
450
+ "classes": "mb-base mr-base"
451
+ },
452
+ {
453
+ "text": "Menuitem solo",
454
+ "ariaLabel": "Menuitem solo",
455
+ "id": "menuitems-example-item-6-2",
456
+ "classes": "c-menubar__button--transparent mb-base mr-base",
457
+ "href": "#"
458
+ }
459
+ ]
460
+ }
461
+ },
309
462
  {
310
463
  "name": "con un item padre deshabilitado",
311
464
  "data": {
@@ -1467,4 +1620,4 @@
1467
1620
  ]
1468
1621
  }
1469
1622
  }
1470
- ] %}
1623
+ ] %}
@@ -23,7 +23,7 @@
23
23
  {% set subId = "sub-" + id %}
24
24
  <li class="relative" role="none">
25
25
  {% if item.sub %}
26
- <a href="#" role="menuitem" aria-haspopup="true" aria-expanded="false" class="c-menubar__button {%- if item.classes %} {{ item.classes }}{% endif %} {%- if item.disabled %} c-menubar__button--disabled{% endif %} {%- if item.active %} c-menubar__button--primary{% endif %}" {%- if item.title %} title="{{ item.title }}"{% endif %} {% if item.disabled %} aria-disabled="true" tabindex="-1"{% endif %} id="{{ id }}"
26
+ <a href="#" role="menuitem" aria-haspopup="true" aria-expanded="false" class="c-menubar__button {%- if item.classes %} {{ item.classes }}{% endif %} {%- if item.disabled %} c-menubar__button--disabled{% endif %} {%- if item.active %} c-menu-navigation__button--has-selection{% endif %}" {%- if item.title %} title="{{ item.title }}"{% endif %} {% if item.disabled %} aria-disabled="true" tabindex="-1"{% endif %} id="{{ id }}"
27
27
  {%- if item.sub.html %} data-aria-controls="{{ subId }}"{% endif %}
28
28
  {%- for attribute, value in item.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}>
29
29
  <span class="inline-flex self-center max-w-xs align-middle truncate">{{ item.html | safe if item.html else item.text }}</span>
@@ -32,7 +32,7 @@
32
32
  </a>
33
33
  {% endif %}
34
34
  {% if item.href and not item.sub %}
35
- <a role="menuitem" {%- if id %} id="{{ id }}"{% endif %} {%- if item.href %} href="{{ item.href }}"{% endif %} class="c-menubar__button {%- if item.classes %} {{ item.classes }}{% endif %} {%- if item.disabled %} c-menubar__button--disabled{% endif %} {%- if item.active %} c-menubar__button--primary{% endif %}" {%- if item.title %} title="{{ item.title }}"{% endif %} {% if item.disabled %} disabled="disabled" aria-disabled="true" tabindex="-1"{% endif %} {% if item.target %} target="{{ item.target }}"{% endif %}{%- for attribute, value in item.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}>
35
+ <a role="menuitem" {%- if id %} id="{{ id }}"{% endif %} {%- if item.href %} href="{{ item.href }}"{% endif %} class="c-menubar__button {%- if item.classes %} {{ item.classes }}{% endif %} {%- if item.disabled %} c-menubar__button--disabled{% endif %} {%- if item.active %} c-menu-navigation__button--has-selection{% endif %}" {%- if item.title %} title="{{ item.title }}"{% endif %} {% if item.disabled %} disabled="disabled" aria-disabled="true" tabindex="-1"{% endif %} {% if item.target %} target="{{ item.target }}"{% endif %}{%- for attribute, value in item.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}>
36
36
  {{ item.html | safe if item.html else item.text }}
37
37
  </a>
38
38
  {% endif %}
@@ -120,7 +120,7 @@
120
120
  </div>
121
121
  {% if params.isDismissible %}
122
122
  <div class="absolute top-0 right-0 p-sm lg:p-base">
123
- <button onclick="closeDialog(this)" class="p-sm focus:bg-warning-base focus:border-warning-base focus:shadow-outline-black focus:text-black focus:outline-none" aria-label="X: Cerrar la ventana emergente">
123
+ <button onclick="closeDialog(this)" class="p-sm focus:bg-warning-base focus:border-warning-base focus:shadow-outline-black focus:text-black focus:outline-none" aria-label="X: Cerrar la ventana emergente" type="button">
124
124
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 140 140" width="1em" height="1em" class="w-4 h-4" aria-hidden="true" role="presentation"><path d="M85.91 71.77a2.5 2.5 0 010-3.54l46.16-46.16a10 10 0 10-14.14-14.14L71.77 54.09a2.5 2.5 0 01-3.54 0L22.07 7.93A10 10 0 007.93 22.07l46.16 46.16a2.5 2.5 0 010 3.54L7.93 117.93a10 10 0 0014.14 14.14l46.16-46.16a2.5 2.5 0 013.54 0l46.16 46.16a10 10 0 0014.14-14.14z" fill="currentColor"/></svg>
125
125
  </button>
126
126
  </div>
@@ -68,7 +68,7 @@
68
68
  </div>
69
69
  {% if params.isDismissible %}
70
70
  <div class="absolute top-0 right-0 p-sm">
71
- <button class="c-notification-button__close p-sm focus:bg-warning-base focus:border-warning-base focus:shadow-outline-black focus:text-black focus:outline-none" aria-label="X: Cerrar notificación">
71
+ <button type="button" class="c-notification-button__close p-sm focus:bg-warning-base focus:border-warning-base focus:shadow-outline-black focus:text-black focus:outline-none" aria-label="X: Cerrar notificación">
72
72
  <svg class="w-4 h-4 pointer-events-none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 140 140" width="1em" height="1em" aria-hidden="true" role="presentation"><path d="M85.91 71.77a2.5 2.5 0 010-3.54l46.16-46.16a10 10 0 10-14.14-14.14L71.77 54.09a2.5 2.5 0 01-3.54 0L22.07 7.93A10 10 0 007.93 22.07l46.16 46.16a2.5 2.5 0 010 3.54L7.93 117.93a10 10 0 0014.14 14.14l46.16-46.16a2.5 2.5 0 013.54 0l46.16 46.16a10 10 0 0014.14-14.14z" fill="currentColor"/></svg>
73
73
  </button>
74
74
  </div>