desy-html 5.3.0 → 6.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.
- package/config/tailwind.config.js +10 -10
- package/docs/_include.template-header.njk +8 -0
- package/docs/_macro.example-render.njk +8 -0
- package/docs/componentes.html +6 -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-menu-navigation.html +5 -0
- package/docs/index.html +39 -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 +209 -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 +27 -0
- package/src/templates/components/button/_template.button.njk +1 -1
- package/src/templates/components/button-loader/_template.button-loader.njk +6 -6
- 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.njk +166 -0
- package/src/templates/components/header/_template.header.header__navigation.njk +2 -2
- package/src/templates/components/header/_template.header.njk +7 -3
- package/src/templates/components/header/params.header.yaml +24 -0
- package/src/templates/components/item/_examples.item.njk +1 -1
- package/src/templates/components/item/_template.item.njk +3 -3
- package/src/templates/components/listbox/_styles.listbox.css +7 -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 +216 -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 +26 -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/searchbar/_examples.searchbar.njk +12 -1
- package/src/templates/components/searchbar/_template.searchbar.njk +8 -8
- 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 +26 -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/_template.tree.njk +1 -1
- package/config/clean-css.js +0 -25
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/* ==========================================================================
|
|
2
|
+
_styles.menu-navigation.css
|
|
3
|
+
========================================================================== */
|
|
4
|
+
|
|
5
|
+
@layer components {
|
|
6
|
+
.c-menu-navigation--last-right {
|
|
7
|
+
&>ul li:last-of-type {
|
|
8
|
+
@apply ml-auto;
|
|
9
|
+
|
|
10
|
+
.c-menu-navigation__sub {
|
|
11
|
+
@apply left-auto;
|
|
12
|
+
@apply right-0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.c-menu-navigation__tooltip {
|
|
16
|
+
@apply left-auto;
|
|
17
|
+
@apply right-0;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
.c-menu-navigation__button {
|
|
24
|
+
@apply inline-flex;
|
|
25
|
+
@apply items-baseline;
|
|
26
|
+
@apply px-3;
|
|
27
|
+
@apply py-2;
|
|
28
|
+
@apply bg-white;
|
|
29
|
+
@apply border;
|
|
30
|
+
@apply border-primary-base;
|
|
31
|
+
@apply rounded;
|
|
32
|
+
@apply align-baseline;
|
|
33
|
+
@apply font-semibold;
|
|
34
|
+
@apply text-primary-base;
|
|
35
|
+
@apply transition-all;
|
|
36
|
+
@apply duration-100;
|
|
37
|
+
@apply ease-out;
|
|
38
|
+
@apply whitespace-nowrap;
|
|
39
|
+
@apply cursor-pointer;
|
|
40
|
+
|
|
41
|
+
@apply focus:bg-warning-base;
|
|
42
|
+
@apply focus:border-warning-base;
|
|
43
|
+
@apply focus:shadow-outline-black;
|
|
44
|
+
@apply focus:text-black;
|
|
45
|
+
@apply focus:outline-none;
|
|
46
|
+
|
|
47
|
+
&:hover:not(disabled),
|
|
48
|
+
&:active:not(disabled),
|
|
49
|
+
&.ds-hover:not(disabled) {
|
|
50
|
+
@apply bg-neutral-light;
|
|
51
|
+
@apply border-primary-base;
|
|
52
|
+
@apply text-primary-base;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&:active:not(disabled),
|
|
56
|
+
&.ds-active:not(disabled) {
|
|
57
|
+
@apply relative;
|
|
58
|
+
@apply top-px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&.ds-focus {
|
|
62
|
+
@apply bg-warning-base;
|
|
63
|
+
@apply border-warning-base;
|
|
64
|
+
@apply shadow-outline-black;
|
|
65
|
+
@apply text-black;
|
|
66
|
+
@apply outline-none;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
&[disabled],
|
|
71
|
+
&[disabled]:hover,
|
|
72
|
+
&[disabled]:focus,
|
|
73
|
+
&.c-menu-navigation__button--disabled,
|
|
74
|
+
&.c-menu-navigation__button--disabled:hover,
|
|
75
|
+
&.c-menu-navigation__button--disabled:focus {
|
|
76
|
+
@apply bg-white;
|
|
77
|
+
@apply opacity-50;
|
|
78
|
+
@apply cursor-not-allowed;
|
|
79
|
+
@apply pointer-events-none;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
.c-menu-navigation__tooltip {
|
|
85
|
+
@apply absolute;
|
|
86
|
+
@apply top-0;
|
|
87
|
+
@apply left-0;
|
|
88
|
+
|
|
89
|
+
&:focus,
|
|
90
|
+
&.ds-focus {
|
|
91
|
+
@apply bg-primary-base;
|
|
92
|
+
@apply text-white;
|
|
93
|
+
@apply outline-none;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
.c-menu-navigation__button--sm {
|
|
99
|
+
@apply px-2;
|
|
100
|
+
@apply py-1;
|
|
101
|
+
@apply text-sm;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
.c-menu-navigation__button--primary {
|
|
106
|
+
@apply bg-primary-base;
|
|
107
|
+
@apply text-white;
|
|
108
|
+
@apply shadow-solid-primary-dark;
|
|
109
|
+
|
|
110
|
+
&:hover:not(disabled),
|
|
111
|
+
&:active:not(disabled),
|
|
112
|
+
&.ds-hover:not(disabled) {
|
|
113
|
+
@apply bg-primary-dark;
|
|
114
|
+
@apply border-primary-dark;
|
|
115
|
+
@apply text-white;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&[disabled],
|
|
119
|
+
&[disabled]:hover,
|
|
120
|
+
&[disabled]:focus,
|
|
121
|
+
&.c-menu-navigation__button--disabled,
|
|
122
|
+
&.c-menu-navigation__button--disabled:hover,
|
|
123
|
+
&.c-menu-navigation__button--disabled:focus {
|
|
124
|
+
@apply bg-primary-base;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
.c-menu-navigation__button--has-selection {
|
|
130
|
+
@apply bg-primary-light;
|
|
131
|
+
@apply text-primary-dark;
|
|
132
|
+
@apply border-primary-base;
|
|
133
|
+
@apply shadow-none;
|
|
134
|
+
@apply font-bold;
|
|
135
|
+
|
|
136
|
+
&:hover:not(disabled),
|
|
137
|
+
&:active:not(disabled),
|
|
138
|
+
&.ds-hover:not(disabled) {
|
|
139
|
+
@apply bg-primary-light;
|
|
140
|
+
@apply text-black;
|
|
141
|
+
@apply bg-opacity-50;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
&:active:not(disabled),
|
|
145
|
+
&.ds-active:not(disabled) {
|
|
146
|
+
@apply shadow-none;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
&[disabled],
|
|
150
|
+
&[disabled]:hover,
|
|
151
|
+
&[disabled]:focus,
|
|
152
|
+
&.c-menu-navigation__button--disabled,
|
|
153
|
+
&.c-menu-navigation__button--disabled:hover,
|
|
154
|
+
&.c-menu-navigation__button--disabled:focus {
|
|
155
|
+
@apply bg-primary-light;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
.c-menu-navigation__button--transparent {
|
|
161
|
+
@apply bg-transparent;
|
|
162
|
+
@apply border-transparent;
|
|
163
|
+
@apply shadow-none;
|
|
164
|
+
@apply underline;
|
|
165
|
+
|
|
166
|
+
&:hover:not(disabled),
|
|
167
|
+
&.ds-hover:not(disabled) {
|
|
168
|
+
@apply text-primary-dark;
|
|
169
|
+
@apply border-neutral-base;
|
|
170
|
+
@apply shadow-none;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
&[disabled],
|
|
174
|
+
&[disabled]:hover,
|
|
175
|
+
&[disabled]:focus,
|
|
176
|
+
&.c-menu-navigation__button--disabled,
|
|
177
|
+
&.c-menu-navigation__button--disabled:hover,
|
|
178
|
+
&.c-menu-navigation__button--disabled:focus {
|
|
179
|
+
@apply bg-transparent;
|
|
180
|
+
@apply border-transparent;
|
|
181
|
+
@apply no-underline;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
.c-menu-navigation__button--header {
|
|
187
|
+
@apply bg-black;
|
|
188
|
+
@apply border-none;
|
|
189
|
+
@apply rounded-none;
|
|
190
|
+
@apply shadow-none;
|
|
191
|
+
@apply font-normal;
|
|
192
|
+
@apply text-sm;
|
|
193
|
+
@apply text-white;
|
|
194
|
+
|
|
195
|
+
&:hover:not(disabled),
|
|
196
|
+
&.ds-hover:not(disabled) {
|
|
197
|
+
@apply bg-black;
|
|
198
|
+
@apply border-none;
|
|
199
|
+
@apply shadow-none;
|
|
200
|
+
@apply text-white;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
&[disabled],
|
|
204
|
+
&[disabled]:hover,
|
|
205
|
+
&[disabled]:focus,
|
|
206
|
+
&.c-menu-navigation__button--disabled,
|
|
207
|
+
&.c-menu-navigation__button--disabled:hover,
|
|
208
|
+
&.c-menu-navigation__button--disabled:focus {
|
|
209
|
+
@apply bg-transparent;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
&.c-menu-navigation__button--has-selection {
|
|
213
|
+
@apply font-bold;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
{#- If an id 'prefix' is not passed, fall back to using the name attribute
|
|
2
|
+
instead. We need this for error messages and hints as well -#}
|
|
3
|
+
{% set idPrefix = params.idPrefix if params.idPrefix else "menu-nav-item" %}
|
|
4
|
+
|
|
5
|
+
{#- fieldset is false by default -#}
|
|
6
|
+
{% set hasFieldset = true if params.fieldset else false %}
|
|
7
|
+
|
|
8
|
+
{% set iconHtml %}
|
|
9
|
+
{#- The SVG needs `focusable="false"` so that Internet Explorer does not
|
|
10
|
+
treat it as an interactive element - without this it will be
|
|
11
|
+
'focusable' when using the keyboard to navigate. #}
|
|
12
|
+
<svg class="inline-block -mr-2 align-middle -my-px pointer-events-none" viewBox="0 0 96 96" aria-hidden="true" fill="currentColor" focusable="false" width="1.5em" height="1.5em"><g><path d="M46.71 58.037a1.823 1.823 0 002.581 0L62.048 45.28a1.823 1.823 0 00-1.29-3.113H35.243a1.823 1.823 0 00-1.291 3.113z"/></g></svg>
|
|
13
|
+
{% endset %}
|
|
14
|
+
|
|
15
|
+
{#- Capture the HTML so we can optionally nest it in a fieldset -#}
|
|
16
|
+
{% set innerHtml %}
|
|
17
|
+
<ul data-module="c-menu-navigation" class="flex flex-wrap gap-base">
|
|
18
|
+
{% for item in params.items %}
|
|
19
|
+
{% if item %}
|
|
20
|
+
{#- If the user explicitly sets an id, use this instead of the regular idPrefix -#}
|
|
21
|
+
{%- if item.id -%}
|
|
22
|
+
{%- set id = item.id -%}
|
|
23
|
+
{%- else -%}
|
|
24
|
+
{#- The first id should not have a number suffix so it's easy to link to from the error summary component -#}
|
|
25
|
+
{%- if loop.first -%}
|
|
26
|
+
{%- set id = idPrefix %}
|
|
27
|
+
{% else %}
|
|
28
|
+
{%- set id = idPrefix + "-" + loop.index -%}
|
|
29
|
+
{%- endif -%}
|
|
30
|
+
{%- endif -%}
|
|
31
|
+
{% set subId = "sub-" + id %}
|
|
32
|
+
<li class="relative">
|
|
33
|
+
{% if item.href %}
|
|
34
|
+
<a {%- if id %} id="{{ id }}"{% endif %} href="{{ item.href }}" class="c-menu-navigation__button {%- if item.disabled %} c-menu-navigation__button--disabled{% endif %} {%- if item.active %} c-menu-navigation__button--primary{% endif %} {%- if item.active %} c-menu-navigation__button--has-selection{% endif %} {%- if item.classes %} {{ item.classes }}{% endif %}" {%- if item.title %} title="{{ item.title }}"{% endif %}{%- if item.active %} aria-current="page"{% endif %} {% if item.disabled %} tabindex="-1"{% endif %} {% if item.target %} target="{{ item.target }}"{% endif %}{%- for attribute, value in item.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}>
|
|
35
|
+
<span class="inline-flex self-center max-w-xs align-middle truncate pointer-events-none">{{ item.html | safe if item.html else item.text }}</span>
|
|
36
|
+
</a>
|
|
37
|
+
{% else %}
|
|
38
|
+
<button {%- if item.sub %} aria-expanded="true" aria-controls="{{ id }}-sub-list"{% endif %}
|
|
39
|
+
{%- if id %} id="{{ id }}"{% endif %} class="c-menu-navigation__button {%- if item.disabled %} c-menu-navigation__button--disabled{% endif %} {%- if item.active %} c-menu-navigation__button--primary{% endif %} {%- if item.active %} c-menu-navigation__button--has-selection{% endif %} {%- if item.classes %} {{ item.classes }}{% endif %}" {%- if item.title %} title="{{ item.title }}"{% endif %} {% if item.disabled %} aria-disabled="true" tabindex="-1"{% endif %} {%- for attribute, value in item.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}>
|
|
40
|
+
<span class="inline-flex self-center max-w-xs align-middle truncate pointer-events-none">{{ item.html | safe if item.html else item.text }}</span>
|
|
41
|
+
{# Indentation is intentional to output HTML nicely #}
|
|
42
|
+
{{- iconHtml | safe | trim | indent(2, true) if iconHtml -}}
|
|
43
|
+
</button>
|
|
44
|
+
{% endif %}
|
|
45
|
+
{% if item.sub.items %}
|
|
46
|
+
<div class="c-menu-navigation__sub absolute bottom-0 left-0">
|
|
47
|
+
<ul id="{{ id }}-sub-list" class="{% if item.sub.classes %}{{ item.sub.classes }}{% else-%} c-menu-navigation__tooltip w-max max-w-64 border border-neutral-base shadow-md bg-white text-sm{% endif %}" {%- for attribute, value in item.sub.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}>
|
|
48
|
+
{% for subitem in item.sub.items %}
|
|
49
|
+
{% if subitem %}
|
|
50
|
+
{#- If the user explicitly sets an id, use this instead of the regular idPrefix -#}
|
|
51
|
+
{%- if subitem.id -%}
|
|
52
|
+
{%- set subId = subitem.id -%}
|
|
53
|
+
{%- else -%}
|
|
54
|
+
{#- The first id should not have a number suffix so it's easy to link to from the error summary component -#}
|
|
55
|
+
{%- if loop.first -%}
|
|
56
|
+
{%- set subId = "sub-" + id %}
|
|
57
|
+
{% else %}
|
|
58
|
+
{%- set subId = "sub-" + id + "-" + loop.index -%}
|
|
59
|
+
{%- endif -%}
|
|
60
|
+
{%- endif %}
|
|
61
|
+
{% set commonSubItemAttributes %}{% if subId %} id="{{ subId }}"{% endif %} {%- if subitem.title %} title="{{ subitem.title }}"{% endif %} {%- for attribute, value in subitem.attributes %} {{ attribute }}="{{ value }}"{% endfor %}{% endset %}
|
|
62
|
+
<li>
|
|
63
|
+
{% if subitem.href %}
|
|
64
|
+
{% if subitem.active %}
|
|
65
|
+
<span {%- if subitem.id %} id="{{ subId }}"{% endif %} class="flex items-center px-base py-sm text-sm font-semibold {%- if subitem.classes %} {{ subitem.classes }}{% endif -%}" aria-current="page" {{- commonSubItemAttributes | safe }}>
|
|
66
|
+
<strong>{{ subitem.html | safe if subitem.html else subitem.text }}</strong>
|
|
67
|
+
</span>
|
|
68
|
+
{% else %}
|
|
69
|
+
<a {%- if subitem.id %} id="{{ subId }}"{% endif %} href="{{ subitem.href }}" class="flex items-center px-base py-sm text-sm hover:bg-primary-base hover:text-white focus:bg-warning-base focus:outline-none focus:shadow-outline-focus focus:text-black{%- if subitem.classes %} {{ subitem.classes }}{% endif -%} {%- if subitem.disabled %} pointer-events-none{% endif -%}" {%- if subitem.disabled %} tabindex="-1"{% endif -%} {%- if subitem.target %} target="{{ subitem.target }}"{% endif %} {{- commonSubItemAttributes | safe }}>
|
|
70
|
+
{{ subitem.html | safe if subitem.html else subitem.text }}
|
|
71
|
+
{% if subitem.disabled %}
|
|
72
|
+
<svg viewBox="0 0 140 140" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg" class="inline-block align-middle ml-sm text-neutral-base fill-current" aria-hidden="true" focusable="false" ><path d="M70 0a70 70 0 1070 70A70.08 70.08 0 0070 0zM20 70a50 50 0 0174.8-43.4 2.51 2.51 0 011.23 1.84 2.48 2.48 0 01-.71 2.1L30.54 95.32a2.51 2.51 0 01-3.94-.52A49.63 49.63 0 0120 70zm100 0a50 50 0 01-74.8 43.4 2.51 2.51 0 01-1.23-1.84 2.48 2.48 0 01.71-2.1l64.78-64.78a2.51 2.51 0 013.94.52A49.63 49.63 0 01120 70z"/></svg>
|
|
73
|
+
{% endif %}
|
|
74
|
+
</a>
|
|
75
|
+
{% endif %}
|
|
76
|
+
{% else %}
|
|
77
|
+
<span {%- if subitem.id %} id="{{ subId }}"{% endif %} class="flex items-center px-base py-sm text-sm {%- if subitem.classes %} {{ subitem.classes }}{% endif %} {%- if subitem.active %} font-bold{% endif %} {%- if subitem.active %} font-bold{% endif %}" {%- if subitem.title %} title="{{ subitem.title }}"{% endif %} {%- if subitem.active %} aria-current="page"{% endif %} {%- if subitem.disabled %} aria-disabled="true" tabindex="-1"{% endif %} {%- for attribute, value in subitem.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}>
|
|
78
|
+
{% if subitem.active %}
|
|
79
|
+
<strong>{{ subitem.html | safe if subitem.html else subitem.text }}</strong>
|
|
80
|
+
{% else %}
|
|
81
|
+
{{ subitem.html | safe if subitem.html else subitem.text }}
|
|
82
|
+
{% endif %}
|
|
83
|
+
</span>
|
|
84
|
+
{% endif %}
|
|
85
|
+
</li>
|
|
86
|
+
{% if subitem.divider %}
|
|
87
|
+
<li class="my-sm border-b border-neutral-base">
|
|
88
|
+
<div class="sr-only">Separador</div>
|
|
89
|
+
</li>
|
|
90
|
+
{% endif %}
|
|
91
|
+
{% endif %}
|
|
92
|
+
{% endfor %}
|
|
93
|
+
</ul>
|
|
94
|
+
</div>
|
|
95
|
+
{% endif %}
|
|
96
|
+
</li>
|
|
97
|
+
{% if item.divider %}
|
|
98
|
+
<li {%- if item.divider.classes %} class="{{ item.divider.classes }}"{% endif %} role="presentation" aria-hidden="true">
|
|
99
|
+
{% if item.divider.html %}
|
|
100
|
+
{{ item.divider.html | safe }}
|
|
101
|
+
{% else %}
|
|
102
|
+
{{ item.divider.text }}
|
|
103
|
+
{% endif %}
|
|
104
|
+
</li>
|
|
105
|
+
{% endif %}
|
|
106
|
+
{% endif %}
|
|
107
|
+
{% endfor %}
|
|
108
|
+
</ul>
|
|
109
|
+
{% endset -%}
|
|
110
|
+
|
|
111
|
+
<!-- menu-navigation -->
|
|
112
|
+
<nav {%- if params.classes %} class="{{ params.classes }}"{% endif %}
|
|
113
|
+
{%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}>
|
|
114
|
+
{{ innerHtml | trim | safe }}
|
|
115
|
+
</nav>
|
|
116
|
+
<!-- /menu-navigation -->
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
params:
|
|
2
|
+
- name: idPrefix
|
|
3
|
+
type: string
|
|
4
|
+
required: false
|
|
5
|
+
description: String to prefix id for each item if no id is specified on each item.
|
|
6
|
+
- name: items
|
|
7
|
+
type: array
|
|
8
|
+
required: true
|
|
9
|
+
description: Array of nav items objects.
|
|
10
|
+
params:
|
|
11
|
+
- name: href
|
|
12
|
+
type: string
|
|
13
|
+
required: false
|
|
14
|
+
description: Item link.
|
|
15
|
+
- name: target
|
|
16
|
+
type: string
|
|
17
|
+
required: false
|
|
18
|
+
description: The target where the item should link to.
|
|
19
|
+
- name: text
|
|
20
|
+
type: string
|
|
21
|
+
required: true
|
|
22
|
+
description: If `html` is set, this is not required. Text to use within each nav item label. If `html` is provided, the `text` argument will be ignored.
|
|
23
|
+
- name: html
|
|
24
|
+
type: string
|
|
25
|
+
required: true
|
|
26
|
+
description: If `text` is set, this is not required. HTML to use within each nav item label. If `html` is provided, the `text` argument will be ignored.
|
|
27
|
+
- name: id
|
|
28
|
+
type: string
|
|
29
|
+
required: false
|
|
30
|
+
description: Specific id attribute for the item. If omitted, then idPrefix option will be applied.
|
|
31
|
+
- name: hint
|
|
32
|
+
type: object
|
|
33
|
+
required: false
|
|
34
|
+
description: Provide hint to each nav item.
|
|
35
|
+
isComponent: true
|
|
36
|
+
- name: expanded
|
|
37
|
+
type: boolean
|
|
38
|
+
required: false
|
|
39
|
+
description: If true, nav sub will be expanded.
|
|
40
|
+
- name: divider
|
|
41
|
+
type: object
|
|
42
|
+
required: false
|
|
43
|
+
description: Divider item that separates items.
|
|
44
|
+
- name: text
|
|
45
|
+
type: string
|
|
46
|
+
required: true
|
|
47
|
+
description: If `html` is set, this is not required. Text to use within the divider. If `html` is provided, the `text` argument will be ignored.
|
|
48
|
+
- name: html
|
|
49
|
+
type: string
|
|
50
|
+
required: true
|
|
51
|
+
description: If `text` is set, this is not required. HTML to use within the divider. If `html` is provided, the `text` argument will be ignored.
|
|
52
|
+
- name: sub
|
|
53
|
+
type: boolean
|
|
54
|
+
required: false
|
|
55
|
+
description: If true, content provided will be revealed when the item is expanded.
|
|
56
|
+
- name: sub.classes
|
|
57
|
+
type: string
|
|
58
|
+
required: false
|
|
59
|
+
description: Classes to add to the sub container.
|
|
60
|
+
- name: sub.items
|
|
61
|
+
type: array
|
|
62
|
+
required: false
|
|
63
|
+
description: Provide subitems for the sub reveal with same parameters as nav component, including divider.
|
|
64
|
+
- name: disabled
|
|
65
|
+
type: boolean
|
|
66
|
+
required: false
|
|
67
|
+
description: If true, nav will be disabled.
|
|
68
|
+
- name: classes
|
|
69
|
+
type: string
|
|
70
|
+
required: false
|
|
71
|
+
description: Classes to add to the item.
|
|
72
|
+
- name: attributes
|
|
73
|
+
type: object
|
|
74
|
+
required: false
|
|
75
|
+
description: HTML attributes (for example data attributes) to add to the item.
|
|
76
|
+
- name: classes
|
|
77
|
+
type: string
|
|
78
|
+
required: false
|
|
79
|
+
description: Classes to add to the nav container.
|
|
80
|
+
- name: attributes
|
|
81
|
+
type: object
|
|
82
|
+
required: false
|
|
83
|
+
description: HTML attributes (for example data attributes) to add to the nav container.
|
|
84
|
+
|
|
85
|
+
accessibilityCriteria: |
|
|
86
|
+
## sub reveals
|
|
87
|
+
Must:
|
|
88
|
+
- be visible as static content if JavaScript is unavailable or fails
|
|
89
|
+
- be hidden if JavaScript is available and is collapsed
|
|
90
|
+
- indicate if content is expanded or collapsed
|
|
91
|
+
- indicate that there is collapsed content to interact with
|
|
92
|
+
|
|
93
|
+
Note that alphagov have known issues against this criteria: https://github.com/alphagov/govuk_elements/issues/575
|
|
@@ -924,7 +924,7 @@
|
|
|
924
924
|
},
|
|
925
925
|
{
|
|
926
926
|
"name": "Header",
|
|
927
|
-
"description": "In special cases, a special fixed header with a menubar could be useful.",
|
|
927
|
+
"description": "In special cases, a special fixed header with a menubar could be useful. If you need a navigation menu with links, use the component Menu navigation instead.",
|
|
928
928
|
"data": {
|
|
929
929
|
"id": "header-items",
|
|
930
930
|
"idPrefix": "header-example",
|
|
@@ -82,6 +82,20 @@
|
|
|
82
82
|
@apply bg-primary-base;
|
|
83
83
|
@apply text-white;
|
|
84
84
|
@apply outline-none;
|
|
85
|
+
|
|
86
|
+
&[aria-checked="true"]{
|
|
87
|
+
&::before {
|
|
88
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cg transform='matrix(3.4285714285714284,0,0,3.4285714285714284,0,0)'%3E%3Cpath d='M4,12.5a2,2,0,0,1-1.55-.78L.25,9.23A1,1,0,0,1,.34,7.81a1,1,0,0,1,1.41.1l2.06,2.33a.21.21,0,0,0,.18.09.23.23,0,0,0,.18-.08l8.11-8.44a1,1,0,0,1,1.44,1.38l-8.2,8.63A1.94,1.94,0,0,1,4,12.5Z' style='fill: %23ffffff'%3E%3C/path%3E%3C/g%3E%3C/svg%3E");
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&[role="menuitemradio"] {
|
|
93
|
+
&[aria-checked="true"]{
|
|
94
|
+
&::before {
|
|
95
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cg transform='matrix(3.4285714285714284,0,0,3.4285714285714284,0,0)'%3E%3Ccircle cx='7' cy='7' r='7' style='fill: %23ffffff'%3E%3C/circle%3E%3C/g%3E%3C/svg%3E");
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
85
99
|
}
|
|
86
100
|
|
|
87
101
|
|
|
@@ -89,11 +103,14 @@
|
|
|
89
103
|
@apply font-bold;
|
|
90
104
|
|
|
91
105
|
&::before {
|
|
92
|
-
|
|
106
|
+
@apply bg-center bg-no-repeat bg-cover;
|
|
107
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cg transform='matrix(3.4285714285714284,0,0,3.4285714285714284,0,0)'%3E%3Cpath d='M4,12.5a2,2,0,0,1-1.55-.78L.25,9.23A1,1,0,0,1,.34,7.81a1,1,0,0,1,1.41.1l2.06,2.33a.21.21,0,0,0,.18.09.23.23,0,0,0,.18-.08l8.11-8.44a1,1,0,0,1,1.44,1.38l-8.2,8.63A1.94,1.94,0,0,1,4,12.5Z' style='fill: %23000000'%3E%3C/path%3E%3C/g%3E%3C/svg%3E");
|
|
108
|
+
content: '';
|
|
109
|
+
@apply w-3;
|
|
110
|
+
@apply h-3;
|
|
93
111
|
@apply absolute;
|
|
94
|
-
@apply top-
|
|
95
|
-
@apply left-
|
|
96
|
-
@apply p-sm;
|
|
112
|
+
@apply top-3;
|
|
113
|
+
@apply left-2;
|
|
97
114
|
}
|
|
98
115
|
}
|
|
99
116
|
}
|
|
@@ -101,7 +118,11 @@
|
|
|
101
118
|
[role="menuitemradio"] {
|
|
102
119
|
&[aria-checked="true"]{
|
|
103
120
|
&::before {
|
|
104
|
-
|
|
121
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cg transform='matrix(3.4285714285714284,0,0,3.4285714285714284,0,0)'%3E%3Ccircle cx='7' cy='7' r='7' style='fill: %23000000'%3E%3C/circle%3E%3C/g%3E%3C/svg%3E");
|
|
122
|
+
@apply w-1.5;
|
|
123
|
+
@apply h-1.5;
|
|
124
|
+
@apply top-4;
|
|
125
|
+
@apply left-3;
|
|
105
126
|
}
|
|
106
127
|
}
|
|
107
128
|
}
|
|
@@ -19,6 +19,28 @@
|
|
|
19
19
|
"isDismissible": true
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
|
+
{
|
|
23
|
+
"name": "isButtonLoader",
|
|
24
|
+
"description": "If an additional param in items called isButtonLoader is true, then a Button loader is used with this item.",
|
|
25
|
+
"data": {
|
|
26
|
+
"id": "button-loader-example",
|
|
27
|
+
"title": {
|
|
28
|
+
"text": "Aviso"
|
|
29
|
+
},
|
|
30
|
+
"description": {
|
|
31
|
+
"text": "Estamos realizando labores de mantenimiento en el sistema. Es posible que algunos procesos tarden más de lo esperado. Rogamos disculpas."
|
|
32
|
+
},
|
|
33
|
+
"itemsPrimary": [
|
|
34
|
+
{
|
|
35
|
+
"text": "De acuerdo, continuar",
|
|
36
|
+
"isButtonLoader": true,
|
|
37
|
+
"state": "is-loading",
|
|
38
|
+
"classes": "c-button-loader--primary c-button-loader--is-loading"
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
"isDismissible": true
|
|
42
|
+
}
|
|
43
|
+
},
|
|
22
44
|
{
|
|
23
45
|
"name": "with headingLevel 3",
|
|
24
46
|
"data": {
|
|
@@ -120,6 +142,46 @@
|
|
|
120
142
|
"classes": "max-w-4xl"
|
|
121
143
|
}
|
|
122
144
|
},
|
|
145
|
+
{
|
|
146
|
+
"name": "with many actions isButtonLoader",
|
|
147
|
+
"data": {
|
|
148
|
+
"id": "many-actions-is-button-loader-example",
|
|
149
|
+
"title": {
|
|
150
|
+
"text": "Aviso"
|
|
151
|
+
},
|
|
152
|
+
"description": {
|
|
153
|
+
"text": "Estamos realizando labores de mantenimiento en el sistema. Es posible que algunos procesos tarden más de lo esperado. Rogamos disculpas."
|
|
154
|
+
},
|
|
155
|
+
"itemsPrimary": [
|
|
156
|
+
{
|
|
157
|
+
"text": "Guardar cambios y publicar",
|
|
158
|
+
"isButtonLoader": true,
|
|
159
|
+
"state": "is-success",
|
|
160
|
+
"classes": "c-button-loader--primary c-button-loader--is-success"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"text": "Guardar cambios",
|
|
164
|
+
"isButtonLoader": true
|
|
165
|
+
}
|
|
166
|
+
],
|
|
167
|
+
"itemsSecondary": [
|
|
168
|
+
{
|
|
169
|
+
"text": "Más información",
|
|
170
|
+
"isButtonLoader": true,
|
|
171
|
+
"state": "is-loading",
|
|
172
|
+
"classes": "c-button-loader--transparent c-button-loader--is-loading"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"html": 'Cancelar <span class="sr-only">y cerrar la ventana modal</span>',
|
|
176
|
+
"isButtonLoader": true,
|
|
177
|
+
"state": "is-success",
|
|
178
|
+
"classes": "c-button-loader--is-success"
|
|
179
|
+
}
|
|
180
|
+
],
|
|
181
|
+
"isDismissible": true,
|
|
182
|
+
"classes": "max-w-4xl"
|
|
183
|
+
}
|
|
184
|
+
},
|
|
123
185
|
{
|
|
124
186
|
"name": "with icon type delete",
|
|
125
187
|
"data": {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
{% from "components/button/_macro.button.njk" import componentButton %}
|
|
2
|
+
{% from "components/button-loader/_macro.button-loader.njk" import componentButtonLoader %}
|
|
2
3
|
|
|
3
4
|
{% set labelledId = 'label-' + params.id %}
|
|
4
5
|
|
|
@@ -65,13 +66,21 @@
|
|
|
65
66
|
<ul class="flex flex-wrap gap-sm">
|
|
66
67
|
{% for item in params.itemsPrimary %}
|
|
67
68
|
<li>
|
|
68
|
-
{
|
|
69
|
+
{% if item.isButtonLoader %}
|
|
70
|
+
{{ componentButtonLoader(item) }}
|
|
71
|
+
{% else %}
|
|
72
|
+
{{ componentButton(item) }}
|
|
73
|
+
{% endif %}
|
|
69
74
|
</li>
|
|
70
75
|
{% endfor %}
|
|
71
76
|
</ul>
|
|
72
77
|
{% else %}
|
|
73
78
|
<div class="mt-sm">
|
|
74
|
-
{
|
|
79
|
+
{% if params.itemsPrimary[0].isButtonLoader %}
|
|
80
|
+
{{ componentButtonLoader(params.itemsPrimary[0]) }}
|
|
81
|
+
{% else %}
|
|
82
|
+
{{ componentButton(params.itemsPrimary[0]) }}
|
|
83
|
+
{% endif %}
|
|
75
84
|
</div>
|
|
76
85
|
{% endif %}
|
|
77
86
|
{% endif %}
|
|
@@ -80,13 +89,21 @@
|
|
|
80
89
|
<ul class="flex flex-wrap gap-sm">
|
|
81
90
|
{% for item in params.itemsSecondary %}
|
|
82
91
|
<li>
|
|
83
|
-
{
|
|
92
|
+
{% if item.isButtonLoader %}
|
|
93
|
+
{{ componentButtonLoader(item) }}
|
|
94
|
+
{% else %}
|
|
95
|
+
{{ componentButton(item) }}
|
|
96
|
+
{% endif %}
|
|
84
97
|
</li>
|
|
85
98
|
{% endfor %}
|
|
86
99
|
</ul>
|
|
87
100
|
{% else %}
|
|
88
101
|
<div class="mt-sm">
|
|
89
|
-
{
|
|
102
|
+
{% if params.itemsSecondary[0].isButtonLoader %}
|
|
103
|
+
{{ componentButtonLoader(params.itemsSecondary[0]) }}
|
|
104
|
+
{% else %}
|
|
105
|
+
{{ componentButton(params.itemsSecondary[0]) }}
|
|
106
|
+
{% endif %}
|
|
90
107
|
</div>
|
|
91
108
|
{% endif %}
|
|
92
109
|
{% endif %}
|
|
@@ -38,11 +38,11 @@ params:
|
|
|
38
38
|
- name: itemsPrimary
|
|
39
39
|
type: array
|
|
40
40
|
required: false
|
|
41
|
-
description: This is a list of primary action buttons (see button component params) placed left side from secondary items or centered if are alone.
|
|
41
|
+
description: This is a list of primary action buttons (see button component params) placed left side from secondary items or centered if are alone. If additional item param `isButtonLoader` is `true` then a ButtonLoader component will be used.
|
|
42
42
|
- name: itemsSecondary
|
|
43
43
|
type: array
|
|
44
44
|
required: false
|
|
45
|
-
description: This is a list of secondary action buttons (see button component params) placed right side from primary items or centered if are alone.
|
|
45
|
+
description: This is a list of secondary action buttons (see button component params) placed right side from primary items or centered if are alone. If additional item param `isButtonLoader` is `true` then a ButtonLoader component will be used.
|
|
46
46
|
- name: icon
|
|
47
47
|
type: object
|
|
48
48
|
required: false
|
|
@@ -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"
|
|
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"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
45
56
|
{
|
|
46
57
|
"name": "small",
|
|
47
58
|
"data": {
|