desy-html 8.5.0 → 8.6.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.
- package/docs/_macro.example-render.njk +1 -1
- package/docs/_macro.show-code-from-file.njk +1 -1
- package/docs/_macro.show-html-from-file.njk +1 -1
- package/docs/ds/_ds.macro.code-snippet.njk +1 -1
- package/docs/index.html +6 -0
- package/package.json +1 -1
- package/src/js/aria/MenuNavigation.js +115 -0
- package/src/js/desy-html.js +10 -0
- package/src/js/index.js +2 -0
- package/src/templates/components/menu-navigation/_examples.menu-navigation.njk +90 -63
- package/src/templates/components/menu-navigation/_styles.menu-navigation.css +4 -0
- package/src/templates/components/menu-navigation/_template.menu-navigation.njk +5 -21
- package/src/templates/components/menu-navigation/params.menu-navigation.yaml +4 -0
|
@@ -301,7 +301,7 @@ import componentTree %}
|
|
|
301
301
|
}
|
|
302
302
|
}) %}
|
|
303
303
|
{{ componentTabs({
|
|
304
|
-
"tablistAriaLabel": "
|
|
304
|
+
"tablistAriaLabel": "Ejemplos de código de: " + example.name | capitalize,
|
|
305
305
|
"idPrefix": "tab-" + loop.index,
|
|
306
306
|
"classes": "c-tabs--scroll",
|
|
307
307
|
"items": [
|
|
@@ -35,7 +35,7 @@ import componentTabs %}
|
|
|
35
35
|
}
|
|
36
36
|
}) %}
|
|
37
37
|
{{ componentTabs({
|
|
38
|
-
"tablistAriaLabel": "
|
|
38
|
+
"tablistAriaLabel": "Ejemplo de código de: " + filePath,
|
|
39
39
|
"idPrefix": "tab-" + filePath | replace("/", "-") | replace("_", "") | replace(".", "-"),
|
|
40
40
|
"classes": "c-tabs--scroll",
|
|
41
41
|
"items": [
|
|
@@ -25,7 +25,7 @@ import componentTabs %}
|
|
|
25
25
|
}
|
|
26
26
|
}) %}
|
|
27
27
|
{{ componentTabs({
|
|
28
|
-
"tablistAriaLabel": "
|
|
28
|
+
"tablistAriaLabel": "Ejemplo de código de: " + filePath,
|
|
29
29
|
"idPrefix": "tab-" + filePath | replace("/", "-") | replace("_", "") | replace(".", "-"),
|
|
30
30
|
"classes": "c-tabs--scroll",
|
|
31
31
|
"items": [
|
package/docs/index.html
CHANGED
|
@@ -38,6 +38,12 @@
|
|
|
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.8.6.0</h3>
|
|
42
|
+
<ul class="text-sm">
|
|
43
|
+
<li>Added global function to select items and subitems in Menu navigation.</li>
|
|
44
|
+
<li>Bug fixes.</li>
|
|
45
|
+
<li>Improvements in docs.</li>
|
|
46
|
+
</ul>
|
|
41
47
|
<h3>v.8.5.0</h3>
|
|
42
48
|
<ul class="text-sm">
|
|
43
49
|
<li>Added global function to select an item in Tabs.</li>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "desy-html",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.6.0",
|
|
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)",
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
export function MenuNavigation(aria) {
|
|
2
|
+
(function () {
|
|
3
|
+
aria.MenuNavigation = function (domNode) {
|
|
4
|
+
this.domNode = domNode;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
aria.MenuNavigation.prototype.init = function () {
|
|
8
|
+
const menuItems = this.domNode.querySelectorAll('a');
|
|
9
|
+
const getItemsFromMenu = Array.from(menuItems);
|
|
10
|
+
|
|
11
|
+
if(getItemsFromMenu.some(item => item.classList.contains('c-menu-navigation__button--has-selection'))) {
|
|
12
|
+
getItemsFromMenu.forEach((button) => {
|
|
13
|
+
if(button.classList.contains('c-menu-navigation__button--has-selection')) {
|
|
14
|
+
this.activateElement(button.id);
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if(this.domNode.querySelectorAll('.c-menu-navigation__sub--list')) {
|
|
20
|
+
const subItems = this.domNode.querySelectorAll('.c-menu-navigation__sub--list li a');
|
|
21
|
+
[...subItems].forEach((element) => {
|
|
22
|
+
if(element.getAttribute("aria-current") === "true"){
|
|
23
|
+
const getElement = element.parentElement.parentElement.parentElement.parentElement.querySelector('button');
|
|
24
|
+
getElement.classList.add('c-menu-navigation__button--primary', 'c-menu-navigation__button--has-selection');
|
|
25
|
+
getElement.firstChild.innerHTML = `<strong class="font-bold">${getElement.textContent}</strong>`;
|
|
26
|
+
element.innerHTML = `<strong class="font-bold">${element.textContent}</strong>`;
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
aria.MenuNavigation.prototype.activateElement = function (elementActive) {
|
|
33
|
+
const getAllLiElements = this.domNode.querySelectorAll('li');
|
|
34
|
+
[...getAllLiElements].forEach((element) => {
|
|
35
|
+
const getElement = element.querySelector('a');
|
|
36
|
+
if (getElement.id === elementActive) {
|
|
37
|
+
this.wrapActiveElement(getElement);
|
|
38
|
+
} else {
|
|
39
|
+
this.deactivateElement(getElement);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
aria.MenuNavigation.prototype.activateSubElement = function (menuId, elementActive) {
|
|
45
|
+
const getAllLinks = this.domNode.querySelectorAll(`#${menuId} ul li li a`);
|
|
46
|
+
[...getAllLinks].forEach((link) => {
|
|
47
|
+
if(link.id === elementActive) {
|
|
48
|
+
link.setAttribute('aria-current', 'true');
|
|
49
|
+
link.innerHTML = `<strong class="font-bold">${link.textContent}</strong>`;
|
|
50
|
+
} else {
|
|
51
|
+
const getElementParent = link.parentElement.parentElement.parentElement.parentElement.querySelector('button');
|
|
52
|
+
getElementParent.classList.remove('c-menu-navigation__button--primary', 'c-menu-navigation__button--has-selection');
|
|
53
|
+
getElementParent.firstChild.innerHTML = `${getElementParent.textContent}`;
|
|
54
|
+
link.setAttribute('aria-current', 'false');
|
|
55
|
+
link.innerHTML = `${link.textContent}`;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
[...getAllLinks].forEach((link) => {
|
|
59
|
+
if(link.getAttribute("aria-current") === "true"){
|
|
60
|
+
const getElementParent = link.parentElement.parentElement.parentElement.parentElement.querySelector('button');
|
|
61
|
+
getElementParent.classList.add('c-menu-navigation__button--primary', 'c-menu-navigation__button--has-selection');
|
|
62
|
+
getElementParent.firstChild.innerHTML = `<strong class="font-bold">${getElementParent.textContent}</strong>`;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
aria.MenuNavigation.prototype.wrapActiveElement = function (elementActive) {
|
|
68
|
+
elementActive.setAttribute('aria-current', 'true');
|
|
69
|
+
elementActive.classList.add('c-menu-navigation__button--primary', 'c-menu-navigation__button--has-selection');
|
|
70
|
+
elementActive.innerHTML = `<strong class="font-bold">${elementActive.textContent}</strong>`;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
aria.MenuNavigation.prototype.deactivateElement = function (elementDeactivated) {
|
|
74
|
+
elementDeactivated.setAttribute('aria-current', 'false');
|
|
75
|
+
elementDeactivated.classList.remove('c-menu-navigation__button--primary', 'c-menu-navigation__button--has-selection');
|
|
76
|
+
elementDeactivated.innerHTML = elementDeactivated.textContent;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
window.activateItemMenuNavigation = function (menuId, activeItemId) {
|
|
80
|
+
const menu = document.getElementById(menuId);
|
|
81
|
+
if (menu) {
|
|
82
|
+
const activeItem = document.querySelector(`#${menuId} #${activeItemId}`);
|
|
83
|
+
if (activeItem) {
|
|
84
|
+
const menuInstance = new aria.MenuNavigation(menu);
|
|
85
|
+
menuInstance.activateElement(activeItemId);
|
|
86
|
+
return [menu, activeItem];
|
|
87
|
+
} else {
|
|
88
|
+
console.log('There is no element with this id in the menu.');
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
} else {
|
|
92
|
+
console.log('There is no menu with this id in the document.');
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
window.activateSubItemMenuNavigation = function (menuId, activeSubItemId) {
|
|
98
|
+
const menu = document.getElementById(menuId);
|
|
99
|
+
if (menu) {
|
|
100
|
+
const activeSubItem = document.querySelector(`#${menuId} #${activeSubItemId}`);
|
|
101
|
+
if (activeSubItem) {
|
|
102
|
+
const menuInstance = new aria.MenuNavigation(menu);
|
|
103
|
+
menuInstance.activateSubElement(menuId, activeSubItemId);
|
|
104
|
+
return [menu, activeSubItem];
|
|
105
|
+
} else {
|
|
106
|
+
console.log('There is no element with this id in the menu.');
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
} else {
|
|
110
|
+
console.log('There is no menu with this id in the document.');
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}());
|
|
115
|
+
}
|
package/src/js/desy-html.js
CHANGED
|
@@ -18,6 +18,7 @@ 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';
|
|
21
22
|
import { HeaderNavigation } from './aria/HeaderNavigation.js';
|
|
22
23
|
import { Nav } from './aria/Nav.js';
|
|
23
24
|
|
|
@@ -374,6 +375,15 @@ export function MenuVerticalComponent(aria) {
|
|
|
374
375
|
});
|
|
375
376
|
}
|
|
376
377
|
|
|
378
|
+
export function MenuNavigationComponent(aria) {
|
|
379
|
+
MenuNavigation(aria);
|
|
380
|
+
const modules = document.querySelectorAll('[data-module="c-menu-navigation"]');
|
|
381
|
+
[...modules].forEach((module) => {
|
|
382
|
+
const menuNavigation = new aria.MenuNavigation(module);
|
|
383
|
+
menuNavigation.init();
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
|
|
377
387
|
export function HeaderNavigationComponent(aria) {
|
|
378
388
|
HeaderNavigation(aria);
|
|
379
389
|
const modules = document.querySelectorAll('[data-module="c-header-navigation"]');
|
package/src/js/index.js
CHANGED
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
radioButtonComponent,
|
|
22
22
|
checkBoxComponent,
|
|
23
23
|
MenuVerticalComponent,
|
|
24
|
+
MenuNavigationComponent,
|
|
24
25
|
HeaderNavigationComponent,
|
|
25
26
|
NavComponent
|
|
26
27
|
} from './desy-html.js';
|
|
@@ -44,6 +45,7 @@ notificationComponent(aria);
|
|
|
44
45
|
radioButtonComponent(aria);
|
|
45
46
|
checkBoxComponent(aria);
|
|
46
47
|
MenuVerticalComponent(aria);
|
|
48
|
+
MenuNavigationComponent(aria);
|
|
47
49
|
HeaderNavigationComponent(aria);
|
|
48
50
|
NavComponent(aria);
|
|
49
51
|
|
|
@@ -106,6 +106,7 @@
|
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
108
|
"name": "con item activo",
|
|
109
|
+
"description": 'Añade <code>active: true</code> a un item para mostrarlo activo inicialmente. También puedes usar con javascript la función global <code>activateItemMenuNavigation(elementMenu, idItemSeleccionado)</code> para seleccionar un item de un menú, usando sus ids. Ej: Abre la consola del navegador y escribe <code>activateItemMenuNavigation("mi-menu", "with-active-item-example-3")</code> para desactivar el item actual y activar el tercer item de este ejemplo.',
|
|
109
110
|
"data": {
|
|
110
111
|
"idPrefix": "with-active-item-example",
|
|
111
112
|
"items": [
|
|
@@ -124,7 +125,91 @@
|
|
|
124
125
|
}
|
|
125
126
|
],
|
|
126
127
|
"attributes": {
|
|
127
|
-
"aria-label": "Menu navigation"
|
|
128
|
+
"aria-label": "Menu navigation",
|
|
129
|
+
"id": "mi-menu"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"name": "con sub-item activo",
|
|
135
|
+
"description": '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>activateSubItemMenuNavigation(elementMenu, idItemSeleccionado)</code> para seleccionar un sub-item de un menú, usando sus ids. Ej: Abre la consola del navegador y escribe <code>activateSubItemMenuNavigation("mi-sub-menu", "sub-active-sub-item-example-2-2")</code> para desactivar el sub-item actual y activar el tercer sub-item de este ejemplo.',
|
|
136
|
+
"data": {
|
|
137
|
+
"idPrefix": "with-active-sub-item-example",
|
|
138
|
+
"items": [
|
|
139
|
+
{
|
|
140
|
+
"text": "Item 1",
|
|
141
|
+
"id": "active-sub-item-example-1",
|
|
142
|
+
"sub": {
|
|
143
|
+
"items": [
|
|
144
|
+
{
|
|
145
|
+
"href": "#",
|
|
146
|
+
"text": "Subitem 1"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"href": "#",
|
|
150
|
+
"text": "Subitem 2",
|
|
151
|
+
"active": true
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"href": "#",
|
|
155
|
+
"text": "Subitem 3"
|
|
156
|
+
}
|
|
157
|
+
],
|
|
158
|
+
"attributes": {
|
|
159
|
+
"aria-labelledby": "active-sub-item-example-item-1"
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"text": "Item 2",
|
|
165
|
+
"id": "active-sub-item-example-2",
|
|
166
|
+
"sub": {
|
|
167
|
+
"items": [
|
|
168
|
+
{
|
|
169
|
+
"href": "#",
|
|
170
|
+
"text": "Subitem 1"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"href": "#",
|
|
174
|
+
"text": "Subitem 2"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"href": "#",
|
|
178
|
+
"text": "Subitem 3"
|
|
179
|
+
}
|
|
180
|
+
],
|
|
181
|
+
"attributes": {
|
|
182
|
+
"aria-labelledby": "active-sub-item-example-item-2"
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"text": "Item 3",
|
|
188
|
+
"id": "active-sub-item-example-3",
|
|
189
|
+
"sub": {
|
|
190
|
+
"items": [
|
|
191
|
+
{
|
|
192
|
+
"href": "#",
|
|
193
|
+
"text": "Subitem 1"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"href": "#",
|
|
197
|
+
"text": "Subitem 2"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"href": "#",
|
|
201
|
+
"text": "Subitem 3"
|
|
202
|
+
}
|
|
203
|
+
],
|
|
204
|
+
"attributes": {
|
|
205
|
+
"aria-labelledby": "active-sub-item-example-item-2"
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
],
|
|
210
|
+
"attributes": {
|
|
211
|
+
"aria-label": "Menu navigation",
|
|
212
|
+
"id": "mi-sub-menu"
|
|
128
213
|
}
|
|
129
214
|
}
|
|
130
215
|
},
|
|
@@ -598,65 +683,6 @@
|
|
|
598
683
|
}
|
|
599
684
|
}
|
|
600
685
|
},
|
|
601
|
-
{
|
|
602
|
-
"name": "con un item hijo activo",
|
|
603
|
-
"data": {
|
|
604
|
-
"idPrefix": "nav-item-with-children-active",
|
|
605
|
-
"items": [
|
|
606
|
-
{
|
|
607
|
-
"text": "Item 1",
|
|
608
|
-
"id": "nav-item-item-1-a",
|
|
609
|
-
"sub": {
|
|
610
|
-
"items": [
|
|
611
|
-
{
|
|
612
|
-
"href": "#",
|
|
613
|
-
"text": "Subitem 1"
|
|
614
|
-
},
|
|
615
|
-
{
|
|
616
|
-
"href": "#",
|
|
617
|
-
"text": "Subitem 2",
|
|
618
|
-
"active": true
|
|
619
|
-
},
|
|
620
|
-
{
|
|
621
|
-
"href": "#",
|
|
622
|
-
"text": "Subitem 3"
|
|
623
|
-
}
|
|
624
|
-
],
|
|
625
|
-
"attributes": {
|
|
626
|
-
"aria-labelledby": "nav-item-item-1-a"
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
},
|
|
630
|
-
{
|
|
631
|
-
"text": "Item 2",
|
|
632
|
-
"id": "nav-item-item-2-a",
|
|
633
|
-
"sub": {
|
|
634
|
-
"items": [
|
|
635
|
-
{
|
|
636
|
-
"href": "#",
|
|
637
|
-
"text": "Subitem 1"
|
|
638
|
-
},
|
|
639
|
-
{
|
|
640
|
-
"href": "#",
|
|
641
|
-
"text": "Subitem 2",
|
|
642
|
-
"active": true
|
|
643
|
-
},
|
|
644
|
-
{
|
|
645
|
-
"href": "#",
|
|
646
|
-
"text": "Subitem 3"
|
|
647
|
-
}
|
|
648
|
-
],
|
|
649
|
-
"attributes": {
|
|
650
|
-
"aria-labelledby": "nav-item-item-2-a"
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
],
|
|
655
|
-
"attributes": {
|
|
656
|
-
"aria-label": "Menu navigation"
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
},
|
|
660
686
|
{
|
|
661
687
|
"name": "con deshabilitado o sin href en un padre e hijo",
|
|
662
688
|
"data": {
|
|
@@ -717,7 +743,7 @@
|
|
|
717
743
|
},
|
|
718
744
|
{
|
|
719
745
|
"name": "con estilos de cabecera",
|
|
720
|
-
"description": 'Un Menu navigation puede estar anidado en <code>customNavigationHtml</code> en el componente Header.',
|
|
746
|
+
"description": 'Un Menu navigation puede estar anidado en <code>customNavigationHtml</code> en el componente Header. 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>activateSubItemMenuNavigation(elementMenu, idItemSeleccionado)</code> para seleccionar un sub-item de un menú, usando sus ids. Ej: Abre la consola del navegador y escribe <code>activateSubItemMenuNavigation("mi-menu-header", "sub-header-custom-nav-item-1-1")</code> para desactivar el sub-item actual y activar el primer sub-item del primer item de este ejemplo.',
|
|
721
747
|
"data": {
|
|
722
748
|
"idPrefix": "header-custom-nav",
|
|
723
749
|
"classes": "bg-neutral-lighter c-menu-navigation--last-right w-full",
|
|
@@ -823,7 +849,8 @@
|
|
|
823
849
|
}
|
|
824
850
|
],
|
|
825
851
|
"attributes": {
|
|
826
|
-
"aria-label": "Menu navigation"
|
|
852
|
+
"aria-label": "Menu navigation",
|
|
853
|
+
"id": "mi-menu-header"
|
|
827
854
|
}
|
|
828
855
|
}
|
|
829
856
|
},
|
|
@@ -1076,4 +1103,4 @@
|
|
|
1076
1103
|
}
|
|
1077
1104
|
}
|
|
1078
1105
|
}
|
|
1079
|
-
] %}
|
|
1106
|
+
] %}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
{#- Capture the HTML so we can optionally nest it in a fieldset -#}
|
|
16
16
|
{% set innerHtml %}
|
|
17
|
-
<ul
|
|
17
|
+
<ul class="flex flex-wrap gap-base c-menu-navigation__list">
|
|
18
18
|
{% for item in params.items %}
|
|
19
19
|
{% if item %}
|
|
20
20
|
{#- If the user explicitly sets an id, use this instead of the regular idPrefix -#}
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
{% endif %}
|
|
39
39
|
{% if item.sub.items %}
|
|
40
40
|
<div class="c-menu-navigation__sub absolute bottom-0 left-0">
|
|
41
|
-
<ul id="{{ id }}-sub-list" class="{% if item.sub.classes %}{{ item.sub.classes }}{% else-%} c-menu-navigation__tooltip w-max max-w-64 border border-neutral-base shadow-md bg-white text-sm{% endif %}" {%- for attribute, value in item.sub.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}>
|
|
41
|
+
<ul id="{{ id }}-sub-list" class="c-menu-navigation__sub--list {% if item.sub.classes %}{{ item.sub.classes }}{% else-%} c-menu-navigation__tooltip w-max max-w-64 border border-neutral-base shadow-md bg-white text-sm{% endif %}" {%- for attribute, value in item.sub.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}>
|
|
42
42
|
{% for subitem in item.sub.items %}
|
|
43
43
|
{% if subitem %}
|
|
44
44
|
{#- If the user explicitly sets an id, use this instead of the regular idPrefix -#}
|
|
@@ -49,28 +49,12 @@
|
|
|
49
49
|
{%- endif %}
|
|
50
50
|
{% set commonSubItemAttributes %}{% if subId %} id="{{ subId }}"{% endif %} {%- if subitem.title %} title="{{ subitem.title }}"{% endif %} {%- for attribute, value in subitem.attributes %} {{ attribute }}="{{ value }}"{% endfor %}{% endset %}
|
|
51
51
|
<li>
|
|
52
|
-
{% if subitem.href %}
|
|
53
|
-
{% if subitem.active %}
|
|
54
|
-
<span {%- if subitem.id %} id="{{ subId }}"{% endif %} class="flex items-center px-base py-sm text-sm {%- if subitem.classes %} {{ subitem.classes }}{% endif -%}" aria-current="page" {{- commonSubItemAttributes | safe }}>
|
|
55
|
-
<strong class="font-bold">{{ subitem.html | safe if subitem.html else subitem.text }}</strong>
|
|
56
|
-
</span>
|
|
57
|
-
{% else %}
|
|
58
|
-
<a {%- if subitem.id %} id="{{ subId }}"{% endif %} href="{{ subitem.href }}" class="flex items-center px-base py-sm text-sm hover:bg-primary-base hover:text-white focus:bg-warning-base focus:outline-none focus:shadow-outline-focus focus:text-black{%- if subitem.classes %} {{ subitem.classes }}{% endif -%} {%- if subitem.disabled %} pointer-events-none{% endif -%}" {%- if subitem.disabled %} tabindex="-1"{% endif -%} {%- if subitem.target %} target="{{ subitem.target }}"{% endif %} {{- commonSubItemAttributes | safe }}>
|
|
52
|
+
<a aria-current="{%- if subitem.active %}true{% else %}false{% endif -%}" {%- if subitem.id %} id="{{ subId }}"{% endif %} href="{{ subitem.href }}" class="flex items-center px-base py-sm text-sm hover:bg-primary-base hover:text-white focus:bg-warning-base focus:outline-none focus:shadow-outline-focus focus:text-black{%- if subitem.classes %} {{ subitem.classes }}{% endif -%} {%- if subitem.disabled %} pointer-events-none{% endif -%}" {%- if subitem.disabled %} tabindex="-1"{% endif -%} {%- if subitem.target %} target="{{ subitem.target }}"{% endif %} {{- commonSubItemAttributes | safe }}>
|
|
59
53
|
{{ subitem.html | safe if subitem.html else subitem.text }}
|
|
60
54
|
{% if subitem.disabled %}
|
|
61
55
|
<svg viewBox="0 0 140 140" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg" class="inline-block align-middle ml-sm text-neutral-base fill-current" aria-hidden="true" focusable="false" ><path d="M70 0a70 70 0 1070 70A70.08 70.08 0 0070 0zM20 70a50 50 0 0174.8-43.4 2.51 2.51 0 011.23 1.84 2.48 2.48 0 01-.71 2.1L30.54 95.32a2.51 2.51 0 01-3.94-.52A49.63 49.63 0 0120 70zm100 0a50 50 0 01-74.8 43.4 2.51 2.51 0 01-1.23-1.84 2.48 2.48 0 01.71-2.1l64.78-64.78a2.51 2.51 0 013.94.52A49.63 49.63 0 01120 70z"/></svg>
|
|
62
56
|
{% endif %}
|
|
63
57
|
</a>
|
|
64
|
-
{% endif %}
|
|
65
|
-
{% else %}
|
|
66
|
-
<span {%- if subitem.id %} id="{{ subId }}"{% endif %} class="flex items-center px-base py-sm text-sm {%- if subitem.classes %} {{ subitem.classes }}{% endif %} {%- if subitem.active %} font-bold{% endif %} {%- if subitem.active %} font-bold{% endif %}" {%- if subitem.title %} title="{{ subitem.title }}"{% endif %} {%- if subitem.active %} aria-current="page"{% endif %} {%- if subitem.disabled %} aria-disabled="true" tabindex="-1"{% endif %} {%- for attribute, value in subitem.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}>
|
|
67
|
-
{% if subitem.active %}
|
|
68
|
-
<strong class="font-bold">{{ subitem.html | safe if subitem.html else subitem.text }}</strong>
|
|
69
|
-
{% else %}
|
|
70
|
-
{{ subitem.html | safe if subitem.html else subitem.text }}
|
|
71
|
-
{% endif %}
|
|
72
|
-
</span>
|
|
73
|
-
{% endif %}
|
|
74
58
|
</li>
|
|
75
59
|
{% if subitem.divider %}
|
|
76
60
|
<li class="my-sm border-b border-neutral-base">
|
|
@@ -98,8 +82,8 @@
|
|
|
98
82
|
{% endset -%}
|
|
99
83
|
|
|
100
84
|
<!-- menu-navigation -->
|
|
101
|
-
<nav {%- if params.classes %} class="{{ params.classes }}"{% endif %}
|
|
85
|
+
<nav data-module="c-menu-navigation" {%- if params.classes %} class="{{ params.classes }}"{% endif %}
|
|
102
86
|
{%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}>
|
|
103
87
|
{{ innerHtml | trim | safe }}
|
|
104
88
|
</nav>
|
|
105
|
-
<!-- /menu-navigation -->
|
|
89
|
+
<!-- /menu-navigation -->
|