@ons/design-system 55.1.0 → 56.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/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/button/_button.scss +49 -51
- package/components/button/_macro.njk +61 -35
- package/components/button/_macro.spec.js +24 -24
- package/components/button/button.spec.js +11 -11
- 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/_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/_macro.njk +7 -7
- package/components/date-input/_macro.njk +5 -5
- package/components/document-list/_macro.njk +29 -29
- 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 +1 -1
- package/components/feedback/_macro.njk +2 -2
- package/components/field/_macro.njk +5 -5
- package/components/fieldset/_fieldset.scss +5 -0
- package/components/fieldset/_macro.njk +8 -8
- package/components/footer/_macro.njk +19 -23
- package/components/footer/_macro.spec.js +0 -6
- package/components/header/_macro.njk +39 -41
- package/components/header/_macro.spec.js +4 -8
- package/components/hero/_macro.njk +15 -15
- package/components/icons/_macro.njk +2 -2
- package/components/images/_macro.njk +3 -3
- package/components/input/_input-type.scss +4 -0
- package/components/input/_macro.njk +41 -34
- package/components/input/_macro.spec.js +66 -59
- package/components/label/_macro.njk +1 -1
- package/components/language-selector/_macro.njk +1 -1
- package/components/lists/_macro.njk +22 -22
- package/components/message/_macro.njk +6 -6
- package/components/message-list/_macro.njk +1 -1
- package/components/metadata/_macro.njk +2 -2
- package/components/modal/_macro.njk +4 -4
- package/components/mutually-exclusive/_macro.njk +1 -1
- package/components/mutually-exclusive/mutually-exclusive.js +3 -1
- package/components/navigation/_macro.njk +11 -10
- package/components/navigation/_macro.spec.js +3 -2
- package/components/pagination/_macro.njk +3 -3
- package/components/panel/_macro.njk +37 -39
- package/components/panel/_macro.spec.js +1 -13
- package/components/promotional-banner/_macro.njk +2 -2
- package/components/question/_macro.njk +20 -20
- package/components/question/_macro.spec.js +2 -2
- package/components/question/_question.scss +1 -1
- package/components/quote/_macro.njk +2 -2
- package/components/radios/_macro.njk +8 -8
- package/components/radios/check-radios.js +5 -1
- package/components/related-content/_macro.njk +2 -2
- package/components/relationships/_macro.njk +4 -3
- package/components/search/_macro.njk +12 -2
- package/components/search/_macro.spec.js +27 -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/status/_macro.njk +2 -2
- package/components/summary/_macro.njk +25 -25
- package/components/table/_macro.njk +10 -10
- package/components/table-of-contents/_macro.njk +4 -4
- 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 +35 -35
- package/package.json +1 -1
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- package/scss/patternlib.scss +2 -2
|
@@ -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({
|
|
@@ -30,16 +30,9 @@ $button-shadow-size: 3px;
|
|
|
30
30
|
top: 0;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
.ons-svg-icon {
|
|
34
|
-
height: 18px;
|
|
35
|
-
margin-top: -$button-shadow-size;
|
|
36
|
-
vertical-align: middle;
|
|
37
|
-
width: 18px;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
33
|
&--search {
|
|
41
34
|
.ons-svg-icon {
|
|
42
|
-
@include mq(s,
|
|
35
|
+
@include mq(s, l) {
|
|
43
36
|
margin-right: 0.5rem;
|
|
44
37
|
}
|
|
45
38
|
}
|
|
@@ -55,6 +48,14 @@ $button-shadow-size: 3px;
|
|
|
55
48
|
// Required for Google Tag Manager
|
|
56
49
|
pointer-events: none;
|
|
57
50
|
position: relative;
|
|
51
|
+
|
|
52
|
+
.ons-svg-icon {
|
|
53
|
+
fill: $color-text-inverse;
|
|
54
|
+
height: 18px;
|
|
55
|
+
margin-top: -$button-shadow-size;
|
|
56
|
+
vertical-align: middle;
|
|
57
|
+
width: 18px;
|
|
58
|
+
}
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
// When preceded by another button (for example, in a group)
|
|
@@ -74,6 +75,10 @@ $button-shadow-size: 3px;
|
|
|
74
75
|
background: $color-focus;
|
|
75
76
|
box-shadow: 0 ems($button-shadow-size) 0 $color-text-link-focus;
|
|
76
77
|
color: $color-text-link-focus;
|
|
78
|
+
|
|
79
|
+
.ons-svg-icon {
|
|
80
|
+
fill: $color-text-link-focus;
|
|
81
|
+
}
|
|
77
82
|
}
|
|
78
83
|
|
|
79
84
|
&:focus:hover:not(:active) &__inner {
|
|
@@ -87,6 +92,10 @@ $button-shadow-size: 3px;
|
|
|
87
92
|
background: $color-button;
|
|
88
93
|
box-shadow: none;
|
|
89
94
|
color: $color-text-inverse;
|
|
95
|
+
|
|
96
|
+
.ons-svg-icon {
|
|
97
|
+
fill: $color-text-inverse;
|
|
98
|
+
}
|
|
90
99
|
}
|
|
91
100
|
}
|
|
92
101
|
|
|
@@ -156,16 +165,6 @@ $button-shadow-size: 3px;
|
|
|
156
165
|
text-decoration: none;
|
|
157
166
|
}
|
|
158
167
|
|
|
159
|
-
&--link:not(&--secondary) &,
|
|
160
|
-
&--link:active:not(&--secondary) &,
|
|
161
|
-
&--link:hover:not(&--secondary) & {
|
|
162
|
-
&__inner {
|
|
163
|
-
.ons-svg-icon {
|
|
164
|
-
fill: $color-text-inverse;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
168
|
&--link:focus:not(:active):not(&--secondary) &,
|
|
170
169
|
&--link:focus:hover:not(:active):not(&--secondary) & {
|
|
171
170
|
outline: inherit;
|
|
@@ -177,38 +176,6 @@ $button-shadow-size: 3px;
|
|
|
177
176
|
}
|
|
178
177
|
}
|
|
179
178
|
|
|
180
|
-
&--loader &__inner {
|
|
181
|
-
position: relative;
|
|
182
|
-
transition: color 0.3s ease-in-out;
|
|
183
|
-
.ons-svg-icon {
|
|
184
|
-
height: 27px;
|
|
185
|
-
left: 50%;
|
|
186
|
-
margin: 0;
|
|
187
|
-
opacity: 0;
|
|
188
|
-
position: absolute;
|
|
189
|
-
top: 50%;
|
|
190
|
-
transform: translate(-50%, -50%);
|
|
191
|
-
transition: opacity 0.3s ease-in-out;
|
|
192
|
-
width: 27px;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
&--loader.ons-btn--small {
|
|
197
|
-
.ons-svg-icon {
|
|
198
|
-
height: 24px;
|
|
199
|
-
width: 24px;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
&--loader.ons-is-loading &__inner {
|
|
204
|
-
color: transparent;
|
|
205
|
-
.ons-svg-icon {
|
|
206
|
-
fill: $color-white;
|
|
207
|
-
margin-left: 0 !important;
|
|
208
|
-
opacity: 1;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
179
|
&--text-link {
|
|
213
180
|
vertical-align: baseline;
|
|
214
181
|
}
|
|
@@ -298,7 +265,7 @@ $button-shadow-size: 3px;
|
|
|
298
265
|
box-shadow: none;
|
|
299
266
|
color: $color-text;
|
|
300
267
|
.ons-svg-icon {
|
|
301
|
-
fill: $color-
|
|
268
|
+
fill: $color-text;
|
|
302
269
|
}
|
|
303
270
|
}
|
|
304
271
|
}
|
|
@@ -394,6 +361,37 @@ $button-shadow-size: 3px;
|
|
|
394
361
|
}
|
|
395
362
|
}
|
|
396
363
|
|
|
364
|
+
&--loader &__inner {
|
|
365
|
+
position: relative;
|
|
366
|
+
transition: color 0.3s ease-in-out;
|
|
367
|
+
.ons-svg-icon {
|
|
368
|
+
height: 27px;
|
|
369
|
+
left: 50%;
|
|
370
|
+
margin: 0;
|
|
371
|
+
opacity: 0;
|
|
372
|
+
position: absolute;
|
|
373
|
+
top: 50%;
|
|
374
|
+
transform: translate(-50%, -50%);
|
|
375
|
+
transition: opacity 0.3s ease-in-out;
|
|
376
|
+
width: 27px;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
&--loader.ons-btn--small {
|
|
381
|
+
.ons-svg-icon {
|
|
382
|
+
height: 24px;
|
|
383
|
+
width: 24px;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
&--loader.ons-is-loading &__inner {
|
|
388
|
+
color: transparent;
|
|
389
|
+
.ons-svg-icon {
|
|
390
|
+
margin-left: 0 !important;
|
|
391
|
+
opacity: 1;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
397
395
|
&--dropdown:focus & {
|
|
398
396
|
&__inner {
|
|
399
397
|
box-shadow: inset 0 -4px 0 0 $color-text-link-focus;
|
|
@@ -2,60 +2,86 @@
|
|
|
2
2
|
|
|
3
3
|
{% macro onsButton(params) %}
|
|
4
4
|
|
|
5
|
-
{#
|
|
6
|
-
{% if params.iconType
|
|
5
|
+
{# Set button icon #}
|
|
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 #}
|
|
12
12
|
{% set iconPosition = "before" %}
|
|
13
13
|
{% endif %}
|
|
14
14
|
{% elif params.iconType is not defined and params.noIcon is not defined %}
|
|
15
|
-
{
|
|
16
|
-
{
|
|
15
|
+
{% if params.url and params.newWindow %}
|
|
16
|
+
{# CTA link opening in new tab #}
|
|
17
17
|
{% set iconType = "external-link" %}
|
|
18
18
|
{% set iconPosition = "after" %}
|
|
19
|
-
{
|
|
20
|
-
{
|
|
21
|
-
{% set iconType = "
|
|
22
|
-
{% set iconPosition = "
|
|
23
|
-
{
|
|
24
|
-
|
|
19
|
+
{% elif params.url %}
|
|
20
|
+
{# CTA link #}
|
|
21
|
+
{% set iconType = "arrow-next" %}
|
|
22
|
+
{% set iconPosition = "after" %}
|
|
23
|
+
{% endif %}
|
|
24
|
+
{% endif %}
|
|
25
|
+
|
|
26
|
+
{# Set button type #}
|
|
27
|
+
{% if params.type %}
|
|
28
|
+
{% set buttonType = params.type %}
|
|
29
|
+
{% else %}
|
|
30
|
+
{% set buttonType = 'submit' %}
|
|
31
|
+
{% endif %}
|
|
32
|
+
|
|
33
|
+
{# Set button variant attributes #}
|
|
34
|
+
{% if params.variants %}
|
|
35
|
+
{% if 'print' in params.variants %}
|
|
36
|
+
{# Print #}
|
|
37
|
+
{% if params.type is not defined %}
|
|
38
|
+
{% set buttonType = "button" %}
|
|
39
|
+
{% endif %}
|
|
25
40
|
{% set iconType = "print" %}
|
|
26
41
|
{% set iconPosition = "before" %}
|
|
27
|
-
|
|
28
|
-
{% elif
|
|
29
|
-
{
|
|
30
|
-
{% set
|
|
31
|
-
|
|
32
|
-
|
|
42
|
+
{% set variantClasses = "ons-u-d-no ons-js-print-btn" %}
|
|
43
|
+
{% elif 'download' in params.variants %}
|
|
44
|
+
{# Download #}
|
|
45
|
+
{% set iconType = "download" %}
|
|
46
|
+
{% set iconPosition = "before" %}
|
|
47
|
+
{% if not params.removeDownloadAttribute %}
|
|
48
|
+
{% set variantAttributes = "download" %}
|
|
49
|
+
{% endif %}
|
|
50
|
+
{% elif 'mobile' in params.variants %}
|
|
51
|
+
{# CTA or mobile menu toggle #}
|
|
33
52
|
{% set iconType = "chevron" %}
|
|
34
53
|
{% set iconPosition = "after" %}
|
|
35
|
-
{% elif
|
|
36
|
-
{% set
|
|
54
|
+
{% elif 'disabled' in params.variants %}
|
|
55
|
+
{% set variantAttributes = "disabled" %}
|
|
56
|
+
{% elif 'timer' in params.variants %}
|
|
57
|
+
{# Timer #}
|
|
58
|
+
{% set variantClasses = "ons-js-timer ons-js-submit-btn" %}
|
|
59
|
+
{% elif 'loader' in params.variants %}
|
|
60
|
+
{# Loader #}
|
|
61
|
+
{% set iconType = "loader" %}
|
|
37
62
|
{% set iconPosition = "after" %}
|
|
63
|
+
{% set variantClasses = "ons-btn--loader ons-js-loader ons-js-submit-btn" %}
|
|
38
64
|
{% endif %}
|
|
39
65
|
{% endif %}
|
|
40
66
|
|
|
41
|
-
{% set tag = "a" if params.url or params.dsExample
|
|
67
|
+
{% set tag = "a" if params.url or params.dsExample else "button" %}
|
|
42
68
|
|
|
43
69
|
<{{ tag }}
|
|
44
|
-
{% if params.url
|
|
70
|
+
{% if params.url %}
|
|
45
71
|
href="{{ params.url }}"
|
|
46
72
|
role="button"
|
|
47
73
|
{% else %}
|
|
48
|
-
type="{{
|
|
74
|
+
type="{{ buttonType }}"
|
|
49
75
|
{% 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
|
-
{
|
|
56
|
-
{% if params.attributes
|
|
76
|
+
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 variantClasses %} {{ variantClasses }}{% endif %}"
|
|
77
|
+
{% if params.id %}id="{{ params.id }}"{% endif %}
|
|
78
|
+
{% if params.value and tag != "a" %}value="{{ params.value }}"{% endif %}
|
|
79
|
+
{% if params.name and tag != "a" %}name="{{ params.name }}"{% endif %}
|
|
80
|
+
{% if params.url and params.newWindow %}target="_blank" rel="noopener"{% endif %}
|
|
81
|
+
{{ variantAttributes }}
|
|
82
|
+
{% 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
83
|
>
|
|
58
|
-
<span class="ons-btn__inner{% if params.innerClasses
|
|
84
|
+
<span class="ons-btn__inner{% if params.innerClasses %} {{ params.innerClasses }}{% endif %}">
|
|
59
85
|
{%- if iconPosition == "before" or iconPosition == "after" %}
|
|
60
86
|
{%- if iconPosition == "before" %}
|
|
61
87
|
{{
|
|
@@ -65,7 +91,7 @@
|
|
|
65
91
|
})
|
|
66
92
|
}}
|
|
67
93
|
{% endif -%}
|
|
68
|
-
<span class="ons-btn__text">{{- params.html | safe if params.html
|
|
94
|
+
<span class="ons-btn__text">{{- params.html | safe if params.html else params.text -}}</span>
|
|
69
95
|
{%- if iconPosition == "after" %}
|
|
70
96
|
{{
|
|
71
97
|
onsIcon({
|
|
@@ -80,15 +106,15 @@
|
|
|
80
106
|
"iconType": iconType
|
|
81
107
|
})
|
|
82
108
|
}}
|
|
83
|
-
<span class="ons-btn__text ons-u-vh@xxs@s">{{- params.html | safe if params.html
|
|
109
|
+
<span class="ons-btn__text ons-u-vh@xxs@s">{{- params.html | safe if params.html else params.text -}}</span>
|
|
84
110
|
{% else -%}
|
|
85
|
-
<span class="ons-btn__text">{{- params.html | safe if params.html
|
|
111
|
+
<span class="ons-btn__text">{{- params.html | safe if params.html else params.text -}}</span>
|
|
86
112
|
{% endif -%}
|
|
87
113
|
</span>
|
|
88
|
-
{% if params.url
|
|
114
|
+
{% if params.url and params.newWindow %}
|
|
89
115
|
<span class="ons-btn__new-window-description ons-u-vh"> ({{ params.newWindowDescription | default("opens in a new tab") }})</span>
|
|
90
116
|
{% endif %}
|
|
91
|
-
{% if params.buttonContext
|
|
117
|
+
{% if params.buttonContext %}
|
|
92
118
|
<span class="ons-btn__context ons-u-vh">{{ params.buttonContext }}</span>
|
|
93
119
|
{% endif %}
|
|
94
120
|
{% if params.listeners %}
|