desy-html 4.1.3 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/docs/_include.template-header.njk +47 -47
  2. package/docs/ds/_ds.example.header.njk +1 -1
  3. package/docs/ds/_ds.example.menubar-en-uso.njk +6 -18
  4. package/docs/ds/_ds.example.menubar-variaciones.njk +51 -121
  5. package/docs/index.html +25 -0
  6. package/package.json +1 -1
  7. package/src/js/desy-html.js +63 -4
  8. package/src/templates/components/alert/_template.alert.njk +2 -2
  9. package/src/templates/components/checkboxes/_examples.checkboxes.njk +22 -0
  10. package/src/templates/components/checkboxes/_template.checkboxes.njk +4 -3
  11. package/src/templates/components/checkboxes/params.checkboxes.yaml +8 -0
  12. package/src/templates/components/description-list/_examples.description-list.njk +63 -0
  13. package/src/templates/components/dropdown/_styles.dropdown.css +1 -0
  14. package/src/templates/components/dropdown/params.dropdown.yaml +6 -6
  15. package/src/templates/components/header/_examples.header.njk +35 -3
  16. package/src/templates/components/header/_template.header.header__dropdown.njk +17 -18
  17. package/src/templates/components/header/_template.header.header__offcanvas.njk +1 -1
  18. package/src/templates/components/header/_template.header.header__subnav.njk +16 -20
  19. package/src/templates/components/header/_template.header.njk +42 -30
  20. package/src/templates/components/header/params.header.yaml +45 -5
  21. package/src/templates/components/menu-horizontal/_examples.menu-horizontal.njk +2 -1
  22. package/src/templates/components/menu-horizontal/_template.menu-horizontal.njk +1 -1
  23. package/src/templates/components/menubar/_examples.menubar.njk +349 -143
  24. package/src/templates/components/menubar/_styles.menubar.css +1 -0
  25. package/src/templates/components/menubar/_template.menubar.njk +2 -2
  26. package/src/templates/components/menubar/params.menubar.yaml +8 -0
@@ -178,6 +178,69 @@
178
178
  ]
179
179
  }
180
180
  },
181
+ {
182
+ "name": "grouped",
183
+ "data": {
184
+ "classes": "w-full py-sm border-t border-b border-neutral-base",
185
+ "items": [
186
+ {
187
+ "term": {
188
+ "text": "Código de procedimiento",
189
+ "classes": "lg:w-1/3"
190
+ },
191
+ "definition": {
192
+ "text": "G00345-BX",
193
+ "classes": "lg:flex-1 font-semibold"
194
+ },
195
+ "classes": "lg:flex py-sm"
196
+ },
197
+ {
198
+ "term": {
199
+ "text": "Nombre del procedimiento",
200
+ "classes": "lg:w-1/3"
201
+ },
202
+ "definition": {
203
+ "text": "Resolución definitiva",
204
+ "classes": "lg:flex-1 font-semibold"
205
+ },
206
+ "classes": "lg:flex py-sm"
207
+ },
208
+ {
209
+ "term": {
210
+ "text": "CSV",
211
+ "classes": "lg:w-1/3"
212
+ },
213
+ "definition": {
214
+ "text": "CSVK45WT8V5T110CPPC",
215
+ "classes": "lg:flex-1 font-semibold"
216
+ },
217
+ "classes": "lg:flex py-sm"
218
+ },
219
+ {
220
+ "term": {
221
+ "text": "Fecha de captura",
222
+ "classes": "lg:w-1/3"
223
+ },
224
+ "definition": {
225
+ "text": "13 de Diciembre de 2021. A las 11:48:08",
226
+ "classes": "lg:flex-1 font-semibold"
227
+ },
228
+ "classes": "lg:flex py-sm"
229
+ },
230
+ {
231
+ "term": {
232
+ "text": "Categoría",
233
+ "classes": "lg:w-1/3"
234
+ },
235
+ "definition": {
236
+ "text": "Documento simple",
237
+ "classes": "lg:flex-1 font-semibold"
238
+ },
239
+ "classes": "lg:flex py-sm"
240
+ }
241
+ ]
242
+ }
243
+ },
181
244
  {
182
245
  "name": "with table like appaerance",
183
246
  "data": {
@@ -160,6 +160,7 @@
160
160
  @apply text-white;
161
161
 
162
162
  &:hover:not(disabled),
163
+ &:active:not(disabled),
163
164
  &.ds-hover:not(disabled) {
164
165
  @apply bg-black;
165
166
  @apply border-none;
@@ -2,19 +2,19 @@ params:
2
2
  - name: text
3
3
  type: string
4
4
  required: true
5
- description: If `html` is set, this is not required. Text for the button. If `html` is provided, the `text` argument will be ignored.
5
+ description: If `html` is set, this is not required. Text for the dropdown. If `html` is provided, the `text` argument will be ignored.
6
6
  - name: html
7
7
  type: string
8
8
  required: true
9
- description: If `text` is set, this is not required. HTML for the button. If `html` is provided, the `text` argument will be ignored.
9
+ description: If `text` is set, this is not required. HTML for the dropdown. If `html` is provided, the `text` argument will be ignored.
10
10
  - name: hiddenText
11
11
  type: string
12
12
  required: false
13
- description: Text for screenreaders only after the button element.
13
+ description: Text for screenreaders only after the dropdown element.
14
14
  - name: classesContainer
15
15
  type: string
16
16
  required: false
17
- description: Classes to add to the container div of button and tooltip elements.
17
+ description: Classes to add to the container div of dropdown and tooltip elements.
18
18
  - name: classesTooltip
19
19
  type: string
20
20
  required: false
@@ -22,11 +22,11 @@ params:
22
22
  - name: classes
23
23
  type: string
24
24
  required: false
25
- description: Classes to add to the button element.
25
+ description: Classes to add to the dropdown element.
26
26
  - name: attributes
27
27
  type: object
28
28
  required: false
29
- description: HTML attributes (for example data attributes) to add to the button element.
29
+ description: HTML attributes (for example data attributes) to add to the dropdown element.
30
30
  - name: caller
31
31
  type: nunjucks-block
32
32
  required: false
@@ -156,7 +156,7 @@
156
156
  }
157
157
  },
158
158
  {
159
- "name": "Espanded logo",
159
+ "name": "Expanded logo",
160
160
  "description": "expandedLogo: true. Utilizar este logotipo en apps que estén dirigidas al ciudadano.",
161
161
  "data": {
162
162
  "homepageUrl": "/",
@@ -196,7 +196,7 @@
196
196
  "text": "Carpeta del gestor"
197
197
  },
198
198
  "offcanvas": {
199
- "text": "Menu",
199
+ "text": "Menú",
200
200
  "textClose": "Cerrar menu",
201
201
  "labelledId": "offcanvas-title"
202
202
  },
@@ -262,6 +262,38 @@
262
262
  }
263
263
  }
264
264
  },
265
+ {
266
+ "name": "con dropdown personalizado",
267
+ "description": "Se pueden usar los parámetros del dropdown para personalizarlo. En este ejemplo con html en el dropdown.",
268
+ "data": {
269
+ "homepageUrl": "/",
270
+ "dropdown": {
271
+ "html": '<p class="text-right">Marta Pérez <br>(Administración)</p>',
272
+ "items": [
273
+ {
274
+ "text": "Perfil",
275
+ "href": "/"
276
+ },
277
+ {
278
+ "text": "Cerrar sesión",
279
+ "href": "/"
280
+ }
281
+ ]
282
+ }
283
+ }
284
+ },
285
+ {
286
+ "name": "con contenido personalizado en dropdown",
287
+ "description": "El dropdown puede contener cualquier tipo de información.",
288
+ "data": {
289
+ "homepageUrl": "/",
290
+ "dropdown": {
291
+ "text": "Marta Pérez",
292
+ "contentHtml": '<div class="p-base"><dl><dt class="text-base">Marta Pérez</dt><dd class="text-sm text-neutral-dark">Departamento de Ciencia, Universidad y Sociedad del Conocimiento</dd></dl></div>',
293
+ "classesTooltip": "w-64 max-h-48 overflow-y-auto"
294
+ }
295
+ }
296
+ },
265
297
  {
266
298
  "name": "con todo",
267
299
  "description": "Logo, menu de navegación, dropdown en anchuras grandes y menu mobile en pequeñas.",
@@ -321,7 +353,7 @@
321
353
  ]
322
354
  },
323
355
  "offcanvas": {
324
- "text": "Menu",
356
+ "text": "Menú",
325
357
  "textClose": "Cerrar menu"
326
358
  },
327
359
  "caller": exampleOffcanvas
@@ -1,23 +1,22 @@
1
+ {% from "components/dropdown/_macro.dropdown.njk" import componentDropdown %}
1
2
  <div class="ml-4 flex items-center lg:ml-6">
2
- <div x-data="{ isOpen: false }" class="ml-3 relative">
3
+ <div class="ml-3 relative">
3
4
  <div>
4
- <button id="header-dropdown-button" @click="isOpen = !isOpen" class="inline-flex items-center px-3 py-4 text-sm text-white focus:outline-none focus:ring-4 focus:ring-inset focus:ring-warning-base" aria-haspopup="true" x-bind:aria-expanded="String(isOpen)" x-on:keydown.escape="isOpen = false; document.getElementById('header-dropdown-button').focus();">
5
- <span class="inline-block align-middle text-right">{{ params.html | safe if params.html else params.text }}</span> <svg class="inline-block align-middle" viewBox="0 0 96 96" fill="currentColor" aria-hidden="true" focusable="false" width="1.5em" height="1.5em"><g><path d="M46.71 58.037a1.823 1.823 0 002.581 0L62.048 45.28a1.823 1.823 0 00-1.29-3.113H35.243a1.823 1.823 0 00-1.291 3.113z"/></g></svg>
6
- </button>
7
- </div>
8
- <div x-show="isOpen"
9
- x-transition:enter="transition ease-out duration-100 transform"
10
- x-transition:enter-start="opacity-0 scale-95"
11
- x-transition:enter-end="opacity-100 scale-100"
12
- x-transition:leave="transition ease-in duration-75 transform"
13
- x-transition:leave-start="opacity-100 scale-100"
14
- x-transition:leave-end="opacity-0 scale-95"
15
- @click.away="isOpen = false"
16
- x-on:keydown.escape="isOpen = false; document.getElementById('header-dropdown-button').focus();"
17
- class="origin-top-right absolute right-0 max-h-64 mt-2 border border-neutral-base overflow-y-auto shadow-md">
18
- <div class="bg-white shadow-xs">
19
- {{ caller() if caller }}
20
- </div>
5
+ {% call componentDropdown({
6
+ "text": params.text,
7
+ "html": params.html,
8
+ "hiddenText": params.hiddenText,
9
+ "classesContainer": params.classesContainer,
10
+ "classesTooltip": params.classesTooltip,
11
+ "classes": params.classes,
12
+ "attributes": params.attributes
13
+ }) %}
14
+ {% if caller %}
15
+ {{ caller() }} {#- if statement allows usage of `call` to be optional -#}
16
+ {% elseif params.caller %}
17
+ {{ params.caller | safe }}
18
+ {% endif %}
19
+ {% endcall %}
21
20
  </div>
22
21
  </div>
23
22
  </div>
@@ -5,7 +5,7 @@
5
5
  <button
6
6
  onclick="closeDialog(this)"
7
7
  id="header-offcanvas-button-close"
8
- 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"><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>
8
+ 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>
9
9
  </div>
10
10
  {% if caller %}
11
11
  {{ caller() }} {#- if statement allows usage of `call` to be optional -#}
@@ -1,34 +1,30 @@
1
+ {% from "components/dropdown/_macro.dropdown.njk" import componentDropdown %}
2
+
3
+
1
4
  {% if params.items %}
2
5
  <div class="hidden lg:flex items-center">
3
- <div x-data="{ isOpen: false }" class="ml-3 relative">
4
- <h2 id="subnav-title">
5
- <button id="header-subnav-button" @click="isOpen = !isOpen" class="pr-2 pl-3 py-4 border-r border-l border-neutral-base text-sm text-white truncate focus:outline-none focus:ring-4 focus:ring-inset focus:ring-warning-base" aria-haspopup="true" x-bind:aria-expanded="String(isOpen)" x-on:keydown.escape="isOpen = false; document.getElementById('header-subnav-button').focus();">
6
- <span class="inline-block align-middle">{{ params.html | safe if params.html else params.text }}</span> <svg class="inline-block align-middle" viewBox="0 0 96 96" fill="currentColor" aria-hidden="true" focusable="false" width="1.5em" height="1.5em"><g><path d="M46.71 58.037a1.823 1.823 0 002.581 0L62.048 45.28a1.823 1.823 0 00-1.29-3.113H35.243a1.823 1.823 0 00-1.291 3.113z"/></g></svg>
7
- </button>
8
- </h2>
9
- <div x-show="isOpen"
10
- x-transition:enter="transition ease-out duration-100 transform"
11
- x-transition:enter-start="opacity-0 scale-95"
12
- x-transition:enter-end="opacity-100 scale-100"
13
- x-transition:leave="transition ease-in duration-75 transform"
14
- x-transition:leave-start="opacity-100 scale-100"
15
- x-transition:leave-end="opacity-0 scale-95"
16
- @click.away="isOpen = false"
17
- x-on:keydown.escape="isOpen = false; document.getElementById('header-subnav-button').focus();"
18
- class="origin-top-left absolute left-0 max-h-64 mt-2 border border-neutral-base overflow-y-auto shadow-md">
19
- <div class="bg-white shadow-xs">
6
+ <div class="ml-3 py-2 relative border-r border-l border-neutral-base">
7
+ <p class="sr-only">Aplicación actual: </p>
8
+ {% call componentDropdown({
9
+ "text": params.text,
10
+ "html": params.html,
11
+ "hiddenText": params.hiddenText,
12
+ "classesContainer": params.classesContainer,
13
+ "classesTooltip": params.classesTooltip,
14
+ "classes": params.classes,
15
+ "attributes": params.attributes
16
+ }) %}
20
17
  {% if caller %}
21
18
  {{ caller() }} {#- if statement allows usage of `call` to be optional -#}
22
19
  {% elseif params.caller %}
23
20
  {{ params.caller | safe }}
24
21
  {% endif %}
25
- </div>
26
- </div>
22
+ {% endcall %}
27
23
  </div>
28
24
  </div>
29
25
  {% else %}
30
26
  <p class="hidden lg:inline-block align-middle ml-4 px-3 py-4 border-r border-l border-neutral-base text-sm text-white">
31
27
  <span class="sr-only">Aplicación actual: </span>
32
- {{ params.text }}
28
+ {{ params.html | safe if params.html else params.text }}
33
29
  </p>
34
30
  {% endif %}
@@ -26,28 +26,32 @@
26
26
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 216.878 51.894" width="144" height="32" class="fill-current {% if params.expandedLogo %} hidden sm:block{% else %} hidden{% endif %}" aria-label="Gobierno de Aragón" role="img"><title>Ir a la página de inicio</title><path data-name="img" d="M51.89 51.892H0V0h51.89zm-2.5-2.494v-8.96L38.906 42.33a17.743 17.743 0 01-3.136.278 18.211 18.211 0 01-9.225-2.517 21.42 21.42 0 00-9.317-2.082 20.786 20.786 0 00-4.9.571c-.743.15-1.526.292-2.282.429l-.125.023-.613.112-4.928.913-1.875.382V48.934l1.527-.247 22.517-4.133a17.458 17.458 0 013.236-.3 18.06 18.06 0 017.317 1.527l5.442 2.854a9.431 9.431 0 002.372.679 7.837 7.837 0 001.147.083h.029a16 16 0 003.3-.464zm0 0zm0-8.96V27.195a8.1 8.1 0 00-4.062-1.2 7.451 7.451 0 00-1.162.094l-10.852 2.009c-.026 0-2.878.518-4.281.779L17.12 31.048a18.266 18.266 0 01-2.5.173 18.246 18.246 0 01-7.67-1.683l-4.447-2.34V33.636l1.511-.281a19.009 19.009 0 014.442-.517 17.882 17.882 0 018.168 1.894 23.042 23.042 0 0010.673 2.617 23.64 23.64 0 002.884-.178l19.21-3.535zm0-13.243v-8.778l-1.341.282a19.092 19.092 0 01-4.442.516 17.873 17.873 0 01-8.169-1.894 23.049 23.049 0 00-10.672-2.618 23.464 23.464 0 00-2.884.179L2.5 18.417v6.538a7.558 7.558 0 003.968 1.128 9.406 9.406 0 001.426-.116l10.852-2.008c.027-.005 2.876-.518 4.28-.78l11.914-2.174a18.122 18.122 0 012.5-.173 18.236 18.236 0 017.67 1.683l4.277 2.441v-4.427zm0-8.778V2.981l-7.4 1.524-7.35 1.328-7.035 1.277a23.976 23.976 0 01-5.306.62 16.834 16.834 0 01-4.517-.57 19.322 19.322 0 01-5.084-2.209 95.551 95.551 0 00-1.3-.712c-.285-.139-.571-.291-.846-.437h-.005a9.085 9.085 0 00-2.252-.954 7.331 7.331 0 00-1.918-.341H2.5v9c1.433-.237 2.593-.442 3.651-.647l7.517-1.345a19.656 19.656 0 012.63-.178 17.162 17.162 0 012.63.2 22.628 22.628 0 017.434 2.705 21.654 21.654 0 008.584 1.768h.006a20.746 20.746 0 003.173-.242l11.264-2.256v6.907zM2.5 2.98v-.472h2.95a14.929 14.929 0 00-2.949.473z"/><path data-name="typo" d="M59.352 45.091V32.36h2.074c4.307 0 6.668 2.266 6.668 6.382 0 4.212-2.265 6.349-6.7 6.349zm15.489-16.974v21.281h14.1v-4.307h-9.348v-4.85h9.253v-4.308h-9.253v-3.542h9.348v-4.275zm32.389 0l-7.757 21.282h5.041l2.3-6.477h6.509l2.265 6.477h5.138l-7.912-21.281zm2.807 4.4l-1.978 6.287h3.989zm63.051 6h-4.754v6.7a6.262 6.262 0 01-2.042.288c-3.638 0-6.317-2.84-6.317-6.7 0-4.147 2.84-6.923 7.051-6.923a11.142 11.142 0 016.062 1.851v-4.849a17.388 17.388 0 00-6.477-1.276c-6.891 0-11.677 4.626-11.677 11.262 0 6.54 4.689 10.976 11.677 10.976a19.329 19.329 0 006.477-1.117zm24.023.192c0-6.35-4.722-10.976-11.167-10.976a11.024 11.024 0 00.16 22.047c6.445.001 11.007-4.593 11.007-11.07zm-11.1-6.637c-3.573 0-5.966 2.713-5.966 6.7s2.456 6.7 6.062 6.7c3.573 0 5.934-2.681 5.934-6.7s-2.428-6.699-6.033-6.699zm12.94-3.956v21.281h4.85v-13.56l8.58 13.56h4.5V28.116h-4.849l.006 13.235-8.237-13.235zm-126.6-15h-4.754v6.7a6.266 6.266 0 01-2.042.287c-3.637 0-6.317-2.84-6.317-6.7 0-4.148 2.84-6.923 7.051-6.923a11.152 11.152 0 016.062 1.85V3.481a17.386 17.386 0 00-6.477-1.277c-6.891 0-11.677 4.626-11.677 11.263 0 6.54 4.69 10.974 11.677 10.974a19.342 19.342 0 006.477-1.116zm24 .191c0-6.349-4.722-10.975-11.167-10.975a11.023 11.023 0 00.159 22.046c6.437-.002 11-4.597 11-11.074zm-11.1-6.636c-3.573 0-5.966 2.711-5.966 6.7s2.457 6.7 6.062 6.7c3.573 0 5.935-2.68 5.935-6.7s-2.437-6.702-6.042-6.702zm12.695-3.956v21.281h8.806c4.69 0 7.433-2.33 7.433-6.318 0-2.743-1.563-4.721-4.435-5.551a4.665 4.665 0 002.9-4.371c.032-3.382-2.265-5.041-6.859-5.041zm7.083 7.944c2.074 0 2.9-.575 2.9-2.01 0-1.372-.8-1.882-3.062-1.882h-2.074v3.892zm.638 9c2.36 0 3.381-.734 3.381-2.457 0-1.786-1.053-2.489-3.573-2.489h-2.679v4.946zm14.274-16.942h-4.768v21.281h4.754zm2.07 0v21.281h14.1v-4.307h-9.349v-4.85h9.253v-4.307h-9.253V6.993h9.349V2.718zm75.145 10.592c0-6.349-4.722-10.975-11.167-10.975a11.023 11.023 0 00.16 22.046c6.435-.004 10.997-4.599 10.997-11.076zm-11.1-6.636c-3.573 0-5.966 2.711-5.966 6.7s2.456 6.7 6.062 6.7c3.573 0 5.934-2.68 5.934-6.7s-2.438-6.704-6.043-6.704zm-37.783 32.132l-2.01-6.287-1.978 6.287zM126.43 49.398v-8.743h.606c3.063 0 3.382.319 5.423 5.583a10.7 10.7 0 00.447 1.085l.415.989a9.523 9.523 0 00.51 1.085h6.911l2.3-6.477h6.509l2.265 6.477h5.137l-7.912-21.281h-5.583l-6.288 17.258a89.817 89.817 0 01-1.549-3.411c-.83-1.819-1.308-2.362-2.84-3a5.086 5.086 0 003.892-5.106c0-3.828-2.52-5.743-7.593-5.743h-7.53v21.281zm0-12.763h2.105c2.042 0 3.063-.734 3.063-2.265s-.926-2.2-3-2.2h-2.17zm16.613-12.643V15.25h.605c3.063 0 3.382.319 5.424 5.583a10.427 10.427 0 00.447 1.085l.415.989a9.465 9.465 0 00.51 1.085h9.578l.027-13.652 8.555 13.652h4.5V2.711h-4.849l.021 13.056-8.252-13.056h-4.851v19.812a44.3 44.3 0 01-2.942-5.962c-.829-1.818-1.307-2.36-2.839-3a5.085 5.085 0 003.892-5.1c0-3.829-2.521-5.743-7.594-5.743h-7.529v21.281zm0-12.762h2.106c2.041 0 3.062-.734 3.062-2.265s-.924-2.2-3-2.2h-2.169zM54.53 28.117v21.281h7.114c7.21 0 11.454-3.956 11.454-10.657 0-6.669-4.339-10.625-11.709-10.625z" fill-rule="evenodd"/></svg>
27
27
  <svg class="w-8 h-8 fill-current {%- if params.expandedLogo %} sm:hidden{% endif %}" viewBox="0 0 51.894 51.894" width="32" height="32" aria-label="Gobierno de Aragón" role="img"><title>Ir a la página de inicio</title><path data-name="img" d="M51.89 51.892H0V0h51.89zm-2.5-2.494v-8.96L38.906 42.33a17.743 17.743 0 01-3.136.278 18.211 18.211 0 01-9.225-2.517 21.42 21.42 0 00-9.317-2.082 20.786 20.786 0 00-4.9.571c-.743.15-1.526.292-2.282.429l-.125.023-.613.112-4.928.913-1.875.382V48.934l1.527-.247 22.517-4.133a17.458 17.458 0 013.236-.3 18.06 18.06 0 017.317 1.527l5.442 2.854a9.431 9.431 0 002.372.679 7.837 7.837 0 001.147.083h.029a16 16 0 003.3-.464zm0 0zm0-8.96V27.195a8.1 8.1 0 00-4.062-1.2 7.451 7.451 0 00-1.162.094l-10.852 2.009c-.026 0-2.878.518-4.281.779L17.12 31.048a18.266 18.266 0 01-2.5.173 18.246 18.246 0 01-7.67-1.683l-4.447-2.34V33.636l1.511-.281a19.009 19.009 0 014.442-.517 17.882 17.882 0 018.168 1.894 23.042 23.042 0 0010.673 2.617 23.64 23.64 0 002.884-.178l19.21-3.535zm0-13.243v-8.778l-1.341.282a19.092 19.092 0 01-4.442.516 17.873 17.873 0 01-8.169-1.894 23.049 23.049 0 00-10.672-2.618 23.464 23.464 0 00-2.884.179L2.5 18.417v6.538a7.558 7.558 0 003.968 1.128 9.406 9.406 0 001.426-.116l10.852-2.008c.027-.005 2.876-.518 4.28-.78l11.914-2.174a18.122 18.122 0 012.5-.173 18.236 18.236 0 017.67 1.683l4.277 2.441v-4.427zm0-8.778V2.981l-7.4 1.524-7.35 1.328-7.035 1.277a23.976 23.976 0 01-5.306.62 16.834 16.834 0 01-4.517-.57 19.322 19.322 0 01-5.084-2.209 95.551 95.551 0 00-1.3-.712c-.285-.139-.571-.291-.846-.437h-.005a9.085 9.085 0 00-2.252-.954 7.331 7.331 0 00-1.918-.341H2.5v9c1.433-.237 2.593-.442 3.651-.647l7.517-1.345a19.656 19.656 0 012.63-.178 17.162 17.162 0 012.63.2 22.628 22.628 0 017.434 2.705 21.654 21.654 0 008.584 1.768h.006a20.746 20.746 0 003.173-.242l11.264-2.256v6.907zM2.5 2.98v-.472h2.95a14.929 14.929 0 00-2.949.473z"/></svg>
28
28
  </a>
29
- {% if params.subnav.text %}
30
- <div {%- if params.subnav.classes %} class="{{ params.subnav.classes }}"{% endif %}>
31
- {% from "./_macro.header.header__subnav.njk" import componentHeaderSubnav %}
32
- {% call componentHeaderSubnav({
33
- text: params.subnav.text,
34
- items: params.subnav.items
35
- }) %}
36
- {% if params.subnav.items %}
37
- {% from "../nav/_macro.nav.njk" import componentNav %}
38
- {{ componentNav({
39
- isMenu: true,
40
- idPrefix: "header-subnav-nav-item",
41
- items: params.subnav.items,
42
- classes: "w-max max-w-64",
43
- attributes: {
44
- "id": "id-subnav-nav",
45
- "aria-label": "Aplicaciones"
46
- }
47
- }) }}
48
- {% endif %}
49
- {% endcall %}
50
- </div>
29
+ {% if params.subnav %}
30
+ {% from "./_macro.header.header__subnav.njk" import componentHeaderSubnav %}
31
+ {% call componentHeaderSubnav({
32
+ "text": params.subnav.text,
33
+ "html": params.subnav.html,
34
+ "hiddenText": params.subnav.hiddenText,
35
+ "classesContainer": params.subnav.classesContainer,
36
+ "classesTooltip": params.subnav.classesTooltip,
37
+ "classes": params.subnav.classes if params.subnav.classes else "c-dropdown--header",
38
+ "attributes": params.subnav.attributes,
39
+ "items": params.subnav.items
40
+ }) %}
41
+ {% if params.subnav.items %}
42
+ {% from "../nav/_macro.nav.njk" import componentNav %}
43
+ {{ componentNav({
44
+ isMenu: true,
45
+ idPrefix: "header-subnav-nav-item",
46
+ items: params.subnav.items,
47
+ classes: "w-max max-w-64",
48
+ attributes: {
49
+ "id": "id-subnav-nav",
50
+ "aria-label": "Aplicaciones"
51
+ }
52
+ }) }}
53
+ {% endif %}
54
+ {% endcall %}
51
55
  {% endif %}
52
56
  </div>
53
57
  {% if params.navigation.items %}
@@ -62,12 +66,20 @@
62
66
  }) | indent(12) }}
63
67
  {% endif %}
64
68
  </div>
65
- {% if params.dropdown.items %}
66
- <div class="{{ params.dropdown.classes if params.dropdown.classes else 'hidden lg:block' }}">
67
- {% from "./_macro.header.header__dropdown.njk" import componentHeaderDropdown %}
68
- {% call componentHeaderDropdown({
69
- text: params.dropdown.text
70
- }) %}
69
+ {% if params.dropdown.items or params.dropdown.contentHtml %}
70
+ {% from "./_macro.header.header__dropdown.njk" import componentHeaderDropdown %}
71
+ {% call componentHeaderDropdown({
72
+ "text": params.dropdown.text,
73
+ "html": params.dropdown.html,
74
+ "hiddenText": params.dropdown.hiddenText,
75
+ "classesContainer": params.dropdown.classesContainer if params.dropdown.classesContainer else "hidden lg:block",
76
+ "classesTooltip": params.dropdown.classesTooltip,
77
+ "classes": params.dropdown.classes if params.dropdown.classes else "c-dropdown--header",
78
+ "attributes": params.dropdown.attributes
79
+ }) %}
80
+ {% if params.dropdown.contentHtml %}
81
+ {{ params.dropdown.contentHtml | safe }}
82
+ {% else %}
71
83
  {% from "../nav/_macro.nav.njk" import componentNav %}
72
84
  {{ componentNav({
73
85
  isMenu: true,
@@ -79,8 +91,8 @@
79
91
  "aria-label": "Menú de usuario"
80
92
  }
81
93
  }) }}
82
- {% endcall %}
83
- </div>
94
+ {% endif %}
95
+ {% endcall %}
84
96
  {% endif %}
85
97
  {% if params.offcanvas %}
86
98
  {% from "./_macro.header.header__offcanvasButton.njk" import componentHeaderOffcanvasButton %}
@@ -19,11 +19,31 @@ params:
19
19
  - name: text
20
20
  type: string
21
21
  required: true
22
- description: Text for the subnav item. If no items are defined, there will be simple text instead a dropdown.
22
+ description: If `html` is set, this is not required. Text for the dropdown. If `html` is provided, the `text` argument will be ignored.
23
+ - name: html
24
+ type: string
25
+ required: true
26
+ description: If `text` is set, this is not required. HTML for the dropdown. If `html` is provided, the `text` argument will be ignored.
27
+ - name: hiddenText
28
+ type: string
29
+ required: false
30
+ description: Text for screenreaders only after the dropdown element.
31
+ - name: classesContainer
32
+ type: string
33
+ required: false
34
+ description: Classes to add to the container div of dropdown and tooltip elements.
35
+ - name: classesTooltip
36
+ type: string
37
+ required: false
38
+ description: Classes to add to the tooltip content.
23
39
  - name: classes
24
40
  type: string
25
41
  required: false
26
- description: Classes for the subnav component.
42
+ description: Classes to add to the dropdown element.
43
+ - name: attributes
44
+ type: object
45
+ required: false
46
+ description: HTML attributes (for example data attributes) to add to the dropdown element.
27
47
  - name: contentHtml
28
48
  type: string
29
49
  required: true
@@ -77,11 +97,31 @@ params:
77
97
  - name: text
78
98
  type: string
79
99
  required: true
80
- description: Text for the dropdown item.
100
+ description: If `html` is set, this is not required. Text for the dropdown. If `html` is provided, the `text` argument will be ignored.
101
+ - name: html
102
+ type: string
103
+ required: true
104
+ description: If `text` is set, this is not required. HTML for the dropdown. If `html` is provided, the `text` argument will be ignored.
105
+ - name: hiddenText
106
+ type: string
107
+ required: false
108
+ description: Text for screenreaders only after the dropdown element.
109
+ - name: classesContainer
110
+ type: string
111
+ required: false
112
+ description: Classes to add to the container div of dropdown and tooltip elements. Defaults to 'hidden lg:block'
113
+ - name: classesTooltip
114
+ type: string
115
+ required: false
116
+ description: Classes to add to the tooltip content.
81
117
  - name: classes
82
118
  type: string
83
119
  required: false
84
- description: Classes for the dropdown component. Defaults to 'hidden lg:block'.
120
+ description: Classes to add to the dropdown element.
121
+ - name: attributes
122
+ type: object
123
+ required: false
124
+ description: HTML attributes (for example data attributes) to add to the dropdown element.
85
125
  - name: contentHtml
86
126
  type: string
87
127
  required: true
@@ -89,7 +129,7 @@ params:
89
129
  - name: items
90
130
  type: array
91
131
  required: true
92
- description: An array of navigation item objects in subnav dropdown.
132
+ description: An array of navigation item objects in subnav dropdown. If `items` is provided, the `contentHtml` argument will be ignored.
93
133
  params:
94
134
  - name: href
95
135
  type: string
@@ -148,7 +148,8 @@
148
148
  },
149
149
  {
150
150
  "href": "http://www.google.com",
151
- "text": "Option 4"
151
+ "text": "Option 4",
152
+ "disabled": true
152
153
  },
153
154
  {
154
155
  "href": "http://www.google.com",
@@ -26,7 +26,7 @@
26
26
  </span>
27
27
  {% else %}
28
28
  <a {%- if id %} id="{{ id }}"{% endif %} href="{{ item.href }}" class="c-menu-horizontal__link relative flex items-center py-sm lg:px-lg lg:py-base border border-transparent text-black hover:text-primary-base underline truncate focus:outline-none
29
- {%- if item.disabled %} opacity-50 pointer-events-none{% 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 -%}>
29
+ {%- if item.disabled %} no-underline pointer-events-none{% 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 -%}>
30
30
  <span class="flex items-center pointer-events-none">
31
31
  {{ item.html | safe if item.html else item.text }}
32
32
  </span>