@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
@@ -7,12 +7,12 @@
7
7
  {% set title_tag = "h1" if params.titleAsH1 else "div" %}
8
8
  {% set currentLanguageISOCode = "en" %}
9
9
 
10
- {% if params.language is defined and params.language and params.language.languages is defined and params.language.languages %}
10
+ {% if params.language and params.language.languages %}
11
11
  {% set currentLanguage = params.language.languages | selectattr("current") | first %}
12
12
  {% set currentLanguageISOCode = currentLanguage.ISOCode %}
13
13
  {% endif %}
14
14
 
15
- <header class="ons-header {% if params.classes is defined and params.classes %} {{ params.classes }}{% endif %}{% if params.variants is not string %}{% for variant in params.variants %} ons-header--{{ variant }}{% endfor %}{% else %} ons-header--{{ params.variants }}{% endif %}" role="banner">
15
+ <header class="ons-header {% if params.classes %} {{ params.classes }}{% endif %}{% if params.variants is not string %}{% for variant in params.variants %} ons-header--{{ variant }}{% endfor %}{% else %} ons-header--{{ params.variants }}{% endif %}" role="banner">
16
16
  {{
17
17
  onsBrowserBanner({
18
18
  "lang": currentLanguageISOCode,
@@ -20,7 +20,7 @@
20
20
  "fullWidth": params.fullWidth
21
21
  })
22
22
  }}
23
- {% if params.phase is defined and params.phase %}
23
+ {% if params.phase %}
24
24
  {% from "components/phase-banner/_macro.njk" import onsPhaseBanner %}
25
25
  {{ onsPhaseBanner({
26
26
  "fullWidth": params.fullWidth,
@@ -33,9 +33,9 @@
33
33
  {% if params.noMasthead != true %}
34
34
  <div class="ons-header__top">
35
35
  <div class="ons-container{{ ' ons-container--full-width' if params.fullWidth }}{{ ' ons-container--wide' if params.wide }}">
36
- <div class="ons-header__grid-top ons-grid ons-grid--gutterless ons-grid--flex ons-grid--between ons-grid--vertical-center ons-grid--no-wrap{{ ' ons-header__grid-top-tall' if params.customHeaderLogo is defined and params.customHeaderLogo }}">
36
+ <div class="ons-header__grid-top ons-grid ons-grid--gutterless ons-grid--flex ons-grid--between ons-grid--vertical-center ons-grid--no-wrap{{ ' ons-header__grid-top-tall' if params.customHeaderLogo }}">
37
37
  <div class="ons-grid__col ons-col-auto">
38
- {%-if params.orgLogoHref is defined and params.orgLogoHref %}
38
+ {%-if params.orgLogoHref %}
39
39
  <a class="ons-header__org-logo-link" href="{{ params.orgLogoHref }}">
40
40
  {% endif -%}
41
41
  <div class="ons-header__org-logo ons-header__org-logo--large">
@@ -55,20 +55,20 @@
55
55
  })
56
56
  }}
57
57
  </div>
58
- {% if params.orgLogoHref is defined and params.orgLogoHref %}
58
+ {% if params.orgLogoHref %}
59
59
  </a>
60
60
  {% endif %}
61
61
  </div>
62
- {% if params.language is defined and params.language or params.serviceLinks is defined and params.serviceLinks %}
62
+ {% if params.language or params.serviceLinks %}
63
63
  <div class="ons-header__links ons-grid__col ons-col-auto">
64
- {% if params.language is defined and params.language %}
65
- <div class="ons-grid__col ons-col-auto {{ ' ons-u-mr-s ons-u-d-no@xxs@xs' if params.serviceLinks is defined and params.serviceLinks else '' }}">
64
+ {% if params.language %}
65
+ <div class="ons-grid__col ons-col-auto {{ ' ons-u-mr-s ons-u-d-no@xxs@xs' if params.serviceLinks else '' }}">
66
66
  {% from "components/language-selector/_macro.njk" import onsLanguageSelector %}
67
67
  {{ onsLanguageSelector(params.language) }}
68
68
  </div>
69
69
  {% endif %}
70
- {% if params.serviceLinks is defined and params.serviceLinks %}
71
- {% if params.serviceLinks.itemsList | length == 1 and params.language is defined and params.language %}
70
+ {% if params.serviceLinks %}
71
+ {% if params.serviceLinks.itemsList | length == 1 and params.language %}
72
72
  {% set breakpoint = 'xs' %}
73
73
  {% set controlVisibility = true %}
74
74
  {% elif params.serviceLinks.itemsList | length > 1 %}
@@ -82,18 +82,18 @@
82
82
  <ul class="ons-header-service-nav__list">
83
83
  {% for item in (params.serviceLinks.itemsList if params.serviceLinks.itemsList is iterable else params.serviceLinks.itemsList.items()) %}
84
84
  <li class="ons-header-service-nav__item">
85
- {% if item.iconType is defined and item.iconType %}
85
+ {% if item.iconType %}
86
86
  {{
87
87
  onsIcon({
88
88
  "iconType": item.iconType
89
89
  })
90
90
  }}
91
91
  {% endif %}
92
- {% if item.url is defined and item.url %}
92
+ {% if item.url %}
93
93
  <a
94
94
  href="{{ item.url }}"
95
95
  class="ons-header-service-nav__link"
96
- {% if item.id is defined and item.id %} id="{{ item.id }}"{% endif %}
96
+ {% if item.id %} id="{{ item.id }}"{% endif %}
97
97
  >{{ item.title }}</a>
98
98
  {% else %}
99
99
  {{ item.title }}
@@ -103,18 +103,17 @@
103
103
  </ul>
104
104
  </nav>
105
105
  </div>
106
- {% if params.serviceLinks.itemsList | length > 1 or params.language is defined and params.language %}
106
+ {% if params.serviceLinks.itemsList | length > 1 or params.language %}
107
107
  {% if params.variants == 'internal' or params.variants == 'neutral' %}
108
- {% set buttonVariant = ["text-link", "text-link-inverse"] %}
108
+ {% set buttonVariant = ["mobile", "text-link", "text-link-inverse"] %}
109
109
  {% else %}
110
- {% set buttonVariant = "text-link" %}
110
+ {% set buttonVariant = ["mobile", "text-link"] %}
111
111
  {% endif %}
112
112
  <div class="ons-grid__col ons-col-auto ons-u-d-no@{{ breakpoint }}">
113
113
  {{ onsButton({
114
114
  "text": params.serviceLinks.toggleServicesButton.text | default("Account"),
115
115
  "classes": "ons-u-d-no ons-js-toggle-services",
116
116
  "type": "button",
117
- "buttonStyle": "mobile",
118
117
  "variants": buttonVariant,
119
118
  "attributes": {
120
119
  "aria-label": params.serviceLinks.toggleServicesButton.ariaLabel | default("Toggle menu"),
@@ -129,30 +128,30 @@
129
128
  {% endif %}
130
129
  </div>
131
130
  </div>
132
- {% if params.serviceLinks is defined and params.serviceLinks %}
131
+ {% if params.serviceLinks %}
133
132
  <nav class="ons-header-service-nav ons-header-service-nav--mobile ons-u-d-no ons-js-services-mobile-nav" id="{{ params.serviceLinks.id }}" aria-label="{{ params.serviceLinks.ariaLabel | default("Service links navigation") }}">
134
133
  <ul class="ons-header-service-nav__list">
135
134
  {% for item in (params.serviceLinks.itemsList if params.serviceLinks.itemsList is iterable else params.serviceLinks.itemsList.items()) %}
136
135
  <li class="ons-header-service-nav__item ons-header-service-nav__item--mobile">
137
- {% if item.iconType is defined and item.iconType %}
136
+ {% if item.iconType %}
138
137
  {{
139
138
  onsIcon({
140
139
  "iconType": item.iconType
141
140
  })
142
141
  }}
143
142
  {% endif %}
144
- {% if item.url is defined and item.url %}
143
+ {% if item.url %}
145
144
  <a
146
145
  href="{{ item.url }}"
147
146
  class="ons-header-service-nav__link"
148
- {% if item.id is defined and item.id %} id="{{ item.id }}"{% endif %}
147
+ {% if item.id %} id="{{ item.id }}"{% endif %}
149
148
  >{{ item.title }}</a>
150
149
  {% else %}
151
150
  {{ item.title }}
152
151
  {% endif %}
153
152
  </li>
154
153
  {% endfor %}
155
- {% if params.language is defined and params.language %}
154
+ {% if params.language %}
156
155
  <div class="ons-u-d-no@xs">
157
156
  {% from "components/language-selector/_macro.njk" import onsLanguageSelector %}
158
157
  {{ onsLanguageSelector(params.language) }}
@@ -167,11 +166,11 @@
167
166
  <div class="ons-container{{ ' ons-container--full-width' if params.fullWidth }}{{ ' ons-container--wide' if params.wide }}">
168
167
  <div class="ons-grid ons-grid--gutterless ons-grid--flex ons-grid--between ons-grid--vertical-center ons-grid--no-wrap">
169
168
  <div class="ons-grid__col ons-col-auto ons-u-flex-shrink">
170
- {% if params.titleLogo is defined and params.titleLogo and params.titleLogoAlt is defined and params.titleLogoAlt %}
171
- {% if params.titleLogoHref is defined and params.titleLogoHref %}
169
+ {% if params.titleLogo and params.titleLogoAlt %}
170
+ {% if params.titleLogoHref %}
172
171
  <a class="ons-header__title-logo-link" href="{{ params.titleLogoHref }}">
173
172
  {% endif %}
174
- <div class="ons-header__title-logo ons-header__title-logo--large {% if params.titleLogoClasses %} {{ params.titleLogoClasses }} {% endif %}{% if params.titleLogoMobile is defined and params.titleLogoMobile %}ons-u-d-no@xxs@s{% endif %}">
173
+ <div class="ons-header__title-logo ons-header__title-logo--large {% if params.titleLogoClasses %} {{ params.titleLogoClasses }} {% endif %}{% if params.titleLogoMobile %}ons-u-d-no@xxs@s{% endif %}">
175
174
  {% from "components/icons/_macro.njk" import onsIcon %}
176
175
  {{
177
176
  onsIcon({
@@ -180,7 +179,7 @@
180
179
  })
181
180
  }}
182
181
  </div>
183
- {% if params.titleLogoMobile is defined and params.titleLogoMobile %}
182
+ {% if params.titleLogoMobile %}
184
183
  <div class="ons-header__title-logo ons-header__title-logo--mobile ons-u-d-no@s{% if params.titleLogoMobileClasses %} {{ params.titleLogoMobileClasses }}{% endif %}">
185
184
  {% from "components/icons/_macro.njk" import onsIcon %}
186
185
  {{
@@ -191,26 +190,26 @@
191
190
  }}
192
191
  </div>
193
192
  {% endif %}
194
- {% if params.titleLogoHref is defined and params.titleLogoHref %}
193
+ {% if params.titleLogoHref %}
195
194
  </a>
196
195
  {% endif %}
197
196
  {% else %}
198
- {% if params.titleLogoHref is defined and params.titleLogoHref %}
197
+ {% if params.titleLogoHref %}
199
198
  <a class="ons-header__title-link" href="{{ params.titleLogoHref }}">
200
199
  {% endif %}
201
200
  <{{ title_tag }} class="ons-header__title">{{ params.title }}</{{ title_tag }}>
202
- {% if params.titleLogoHref is defined and params.titleLogoHref %}
201
+ {% if params.titleLogoHref %}
203
202
  </a>
204
203
  {% endif %}
205
204
  {% endif %}
206
- {% if params.description is defined and params.description %}
205
+ {% if params.description %}
207
206
  <p class="ons-header__description">{{ params.description }}</p>
208
207
  {% endif %}
209
208
  </div>
210
209
 
211
- {% if params.button is defined and params.button %}
210
+ {% if params.button %}
212
211
  {% if params.variants == 'neutral' %}
213
- {% set buttonVariant = ["ghost", "ghost-dark"] %}
212
+ {% set buttonVariant = "ghost-dark" %}
214
213
  {% else %}
215
214
  {% set buttonVariant = "ghost" %}
216
215
  {% endif %}
@@ -222,15 +221,15 @@
222
221
  "name": params.button.name,
223
222
  "attributes": params.button.attributes,
224
223
  "url": params.button.url,
225
- "iconType": params.button.iconType,
226
- "iconPosition": params.button.iconPosition
224
+ "iconType": "exit",
225
+ "iconPosition": "after"
227
226
  }) }}
228
227
  </div>
229
228
  {% endif %}
230
- {% if params.navigation is defined %}
229
+ {% if params.navigation %}
231
230
  <div class="ons-grid__col ons-col-auto ons-u-flex-no-shrink">
232
231
  {% if params.noMasthead == true %}
233
- {% if params.language is defined and params.language %}
232
+ {% if params.language %}
234
233
  <div class="ons-grid__col ons-col-auto ons-u-mt-xxs@xxs@l ons-u-mr-xs@xxs@s {% if params.navigation.siteSearchAutosuggest %}ons-header__lang-adjustment{% endif %}">
235
234
  {% from "components/language-selector/_macro.njk" import onsLanguageSelector %}
236
235
  {{ onsLanguageSelector(params.language) }}
@@ -239,7 +238,7 @@
239
238
  {% endif %}
240
239
  {% if params.navigation.siteSearchAutosuggest %}
241
240
  {% if params.variants == 'neutral' %}
242
- {% set buttonVariant = ["small", "ghost", "ghost-dark"] %}
241
+ {% set buttonVariant = ["small", "ghost-dark"] %}
243
242
  {% else %}
244
243
  {% set buttonVariant = ["small", "ghost"] %}
245
244
  {% endif %}
@@ -258,7 +257,7 @@
258
257
  }) }}
259
258
  </span>
260
259
  {% endif %}
261
- {% if params.navigation.toggleNavigationButton is defined and params.navigation.toggleNavigationButton %}
260
+ {% if params.navigation.toggleNavigationButton %}
262
261
  {% if params.variants == 'neutral' %}
263
262
  {% set buttonVariant = ["mobile", "ghost-dark"] %}
264
263
  {% else %}
@@ -267,7 +266,6 @@
267
266
  {{ onsButton({
268
267
  "text": params.navigation.toggleNavigationButton.text,
269
268
  "classes": "ons-u-ml-xs ons-u-d-no ons-js-navigation-button ons-u-d-no@l",
270
- "buttonStyle": "mobile",
271
269
  "variants": buttonVariant,
272
270
  "attributes": {
273
271
  "aria-label": params.navigation.toggleNavigationButton.ariaLabel | default("Toggle main menu") ,
@@ -281,7 +279,7 @@
281
279
  </div>
282
280
  </div>
283
281
  </div>
284
- {% if params.navigation is defined and params.navigation %}
282
+ {% if params.navigation %}
285
283
  {{ onsNavigation(params) }}
286
284
  {% endif %}
287
285
  </header>
@@ -333,8 +333,6 @@ describe('macro: header', () => {
333
333
  a: 'b',
334
334
  },
335
335
  url: '#0',
336
- iconType: 'button-icon',
337
- iconPosition: 'before',
338
336
  },
339
337
  });
340
338
 
@@ -347,8 +345,8 @@ describe('macro: header', () => {
347
345
  a: 'b',
348
346
  },
349
347
  url: '#0',
350
- iconType: 'button-icon',
351
- iconPosition: 'before',
348
+ iconType: 'exit',
349
+ iconPosition: 'after',
352
350
  });
353
351
  });
354
352
 
@@ -491,8 +489,7 @@ describe('macro: header', () => {
491
489
  text: 'Menu',
492
490
  classes: 'ons-u-d-no ons-js-toggle-services',
493
491
  type: 'button',
494
- buttonStyle: 'mobile',
495
- variants: 'text-link',
492
+ variants: ['mobile', 'text-link'],
496
493
  attributes: {
497
494
  'aria-label': 'Toggle services menu',
498
495
  'aria-controls': 'service-links',
@@ -523,7 +520,7 @@ describe('macro: header', () => {
523
520
  },
524
521
  });
525
522
 
526
- expect(buttonSpy.occurrences[0]).toHaveProperty('variants', ['text-link', 'text-link-inverse']);
523
+ expect(buttonSpy.occurrences[0]).toHaveProperty('variants', ['mobile', 'text-link', 'text-link-inverse']);
527
524
  });
528
525
 
529
526
  it('does not render a button for a single services link', () => {
@@ -623,7 +620,6 @@ describe('macro: header', () => {
623
620
  expect(buttonSpy.occurrences[0]).toEqual({
624
621
  text: 'Menu',
625
622
  classes: 'ons-u-ml-xs ons-u-d-no ons-js-navigation-button ons-u-d-no@l',
626
- buttonStyle: 'mobile',
627
623
  variants: ['mobile', 'ghost'],
628
624
  attributes: {
629
625
  'aria-label': 'Toggle main menu',
@@ -3,46 +3,46 @@
3
3
  {% from "components/icons/_macro.njk" import onsIcon %}
4
4
 
5
5
  {# style adjustments if dark or light skin #}
6
- {% if params.variants is defined and 'dark' in params.variants %}
6
+ {% if params.variants and 'dark' in params.variants %}
7
7
  {% set skinName = "dark" %}
8
8
  {% else %}
9
9
  {% set skinName = "light" %}
10
10
  {% endif %}
11
11
 
12
12
  {# If hero contains a collapsible, style it differently #}
13
- {% if params.collapsible is defined and params.collapsible %}
13
+ {% if params.collapsible %}
14
14
  {% set containerClasses = " ons-hero__container--has-collapsible" %}
15
15
  {% endif %}
16
16
 
17
17
  {# Set number of columns used for hero content after medium breakpoint #}
18
18
  {% set detailsColumns = params.detailsColumns | default ('8') %}
19
19
 
20
- <section class="ons-hero ons-grid--gutterless{% if params.variants is defined and params.variants %}{% if params.variants is not string %}{% for variant in params.variants %} ons-hero--{{ variant }}{% endfor %}{% else %} ons-hero--{{ params.variants }}{% endif %}{% endif %}">
20
+ <section class="ons-hero ons-grid--gutterless{% if params.variants %}{% if params.variants is not string %}{% for variant in params.variants %} ons-hero--{{ variant }}{% endfor %}{% else %} ons-hero--{{ params.variants }}{% endif %}{% endif %}">
21
21
 
22
22
  <div class="ons-hero__container ons-container{{ ' ons-container--wide' if params.wide }}{{ containerClasses }}">
23
23
 
24
24
  <div class="ons-hero__details{{ detailsClasses }} ons-grid__col ons-col-{{ detailsColumns }}@m ons-col-10@s@m">
25
25
 
26
26
  <header>
27
- {% if params.preTitleImage is defined and params.preTitleImage %}
27
+ {% if params.preTitleImage %}
28
28
  {% set preTitleImageWithModifier = params.preTitleImage.name ~ "--" ~ skinName ~ ".svg" %}
29
29
  <img class="ons-hero__pre-title" src="{{ params.placeholderURL }}/img/{{ preTitleImageWithModifier }}" alt="{{ params.preTitleImage.alt }}">
30
30
  {% endif %}
31
- {% if params.title is defined and params.title %}
31
+ {% if params.title %}
32
32
  <h1 class="ons-hero__title ons-u-fs-xxxl">{{ params.title }}</h1>
33
33
  {% endif %}
34
- {% if params.subtitle is defined and params.subtitle %}
34
+ {% if params.subtitle %}
35
35
  <h2 class="ons-hero__subtitle ons-u-fs-r--b">{{ params.subtitle }}</h2>
36
36
  {% endif %}
37
37
  </header>
38
38
 
39
- {% if params.text is defined and params.text %}
39
+ {% if params.text %}
40
40
  <p class="ons-hero__text">{{ params.text | safe }}</p>
41
41
  {% endif %}
42
42
 
43
- {% if params.button is defined and params.button %}
43
+ {% if params.button %}
44
44
  {% from "components/button/_macro.njk" import onsButton %}
45
- {% set btnClasses = params.button.classes if params.button.classes is defined and params.button.classes else '' %}
45
+ {% set btnClasses = params.button.classes if params.button.classes else '' %}
46
46
  {% if skinName == 'dark' %}
47
47
  {% set btnClasses = btnClasses + ' ons-btn--ghost' %}
48
48
  {% endif %}
@@ -56,7 +56,7 @@
56
56
  }}
57
57
  {% endif %}
58
58
 
59
- {% if params.collapsible is defined and params.collapsible %}
59
+ {% if params.collapsible %}
60
60
  {% from "components/collapsible/_macro.njk" import onsCollapsible %}
61
61
  {{
62
62
  onsCollapsible({
@@ -73,16 +73,16 @@
73
73
  }}
74
74
  {% endif %}
75
75
 
76
- {% if params.suffixText is defined and params.suffixText %}
76
+ {% if params.suffixText %}
77
77
  <p class="ons-hero__suffixText ons-u-fs-s ons-u-mt-m ons-u-mb-no">{{ params.suffixText | safe }}</p>
78
78
  {% endif %}
79
79
 
80
80
  </div>
81
- {% if params.variants is defined and 'census' in params.variants %}
81
+ {% if params.variants and 'census' in params.variants %}
82
82
 
83
- {% if params.image is defined and params.image %}
83
+ {% if params.image %}
84
84
  <div class="ons-hero__circle-image">
85
- <img height="558" width="558" {% if params.image.largeSrc is defined and params.image.largeSrc %}srcset="{{ params.image.smallSrc }} 1x, {{ params.image.largeSrc }} 2x" {% endif %}src="{{ params.image.smallSrc }}" alt="">
85
+ <img height="558" width="558" {% if params.image.largeSrc %}srcset="{{ params.image.smallSrc }} 1x, {{ params.image.largeSrc }} 2x" {% endif %}src="{{ params.image.smallSrc }}" alt="">
86
86
  </div>
87
87
  {% endif %}
88
88
 
@@ -94,7 +94,7 @@
94
94
 
95
95
  <div class="ons-hero__circle-gradient"></div>
96
96
 
97
- {% if (params.variants is defined and 'census' in params.variants) and ('dark' not in params.variants) %}
97
+ {% if (params.variants and 'census' in params.variants) and ('dark' not in params.variants) %}
98
98
  <div class="ons-hero__circle"></div>
99
99
  {% endif %}
100
100
 
@@ -1,6 +1,6 @@
1
1
  {% macro onsIcon(params) %}
2
2
 
3
- {% if params.classes is defined and params.classes %}
3
+ {% if params.classes %}
4
4
  {% set iconClasses = ' ' + params.classes %}
5
5
  {% endif %}
6
6
 
@@ -62,7 +62,7 @@
62
62
  <path d="M11.86 10.23 8.62 6.99a4.63 4.63 0 1 0-6.34 1.64 4.55 4.55 0 0 0 2.36.64 4.65 4.65 0 0 0 2.33-.65l3.24 3.23a.46.46 0 0 0 .65 0l1-1a.48.48 0 0 0 0-.62Zm-5-3.32a3.28 3.28 0 0 1-2.31.93 3.22 3.22 0 1 1 2.35-.93Z"/>
63
63
  </svg>
64
64
  {% elif params.iconType == "sort-sprite" %}
65
- <svg id="sort-sprite{% if params.id is defined and params.id %}-{{ params.id | lower }}{% endif %}" class="ons-svg-icon{{ iconClasses }}" viewBox="0 0 12 19" xmlns="http://www.w3.org/2000/svg" focusable="false" fill="currentColor">
65
+ <svg id="sort-sprite{% if params.id %}-{{ params.id | lower }}{% endif %}" class="ons-svg-icon{{ iconClasses }}" viewBox="0 0 12 19" xmlns="http://www.w3.org/2000/svg" focusable="false" fill="currentColor">
66
66
  <path class="ons-topTriangle" d="M6 0l6 7.2H0L6 0zm0 18.6l6-7.2H0l6 7.2zm0 3.6l6 7.2H0l6-7.2z"/>
67
67
  <path class="ons-bottomTriangle" d="M6 18.6l6-7.2H0l6 7.2zm0 3.6l6 7.2H0l6-7.2z"/>
68
68
  </svg>
@@ -1,13 +1,13 @@
1
1
  {%- macro onsImage(params) -%}
2
2
  <figure class="ons-figure">
3
3
 
4
- {% if params.image is defined and params.image %}
5
- <img class="ons-figure__image" {% if params.image.largeSrc is defined and params.image.largeSrc %}srcset="{{ params.image.smallSrc }} 1x, {{ params.image.largeSrc }} 2x"{% endif %}src="{{ params.image.smallSrc }}" alt="{{ params.alt if params.alt is defined and params.alt else '' }}">
4
+ {% if params.image %}
5
+ <img class="ons-figure__image" {% if params.image.largeSrc %}srcset="{{ params.image.smallSrc }} 1x, {{ params.image.largeSrc }} 2x"{% endif %}src="{{ params.image.smallSrc }}" alt="{{ params.alt if params.alt else '' }}">
6
6
  {% else %}
7
7
  <img class="ons-figure__image" src="{{ params.url }}" alt="{{ params.alt }}">
8
8
  {% endif %}
9
9
 
10
- {% if params.caption is defined and params.caption %}
10
+ {% if params.caption %}
11
11
  <figcaption class="ons-figure__caption">
12
12
  {{ params.caption }}
13
13
  </figcaption>
@@ -48,6 +48,10 @@
48
48
  border: 1px solid $color-input-border;
49
49
  }
50
50
 
51
+ &__type[title] {
52
+ cursor: help;
53
+ }
54
+
51
55
  &__input:focus + &__type::after {
52
56
  // Style input + prefix/suffix on focus
53
57
  @extend %ons-input-focus;
@@ -11,9 +11,9 @@
11
11
  {% set type = "text" %}
12
12
  {% set pattern = "[0-9]*" %}
13
13
  {% set inputmode = "numeric" %}
14
- {% elif params.type is defined and params.type %}
14
+ {% elif params.type %}
15
15
  {% set type = params.type %}
16
- {% elif params.searchButton is defined and params.searchButton %}
16
+ {% elif params.searchButton %}
17
17
  {% set type = "search" %}
18
18
  {% else %}
19
19
  {% set type = "text" %}
@@ -26,24 +26,24 @@
26
26
  <input
27
27
  type="{{ type }}"
28
28
  id="{{ params.id }}"
29
- class="ons-input ons-input--text ons-input-type__input{% if params.error is defined and params.error %} ons-input--error{% endif %}{% if params.searchButton is defined and params.searchButton %} ons-search__input{% endif %}{% if params.classes is defined and params.classes %} {{ params.classes }}{% endif %}{% if params.width is defined and params.width %} ons-input{% if params.type is defined and (params.type == 'number' or params.type == 'tel') %}-number{% endif %}--w-{{ params.width }}{% endif %}{{ exclusiveClass }}{{ inputPlaceholder }}"
30
- {% if params.prefix is defined and params.prefix and params.prefix.id is defined and params.prefix.id %}aria-labelledby="{{ params.prefix.id }}"{% elif params.suffix is defined and params.suffix and params.suffix.id is defined and params.suffix.id %}aria-labelledby="{{ params.suffix.id }}"{% endif %}
31
- {% if params.name is defined and params.name %}name="{{ params.name }}"{% endif %}
32
- {% if params.value is defined and params.value %}value="{{ params.value }}"{% endif %}
33
- {% if params.accept is defined and params.accept %}accept="{{ params.accept }}"{% endif %}
34
- {% if params.min is defined and params.min %}min="{{ params.min }}"{% endif %}
35
- {% if params.max is defined and params.max %}max="{{ params.max }}"{% endif %}
36
- {% if params.minLength is defined and params.minLength %}minlength="{{ params.minLength }}"{% endif %}
37
- {% if params.maxLength is defined and params.maxLength %}maxlength="{{ params.maxLength }}"{% endif %}
38
- {% if pattern is defined and pattern %}pattern="{{ pattern }}"{% endif %}
39
- {% if inputmode is defined and inputmode %}inputmode="{{ inputmode }}"{% endif %}
40
- {% if params.autocomplete is defined and params.autocomplete %}autocomplete="{{ params.autocomplete }}"{% endif %}
41
- {% if params.accessiblePlaceholder is defined and params.accessiblePlaceholder %}placeholder="{{ params.label.text }}"{% endif %}
42
- {% if params.charCheckLimit is defined and params.charCheckLimit %}data-char-check-ref="{{ params.id }}-check-remaining" data-char-check-num="{{ params.charCheckLimit.limit }}" aria-describedby="{{ params.id }}-check-remaining"{% endif %}
43
- {% if params.charCheckLimit is defined and params.charCheckLimit and params.charCheckLimit.charcheckCountdown is defined and params.charCheckLimit.charcheckCountdown %}data-char-check-countdown="true"{% endif %}
44
- {% 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 }}{% if value is defined and value %}="{{ value }}"{% endif %} {% endfor %}{% endif %}
45
- {% if params.label is defined and params.label and params.label.description is defined and params.label.description %}{% if params.label.id is defined and params.label.id %}aria-describedby="{{ params.label.id }}-description-hint"{% else %}aria-describedby="description-hint"{% endif %}{% endif %}
46
- {% if params.required is defined and params.required == true %}required="required"{% endif %}
29
+ class="ons-input ons-input--text ons-input-type__input{% if params.error %} ons-input--error{% endif %}{% if params.searchButton %} ons-search__input{% endif %}{% if params.classes %} {{ params.classes }}{% endif %}{% if params.width %} ons-input{% if params.type == 'number' or params.type == 'tel' %}-number{% endif %}--w-{{ params.width }}{% endif %}{{ exclusiveClass }}{{ inputPlaceholder }}"
30
+ {% if params.prefix and params.prefix.id %}aria-labelledby="{{ params.prefix.id }}"{% elif params.suffix and params.suffix.id %}aria-labelledby="{{ params.suffix.id }}"{% endif %}
31
+ {% if params.name %}name="{{ params.name }}"{% endif %}
32
+ {% if params.value %}value="{{ params.value }}"{% endif %}
33
+ {% if params.accept %}accept="{{ params.accept }}"{% endif %}
34
+ {% if params.min %}min="{{ params.min }}"{% endif %}
35
+ {% if params.max %}max="{{ params.max }}"{% endif %}
36
+ {% if params.minLength %}minlength="{{ params.minLength }}"{% endif %}
37
+ {% if params.maxLength %}maxlength="{{ params.maxLength }}"{% endif %}
38
+ {% if pattern %}pattern="{{ pattern }}"{% endif %}
39
+ {% if inputmode %}inputmode="{{ inputmode }}"{% endif %}
40
+ {% if params.autocomplete %}autocomplete="{{ params.autocomplete }}"{% endif %}
41
+ {% if params.accessiblePlaceholder %}placeholder="{{ params.label.text }}"{% endif %}
42
+ {% if params.charCheckLimit %}data-char-check-ref="{{ params.id }}-check-remaining" data-char-check-num="{{ params.charCheckLimit.limit }}" aria-describedby="{{ params.id }}-check-remaining"{% endif %}
43
+ {% if params.charCheckLimit and params.charCheckLimit.charcheckCountdown %}data-char-check-countdown="true"{% endif %}
44
+ {% 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 %}
45
+ {% if params.label and params.label.description %}{% if params.label.id %}aria-describedby="{{ params.label.id }}-description-hint"{% else %}aria-describedby="description-hint"{% endif %}{% endif %}
46
+ {% if params.required == true %}required="required"{% endif %}
47
47
  />
48
48
  {% if params.listeners %}
49
49
  <script{% if csp_nonce %} nonce="{{ csp_nonce() }}"{% endif %}>
@@ -52,12 +52,12 @@
52
52
  {% endfor %}
53
53
  </script>
54
54
  {% endif %}
55
- {% if params.postTextboxLinkText is defined and params.postTextboxLinkText %}
55
+ {% if params.postTextboxLinkText %}
56
56
  <a class="ons-u-fs-s ons-input__post-link" href="{{ params.postTextboxLinkUrl }}">{{ params.postTextboxLinkText }}</a>
57
57
  {% endif %}
58
58
  {% endset %}
59
59
  {% set field %}
60
- {% if params.label is defined and params.label and params.label.text is defined and params.label.text %}
60
+ {% if params.label and params.label.text %}
61
61
  {{ onsLabel({
62
62
  "for": params.id,
63
63
  "id": params.label.id,
@@ -70,9 +70,9 @@
70
70
  }) }}
71
71
  {% endif %}
72
72
 
73
- {% if params.prefix is defined and params.prefix or params.suffix is defined and params.suffix %}
74
- {% if (params.prefix is defined and params.prefix and params.prefix.id is defined and params.prefix.id and params.prefix.title is defined and params.prefix.title) or (params.suffix is defined and params.suffix and params.suffix.id is defined and params.suffix.id and params.suffix.title is defined and params.suffix.title) %}
75
- {% if params.prefix is defined and params.prefix %}
73
+ {% if params.prefix or params.suffix %}
74
+ {% if (params.prefix and params.prefix.id) or (params.suffix and params.suffix.id) %}
75
+ {% if params.prefix %}
76
76
  {% set prefixClass = " ons-input-type--prefix" %}
77
77
  {% endif %}
78
78
 
@@ -81,21 +81,28 @@
81
81
  {{ input | safe }}
82
82
 
83
83
  {% set abbr = params.prefix or params.suffix %}
84
- <abbr
84
+ {% if params.prefix.title or params.suffix.title %}
85
+ {% set tag = 'abbr' %}
86
+ {% else %}
87
+ {% set tag = 'span' %}
88
+ {% endif %}
89
+
90
+ <{{ tag }}
85
91
  id="{{ abbr.id }}"
86
92
  class="ons-input-type__type ons-js-input-abbr"
87
- title="{{ abbr.title }}"
88
- >{{ abbr.text or abbr.title }}</abbr>
93
+ {% if abbr.title %}title="{{ abbr.title }}"{% endif %}
94
+ >{{ abbr.text }}</{{ tag }}>
89
95
  </span>
90
96
  </span>
91
97
  {% endif %}
92
- {% elif params.searchButton is defined and params.searchButton %}
98
+ {% elif params.searchButton %}
93
99
  <span class="ons-grid--flex ons-search">
94
100
  {% call onsSearch({
95
101
  "accessiblePlaceholder": params.accessiblePlaceholder,
96
102
  "searchButton": {
97
103
  "type": params.searchButton.type,
98
104
  "text": params.searchButton.text,
105
+ "visuallyHideButtonText": params.searchButton.visuallyHideButtonText,
99
106
  "id": params.searchButton.id,
100
107
  "attributes": params.searchButton.attributes,
101
108
  "classes": params.searchButton.classes,
@@ -110,7 +117,7 @@
110
117
  {% endif %}
111
118
  {% endset %}
112
119
 
113
- {% if params.charCheckLimit is defined and params.charCheckLimit and params.charCheckLimit.limit is defined and params.charCheckLimit.limit %}
120
+ {% if params.charCheckLimit and params.charCheckLimit.limit %}
114
121
  {% set charCheckField %}
115
122
  {% call onsCharLimit({
116
123
  "id": params.id ~ "-check",
@@ -126,7 +133,7 @@
126
133
  {% endset %}
127
134
  {% endif %}
128
135
 
129
- {% if params.mutuallyExclusive is defined and params.mutuallyExclusive %}
136
+ {% if params.mutuallyExclusive %}
130
137
  {% call onsMutuallyExclusive({
131
138
  "id": params.fieldId,
132
139
  "legend": params.legend,
@@ -142,7 +149,7 @@
142
149
  "error": params.error,
143
150
  "autosuggestResults": params.autosuggestResults
144
151
  }) %}
145
- {% if charCheckField is defined and charCheckField %}
152
+ {% if charCheckField %}
146
153
  {{ charCheckField | safe }}
147
154
  {% else %}
148
155
  {{ field | safe }}
@@ -156,9 +163,9 @@
156
163
  "classes": params.fieldClasses,
157
164
  "dontWrap": params.dontWrap,
158
165
  "error": params.error,
159
- "inline": params.label.inline if params.label is defined and params.label else ''
166
+ "inline": params.label.inline if params.label else ''
160
167
  }) %}
161
- {% if charCheckField is defined and charCheckField %}
168
+ {% if charCheckField %}
162
169
  {{ charCheckField | safe }}
163
170
  {% else %}
164
171
  {{ field | safe }}