@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.
Files changed (81) hide show
  1. package/components/access-code/_macro.njk +3 -3
  2. package/components/accordion/_macro.njk +1 -1
  3. package/components/address-input/_macro.njk +7 -7
  4. package/components/address-output/_macro.njk +7 -7
  5. package/components/autosuggest/_macro.njk +19 -19
  6. package/components/breadcrumbs/_macro.njk +3 -3
  7. package/components/button/_button.scss +49 -51
  8. package/components/button/_macro.njk +61 -35
  9. package/components/button/_macro.spec.js +24 -24
  10. package/components/button/button.spec.js +11 -11
  11. package/components/call-to-action/_macro.njk +1 -1
  12. package/components/card/_macro.njk +10 -10
  13. package/components/checkboxes/_checkbox-macro.njk +9 -9
  14. package/components/checkboxes/_macro.njk +10 -10
  15. package/components/checkboxes/checkbox-with-fieldset.js +6 -5
  16. package/components/checkboxes/checkboxes.dom.js +6 -9
  17. package/components/code-highlight/_macro.njk +1 -1
  18. package/components/collapsible/_macro.njk +7 -7
  19. package/components/date-input/_macro.njk +5 -5
  20. package/components/document-list/_macro.njk +29 -29
  21. package/components/duration/_macro.njk +9 -9
  22. package/components/duration/_macro.spec.js +0 -3
  23. package/components/error/_macro.njk +1 -1
  24. package/components/external-link/_macro.njk +1 -1
  25. package/components/feedback/_macro.njk +2 -2
  26. package/components/field/_macro.njk +5 -5
  27. package/components/fieldset/_fieldset.scss +5 -0
  28. package/components/fieldset/_macro.njk +8 -8
  29. package/components/footer/_macro.njk +19 -23
  30. package/components/footer/_macro.spec.js +0 -6
  31. package/components/header/_macro.njk +39 -41
  32. package/components/header/_macro.spec.js +4 -8
  33. package/components/hero/_macro.njk +15 -15
  34. package/components/icons/_macro.njk +2 -2
  35. package/components/images/_macro.njk +3 -3
  36. package/components/input/_input-type.scss +4 -0
  37. package/components/input/_macro.njk +41 -34
  38. package/components/input/_macro.spec.js +66 -59
  39. package/components/label/_macro.njk +1 -1
  40. package/components/language-selector/_macro.njk +1 -1
  41. package/components/lists/_macro.njk +22 -22
  42. package/components/message/_macro.njk +6 -6
  43. package/components/message-list/_macro.njk +1 -1
  44. package/components/metadata/_macro.njk +2 -2
  45. package/components/modal/_macro.njk +4 -4
  46. package/components/mutually-exclusive/_macro.njk +1 -1
  47. package/components/mutually-exclusive/mutually-exclusive.js +3 -1
  48. package/components/navigation/_macro.njk +11 -10
  49. package/components/navigation/_macro.spec.js +3 -2
  50. package/components/pagination/_macro.njk +3 -3
  51. package/components/panel/_macro.njk +37 -39
  52. package/components/panel/_macro.spec.js +1 -13
  53. package/components/promotional-banner/_macro.njk +2 -2
  54. package/components/question/_macro.njk +20 -20
  55. package/components/question/_macro.spec.js +2 -2
  56. package/components/question/_question.scss +1 -1
  57. package/components/quote/_macro.njk +2 -2
  58. package/components/radios/_macro.njk +8 -8
  59. package/components/radios/check-radios.js +5 -1
  60. package/components/related-content/_macro.njk +2 -2
  61. package/components/relationships/_macro.njk +4 -3
  62. package/components/search/_macro.njk +12 -2
  63. package/components/search/_macro.spec.js +27 -2
  64. package/components/section-navigation/_macro.njk +2 -2
  65. package/components/select/_macro.njk +8 -8
  66. package/components/share-page/_macro.njk +2 -2
  67. package/components/status/_macro.njk +2 -2
  68. package/components/summary/_macro.njk +25 -25
  69. package/components/table/_macro.njk +10 -10
  70. package/components/table-of-contents/_macro.njk +4 -4
  71. package/components/textarea/_macro.njk +8 -8
  72. package/components/timeline/_macro.njk +1 -1
  73. package/components/video/_macro.njk +1 -1
  74. package/css/census.css +1 -1
  75. package/css/ids.css +1 -1
  76. package/css/main.css +1 -1
  77. package/layout/_template.njk +35 -35
  78. package/package.json +1 -1
  79. package/scripts/main.es5.js +1 -1
  80. package/scripts/main.js +1 -1
  81. package/scss/patternlib.scss +2 -2
@@ -26,9 +26,9 @@
26
26
  }) }}
27
27
  {% endset %}
28
28
 
29
- {% if params.error is not defined %}
29
+ {% if not params.error %}
30
30
  {% call onsPanel({
31
- "classes": "ons-u-mb-s" + (' ' + params.classes if params.classes is defined and 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 is defined and 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 is defined and 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 is defined and 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 is defined and 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 is defined and 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 is defined and 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 is defined and 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 is defined and params.uprn and params.uprn.value is defined and params.uprn.value %}
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 is defined and 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 is defined and params.classes %} {{ params.classes }}{% endif %}">
2
+ <div class="ons-address-output{% if params.classes %} {{ params.classes }}{% endif %}">
3
3
  <p class="ons-address-output__lines">
4
- {% if params.unit is defined and 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 is defined and 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 is defined and 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 is defined and 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 is defined and 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 is defined and 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 is defined and params.mandatory == true %} ons-js-address-mandatory{% endif %} {% if params.containerClasses is defined and params.containerClasses %} {{ params.containerClasses }}{% endif %} ons-autosuggest-input"
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 is defined and params.APIDomain %}data-api-domain="{{ params.APIDomain }}"{% endif %}
19
- {% if params.APIDomainBearerToken is defined and params.APIDomainBearerToken %}data-authorization-token="{{ params.APIDomainBearerToken }}"{% endif %}
20
- {% if params.APIManualQueryParams is defined and params.APIManualQueryParams == true %}data-query-params=""{% endif %}
21
- {% if params.allowMultiple is defined and params.allowMultiple == true %}data-allow-multiple="true"{% endif %}
22
- {% if params.autosuggestData is defined and params.autosuggestData %}data-autosuggest-data="{{ params.autosuggestData }}"{% endif %}
23
- {% if params.errorTitle is defined and params.errorTitle %}data-error-title="{{ params.errorTitle }}"{% endif %}
24
- {% if params.errorMessageEnter is defined and params.errorMessageEnter %}data-error-enter="{{ params.errorMessageEnter }}"{% endif %}
25
- {% if params.errorMessageSelect is defined and params.errorMessageSelect %}data-error-select="{{ params.errorMessageSelect }}"{% endif %}
26
- {% if params.ariaGroupedResults is defined and params.ariaGroupedResults %}data-aria-grouped-results="{{ params.ariaGroupedResults }}"{% endif %}
27
- {% if params.groupCount is defined and params.groupCount %}data-group-count="{{ params.groupCount }}"{% endif %}
28
- {% if params.tooManyResults is defined and params.tooManyResults %}data-too-many-results="{{ params.tooManyResults }}"{% endif %}
29
- {% if params.errorMessageAPI is defined and params.errorMessageAPI %}data-error-api="{{ params.errorMessageAPI }}"{% endif %}
30
- {% if params.errorMessageAPILinkText is defined and params.errorMessageAPILinkText %}data-error-api-link-text="{{ params.errorMessageAPILinkText }}"{% endif %}
31
- {% if params.options is defined and params.options %}
32
- {% if params.options.oneYearAgo is defined and params.options.oneYearAgo %}data-options-one-year-ago="true"{% endif %}
33
- {% if params.options.regionCode is defined and params.options.regionCode %}data-options-region-code="{{ params.options.regionCode }}"{% endif %}
34
- {% if params.options.addressType is defined and params.options.addressType %}data-options-address-type="{{ params.options.addressType }}"{% endif %}
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 is not defined %}
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 is defined and params.id %} id="{{ params.id }}"{% endif %}>
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 is defined and item.id %} id="{{ item.id }}"{% endif %}
9
- {% if item.attributes is defined and 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 %}
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, m) {
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-black;
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
- {# Customisable button icon #}
6
- {% if params.iconType is defined and params.iconType %}
5
+ {# Set button icon #}
6
+ {% if params.iconType %}
7
7
  {% set iconType = params.iconType %}
8
- {% if params.iconPosition is defined and 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
- {# Opens in new tab #}
16
- {% if params.url is defined and params.url and params.newWindow is defined and params.newWindow %}
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
- {# Download #}
20
- {% elif params.buttonStyle is defined and params.buttonStyle == "download" %}
21
- {% set iconType = "download" %}
22
- {% set iconPosition = "before" %}
23
- {# Print #}
24
- {% elif params.buttonStyle is defined and params.buttonStyle == "print" %}
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
- {# Loader #}
28
- {% elif params.submitType is defined and params.submitType == "loader" %}
29
- {% set iconType = "loader" %}
30
- {% set iconPosition = "after" %}
31
- {# CTA or mobile menu toggle #}
32
- {% elif params.buttonStyle is defined and params.buttonStyle == "mobile" %}
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 params.url is defined and params.url %}
36
- {% set iconType = "arrow-next" %}
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 is defined and params.dsExample else "button" %}
67
+ {% set tag = "a" if params.url or params.dsExample else "button" %}
42
68
 
43
69
  <{{ tag }}
44
- {% if params.url is defined and params.url %}
70
+ {% if params.url %}
45
71
  href="{{ params.url }}"
46
72
  role="button"
47
73
  {% else %}
48
- type="{{ params.type if params.type is defined and params.type else ('button' if params.buttonStyle == "print" else 'submit') }}"
74
+ type="{{ buttonType }}"
49
75
  {% endif %}
50
- class="ons-btn{% if params.classes is defined and params.classes %} {{ params.classes }}{% endif %}{% if params.variants is defined and 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 is defined and 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 is defined and params.id %}id="{{ params.id }}"{% endif %}
52
- {% if params.value is defined and params.value and tag != "a" %}value="{{ params.value }}"{% endif %}
53
- {% if params.name is defined and params.name and tag != "a" %}name="{{ params.name }}"{% endif %}
54
- {% if params.url is defined and params.url and params.newWindow is defined and params.newWindow %}target="_blank" rel="noopener"{% endif %}
55
- {% if params.buttonStyle == "download" and (params.removeDownloadAttribute is not defined or not params.removeDownloadAttribute or params.removeDownloadAttribute != true) %} download{% endif %}
56
- {% if params.attributes is defined and 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 %}
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 is defined and params.innerClasses %} {{ params.innerClasses }}{% endif %}">
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 is defined and params.html else params.text -}}</span>
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 is defined and params.html else params.text -}}</span>
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 is defined and params.html else params.text -}}</span>
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 is defined and params.url and params.newWindow is defined and params.newWindow %}
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 is defined and 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 %}