desy-html 5.3.0 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/tailwind.config.js +11 -21
- package/docs/_include.template-header.njk +16 -4
- package/docs/_macro.example-render.njk +16 -0
- package/docs/componentes.html +12 -0
- package/docs/ds/_ds.example.accordion.njk +61 -0
- package/docs/ds/_ds.example.footer.njk +7 -128
- package/docs/ds/_ds.example.header.njk +118 -0
- package/docs/ds/_ds.example.layout.njk +16 -6
- package/docs/ds/_ds.example.menu-navigation.njk +494 -0
- package/docs/ds/_ds.example.searchbar.njk +39 -0
- package/docs/ds/_ds.example.table.njk +432 -0
- package/docs/ds/_ds.example.toggle.njk +55 -35
- package/docs/ds/_ds.section.layout.njk +12 -12
- package/docs/ds/_ds.section.navigation.njk +5 -0
- package/docs/ds/_ds.section.textos.njk +27 -0
- package/docs/examples-accordion-history.html +5 -0
- package/docs/examples-header-2.html +5 -0
- package/docs/examples-header-advanced-2.html +5 -0
- package/docs/examples-header-advanced.html +5 -0
- package/docs/examples-header-mini.html +5 -0
- package/docs/examples-menu-navigation.html +5 -0
- package/docs/index.html +53 -0
- package/gulpfile.js +7 -6
- package/package.json +6 -7
- package/src/css/base.css +4 -0
- package/src/css/styles.css +1 -0
- package/src/js/aria/accordion.js +16 -5
- package/src/js/aria/disclosureMenu.js +153 -0
- package/src/js/desy-html.js +15 -0
- package/src/js/index.js +2 -0
- package/src/templates/components/accordion/_examples.accordion.njk +70 -2
- package/src/templates/components/accordion/_template.accordion.njk +18 -8
- package/src/templates/components/accordion/params.accordion.yaml +38 -0
- package/src/templates/components/accordion-history/_examples.accordion-history.njk +356 -0
- package/src/templates/components/accordion-history/_macro.accordion-history.njk +3 -0
- package/src/templates/components/accordion-history/_template.accordion-history.njk +220 -0
- package/src/templates/components/accordion-history/params.accordion-history.yaml +125 -0
- package/src/templates/components/button/_examples.button.njk +7 -0
- package/src/templates/components/button/_styles.button.css +34 -0
- package/src/templates/components/button/_template.button.njk +1 -1
- package/src/templates/components/button-loader/_styles.button-loader.css +6 -0
- package/src/templates/components/button-loader/_template.button-loader.njk +6 -6
- package/src/templates/components/checkboxes/_styles.checkboxes.css +7 -0
- package/src/templates/components/dropdown/_styles.dropdown.css +12 -4
- package/src/templates/components/file-upload/_template.file-upload.njk +1 -1
- package/src/templates/components/footer/_examples.footer.njk +46 -136
- package/src/templates/components/footer/_template.footer.njk +35 -28
- package/src/templates/components/footer/params.footer.yaml +18 -0
- package/src/templates/components/header/_examples.header-2.njk +536 -0
- package/src/templates/components/header/_examples.header.njk +134 -1
- package/src/templates/components/header/_template.header.header__navigation.njk +3 -3
- package/src/templates/components/header/_template.header.header__offcanvasButton.njk +1 -1
- package/src/templates/components/header/_template.header.header__subnav.njk +2 -2
- package/src/templates/components/header/_template.header.njk +8 -9
- package/src/templates/components/header/params.header.yaml +24 -0
- package/src/templates/components/header-advanced/_examples.header-advanced-2.njk +851 -0
- package/src/templates/components/header-advanced/_examples.header-advanced.njk +761 -0
- package/src/templates/components/header-advanced/_macro.header-advanced.njk +3 -0
- package/src/templates/components/header-advanced/_template.header-advanced.njk +146 -0
- package/src/templates/components/header-advanced/params.header-advanced.yaml +298 -0
- package/src/templates/components/header-mini/_examples.header-mini.njk +30 -0
- package/src/templates/components/header-mini/_macro.header-mini.njk +3 -0
- package/src/templates/components/header-mini/_template.header-mini.njk +14 -0
- package/src/templates/components/header-mini/params.header-mini.yaml +25 -0
- package/src/templates/components/input/_styles.input.css +7 -0
- package/src/templates/components/item/_examples.item.njk +26 -1
- package/src/templates/components/item/_template.item.njk +4 -4
- package/src/templates/components/item/params.item.yaml +4 -0
- package/src/templates/components/listbox/_styles.listbox.css +14 -4
- package/src/templates/components/menu-horizontal/_examples.menu-horizontal.njk +25 -0
- package/src/templates/components/menu-horizontal/_styles.menu-horizontal.css +26 -0
- package/src/templates/components/menu-horizontal/_template.menu-horizontal.njk +1 -1
- package/src/templates/components/menu-navigation/_examples.menu-navigation.njk +1080 -0
- package/src/templates/components/menu-navigation/_macro.menu-navigation.njk +3 -0
- package/src/templates/components/menu-navigation/_styles.menu-navigation.css +224 -0
- package/src/templates/components/menu-navigation/_template.menu-navigation.njk +116 -0
- package/src/templates/components/menu-navigation/params.menu-navigation.yaml +93 -0
- package/src/templates/components/menubar/_examples.menubar.njk +1 -1
- package/src/templates/components/menubar/_styles.menubar.css +33 -5
- package/src/templates/components/modal/_examples.modal.njk +62 -0
- package/src/templates/components/modal/_template.modal.njk +21 -4
- package/src/templates/components/modal/params.modal.yaml +2 -2
- package/src/templates/components/pagination/_examples.pagination.njk +60 -0
- package/src/templates/components/pagination/_template.pagination.njk +16 -2
- package/src/templates/components/pagination/params.pagination.yaml +49 -0
- package/src/templates/components/radios/_styles.radios.css +7 -0
- package/src/templates/components/searchbar/_examples.searchbar.njk +12 -1
- package/src/templates/components/searchbar/_template.searchbar.njk +9 -9
- package/src/templates/components/select/_styles.select.css +8 -0
- package/src/templates/components/spinner/_styles.spinner.css +1 -0
- package/src/templates/components/spinner/_template.spinner.njk +4 -4
- package/src/templates/components/table-advanced/_examples.table-advanced.njk +182 -5
- package/src/templates/components/table-advanced/_template.table-advanced.njk +27 -2
- package/src/templates/components/table-advanced/params.table-advanced.yaml +5 -0
- package/src/templates/components/toggle/_examples.toggle.njk +33 -11
- package/src/templates/components/toggle/_template.toggle.njk +3 -1
- package/src/templates/components/toggle/params.toggle.yaml +4 -0
- package/src/templates/components/tree/_examples.tree.njk +580 -32
- package/src/templates/components/tree/_styles.tree.css +8 -0
- package/src/templates/components/tree/_template.tree.njk +1 -1
- package/config/clean-css.js +0 -25
|
@@ -160,5 +160,65 @@
|
|
|
160
160
|
"aria-label": "Paginación"
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"name": "with itemsListbox",
|
|
166
|
+
"data": {
|
|
167
|
+
"id": "with-items-listbox",
|
|
168
|
+
"idPrefix": "with-items-listbox",
|
|
169
|
+
"totalItems": "64",
|
|
170
|
+
"itemsPerPage": "10",
|
|
171
|
+
"hasSelect": true,
|
|
172
|
+
"itemsListbox": {
|
|
173
|
+
"items": [
|
|
174
|
+
{
|
|
175
|
+
"text": "10",
|
|
176
|
+
"active": true
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"text": "25"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"text": "50"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"text": "75"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"text": "100"
|
|
189
|
+
}
|
|
190
|
+
]
|
|
191
|
+
},
|
|
192
|
+
"items": [
|
|
193
|
+
{
|
|
194
|
+
"href": "#",
|
|
195
|
+
"text": 1
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"href": "#",
|
|
199
|
+
"text": 2,
|
|
200
|
+
"active": true
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"href": "#",
|
|
204
|
+
"text": 3
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"href": "#",
|
|
208
|
+
"text": 4
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"href": "#",
|
|
212
|
+
"text": 5
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"href": "#",
|
|
216
|
+
"text": 6
|
|
217
|
+
}
|
|
218
|
+
],
|
|
219
|
+
"attributes": {
|
|
220
|
+
"aria-label": "Paginación"
|
|
221
|
+
}
|
|
222
|
+
}
|
|
163
223
|
}
|
|
164
224
|
] %}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{% from "../button/_macro.button.njk" import componentButton %}
|
|
2
2
|
{% from "components/listbox/_macro.listbox.njk" import componentListbox %}
|
|
3
3
|
|
|
4
|
+
|
|
4
5
|
{#- If an id 'prefix' is not passed, fall back to using a default one
|
|
5
6
|
instead -#}
|
|
6
7
|
{% set idPrefix = params.idPrefix if params.idPrefix else "pagination-item" %}
|
|
@@ -75,7 +76,7 @@
|
|
|
75
76
|
{% set nextSuffix %}
|
|
76
77
|
{% if (((activePosition + 2) | int + 1) * params.itemsPerPage | int) < ( params.totalItems | int ) %}<span class="sr-only">: Página {{ activePosition + 2 }} con los resultados del {{ (activePosition + 1) | int * params.itemsPerPage | int }} al {% if (((activePosition + 1) | int + 1) * params.itemsPerPage | int) > ( params.totalItems | int ) %}{{ params.totalItems }}{% else %}{{ ((activePosition + 1) | int + 1) * params.itemsPerPage | int }}{% endif %}</span>{% endif %}
|
|
77
78
|
{% endset %}
|
|
78
|
-
<div id="{{ params.id }}" class="lg:flex lg:flex-wrap lg:
|
|
79
|
+
<div id="{{ params.id }}" class="lg:flex lg:flex-wrap lg:items-center lg:gap-base{%- if params.containerClasses %} {{ params.containerClasses }}{% endif %}">
|
|
79
80
|
{% if params.hasSelect %}
|
|
80
81
|
<p class="w-full mb-xs text-sm text-neutral-dark">
|
|
81
82
|
Selecciona una página para cargar datos
|
|
@@ -120,7 +121,20 @@
|
|
|
120
121
|
</ul>
|
|
121
122
|
</nav>
|
|
122
123
|
{% endif %}
|
|
123
|
-
|
|
124
|
+
{% if params.itemsListbox %}
|
|
125
|
+
<div class="block relative -top-xs lg:ml-auto text-sm text-neutral-dark">
|
|
126
|
+
{{ componentListbox({
|
|
127
|
+
"id": "items-listbox-" + idPrefix,
|
|
128
|
+
"text": params.itemsPerPage,
|
|
129
|
+
"label": params.itemsListbox.label if params.itemsListbox.label else { "text": "Items por página: ", "classes": "inline-block align-middle mb-0" },
|
|
130
|
+
"doesChangeButtonText": true,
|
|
131
|
+
"classesContainer": "flex flex-wrap items-center gap-xs",
|
|
132
|
+
"classes": "c-listbox--sm c-listbox--transparent",
|
|
133
|
+
"items": params.itemsListbox.items
|
|
134
|
+
}) }}
|
|
135
|
+
</div>
|
|
136
|
+
{% endif %}
|
|
137
|
+
<p class="block relative -top-xs lg:ml-auto text-sm text-neutral-dark">
|
|
124
138
|
<span class="sr-only">Posición de paginación: </span>{{ activePosition | int * params.itemsPerPage | int }} - {{ (activePosition | int + 1) * params.itemsPerPage | int }} de {{ params.totalItems }}
|
|
125
139
|
</p>
|
|
126
140
|
</div>
|
|
@@ -39,6 +39,55 @@ params:
|
|
|
39
39
|
type: string
|
|
40
40
|
required: false
|
|
41
41
|
description: Text for the previous button. Defaults to "Siguiente".
|
|
42
|
+
- name: itemsListbox
|
|
43
|
+
type: object
|
|
44
|
+
required: false
|
|
45
|
+
description: Options for a listbox component to choose number of items per page.
|
|
46
|
+
- name: label
|
|
47
|
+
type: object
|
|
48
|
+
required: true
|
|
49
|
+
description: Label text or HTML by specifying value for either text or html keys.
|
|
50
|
+
- name: text
|
|
51
|
+
type: string
|
|
52
|
+
required: true
|
|
53
|
+
description: If `html` is set, this is not required. Text for the button. If `html` is provided, the `text` argument will be ignored.
|
|
54
|
+
- name: html
|
|
55
|
+
type: string
|
|
56
|
+
required: true
|
|
57
|
+
description: If `text` is set, this is not required. HTML for the button. If `html` is provided, the `text` argument will be ignored.
|
|
58
|
+
- name: classes
|
|
59
|
+
type: string
|
|
60
|
+
required: false
|
|
61
|
+
description: Classes to add to the element that acts as label.
|
|
62
|
+
- name: items
|
|
63
|
+
type: array
|
|
64
|
+
required: true
|
|
65
|
+
description: Array of items objects.
|
|
66
|
+
params:
|
|
67
|
+
- name: text
|
|
68
|
+
type: string
|
|
69
|
+
required: true
|
|
70
|
+
description: If `html` is set, this is not required. Text to use within each item. If `html` is provided, the `text` argument will be ignored.
|
|
71
|
+
- name: html
|
|
72
|
+
type: string
|
|
73
|
+
required: true
|
|
74
|
+
description: If `text` is set, this is not required. HTML to use within each item. If `html` is provided, the `text` argument will be ignored.
|
|
75
|
+
- name: id
|
|
76
|
+
type: string
|
|
77
|
+
required: false
|
|
78
|
+
description: Specific id attribute for the item. If omitted, then idPrefix option will be applied.
|
|
79
|
+
- name: active
|
|
80
|
+
type: boolean
|
|
81
|
+
required: false
|
|
82
|
+
description: If true, item will be active.
|
|
83
|
+
- name: classes
|
|
84
|
+
type: string
|
|
85
|
+
required: false
|
|
86
|
+
description: Classes to add to the item.
|
|
87
|
+
- name: attributes
|
|
88
|
+
type: object
|
|
89
|
+
required: false
|
|
90
|
+
description: HTML attributes (for example data attributes) to add to the item.
|
|
42
91
|
- name: items
|
|
43
92
|
type: array
|
|
44
93
|
required: true
|
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
========================================================================== */
|
|
4
4
|
|
|
5
5
|
@layer components {
|
|
6
|
+
.c-radios--base {
|
|
7
|
+
input[type="radio"] {
|
|
8
|
+
@apply w-6;
|
|
9
|
+
@apply h-6;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
6
13
|
.c-radios--sm {
|
|
7
14
|
input[type="radio"] {
|
|
8
15
|
@apply w-base !important;
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
"data": {
|
|
6
6
|
"id": "searchbar-1",
|
|
7
7
|
"label": {
|
|
8
|
-
"text": "Buscar"
|
|
8
|
+
"text": "Buscar",
|
|
9
|
+
"classes": "not-sr-only mb-sm"
|
|
9
10
|
}
|
|
10
11
|
}
|
|
11
12
|
},
|
|
@@ -42,6 +43,16 @@
|
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
},
|
|
46
|
+
{
|
|
47
|
+
"name": "with label visible",
|
|
48
|
+
"data": {
|
|
49
|
+
"id": "searchbar-label-visible",
|
|
50
|
+
"label": {
|
|
51
|
+
"text": "Buscar items recientes",
|
|
52
|
+
"classes": "not-sr-only mb-sm"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
45
56
|
{
|
|
46
57
|
"name": "small",
|
|
47
58
|
"data": {
|
|
@@ -9,16 +9,16 @@
|
|
|
9
9
|
{% endif %}
|
|
10
10
|
|
|
11
11
|
<!-- searchbar -->
|
|
12
|
+
{{ componentLabel({
|
|
13
|
+
html: params.label.html,
|
|
14
|
+
text: params.label.text,
|
|
15
|
+
classes: "sr-only " + params.label.classes,
|
|
16
|
+
isPageHeading: false,
|
|
17
|
+
attributes: params.label.attributes,
|
|
18
|
+
for: params.id
|
|
19
|
+
}) | indent(2) | trim }}
|
|
12
20
|
<div class="relative {%- if params.button %} flex flex-wrap items-end{% endif %}">
|
|
13
|
-
{{
|
|
14
|
-
html: params.label.html,
|
|
15
|
-
text: params.label.text,
|
|
16
|
-
classes: "sr-only",
|
|
17
|
-
isPageHeading: false,
|
|
18
|
-
attributes: params.label.attributes,
|
|
19
|
-
for: params.id
|
|
20
|
-
}) | indent(2) | trim }}
|
|
21
|
-
<input class="c-input block mt-sm pr-12 border-black rounded font-semibold placeholder-neutral-dark focus:border-black focus:shadow-outline-focus-input focus:ring-4 focus:ring-warning-base disabled:bg-neutral-light disabled:border-neutral-base {%- if not params.button %} w-full{% endif %} {%- if params.classes %} {{ params.classes }}{% endif %} {%- if params.errorMessage %} border-alert-base ring-2 ring-alert-base {% endif %}" id="{{ params.id }}" name="{{ params.id }}" type="search"
|
|
21
|
+
<input class="c-input block pr-12 border-black rounded font-semibold placeholder-neutral-dark focus:border-black focus:shadow-outline-focus-input focus:ring-4 focus:ring-warning-base disabled:bg-neutral-light disabled:border-neutral-base {%- if not params.button %} w-full{% endif %} {%- if params.classes %} {{ params.classes }}{% endif %} {%- if params.errorMessage %} border-alert-base ring-2 ring-alert-base {% endif %}" id="{{ params.id }}" name="{{ params.id }}" type="search"
|
|
22
22
|
{%- if params.value %} value="{{ params.value}}"{% endif %}
|
|
23
23
|
{%- if describedBy %} aria-describedby="{{ describedBy }}"{% endif %}
|
|
24
24
|
{%- if params.errorMessage %} aria-errormessage="{{ errorId }}" aria-invalid="true"{% endif %}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<!-- spinner -->
|
|
2
|
-
<
|
|
2
|
+
<span class="c-spinner {% if params.classes %}{{ params.classes }}{% endif %}" data-module="c-spinner"{% if params.attributes %}{% for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}{% endif %} >
|
|
3
3
|
{% if params.text %}
|
|
4
|
-
<
|
|
4
|
+
<span class="sr-only" role="alert" aria-live="assertive">
|
|
5
5
|
{{ params.text }}
|
|
6
|
-
</
|
|
6
|
+
</span>
|
|
7
7
|
{% endif %}
|
|
8
|
-
</
|
|
8
|
+
</span>
|
|
9
9
|
<!-- /spinner -->
|
|
@@ -238,7 +238,7 @@
|
|
|
238
238
|
"classes": "min-w-full"
|
|
239
239
|
}
|
|
240
240
|
},
|
|
241
|
-
|
|
241
|
+
{
|
|
242
242
|
"name": "table with head and filters",
|
|
243
243
|
"description": "hasFilter: true and filterClasses: text-right in numeric columns",
|
|
244
244
|
"data": {
|
|
@@ -250,7 +250,8 @@
|
|
|
250
250
|
},
|
|
251
251
|
{
|
|
252
252
|
"text": "Rate for bicycles",
|
|
253
|
-
"classes": "text-right"
|
|
253
|
+
"classes": "text-right",
|
|
254
|
+
"hasFilter": true
|
|
254
255
|
},
|
|
255
256
|
{
|
|
256
257
|
"text": "Rate for vehicles",
|
|
@@ -302,6 +303,137 @@
|
|
|
302
303
|
"classes": "min-w-full"
|
|
303
304
|
}
|
|
304
305
|
},
|
|
306
|
+
{
|
|
307
|
+
"name": "table with head and selects",
|
|
308
|
+
"description": "selects and filterClasses: text-right in numeric columns",
|
|
309
|
+
"data": {
|
|
310
|
+
"idPrefix": "table-with-head-and-selects",
|
|
311
|
+
"head": [
|
|
312
|
+
{
|
|
313
|
+
"text": "Month you apply",
|
|
314
|
+
"select": {
|
|
315
|
+
"items": [
|
|
316
|
+
{
|
|
317
|
+
"value": "",
|
|
318
|
+
"text": "Filtrar por...",
|
|
319
|
+
"disabled": true,
|
|
320
|
+
"selected": true,
|
|
321
|
+
"hidden": true
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
"value": 1,
|
|
325
|
+
"text": "Option 1"
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"value": 2,
|
|
329
|
+
"text": "Option 2"
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
"value": 3,
|
|
333
|
+
"text": "Option 3"
|
|
334
|
+
}
|
|
335
|
+
]
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
"text": "Rate for bicycles",
|
|
340
|
+
"classes": "text-right",
|
|
341
|
+
"select": {
|
|
342
|
+
"items": [
|
|
343
|
+
{
|
|
344
|
+
"value": "",
|
|
345
|
+
"text": "Filtrar por...",
|
|
346
|
+
"disabled": true,
|
|
347
|
+
"selected": true,
|
|
348
|
+
"hidden": true
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
"value": 1,
|
|
352
|
+
"text": "Option 1"
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
"value": 2,
|
|
356
|
+
"text": "Option 2"
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
"value": 3,
|
|
360
|
+
"text": "Option 3"
|
|
361
|
+
}
|
|
362
|
+
]
|
|
363
|
+
}
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
"text": "Rate for vehicles",
|
|
367
|
+
"classes": "text-right",
|
|
368
|
+
"select": {
|
|
369
|
+
"items": [
|
|
370
|
+
{
|
|
371
|
+
"value": "",
|
|
372
|
+
"text": "Filtrar por...",
|
|
373
|
+
"disabled": true,
|
|
374
|
+
"selected": true,
|
|
375
|
+
"hidden": true
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
"value": 1,
|
|
379
|
+
"text": "Option 1"
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
"value": 2,
|
|
383
|
+
"text": "Option 2"
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
"value": 3,
|
|
387
|
+
"text": "Option 3"
|
|
388
|
+
}
|
|
389
|
+
]
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
],
|
|
393
|
+
"rows": [
|
|
394
|
+
[
|
|
395
|
+
{
|
|
396
|
+
"text": "January"
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
"text": "85€",
|
|
400
|
+
"classes": "text-right"
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
"text": "95€",
|
|
404
|
+
"classes": "text-right"
|
|
405
|
+
}
|
|
406
|
+
],
|
|
407
|
+
[
|
|
408
|
+
{
|
|
409
|
+
"text": "February"
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
"text": "75€",
|
|
413
|
+
"classes": "text-right"
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
"text": "55€",
|
|
417
|
+
"classes": "text-right"
|
|
418
|
+
}
|
|
419
|
+
],
|
|
420
|
+
[
|
|
421
|
+
{
|
|
422
|
+
"text": "March"
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
"text": "165€",
|
|
426
|
+
"classes": "text-right"
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
"text": "125€",
|
|
430
|
+
"classes": "text-right"
|
|
431
|
+
}
|
|
432
|
+
]
|
|
433
|
+
],
|
|
434
|
+
"classes": "min-w-full"
|
|
435
|
+
}
|
|
436
|
+
},
|
|
305
437
|
{
|
|
306
438
|
"name": "table with checkboxes",
|
|
307
439
|
"data": {
|
|
@@ -366,7 +498,7 @@
|
|
|
366
498
|
},
|
|
367
499
|
{
|
|
368
500
|
"name": "table with all",
|
|
369
|
-
"description": "orderBy, hasCheckboxes, hasFilter and firstCellIsHeader",
|
|
501
|
+
"description": "orderBy, hasCheckboxes, hasFilter, selects and firstCellIsHeader",
|
|
370
502
|
"data": {
|
|
371
503
|
"idPrefix": "table-with-all",
|
|
372
504
|
"hasCheckboxes": true,
|
|
@@ -384,13 +516,58 @@
|
|
|
384
516
|
"text": "Rate for bicycles",
|
|
385
517
|
"orderBy": "none",
|
|
386
518
|
"classes": "text-right",
|
|
387
|
-
"
|
|
519
|
+
"select": {
|
|
520
|
+
"items": [
|
|
521
|
+
{
|
|
522
|
+
"value": "",
|
|
523
|
+
"text": "Filtrar por...",
|
|
524
|
+
"disabled": true,
|
|
525
|
+
"selected": true,
|
|
526
|
+
"hidden": true
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
"value": 1,
|
|
530
|
+
"text": "Option 1"
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
"value": 2,
|
|
534
|
+
"text": "Option 2"
|
|
535
|
+
},
|
|
536
|
+
{
|
|
537
|
+
"value": 3,
|
|
538
|
+
"text": "Option 3"
|
|
539
|
+
}
|
|
540
|
+
]
|
|
541
|
+
}
|
|
388
542
|
},
|
|
389
543
|
{
|
|
390
544
|
"text": "Rate for vehicles",
|
|
391
545
|
"orderBy": "none",
|
|
392
546
|
"classes": "text-right",
|
|
393
|
-
"hasFilter": true
|
|
547
|
+
"hasFilter": true,
|
|
548
|
+
"select": {
|
|
549
|
+
"items": [
|
|
550
|
+
{
|
|
551
|
+
"value": "",
|
|
552
|
+
"text": "Filtrar por...",
|
|
553
|
+
"disabled": true,
|
|
554
|
+
"selected": true,
|
|
555
|
+
"hidden": true
|
|
556
|
+
},
|
|
557
|
+
{
|
|
558
|
+
"value": 1,
|
|
559
|
+
"text": "Option 1"
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
"value": 2,
|
|
563
|
+
"text": "Option 2"
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
"value": 3,
|
|
567
|
+
"text": "Option 3"
|
|
568
|
+
}
|
|
569
|
+
]
|
|
570
|
+
}
|
|
394
571
|
}
|
|
395
572
|
],
|
|
396
573
|
"rows": [
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
{% from "components/searchbar/_macro.searchbar.njk" import componentSearchbar %}
|
|
2
|
+
{% from "components/select/_macro.select.njk" import componentSelect %}
|
|
2
3
|
|
|
3
4
|
{#- If an id 'prefix' is not passed, fall back to using a generic one
|
|
4
5
|
instead. -#}
|
|
5
6
|
{% set idPrefix = params.idPrefix if params.idPrefix else 'id-table-row' %}
|
|
6
7
|
{% set hasFilters = false %}
|
|
8
|
+
{% set hasSelects = false %}
|
|
7
9
|
|
|
8
10
|
{% for item in params.head %}
|
|
9
11
|
{% if item.hasFilter %}
|
|
10
12
|
{% set hasFilters = true %}
|
|
11
13
|
{% endif %}
|
|
14
|
+
{% if item.select %}
|
|
15
|
+
{% set hasSelects = true %}
|
|
16
|
+
{% endif %}
|
|
12
17
|
{% endfor %}
|
|
13
18
|
|
|
14
19
|
{#- Capture the HTML so we can optionally nest it in a wrapper -#}
|
|
@@ -55,7 +60,7 @@
|
|
|
55
60
|
</thead>
|
|
56
61
|
{% endif %}
|
|
57
62
|
<tbody>
|
|
58
|
-
{% if hasFilters %}
|
|
63
|
+
{% if hasFilters or hasSelects %}
|
|
59
64
|
<tr class="divide-x divide-neutral-base">
|
|
60
65
|
{% if params.hasCheckboxes %}
|
|
61
66
|
<td {%- if params.checkboxesClasses %} class="{{ params.checkboxesClasses }}"{% endif %}></td>
|
|
@@ -63,7 +68,27 @@
|
|
|
63
68
|
{% for item in params.head %}
|
|
64
69
|
{%- set idHeader = idPrefix + "-header-" + loop.index0 -%}
|
|
65
70
|
{%- set idFilter = idPrefix + "-header-filter-" + loop.index0 -%}
|
|
71
|
+
{%- set idSelect = idPrefix + "-header-select-" + loop.index0 -%}
|
|
66
72
|
<td tabindex="-1" class="align-top px-base pb-sm border-neutral-base border-b-0 text-left text-sm font-normal text-neutral-dark {%- if item.classes %} {{ item.classes }}{% endif %}">
|
|
73
|
+
{% if item.select %}
|
|
74
|
+
{{ componentSelect({
|
|
75
|
+
"formGroup": {
|
|
76
|
+
"classes": "mb-0"
|
|
77
|
+
},
|
|
78
|
+
"label": {
|
|
79
|
+
"text": "Filtrar en esta columna",
|
|
80
|
+
"classes": "sr-only"
|
|
81
|
+
},
|
|
82
|
+
"id": item.select.id if item.select.id else idSelect,
|
|
83
|
+
"name": item.select.name if item.select.name else idSelect,
|
|
84
|
+
"items": item.select.items,
|
|
85
|
+
"describedBy": idHeader,
|
|
86
|
+
"disabled": item.select.disabled,
|
|
87
|
+
"classes": item.select.classes if item.select.classes else "c-select--sm w-full mt-0",
|
|
88
|
+
"attributes": item.select.attributes
|
|
89
|
+
}) }}
|
|
90
|
+
{% endif %}
|
|
91
|
+
{% if item.select and item.hasFilter %}<div class="pb-sm"></div>{% endif %}
|
|
67
92
|
{% if item.hasFilter %}
|
|
68
93
|
{{ componentSearchbar({
|
|
69
94
|
"formGroup": {
|
|
@@ -74,7 +99,7 @@
|
|
|
74
99
|
"classes": "sr-only"
|
|
75
100
|
},
|
|
76
101
|
"id": idFilter,
|
|
77
|
-
"name":
|
|
102
|
+
"name": idFilter,
|
|
78
103
|
"placeholder": "Buscar",
|
|
79
104
|
"classes": "c-input--sm " + item.filterClasses if item.filterClasses else "c-input--sm",
|
|
80
105
|
"buttonClasses": "m-xs p-0.5 text-xs",
|
|
@@ -61,6 +61,11 @@ params:
|
|
|
61
61
|
type: string
|
|
62
62
|
required: false
|
|
63
63
|
description: Classes to add to the table head cell input.
|
|
64
|
+
- name: select
|
|
65
|
+
type: object
|
|
66
|
+
required: false
|
|
67
|
+
description: Options for a select component to filter results in the column.
|
|
68
|
+
isComponent: true
|
|
64
69
|
- name: classes
|
|
65
70
|
type: string
|
|
66
71
|
required: false
|
|
@@ -2,31 +2,53 @@
|
|
|
2
2
|
{% set examples = [
|
|
3
3
|
{
|
|
4
4
|
"name": "default",
|
|
5
|
-
"description": "Button like appearance, no change of button text, only changes in visual state",
|
|
5
|
+
"description": "Button like 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-controls to show/hide that outer element.",
|
|
6
6
|
"data": {
|
|
7
|
-
"classes": "c-button
|
|
7
|
+
"classes": "c-button",
|
|
8
8
|
"offState": {
|
|
9
9
|
"classes": "",
|
|
10
|
-
"html": '
|
|
10
|
+
"html": 'Mostrar detalles'
|
|
11
11
|
},
|
|
12
12
|
"onState": {
|
|
13
|
-
"classes": "",
|
|
14
|
-
"html": '
|
|
13
|
+
"classes": "c-button--has-selection",
|
|
14
|
+
"html": '<span class="inline-flex"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" class="self-center mr-2" aria-hidden="true" width="1em" height="1em"><path d="M13.714 42.857A6.857 6.857 0 0 1 8.4 40.183L.857 31.646a3.429 3.429 0 0 1 .309-4.869A3.429 3.429 0 0 1 6 27.12l7.063 7.989a.72.72 0 0 0 .617.308.789.789 0 0 0 .617-.274L42.103 6.206a3.429 3.429 0 0 1 4.937 4.731L18.926 40.526a6.651 6.651 0 0 1-5.212 2.331Z" fill="currentColor"/></svg>Mostrar detalles</span>'
|
|
15
|
+
},
|
|
16
|
+
"attributes": {
|
|
17
|
+
"aria-controls": "id-panel-oculto"
|
|
15
18
|
}
|
|
16
19
|
}
|
|
17
20
|
},
|
|
18
21
|
{
|
|
19
22
|
"name": "2 icons",
|
|
20
|
-
"description": "Button like appearance,
|
|
23
|
+
"description": "Button like appearance, no change of button text, only changes in icons. It needs an outer element with an id to use it with its aria-controls to show/hide that outer element.",
|
|
21
24
|
"data": {
|
|
22
|
-
"classes": "c-button c-button--sm
|
|
25
|
+
"classes": "c-button c-button--sm",
|
|
23
26
|
"offState": {
|
|
24
27
|
"classes": "",
|
|
25
|
-
"html": '<span class="inline-flex"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" class="self-center mr-2" aria-hidden="true" focusable="false" width="1em" height="1em"><path d="M13.
|
|
28
|
+
"html": '<span class="inline-flex"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" class="self-center mr-2" aria-hidden="true" focusable="false" width="1em" height="1em"><path d="M13.71 2.3a1.45 1.45 0 0 0 .14-1.51A1.41 1.41 0 0 0 12.57 0H1.43A1.4 1.4 0 0 0 .15.8a1.43 1.43 0 0 0 .16 1.52l5.13 6.32a.25.25 0 0 1 .06.16v4.7a.5.5 0 0 0 .31.46A.43.43 0 0 0 6 14a.47.47 0 0 0 .35-.15l2-2a.47.47 0 0 0 .15-.35V8.8a.25.25 0 0 1 .06-.16ZM7.6 6.65a.29.29 0 0 1-.2.09h-.8a.29.29 0 0 1-.2-.09L3 2.41a.26.26 0 0 1 0-.27.26.26 0 0 1 .15-.14h7.7a.26.26 0 0 1 .22.14.26.26 0 0 1 0 .27Z" fill="currentColor" transform="scale(3.42857)"/></svg>Mostrar filtros</span>'
|
|
26
29
|
},
|
|
27
30
|
"onState": {
|
|
31
|
+
"classes": "c-button--has-selection",
|
|
32
|
+
"html": '<span class="inline-flex"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" class="self-center mr-2" aria-hidden="true" focusable="false" width="1em" height="1em"><path d="M13.9.8a.51.51 0 0 0 0-.52.51.51 0 0 0-.4-.28H.5a.51.51 0 0 0-.45.28A.51.51 0 0 0 .1.8l5.19 6.79a1 1 0 0 1 .21.61v5.3a.5.5 0 0 0 .31.46A.43.43 0 0 0 6 14a.47.47 0 0 0 .35-.15l2-2a.47.47 0 0 0 .15-.35V8.2a1 1 0 0 1 .21-.61Z" fill="currentColor" transform="scale(3.42857)"/></svg>Mostrar filtros</span>'
|
|
33
|
+
},
|
|
34
|
+
"attributes": {
|
|
35
|
+
"aria-controls": "id-panel-oculto"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"name": "Not Expandible",
|
|
41
|
+
"description": "isExpandible = false. Instead of aria-expanded will use aria-pressed.",
|
|
42
|
+
"data": {
|
|
43
|
+
"isExpandible": false,
|
|
44
|
+
"classes": "c-button",
|
|
45
|
+
"offState": {
|
|
28
46
|
"classes": "",
|
|
29
|
-
"html": '<span class="inline-flex"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" class="self-center mr-2" aria-hidden="true"
|
|
47
|
+
"html": '<span class="inline-flex"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" class="self-center mr-2" aria-hidden="true" width="1em" height="1em"><path d="M6.41 10.78a.25.25 0 0 0 0 .34l2.16 2.41a1.35 1.35 0 0 0 .8.27 1.31 1.31 0 0 0 1.31-1.31V7.12a.26.26 0 0 0-.43-.18ZM.26 13.81a.76.76 0 0 0 1 0l12.5-12.5a.76.76 0 0 0 .18-.31.71.71 0 0 0 .06-.24.73.73 0 0 0-.19-.49.74.74 0 0 0-1.06 0l-2 2a.26.26 0 0 1-.19.07.25.25 0 0 1-.18-.08 1.23 1.23 0 0 0-1-.45 1.29 1.29 0 0 0-.8.27L5.74 5.21a.23.23 0 0 1-.19.09H4.42a1.75 1.75 0 0 0-1.75 1.75v1.5A1.78 1.78 0 0 0 3 9.61a.25.25 0 0 1 0 .33L.22 12.73a.75.75 0 0 0 0 1.06Z" fill="currentColor" transform="scale(3.42857)"/></svg>Reproducir sonido</span>'
|
|
48
|
+
},
|
|
49
|
+
"onState": {
|
|
50
|
+
"classes": "c-button--has-selection",
|
|
51
|
+
"html": '<span class="inline-flex"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" class="self-center mr-2" aria-hidden="true" width="1em" height="1em"><path d="M12 2.21a.75.75 0 0 0-1.06 0 .75.75 0 0 0 0 1.06 5.26 5.26 0 0 1 0 7.46.75.75 0 0 0 0 1.06.75.75 0 0 0 1.06 0 6.74 6.74 0 0 0 0-9.58Z" fill="currentColor" transform="scale(3.42857)"/><path d="M10.34 4.89a.75.75 0 0 0-1.23.85 2.23 2.23 0 0 1 0 2.52.74.74 0 0 0 .19 1 .75.75 0 0 0 1-.19 3.7 3.7 0 0 0 0-4.22ZM6.69 1a1.35 1.35 0 0 0-.8.27L3.07 4.42a.27.27 0 0 1-.19.08H1.75A1.76 1.76 0 0 0 0 6.25v1.5A1.76 1.76 0 0 0 1.75 9.5h1.13a.27.27 0 0 1 .19.08l2.82 3.15a1.35 1.35 0 0 0 .8.27A1.31 1.31 0 0 0 8 11.69V2.31A1.31 1.31 0 0 0 6.69 1Z" fill="currentColor" transform="scale(3.42857)"/></svg>Reproducir sonido</span>'
|
|
30
52
|
}
|
|
31
53
|
}
|
|
32
54
|
},
|
|
@@ -38,11 +60,11 @@
|
|
|
38
60
|
"isSwitch": true,
|
|
39
61
|
"offState": {
|
|
40
62
|
"classes": "",
|
|
41
|
-
"html": '<span class="bg-neutral-base relative inline-flex flex-shrink-0 h-5 w-9 border-2 border-neutral-base rounded-full cursor-pointer
|
|
63
|
+
"html": '<span class="flex align-center justify-between gap-xs"><span class="text-sm" aria-hidden="true">Off</span><span class="bg-neutral-base relative inline-flex flex-shrink-0 h-5 w-9 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-4 w-4 rounded-full bg-white shadow-lg transform ring-0 transition ease-in-out duration-200" /></span></span><span class="text-sm" aria-hidden="true">On</span></span>'
|
|
42
64
|
},
|
|
43
65
|
"onState": {
|
|
44
66
|
"classes": "",
|
|
45
|
-
"html": '<span class="bg-primary-base relative inline-flex flex-shrink-0 h-5 w-9 border-2 border-primary-base rounded-full cursor-pointer
|
|
67
|
+
"html": '<span class="flex align-center justify-between gap-xs"><span class="text-sm" aria-hidden="true">Off</span><span class="bg-primary-base relative inline-flex flex-shrink-0 h-5 w-9 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-4 w-4 rounded-full bg-white shadow-lg transform ring-0 transition ease-in-out duration-200" /></span></span><span class="text-sm" aria-hidden="true">On</span></span>'
|
|
46
68
|
},
|
|
47
69
|
"attributes": {
|
|
48
70
|
"aria-labelledby": "id-text"
|