@ons/design-system 55.1.0 → 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.
Files changed (70) 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 +1 -1
  8. package/components/button/_macro.njk +24 -24
  9. package/components/call-to-action/_macro.njk +1 -1
  10. package/components/card/_macro.njk +10 -10
  11. package/components/checkboxes/_checkbox-macro.njk +9 -9
  12. package/components/checkboxes/_macro.njk +10 -10
  13. package/components/checkboxes/checkbox-with-fieldset.js +6 -5
  14. package/components/checkboxes/checkboxes.dom.js +6 -9
  15. package/components/code-highlight/_macro.njk +1 -1
  16. package/components/collapsible/_macro.njk +7 -7
  17. package/components/date-input/_macro.njk +5 -5
  18. package/components/document-list/_macro.njk +29 -29
  19. package/components/duration/_macro.njk +9 -9
  20. package/components/duration/_macro.spec.js +0 -3
  21. package/components/error/_macro.njk +1 -1
  22. package/components/external-link/_macro.njk +1 -1
  23. package/components/feedback/_macro.njk +2 -2
  24. package/components/field/_macro.njk +5 -5
  25. package/components/fieldset/_macro.njk +8 -8
  26. package/components/footer/_macro.njk +17 -17
  27. package/components/header/_macro.njk +33 -33
  28. package/components/hero/_macro.njk +15 -15
  29. package/components/icons/_macro.njk +2 -2
  30. package/components/images/_macro.njk +3 -3
  31. package/components/input/_input-type.scss +4 -0
  32. package/components/input/_macro.njk +40 -34
  33. package/components/input/_macro.spec.js +64 -59
  34. package/components/label/_macro.njk +1 -1
  35. package/components/language-selector/_macro.njk +1 -1
  36. package/components/lists/_macro.njk +22 -22
  37. package/components/message/_macro.njk +6 -6
  38. package/components/message-list/_macro.njk +1 -1
  39. package/components/metadata/_macro.njk +2 -2
  40. package/components/modal/_macro.njk +4 -4
  41. package/components/mutually-exclusive/_macro.njk +1 -1
  42. package/components/mutually-exclusive/mutually-exclusive.js +3 -1
  43. package/components/navigation/_macro.njk +8 -8
  44. package/components/pagination/_macro.njk +3 -3
  45. package/components/panel/_macro.njk +37 -39
  46. package/components/panel/_macro.spec.js +1 -13
  47. package/components/promotional-banner/_macro.njk +2 -2
  48. package/components/question/_macro.njk +18 -18
  49. package/components/quote/_macro.njk +2 -2
  50. package/components/radios/_macro.njk +8 -8
  51. package/components/radios/check-radios.js +5 -1
  52. package/components/related-content/_macro.njk +2 -2
  53. package/components/relationships/_macro.njk +2 -2
  54. package/components/section-navigation/_macro.njk +2 -2
  55. package/components/select/_macro.njk +8 -8
  56. package/components/share-page/_macro.njk +2 -2
  57. package/components/status/_macro.njk +2 -2
  58. package/components/summary/_macro.njk +25 -25
  59. package/components/table/_macro.njk +10 -10
  60. package/components/table-of-contents/_macro.njk +4 -4
  61. package/components/textarea/_macro.njk +8 -8
  62. package/components/timeline/_macro.njk +1 -1
  63. package/components/video/_macro.njk +1 -1
  64. package/css/census.css +1 -1
  65. package/css/ids.css +1 -1
  66. package/css/main.css +1 -1
  67. package/layout/_template.njk +35 -35
  68. package/package.json +1 -1
  69. package/scripts/main.es5.js +1 -1
  70. package/scripts/main.js +1 -1
@@ -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,7 +103,7 @@
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
108
  {% set buttonVariant = ["text-link", "text-link-inverse"] %}
109
109
  {% else %}
@@ -129,30 +129,30 @@
129
129
  {% endif %}
130
130
  </div>
131
131
  </div>
132
- {% if params.serviceLinks is defined and params.serviceLinks %}
132
+ {% if params.serviceLinks %}
133
133
  <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
134
  <ul class="ons-header-service-nav__list">
135
135
  {% for item in (params.serviceLinks.itemsList if params.serviceLinks.itemsList is iterable else params.serviceLinks.itemsList.items()) %}
136
136
  <li class="ons-header-service-nav__item ons-header-service-nav__item--mobile">
137
- {% if item.iconType is defined and item.iconType %}
137
+ {% if item.iconType %}
138
138
  {{
139
139
  onsIcon({
140
140
  "iconType": item.iconType
141
141
  })
142
142
  }}
143
143
  {% endif %}
144
- {% if item.url is defined and item.url %}
144
+ {% if item.url %}
145
145
  <a
146
146
  href="{{ item.url }}"
147
147
  class="ons-header-service-nav__link"
148
- {% if item.id is defined and item.id %} id="{{ item.id }}"{% endif %}
148
+ {% if item.id %} id="{{ item.id }}"{% endif %}
149
149
  >{{ item.title }}</a>
150
150
  {% else %}
151
151
  {{ item.title }}
152
152
  {% endif %}
153
153
  </li>
154
154
  {% endfor %}
155
- {% if params.language is defined and params.language %}
155
+ {% if params.language %}
156
156
  <div class="ons-u-d-no@xs">
157
157
  {% from "components/language-selector/_macro.njk" import onsLanguageSelector %}
158
158
  {{ onsLanguageSelector(params.language) }}
@@ -167,11 +167,11 @@
167
167
  <div class="ons-container{{ ' ons-container--full-width' if params.fullWidth }}{{ ' ons-container--wide' if params.wide }}">
168
168
  <div class="ons-grid ons-grid--gutterless ons-grid--flex ons-grid--between ons-grid--vertical-center ons-grid--no-wrap">
169
169
  <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 %}
170
+ {% if params.titleLogo and params.titleLogoAlt %}
171
+ {% if params.titleLogoHref %}
172
172
  <a class="ons-header__title-logo-link" href="{{ params.titleLogoHref }}">
173
173
  {% 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 %}">
174
+ <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
175
  {% from "components/icons/_macro.njk" import onsIcon %}
176
176
  {{
177
177
  onsIcon({
@@ -180,7 +180,7 @@
180
180
  })
181
181
  }}
182
182
  </div>
183
- {% if params.titleLogoMobile is defined and params.titleLogoMobile %}
183
+ {% if params.titleLogoMobile %}
184
184
  <div class="ons-header__title-logo ons-header__title-logo--mobile ons-u-d-no@s{% if params.titleLogoMobileClasses %} {{ params.titleLogoMobileClasses }}{% endif %}">
185
185
  {% from "components/icons/_macro.njk" import onsIcon %}
186
186
  {{
@@ -191,24 +191,24 @@
191
191
  }}
192
192
  </div>
193
193
  {% endif %}
194
- {% if params.titleLogoHref is defined and params.titleLogoHref %}
194
+ {% if params.titleLogoHref %}
195
195
  </a>
196
196
  {% endif %}
197
197
  {% else %}
198
- {% if params.titleLogoHref is defined and params.titleLogoHref %}
198
+ {% if params.titleLogoHref %}
199
199
  <a class="ons-header__title-link" href="{{ params.titleLogoHref }}">
200
200
  {% endif %}
201
201
  <{{ title_tag }} class="ons-header__title">{{ params.title }}</{{ title_tag }}>
202
- {% if params.titleLogoHref is defined and params.titleLogoHref %}
202
+ {% if params.titleLogoHref %}
203
203
  </a>
204
204
  {% endif %}
205
205
  {% endif %}
206
- {% if params.description is defined and params.description %}
206
+ {% if params.description %}
207
207
  <p class="ons-header__description">{{ params.description }}</p>
208
208
  {% endif %}
209
209
  </div>
210
210
 
211
- {% if params.button is defined and params.button %}
211
+ {% if params.button %}
212
212
  {% if params.variants == 'neutral' %}
213
213
  {% set buttonVariant = ["ghost", "ghost-dark"] %}
214
214
  {% else %}
@@ -227,10 +227,10 @@
227
227
  }) }}
228
228
  </div>
229
229
  {% endif %}
230
- {% if params.navigation is defined %}
230
+ {% if params.navigation %}
231
231
  <div class="ons-grid__col ons-col-auto ons-u-flex-no-shrink">
232
232
  {% if params.noMasthead == true %}
233
- {% if params.language is defined and params.language %}
233
+ {% if params.language %}
234
234
  <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
235
  {% from "components/language-selector/_macro.njk" import onsLanguageSelector %}
236
236
  {{ onsLanguageSelector(params.language) }}
@@ -258,7 +258,7 @@
258
258
  }) }}
259
259
  </span>
260
260
  {% endif %}
261
- {% if params.navigation.toggleNavigationButton is defined and params.navigation.toggleNavigationButton %}
261
+ {% if params.navigation.toggleNavigationButton %}
262
262
  {% if params.variants == 'neutral' %}
263
263
  {% set buttonVariant = ["mobile", "ghost-dark"] %}
264
264
  {% else %}
@@ -281,7 +281,7 @@
281
281
  </div>
282
282
  </div>
283
283
  </div>
284
- {% if params.navigation is defined and params.navigation %}
284
+ {% if params.navigation %}
285
285
  {{ onsNavigation(params) }}
286
286
  {% endif %}
287
287
  </header>
@@ -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,15 +81,21 @@
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,
@@ -110,7 +116,7 @@
110
116
  {% endif %}
111
117
  {% endset %}
112
118
 
113
- {% if params.charCheckLimit is defined and params.charCheckLimit and params.charCheckLimit.limit is defined and params.charCheckLimit.limit %}
119
+ {% if params.charCheckLimit and params.charCheckLimit.limit %}
114
120
  {% set charCheckField %}
115
121
  {% call onsCharLimit({
116
122
  "id": params.id ~ "-check",
@@ -126,7 +132,7 @@
126
132
  {% endset %}
127
133
  {% endif %}
128
134
 
129
- {% if params.mutuallyExclusive is defined and params.mutuallyExclusive %}
135
+ {% if params.mutuallyExclusive %}
130
136
  {% call onsMutuallyExclusive({
131
137
  "id": params.fieldId,
132
138
  "legend": params.legend,
@@ -142,7 +148,7 @@
142
148
  "error": params.error,
143
149
  "autosuggestResults": params.autosuggestResults
144
150
  }) %}
145
- {% if charCheckField is defined and charCheckField %}
151
+ {% if charCheckField %}
146
152
  {{ charCheckField | safe }}
147
153
  {% else %}
148
154
  {{ field | safe }}
@@ -156,9 +162,9 @@
156
162
  "classes": params.fieldClasses,
157
163
  "dontWrap": params.dontWrap,
158
164
  "error": params.error,
159
- "inline": params.label.inline if params.label is defined and params.label else ''
165
+ "inline": params.label.inline if params.label else ''
160
166
  }) %}
161
- {% if charCheckField is defined and charCheckField %}
167
+ {% if charCheckField %}
162
168
  {{ charCheckField | safe }}
163
169
  {% else %}
164
170
  {{ field | safe }}