desy-html 11.1.2 → 12.0.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 (134) hide show
  1. package/docs/_global.foot.njk +1 -1
  2. package/docs/_macro.example-render.njk +62 -18
  3. package/docs/ds/_ds.example.botones-primary-lg.njk +265 -0
  4. package/docs/ds/_ds.example.dropdowns-variaciones.njk +37 -0
  5. package/docs/ds/_ds.example.listbox-variaciones.njk +137 -0
  6. package/docs/ds/_ds.example.tabs.njk +44 -0
  7. package/docs/ds/_ds.example.textos.njk +5 -0
  8. package/docs/ds/_ds.section.botones.njk +5 -0
  9. package/docs/ds/_ds.section.textos.njk +11 -1
  10. package/docs/index.html +19 -0
  11. package/docs/pagina-prueba.html +2 -2
  12. package/package.json +3 -3
  13. package/src/css/component.text.css +33 -26
  14. package/src/js/aria/linksList.js +42 -0
  15. package/src/js/aria/treeitem.js +9 -2
  16. package/src/js/aria/utils.js +80 -15
  17. package/src/js/desy-html.js +249 -196
  18. package/src/js/filters/filter-caller.js +4 -2
  19. package/src/js/filters/filter-escape-ltgt.js +7 -0
  20. package/src/js/filters/filter-quotes.js +50 -0
  21. package/src/js/filters/filter-version.js +8 -0
  22. package/src/js/filters/index.js +7 -1
  23. package/src/js/index.js +2 -0
  24. package/src/templates/components/accordion/_examples.accordion.njk +107 -107
  25. package/src/templates/components/accordion/_template.accordion.njk +5 -5
  26. package/src/templates/components/accordion-history/_examples.accordion-history.njk +119 -119
  27. package/src/templates/components/accordion-history/_template.accordion-history.njk +11 -11
  28. package/src/templates/components/alert/_examples.alert.njk +2 -2
  29. package/src/templates/components/breadcrumbs/_examples.breadcrumbs.njk +4 -4
  30. package/src/templates/components/breadcrumbs/_template.breadcrumbs.njk +4 -4
  31. package/src/templates/components/button/_examples.button.njk +28 -21
  32. package/src/templates/components/button/_styles.button.css +7 -0
  33. package/src/templates/components/button/_template.button.njk +2 -2
  34. package/src/templates/components/button-loader/_examples.button-loader.njk +25 -18
  35. package/src/templates/components/button-loader/_styles.button-loader.css +6 -0
  36. package/src/templates/components/button-loader/_template.button-loader.njk +2 -2
  37. package/src/templates/components/card/_examples.card.njk +3 -3
  38. package/src/templates/components/card/_template.card.njk +4 -4
  39. package/src/templates/components/character-count/_examples.character-count.njk +2 -2
  40. package/src/templates/components/checkboxes/_examples.checkboxes.njk +6 -6
  41. package/src/templates/components/checkboxes/_template.checkboxes.njk +2 -2
  42. package/src/templates/components/collapsible/_examples.collapsible.njk +4 -4
  43. package/src/templates/components/collapsible/_template.collapsible.njk +1 -1
  44. package/src/templates/components/date-input/_template.date-input.njk +1 -1
  45. package/src/templates/components/datepicker/_examples.datepicker.njk +45 -62
  46. package/src/templates/components/datepicker/_styles.datepicker.css +4 -0
  47. package/src/templates/components/datepicker/_template.datepicker.njk +10 -2
  48. package/src/templates/components/description-list/_examples.description-list.njk +3 -3
  49. package/src/templates/components/description-list/_template.description-list.njk +2 -2
  50. package/src/templates/components/details/_examples.details.njk +3 -3
  51. package/src/templates/components/details/_template.details.njk +1 -1
  52. package/src/templates/components/dialog/_examples.dialog.njk +4 -4
  53. package/src/templates/components/dropdown/_examples.dropdown.njk +38 -16
  54. package/src/templates/components/dropdown/_styles.dropdown.css +7 -0
  55. package/src/templates/components/dropdown/_template.dropdown.njk +1 -1
  56. package/src/templates/components/error-message/_examples.error-message.njk +1 -1
  57. package/src/templates/components/error-message/_template.error-message.njk +1 -1
  58. package/src/templates/components/error-summary/_template.error-summary.njk +2 -2
  59. package/src/templates/components/fieldset/_examples.fieldset.njk +3 -3
  60. package/src/templates/components/fieldset/_template.fieldset.njk +7 -7
  61. package/src/templates/components/footer/_examples.footer.njk +32 -32
  62. package/src/templates/components/footer/_template.footer.njk +6 -6
  63. package/src/templates/components/header/_examples.header.njk +14 -8
  64. package/src/templates/components/header/_template.header.header__navigation.njk +2 -2
  65. package/src/templates/components/header/_template.header.header__offcanvasButton.njk +1 -1
  66. package/src/templates/components/header/_template.header.header__subnav.njk +1 -1
  67. package/src/templates/components/header/_template.header.njk +2 -2
  68. package/src/templates/components/header-advanced/_examples.header-advanced.njk +14 -8
  69. package/src/templates/components/header-advanced/_template.header-advanced.njk +3 -3
  70. package/src/templates/components/header-mini/_examples.header-mini.njk +3 -3
  71. package/src/templates/components/header-mini/_template.header-mini.njk +2 -2
  72. package/src/templates/components/hint/_examples.hint.njk +1 -1
  73. package/src/templates/components/hint/_template.hint.njk +1 -1
  74. package/src/templates/components/input/_examples.input.njk +7 -7
  75. package/src/templates/components/input-group/_examples.input-group.njk +1 -1
  76. package/src/templates/components/input-group/_template.input-group.njk +1 -1
  77. package/src/templates/components/item/_examples.item.njk +23 -23
  78. package/src/templates/components/item/_template.item.njk +9 -9
  79. package/src/templates/components/label/_examples.label.njk +2 -2
  80. package/src/templates/components/label/_template.label.njk +1 -1
  81. package/src/templates/components/links-list/_examples.links-list.njk +54 -34
  82. package/src/templates/components/links-list/_template.links-list.njk +15 -15
  83. package/src/templates/components/listbox/_examples.listbox.njk +52 -17
  84. package/src/templates/components/listbox/_styles.listbox.css +7 -0
  85. package/src/templates/components/listbox/_template.listbox.njk +5 -5
  86. package/src/templates/components/media-object/_examples.media-object.njk +5 -5
  87. package/src/templates/components/menu-horizontal/_examples.menu-horizontal.njk +16 -16
  88. package/src/templates/components/menu-horizontal/_template.menu-horizontal.njk +2 -2
  89. package/src/templates/components/menu-navigation/_examples.menu-navigation.njk +93 -9
  90. package/src/templates/components/menu-navigation/_styles.menu-navigation.css +7 -0
  91. package/src/templates/components/menu-navigation/_template.menu-navigation.njk +4 -4
  92. package/src/templates/components/menu-vertical/_examples.menu-vertical.njk +8 -8
  93. package/src/templates/components/menu-vertical/_template.menu-vertical.njk +9 -9
  94. package/src/templates/components/menubar/_examples.menubar.njk +169 -15
  95. package/src/templates/components/menubar/_styles.menubar.css +8 -1
  96. package/src/templates/components/menubar/_template.menubar.njk +7 -7
  97. package/src/templates/components/modal/_examples.modal.njk +18 -18
  98. package/src/templates/components/modal/_template.modal.njk +8 -8
  99. package/src/templates/components/nav/_examples.nav.njk +7 -7
  100. package/src/templates/components/nav/_template.nav.njk +2 -2
  101. package/src/templates/components/notification/_examples.notification.njk +9 -9
  102. package/src/templates/components/notification/_template.notification.njk +11 -11
  103. package/src/templates/components/pagination/_examples.pagination.njk +6 -6
  104. package/src/templates/components/pagination/_template.pagination.njk +3 -3
  105. package/src/templates/components/pill/_examples.pill.njk +8 -8
  106. package/src/templates/components/pill/_template.pill.njk +3 -3
  107. package/src/templates/components/radios/_examples.radios.njk +2 -2
  108. package/src/templates/components/radios/_template.radios.njk +1 -1
  109. package/src/templates/components/select/_examples.select.njk +1 -1
  110. package/src/templates/components/skip-link/_examples.skip-link.njk +1 -1
  111. package/src/templates/components/skip-link/_template.skip-link.njk +1 -1
  112. package/src/templates/components/status/_examples.status.njk +1 -1
  113. package/src/templates/components/status/_template.status.njk +1 -1
  114. package/src/templates/components/status-item/_examples.status-item.njk +15 -15
  115. package/src/templates/components/status-item/_template.status-item.njk +3 -3
  116. package/src/templates/components/table/_examples.table.njk +3 -3
  117. package/src/templates/components/table/_template.table.njk +2 -2
  118. package/src/templates/components/table-advanced/_examples.table-advanced.njk +96 -6
  119. package/src/templates/components/table-advanced/_template.table-advanced.njk +8 -8
  120. package/src/templates/components/table-advanced/params.table-advanced.yaml +4 -0
  121. package/src/templates/components/tabs/_examples.tabs.njk +57 -14
  122. package/src/templates/components/tabs/_styles.tabs.css +31 -8
  123. package/src/templates/components/tabs/_template.tabs.njk +8 -8
  124. package/src/templates/components/tabs/params.tabs.yaml +4 -0
  125. package/src/templates/components/textarea/_examples.textarea.njk +2 -2
  126. package/src/templates/components/toggle/_examples.toggle.njk +29 -29
  127. package/src/templates/components/toggle/_template.toggle.njk +2 -2
  128. package/src/templates/components/tooltip/_examples.tooltip.njk +11 -11
  129. package/src/templates/components/tooltip/_template.tooltip.njk +3 -3
  130. package/src/templates/components/tree/_examples.tree.njk +112 -47
  131. package/src/templates/components/tree/_template.tree.njk +6 -6
  132. package/src/templates/includes/_test-include.njk +2 -2
  133. package/src/templates/pages/_page.footer.njk +1 -1
  134. package/src/templates/pages/_template.logged-selector-subheader.njk +1 -1
@@ -90,4 +90,48 @@
90
90
  ]
91
91
  }) }}
92
92
  </div>
93
+ </div>
94
+ <div class="grid lg:grid-cols-1 gap-xl mb-lg">
95
+ <div>
96
+ <p class="c-paragraph-base">Ejemplo con aspecto de lista de enlaces:</p>
97
+ {{ componentTabs({
98
+ "tablistClasses": "flex flex-col col-span-2 lg:col-span-1 lg:divide-y lg:divide-neutral-base mb-base lg:mb-0",
99
+ "tablistAriaLabel": "Ejemplo de tab con aspecto de links list dispuesto en horizontal",
100
+ "idPrefix": "tab-links-list",
101
+ "items": [
102
+ {
103
+ "html": "<div class=\"flex gap-base justify-between items-center flex-1 c-link\">Tab 1</div><div class=\"self-center h-full text-primary-base\"><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 140 140\" class=\"hidden lg:block self-center\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\"><path d=\"M102.07 27.93l35 35a10 10 0 010 14.14l-35 35a10 10 0 01-14.14-14.14l13.66-13.66A2.5 2.5 0 0099.82 80H10a10 10 0 010-20h89.82a2.5 2.5 0 001.77-4.27L87.93 42.07a10 10 0 0114.14-14.14z\" fill=\"currentColor\"></path></svg></div>",
104
+ "panel": {
105
+ "html": "<p><strong>Panel 1</strong>. Lorem ipsum dolor sit, amet, consectetur adipisicing elit. Est quis exercitationem, nesciunt nulla quisquam temporibus. Provident animi dolor veniam, et quas consequuntur. Reiciendis eius in, nostrum porro? Quaerat, temporibus, optio?</p>",
106
+ "classes": "col-span-2 lg:col-span-2 lg:p-base focus:outline-none focus:border-black focus:shadow-outline-focus-input focus:ring-4 focus:ring-warning-base"
107
+ }
108
+ },
109
+ {
110
+ "html": "<div class=\"flex gap-base justify-between items-center flex-1 c-link\">Tab 2</div><div class=\"self-center h-full text-primary-base\"><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 140 140\" class=\"hidden lg:block self-center\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\"><path d=\"M102.07 27.93l35 35a10 10 0 010 14.14l-35 35a10 10 0 01-14.14-14.14l13.66-13.66A2.5 2.5 0 0099.82 80H10a10 10 0 010-20h89.82a2.5 2.5 0 001.77-4.27L87.93 42.07a10 10 0 0114.14-14.14z\" fill=\"currentColor\"></path></svg></div>",
111
+ "panel": {
112
+ "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>",
113
+ "classes": "col-span-2 lg:col-span-2 lg:p-base focus:outline-none focus:border-black focus:shadow-outline-focus-input focus:ring-4 focus:ring-warning-base"
114
+ }
115
+ },
116
+ {
117
+ "html": "<div class=\"flex gap-base justify-between items-center flex-1 c-link\">Tab 3</div><div class=\"self-center h-full text-primary-base\"><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 140 140\" class=\"hidden lg:block self-center\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\"><path d=\"M102.07 27.93l35 35a10 10 0 010 14.14l-35 35a10 10 0 01-14.14-14.14l13.66-13.66A2.5 2.5 0 0099.82 80H10a10 10 0 010-20h89.82a2.5 2.5 0 001.77-4.27L87.93 42.07a10 10 0 0114.14-14.14z\" fill=\"currentColor\"></path></svg></div>",
118
+ "panel": {
119
+ "html": "<p><strong>Panel 3</strong>. 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>",
120
+ "classes": "col-span-2 lg:col-span-2 lg:p-base focus:outline-none focus:border-black focus:shadow-outline-focus-input focus:ring-4 focus:ring-warning-base"
121
+ }
122
+ },
123
+ {
124
+ "html": "<div class=\"flex gap-base justify-between items-center flex-1 c-link\">Tab 4</div><div class=\"self-center h-full text-primary-base\"><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 140 140\" class=\"hidden lg:block self-center\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\"><path d=\"M102.07 27.93l35 35a10 10 0 010 14.14l-35 35a10 10 0 01-14.14-14.14l13.66-13.66A2.5 2.5 0 0099.82 80H10a10 10 0 010-20h89.82a2.5 2.5 0 001.77-4.27L87.93 42.07a10 10 0 0114.14-14.14z\" fill=\"currentColor\"></path></svg></div>",
125
+ "panel": {
126
+ "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>",
127
+ "classes": "col-span-2 lg:col-span-2 lg:p-base focus:outline-none focus:border-black focus:shadow-outline-focus-input focus:ring-4 focus:ring-warning-base"
128
+ }
129
+ }
130
+ ],
131
+ "classes": "c-tabs--reset c-tabs--list grid grid-cols-2 lg:grid-cols-4 lg:gap-lg",
132
+ "attributes": {
133
+ "id": "tabs-list"
134
+ }
135
+ }) }}
136
+ </div>
93
137
  </div>
@@ -6,6 +6,11 @@
6
6
  <p>Esto es un <a href="#" class="c-link">link</a> en un texto</p>
7
7
  <p>Esto es un <a href="#" class="c-link" title="Se abre en ventana nueva" target="_blank">enlace en ventana nueva<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" height="0.8em" width="0.8em" class="inline-block mx-xs no-underline align-baseline" aria-hidden="true" focusable="false" role="img"><g><path fill="currentcolor" fill-rule="evenodd" d="M7.428571428571428 0.5714285714285714c-0.6311885714285713 0 -1.1428571428571428 0.5116742857142856 -1.1428571428571428 1.1428571428571428 0 0.6311771428571428 0.5116685714285714 1.1428571428571428 1.1428571428571428 1.1428571428571428h4.098057142857143L0.9061634285714285 13.477599999999999c-0.4463131428571428 0.4462857142857143 -0.4463131428571428 1.1699428571428572 0 1.6162285714285711 0.4463165714285714 0.4462857142857143 1.1699279999999999 0.4462857142857143 1.616248 0L13.142857142857142 4.473382857142857V8.571428571428571c0 0.6311771428571428 0.5116571428571428 1.1428571428571428 1.1428571428571428 1.1428571428571428s1.1428571428571428 -0.51168 1.1428571428571428 -1.1428571428571428v-6.857142857142857c0 -0.6311828571428572 -0.5116571428571428 -1.1428571428571428 -1.1428571428571428 -1.1428571428571428h-6.857142857142857Z" clip-rule="evenodd" stroke-width="1"></path></g></svg></a> en un texto.</p>
8
8
  <p>Esto es un <a href="#" class="c-link c-link--alert">link</a> en una notificación de error</p>
9
+ <p class="text-neutral-dark">Esto es un <a href="#" class="c-link c-link--neutral">enlace</a> en un texto secundario.</p>
10
+ <p>Esto es un <a href="#" class="c-link c-link--no-underline">enlace</a> sin subrayado (sólo en hover).</p>
11
+ <div class="col-span-2 lg:col-span-2 p-base border border-neutral-base rounded relative hover:bg-neutral-light">
12
+ <p><a href="#" class="c-link c-link--full">Esto es un contenedor con enlace</a></p>
13
+ </div>
9
14
  <p class="c-paragraph-lg">Párrafo destacados</p>
10
15
  <p class="c-paragraph-base">Párrafo por defecto</p>
11
16
  <p class="c-paragraph-base text-neutral-dark">Párrafo secundario</p>
@@ -45,4 +45,9 @@
45
45
  title: "Botones pequeños alerta"
46
46
  }) }}
47
47
  {% include "ds/_ds.example.botones-alert-sm.njk" %}
48
+ <div class="pb-lg"></div>
49
+ {{ DSSubsectionTitle({
50
+ title: "Botones grandes primarios"
51
+ }) }}
52
+ {% include "ds/_ds.example.botones-primary-lg.njk" %}
48
53
  </div>
@@ -4,7 +4,7 @@
4
4
  <!-- _ds.section.textos.njk -->
5
5
 
6
6
  <div class="container mx-auto">
7
-
7
+
8
8
  <div class="pb-lg"></div>
9
9
  {% from "ds/_ds.macro.subsection-title.njk" import DSSubsectionTitle %}
10
10
  {{ DSSubsectionTitle({
@@ -209,6 +209,16 @@
209
209
  </dd>
210
210
  </dl>
211
211
  </li>
212
+ <li>
213
+ <dl class="grid grid-cols-2 lg:grid-cols-4 gap-x-lg gap-y-base my-base">
214
+ <dt class="col-span-2 lg:col-span-2">
215
+ <p>Esto es un <a href="#" class="c-link c-link--no-underline">enlace</a> sin subrayado (sólo en hover).</p>
216
+ </dt>
217
+ <dd class="col-span-2 lg:col-span-2">
218
+ <p class="text-neutral-dark text-sm"><code>.c-link.c-link--no-underline</code> - <code>normal</code> - <code>no-underline</code> - <code>text-primary-base</code> - hover: <code>primary-dark.underline</code></p>
219
+ </dd>
220
+ </dl>
221
+ </li>
212
222
  <li>
213
223
  <dl class="grid grid-cols-2 lg:grid-cols-4 gap-x-lg gap-y-base my-base">
214
224
  <dt class="col-span-2 lg:col-span-2 p-base border border-neutral-base rounded relative hover:bg-neutral-light">
package/docs/index.html CHANGED
@@ -7,6 +7,7 @@
7
7
  <div class="prose pb-xl">
8
8
  <div class="pb-lg"></div>
9
9
  <h1>desy-html</h1>
10
+ <p>Versión: {{ '' | filterversion }}</p>
10
11
  <p>desy-html es una librería NPM que sirve para construir la interfaz de usuario de las aplicaciones web del Gobierno de Aragón. Utiliza <a href="https://gulpjs.com/">Gulp</a>, <a href="https://postcss.org/">PostCSS</a>, <a href="https://tailwindcss.com/">Tailwind CSS</a> y <a href="https://mozilla.github.io/nunjucks/">Nunjucks</a> para renderizar componentes HTML+CSS+JS. Es útil para crear aplicaciones web ligeras o maquetas html.</p>
11
12
  <p>Si necesitas una librería con más potencia para construir tu aplicación web, te recomendamos mejor, que uses su versión traducida a Angular: <a href="https://bitbucket.org/sdaragon/desy-angular">desy-angular librería NPM</a>, <a href="https://desy.aragon.es/desy-angular">Ejemplos de desy-angular</a></p>
12
13
  <p>Mira ejemplos de componentes y plantillas de página en la documentación: <a href="https://desy.aragon.es/">https://desy.aragon.es/</a></p>
@@ -38,6 +39,24 @@
38
39
 
39
40
  <h2>Changelog (English)</h2>
40
41
  <p>What's new in the latest version of desy-html</p>
42
+ <h3>v.12.0.0</h3>
43
+ <ul class="text-sm">
44
+ <li>Datepicker now uses Spanish date format: DD-MM-AAAA.</li>
45
+ <li>Dropdowns that has no menu, now has the correct arias using data attributes.</li>
46
+ <li>Accesibility fixes in Header mini, Datepicker, Dropdown, Tooltip and Links list.</li>
47
+ <li>Docs examples in Nunjucks have single quotes in attributes instead of escaped double quotes.</li>
48
+ <li>Docs improvements for AI and robots.</li>
49
+ <li>Validation fixes.</li>
50
+ </ul>
51
+ <h3>v.11.2.0</h3>
52
+ <ul class="text-sm">
53
+ <li>Added global function to Links list and Tree navigation to activate items.</li>
54
+ <li>Added parameter in Table advanced to customize filter texts in table head.</li>
55
+ <li>Added parameter in Tabs to improve customization.</li>
56
+ <li>Added large modifier in Button, Button loader, Dropdown, Listbox, Menu navigation and Menebar.</li>
57
+ <li>Added style for links.</li>
58
+ <li>Validation fixes.</li>
59
+ </ul>
41
60
  <h3>v.11.1.2</h3>
42
61
  <ul class="text-sm">
43
62
  <li>Improved initial tooltip visualization in Dropdown, Listbox, Menu navigation, Menubar and Tooltip.</li>
@@ -47,7 +47,7 @@
47
47
  "text": "Ejemplo de modal"
48
48
  },
49
49
  "description": {
50
- "html": ''
50
+ "html": ""
51
51
  },
52
52
  "itemsPrimary": [
53
53
  {
@@ -57,7 +57,7 @@
57
57
  ],
58
58
  "itemsSecondary": [
59
59
  {
60
- "html": 'Cancelar <span class="sr-only">y cerrar la ventana modal</span>',
60
+ "html": "Cancelar <span class='sr-only'>y cerrar la ventana modal</span>",
61
61
  "attributes": {
62
62
  "onclick": "closeDialog(this)"
63
63
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "desy-html",
3
- "version": "11.1.2",
3
+ "version": "12.0.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
  "type": "module",
6
6
  "author": {
@@ -38,10 +38,10 @@
38
38
  "autoprefixer": "^10.4.19",
39
39
  "hex-rgb": "^5.0.0",
40
40
  "highlight.js": "^11.9.0",
41
- "postcss": "^8.4.38",
41
+ "postcss": "^8.5.0",
42
42
  "postcss-cli": "^10.1.0",
43
43
  "postcss-import": "^15.1.0",
44
- "tailwindcss": "^3.4.4"
44
+ "tailwindcss": "^3.4.15"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@babel/core": "^7.24.7",
@@ -9,43 +9,43 @@
9
9
  @apply font-bold;
10
10
  @apply leading-tight;
11
11
  }
12
-
12
+
13
13
  .c-h1 {
14
14
  @apply mb-lg;
15
15
  @apply text-3xl;
16
16
  @apply font-bold;
17
17
  @apply leading-tight;
18
18
  }
19
-
19
+
20
20
  .c-h2 {
21
21
  @apply mb-base;
22
22
  @apply text-2xl;
23
23
  @apply font-bold;
24
24
  @apply leading-tight;
25
25
  }
26
-
26
+
27
27
  .c-h3 {
28
28
  @apply mb-sm;
29
29
  @apply text-lg;
30
30
  @apply font-bold;
31
31
  @apply leading-tight;
32
32
  }
33
-
33
+
34
34
  .c-h4 {
35
35
  @apply mb-sm;
36
36
  @apply text-base;
37
37
  @apply font-bold;
38
38
  @apply leading-tight;
39
39
  }
40
-
40
+
41
41
  .c-link {
42
42
  @apply text-primary-base;
43
43
  @apply underline;
44
-
44
+
45
45
  &:hover {
46
46
  @apply text-primary-dark;
47
47
  }
48
-
48
+
49
49
  &:focus {
50
50
  @apply bg-warning-base;
51
51
  @apply shadow-outline-focus;
@@ -53,26 +53,26 @@
53
53
  @apply text-black;
54
54
  }
55
55
  }
56
-
56
+
57
57
  .c-link--alert {
58
58
  @apply text-alert-base;
59
59
  @apply underline;
60
60
  @apply font-semibold;
61
-
61
+
62
62
  &:hover {
63
63
  @apply text-alert-dark;
64
64
  }
65
65
  }
66
-
66
+
67
67
  .c-link--neutral {
68
68
  @apply text-neutral-dark;
69
69
  @apply underline;
70
-
70
+
71
71
  &:hover {
72
72
  @apply text-black;
73
73
  }
74
74
  }
75
-
75
+
76
76
  .c-link--full {
77
77
  &::after {
78
78
  content:"";
@@ -80,31 +80,39 @@
80
80
  @apply inset-0;
81
81
  }
82
82
  }
83
-
83
+
84
+ .c-link--no-underline {
85
+ @apply no-underline;
86
+
87
+ &:hover {
88
+ @apply underline;
89
+ }
90
+ }
91
+
84
92
  .c-paragraph-lg {
85
93
  @apply mb-lg;
86
94
  @apply text-lg;
87
95
  }
88
-
96
+
89
97
  .c-paragraph-base {
90
98
  @apply mb-base;
91
99
  @apply text-base;
92
100
  }
93
-
101
+
94
102
  .c-paragraph-sm {
95
103
  @apply mb-sm;
96
104
  @apply text-sm;
97
105
  }
98
-
106
+
99
107
  .c-ul {
100
108
  @apply mb-base;
101
109
  @apply list-none;
102
-
110
+
103
111
  li {
104
112
  @apply relative;
105
113
  @apply mb-base;
106
114
  @apply pl-8;
107
-
115
+
108
116
  &::before {
109
117
  content: "";
110
118
  @apply absolute;
@@ -115,32 +123,32 @@
115
123
  @apply bg-black;
116
124
  @apply rounded-full;
117
125
  }
118
-
126
+
119
127
  &:last-of-type {
120
128
  @apply mb-0;
121
129
  }
122
130
  }
123
131
  }
124
-
132
+
125
133
  .c-ul--no-bullets {
126
134
  li {
127
135
  @apply pl-0;
128
-
136
+
129
137
  &::before {
130
138
  @apply hidden;
131
139
  }
132
140
  }
133
141
  }
134
-
142
+
135
143
  .c-ol {
136
144
  @apply mb-base;
137
145
  counter-reset: list-counter;
138
-
146
+
139
147
  li {
140
148
  @apply relative;
141
149
  @apply mb-base;
142
150
  @apply pl-8;
143
-
151
+
144
152
  &::before {
145
153
  counter-increment: list-counter;
146
154
  content: counter(list-counter) ".";
@@ -148,11 +156,10 @@
148
156
  left: .25rem;
149
157
  @apply text-black;
150
158
  }
151
-
159
+
152
160
  &:last-of-type {
153
161
  @apply mb-0;
154
162
  }
155
163
  }
156
164
  }
157
165
  }
158
-
@@ -0,0 +1,42 @@
1
+ export function LinksList(aria) {
2
+
3
+ aria.linksListInit = function (domNode) {
4
+ this.rootEl = domNode;
5
+ };
6
+
7
+ window.activateItemLinksList = function (wrapperId, activeItemId) {
8
+ const activeItem = document.querySelector(`#${wrapperId} #${activeItemId}`);
9
+ if (activeItem) {
10
+ activateElement(wrapperId, activeItemId);
11
+ return [activeItem];
12
+ } else {
13
+ console.log('There is no element with this id in the menu.');
14
+ return null;
15
+ }
16
+ };
17
+
18
+ function activateElement(wrapperId, elementActive) {
19
+ const getWrapper = document.getElementById(wrapperId);
20
+ getWrapper.querySelectorAll('li').forEach((element) => {
21
+ const getLink = element.querySelector('a');
22
+ if (getLink) {
23
+ if (getLink.id === elementActive) {
24
+ wrapActiveElement(getLink);
25
+ } else {
26
+ deactivateElement(getLink);
27
+ }
28
+ }
29
+ });
30
+ };
31
+
32
+ function wrapActiveElement(elementActive) {
33
+ const getText = elementActive.querySelector('div[data-element="c-links-list__text"]');
34
+ getText.innerHTML = `<strong class="font-bold">${elementActive.textContent}</strong>`;
35
+ };
36
+
37
+ function deactivateElement(elementDeactivated) {
38
+ const getText = elementDeactivated.querySelector('div[data-element="c-links-list__text"]');
39
+ const replaceStrong = getText.textContent.replace('<strong class="font-bold">', '').replace('<strong/>', '');
40
+ getText.textContent = `${replaceStrong}`;
41
+ };
42
+ }
@@ -285,9 +285,11 @@ export function Treeitem(aria) {
285
285
  }
286
286
 
287
287
  if(typeof itemsIds !== 'object' && open !== null) {
288
+ const getElement = document.querySelector(`nav #${elementId}`);
289
+ const isTreeNavigation = getElement.hasAttribute('data-tree-navigation');
288
290
  const selectItem = document.querySelector(`#${elementId} #${itemsIds}`)
289
291
  if(selectItem) {
290
- activateElement(selectItem, open)
292
+ activateElement(selectItem, open, isTreeNavigation)
291
293
  } else {
292
294
  returnMessage()
293
295
  }
@@ -306,9 +308,14 @@ export function Treeitem(aria) {
306
308
  }
307
309
  }
308
310
 
309
- function activateElement(item, open) {
311
+ function activateElement(item, open, treeNav = false) {
310
312
  if(open === true) {
311
313
  item.setAttribute('aria-expanded', 'true');
314
+ if(treeNav) {
315
+ const getLink = item.querySelector('a')
316
+ getLink.setAttribute("aria-current", "page");
317
+ getLink.innerHTML = `<strong class="font-bold">${getLink.textContent}</strong>`;
318
+ }
312
319
  recursiveParent(item)
313
320
  } else {
314
321
  item.setAttribute('aria-expanded', 'false');
@@ -1,4 +1,3 @@
1
-
2
1
  export function utils(aria) {
3
2
  /**
4
3
  * @namespace aria
@@ -29,7 +28,7 @@ export function utils(aria) {
29
28
 
30
29
 
31
30
  // Polyfill src https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
32
- aria.Utils.matches = function (element, selector) {
31
+ aria.Utils.matches = function(element, selector) {
33
32
  if (!Element.prototype.matches) {
34
33
  Element.prototype.matches =
35
34
  Element.prototype.matchesSelector ||
@@ -37,7 +36,7 @@ export function utils(aria) {
37
36
  Element.prototype.msMatchesSelector ||
38
37
  Element.prototype.oMatchesSelector ||
39
38
  Element.prototype.webkitMatchesSelector ||
40
- function (s) {
39
+ function(s) {
41
40
  var matches = element.parentNode.querySelectorAll(s);
42
41
  var i = matches.length;
43
42
  while (--i >= 0 && matches.item(i) !== this) {}
@@ -48,19 +47,19 @@ export function utils(aria) {
48
47
  return element.matches(selector);
49
48
  };
50
49
 
51
- aria.Utils.remove = function (item) {
50
+ aria.Utils.remove = function(item) {
52
51
  if (item.remove && typeof item.remove === 'function') {
53
52
  return item.remove();
54
53
  }
55
54
  if (item.parentNode &&
56
- item.parentNode.removeChild &&
57
- typeof item.parentNode.removeChild === 'function') {
55
+ item.parentNode.removeChild &&
56
+ typeof item.parentNode.removeChild === 'function') {
58
57
  return item.parentNode.removeChild(item);
59
58
  }
60
59
  return false;
61
60
  };
62
61
 
63
- aria.Utils.isFocusable = function (element) {
62
+ aria.Utils.isFocusable = function(element) {
64
63
  if (element.tabIndex > 0 || (element.tabIndex === 0 && element.getAttribute('tabIndex') !== null)) {
65
64
  return true;
66
65
  }
@@ -83,7 +82,7 @@ export function utils(aria) {
83
82
  }
84
83
  };
85
84
 
86
- aria.Utils.getAncestorBySelector = function (element, selector) {
85
+ aria.Utils.getAncestorBySelector = function(element, selector) {
87
86
  if (!aria.Utils.matches(element, selector + ' ' + element.tagName)) {
88
87
  // Element is not inside an element that matches selector
89
88
  return null;
@@ -95,8 +94,7 @@ export function utils(aria) {
95
94
  while (ancestor === null) {
96
95
  if (aria.Utils.matches(currentNode.parentNode, selector)) {
97
96
  ancestor = currentNode.parentNode;
98
- }
99
- else {
97
+ } else {
100
98
  currentNode = currentNode.parentNode;
101
99
  }
102
100
  }
@@ -104,25 +102,92 @@ export function utils(aria) {
104
102
  return ancestor;
105
103
  };
106
104
 
107
- aria.Utils.hasClass = function (element, className) {
105
+ aria.Utils.hasClass = function(element, className) {
108
106
  return (new RegExp('(\\s|^)' + className + '(\\s|$)')).test(element.className);
109
107
  };
110
108
 
111
- aria.Utils.addClass = function (element, className) {
109
+ aria.Utils.addClass = function(element, className) {
112
110
  if (!aria.Utils.hasClass(element, className)) {
113
111
  element.className += ' ' + className;
114
112
  }
115
113
  };
116
114
 
117
- aria.Utils.removeClass = function (element, className) {
115
+ aria.Utils.removeClass = function(element, className) {
118
116
  var classRegex = new RegExp('(\\s|^)' + className + '(\\s|$)');
119
117
  element.className = element.className.replace(classRegex, ' ').trim();
120
118
  };
121
119
 
122
- aria.Utils.bindMethods = function (object /* , ...methodNames */) {
120
+ aria.Utils.bindMethods = function(object /* , ...methodNames */ ) {
123
121
  var methodNames = Array.prototype.slice.call(arguments, 1);
124
- methodNames.forEach(function (method) {
122
+ methodNames.forEach(function(method) {
125
123
  object[method] = object[method].bind(object);
126
124
  });
127
125
  };
128
126
  }
127
+
128
+ // Function to convert ISO date(s) to DD-MM-YYYY format
129
+ export function formatDateToDDMMYYYY(isoDate) {
130
+ if (!isoDate) return '';
131
+ try {
132
+ // Case 1: Multiple dates separated by space
133
+ if (isoDate.includes(' ')) {
134
+ return isoDate
135
+ .split(' ')
136
+ .map(date => formatSingleDate(date))
137
+ .join(' ');
138
+ }
139
+ // Case 2: Date range separated by /
140
+ if (isoDate.includes('/')) {
141
+ const [startDate, endDate] = isoDate.split('/');
142
+ return `${formatSingleDate(startDate)}/${formatSingleDate(endDate)}`;
143
+ }
144
+ // Case 3: Single date
145
+ return formatSingleDate(isoDate);
146
+ } catch (error) {
147
+ console.error('Error formatting date:', error);
148
+ return '';
149
+ }
150
+ }
151
+
152
+ // Helper function to format a single date
153
+ export function formatSingleDate(isoDate) {
154
+ const date = new Date(isoDate);
155
+ if (isNaN(date.getTime())) {
156
+ return '';
157
+ }
158
+ const day = String(date.getDate()).padStart(2, '0');
159
+ const month = String(date.getMonth() + 1).padStart(2, '0');
160
+ const year = date.getFullYear();
161
+ return `${day}-${month}-${year}`;
162
+ }
163
+
164
+ // Function to convert DD-MM-YYYY format to ISO
165
+ export function convertToISOFormat(ddmmyyyyDate) {
166
+ if (!ddmmyyyyDate) return '';
167
+ try {
168
+ // For multiple dates
169
+ if (ddmmyyyyDate.includes(' ')) {
170
+ return ddmmyyyyDate
171
+ .split(' ')
172
+ .map(date => convertSingleDateToISO(date))
173
+ .join(' ');
174
+ }
175
+ // For date ranges
176
+ if (ddmmyyyyDate.includes('/')) {
177
+ const [startDate, endDate] = ddmmyyyyDate.split('/');
178
+ return `${convertSingleDateToISO(startDate)}/${convertSingleDateToISO(endDate)}`;
179
+ }
180
+ // For single date
181
+ return convertSingleDateToISO(ddmmyyyyDate);
182
+ } catch (error) {
183
+ console.error('Error converting to ISO format:', error);
184
+ return '';
185
+ }
186
+ }
187
+
188
+ // Helper function to convert a single date to ISO
189
+ function convertSingleDateToISO(ddmmyyyyDate) {
190
+ if (!ddmmyyyyDate) return '';
191
+ const [day, month, year] = ddmmyyyyDate.split('-');
192
+ return `${year}-${month}-${day}`;
193
+ }