@ons/design-system 54.0.1 → 55.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/components/access-code/_macro.njk +3 -3
- package/components/accordion/_macro.njk +1 -1
- package/components/address-input/_macro.njk +7 -7
- package/components/address-output/_macro.njk +7 -7
- package/components/autosuggest/_macro.njk +19 -19
- package/components/breadcrumbs/_macro.njk +3 -3
- package/components/browser-banner/_macro.njk +1 -1
- package/components/browser-banner/_macro.spec.js +31 -0
- package/components/button/_button.scss +21 -7
- package/components/button/_macro.njk +25 -25
- package/components/button/_macro.spec.js +2 -2
- package/components/call-to-action/_macro.njk +1 -1
- package/components/card/_macro.njk +10 -10
- package/components/checkboxes/_checkbox-macro.njk +9 -9
- package/components/checkboxes/_checkbox.scss +43 -10
- package/components/checkboxes/_macro.njk +10 -10
- package/components/checkboxes/checkbox-with-fieldset.js +6 -5
- package/components/checkboxes/checkboxes.dom.js +6 -9
- package/components/code-highlight/_macro.njk +1 -1
- package/components/collapsible/_collapsible.scss +2 -1
- package/components/collapsible/_macro.njk +7 -7
- package/components/date-input/_macro.njk +5 -5
- package/components/document-list/_macro.njk +29 -29
- package/components/document-list/document-list.scss +2 -0
- package/components/download-resources/download-resources.js +19 -0
- package/components/download-resources/download-resources.spec.js +95 -0
- package/components/duration/_macro.njk +9 -9
- package/components/duration/_macro.spec.js +0 -3
- package/components/error/_macro.njk +1 -1
- package/components/external-link/_macro.njk +2 -2
- package/components/external-link/_macro.spec.js +2 -2
- package/components/feedback/_macro.njk +2 -2
- package/components/field/_macro.njk +5 -5
- package/components/fieldset/_fieldset.scss +11 -1
- package/components/fieldset/_macro.njk +15 -14
- package/components/fieldset/_macro.spec.js +27 -5
- package/components/footer/_footer.scss +1 -0
- package/components/footer/_macro.njk +18 -18
- package/components/footer/_macro.spec.js +18 -0
- package/components/header/_header.scss +7 -2
- package/components/header/_macro.njk +63 -37
- package/components/header/_macro.spec.js +82 -14
- package/components/hero/_macro.njk +16 -16
- package/components/hero/_macro.spec.js +1 -1
- package/components/icons/_macro.njk +2 -2
- package/components/images/_macro.njk +3 -3
- package/components/input/_input-type.scss +7 -0
- package/components/input/_input.scss +13 -2
- package/components/input/_macro.njk +40 -34
- package/components/input/_macro.spec.js +64 -59
- package/components/label/_label.scss +1 -1
- package/components/label/_macro.njk +27 -15
- package/components/label/_macro.spec.js +31 -0
- package/components/language-selector/_macro.njk +1 -1
- package/components/lists/_macro.njk +22 -22
- package/components/lists/_macro.spec.js +2 -2
- package/components/message/_macro.njk +6 -6
- package/components/message/_message.scss +1 -0
- package/components/message-list/_macro.njk +1 -1
- package/components/metadata/_macro.njk +2 -2
- package/components/modal/_macro.njk +6 -6
- package/components/modal/_modal.scss +10 -9
- package/components/mutually-exclusive/_macro.njk +1 -1
- package/components/mutually-exclusive/mutually-exclusive.js +3 -1
- package/components/navigation/_macro.njk +9 -10
- package/components/navigation/_macro.spec.js +0 -1
- package/components/pagination/_macro.njk +3 -3
- package/components/pagination/_pagination.scss +1 -0
- package/components/panel/_macro.njk +38 -43
- package/components/panel/_macro.spec.js +24 -33
- package/components/panel/_panel.scss +13 -5
- package/components/phase-banner/_macro.njk +1 -1
- package/components/phase-banner/_macro.spec.js +31 -0
- package/components/phase-banner/_phase-banner.scss +1 -0
- package/components/promotional-banner/_macro.njk +2 -2
- package/components/question/_macro.njk +18 -18
- package/components/quote/_macro.njk +2 -2
- package/components/radios/_macro.njk +8 -8
- package/components/radios/_radio.scss +15 -3
- package/components/radios/check-radios.js +5 -1
- package/components/related-content/_macro.njk +2 -2
- package/components/relationships/_macro.njk +2 -2
- package/components/reply/_macro.njk +2 -2
- package/components/section-navigation/_macro.njk +2 -2
- package/components/select/_macro.njk +8 -8
- package/components/share-page/_macro.njk +2 -2
- package/components/skip-to-content/_skip.scss +2 -1
- package/components/status/_macro.njk +2 -2
- package/components/summary/_macro.njk +25 -25
- package/components/table/_macro.njk +13 -12
- package/components/table/_macro.spec.js +0 -27
- package/components/table/_table.scss +13 -6
- package/components/table/sortable-table.js +1 -0
- package/components/table-of-contents/_macro.njk +4 -4
- package/components/tabs/_tabs.scss +5 -3
- package/components/textarea/_macro.njk +8 -8
- package/components/timeline/_macro.njk +1 -1
- package/components/video/_macro.njk +1 -1
- package/css/census.css +1 -1
- package/css/ids.css +1 -1
- package/css/main.css +1 -1
- package/layout/_template.njk +57 -44
- package/package.json +1 -1
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- package/scss/base/_global.scss +1 -0
- package/scss/overrides/hcm.scss +205 -46
- package/scss/patternlib.scss +1 -0
|
@@ -9,12 +9,11 @@ $checkbox-padding: 11px;
|
|
|
9
9
|
|
|
10
10
|
&__input {
|
|
11
11
|
appearance: none;
|
|
12
|
-
background: url(#{$static}/img/icons--check.svg) no-repeat center center;
|
|
13
12
|
background-color: $color-input-bg;
|
|
14
|
-
background-size: 0;
|
|
15
13
|
border: 2px solid $color-input-border;
|
|
16
14
|
border-radius: 0.2rem;
|
|
17
15
|
box-sizing: border-box;
|
|
16
|
+
cursor: pointer;
|
|
18
17
|
height: $checkbox-input-width;
|
|
19
18
|
left: $checkbox-padding;
|
|
20
19
|
position: absolute;
|
|
@@ -22,13 +21,30 @@ $checkbox-padding: 11px;
|
|
|
22
21
|
width: $checkbox-input-width;
|
|
23
22
|
z-index: 1;
|
|
24
23
|
|
|
24
|
+
// Check icon
|
|
25
|
+
&::after {
|
|
26
|
+
border: solid $color-input-border;
|
|
27
|
+
border-radius: 1px;
|
|
28
|
+
border-top-color: $color-input-bg;
|
|
29
|
+
border-width: 0 0 3px 3px;
|
|
30
|
+
box-sizing: border-box;
|
|
31
|
+
content: '';
|
|
32
|
+
height: 7px;
|
|
33
|
+
left: 2px;
|
|
34
|
+
opacity: 0;
|
|
35
|
+
position: absolute;
|
|
36
|
+
top: 4px;
|
|
37
|
+
transform: rotate(-45deg);
|
|
38
|
+
width: 14px;
|
|
39
|
+
}
|
|
40
|
+
|
|
25
41
|
&:focus,
|
|
26
42
|
&:checked {
|
|
27
43
|
outline: none;
|
|
28
44
|
}
|
|
29
45
|
|
|
30
|
-
&:checked {
|
|
31
|
-
|
|
46
|
+
&:checked::after {
|
|
47
|
+
opacity: 1;
|
|
32
48
|
}
|
|
33
49
|
|
|
34
50
|
&:disabled {
|
|
@@ -36,9 +52,24 @@ $checkbox-padding: 11px;
|
|
|
36
52
|
cursor: not-allowed;
|
|
37
53
|
}
|
|
38
54
|
|
|
39
|
-
&:disabled
|
|
40
|
-
color: $color-
|
|
55
|
+
&:disabled:checked::after {
|
|
56
|
+
border-color: $color-border-disabled;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&:disabled + .ons-checkbox__label,
|
|
60
|
+
&:disabled:checked + .ons-checkbox__label {
|
|
61
|
+
color: $color-border-disabled;
|
|
41
62
|
cursor: not-allowed;
|
|
63
|
+
|
|
64
|
+
&::before {
|
|
65
|
+
border: 1px solid $color-border-disabled;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&:disabled:checked + .ons-checkbox__label {
|
|
70
|
+
&::before {
|
|
71
|
+
box-shadow: 0 0 0 1px $color-border-disabled;
|
|
72
|
+
}
|
|
42
73
|
}
|
|
43
74
|
}
|
|
44
75
|
|
|
@@ -47,9 +78,9 @@ $checkbox-padding: 11px;
|
|
|
47
78
|
padding: 0 0 0 1.85rem;
|
|
48
79
|
|
|
49
80
|
&::before {
|
|
50
|
-
background: none;
|
|
51
|
-
border: none;
|
|
52
|
-
box-shadow: none;
|
|
81
|
+
background: none !important;
|
|
82
|
+
border: none !important;
|
|
83
|
+
box-shadow: none !important;
|
|
53
84
|
}
|
|
54
85
|
|
|
55
86
|
& > .ons-checkbox__label--with-description {
|
|
@@ -69,6 +100,7 @@ $checkbox-padding: 11px;
|
|
|
69
100
|
background: none;
|
|
70
101
|
border: none;
|
|
71
102
|
box-shadow: none;
|
|
103
|
+
outline: none;
|
|
72
104
|
}
|
|
73
105
|
}
|
|
74
106
|
|
|
@@ -153,6 +185,7 @@ $checkbox-padding: 11px;
|
|
|
153
185
|
&__input:checked + &__label::before {
|
|
154
186
|
background: $color-grey-5;
|
|
155
187
|
box-shadow: 0 0 0 1px $color-input-border;
|
|
188
|
+
outline: 1px solid transparent; // Add transparent outline because Windows High Contrast Mode doesn't show box-shadows
|
|
156
189
|
}
|
|
157
190
|
|
|
158
191
|
.ons-panel--error .ons-radio__input:checked ~ &__other > .ons-input--text:required:not(:focus) {
|
|
@@ -176,7 +209,7 @@ $checkbox-padding: 11px;
|
|
|
176
209
|
&--toggle & {
|
|
177
210
|
&__input {
|
|
178
211
|
left: 0;
|
|
179
|
-
top: 0.
|
|
212
|
+
top: 0.2rem;
|
|
180
213
|
|
|
181
214
|
&:focus {
|
|
182
215
|
@extend %ons-input-focus;
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
<p class="ons-checkboxes__label{{ " " + params.checkboxesLabelClasses if params.checkboxesLabelClasses }}">{{ params.checkboxesLabel }}</p>
|
|
9
9
|
{% set hasOther = false %}
|
|
10
10
|
{% for checkbox in params.checkboxes %}
|
|
11
|
-
{% if checkbox.other
|
|
11
|
+
{% if checkbox.other %}
|
|
12
12
|
{% set hasOther = true %}
|
|
13
13
|
{% endif %}
|
|
14
14
|
{% endfor %}
|
|
15
|
-
{% if hasOther == false and params.autoSelect
|
|
15
|
+
{% if hasOther == false and params.autoSelect and params.autoSelect.selectAllText %}
|
|
16
16
|
{% set btnClasses = ['small', 'secondary'] %}
|
|
17
|
-
{% if params.borderlessParent
|
|
17
|
+
{% if params.borderlessParent == false %}
|
|
18
18
|
{% set btnClasses = ['small', 'secondary', 'ghost-dark'] %}
|
|
19
19
|
{% endif %}
|
|
20
20
|
{{
|
|
@@ -33,19 +33,19 @@
|
|
|
33
33
|
{% for checkbox in params.checkboxes %}
|
|
34
34
|
{% set childIsChecked = false %}
|
|
35
35
|
{% set labelHTML = checkbox.label.text %}
|
|
36
|
-
{% if params.mutuallyExclusive
|
|
36
|
+
{% if params.mutuallyExclusive %}
|
|
37
37
|
{% set exclusiveClass = ' ons-js-exclusive-group-item' %}
|
|
38
38
|
{% endif %}
|
|
39
|
-
{% if params.borderless
|
|
39
|
+
{% if params.borderless %}
|
|
40
40
|
{% set borderless = " ons-checkbox--no-border" %}
|
|
41
41
|
{% endif %}
|
|
42
|
-
{% if checkbox.other
|
|
42
|
+
{% if checkbox.other %}
|
|
43
43
|
{% set otherClass = " ons-js-other" %}
|
|
44
|
-
{% if checkbox.other.selectAllChildren
|
|
44
|
+
{% if checkbox.other.selectAllChildren == true %}
|
|
45
45
|
{% set otherClass = otherClass + " ons-js-select-all-children" %}
|
|
46
46
|
{% endif %}
|
|
47
47
|
{% for otherCheckbox in checkbox.other.checkboxes %}
|
|
48
|
-
{% if otherCheckbox.checked
|
|
48
|
+
{% if otherCheckbox.checked %}
|
|
49
49
|
{% set childIsChecked = true %}
|
|
50
50
|
{% endif %}
|
|
51
51
|
{% endfor %}
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"attributes": checkbox.attributes
|
|
70
70
|
} %}
|
|
71
71
|
|
|
72
|
-
{% if checkbox.other
|
|
72
|
+
{% if checkbox.other %}
|
|
73
73
|
{% set config = config | setAttributes({
|
|
74
74
|
"other": {
|
|
75
75
|
"open": checkbox.other.open | default(false),
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
</div>
|
|
104
104
|
{% endset %}
|
|
105
105
|
|
|
106
|
-
{% if params.mutuallyExclusive
|
|
106
|
+
{% if params.mutuallyExclusive %}
|
|
107
107
|
{% call onsMutuallyExclusive({
|
|
108
108
|
"id": params.id,
|
|
109
109
|
"classes": params.classes,
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
export default class CheckboxWithFieldset {
|
|
2
|
-
constructor(fieldset,
|
|
2
|
+
constructor(fieldset, checkboxes) {
|
|
3
3
|
this.fieldset = fieldset;
|
|
4
|
-
this.
|
|
4
|
+
this.checkboxes = checkboxes;
|
|
5
|
+
this.fieldsetParent = fieldset.closest('.ons-checkbox');
|
|
6
|
+
this.selectAllChildrenInput = this.fieldsetParent.querySelector('.ons-js-select-all-children');
|
|
5
7
|
this.childInputs = [...this.fieldset.querySelectorAll('input')];
|
|
6
|
-
this.selectAllChildrenInput = this.inputs.find(input => input.classList.contains('ons-js-select-all-children'));
|
|
7
8
|
|
|
8
9
|
if (this.selectAllChildrenInput) {
|
|
9
10
|
this.selectAllChildrenInput.addEventListener('change', this.checkChildInputsOnSelect.bind(this));
|
|
10
11
|
} else {
|
|
11
|
-
this.
|
|
12
|
+
this.checkboxes.forEach(checkbox => checkbox.addEventListener('change', this.uncheckChildInputsOnDeselect.bind(this)));
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
15
|
|
|
@@ -19,7 +20,7 @@ export default class CheckboxWithFieldset {
|
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
uncheckChildInputsOnDeselect() {
|
|
22
|
-
const isOther = this.
|
|
23
|
+
const isOther = this.checkboxes.find(checkbox => checkbox.classList.contains('ons-js-other'));
|
|
23
24
|
if (isOther && isOther.checked === false) {
|
|
24
25
|
this.childInputs.forEach(input => {
|
|
25
26
|
input.checked = false;
|
|
@@ -15,16 +15,13 @@ domready(async () => {
|
|
|
15
15
|
new CheckCheckbox(checkboxInput, openOther);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
20
|
-
const
|
|
21
|
-
const otherFieldset = other.parentNode.querySelector('.ons-js-other-fieldset');
|
|
18
|
+
const otherFieldsets = [...document.querySelectorAll('.ons-js-other-fieldset')];
|
|
19
|
+
if (otherFieldsets) {
|
|
20
|
+
const CheckboxWithInnerFieldset = (await import('./checkbox-with-fieldset')).default;
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
new CheckboxWithInnerFieldset(otherFieldset, checkboxes, selectAllChildrenInput);
|
|
27
|
-
}
|
|
22
|
+
otherFieldsets.forEach(otherFieldset => {
|
|
23
|
+
new CheckboxWithInnerFieldset(otherFieldset, checkboxes);
|
|
24
|
+
});
|
|
28
25
|
}
|
|
29
26
|
|
|
30
27
|
const autoSelectButtons = [...document.querySelectorAll('.ons-js-auto-selector')];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{% macro onsCodeHighlight(params) %}
|
|
2
2
|
<pre class="ons-patternlib-example__pre">{#
|
|
3
|
-
#}<code class="ons-patternlib-example__code ons-language-{{ params.language if params.language
|
|
3
|
+
#}<code class="ons-patternlib-example__code ons-language-{{ params.language if params.language else 'markup' }}">{{ params.code }}</code>{#
|
|
4
4
|
#}</pre>
|
|
5
5
|
{% endmacro %}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{% macro onsCollapsible(params) %}
|
|
2
2
|
<details
|
|
3
3
|
id="{{ params.id }}"
|
|
4
|
-
class="ons-collapsible ons-js-collapsible{% if params.isAccordion
|
|
5
|
-
{% if params.group
|
|
6
|
-
{% if params.attributes
|
|
7
|
-
{% if params.saveState
|
|
8
|
-
{% if params.open
|
|
4
|
+
class="ons-collapsible ons-js-collapsible{% if params.isAccordion %} ons-collapsible--accordion{% endif %}{% if params.classes %} {{ params.classes }}{% endif %}"
|
|
5
|
+
{% if params.group %} data-group="{{ params.group }}"{% endif %}
|
|
6
|
+
{% if params.attributes %}{% for attribute, value in (params.attributes.items() if params.attributes is mapping and params.attributes.items else params.attributes) %}{{ attribute }}{% if value %}="{{ value }}"{% endif %} {% endfor %}{% endif %}
|
|
7
|
+
{% if params.saveState %} data-save-state="true"{% endif %}
|
|
8
|
+
{% if params.open %} data-open="true"{% endif %}
|
|
9
9
|
>
|
|
10
10
|
<summary
|
|
11
11
|
class="ons-collapsible__heading ons-js-collapsible-heading"
|
|
12
|
-
{% if params.headingAttributes
|
|
12
|
+
{% if params.headingAttributes %}{% for attribute, value in (params.headingAttributes.items() if params.headingAttributes is mapping and params.headingAttributes.items else params.headingAttributes) %}{{ attribute }}{% if value %}="{{ value }}"{% endif %} {% endfor %}{% endif %}
|
|
13
13
|
>
|
|
14
14
|
{% set titleTag = params.titleTag | default("h2") %}
|
|
15
15
|
<{{ titleTag }} class="ons-collapsible__title">{{ params.title }}</{{ titleTag }}>
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
}}</span>
|
|
23
23
|
</summary>
|
|
24
24
|
<div id="{{ params.id }}-content" class="ons-collapsible__content ons-js-collapsible-content"
|
|
25
|
-
{% if params.contentAttributes
|
|
25
|
+
{% if params.contentAttributes %}{% for attribute, value in (params.contentAttributes.items() if params.contentAttributes is mapping and params.contentAttributes.items else params.contentAttributes) %}{{ attribute }}{% if value %}="{{ value }}"{% endif %} {% endfor %}{% endif %}
|
|
26
26
|
>
|
|
27
27
|
{{ params.content | safe }}{{ caller() if caller }}
|
|
28
28
|
</div>
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
{%- endif -%}
|
|
22
22
|
|
|
23
23
|
{% set fields %}
|
|
24
|
-
{% if params.day
|
|
24
|
+
{% if params.day %}
|
|
25
25
|
{{ onsInput({
|
|
26
26
|
"id": params.id + "-day",
|
|
27
27
|
"type": "number",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
}) }}
|
|
42
42
|
{% endif %}
|
|
43
43
|
|
|
44
|
-
{% if params.month
|
|
44
|
+
{% if params.month %}
|
|
45
45
|
{{ onsInput({
|
|
46
46
|
"id": params.id + "-month",
|
|
47
47
|
"type": "number",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
}) }}
|
|
62
62
|
{% endif %}
|
|
63
63
|
|
|
64
|
-
{% if params.year
|
|
64
|
+
{% if params.year %}
|
|
65
65
|
{{ onsInput({
|
|
66
66
|
"id": params.id + "-year",
|
|
67
67
|
"type": "number",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
{% endset %}
|
|
91
91
|
{% endif %}
|
|
92
92
|
|
|
93
|
-
{% if params.mutuallyExclusive
|
|
93
|
+
{% if params.mutuallyExclusive %}
|
|
94
94
|
{% call onsMutuallyExclusive({
|
|
95
95
|
"id": params.id,
|
|
96
96
|
"legend": params.legendOrLabel,
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
{{ fields | safe }}
|
|
110
110
|
{% endcall %}
|
|
111
111
|
{% elif numberOfFields == 1 %}
|
|
112
|
-
{% if params.error
|
|
112
|
+
{% if params.error %}
|
|
113
113
|
{% call onsError(params.error) %}
|
|
114
114
|
{{ fields | safe }}
|
|
115
115
|
{% endcall %}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{% macro onsDocumentList(params) %}
|
|
2
|
-
<ul{% if params.id
|
|
2
|
+
<ul{% if params.id %} id="{{ params.id }}"{% endif %} class="ons-document-list{{ ' ' + params.classes if params.classes else '' }}"{% if params.attributes %}{% for attribute, value in (params.attributes.items() if params.attributes is mapping and params.attributes.items else params.attributes) %} {{attribute}}="{{value}}"{% endfor %}{% endif %}>
|
|
3
3
|
{% for document in (params.documents if params.documents is iterable else params.documents.items()) %}
|
|
4
4
|
|
|
5
|
-
<li class="ons-document-list__item{{ ' ons-document-list__item--featured' if document.featured
|
|
5
|
+
<li class="ons-document-list__item{{ ' ons-document-list__item--featured' if document.featured }}{{ ' ons-document-list__item--full-width' if document.fullWidth == true }}{{ ' ' + document.classes if document.classes else '' }}"{% if document.attributes %}{% for attribute, value in (document.attributes.items() if document.attributes is mapping and document.attributes.items else document.attributes) %} {{attribute}}="{{value}}"{% endfor %}{% endif %}>
|
|
6
6
|
|
|
7
|
-
{% if document.fullWidth
|
|
7
|
+
{% if document.fullWidth == true %}
|
|
8
8
|
|
|
9
|
-
<div class="ons-container{{ ' ons-container--wide' if document.wide
|
|
9
|
+
<div class="ons-container{{ ' ons-container--wide' if document.wide == true }}">
|
|
10
10
|
|
|
11
11
|
{% endif %}
|
|
12
12
|
|
|
13
|
-
{% if document.thumbnail
|
|
13
|
+
{% if document.thumbnail %}
|
|
14
14
|
|
|
15
|
-
<div class="ons-document-list__item-image{%- if document.metadata.file
|
|
15
|
+
<div class="ons-document-list__item-image{%- if document.metadata.file %} ons-document-list__item-image--file{% endif %}" aria-hidden="true">
|
|
16
16
|
<a class="ons-document-list__image-link{{ ' ons-document-list__image-link--placeholder' if not document.thumbnail.smallSrc }}" href="{{ document.url }}" tabindex="-1">
|
|
17
|
-
{% if document.thumbnail.smallSrc
|
|
17
|
+
{% if document.thumbnail.smallSrc and document.thumbnail.largeSrc %}
|
|
18
18
|
<img srcset="{{ document.thumbnail.smallSrc }} 1x, {{ document.thumbnail.largeSrc }} 2x" src="{{ document.thumbnail.smallSrc }}" alt="" loading="lazy">
|
|
19
19
|
{% endif %}
|
|
20
20
|
</a>
|
|
@@ -24,18 +24,18 @@
|
|
|
24
24
|
|
|
25
25
|
<div class="ons-document-list__item-content">
|
|
26
26
|
|
|
27
|
-
<div class="ons-document-list__item-header{{ ' ons-document-list__item-header--reverse' if document.showMetadataFirst
|
|
27
|
+
<div class="ons-document-list__item-header{{ ' ons-document-list__item-header--reverse' if document.showMetadataFirst == true }}">
|
|
28
28
|
|
|
29
29
|
{% set titleTag = params.titleTag | default("h2") %}
|
|
30
30
|
|
|
31
31
|
<{{ titleTag }} class="ons-document-list__item-title ons-u-fs-m ons-u-mt-no ons-u-mb-xs">
|
|
32
32
|
<a href="{{ document.url }}">{{ document.title }}
|
|
33
|
-
{%- if document.metadata
|
|
33
|
+
{%- if document.metadata and document.metadata.file %}
|
|
34
34
|
<span class="ons-u-vh">
|
|
35
35
|
{% set fileMetadataItems = [] %}
|
|
36
|
-
{% if document.metadata.file.fileType
|
|
37
|
-
{% if document.metadata.file.fileSize
|
|
38
|
-
{% if document.metadata.file.filePages
|
|
36
|
+
{% if document.metadata.file.fileType %}{% set fileMetadataItems = (fileMetadataItems.push(document.metadata.file.fileType + ' document download'), fileMetadataItems) %}{% endif %}
|
|
37
|
+
{% if document.metadata.file.fileSize %}{% set fileMetadataItems = (fileMetadataItems.push(document.metadata.file.fileSize), fileMetadataItems) %}{% endif %}
|
|
38
|
+
{% if document.metadata.file.filePages %}{% set fileMetadataItems = (fileMetadataItems.push(document.metadata.file.filePages), fileMetadataItems) %}{% endif %}
|
|
39
39
|
|
|
40
40
|
, {{ fileMetadataItems | join(', ') }}
|
|
41
41
|
|
|
@@ -44,45 +44,45 @@
|
|
|
44
44
|
</span></a>
|
|
45
45
|
</{{ titleTag }}>
|
|
46
46
|
|
|
47
|
-
{%- if document.metadata
|
|
47
|
+
{%- if document.metadata %}
|
|
48
48
|
|
|
49
|
-
<ul class="ons-document-list__item-metadata{% if document.description
|
|
49
|
+
<ul class="ons-document-list__item-metadata{% if document.description %} ons-u-mb-xs{% else %} ons-u-mb-no{% endif %}">
|
|
50
50
|
|
|
51
|
-
{%- if document.metadata.date
|
|
51
|
+
{%- if document.metadata.date %}
|
|
52
52
|
<li class="ons-document-list__item-attribute">
|
|
53
53
|
{% if document.metadata.date -%}
|
|
54
|
-
{% set prefixClasses = "ons-u-fw-b" if document.metadata.date.showPrefix
|
|
54
|
+
{% set prefixClasses = "ons-u-fw-b" if document.metadata.date.showPrefix == true else "ons-u-vh" %}
|
|
55
55
|
<span class="{{ prefixClasses }}">{{ document.metadata.date.prefix | default("Published") }}: </span>
|
|
56
56
|
{%- endif -%}
|
|
57
|
-
{% if document.metadata.date.iso
|
|
57
|
+
{% if document.metadata.date.iso -%}
|
|
58
58
|
<time datetime="{{ document.metadata.date.iso }}">{{ document.metadata.date.short }}</time>
|
|
59
59
|
{%- endif %}
|
|
60
60
|
</li>
|
|
61
61
|
{% endif %}
|
|
62
62
|
|
|
63
|
-
{%- if document.metadata.type
|
|
64
|
-
<li class="ons-document-list__item-attribute{%- if document.metadata.file
|
|
65
|
-
{%- if document.metadata.type.url
|
|
63
|
+
{%- if document.metadata.type and document.metadata.type.text %}
|
|
64
|
+
<li class="ons-document-list__item-attribute{%- if document.metadata.file %} ons-u-mr-no{% endif %}">
|
|
65
|
+
{%- if document.metadata.type.url %}
|
|
66
66
|
<a class="ons-document-list__attribute-link" href="{{ document.metadata.type.url }}">
|
|
67
67
|
{% endif %}
|
|
68
|
-
<span {% if not document.metadata.file and not document.metadata.type.url %}class="ons-u-fw-b"{% endif %}>{{ document.metadata.type.text }}{%- if document.metadata.type.ref
|
|
69
|
-
{%- if document.metadata.type.url
|
|
68
|
+
<span {% if not document.metadata.file and not document.metadata.type.url %}class="ons-u-fw-b"{% endif %}>{{ document.metadata.type.text }}{%- if document.metadata.type.ref %}: {% elif document.metadata.file %},{% endif %}</span>
|
|
69
|
+
{%- if document.metadata.type.url %}
|
|
70
70
|
</a>
|
|
71
71
|
{% endif %}
|
|
72
|
-
{%- if document.metadata.type.ref
|
|
72
|
+
{%- if document.metadata.type.ref %}
|
|
73
73
|
<span>{{ document.metadata.type.ref }}</span>
|
|
74
74
|
{% endif %}
|
|
75
75
|
</li>
|
|
76
76
|
{% endif %}
|
|
77
77
|
|
|
78
|
-
{%- if document.metadata.file
|
|
78
|
+
{%- if document.metadata.file and document.metadata.file.fileType %}
|
|
79
79
|
|
|
80
80
|
<li class="ons-document-list__item-attribute" aria-hidden="true">
|
|
81
81
|
{% set fileMetadataItems = [] %}
|
|
82
82
|
|
|
83
|
-
{% if document.metadata.file.fileType
|
|
84
|
-
{% if document.metadata.file.fileSize
|
|
85
|
-
{% if document.metadata.file.filePages
|
|
83
|
+
{% if document.metadata.file.fileType %}{% set fileMetadataItems = (fileMetadataItems.push(document.metadata.file.fileType), fileMetadataItems) %}{% endif %}
|
|
84
|
+
{% if document.metadata.file.fileSize %}{% set fileMetadataItems = (fileMetadataItems.push(document.metadata.file.fileSize), fileMetadataItems) %}{% endif %}
|
|
85
|
+
{% if document.metadata.file.filePages %}{% set fileMetadataItems = (fileMetadataItems.push(document.metadata.file.filePages), fileMetadataItems) %}{% endif %}
|
|
86
86
|
|
|
87
87
|
{{ fileMetadataItems | join(', ') }}
|
|
88
88
|
</li>
|
|
@@ -93,13 +93,13 @@
|
|
|
93
93
|
{% endif %}
|
|
94
94
|
</div>
|
|
95
95
|
|
|
96
|
-
{% if document.description
|
|
96
|
+
{% if document.description %}
|
|
97
97
|
<div class="ons-document-list__item-description">{{ document.description | safe }}</div>
|
|
98
98
|
{% endif %}
|
|
99
99
|
|
|
100
100
|
</div>
|
|
101
101
|
|
|
102
|
-
{% if document.fullWidth
|
|
102
|
+
{% if document.fullWidth == true %}
|
|
103
103
|
|
|
104
104
|
</div>
|
|
105
105
|
|
|
@@ -120,6 +120,8 @@
|
|
|
120
120
|
background-color: $color-banner-bg;
|
|
121
121
|
border-bottom: none;
|
|
122
122
|
display: block;
|
|
123
|
+
outline: 2px solid transparent; // Add transparent outline because Windows High Contrast Mode doesn't show background
|
|
124
|
+
outline-offset: -2px;
|
|
123
125
|
padding: 2rem;
|
|
124
126
|
|
|
125
127
|
@include mq(m) {
|
|
@@ -1061,9 +1061,28 @@ Math.easeInOutQuad = function(t, b, c, d) {
|
|
|
1061
1061
|
|
|
1062
1062
|
// Toggle filters visibility on small devices
|
|
1063
1063
|
function toggleFilters(bool) {
|
|
1064
|
+
let resultsOptions = document.getElementsByClassName('ons-adv-filter__results-options')[0];
|
|
1065
|
+
let resultsList = document.getElementsByClassName('ons-js-adv-filter__gallery')[0];
|
|
1066
|
+
let header = document.getElementsByClassName('ons-header')[0];
|
|
1067
|
+
let breadcrumbs = document.getElementsByClassName('ons-breadcrumb')[0];
|
|
1068
|
+
let footer = document.getElementsByClassName('ons-footer')[0];
|
|
1069
|
+
|
|
1064
1070
|
Util.toggleClass(filtersPanel, 'ons-adv-filter__panel--is-visible', bool);
|
|
1065
1071
|
Util.toggleClass(body, 'ons-no-scroll', bool);
|
|
1066
1072
|
filtersTrigger.setAttribute('aria-expanded', bool);
|
|
1073
|
+
filtersTrigger.setAttribute('aria-hidden', bool);
|
|
1074
|
+
Util.toggleClass(filtersTrigger, 'ons-u-d-no', bool);
|
|
1075
|
+
|
|
1076
|
+
Util.toggleClass(resultsOptions, 'ons-u-d-no', bool);
|
|
1077
|
+
Util.toggleClass(resultsList, 'ons-u-d-no', bool);
|
|
1078
|
+
Util.toggleClass(header, 'ons-u-d-no', bool);
|
|
1079
|
+
Util.toggleClass(breadcrumbs, 'ons-u-d-no', bool);
|
|
1080
|
+
Util.toggleClass(footer, 'ons-u-d-no', bool);
|
|
1081
|
+
resultsOptions.setAttribute('aria-hidden', bool);
|
|
1082
|
+
resultsList.setAttribute('aria-hidden', bool);
|
|
1083
|
+
header.setAttribute('aria-hidden', bool);
|
|
1084
|
+
breadcrumbs.setAttribute('aria-hidden', bool);
|
|
1085
|
+
footer.setAttribute('aria-hidden', bool);
|
|
1067
1086
|
}
|
|
1068
1087
|
}
|
|
1069
1088
|
})();
|
|
@@ -4,6 +4,20 @@ import { setViewport } from '../../tests/helpers/puppeteer';
|
|
|
4
4
|
import { renderComponent, renderTemplate, setTestPage } from '../../tests/helpers/rendering';
|
|
5
5
|
|
|
6
6
|
const EXAMPLE_PAGE = `
|
|
7
|
+
${renderComponent('header', {})}
|
|
8
|
+
${renderComponent('breadcrumbs', {
|
|
9
|
+
ariaLabel: 'Breadcrumbs',
|
|
10
|
+
itemsList: [
|
|
11
|
+
{
|
|
12
|
+
url: '/',
|
|
13
|
+
text: 'Home',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
url: '/components',
|
|
17
|
+
text: 'Components',
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
})}
|
|
7
21
|
<div class="ons-js-adv-filter">
|
|
8
22
|
${renderComponent('button', {
|
|
9
23
|
type: 'button',
|
|
@@ -175,6 +189,7 @@ const EXAMPLE_PAGE = `
|
|
|
175
189
|
<p>Try selecting different filters to get results.</p>
|
|
176
190
|
</div>
|
|
177
191
|
</div>
|
|
192
|
+
${renderComponent('footer', {})}
|
|
178
193
|
`;
|
|
179
194
|
|
|
180
195
|
const RENDERED_EXAMPLE_PAGE = renderTemplate(EXAMPLE_PAGE);
|
|
@@ -505,6 +520,32 @@ describe('script: download-resources', () => {
|
|
|
505
520
|
expect(displayStyle).not.toBe('none');
|
|
506
521
|
});
|
|
507
522
|
|
|
523
|
+
it('hides the underlying page elements when the "Show filters" button is pressed', async () => {
|
|
524
|
+
await page.click('.ons-js-adv-filter__trigger');
|
|
525
|
+
|
|
526
|
+
const isListHiddenClass = await page.$eval('.ons-js-adv-filter__gallery', node => node.classList.contains('ons-u-d-no'));
|
|
527
|
+
const isListAriaHidden = await page.$eval('.ons-js-adv-filter__gallery', node => node.getAttribute('aria-hidden'));
|
|
528
|
+
const isOptionsHiddenClass = await page.$eval('.ons-adv-filter__results-options', node => node.classList.contains('ons-u-d-no'));
|
|
529
|
+
const isOptionsAriaHidden = await page.$eval('.ons-adv-filter__results-options', node => node.getAttribute('aria-hidden'));
|
|
530
|
+
const isHeaderHiddenClass = await page.$eval('.ons-header', node => node.classList.contains('ons-u-d-no'));
|
|
531
|
+
const isHeaderAriaHidden = await page.$eval('.ons-header', node => node.getAttribute('aria-hidden'));
|
|
532
|
+
const isFooterHiddenClass = await page.$eval('.ons-footer', node => node.classList.contains('ons-u-d-no'));
|
|
533
|
+
const isFooterAriaHidden = await page.$eval('.ons-footer', node => node.getAttribute('aria-hidden'));
|
|
534
|
+
const isBreadcrumbsHiddenClass = await page.$eval('.ons-breadcrumb', node => node.classList.contains('ons-u-d-no'));
|
|
535
|
+
const isBreadcrumbsAriaHidden = await page.$eval('.ons-breadcrumb', node => node.getAttribute('aria-hidden'));
|
|
536
|
+
|
|
537
|
+
expect(isListHiddenClass).toBe(true);
|
|
538
|
+
expect(isListAriaHidden).toBe('true');
|
|
539
|
+
expect(isOptionsHiddenClass).toBe(true);
|
|
540
|
+
expect(isOptionsAriaHidden).toBe('true');
|
|
541
|
+
expect(isHeaderHiddenClass).toBe(true);
|
|
542
|
+
expect(isHeaderAriaHidden).toBe('true');
|
|
543
|
+
expect(isFooterHiddenClass).toBe(true);
|
|
544
|
+
expect(isFooterAriaHidden).toBe('true');
|
|
545
|
+
expect(isBreadcrumbsHiddenClass).toBe(true);
|
|
546
|
+
expect(isBreadcrumbsAriaHidden).toBe('true');
|
|
547
|
+
});
|
|
548
|
+
|
|
508
549
|
it('hides filter elements when the "Show (n results)" button is pressed', async () => {
|
|
509
550
|
await page.click('.ons-js-adv-filter__trigger');
|
|
510
551
|
await page.click('.ons-js-adv-filter__show');
|
|
@@ -513,6 +554,33 @@ describe('script: download-resources', () => {
|
|
|
513
554
|
expect(displayStyle).toBe('none');
|
|
514
555
|
});
|
|
515
556
|
|
|
557
|
+
it('shows the underlying page elements when the "Show (n results)" button is pressed', async () => {
|
|
558
|
+
await page.click('.ons-js-adv-filter__trigger');
|
|
559
|
+
await page.click('.ons-js-adv-filter__show');
|
|
560
|
+
|
|
561
|
+
const isListHiddenClass = await page.$eval('.ons-js-adv-filter__gallery', node => node.classList.contains('ons-u-d-no'));
|
|
562
|
+
const isListAriaHidden = await page.$eval('.ons-js-adv-filter__gallery', node => node.getAttribute('aria-hidden'));
|
|
563
|
+
const isOptionsHiddenClass = await page.$eval('.ons-adv-filter__results-options', node => node.classList.contains('ons-u-d-no'));
|
|
564
|
+
const isOptionsAriaHidden = await page.$eval('.ons-adv-filter__results-options', node => node.getAttribute('aria-hidden'));
|
|
565
|
+
const isHeaderHiddenClass = await page.$eval('.ons-header', node => node.classList.contains('ons-u-d-no'));
|
|
566
|
+
const isHeaderAriaHidden = await page.$eval('.ons-header', node => node.getAttribute('aria-hidden'));
|
|
567
|
+
const isFooterHiddenClass = await page.$eval('.ons-footer', node => node.classList.contains('ons-u-d-no'));
|
|
568
|
+
const isFooterAriaHidden = await page.$eval('.ons-footer', node => node.getAttribute('aria-hidden'));
|
|
569
|
+
const isBreadcrumbsHiddenClass = await page.$eval('.ons-breadcrumb', node => node.classList.contains('ons-u-d-no'));
|
|
570
|
+
const isBreadcrumbsAriaHidden = await page.$eval('.ons-breadcrumb', node => node.getAttribute('aria-hidden'));
|
|
571
|
+
|
|
572
|
+
expect(isListHiddenClass).toBe(false);
|
|
573
|
+
expect(isListAriaHidden).toBe('false');
|
|
574
|
+
expect(isOptionsHiddenClass).toBe(false);
|
|
575
|
+
expect(isOptionsAriaHidden).toBe('false');
|
|
576
|
+
expect(isHeaderHiddenClass).toBe(false);
|
|
577
|
+
expect(isHeaderAriaHidden).toBe('false');
|
|
578
|
+
expect(isFooterHiddenClass).toBe(false);
|
|
579
|
+
expect(isFooterAriaHidden).toBe('false');
|
|
580
|
+
expect(isBreadcrumbsHiddenClass).toBe(false);
|
|
581
|
+
expect(isBreadcrumbsAriaHidden).toBe('false');
|
|
582
|
+
});
|
|
583
|
+
|
|
516
584
|
it('hides filter elements when the "Close" button is pressed', async () => {
|
|
517
585
|
await page.click('.ons-js-adv-filter__trigger');
|
|
518
586
|
await page.click('.ons-js-adv-filter__close');
|
|
@@ -520,6 +588,33 @@ describe('script: download-resources', () => {
|
|
|
520
588
|
const displayStyle = await page.$eval('.ons-adv-filter__panel', node => getComputedStyle(node).display);
|
|
521
589
|
expect(displayStyle).toBe('none');
|
|
522
590
|
});
|
|
591
|
+
|
|
592
|
+
it('shows the underlying page elements when the "Close" button is pressed', async () => {
|
|
593
|
+
await page.click('.ons-js-adv-filter__trigger');
|
|
594
|
+
await page.click('.ons-js-adv-filter__close');
|
|
595
|
+
|
|
596
|
+
const isListHiddenClass = await page.$eval('.ons-js-adv-filter__gallery', node => node.classList.contains('ons-u-d-no'));
|
|
597
|
+
const isListAriaHidden = await page.$eval('.ons-js-adv-filter__gallery', node => node.getAttribute('aria-hidden'));
|
|
598
|
+
const isOptionsHiddenClass = await page.$eval('.ons-adv-filter__results-options', node => node.classList.contains('ons-u-d-no'));
|
|
599
|
+
const isOptionsAriaHidden = await page.$eval('.ons-adv-filter__results-options', node => node.getAttribute('aria-hidden'));
|
|
600
|
+
const isHeaderHiddenClass = await page.$eval('.ons-header', node => node.classList.contains('ons-u-d-no'));
|
|
601
|
+
const isHeaderAriaHidden = await page.$eval('.ons-header', node => node.getAttribute('aria-hidden'));
|
|
602
|
+
const isFooterHiddenClass = await page.$eval('.ons-footer', node => node.classList.contains('ons-u-d-no'));
|
|
603
|
+
const isFooterAriaHidden = await page.$eval('.ons-footer', node => node.getAttribute('aria-hidden'));
|
|
604
|
+
const isBreadcrumbsHiddenClass = await page.$eval('.ons-breadcrumb', node => node.classList.contains('ons-u-d-no'));
|
|
605
|
+
const isBreadcrumbsAriaHidden = await page.$eval('.ons-breadcrumb', node => node.getAttribute('aria-hidden'));
|
|
606
|
+
|
|
607
|
+
expect(isListHiddenClass).toBe(false);
|
|
608
|
+
expect(isListAriaHidden).toBe('false');
|
|
609
|
+
expect(isOptionsHiddenClass).toBe(false);
|
|
610
|
+
expect(isOptionsAriaHidden).toBe('false');
|
|
611
|
+
expect(isHeaderHiddenClass).toBe(false);
|
|
612
|
+
expect(isHeaderAriaHidden).toBe('false');
|
|
613
|
+
expect(isFooterHiddenClass).toBe(false);
|
|
614
|
+
expect(isFooterAriaHidden).toBe('false');
|
|
615
|
+
expect(isBreadcrumbsHiddenClass).toBe(false);
|
|
616
|
+
expect(isBreadcrumbsAriaHidden).toBe('false');
|
|
617
|
+
});
|
|
523
618
|
});
|
|
524
619
|
});
|
|
525
620
|
|