desy-html 6.3.3 → 6.4.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/config/tailwind.config.js +2 -0
  2. package/docs/ds/_ds.example.menu-navigation.njk +4 -4
  3. package/docs/ds/_ds.section.typography.njk +3 -3
  4. package/docs/index.html +11 -0
  5. package/package.json +1 -1
  6. package/src/js/aria/collapsible.js +8 -1
  7. package/src/js/aria/dialog.js +13 -1
  8. package/src/js/aria/notification.js +29 -0
  9. package/src/js/aria/tabs.js +2 -0
  10. package/src/js/aria/toggle.js +24 -6
  11. package/src/js/desy-html.js +4 -0
  12. package/src/js/index.js +3 -1
  13. package/src/templates/components/accordion/_examples.accordion.njk +22 -0
  14. package/src/templates/components/accordion-history/_examples.accordion-history.njk +22 -0
  15. package/src/templates/components/collapsible/_template.collapsible.njk +1 -1
  16. package/src/templates/components/dialog/_examples.dialog.njk +2 -4
  17. package/src/templates/components/dialog/_styles.dialog.css +1 -1
  18. package/src/templates/components/header/_examples.header-2.njk +19 -0
  19. package/src/templates/components/header/_examples.header.njk +19 -0
  20. package/src/templates/components/header/_template.header.header__offcanvas.njk +2 -2
  21. package/src/templates/components/header/_template.header.njk +10 -1
  22. package/src/templates/components/header/params.header.yaml +20 -0
  23. package/src/templates/components/input-group/_examples.input-group.njk +36 -7
  24. package/src/templates/components/menu-navigation/_examples.menu-navigation.njk +4 -4
  25. package/src/templates/components/modal/_template.modal.njk +2 -2
  26. package/src/templates/components/notification/_template.notification.njk +3 -3
  27. package/src/templates/components/tabs/_examples.tabs.njk +1 -1
  28. package/src/templates/components/toggle/_examples.toggle.njk +19 -0
  29. package/src/templates/components/toggle/_template.toggle.njk +9 -7
@@ -136,6 +136,8 @@ module.exports = {
136
136
  DEFAULT: {
137
137
  css: {
138
138
  color: theme('colors.black'),
139
+ lineHeight: '1.5rem',
140
+ '--tw-prose-bullets': theme('colors.black'),
139
141
  a: {
140
142
  color: theme('colors.primary.base'),
141
143
  '&:hover': {
@@ -389,7 +389,7 @@
389
389
  {
390
390
  "text": "Item 1",
391
391
  "id": "header-custom-nav-item-1",
392
- "classes": "c-menu-navigation__button--header -mr-base uppercase",
392
+ "classes": "c-menu-navigation__button--header -mr-base",
393
393
  "sub": {
394
394
  "items": [
395
395
  {
@@ -413,7 +413,7 @@
413
413
  {
414
414
  "text": "Active Item 2",
415
415
  "id": "header-custom-nav-item-2",
416
- "classes": "c-menu-navigation__button--header -mr-base uppercase",
416
+ "classes": "c-menu-navigation__button--header -mr-base",
417
417
  "active": true,
418
418
  "sub": {
419
419
  "items": [
@@ -439,7 +439,7 @@
439
439
  {
440
440
  "text": "Disabled Item 3",
441
441
  "id": "header-custom-nav-item-3",
442
- "classes": "c-menu-navigation__button--header -mr-base uppercase",
442
+ "classes": "c-menu-navigation__button--header -mr-base",
443
443
  "disabled": true,
444
444
  "sub": {
445
445
  "items": [
@@ -464,7 +464,7 @@
464
464
  {
465
465
  "text": "Item 4 right",
466
466
  "id": "header-custom-nav-item-4",
467
- "classes": "c-menu-navigation__button--header uppercase",
467
+ "classes": "c-menu-navigation__button--header",
468
468
  "sub": {
469
469
  "items": [
470
470
  {
@@ -11,14 +11,14 @@
11
11
  {{ DSSubsectionTitle({
12
12
  title: "Tailwindcss typography plugin"
13
13
  }) }}
14
- <p class="c-paragraph-base">Para dar estilos por defecto a contenido html sin clases que proviene de markdown o de wysiwyg, utilizamos un plugin de Tailwindcss: <a href="https://github.com/tailwindlabs/tailwindcss-typography" class="c-link">tailwindcss-typography</a>. Basta con añadir al contenedor la clase <code>.prose</code>. También hay variantes de estos estilos que pueden usarse con breakpoints, por ejemplo: <code>prose-sm lg:prose max-w-none lg:max-w-none mx-auto</code>. Leer la <a href="https://github.com/tailwindlabs/tailwindcss-typography" class="c-link">documentación</a>.</p>
14
+ <p class="c-paragraph-base">Para dar estilos por defecto a contenido html sin clases que proviene de markdown o de wysiwyg, utilizamos un plugin de Tailwindcss: <a href="https://github.com/tailwindlabs/tailwindcss-typography" class="c-link">tailwindcss-typography</a>. Basta con añadir al contenedor la clase <code>.prose</code>. También hay variantes de estos estilos que pueden usarse con breakpoints, por ejemplo: <code>prose prose-sm lg:prose-base max-w-none lg:max-w-none mx-auto</code>. Leer la <a href="https://github.com/tailwindlabs/tailwindcss-typography" class="c-link">documentación</a>.</p>
15
15
  <div class="pb-lg"></div>
16
16
  {% from "ds/_ds.macro.subsection-title.njk" import DSSubsectionTitle %}
17
17
  {{ DSSubsectionTitle({
18
18
  title: "Ejemplo:"
19
19
  }) }}
20
20
  <div class="pb-xl"></div>
21
- <div class="prose-sm lg:prose max-w-none lg:max-w-none mx-auto">
21
+ <div class="prose prose-sm lg:prose-base max-w-none lg:max-w-none mx-auto">
22
22
  <p class="lead">Until now, trying to style an article, document, or blog post with Tailwind has been a tedious task that required a keen eye for typography and a lot of complex custom CSS.</p>
23
23
  <p>
24
24
  By default, Tailwind removes all of the default browser styling from paragraphs, headings, lists and more. This ends up being really useful for building application UIs because you spend less time undoing user-agent styles, but when you
@@ -249,4 +249,4 @@
249
249
  {% from "ds/_ds.macro.code-snippet.njk" import DSCodeSnippet %}
250
250
  {{ DSCodeSnippet("ds/_ds.example.typography.njk") }}
251
251
  </div>
252
- </div>
252
+ </div>
package/docs/index.html CHANGED
@@ -38,6 +38,17 @@
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.6.4.0</h3>
42
+ <ul class="text-sm">
43
+ <li>Added title for mobile in Header.</li>
44
+ <li>Now the Dialog close on click outside.</li>
45
+ <li>Fixed Notification not closing on close button click.</li>
46
+ <li>Fixed Toggle bad arias and colors.</li>
47
+ <li>Fixed Collapsible bad arias and not opening.</li>
48
+ <li>Fixed Tabs active element.</li>
49
+ <li>Improved prose styles. Now the lists have black bullets and paragraphs correct line heights.</li>
50
+ <li>Improvements in documentation.</li>
51
+ </ul>
41
52
  <h3>v.6.3.3</h3>
42
53
  <ul class="text-sm">
43
54
  <li>Fixed behavior in Accordion and Accordion history.</li>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "desy-html",
3
- "version": "6.3.3",
3
+ "version": "6.4.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)",
@@ -5,6 +5,9 @@ export function Collapsible(aria) {
5
5
  this.rootEl = domNode;
6
6
  this.buttonEl = this.rootEl.querySelector('button[aria-expanded]');
7
7
  this.buttonEl.addEventListener('click', this.toggle.bind(this));
8
+ if(domNode.dataset.expanded){
9
+ this.buttonEl.click()
10
+ }
8
11
  }
9
12
 
10
13
  toggle(event) {
@@ -18,16 +21,20 @@ export function Collapsible(aria) {
18
21
  elementCollapsibleContent.classList.toggle('hidden')
19
22
 
20
23
  if(elementCollapsibleShow.classList.contains('hidden')) {
24
+ this.buttonEl.setAttribute('aria-expanded', 'true')
21
25
  elementCollapsibleShow.setAttribute('aria-hidden', 'false')
22
26
  elementCollapsibleHide.setAttribute('aria-hidden', 'true')
27
+ elementCollapsibleContent.setAttribute('aria-hidden', 'false')
23
28
  } else {
29
+ this.buttonEl.setAttribute('aria-expanded', 'false')
24
30
  elementCollapsibleShow.setAttribute('aria-hidden', 'true')
25
31
  elementCollapsibleHide.setAttribute('aria-hidden', 'false')
32
+ elementCollapsibleContent.setAttribute('aria-hidden', 'true')
26
33
  }
27
34
  }
28
35
  }
29
36
 
30
- const collapsible = document.querySelectorAll('.c-collapsible');
37
+ const collapsible = document.querySelectorAll('[data-module="c-collapsible"]');
31
38
  collapsible.forEach((collapsibleElement) => {
32
39
  new Collapsible(collapsibleElement);
33
40
  });
@@ -276,12 +276,24 @@ export function dialog(aria) {
276
276
 
277
277
  aria.Dialog.prototype.addListeners = function () {
278
278
  document.addEventListener('focus', this.trapFocus, true);
279
+ document.addEventListener('click', this.clickOutSide, true)
279
280
  }; // end addListeners
280
281
 
281
282
  aria.Dialog.prototype.removeListeners = function () {
282
283
  document.removeEventListener('focus', this.trapFocus, true);
284
+ document.removeEventListener('click', this.clickOutSide, true);
283
285
  }; // end removeListeners
284
286
 
287
+ aria.Dialog.prototype.clickOutSide = function (event) {
288
+ var currentDialog = aria.getCurrentDialog();
289
+ var getDialogElement = currentDialog.dialogNode;
290
+ const isClickInside = getDialogElement.contains(event.target)
291
+
292
+ if (!isClickInside) {
293
+ currentDialog.close();
294
+ }
295
+ };
296
+
285
297
  aria.Dialog.prototype.trapFocus = function (event) {
286
298
  if (aria.Utils.IgnoreUtilFocusChanges) {
287
299
  return;
@@ -319,4 +331,4 @@ export function dialog(aria) {
319
331
  }; // end replaceDialog
320
332
 
321
333
  }());
322
- }
334
+ }
@@ -0,0 +1,29 @@
1
+ export function notification() {
2
+
3
+ class Notification {
4
+ constructor(domNode) {
5
+ this.rootEl = domNode;
6
+ /*No todas las notificaciones tienen botón de cerrar
7
+ así que comprobamos que el componente contiene el botón.*/
8
+ if(this.rootEl.querySelector('.c-notification-button__close')) {
9
+ this.buttonClose = this.rootEl.querySelector('.c-notification-button__close');
10
+ this.buttonClose.addEventListener('click', this._closeNotification.bind(this));
11
+ }
12
+ }
13
+
14
+ _closeNotification() {
15
+ //Replicamos la transición de alpine con tailwind al cerrar.
16
+ this.rootEl.classList.add('transition-opacity', 'duration-150', 'ease-in-out', 'opacity-0');
17
+ //Añadimos display: none para que el componente "desaparezca del DOM"
18
+ setTimeout(() =>{
19
+ this.rootEl.classList.add('hidden');
20
+ },300)
21
+ }
22
+ }
23
+
24
+ const notifications = document.querySelectorAll('[data-module="c-notification"]');
25
+ notifications.forEach((notificationElement) => {
26
+ new Notification(notificationElement);
27
+ });
28
+
29
+ }
@@ -27,12 +27,14 @@ export function tabs(aria) {
27
27
  if(getClassFromTabs.some(tab => tab.classList.contains('c-tabs__link--is-active'))) {
28
28
  tabs.forEach((tab) => {
29
29
  if(tab.classList.contains('c-tabs__link--is-active')) {
30
+ activateTab(tab, false)
30
31
  addActiveClass(tab)
31
32
  }
32
33
  })
33
34
  } else {
34
35
  tabs.forEach((tab, index) => {
35
36
  if(index === 0) {
37
+ activateTab(tab, false)
36
38
  addActiveClass(tab)
37
39
  }
38
40
  })
@@ -3,21 +3,39 @@ export function Toggle(aria) {
3
3
  class Toggle {
4
4
  constructor(domNode) {
5
5
  this.rootEl = domNode;
6
- this.buttonEl = this.rootEl.querySelector('button[aria-expanded]');
7
-
6
+ this.buttonEl = this.rootEl.querySelector('.c-toggle__button');
8
7
  this.buttonEl.addEventListener('click', this.toggle.bind(this));
9
8
  }
10
9
 
11
10
  toggle(event) {
12
11
  const { target } = event
13
- this.buttonEl.classList.toggle('c-button--has-selection')
14
- target.querySelector('.c-button-is-not_pressed').classList.toggle('hidden')
15
- target.querySelector('.c-button-is_pressed').classList.toggle('hidden')
12
+ this.buttonEl.classList.toggle('c-toggle--is-opened')
13
+ target.querySelector('.c-button--is-not-pressed').classList.toggle('hidden')
14
+ target.querySelector('.c-button--is-pressed').classList.toggle('hidden')
15
+
16
+ this.ariaAttribute(target)
17
+ }
18
+
19
+ ariaAttribute(target) {
20
+ if(target.getAttribute('aria-checked')) {
21
+ const toggleIsOpened = target.classList.contains('c-toggle--is-opened') ? true : false
22
+ this.buttonEl.setAttribute('aria-checked', toggleIsOpened);
23
+ }
24
+
25
+ if(target.getAttribute('aria-pressed')) {
26
+ const toggleIsOpened = target.classList.contains('c-toggle--is-opened') ? true : false
27
+ this.buttonEl.setAttribute('aria-pressed', toggleIsOpened);
28
+ }
29
+
30
+ if(target.getAttribute('aria-expanded')) {
31
+ const toggleIsOpened = target.classList.contains('c-toggle--is-opened') ? true : false
32
+ this.buttonEl.setAttribute('aria-expanded', toggleIsOpened);
33
+ }
16
34
  }
17
35
 
18
36
  }
19
37
 
20
- const toggles = document.querySelectorAll('.c-toggle');
38
+ const toggles = document.querySelectorAll('[data-module="c-toggle"]');
21
39
  toggles.forEach((toggleElement) => {
22
40
  new Toggle(toggleElement);
23
41
  });
@@ -14,6 +14,7 @@ import { Treeitem } from './aria/treeitem.js';
14
14
  import { Tree } from './aria/tree.js';
15
15
  import { Toggle } from './aria/toggle.js';
16
16
  import { Collapsible } from './aria/collapsible.js';
17
+ import { notification } from './aria/notification.js';
17
18
 
18
19
 
19
20
  export function accordionComponent(aria) {
@@ -363,3 +364,6 @@ export function treeComponent(aria) {
363
364
  }
364
365
  }
365
366
 
367
+ export function notificationComponent(aria) {
368
+ notification(aria);
369
+ }
package/src/js/index.js CHANGED
@@ -16,7 +16,8 @@ import {
16
16
  tabsComponent,
17
17
  tooltipComponent,
18
18
  toggleComponent,
19
- treeComponent
19
+ treeComponent,
20
+ notificationComponent
20
21
  } from './desy-html.js';
21
22
 
22
23
  var aria = aria || {};
@@ -34,6 +35,7 @@ tabsComponent(aria);
34
35
  tooltipComponent(aria);
35
36
  toggleComponent(aria);
36
37
  treeComponent(aria);
38
+ notificationComponent(aria);
37
39
 
38
40
  document.querySelectorAll('.c-code-snippet__button').forEach(button => {
39
41
  button.addEventListener('click', (event) => {
@@ -259,6 +259,28 @@
259
259
  ]
260
260
  }
261
261
  },
262
+ {
263
+ "name": "with html in headers",
264
+ "description": "To avoid event problems, use pointer-events-none class in subelements",
265
+ "data": {
266
+ "idPrefix": "accordion-example-pointer-events-none",
267
+ "headingLevel": 3,
268
+ "items": [
269
+ {
270
+ "headerHtml": '<span class="block pointer-events-none">Accordion Item 1</span><span class="block pointer-events-none font-normal">Subelement also receives events</span>',
271
+ "html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>"
272
+ },
273
+ {
274
+ "headerHtml": '<span class="block pointer-events-none">Accordion Item 2</span><span class="block pointer-events-none font-normal">Subelement also receives events</span>',
275
+ "html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>"
276
+ },
277
+ {
278
+ "headerHtml": '<span class="block pointer-events-none">Accordion Item 3</span><span class="block pointer-events-none font-normal">Subelement also receives events</span>',
279
+ "html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>"
280
+ }
281
+ ]
282
+ }
283
+ },
262
284
  {
263
285
  "name": "With classes applied",
264
286
  "description": "Show code to display the classes applied in html",
@@ -295,6 +295,28 @@
295
295
  ]
296
296
  }
297
297
  },
298
+ {
299
+ "name": "with html in headers",
300
+ "description": "To avoid event problems, use pointer-events-none class in subelements",
301
+ "data": {
302
+ "idPrefix": "accordion-example-pointer-events-none",
303
+ "headingLevel": 3,
304
+ "items": [
305
+ {
306
+ "headerHtml": '<span class="block pointer-events-none">Accordion Item 1</span><span class="block pointer-events-none font-normal">Subelement also receives events</span>',
307
+ "html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>"
308
+ },
309
+ {
310
+ "headerHtml": '<span class="block pointer-events-none">Accordion Item 2</span><span class="block pointer-events-none font-normal">Subelement also receives events</span>',
311
+ "html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>"
312
+ },
313
+ {
314
+ "headerHtml": '<span class="block pointer-events-none">Accordion Item 3</span><span class="block pointer-events-none font-normal">Subelement also receives events</span>',
315
+ "html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>"
316
+ }
317
+ ]
318
+ }
319
+ },
298
320
  {
299
321
  "name": "With classes applied",
300
322
  "description": "Show code to display the classes applied in html",
@@ -1,5 +1,5 @@
1
1
  <!-- collapsible -->
2
- <div class="{%- if params.classes %} {{ params.classes }}{% else -%} -my-px py-sm border-t border-b border-neutral-base{% endif %} c-collapsible" {%- for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}>
2
+ <div class="{%- if params.classes %} {{ params.classes }}{% else -%} -my-px py-sm border-t border-b border-neutral-base{% endif %} c-collapsible" {%- for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %} {% if params.open %} data-expanded="true" {% endif %} data-module="c-collapsible">
3
3
  <button aria-expanded="false" {%- if params.id %} id="{{params.id}}-title"{% endif %} class="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 params.id %} aria-controls="{{params.id}}"{% endif %}>{{ params.headerHtml | safe if params.headerHtml else params.headerText }}
4
4
  <span class="c-collapsible__show absolute inset-y-0 right-0 py-sm font-normal text-sm text-neutral-dark underline group-focus:text-black pointer-events-none " aria-hidden="false">Mostrar</span>
5
5
  <span class="c-collapsible__hide absolute inset-y-0 right-0 py-sm font-normal text-sm text-neutral-dark underline group-focus:text-black pointer-events-none hidden" aria-hidden="true">Ocultar</span>
@@ -18,8 +18,7 @@
18
18
  }
19
19
  }
20
20
  ],
21
- "isDismissible": true,
22
- "classes": "mt-2xl"
21
+ "isDismissible": true
23
22
  }) }}
24
23
  {% endset %}
25
24
 
@@ -46,8 +45,7 @@
46
45
  }
47
46
  }
48
47
  ],
49
- "isDismissible": true,
50
- "classes": "mt-2xl"
48
+ "isDismissible": true
51
49
  }) }}
52
50
  {% endset %}
53
51
 
@@ -13,7 +13,7 @@
13
13
  @apply hidden fixed overflow-y-auto inset-0 bg-black bg-opacity-50 z-50;
14
14
 
15
15
  &.active {
16
- @apply flex justify-center content-center;
16
+ @apply grid h-screen place-items-center;
17
17
  }
18
18
  }
19
19
  }
@@ -369,6 +369,25 @@
369
369
  "caller": exampleOffcanvas
370
370
  }
371
371
  },
372
+ {
373
+ "name": "con offcanvas y mobileTitle",
374
+ "description": "Menu mobile que sólo se muestra en anchuras pequeñas y que permite insertar dentro cualquier contenido con Nunjuks caller y título que sólo se muestra en mobile",
375
+ "data": {
376
+ "homepageUrl": "/",
377
+ "mobileTitle": {
378
+ "text": "Carpeta del gestor"
379
+ },
380
+ "subnav": {
381
+ "text": "Carpeta del gestor"
382
+ },
383
+ "offcanvas": {
384
+ "text": "Menú",
385
+ "textClose": "Cerrar menu",
386
+ "labelledId": "offcanvas-title"
387
+ },
388
+ "caller": exampleOffcanvas
389
+ }
390
+ },
372
391
  {
373
392
  "name": "con subnav text",
374
393
  "description": "Utilizar para mostrar el nombre de la app actual. Si no se proporcionan items en subnav, el texto será simple sin un dropdown.",
@@ -312,6 +312,25 @@
312
312
  "caller": exampleOffcanvas
313
313
  }
314
314
  },
315
+ {
316
+ "name": "con offcanvas y mobileTitle",
317
+ "description": "Menu mobile que sólo se muestra en anchuras pequeñas y que permite insertar dentro cualquier contenido con Nunjuks caller y título que sólo se muestra en mobile",
318
+ "data": {
319
+ "homepageUrl": "/",
320
+ "mobileTitle": {
321
+ "text": "Carpeta del gestor"
322
+ },
323
+ "subnav": {
324
+ "text": "Carpeta del gestor"
325
+ },
326
+ "offcanvas": {
327
+ "text": "Menú",
328
+ "textClose": "Cerrar menu",
329
+ "labelledId": "offcanvas-title"
330
+ },
331
+ "caller": exampleOffcanvas
332
+ }
333
+ },
315
334
  {
316
335
  "name": "con subnav text",
317
336
  "description": "Utilizar para mostrar el nombre de la app actual. Si no se proporcionan items en subnav, el texto será simple sin un dropdown.",
@@ -1,6 +1,6 @@
1
1
  <div id="header-offcanvas" class="hidden" role="dialog" aria-labelledby="header-offcanvas-button-text" aria-modal="true">
2
- <div class="origin-top-left left-0 fixed inset-0 h-screen">
3
- <div class="h-full overflow-auto relative w-offcanvas h-screen ml-offcanvas-negative bg-white z-10">
2
+ <div class="left-0 fixed top-0 h-screen w-offcanvas ml-offcanvas-negative">
3
+ <div class="h-full overflow-auto relative h-screen bg-white z-10">
4
4
  <div class="text-right p-sm">
5
5
  <button
6
6
  onclick="closeDialog(this)"
@@ -16,7 +16,7 @@
16
16
  <div class="container mx-auto px-base">
17
17
  <div class="flex items-center justify-between min-h-14">
18
18
  <div class="flex flex-wrap items-center">
19
- <div class="flex items-center flex-shrink-0">
19
+ <div class="flex items-center">
20
20
  <a href="{{ params.homepageUrl | default('/') }}" class="flex flex-wrap mr-4 text-black focus:outline-none focus:shadow-outline-black">
21
21
  {% if not params.noLogo %}
22
22
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 144 32" width="144" height="32" class="fill-current {% if params.expandedLogo %} hidden sm:block{% else %} hidden{% endif %}" aria-label="Gobierno de Aragón. Ir a la página de inicio" role="img"><defs><clipPath id="b-logo-expanded"><path fill="gold" d="M0 0h31.509v31.495H0z"/></clipPath><clipPath id="a-logo-expanded"><path d="M0 0h144v32H0z"/></clipPath></defs><g clip-path="url(#a-logo-expanded)"><path fill="gold" d="M0 .205h31.509V31.7H0z"/><g clip-path="url(#b-logo-expanded)" transform="translate(0 .205)"><g fill="#dd171b" fill-rule="evenodd"><path d="m31.509 6.048-7.568 1.515a14.545 14.545 0 0 1-7.905-1.025 15.04 15.04 0 0 0-5-1.817 12.536 12.536 0 0 0-3.535-.011l-5.051.9c-.8.156-1.639.3-2.453.434V.315A7.1 7.1 0 0 1 3.888.226a9.926 9.926 0 0 1 2.085.936 17.6 17.6 0 0 0 4.293 1.962 13.92 13.92 0 0 0 6.6-.034l4.728-.858 4.939-.892 4.97-1.024ZM6.602 24.229a14.592 14.592 0 0 1 9.555 1.014 12.178 12.178 0 0 0 8.307 1.5l7.044-1.271v5.706a8.247 8.247 0 0 1-3.008.256 6.4 6.4 0 0 1-1.594-.457l-3.657-1.917a12.217 12.217 0 0 0-7.092-.825L1.026 31.011 0 31.177v-5.706l1.26-.256 3.312-.613c.669-.123 1.371-.245 2.029-.379ZM-.003 15.077v-4.391l13.027-2.377a15.5 15.5 0 0 1 9.11 1.638 12.535 12.535 0 0 0 8.474.925l.9-.189v4.391l-2.874-1.639a12.286 12.286 0 0 0-6.835-1.014l-8.006 1.46c-.959.179-2.877.524-2.877.524l-7.292 1.349a5.152 5.152 0 0 1-3.627-.677ZM31.509 16.583v4.324L18.6 23.282a15.5 15.5 0 0 1-9.11-1.638 12.532 12.532 0 0 0-8.474-.925l-1.015.19v-4.324l2.988 1.572a12.291 12.291 0 0 0 6.835 1.014l8.006-1.46c.959-.178 2.877-.524 2.877-.524l7.292-1.349a5.142 5.142 0 0 1 3.51.745Z"/></g></g><path d="M38.2 28.807v-8.551h1.393c2.893 0 4.478 1.522 4.478 4.286 0 2.829-1.521 4.265-4.5 4.265Zm10.4-11.4v14.294h9.47v-2.893h-6.277v-3.257h6.214v-2.893h-6.214v-2.379h6.277v-2.871Zm21.751 0-5.206 14.294h3.385l1.542-4.35h4.371l1.521 4.35h3.45L74.1 17.407Zm1.885 2.956-1.328 4.223h2.679Zm42.341 4.03h-3.192v4.5a4.206 4.206 0 0 1-1.371.193 4.251 4.251 0 0 1-4.242-4.5 4.443 4.443 0 0 1 4.735-4.65 7.481 7.481 0 0 1 4.071 1.243v-3.257a11.674 11.674 0 0 0-4.349-.857c-4.628 0-7.841 3.107-7.841 7.564 0 4.393 3.149 7.372 7.841 7.372a12.977 12.977 0 0 0 4.349-.75Zm16.132.129a7.424 7.424 0 1 0-7.391 7.436 7.122 7.122 0 0 0 7.393-7.436Zm-7.456-4.458c-2.4 0-4.006 1.822-4.006 4.5s1.65 4.5 4.071 4.5c2.4 0 3.985-1.8 3.985-4.5s-1.627-4.501-4.048-4.501Zm8.689-2.657v14.294h3.257v-9.108l5.762 9.108h3.021V17.407h-3.256v8.889l-5.532-8.889ZM46.922 7.33h-3.193v4.5a4.335 4.335 0 0 1-5.613-4.307 4.443 4.443 0 0 1 4.735-4.65 7.487 7.487 0 0 1 4.071 1.243V.859a11.674 11.674 0 0 0-4.35-.858c-4.628 0-7.841 3.107-7.841 7.565 0 4.393 3.15 7.371 7.841 7.371a12.99 12.99 0 0 0 4.35-.75Zm16.116.128a7.424 7.424 0 1 0-7.392 7.436 7.122 7.122 0 0 0 7.396-7.436Zm-7.456-4.457c-2.4 0-4.006 1.821-4.006 4.5s1.65 4.5 4.071 4.5c2.4 0 3.985-1.8 3.985-4.5s-1.626-4.5-4.047-4.5ZM64.107.344v14.293h5.914c3.15 0 4.992-1.565 4.992-4.243a3.717 3.717 0 0 0-2.978-3.728 3.133 3.133 0 0 0 1.95-2.936c.021-2.272-1.521-3.386-4.606-3.386Zm4.757 5.336c1.393 0 1.95-.386 1.95-1.35 0-.921-.536-1.264-2.057-1.264h-1.393V5.68Zm.429 6.043c1.585 0 2.271-.493 2.271-1.651 0-1.2-.707-1.671-2.4-1.671h-1.8v3.322ZM78.879.344h-3.192v14.293h3.192Zm1.39 0v14.293h9.47v-2.893h-6.278V8.487h6.214V5.594h-6.214V3.216h6.278V.345Zm50.463 7.114a7.424 7.424 0 1 0-7.392 7.436 7.122 7.122 0 0 0 7.395-7.436Zm-7.456-4.457c-2.4 0-4.006 1.821-4.006 4.5s1.65 4.5 4.071 4.5c2.4 0 3.985-1.8 3.985-4.5s-1.626-4.5-4.047-4.5ZM97.917 24.585l-1.35-4.223-1.328 4.223ZM83.249 31.7v-5.872h.407c2.057 0 2.271.214 3.642 3.75a7.159 7.159 0 0 0 .3.729l.278.664a6.4 6.4 0 0 0 .343.729h4.641l1.543-4.35h4.371l1.521 4.35h3.45l-5.314-14.294h-3.749L90.46 28.997c-.3-.622-.642-1.371-1.04-2.291a3.042 3.042 0 0 0-1.907-2.014 3.416 3.416 0 0 0 2.614-3.429c0-2.571-1.693-3.857-5.1-3.857H79.97V31.7Zm0-8.572h1.414c1.371 0 2.057-.493 2.057-1.521s-.622-1.478-2.014-1.478h-1.457Zm11.156-8.492V8.764h.407c2.057 0 2.271.214 3.642 3.75a6.982 6.982 0 0 0 .3.729l.278.665a6.37 6.37 0 0 0 .342.729h6.432l.018-9.169 5.745 9.169h3.021V.344h-3.256l.014 8.769-5.542-8.769h-3.257v13.3a29.76 29.76 0 0 1-1.975-4 3.043 3.043 0 0 0-1.907-2.014 3.415 3.415 0 0 0 2.614-3.428c0-2.572-1.693-3.857-5.1-3.857h-5.054v14.293Zm0-8.572h1.412c1.371 0 2.056-.493 2.056-1.521s-.621-1.478-2.013-1.478h-1.457Zm-59.44 11.342V31.7h4.778c4.842 0 7.692-2.657 7.692-7.158 0-4.479-2.914-7.136-7.863-7.136Z" fill="#161615" fill-rule="evenodd"/></g></svg>
@@ -51,6 +51,15 @@
51
51
  {% endif %}
52
52
  {% endcall %}
53
53
  {% endif %}
54
+ {% if params.mobileTitle %}
55
+ <div class="{{ params.mobileTitle.classes if params.mobileTitle.classes else 'inline-block lg:hidden max-w-full' }}" {%- for attribute, value in params.mobileTitle.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
56
+ {% if params.mobileTitle.html %}
57
+ {{ params.mobileTitle.html | safe }}
58
+ {% else %}
59
+ <p class="align-middle py-4 text-sm text-black overflow-hidden">{{ params.mobileTitle.text }}</p>
60
+ {% endif %}
61
+ </div>
62
+ {% endif %}
54
63
  </div>
55
64
  {% if params.navigation.items %}
56
65
  {% from "./_macro.header.header__navigation.njk" import componentHeaderNavigation %}
@@ -19,6 +19,26 @@ params:
19
19
  type: string
20
20
  required: false
21
21
  description: HTML for the custom logo. If provided there will appear a custom logo after the Gobierno de Aragón logo
22
+ - name: mobileTitle
23
+ type: object
24
+ required: false
25
+ description: The title of the app that appears after the logo only in mobile.
26
+ - name: text
27
+ type: string
28
+ required: true
29
+ description: If `html` is set, this is not required. Text for the mobileTitle. If `html` is provided, the `text` argument will be ignored.
30
+ - name: html
31
+ type: string
32
+ required: true
33
+ description: If `text` is set, this is not required. HTML for the mobileTitle. If `html` is provided, the `text` argument will be ignored.
34
+ - name: classes
35
+ type: string
36
+ required: false
37
+ description: Classes to add to the mobileTitle.
38
+ - name: attributes
39
+ type: object
40
+ required: false
41
+ description: HTML attributes (for example data attributes) to add to the mobileTitle.
22
42
  - name: subnav
23
43
  type: object
24
44
  required: false
@@ -144,8 +144,11 @@
144
144
  "text": "Datos del solicitante"
145
145
  }
146
146
  },
147
+ "hint": {
148
+ "text": "Necesitamos tus datos para identificarte posteriormente."
149
+ },
147
150
  "errorMessage": {
148
- "text": "Error: Aqui va un mensaje de error"
151
+ "text": "Error: Estos campos no pueden estar vacíos"
149
152
  },
150
153
  "items": [
151
154
  {
@@ -179,14 +182,24 @@
179
182
  "formGroup": {
180
183
  "classes": "mr-base"
181
184
  },
182
- "classes": "w-full lg:w-40 border-alert-base ring-2 ring-alert-base"
185
+ "classes": "w-full lg:w-40 border-alert-base ring-2 ring-alert-base",
186
+ "attributes": {
187
+ "aria-describedby": "datos-errors-hint datos-errors-error",
188
+ "aria-errormessage": "datos-errors-error",
189
+ "aria-invalid": "true"
190
+ }
183
191
  },
184
192
  {
185
193
  "name": "apellidos",
186
194
  "label": {
187
195
  "text": "Apellidos"
188
196
  },
189
- "classes": "w-full lg:w-40 border-alert-base ring-2 ring-alert-base"
197
+ "classes": "w-full lg:w-40 border-alert-base ring-2 ring-alert-base",
198
+ "attributes": {
199
+ "aria-describedby": "datos-errors-hint datos-errors-error",
200
+ "aria-errormessage": "datos-errors-error",
201
+ "aria-invalid": "true"
202
+ }
190
203
  }
191
204
  ]
192
205
  }
@@ -200,8 +213,11 @@
200
213
  "text": "Datos del solicitante"
201
214
  }
202
215
  },
216
+ "hint": {
217
+ "text": "Necesitamos tus datos para identificarte posteriormente."
218
+ },
203
219
  "errorMessage": {
204
- "text": "Error: Aqui va un mensaje de error"
220
+ "text": "Error: Estos campos no pueden estar vacíos"
205
221
  },
206
222
  "items": [
207
223
  {
@@ -235,7 +251,12 @@
235
251
  "formGroup": {
236
252
  "classes": "mr-base"
237
253
  },
238
- "classes": "w-full lg:w-40 border-alert-base ring-2 ring-alert-base"
254
+ "classes": "w-full lg:w-40 border-alert-base ring-2 ring-alert-base",
255
+ "attributes": {
256
+ "aria-describedby": "datos-error-nombre-a-hint datos-error-nombre-a-error",
257
+ "aria-errormessage": "datos-error-nombre-a-error",
258
+ "aria-invalid": "true"
259
+ }
239
260
  },
240
261
  {
241
262
  "name": "apellidos",
@@ -256,8 +277,11 @@
256
277
  "text": "Datos del solicitante"
257
278
  }
258
279
  },
280
+ "hint": {
281
+ "text": "Necesitamos tus datos para identificarte posteriormente."
282
+ },
259
283
  "errorMessage": {
260
- "text": "Error: Aqui va un mensaje de error"
284
+ "text": "Error: Estos campos no pueden estar vacíos"
261
285
  },
262
286
  "items": [
263
287
  {
@@ -298,7 +322,12 @@
298
322
  "label": {
299
323
  "text": "Apellidos"
300
324
  },
301
- "classes": "w-full lg:w-40 border-alert-base ring-2 ring-alert-base"
325
+ "classes": "w-full lg:w-40 border-alert-base ring-2 ring-alert-base",
326
+ "attributes": {
327
+ "aria-describedby": "datos-error-nombre-b-hint datos-error-nombre-b-error",
328
+ "aria-errormessage": "datos-error-nombre-b-error",
329
+ "aria-invalid": "true"
330
+ }
302
331
  }
303
332
  ]
304
333
  }
@@ -726,7 +726,7 @@
726
726
  {
727
727
  "text": "Item 1",
728
728
  "id": "header-custom-nav-item-1",
729
- "classes": "c-menu-navigation__button--header -mr-base uppercase",
729
+ "classes": "c-menu-navigation__button--header -mr-base",
730
730
  "sub": {
731
731
  "items": [
732
732
  {
@@ -750,7 +750,7 @@
750
750
  {
751
751
  "text": "Active Item 2",
752
752
  "id": "header-custom-nav-item-2",
753
- "classes": "c-menu-navigation__button--header -mr-base uppercase",
753
+ "classes": "c-menu-navigation__button--header -mr-base",
754
754
  "active": true,
755
755
  "sub": {
756
756
  "items": [
@@ -776,7 +776,7 @@
776
776
  {
777
777
  "text": "Disabled Item 3",
778
778
  "id": "header-custom-nav-item-3",
779
- "classes": "c-menu-navigation__button--header -mr-base uppercase",
779
+ "classes": "c-menu-navigation__button--header -mr-base",
780
780
  "disabled": true,
781
781
  "sub": {
782
782
  "items": [
@@ -801,7 +801,7 @@
801
801
  {
802
802
  "text": "Item 4 right",
803
803
  "id": "header-custom-nav-item-4",
804
- "classes": "c-menu-navigation__button--header uppercase",
804
+ "classes": "c-menu-navigation__button--header",
805
805
  "sub": {
806
806
  "items": [
807
807
  {
@@ -4,7 +4,7 @@
4
4
  {% set labelledId = 'label-' + params.id %}
5
5
 
6
6
  <!-- modal -->
7
- <div id="{{ params.id }}" class="relative max-w-lg mx-auto p-base lg:p-lg border border-neutral-base rounded bg-white {%- if params.classes %} {{ params.classes }}{% endif %}"
7
+ <div id="{{ params.id }}" class="mt-16 sm:mt-0 relative max-w-lg mx-auto p-base lg:p-lg border border-neutral-base rounded bg-white {%- if params.classes %} {{ params.classes }}{% endif %}"
8
8
  {%- for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}>
9
9
  {% if params.icon %}
10
10
  <div class="flex justify-center p-base">
@@ -116,4 +116,4 @@
116
116
  </div>
117
117
  {% endif %}
118
118
  </div>
119
- <!-- /modal -->
119
+ <!-- /modal -->
@@ -1,5 +1,5 @@
1
1
  <!-- notification -->
2
- <div id="{{ params.id }}" class="c-notification {%- if params.classes %} {{ params.classes }}{% elseif params.type=="success" %} c-notification--success{% elseif params.type=="alert" %} c-notification--alert{% elseif params.type=="info" %} c-notification--primary{% else %} c-notification--primary{% endif %}"
2
+ <div id="{{ params.id }}" data-module="c-notification" class="c-notification {%- if params.classes %} {{ params.classes }}{% elseif params.type=="success" %} c-notification--success{% elseif params.type=="alert" %} c-notification--alert{% elseif params.type=="info" %} c-notification--primary{% else %} c-notification--primary{% endif %}"
3
3
  {%- for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}>
4
4
  {% if params.icon or params.type %}
5
5
  <div class="h-full mr-base">
@@ -58,8 +58,8 @@
58
58
  </div>
59
59
  {% if params.isDismissible %}
60
60
  <div class="absolute top-0 right-0 p-sm">
61
- <button 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 notificación">
62
- <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>
61
+ <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">
62
+ <svg class="pointer-events-none " 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>
63
63
  </button>
64
64
  </div>
65
65
  {% endif %}
@@ -149,7 +149,6 @@
149
149
  },
150
150
  {
151
151
  "text": "Tab 2",
152
- "active": true,
153
152
  "panel": {
154
153
  "html": "<p><strong>Panel 2</strong>. Est quis exercitationem, nesciunt nulla quisquam temporibus. Provident animi dolor veniam, et quas consequuntur. Reiciendis eius in, nostrum porro? Quaerat, temporibus, optio? Lorem ipsum dolor sit, amet, consectetur adipisicing elit. Est quis exercitationem, nesciunt nulla quisquam temporibus. Provident animi dolor veniam, et quas consequuntur.</p>"
155
154
  }
@@ -162,6 +161,7 @@
162
161
  },
163
162
  {
164
163
  "text": "Tab 4",
164
+ "active": true,
165
165
  "panel": {
166
166
  "html": "<p><strong>Panel 4</strong>. Reiciendis eius in, nostrum porro? Quaerat, temporibus, optio? Lorem ipsum dolor sit, amet, consectetur adipisicing elit. Est quis exercitationem, nesciunt nulla quisquam temporibus. Provident animi dolor veniam, et quas consequuntur.</p>"
167
167
  }
@@ -70,5 +70,24 @@
70
70
  "aria-labelledby": "id-text"
71
71
  }
72
72
  }
73
+ },
74
+ {
75
+ "name": "isSwitch small",
76
+ "description": "Switch appearance, no change of button text, only changes in visual state. It needs an outer element with an id to use it with its aria-labelledby.",
77
+ "data": {
78
+ "classes": "",
79
+ "isSwitch": true,
80
+ "offState": {
81
+ "classes": "",
82
+ "html": '<span class="flex align-center justify-between gap-xs"><span class="text-xs" aria-hidden="true">Off</span><span class="bg-neutral-base relative inline-flex flex-shrink-0 h-4 w-8 border-2 border-neutral-base rounded-full cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75"><span class="sr-only">Off</span><span aria-hidden="true" class="translate-x-0 pointer-events-none inline-block h-3 w-3 rounded-full bg-white shadow-lg transform ring-0 transition ease-in-out duration-200" /></span></span><span class="text-xs" aria-hidden="true">On</span></span>'
83
+ },
84
+ "onState": {
85
+ "classes": "",
86
+ "html": '<span class="flex align-center justify-between gap-xs"><span class="text-xs" aria-hidden="true">Off</span><span class="bg-primary-base relative inline-flex flex-shrink-0 h-4 w-8 border-2 border-primary-base rounded-full cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75"><span class="sr-only">On</span><span aria-hidden="true" class="translate-x-4 pointer-events-none inline-block h-3 w-3 rounded-full bg-white shadow-lg transform ring-0 transition ease-in-out duration-200" /></span></span><span class="text-xs" aria-hidden="true">On</span></span>'
87
+ },
88
+ "attributes": {
89
+ "aria-labelledby": "id-text"
90
+ }
91
+ }
73
92
  }
74
93
  ] %}
@@ -1,20 +1,22 @@
1
1
  <!-- toggle -->
2
- <div class="relative c-toggle"
2
+ <div data-module="c-toggle" class="relative c-toggle"
3
3
  >
4
4
  <!-- Button -->
5
5
  <button
6
- aria-checked="false"
7
- aria-pressed="false"
8
- aria-expanded="false"
9
6
  {% if params.isSwitch %}
10
7
  role = "switch"
8
+ aria-checked="false"
9
+ {% elseif params.isExpandible == false %}
10
+ aria-pressed="false"
11
+ {% else %}
12
+ aria-expanded="false"
11
13
  {% endif %}
12
14
  type="button"
13
- class="{{ params.classes if params.classes else '' }}"
15
+ class="c-toggle__button {{ params.classes if params.classes else '' }}"
14
16
  {%- for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}
15
17
  >
16
- <span class="c-button-is-not_pressed pointer-events-none">{{ params.offState.html | safe if params.offState.html else params.offState.text }}</span>
17
- <span class="c-button-is_pressed hidden pointer-events-none">{{ params.onState.html | safe if params.onState.html else params.onState.text }}</span>
18
+ <span class="c-button--is-not-pressed pointer-events-none">{{ params.offState.html | safe if params.offState.html else params.offState.text }}</span>
19
+ <span class="c-button--is-pressed hidden pointer-events-none">{{ params.onState.html | safe if params.onState.html else params.onState.text }}</span>
18
20
  </button>
19
21
  </div>
20
22
  <!-- /toggle -->