@ons/design-system 67.2.0 → 68.0.1

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 (199) hide show
  1. package/README.md +6 -0
  2. package/components/access-code/_macro.njk +1 -1
  3. package/components/access-code/_macro.spec.js +2 -10
  4. package/components/access-code/access-code.dom.js +1 -1
  5. package/components/access-code/access-code.spec.js +2 -2
  6. package/components/access-code/example-access-code-error.njk +9 -14
  7. package/components/access-code/example-access-code.njk +3 -5
  8. package/components/accordion/accordion.js +4 -4
  9. package/components/address-input/_macro.spec.js +3 -15
  10. package/components/address-input/autosuggest.address.dom.js +1 -1
  11. package/components/address-input/autosuggest.address.js +3 -2
  12. package/components/address-input/autosuggest.address.setter.js +3 -3
  13. package/components/address-input/autosuggest.address.spec.js +66 -69
  14. package/components/address-output/_macro.spec.js +6 -30
  15. package/components/autosuggest/_autosuggest.scss +1 -1
  16. package/components/autosuggest/autosuggest.dom.js +1 -1
  17. package/components/autosuggest/autosuggest.helpers.js +1 -1
  18. package/components/back-to-top/_back-to-top.scss +34 -0
  19. package/components/back-to-top/_macro.njk +17 -0
  20. package/components/back-to-top/_macro.spec.js +60 -0
  21. package/components/back-to-top/back-to-top.dom.js +12 -0
  22. package/components/back-to-top/back-to-top.js +58 -0
  23. package/components/back-to-top/back-to-top.spec.js +117 -0
  24. package/components/back-to-top/example-back-to-top.njk +37 -0
  25. package/components/back-to-top/example-full-page-back-to-top.njk +192 -0
  26. package/components/browser-banner/_macro.spec.js +4 -12
  27. package/components/button/_macro.njk +6 -6
  28. package/components/button/_macro.spec.js +1 -5
  29. package/components/button/button.js +7 -8
  30. package/components/button/button.spec.js +17 -39
  31. package/components/call-to-action/_macro.spec.js +2 -6
  32. package/components/card/_macro.njk +25 -25
  33. package/components/card/_macro.spec.js +10 -34
  34. package/components/char-check-limit/_macro.njk +1 -1
  35. package/components/char-check-limit/_macro.spec.js +3 -7
  36. package/components/char-check-limit/character-check.spec.js +24 -20
  37. package/components/checkboxes/_checkbox-macro.njk +1 -1
  38. package/components/checkboxes/_checkbox.scss +0 -3
  39. package/components/checkboxes/_macro.spec.js +1 -5
  40. package/components/checkboxes/checkbox-with-autoselect.js +3 -3
  41. package/components/checkboxes/checkbox-with-fieldset.js +2 -2
  42. package/components/checkboxes/checkboxes-with-reveal.js +4 -2
  43. package/components/checkboxes/checkboxes.dom.js +2 -2
  44. package/components/checkboxes/checkboxes.spec.js +13 -13
  45. package/components/content-pagination/_macro.spec.js +2 -2
  46. package/components/cookies-banner/cookies-banner.dom.js +1 -1
  47. package/components/cookies-banner/cookies-banner.js +1 -1
  48. package/components/cookies-banner/cookies-banner.spec.js +7 -7
  49. package/components/date-input/_macro.njk +71 -69
  50. package/components/date-input/_macro.spec.js +20 -5
  51. package/components/date-input/example-date-input-double-field.njk +27 -0
  52. package/components/date-input/example-date-input-single-field.njk +18 -0
  53. package/components/details/details.spec.js +12 -12
  54. package/components/details/example-details-with-warning.njk +5 -7
  55. package/components/document-list/_macro.spec.js +9 -27
  56. package/components/document-list/document-list.scss +1 -1
  57. package/components/document-list/example-document-list-downloads.njk +3 -3
  58. package/components/document-list/example-document-list-search-result-featured.njk +1 -1
  59. package/components/document-list/example-document-list-search-results.njk +3 -3
  60. package/components/download-resources/download-resources.js +54 -54
  61. package/components/download-resources/download-resources.spec.js +3 -1
  62. package/components/duration/_macro.njk +52 -48
  63. package/components/duration/_macro.spec.js +112 -4
  64. package/components/duration/example-duration-error-for-single-field.njk +1 -1
  65. package/components/duration/example-duration-single-field.njk +24 -0
  66. package/components/error/_macro.njk +1 -1
  67. package/components/error/_macro.spec.js +2 -6
  68. package/components/feedback/_macro.njk +1 -1
  69. package/components/feedback/_macro.spec.js +4 -20
  70. package/components/field/_field-group.scss +3 -4
  71. package/components/field/_macro.spec.js +1 -3
  72. package/components/fieldset/_fieldset.scss +1 -2
  73. package/components/fieldset/_macro.spec.js +3 -9
  74. package/components/footer/_footer.scss +8 -0
  75. package/components/footer/_macro.njk +8 -7
  76. package/components/footer/_macro.spec.js +14 -2
  77. package/components/header/_macro.njk +1 -1
  78. package/components/header/_macro.spec.js +1 -1
  79. package/components/helpers/grid.njk +15 -15
  80. package/components/icon/_macro.njk +17 -13
  81. package/components/icon/_macro.spec.js +8 -16
  82. package/components/image/_macro.spec.js +1 -5
  83. package/components/input/_macro.njk +22 -23
  84. package/components/input/_macro.spec.js +1 -1
  85. package/components/input/character-check.dom.js +1 -1
  86. package/components/input/input.spec.js +1 -4
  87. package/components/label/_label.scss +1 -0
  88. package/components/label/_macro.njk +3 -3
  89. package/components/label/_macro.spec.js +4 -13
  90. package/components/list/_macro.spec.js +4 -12
  91. package/components/message/_macro.njk +17 -17
  92. package/components/message/_macro.spec.js +9 -33
  93. package/components/message-list/_macro.spec.js +7 -39
  94. package/components/metadata/_macro.njk +10 -10
  95. package/components/modal/_macro.spec.js +3 -9
  96. package/components/modal/modal.dom.js +1 -1
  97. package/components/modal/modal.spec.js +5 -5
  98. package/components/multiple-input-fields/_macro.njk +49 -0
  99. package/components/mutually-exclusive/_macro.spec.js +2 -10
  100. package/components/mutually-exclusive/mutually-exclusive.checkboxes.spec.js +26 -26
  101. package/components/mutually-exclusive/mutually-exclusive.date.spec.js +128 -14
  102. package/components/mutually-exclusive/mutually-exclusive.dom.js +1 -1
  103. package/components/mutually-exclusive/mutually-exclusive.duration.spec.js +129 -8
  104. package/components/mutually-exclusive/mutually-exclusive.email.spec.js +7 -7
  105. package/components/mutually-exclusive/mutually-exclusive.js +13 -13
  106. package/components/mutually-exclusive/mutually-exclusive.multiple-options.checkboxes.spec.js +29 -29
  107. package/components/mutually-exclusive/mutually-exclusive.number.spec.js +7 -7
  108. package/components/mutually-exclusive/mutually-exclusive.textarea.spec.js +8 -8
  109. package/components/navigation/navigation.spec.js +0 -2
  110. package/components/pagination/_macro.spec.js +11 -53
  111. package/components/panel/_macro.njk +17 -17
  112. package/components/panel/_macro.spec.js +25 -25
  113. package/components/panel/_panel.scss +10 -9
  114. package/components/panel/example-panel-bare.njk +3 -4
  115. package/components/panel/example-panel-with-announcement.njk +6 -10
  116. package/components/panel/example-panel-with-error-summary.njk +2 -2
  117. package/components/panel/example-panel-with-information.njk +0 -1
  118. package/components/panel/example-panel-with-success-message.njk +1 -1
  119. package/components/panel/example-panel-with-warning.njk +2 -3
  120. package/components/password/password.dom.js +1 -1
  121. package/components/phase-banner/_macro.spec.js +3 -9
  122. package/components/question/_macro.njk +1 -1
  123. package/components/question/_macro.spec.js +5 -19
  124. package/components/question/_question.scss +1 -4
  125. package/components/question/example-question-interviewer-note.njk +1 -1
  126. package/components/quote/_macro.spec.js +2 -10
  127. package/components/radios/clear-radios.js +3 -3
  128. package/components/radios/radio-with-fieldset.js +4 -4
  129. package/components/radios/radios.dom.js +1 -1
  130. package/components/radios/radios.spec.js +26 -26
  131. package/components/related-content/_macro.spec.js +2 -4
  132. package/components/related-content/_section-macro.spec.js +2 -8
  133. package/components/relationships/example-relationships-error.njk +16 -18
  134. package/components/relationships/relationships.dom.js +1 -1
  135. package/components/relationships/relationships.js +2 -2
  136. package/components/reply/_macro.spec.js +3 -3
  137. package/components/reply/reply.dom.js +1 -1
  138. package/components/reply/reply.spec.js +3 -3
  139. package/components/section-navigation/_macro.njk +12 -12
  140. package/components/section-navigation/_macro.spec.js +13 -21
  141. package/components/select/_macro.spec.js +6 -6
  142. package/components/share-page/_macro.spec.js +6 -14
  143. package/components/skip-to-content/_macro.spec.js +3 -11
  144. package/components/skip-to-content/skip-to-content.dom.js +1 -1
  145. package/components/skip-to-content/skip-to-content.js +1 -1
  146. package/components/skip-to-content/skip-to-content.spec.js +2 -2
  147. package/components/status/_macro.njk +2 -2
  148. package/components/status/_macro.spec.js +5 -9
  149. package/components/status/example-status-dead.njk +1 -1
  150. package/components/status/example-status-error.njk +1 -1
  151. package/components/status/example-status-pending.njk +1 -1
  152. package/components/status/example-status-small.njk +1 -1
  153. package/components/status/example-status-success.njk +1 -1
  154. package/components/summary/_macro.njk +7 -8
  155. package/components/summary/_macro.spec.js +27 -9
  156. package/components/table/_macro.spec.js +6 -10
  157. package/components/table/scrollable-table.dom.js +1 -1
  158. package/components/table/scrollable-table.js +1 -1
  159. package/components/table/sortable-table.js +4 -4
  160. package/components/table/table.spec.js +21 -17
  161. package/components/table-of-contents/_macro.njk +31 -31
  162. package/components/table-of-contents/_macro.spec.js +3 -11
  163. package/components/table-of-contents/toc.dom.js +1 -1
  164. package/components/table-of-contents/toc.spec.js +36 -32
  165. package/components/tabs/example-tabs-details.njk +1 -1
  166. package/components/tabs/tabs.dom.js +1 -1
  167. package/components/tabs/tabs.js +8 -8
  168. package/components/text-indent/_macro.spec.js +2 -6
  169. package/components/textarea/textarea.dom.js +1 -1
  170. package/components/textarea/textarea.spec.js +8 -8
  171. package/components/timeout-modal/_macro.spec.js +1 -3
  172. package/components/timeout-modal/timeout-modal.dom.js +1 -1
  173. package/components/timeout-modal/timeout-modal.spec.js +10 -10
  174. package/components/timeout-panel/_macro.njk +16 -17
  175. package/components/timeout-panel/_macro.spec.js +1 -1
  176. package/components/timeout-panel/timeout-panel.dom.js +1 -1
  177. package/components/timeout-panel/timeout-panel.spec.js +8 -8
  178. package/components/video/_macro.spec.js +1 -5
  179. package/components/video/video.dom.js +1 -1
  180. package/components/video/video.spec.js +16 -12
  181. package/css/main.css +1 -1
  182. package/favicons/safari-pinned-tab.svg +23 -23
  183. package/js/analytics.js +15 -14
  184. package/js/cookies-settings.dom.js +1 -1
  185. package/js/cookies-settings.spec.js +19 -19
  186. package/js/domready.js +1 -1
  187. package/js/fetch.js +1 -1
  188. package/js/inpagelink.js +3 -3
  189. package/js/main.js +1 -0
  190. package/js/print-button.js +1 -1
  191. package/js/timeout.js +1 -1
  192. package/package.json +2 -1
  193. package/scripts/main.es5.js +1 -1
  194. package/scripts/main.js +1 -1
  195. package/scss/base/_typography.scss +8 -2
  196. package/scss/main.scss +1 -0
  197. package/scss/overrides/hcm.scss +8 -1
  198. package/scss/vars/_colors.scss +2 -1
  199. package/components/date-field-input/_macro.njk +0 -86
@@ -20,12 +20,12 @@ describe('macro: panel', () => {
20
20
  ['branded', 'Important information:'],
21
21
  ['success', 'Completed:'],
22
22
  ['announcement', 'Announcement:'],
23
- ])('mode: %s', (panelType, accessibleText) => {
23
+ ])('mode: %s', (panelVariant, accessibleText) => {
24
24
  it('passes jest-axe checks', async () => {
25
25
  const $ = cheerio.load(
26
26
  renderComponent('panel', {
27
27
  ...EXAMPLE_PANEL_BASIC,
28
- type: panelType,
28
+ variant: panelVariant,
29
29
  }),
30
30
  );
31
31
  const results = await axe($.html());
@@ -36,18 +36,18 @@ describe('macro: panel', () => {
36
36
  const $ = cheerio.load(
37
37
  renderComponent('panel', {
38
38
  ...EXAMPLE_PANEL_BASIC,
39
- type: panelType,
39
+ variant: panelVariant,
40
40
  }),
41
41
  );
42
42
 
43
- expect($('.ons-panel').hasClass(`ons-panel--${panelType}`)).toBe(true);
43
+ expect($('.ons-panel').hasClass(`ons-panel--${panelVariant}`)).toBe(true);
44
44
  });
45
45
 
46
46
  it('has the provided `body` text', () => {
47
47
  const $ = cheerio.load(
48
48
  renderComponent('panel', {
49
49
  ...EXAMPLE_PANEL_BASIC,
50
- type: panelType,
50
+ variant: panelVariant,
51
51
  }),
52
52
  );
53
53
 
@@ -55,7 +55,7 @@ describe('macro: panel', () => {
55
55
  });
56
56
 
57
57
  it('calls with content', () => {
58
- const $ = cheerio.load(renderComponent('panel', { EXAMPLE_PANEL_BASIC, type: panelType }, 'Example content...'));
58
+ const $ = cheerio.load(renderComponent('panel', { EXAMPLE_PANEL_BASIC, variant: panelVariant }, 'Example content...'));
59
59
 
60
60
  const content = $('.ons-panel__body').text().trim();
61
61
  expect(content).toBe('Example content...');
@@ -65,7 +65,7 @@ describe('macro: panel', () => {
65
65
  const $ = cheerio.load(
66
66
  renderComponent('panel', {
67
67
  ...EXAMPLE_PANEL_BASIC,
68
- type: panelType,
68
+ variant: panelVariant,
69
69
  }),
70
70
  );
71
71
 
@@ -76,7 +76,7 @@ describe('macro: panel', () => {
76
76
  const $ = cheerio.load(
77
77
  renderComponent('panel', {
78
78
  ...EXAMPLE_PANEL_BASIC,
79
- type: panelType,
79
+ variant: panelVariant,
80
80
  classes: 'ons-custom-class',
81
81
  }),
82
82
  );
@@ -88,7 +88,7 @@ describe('macro: panel', () => {
88
88
  const $ = cheerio.load(
89
89
  renderComponent('panel', {
90
90
  ...EXAMPLE_PANEL_BASIC,
91
- type: panelType,
91
+ variant: panelVariant,
92
92
  attributes: {
93
93
  a: '123',
94
94
  b: '456',
@@ -103,7 +103,7 @@ describe('macro: panel', () => {
103
103
  const $ = cheerio.load(
104
104
  renderComponent('panel', {
105
105
  ...EXAMPLE_PANEL_BASIC,
106
- type: panelType,
106
+ variant: panelVariant,
107
107
  }),
108
108
  );
109
109
 
@@ -114,7 +114,7 @@ describe('macro: panel', () => {
114
114
  const $ = cheerio.load(
115
115
  renderComponent('panel', {
116
116
  ...EXAMPLE_PANEL_BASIC,
117
- type: panelType,
117
+ variant: panelVariant,
118
118
  }),
119
119
  );
120
120
 
@@ -125,7 +125,7 @@ describe('macro: panel', () => {
125
125
  const $ = cheerio.load(
126
126
  renderComponent('panel', {
127
127
  ...EXAMPLE_PANEL_BASIC,
128
- type: panelType,
128
+ variant: panelVariant,
129
129
  assistiveTextPrefix: 'Some helpful text:',
130
130
  }),
131
131
  );
@@ -176,13 +176,13 @@ describe('macro: panel', () => {
176
176
  describe.each([
177
177
  ['error', 'h2'],
178
178
  ['success', 'div'],
179
- ])('mode: %s', (panelType, tagEl) => {
179
+ ])('mode: %s', (panelVariant, tagEl) => {
180
180
  it('has the default id set', () => {
181
181
  const $ = cheerio.load(
182
182
  renderComponent('panel', {
183
183
  ...EXAMPLE_PANEL_BASIC,
184
184
  title: 'Title',
185
- type: panelType,
185
+ variant: panelVariant,
186
186
  }),
187
187
  );
188
188
 
@@ -194,7 +194,7 @@ describe('macro: panel', () => {
194
194
  renderComponent('panel', {
195
195
  ...EXAMPLE_PANEL_BASIC,
196
196
  title: 'Title',
197
- type: panelType,
197
+ variant: panelVariant,
198
198
  }),
199
199
  );
200
200
 
@@ -207,7 +207,7 @@ describe('macro: panel', () => {
207
207
  renderComponent('panel', {
208
208
  ...EXAMPLE_PANEL_BASIC,
209
209
  title: 'Title',
210
- type: panelType,
210
+ variant: panelVariant,
211
211
  }),
212
212
  );
213
213
 
@@ -219,7 +219,7 @@ describe('macro: panel', () => {
219
219
  renderComponent('panel', {
220
220
  ...EXAMPLE_PANEL_BASIC,
221
221
  title: 'Title',
222
- type: panelType,
222
+ variant: panelVariant,
223
223
  }),
224
224
  );
225
225
 
@@ -231,7 +231,7 @@ describe('macro: panel', () => {
231
231
  renderComponent('panel', {
232
232
  ...EXAMPLE_PANEL_BASIC,
233
233
  title: 'Title',
234
- type: panelType,
234
+ variant: panelVariant,
235
235
  }),
236
236
  );
237
237
 
@@ -243,7 +243,7 @@ describe('macro: panel', () => {
243
243
  renderComponent('panel', {
244
244
  ...EXAMPLE_PANEL_BASIC,
245
245
  title: 'Title',
246
- type: panelType,
246
+ variant: panelVariant,
247
247
  }),
248
248
  );
249
249
 
@@ -259,7 +259,7 @@ describe('macro: panel', () => {
259
259
  {
260
260
  ...EXAMPLE_PANEL_BASIC,
261
261
  title: 'Title',
262
- type: panelType,
262
+ variant: panelVariant,
263
263
  },
264
264
  null,
265
265
  null,
@@ -289,7 +289,7 @@ describe('macro: panel', () => {
289
289
  const $ = cheerio.load(
290
290
  renderComponent('panel', {
291
291
  ...EXAMPLE_PANEL_BASIC,
292
- type: 'announcement',
292
+ variant: 'announcement',
293
293
  }),
294
294
  );
295
295
 
@@ -303,7 +303,7 @@ describe('macro: panel', () => {
303
303
 
304
304
  faker.renderComponent('panel', {
305
305
  ...EXAMPLE_PANEL_BASIC,
306
- type: 'announcement',
306
+ variant: 'announcement',
307
307
  });
308
308
 
309
309
  expect(iconsSpy.occurrences[0].iconType).toBe('arrow-forward');
@@ -315,7 +315,7 @@ describe('macro: panel', () => {
315
315
  const $ = cheerio.load(
316
316
  renderComponent('panel', {
317
317
  ...EXAMPLE_PANEL_BASIC,
318
- type: 'warn',
318
+ variant: 'warn',
319
319
  }),
320
320
  );
321
321
 
@@ -328,7 +328,7 @@ describe('macro: panel', () => {
328
328
  const $ = cheerio.load(
329
329
  renderComponent('panel', {
330
330
  ...EXAMPLE_PANEL_BASIC,
331
- type: 'warn-branded',
331
+ variant: 'warn-branded',
332
332
  }),
333
333
  );
334
334
 
@@ -340,7 +340,7 @@ describe('macro: panel', () => {
340
340
  const $ = cheerio.load(
341
341
  renderComponent('panel', {
342
342
  ...EXAMPLE_PANEL_BASIC,
343
- type: 'warn-branded',
343
+ variant: 'warn-branded',
344
344
  }),
345
345
  );
346
346
 
@@ -1,4 +1,4 @@
1
- @mixin panel-type($name, $color, $color-bg) {
1
+ @mixin panel-variant($name, $color, $color-bg) {
2
2
  .ons-panel {
3
3
  &--#{$name} {
4
4
  background: $color-bg;
@@ -144,7 +144,8 @@
144
144
 
145
145
  &--announcement {
146
146
  a:focus {
147
- box-shadow: 0 -2px var(--ons-color-focus), 0 4px (--ons-color-text-inverse-link) !important; // Override focus style because the black border is not visible on a black background
147
+ box-shadow: 0 -2px var(--ons-color-focus),
148
+ 0 4px (--ons-color-text-inverse-link) !important; // Override focus style because the black border is not visible on a black background
148
149
  }
149
150
  }
150
151
 
@@ -249,10 +250,10 @@
249
250
  }
250
251
  }
251
252
 
252
- @include panel-type(error, var(--ons-color-errors), var(--ons-color-errors-tint));
253
- @include panel-type(success, var(--ons-color-success), var(--ons-color-success-tint));
254
- @include panel-type(info, var(--ons-color-info), var(--ons-color-info-tint));
255
- @include panel-type(branded, var(--ons-color-branded), var(--ons-color-branded-tint));
256
- @include panel-type(warn, transparent, transparent);
257
- @include panel-type(warn-branded, var(--ons-color-branded-tertiary), var(--ons-color-branded-tertiary));
258
- @include panel-type(announcement, var(--ons-color-black), var(--ons-color-black));
253
+ @include panel-variant(error, var(--ons-color-errors), var(--ons-color-errors-tint));
254
+ @include panel-variant(success, var(--ons-color-success), var(--ons-color-success-tint));
255
+ @include panel-variant(info, var(--ons-color-info), var(--ons-color-info-tint));
256
+ @include panel-variant(branded, var(--ons-color-branded), var(--ons-color-branded-tint));
257
+ @include panel-variant(warn, transparent, transparent);
258
+ @include panel-variant(warn-branded, var(--ons-color-branded-tertiary), var(--ons-color-branded-tertiary));
259
+ @include panel-variant(announcement, var(--ons-color-black), var(--ons-color-black));
@@ -1,9 +1,8 @@
1
1
  {% from "components/panel/_macro.njk" import onsPanel %}
2
2
 
3
3
  {% call onsPanel({
4
- "type": 'bare',
5
- "iconType": 'lock'
6
- })
7
- %}
4
+ "variant": 'bare',
5
+ "iconType": 'lock'
6
+ }) %}
8
7
  Here is some text with an icon
9
8
  {% endcall %}
@@ -1,18 +1,14 @@
1
1
  ---
2
-
3
2
  "fullWidth": true
4
3
  ---
5
4
  {% from "components/panel/_macro.njk" import onsPanel %}
6
5
 
7
6
  {% call onsPanel({
8
- "type": 'announcement'
9
- })
10
- %}
11
-
12
- <p class="ons-u-mb-no">National lockdown: stay at home</p>
13
-
14
- <div class="ons-u-fs-r">
15
- <p>Coronavirus (COVID-19) remains a serious threat across the country. <a href="#0">Find out more</a></p>
16
- </div>
7
+ "variant": 'announcement'
8
+ }) %}
9
+ <p class="ons-u-mb-no">National lockdown: stay at home</p>
17
10
 
11
+ <div class="ons-u-fs-r">
12
+ <p>Coronavirus (COVID-19) remains a serious threat across the country. <a href="#0">Find out more</a></p>
13
+ </div>
18
14
  {% endcall %}
@@ -2,8 +2,8 @@
2
2
  {% from "components/list/_macro.njk" import onsList %}
3
3
 
4
4
  {% call onsPanel({
5
- "title": 'There are 2 problems with your answer',
6
- "type": 'error'
5
+ "title": 'There are 2 problems with your answer',
6
+ "variant": 'error'
7
7
  }) %}
8
8
  {{
9
9
  onsList({
@@ -1,5 +1,4 @@
1
1
  {% from "components/panel/_macro.njk" import onsPanel %}
2
-
3
2
  {{
4
3
  onsPanel({
5
4
  "body": '<p>Include all rooms built or converted for use as bedrooms</p>'
@@ -2,7 +2,7 @@
2
2
 
3
3
  {{
4
4
  onsPanel({
5
- "type": 'success',
5
+ "variant": 'success',
6
6
  "id": 'success-id',
7
7
  "iconType": 'check',
8
8
  "body": 'Information has been successfully submitted'
@@ -1,8 +1,7 @@
1
1
  {% from "components/panel/_macro.njk" import onsPanel %}
2
2
 
3
3
  {% call onsPanel({
4
- "type": 'warn'
5
- })
6
- %}
4
+ "variant": 'warn'
5
+ }) %}
7
6
  All of the information about this person will be deleted
8
7
  {% endcall %}
@@ -6,7 +6,7 @@ async function initialisePasswords() {
6
6
  if (passwordFields.length) {
7
7
  const Password = (await import('./password')).default;
8
8
 
9
- passwordFields.forEach(field => new Password(field));
9
+ passwordFields.forEach((field) => new Password(field));
10
10
  }
11
11
  }
12
12
 
@@ -20,18 +20,14 @@ describe('macro: phase-banner', () => {
20
20
  it('has expected html content', () => {
21
21
  const $ = cheerio.load(renderComponent('phase-banner', EXAMPLE_PHASE_BANNER_MINIMAL));
22
22
 
23
- const htmlContent = $('.ons-phase-banner__desc')
24
- .html()
25
- .trim();
23
+ const htmlContent = $('.ons-phase-banner__desc').html().trim();
26
24
  expect(htmlContent).toBe('Example content with a <a href="#">link</a>');
27
25
  });
28
26
 
29
27
  it('has the "Beta" badge by default', () => {
30
28
  const $ = cheerio.load(renderComponent('phase-banner', EXAMPLE_PHASE_BANNER_MINIMAL));
31
29
 
32
- const badgeText = $('.ons-phase-banner__badge')
33
- .text()
34
- .trim();
30
+ const badgeText = $('.ons-phase-banner__badge').text().trim();
35
31
  expect(badgeText).toBe('Beta');
36
32
  });
37
33
 
@@ -43,9 +39,7 @@ describe('macro: phase-banner', () => {
43
39
  }),
44
40
  );
45
41
 
46
- const badgeText = $('.ons-phase-banner__badge')
47
- .text()
48
- .trim();
42
+ const badgeText = $('.ons-phase-banner__badge').text().trim();
49
43
  expect(badgeText).toBe('Alpha');
50
44
  });
51
45
 
@@ -74,7 +74,7 @@
74
74
  {% from "components/panel/_macro.njk" import onsPanel %}
75
75
  {% call onsPanel({
76
76
  "id": params.warning.id,
77
- "type": "warn"
77
+ "variant": "warn"
78
78
  }) %}
79
79
  <p>{{ params.warning.body }}</p>
80
80
  {% endcall %}
@@ -112,11 +112,7 @@ describe('macro: question', () => {
112
112
  it('has the `title` text', () => {
113
113
  const $ = cheerio.load(renderComponent('question', EXAMPLE_QUESTION_BASIC));
114
114
 
115
- expect(
116
- $('.ons-question__title')
117
- .text()
118
- .trim(),
119
- ).toBe('Question title');
115
+ expect($('.ons-question__title').text().trim()).toBe('Question title');
120
116
  });
121
117
 
122
118
  it('has the provided `id` attribute', () => {
@@ -155,19 +151,13 @@ describe('macro: question', () => {
155
151
  it('has the `description` text', () => {
156
152
  const $ = cheerio.load(renderComponent('question', EXAMPLE_QUESTION_BASIC));
157
153
 
158
- expect(
159
- $('.ons-question__description')
160
- .text()
161
- .trim(),
162
- ).toBe('Question description');
154
+ expect($('.ons-question__description').text().trim()).toBe('Question description');
163
155
  });
164
156
 
165
157
  it('calls with content', () => {
166
158
  const $ = cheerio.load(renderComponent('question', { EXAMPLE_QUESTION_BASIC }, 'Example content...'));
167
159
 
168
- const content = $('.ons-question__answer')
169
- .text()
170
- .trim();
160
+ const content = $('.ons-question__answer').text().trim();
171
161
  expect(content).toEqual(expect.stringContaining('Example content...'));
172
162
  });
173
163
  });
@@ -180,7 +170,7 @@ describe('macro: question', () => {
180
170
  faker.renderComponent('question', EXAMPLE_QUESTION_WARNING);
181
171
 
182
172
  expect(panelSpy.occurrences[0]).toHaveProperty('id', 'warning-id');
183
- expect(panelSpy.occurrences[0]).toHaveProperty('type', 'warn');
173
+ expect(panelSpy.occurrences[0]).toHaveProperty('variant', 'warn');
184
174
  });
185
175
 
186
176
  it('outputs the expected panel content', () => {
@@ -321,11 +311,7 @@ describe('macro: question', () => {
321
311
  it('has a description element visually hidden before the title', () => {
322
312
  const $ = cheerio.load(renderComponent('question', EXAMPLE_QUESTION_DESCRIPTION_FIRST));
323
313
 
324
- expect(
325
- $('.ons-question__title')
326
- .text()
327
- .trim(),
328
- ).toBe('Question description Question title');
314
+ expect($('.ons-question__title').text().trim()).toBe('Question description Question title');
329
315
  });
330
316
 
331
317
  it('has the visible description element with aria-hidden attribute', () => {
@@ -4,16 +4,13 @@
4
4
  &__title {
5
5
  @extend .ons-u-mb-m;
6
6
 
7
- em,
8
- .ons-highlight {
9
- @extend .ons-highlight;
10
- }
11
7
  mark,
12
8
  .ons-instruction {
13
9
  background-color: var(--ons-color-instruction);
14
10
  color: var(--ons-color-text-inverse);
15
11
  margin-right: 0.5rem;
16
12
  padding: 0 0.5rem;
13
+ box-shadow: none;
17
14
  }
18
15
  }
19
16
 
@@ -24,7 +24,7 @@ layout: ~
24
24
 
25
25
  {% block main %}
26
26
  {% call onsQuestion({
27
- "title": "<mark class=\"ons-instruction\">Interviewer note:</mark>Who to interview",
27
+ "title": "<mark>Interviewer note:</mark>Who to interview",
28
28
  "instruction": "<p>Only interview a person who was usually living at the property on <strong>Sunday 21 March 2021</strong>.</p><p>If none of those house members are available, you must save and sign out and return to the address to interview one of them at a later date.</p>",
29
29
  "submitButton": {
30
30
  "variants": "timer",
@@ -25,11 +25,7 @@ describe('macro: quote', () => {
25
25
  }),
26
26
  );
27
27
 
28
- expect(
29
- $('.ons-quote__text')
30
- .text()
31
- .trim(),
32
- ).toBe('Example quote text.');
28
+ expect($('.ons-quote__text').text().trim()).toBe('Example quote text.');
33
29
  });
34
30
 
35
31
  it('has the provided `ref` text with a leading "—" character', () => {
@@ -40,11 +36,7 @@ describe('macro: quote', () => {
40
36
  }),
41
37
  );
42
38
 
43
- expect(
44
- $('.ons-quote__ref')
45
- .text()
46
- .trim(),
47
- ).toBe('— Example quote reference.');
39
+ expect($('.ons-quote__ref').text().trim()).toBe('— Example quote reference.');
48
40
  });
49
41
 
50
42
  it('has a default `textFontSize` of "l"', () => {
@@ -8,7 +8,7 @@ export default class ClearRadios {
8
8
  this.clearAlert = this.ariaElement.getAttribute('data-clear');
9
9
  this.clearedAlert = this.ariaElement.getAttribute('data-cleared');
10
10
 
11
- this.inputs.forEach(input => input.addEventListener('click', this.setClearAttributes.bind(this)));
11
+ this.inputs.forEach((input) => input.addEventListener('click', this.setClearAttributes.bind(this)));
12
12
  this.button.addEventListener('click', this.clearRadios.bind(this));
13
13
  this.checkRadios();
14
14
 
@@ -22,7 +22,7 @@ export default class ClearRadios {
22
22
  }
23
23
 
24
24
  checkRadios() {
25
- this.inputs.forEach(input => {
25
+ this.inputs.forEach((input) => {
26
26
  if (input.checked) {
27
27
  this.setClearAttributes();
28
28
  }
@@ -40,7 +40,7 @@ export default class ClearRadios {
40
40
  clearRadios() {
41
41
  event.preventDefault();
42
42
 
43
- this.inputs.forEach(input => {
43
+ this.inputs.forEach((input) => {
44
44
  input.checked = false;
45
45
  });
46
46
 
@@ -8,20 +8,20 @@ export default class RadioWithFieldset {
8
8
  if (this.selectAllChildrenInput) {
9
9
  this.selectAllChildrenInput.addEventListener('change', this.checkChildInputsOnSelect.bind(this));
10
10
  } else {
11
- this.radios.forEach(radio => radio.addEventListener('change', this.uncheckChildInputsOnDeselect.bind(this)));
11
+ this.radios.forEach((radio) => radio.addEventListener('change', this.uncheckChildInputsOnDeselect.bind(this)));
12
12
  }
13
13
  }
14
14
 
15
15
  checkChildInputsOnSelect() {
16
- this.childInputs.forEach(input => {
16
+ this.childInputs.forEach((input) => {
17
17
  input.checked = this.selectAllChildrenInput.checked === true ? true : false;
18
18
  });
19
19
  }
20
20
 
21
21
  uncheckChildInputsOnDeselect() {
22
- const isOther = this.radios.find(radio => radio.classList.contains('ons-js-other'));
22
+ const isOther = this.radios.find((radio) => radio.classList.contains('ons-js-other'));
23
23
  if (isOther && isOther.checked === false) {
24
- this.childInputs.forEach(input => {
24
+ this.childInputs.forEach((input) => {
25
25
  input.checked = false;
26
26
  });
27
27
  }
@@ -28,7 +28,7 @@ domready(async () => {
28
28
  const otherFieldsets = [...document.querySelectorAll('.ons-js-other-fieldset-radio')];
29
29
  if (otherFieldsets) {
30
30
  const RadioWithInnerFieldset = (await import('./radio-with-fieldset')).default;
31
- otherFieldsets.forEach(otherFieldset => {
31
+ otherFieldsets.forEach((otherFieldset) => {
32
32
  const context = otherFieldset.closest('.ons-radio');
33
33
  new RadioWithInnerFieldset(context);
34
34
  });