desy-html 8.6.0 → 8.7.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 (29) 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 +6 -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/tabs.js +4 -4
  17. package/src/js/desy-html.js +12 -2
  18. package/src/js/index.js +2 -0
  19. package/src/templates/components/accordion/_template.accordion.njk +2 -1
  20. package/src/templates/components/accordion-history/_template.accordion-history.njk +2 -1
  21. package/src/templates/components/header/_template.header.header__offcanvas.njk +1 -0
  22. package/src/templates/components/header/_template.header.header__offcanvasButton.njk +1 -0
  23. package/src/templates/components/menu-horizontal/_examples.menu-horizontal.njk +5 -3
  24. package/src/templates/components/menu-horizontal/_template.menu-horizontal.njk +2 -2
  25. package/src/templates/components/menubar/_examples.menubar.njk +156 -3
  26. package/src/templates/components/menubar/_template.menubar.njk +2 -2
  27. package/src/templates/components/modal/_template.modal.njk +1 -1
  28. package/src/templates/components/notification/_template.notification.njk +1 -1
  29. package/src/templates/components/pagination/_template.pagination.njk +12 -6
@@ -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>
@@ -40,7 +40,8 @@
40
40
  "attributes": {
41
41
  "id": id,
42
42
  "aria-current": "page",
43
- "tabindex": "-1"
43
+ "tabindex": "-1",
44
+ "type": "button"
44
45
  }
45
46
  }) | trim | indent(4) }}
46
47
  {% else %}
@@ -49,7 +50,8 @@
49
50
  "href": "#",
50
51
  "classes": "mb-sm mr-sm",
51
52
  "attributes": {
52
- "id": id
53
+ "id": id,
54
+ "type": "button"
53
55
  }
54
56
  }) | trim | indent(4) }}
55
57
  {% endif %}
@@ -81,7 +83,8 @@
81
83
  "disabled": disabledFirst,
82
84
  "classes": "c-button--sm c-button--transparent mr-xs",
83
85
  "attributes": {
84
- "id": params.idPrefix + "-first"
86
+ "id": params.idPrefix + "-first",
87
+ "type": "button"
85
88
  }
86
89
  }) | trim | indent(4) }}
87
90
  {% endif %}
@@ -92,7 +95,8 @@
92
95
  "disabled": disabledPrevious,
93
96
  "classes": "c-button--sm c-button--transparent mr-xs",
94
97
  "attributes": {
95
- "id": params.idPrefix + "-previous"
98
+ "id": params.idPrefix + "-previous",
99
+ "type": "button"
96
100
  }
97
101
  }) | trim | indent(4) }}
98
102
  {% endif %}
@@ -121,7 +125,8 @@
121
125
  "disabled": disabledNext,
122
126
  "classes": "c-button--sm c-button--transparent mr-xs",
123
127
  "attributes": {
124
- "id": params.idPrefix + "-next"
128
+ "id": params.idPrefix + "-next",
129
+ "type": "button"
125
130
  }
126
131
  }) | trim | indent(4) }}
127
132
  {% endif %}
@@ -132,7 +137,8 @@
132
137
  "disabled": disabledLast,
133
138
  "classes": "c-button--sm c-button--transparent mr-xs",
134
139
  "attributes": {
135
- "id": params.idPrefix + "-last"
140
+ "id": params.idPrefix + "-last",
141
+ "type": "button"
136
142
  }
137
143
  }) | trim | indent(4) }}
138
144
  {% endif %}