@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
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
}) }}
|
|
27
27
|
{% endset %}
|
|
28
28
|
|
|
29
|
-
{% if params.error
|
|
29
|
+
{% if not params.error %}
|
|
30
30
|
{% call onsPanel({
|
|
31
|
-
"classes": "ons-u-mb-s" + (' ' + params.classes if params.classes
|
|
31
|
+
"classes": "ons-u-mb-s" + (' ' + params.classes if params.classes)
|
|
32
32
|
})
|
|
33
33
|
%}
|
|
34
34
|
{{ content | safe }}
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
{{ content | safe }}
|
|
38
38
|
{% endif %}
|
|
39
39
|
|
|
40
|
-
{% if params.securityMessage
|
|
40
|
+
{% if params.securityMessage %}
|
|
41
41
|
{% call onsPanel({
|
|
42
42
|
"type": "bare",
|
|
43
43
|
"iconType": "lock",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
{% from "components/collapsible/_macro.njk" import onsCollapsible %}
|
|
3
3
|
|
|
4
4
|
<div id="{{params.id}}" class="ons-accordion{{ ' ' + params.classes if params.classes }}">
|
|
5
|
-
{% if params.allButton
|
|
5
|
+
{% if params.allButton %}
|
|
6
6
|
{% from "components/button/_macro.njk" import onsButton %}
|
|
7
7
|
{% set attributes = params.allButton.attributes | default({}) %}
|
|
8
8
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<div id="address" class="ons-field ons-address-input {% if not params.manualEntry %}ons-address-input--search ons-js-address-autosuggest{% endif %}">
|
|
8
8
|
{% if params.isEditable == true or params.manualEntry %}
|
|
9
9
|
{% if not params.manualEntry %}<div class="ons-js-address-input__manual ons-u-db-no-js_enabled">{% endif %}
|
|
10
|
-
{% if params.organisation
|
|
10
|
+
{% if params.organisation %}
|
|
11
11
|
{{
|
|
12
12
|
onsInput({
|
|
13
13
|
"id": params.id + "-organisation",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
})
|
|
23
23
|
}}
|
|
24
24
|
{% endif %}
|
|
25
|
-
{% if params.line1
|
|
25
|
+
{% if params.line1 %}
|
|
26
26
|
{{
|
|
27
27
|
onsInput({
|
|
28
28
|
"id": params.id + "-line1",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
})
|
|
38
38
|
}}
|
|
39
39
|
{% endif %}
|
|
40
|
-
{% if params.line2
|
|
40
|
+
{% if params.line2 %}
|
|
41
41
|
{{
|
|
42
42
|
onsInput({
|
|
43
43
|
"id": params.id + "-line2",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
})
|
|
53
53
|
}}
|
|
54
54
|
{% endif %}
|
|
55
|
-
{% if params.town
|
|
55
|
+
{% if params.town %}
|
|
56
56
|
{{
|
|
57
57
|
onsInput({
|
|
58
58
|
"id": params.id + "-town",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
})
|
|
67
67
|
}}
|
|
68
68
|
{% endif %}
|
|
69
|
-
{% if params.postcode
|
|
69
|
+
{% if params.postcode %}
|
|
70
70
|
{{
|
|
71
71
|
onsInput({
|
|
72
72
|
"id": params.id + "-postcode",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
{% endif %}
|
|
90
90
|
{% endif %}
|
|
91
91
|
|
|
92
|
-
{% if params.uprn
|
|
92
|
+
{% if params.uprn and params.uprn.value %}
|
|
93
93
|
{% set uprnValue = params.uprn.value %}
|
|
94
94
|
{% else %}
|
|
95
95
|
{% set uprnValue = '' %}
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
</div>
|
|
163
163
|
{% endset %}
|
|
164
164
|
|
|
165
|
-
{% if params.dontWrap
|
|
165
|
+
{% if params.dontWrap %}
|
|
166
166
|
{{ fields | safe }}
|
|
167
167
|
{% else %}
|
|
168
168
|
{% call onsFieldset({
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
{% macro onsAddressOutput(params) %}
|
|
2
|
-
<div class="ons-address-output{% if params.classes
|
|
2
|
+
<div class="ons-address-output{% if params.classes %} {{ params.classes }}{% endif %}">
|
|
3
3
|
<p class="ons-address-output__lines">
|
|
4
|
-
{% if params.unit
|
|
4
|
+
{% if params.unit %}
|
|
5
5
|
<span class="ons-address-output__unit">{{ params.unit }}</span><br>
|
|
6
6
|
{% endif %}
|
|
7
|
-
{% if params.organisation
|
|
7
|
+
{% if params.organisation %}
|
|
8
8
|
<span class="ons-address-output__organisation">{{ params.organisation }}</span><br>
|
|
9
9
|
{% endif %}
|
|
10
|
-
{% if params.line1
|
|
10
|
+
{% if params.line1 %}
|
|
11
11
|
<span class="ons-address-output__line1">{{ params.line1 }}</span><br>
|
|
12
12
|
{% endif %}
|
|
13
|
-
{% if params.line2
|
|
13
|
+
{% if params.line2 %}
|
|
14
14
|
<span class="ons-address-output__line2">{{ params.line2 }}</span><br>
|
|
15
15
|
{% endif %}
|
|
16
|
-
{% if params.town
|
|
16
|
+
{% if params.town %}
|
|
17
17
|
<span class="ons-address-output__town">{{ params.town }}</span><br>
|
|
18
18
|
{% endif %}
|
|
19
|
-
{% if params.postcode
|
|
19
|
+
{% if params.postcode %}
|
|
20
20
|
<span class="ons-address-output__postcode">{{ params.postcode }}</span>
|
|
21
21
|
{% endif %}
|
|
22
22
|
</p>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
{% macro onsAutosuggest(params) %}
|
|
4
4
|
<div
|
|
5
5
|
id="{{ params.id }}-container"
|
|
6
|
-
class="{% if not params.externalInitialiser %}ons-js-autosuggest {% endif %}{% if params.isEditable == false %}ons-js-address-not-editable{% endif %}{% if params.mandatory
|
|
6
|
+
class="{% if not params.externalInitialiser %}ons-js-autosuggest {% endif %}{% if params.isEditable == false %}ons-js-address-not-editable{% endif %}{% if params.mandatory == true %} ons-js-address-mandatory{% endif %} {% if params.containerClasses %} {{ params.containerClasses }}{% endif %} ons-autosuggest-input"
|
|
7
7
|
data-instructions="{{ params.instructions }}"
|
|
8
8
|
data-aria-you-have-selected="{{ params.ariaYouHaveSelected }}"
|
|
9
9
|
data-min-chars="{{ params.minChars }}"
|
|
@@ -15,23 +15,23 @@
|
|
|
15
15
|
data-results-title="{{ params.resultsTitle }}"
|
|
16
16
|
data-no-results="{{ params.noResults }}"
|
|
17
17
|
data-type-more="{{ params.typeMore }}"
|
|
18
|
-
{% if params.APIDomain
|
|
19
|
-
{% if params.APIDomainBearerToken
|
|
20
|
-
{% if params.APIManualQueryParams
|
|
21
|
-
{% if params.allowMultiple
|
|
22
|
-
{% if params.autosuggestData
|
|
23
|
-
{% if params.errorTitle
|
|
24
|
-
{% if params.errorMessageEnter
|
|
25
|
-
{% if params.errorMessageSelect
|
|
26
|
-
{% if params.ariaGroupedResults
|
|
27
|
-
{% if params.groupCount
|
|
28
|
-
{% if params.tooManyResults
|
|
29
|
-
{% if params.errorMessageAPI
|
|
30
|
-
{% if params.errorMessageAPILinkText
|
|
31
|
-
{% if params.options
|
|
32
|
-
{% if params.options.oneYearAgo
|
|
33
|
-
{% if params.options.regionCode
|
|
34
|
-
{% if params.options.addressType
|
|
18
|
+
{% if params.APIDomain %}data-api-domain="{{ params.APIDomain }}"{% endif %}
|
|
19
|
+
{% if params.APIDomainBearerToken %}data-authorization-token="{{ params.APIDomainBearerToken }}"{% endif %}
|
|
20
|
+
{% if params.APIManualQueryParams == true %}data-query-params=""{% endif %}
|
|
21
|
+
{% if params.allowMultiple == true %}data-allow-multiple="true"{% endif %}
|
|
22
|
+
{% if params.autosuggestData %}data-autosuggest-data="{{ params.autosuggestData }}"{% endif %}
|
|
23
|
+
{% if params.errorTitle %}data-error-title="{{ params.errorTitle }}"{% endif %}
|
|
24
|
+
{% if params.errorMessageEnter %}data-error-enter="{{ params.errorMessageEnter }}"{% endif %}
|
|
25
|
+
{% if params.errorMessageSelect %}data-error-select="{{ params.errorMessageSelect }}"{% endif %}
|
|
26
|
+
{% if params.ariaGroupedResults %}data-aria-grouped-results="{{ params.ariaGroupedResults }}"{% endif %}
|
|
27
|
+
{% if params.groupCount %}data-group-count="{{ params.groupCount }}"{% endif %}
|
|
28
|
+
{% if params.tooManyResults %}data-too-many-results="{{ params.tooManyResults }}"{% endif %}
|
|
29
|
+
{% if params.errorMessageAPI %}data-error-api="{{ params.errorMessageAPI }}"{% endif %}
|
|
30
|
+
{% if params.errorMessageAPILinkText %}data-error-api-link-text="{{ params.errorMessageAPILinkText }}"{% endif %}
|
|
31
|
+
{% if params.options %}
|
|
32
|
+
{% if params.options.oneYearAgo %}data-options-one-year-ago="true"{% endif %}
|
|
33
|
+
{% if params.options.regionCode %}data-options-region-code="{{ params.options.regionCode }}"{% endif %}
|
|
34
|
+
{% if params.options.addressType %}data-options-address-type="{{ params.options.addressType }}"{% endif %}
|
|
35
35
|
{% endif %}
|
|
36
36
|
>
|
|
37
37
|
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"autosuggestResults": autosuggestResults
|
|
67
67
|
}) }}
|
|
68
68
|
|
|
69
|
-
{% if params.mutuallyExclusive
|
|
69
|
+
{% if not params.mutuallyExclusive %}
|
|
70
70
|
{{ autosuggestResults | safe }}
|
|
71
71
|
{% endif %}
|
|
72
72
|
</div>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{% from "components/icons/_macro.njk" import onsIcon %}
|
|
2
2
|
|
|
3
3
|
{% macro onsBreadcrumbs(params) %}
|
|
4
|
-
<nav class="ons-breadcrumb{{ ' ' + params.classes if params.classes else '' }}" aria-label="{{ params.ariaLabel | default("Breadcrumbs") }}" {% if params.id
|
|
4
|
+
<nav class="ons-breadcrumb{{ ' ' + params.classes if params.classes else '' }}" aria-label="{{ params.ariaLabel | default("Breadcrumbs") }}" {% if params.id %} id="{{ params.id }}"{% endif %}>
|
|
5
5
|
<ol class="ons-breadcrumb__items ons-u-fs-s">
|
|
6
6
|
{% for item in (params.itemsList if params.itemsList is iterable else params.itemsList.items()) %}
|
|
7
7
|
<li class="ons-breadcrumb__item{{ ' ' + item.itemClasses if item.itemClasses else '' }}" id="breadcrumb-{{ loop.index }}">
|
|
8
|
-
<a class="ons-breadcrumb__link{{ ' ' + item.linkClasses if item.linkClasses else '' }}" href="{{ item.url }}"{% if item.id
|
|
9
|
-
{% if item.attributes
|
|
8
|
+
<a class="ons-breadcrumb__link{{ ' ' + item.linkClasses if item.linkClasses else '' }}" href="{{ item.url }}"{% if item.id %} id="{{ item.id }}"{% endif %}
|
|
9
|
+
{% if item.attributes %}{% for attribute, value in (item.attributes.items() if item.attributes is mapping and item.attributes.items else item.attributes) %}{{attribute}}="{{value}}" {% endfor %}{% endif %}
|
|
10
10
|
>{{ item.text }}</a>
|
|
11
11
|
{{
|
|
12
12
|
onsIcon({
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
{% endif %}
|
|
11
11
|
|
|
12
12
|
<div class="ons-browser-banner">
|
|
13
|
-
<div class="ons-container{{ ' ons-container--
|
|
13
|
+
<div class="ons-container{{ ' ons-container--full-width' if params.fullWidth }}{{ ' ons-container--wide' if params.wide }}">
|
|
14
14
|
<p class="ons-browser-banner__content"><span class="ons-browser-banner__lead">{{ bannerLeadingText }}</span><span class="ons-browser-banner__cta"> {{ bannerCTA | safe }}</span></p>
|
|
15
15
|
</div>
|
|
16
16
|
</div>
|
|
@@ -49,6 +49,37 @@ describe('macro: browser-banner', () => {
|
|
|
49
49
|
|
|
50
50
|
expect($('.ons-container').hasClass('ons-container--wide')).toBe(true);
|
|
51
51
|
});
|
|
52
|
+
|
|
53
|
+
it('does not have `container--wide` class when `wide` is not set', () => {
|
|
54
|
+
const $ = cheerio.load(
|
|
55
|
+
renderComponent('browser-banner', {
|
|
56
|
+
...EXAMPLE_BROWSER_BANNER_DEFAULT,
|
|
57
|
+
}),
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
expect($('.ons-container').hasClass('ons-container--wide')).toBe(false);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('has `container--full-width` class when `fullWidth` is true', () => {
|
|
64
|
+
const $ = cheerio.load(
|
|
65
|
+
renderComponent('browser-banner', {
|
|
66
|
+
...EXAMPLE_BROWSER_BANNER_DEFAULT,
|
|
67
|
+
fullWidth: true,
|
|
68
|
+
}),
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
expect($('.ons-container').hasClass('ons-container--full-width')).toBe(true);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('does not have `container--full-width` class when `fullWidth` is not set', () => {
|
|
75
|
+
const $ = cheerio.load(
|
|
76
|
+
renderComponent('browser-banner', {
|
|
77
|
+
...EXAMPLE_BROWSER_BANNER_DEFAULT,
|
|
78
|
+
}),
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
expect($('.ons-container').hasClass('ons-container--full-width')).toBe(false);
|
|
82
|
+
});
|
|
52
83
|
});
|
|
53
84
|
|
|
54
85
|
describe('mode: Welsh language', () => {
|
|
@@ -39,7 +39,7 @@ $button-shadow-size: 3px;
|
|
|
39
39
|
|
|
40
40
|
&--search {
|
|
41
41
|
.ons-svg-icon {
|
|
42
|
-
@include mq(s,
|
|
42
|
+
@include mq(s, l) {
|
|
43
43
|
margin-right: 0.5rem;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -63,8 +63,11 @@ $button-shadow-size: 3px;
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
// When focused
|
|
66
|
-
&:focus
|
|
66
|
+
&:focus,
|
|
67
|
+
&:focus-visible {
|
|
68
|
+
// Add transparent outline because Windows High Contrast Mode doesn't show box-shadows
|
|
67
69
|
outline: 3px solid transparent;
|
|
70
|
+
outline-offset: 1px;
|
|
68
71
|
}
|
|
69
72
|
|
|
70
73
|
&:focus &__inner {
|
|
@@ -91,11 +94,6 @@ $button-shadow-size: 3px;
|
|
|
91
94
|
top: ems($button-shadow-size);
|
|
92
95
|
}
|
|
93
96
|
|
|
94
|
-
&:focus,
|
|
95
|
-
&:focus:hover {
|
|
96
|
-
outline: none;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
97
|
// Small buttons
|
|
100
98
|
&--small,
|
|
101
99
|
&--mobile {
|
|
@@ -170,6 +168,8 @@ $button-shadow-size: 3px;
|
|
|
170
168
|
|
|
171
169
|
&--link:focus:not(:active):not(&--secondary) &,
|
|
172
170
|
&--link:focus:hover:not(:active):not(&--secondary) & {
|
|
171
|
+
outline: inherit;
|
|
172
|
+
|
|
173
173
|
&__inner {
|
|
174
174
|
.ons-svg-icon {
|
|
175
175
|
fill: $color-text;
|
|
@@ -480,3 +480,17 @@ $button-shadow-size: 3px;
|
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
482
|
}
|
|
483
|
+
|
|
484
|
+
.ons-btn-group {
|
|
485
|
+
@extend .ons-u-mb-m;
|
|
486
|
+
|
|
487
|
+
align-items: baseline;
|
|
488
|
+
display: flex;
|
|
489
|
+
flex-direction: row;
|
|
490
|
+
flex-wrap: wrap;
|
|
491
|
+
|
|
492
|
+
& .ons-btn,
|
|
493
|
+
& a {
|
|
494
|
+
margin: 0 1rem 1rem 0;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
{% macro onsButton(params) %}
|
|
4
4
|
|
|
5
5
|
{# Customisable button icon #}
|
|
6
|
-
{% if params.iconType
|
|
6
|
+
{% if params.iconType %}
|
|
7
7
|
{% set iconType = params.iconType %}
|
|
8
|
-
{% if params.iconPosition
|
|
8
|
+
{% if params.iconPosition %}
|
|
9
9
|
{% set iconPosition = params.iconPosition %}
|
|
10
10
|
{% else %}
|
|
11
11
|
{# Default icon position before label #}
|
|
@@ -13,49 +13,49 @@
|
|
|
13
13
|
{% endif %}
|
|
14
14
|
{% elif params.iconType is not defined and params.noIcon is not defined %}
|
|
15
15
|
{# Opens in new tab #}
|
|
16
|
-
{% if params.url
|
|
16
|
+
{% if params.url and params.newWindow %}
|
|
17
17
|
{% set iconType = "external-link" %}
|
|
18
18
|
{% set iconPosition = "after" %}
|
|
19
19
|
{# Download #}
|
|
20
|
-
{% elif params.buttonStyle
|
|
20
|
+
{% elif params.buttonStyle == "download" %}
|
|
21
21
|
{% set iconType = "download" %}
|
|
22
22
|
{% set iconPosition = "before" %}
|
|
23
23
|
{# Print #}
|
|
24
|
-
{% elif params.buttonStyle
|
|
24
|
+
{% elif params.buttonStyle == "print" %}
|
|
25
25
|
{% set iconType = "print" %}
|
|
26
26
|
{% set iconPosition = "before" %}
|
|
27
27
|
{# Loader #}
|
|
28
|
-
{% elif params.submitType
|
|
28
|
+
{% elif params.submitType == "loader" %}
|
|
29
29
|
{% set iconType = "loader" %}
|
|
30
30
|
{% set iconPosition = "after" %}
|
|
31
31
|
{# CTA or mobile menu toggle #}
|
|
32
|
-
{% elif params.buttonStyle
|
|
32
|
+
{% elif params.buttonStyle == "mobile" %}
|
|
33
33
|
{% set iconType = "chevron" %}
|
|
34
34
|
{% set iconPosition = "after" %}
|
|
35
|
-
{% elif params.url
|
|
35
|
+
{% elif params.url %}
|
|
36
36
|
{% set iconType = "arrow-next" %}
|
|
37
37
|
{% set iconPosition = "after" %}
|
|
38
38
|
{% endif %}
|
|
39
39
|
{% endif %}
|
|
40
40
|
|
|
41
|
-
{% set tag = "a" if params.url or params.dsExample
|
|
41
|
+
{% set tag = "a" if params.url or params.dsExample else "button" %}
|
|
42
42
|
|
|
43
43
|
<{{ tag }}
|
|
44
|
-
{% if params.url
|
|
44
|
+
{% if params.url %}
|
|
45
45
|
href="{{ params.url }}"
|
|
46
46
|
role="button"
|
|
47
47
|
{% else %}
|
|
48
|
-
type="{{ params.type if params.type
|
|
48
|
+
type="{{ params.type if params.type else ('button' if params.buttonStyle == "print" else 'submit') }}"
|
|
49
49
|
{% endif %}
|
|
50
|
-
class="ons-btn{% if params.classes
|
|
51
|
-
{% if params.id
|
|
52
|
-
{% if params.value
|
|
53
|
-
{% if params.name
|
|
54
|
-
{% if params.url
|
|
55
|
-
{% if params.buttonStyle == "download" and
|
|
56
|
-
{% if params.attributes
|
|
50
|
+
class="ons-btn{% if params.classes %} {{ params.classes }}{% endif %}{% if params.variants %}{% if params.variants is not string %}{% for variant in params.variants %} ons-btn--{{ variant }}{% endfor %}{% else %} ons-btn--{{ params.variants }}{% endif %}{% endif %}{% if params.url %} ons-btn--link ons-js-submit-btn{% endif %}{% if params.buttonStyle == "download" %} ons-btn--download{% endif %}{% if params.buttonStyle == "print" %} ons-btn--print ons-u-d-no ons-js-print-btn{% endif %}{% if params.submitType == "loader" %} ons-btn--loader ons-js-loader ons-js-submit-btn{% endif %}{% if params.submitType == "timer" %} ons-js-timer ons-js-submit-btn{% endif %}"
|
|
51
|
+
{% if params.id %}id="{{ params.id }}"{% endif %}
|
|
52
|
+
{% if params.value and tag != "a" %}value="{{ params.value }}"{% endif %}
|
|
53
|
+
{% if params.name and tag != "a" %}name="{{ params.name }}"{% endif %}
|
|
54
|
+
{% if params.url and params.newWindow %}target="_blank" rel="noopener"{% endif %}
|
|
55
|
+
{% if params.buttonStyle == "download" and not params.removeDownloadAttribute %} download{% endif %}
|
|
56
|
+
{% 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 %}
|
|
57
57
|
>
|
|
58
|
-
<span class="ons-btn__inner{% if params.innerClasses
|
|
58
|
+
<span class="ons-btn__inner{% if params.innerClasses %} {{ params.innerClasses }}{% endif %}">
|
|
59
59
|
{%- if iconPosition == "before" or iconPosition == "after" %}
|
|
60
60
|
{%- if iconPosition == "before" %}
|
|
61
61
|
{{
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
})
|
|
66
66
|
}}
|
|
67
67
|
{% endif -%}
|
|
68
|
-
<span class="ons-btn__text">{{- params.html | safe if params.html
|
|
68
|
+
<span class="ons-btn__text">{{- params.html | safe if params.html else params.text -}}</span>
|
|
69
69
|
{%- if iconPosition == "after" %}
|
|
70
70
|
{{
|
|
71
71
|
onsIcon({
|
|
@@ -80,15 +80,15 @@
|
|
|
80
80
|
"iconType": iconType
|
|
81
81
|
})
|
|
82
82
|
}}
|
|
83
|
-
<span class="ons-btn__text ons-u-vh@xxs@s">{{- params.html | safe if params.html
|
|
83
|
+
<span class="ons-btn__text ons-u-vh@xxs@s">{{- params.html | safe if params.html else params.text -}}</span>
|
|
84
84
|
{% else -%}
|
|
85
|
-
<span class="ons-btn__text">{{- params.html | safe if params.html
|
|
85
|
+
<span class="ons-btn__text">{{- params.html | safe if params.html else params.text -}}</span>
|
|
86
86
|
{% endif -%}
|
|
87
87
|
</span>
|
|
88
|
-
{% if params.url
|
|
89
|
-
<span class="ons-btn__new-window-description ons-u-vh">({{ params.newWindowDescription | default("opens in a new tab") }})</span>
|
|
88
|
+
{% if params.url and params.newWindow %}
|
|
89
|
+
<span class="ons-btn__new-window-description ons-u-vh"> ({{ params.newWindowDescription | default("opens in a new tab") }})</span>
|
|
90
90
|
{% endif %}
|
|
91
|
-
{% if params.buttonContext
|
|
91
|
+
{% if params.buttonContext %}
|
|
92
92
|
<span class="ons-btn__context ons-u-vh">{{ params.buttonContext }}</span>
|
|
93
93
|
{% endif %}
|
|
94
94
|
{% if params.listeners %}
|
|
@@ -407,7 +407,7 @@ describe('macro: button', () => {
|
|
|
407
407
|
}),
|
|
408
408
|
);
|
|
409
409
|
|
|
410
|
-
expect($('.ons-btn__new-window-description').text()).toBe('(opens in a new tab)');
|
|
410
|
+
expect($('.ons-btn__new-window-description').text()).toBe(' (opens in a new tab)');
|
|
411
411
|
});
|
|
412
412
|
|
|
413
413
|
it('has a custom new window description when `newWindow` is `true` and `newWindowDescription` is provided', () => {
|
|
@@ -419,7 +419,7 @@ describe('macro: button', () => {
|
|
|
419
419
|
}),
|
|
420
420
|
);
|
|
421
421
|
|
|
422
|
-
expect($('.ons-btn__new-window-description').text()).toBe('(custom opens in a new window text)');
|
|
422
|
+
expect($('.ons-btn__new-window-description').text()).toBe(' (custom opens in a new window text)');
|
|
423
423
|
});
|
|
424
424
|
|
|
425
425
|
it('has the `download` attribute when `buttonStyle` is "download"', () => {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<div class="ons-grid ons-grid--flex ons-grid--vertical-center ons-grid--no-wrap@s">
|
|
6
6
|
<div class="ons-grid__col ons-col-auto ons-u-flex-shrink@s">
|
|
7
7
|
<h2 class="ons-call-to-action__heading ons-u-fs-r--b ons-u-di">{{ params.headingText }}</h2>
|
|
8
|
-
{% if params.paragraphText
|
|
8
|
+
{% if params.paragraphText %}
|
|
9
9
|
<p class="ons-call-to-action__text ons-u-di">{{ params.paragraphText }}</p>
|
|
10
10
|
{% endif %}
|
|
11
11
|
</div>
|
|
@@ -6,31 +6,31 @@
|
|
|
6
6
|
|
|
7
7
|
<div class="ons-card" aria-describedBy="{{ params.textId }}">
|
|
8
8
|
|
|
9
|
-
{%- if params.image
|
|
10
|
-
{%- if params.url
|
|
9
|
+
{%- if params.image -%}
|
|
10
|
+
{%- if params.url -%}
|
|
11
11
|
<a href="{{ params.url }}" class="ons-card__link ons-u-db">
|
|
12
12
|
{%- endif -%}
|
|
13
|
-
{% if params.image.smallSrc
|
|
14
|
-
<img class="ons-card__image ons-u-mb-s" height="200" width="303"{% if params.image.largeSrc
|
|
15
|
-
{% elif params.image == true or params.image.placeholderURL
|
|
16
|
-
<img class="ons-card__image ons-u-mb-s" height="100" width="303" srcset="{{ params.image.placeholderURL if params.image.placeholderURL
|
|
13
|
+
{% if params.image.smallSrc %}
|
|
14
|
+
<img class="ons-card__image ons-u-mb-s" height="200" width="303"{% if params.image.largeSrc %} srcset="{{ params.image.smallSrc }} 1x, {{ params.image.largeSrc }} 2x"{% endif %} src="{{ params.image.smallSrc }}" alt="{{ params.image.alt }}" loading="lazy">
|
|
15
|
+
{% elif params.image == true or params.image.placeholderURL %}
|
|
16
|
+
<img class="ons-card__image ons-u-mb-s" height="100" width="303" srcset="{{ params.image.placeholderURL if params.image.placeholderURL }}/img/small/placeholder-card.png 1x, {{ params.image.placeholderURL if params.image.placeholderURL }}/img/large/placeholder-card.png 2x" src="{{ params.image.placeholderURL if params.image.placeholderURL }}/img/small/placeholder-card.png" alt="" loading="lazy">
|
|
17
17
|
{% endif %}
|
|
18
18
|
|
|
19
19
|
<h{{ titleSize }} class="ons-card__title {{ params.titleClasses | default('ons-u-fs-m')}}" id="{{ params.id }}">
|
|
20
20
|
{{ params.title }}
|
|
21
21
|
</h{{ titleSize }}>
|
|
22
|
-
{%- if params.url
|
|
22
|
+
{%- if params.url -%}
|
|
23
23
|
</a>
|
|
24
24
|
{%- endif -%}
|
|
25
25
|
|
|
26
26
|
{%- else -%}
|
|
27
27
|
|
|
28
28
|
<h{{ titleSize }} class="ons-card__title {{ params.titleClasses | default('ons-u-fs-m') }}" id="{{ params.id }}">
|
|
29
|
-
{%- if params.url
|
|
29
|
+
{%- if params.url -%}
|
|
30
30
|
<a class="ons-card__link" href="{{ params.url }}">
|
|
31
31
|
{%- endif -%}
|
|
32
32
|
{{ params.title }}
|
|
33
|
-
{%- if params.url
|
|
33
|
+
{%- if params.url -%}
|
|
34
34
|
</a>
|
|
35
35
|
{%- endif -%}
|
|
36
36
|
</h{{ titleSize }}>
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
|
|
40
40
|
<p id="{{ params.textId }}">{{ params.text }}</p>
|
|
41
41
|
|
|
42
|
-
{% if params.itemsList
|
|
42
|
+
{% if params.itemsList -%}
|
|
43
43
|
{{
|
|
44
44
|
onsList({
|
|
45
45
|
"variants": 'dashed',
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{% macro onsCheckbox(params) %}
|
|
2
2
|
{% from "components/label/_macro.njk" import onsLabel %}
|
|
3
3
|
|
|
4
|
-
<span class="ons-checkbox{% if params.hideLabel
|
|
4
|
+
<span class="ons-checkbox{% if params.hideLabel == true %} ons-checkbox--no-label{% endif %}{{ ' ' + params.classes if params.classes else '' }}">
|
|
5
5
|
<input
|
|
6
6
|
type="checkbox"
|
|
7
7
|
id="{{ params.id }}"
|
|
8
|
-
class="ons-checkbox__input ons-js-checkbox{{ ' ' + params.inputClasses if params.inputClasses
|
|
8
|
+
class="ons-checkbox__input ons-js-checkbox{{ ' ' + params.inputClasses if params.inputClasses else '' }}"
|
|
9
9
|
value="{{ params.value }}"
|
|
10
|
-
{% if params.disabled
|
|
11
|
-
{% if params.name
|
|
12
|
-
{% if params.checked
|
|
13
|
-
{% if params.other
|
|
14
|
-
{% if params.attributes
|
|
15
|
-
{% if params.deselectMessage
|
|
10
|
+
{% if params.disabled == true %}disabled aria-disabled="true"{%endif %}
|
|
11
|
+
{% if params.name %} name="{{ params.name }}"{% endif %}
|
|
12
|
+
{% if params.checked %} checked{% endif %}
|
|
13
|
+
{% if params.other and not params.other.open %} aria-controls="{{ params.id }}-other-wrap" aria-haspopup="true"{% endif %}
|
|
14
|
+
{% 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 %}
|
|
15
|
+
{% if params.deselectMessage %} data-deselect-message="{{ params.deselectMessage }}"{% endif %}
|
|
16
16
|
>
|
|
17
17
|
|
|
18
18
|
{{ onsLabel({
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"description": params.label.description
|
|
25
25
|
}) }}
|
|
26
26
|
|
|
27
|
-
{% if params.other
|
|
27
|
+
{% if params.other %}
|
|
28
28
|
{% set otherType = params.other.otherType | default('input') %}
|
|
29
29
|
<span class="ons-checkbox__other{{ ' ons-checkbox__other--open' if params.other.open }}" id="{{ params.id }}-other-wrap">
|
|
30
30
|
{% if otherType == "input" %}
|