desy-html 8.0.0 → 8.1.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/docs/index.html +9 -0
- package/package.json +1 -1
- package/src/js/aria/checkBoxes.js +11 -1
- package/src/js/aria/treeitem.js +6 -0
- package/src/js/globals/get-nunjucks-code-from-example.js +1 -1
- package/src/templates/components/checkboxes/_template.checkboxes.njk +1 -1
- package/src/templates/components/menu-horizontal/_examples.menu-horizontal.njk +2 -2
- package/src/templates/components/menu-horizontal/_styles.menu-horizontal.css +10 -0
- package/src/templates/components/searchbar/_examples.searchbar.njk +2 -2
- package/src/templates/components/searchbar/_template.searchbar.njk +1 -1
- package/src/templates/components/tree/_template.tree.njk +1 -1
package/docs/index.html
CHANGED
|
@@ -38,6 +38,15 @@
|
|
|
38
38
|
|
|
39
39
|
<h2>Changelog (English)</h2>
|
|
40
40
|
<p>What's new in the latest version of desy-html</p>
|
|
41
|
+
<h3>v.8.1.0</h3>
|
|
42
|
+
<ul class="text-sm">
|
|
43
|
+
<li>Added a new modifier class in Menu horizontal to show scroll in mobile.</li>
|
|
44
|
+
<li>Bug fixes.</li>
|
|
45
|
+
</ul>
|
|
46
|
+
<h3>v.8.0.1</h3>
|
|
47
|
+
<ul class="text-sm">
|
|
48
|
+
<li>Fixed a bug in examples Nunjucks code.</li>
|
|
49
|
+
</ul>
|
|
41
50
|
<h3>v.8.0.0</h3>
|
|
42
51
|
<ul class="text-sm">
|
|
43
52
|
<li>Improved indentation in examples.</li>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "desy-html",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.1.0",
|
|
4
4
|
"description": "desy-html contains the code you need to start building a user interface for Gobierno de Aragón government webapps.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Desy (SDA Servicios Digitales de Aragón)",
|
|
@@ -6,6 +6,10 @@ export function CheckBox(aria) {
|
|
|
6
6
|
this.rootEl.querySelectorAll('.c-checkboxes__conditional').forEach(item => {
|
|
7
7
|
item.addEventListener('click', this.toggleConditional.bind(this))
|
|
8
8
|
})
|
|
9
|
+
|
|
10
|
+
this.rootEl.querySelectorAll('.c-checkboxes__indeterminate-active').forEach(item => {
|
|
11
|
+
this.toggleIndeterminate(item, true)
|
|
12
|
+
})
|
|
9
13
|
}
|
|
10
14
|
|
|
11
15
|
toggleConditional(event) {
|
|
@@ -24,11 +28,17 @@ export function CheckBox(aria) {
|
|
|
24
28
|
})
|
|
25
29
|
}
|
|
26
30
|
}
|
|
31
|
+
|
|
32
|
+
toggleIndeterminate(event) {
|
|
33
|
+
const selectInput = event.querySelector('input');
|
|
34
|
+
selectInput.readOnly = true
|
|
35
|
+
selectInput.indeterminate = true
|
|
36
|
+
}
|
|
27
37
|
}
|
|
28
38
|
|
|
29
39
|
const checkBoxesElements = document.querySelectorAll('[data-module="c-checkboxes"]');
|
|
30
40
|
checkBoxesElements.forEach((checkBoxElement) => {
|
|
31
|
-
if (checkBoxElement.querySelector('.c-checkboxes__conditional')) {
|
|
41
|
+
if (checkBoxElement.querySelector('.c-checkboxes__conditional') || checkBoxElement.querySelector('.c-checkboxes__indeterminate-active')) {
|
|
32
42
|
new CheckBox(checkBoxElement);
|
|
33
43
|
}
|
|
34
44
|
});
|
package/src/js/aria/treeitem.js
CHANGED
|
@@ -95,6 +95,12 @@ export function Treeitem(aria) {
|
|
|
95
95
|
this.domNode.addEventListener('mouseover', this.handleMouseOver.bind(this));
|
|
96
96
|
this.domNode.addEventListener('mouseout', this.handleMouseOut.bind(this));
|
|
97
97
|
}
|
|
98
|
+
|
|
99
|
+
const getCheckboxes = document.querySelectorAll('.c-checkboxes__indeterminate-active');
|
|
100
|
+
Array.from(getCheckboxes).forEach((checkbox) => {
|
|
101
|
+
checkbox.readOnly = true
|
|
102
|
+
checkbox.indeterminate = true
|
|
103
|
+
});
|
|
98
104
|
};
|
|
99
105
|
|
|
100
106
|
aria.Treeitem.prototype.isExpanded = function () {
|
|
@@ -12,7 +12,7 @@ function getNunjucksCodeFromExample (componentName, params, pathName) {
|
|
|
12
12
|
const macroName = kebabCaseToPascalCase(componentName)
|
|
13
13
|
|
|
14
14
|
return outdent`
|
|
15
|
-
{% from "${pathName}s/${componentName}/
|
|
15
|
+
{% from "${pathName}s/${componentName}/_macro.${componentName}.njk" import ${pathName}${macroName} %}
|
|
16
16
|
|
|
17
17
|
{{ ${pathName}${macroName}(${
|
|
18
18
|
JSON.stringify(params, undefined, 2)
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
{% set itemHintId = id + "-item-hint" if hasHint else "" %}
|
|
73
73
|
{% set itemDescribedBy = describedBy if not hasFieldset else "" %}
|
|
74
74
|
{% set itemDescribedBy = (itemDescribedBy + " " + itemHintId) %}
|
|
75
|
-
<div class="{%- if params.hasDividers %} border-t border-b border-neutral-base -mb-px{% endif %} {%- if item.classes %} {{ item.classes }}{% endif %} {%- if item.conditional.html %} c-checkboxes__conditional{% endif %} {%- if item.checked %} c-checkboxes__conditional-active {% else %} c-checkboxes__conditional-hidden{% endif %}">
|
|
75
|
+
<div class="{%- if params.hasDividers %} border-t border-b border-neutral-base -mb-px{% endif %} {%- if item.classes %} {{ item.classes }}{% endif %} {%- if item.conditional.html %} c-checkboxes__conditional{% endif %} {%- if item.checked %} c-checkboxes__conditional-active {%- elif item.isIndeterminate and not item.indeterminateChecked %} c-checkboxes__indeterminate {%- elif item.isIndeterminate and item.indeterminateChecked %} c-checkboxes__indeterminate c-checkboxes__indeterminate-active {% else %} c-checkboxes__conditional-hidden{% endif %}">
|
|
76
76
|
<div class="relative flex items-start py-base">
|
|
77
77
|
<div class="flex items-center mx-sm">
|
|
78
78
|
<input class="w-6 h-6 transition duration-150 ease-in-out border-black focus:border-black focus:shadow-outline-focus-input focus:ring-4 focus:ring-offset-0 focus:ring-warning-base disabled:bg-neutral-base disabled:border-neutral-base text-primary-base" id="{{ id }}" name="{{ name }}" type="checkbox" value="{{ item.value }}"
|
|
@@ -163,9 +163,9 @@
|
|
|
163
163
|
},
|
|
164
164
|
{
|
|
165
165
|
"name": "con clases aplicadas: tabs en móvil",
|
|
166
|
-
"description": '
|
|
166
|
+
"description": 'Clases modificadoras aplicadas: <code>.c-menu-horizontal--tabs-mobile</code> y <code>.c-menu-horizontal--scroll</code>',
|
|
167
167
|
"data": {
|
|
168
|
-
"classes": "c-menu-horizontal--tabs-mobile",
|
|
168
|
+
"classes": "c-menu-horizontal--tabs-mobile c-menu-horizontal--scroll",
|
|
169
169
|
"items": [
|
|
170
170
|
{
|
|
171
171
|
"href": "#",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"type": "submit",
|
|
78
78
|
"classes": "c-button--primary ml-sm"
|
|
79
79
|
},
|
|
80
|
-
"classes": "flex-1
|
|
80
|
+
"classes": "flex-1"
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
83
|
{
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"type": "submit",
|
|
94
94
|
"classes": "c-button--sm ml-sm"
|
|
95
95
|
},
|
|
96
|
-
"classes": "flex-1
|
|
96
|
+
"classes": "flex-1 c-input--sm"
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
] %}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
for: params.id
|
|
19
19
|
}) }}
|
|
20
20
|
<div class="relative {%- if params.button %} flex flex-wrap items-end{% endif %}">
|
|
21
|
-
<input class="c-input block
|
|
21
|
+
<input class="c-input block 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 %} pr-12 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 %}
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<div class="{%- if params.hasDividers %} border-t border-b border-neutral-base -mb-px{% endif %} {%- if item.classes %} {{ item.classes }}{% endif %}">
|
|
30
30
|
<div class="relative flex items-start py-xs">
|
|
31
31
|
<div class="flex items-center mx-sm">
|
|
32
|
-
<input class="w-6 h-6 transition duration-150 ease-in-out border-black focus:border-black focus:shadow-outline-focus-input focus:ring-4 focus:ring-offset-0 focus:ring-warning-base disabled:bg-neutral-base disabled:border-neutral-base text-primary-base" id="{{ id }}-input" name="{{ name }}" {%- if type == 'checkbox' %} type="checkbox"{% else %} type="radio"{% endif %} value="{{ item.value }}"
|
|
32
|
+
<input class="w-6 h-6 transition duration-150 ease-in-out border-black focus:border-black focus:shadow-outline-focus-input focus:ring-4 focus:ring-offset-0 focus:ring-warning-base disabled:bg-neutral-base disabled:border-neutral-base text-primary-base {%- if item.isIndeterminate and item.indeterminateChecked %} c-checkboxes__indeterminate-active {% endif %}" id="{{ id }}-input" name="{{ name }}" {%- if type == 'checkbox' %} type="checkbox"{% else %} type="radio"{% endif %} value="{{ item.value }}"
|
|
33
33
|
{{-" checked" if item.checked }}
|
|
34
34
|
{{-" disabled" if item.disabled }}
|
|
35
35
|
{%- if itemDescribedBy %} aria-describedby="{{ itemDescribedBy }}"{% endif -%}
|