@ons/design-system 67.2.0 → 69.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 (182) hide show
  1. package/README.md +5 -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.dom.js +1 -1
  16. package/components/autosuggest/autosuggest.helpers.js +1 -1
  17. package/components/back-to-top/_back-to-top.scss +34 -0
  18. package/components/back-to-top/_macro.njk +17 -0
  19. package/components/back-to-top/_macro.spec.js +60 -0
  20. package/components/back-to-top/back-to-top.dom.js +12 -0
  21. package/components/back-to-top/back-to-top.js +58 -0
  22. package/components/back-to-top/back-to-top.spec.js +117 -0
  23. package/components/back-to-top/example-back-to-top.njk +37 -0
  24. package/components/back-to-top/example-full-page-back-to-top.njk +192 -0
  25. package/components/browser-banner/_macro.spec.js +4 -12
  26. package/components/button/_macro.njk +6 -6
  27. package/components/button/_macro.spec.js +1 -5
  28. package/components/button/button.js +7 -8
  29. package/components/button/button.spec.js +17 -39
  30. package/components/call-to-action/_macro.spec.js +2 -6
  31. package/components/card/_macro.njk +25 -25
  32. package/components/card/_macro.spec.js +6 -30
  33. package/components/char-check-limit/_macro.njk +1 -1
  34. package/components/char-check-limit/_macro.spec.js +3 -7
  35. package/components/char-check-limit/character-check.spec.js +24 -20
  36. package/components/checkboxes/_checkbox-macro.njk +1 -1
  37. package/components/checkboxes/_checkbox.scss +0 -3
  38. package/components/checkboxes/_macro.spec.js +1 -5
  39. package/components/checkboxes/checkbox-with-autoselect.js +3 -3
  40. package/components/checkboxes/checkbox-with-fieldset.js +2 -2
  41. package/components/checkboxes/checkboxes-with-reveal.js +4 -2
  42. package/components/checkboxes/checkboxes.dom.js +2 -2
  43. package/components/checkboxes/checkboxes.spec.js +13 -13
  44. package/components/content-pagination/_macro.spec.js +2 -2
  45. package/components/cookies-banner/cookies-banner.dom.js +1 -1
  46. package/components/cookies-banner/cookies-banner.js +1 -1
  47. package/components/cookies-banner/cookies-banner.spec.js +7 -7
  48. package/components/details/details.spec.js +12 -12
  49. package/components/details/example-details-with-warning.njk +5 -7
  50. package/components/document-list/_macro.spec.js +9 -27
  51. package/components/document-list/document-list.scss +1 -1
  52. package/components/document-list/example-document-list-downloads.njk +3 -3
  53. package/components/document-list/example-document-list-search-result-featured.njk +1 -1
  54. package/components/document-list/example-document-list-search-results.njk +3 -3
  55. package/components/download-resources/download-resources.js +54 -54
  56. package/components/download-resources/download-resources.spec.js +3 -1
  57. package/components/error/_macro.njk +1 -1
  58. package/components/error/_macro.spec.js +2 -6
  59. package/components/feedback/_macro.spec.js +4 -20
  60. package/components/field/_macro.spec.js +1 -3
  61. package/components/fieldset/_fieldset.scss +1 -2
  62. package/components/fieldset/_macro.spec.js +3 -9
  63. package/components/footer/_footer.scss +8 -0
  64. package/components/footer/_macro.njk +8 -7
  65. package/components/footer/_macro.spec.js +14 -2
  66. package/components/helpers/grid.njk +15 -15
  67. package/components/icon/_macro.njk +7 -3
  68. package/components/icon/_macro.spec.js +4 -12
  69. package/components/image/_macro.spec.js +1 -5
  70. package/components/input/_macro.njk +22 -23
  71. package/components/input/_macro.spec.js +1 -1
  72. package/components/input/character-check.dom.js +1 -1
  73. package/components/input/input.spec.js +1 -4
  74. package/components/label/_label.scss +1 -0
  75. package/components/label/_macro.njk +2 -2
  76. package/components/label/_macro.spec.js +4 -13
  77. package/components/list/_macro.spec.js +4 -12
  78. package/components/message/_macro.njk +17 -17
  79. package/components/message/_macro.spec.js +9 -33
  80. package/components/message-list/_macro.spec.js +7 -39
  81. package/components/modal/_macro.spec.js +3 -9
  82. package/components/modal/modal.dom.js +1 -1
  83. package/components/modal/modal.spec.js +5 -5
  84. package/components/mutually-exclusive/_macro.spec.js +2 -10
  85. package/components/mutually-exclusive/mutually-exclusive.checkboxes.spec.js +26 -26
  86. package/components/mutually-exclusive/mutually-exclusive.date.spec.js +9 -9
  87. package/components/mutually-exclusive/mutually-exclusive.dom.js +1 -1
  88. package/components/mutually-exclusive/mutually-exclusive.duration.spec.js +8 -8
  89. package/components/mutually-exclusive/mutually-exclusive.email.spec.js +7 -7
  90. package/components/mutually-exclusive/mutually-exclusive.js +13 -13
  91. package/components/mutually-exclusive/mutually-exclusive.multiple-options.checkboxes.spec.js +29 -29
  92. package/components/mutually-exclusive/mutually-exclusive.number.spec.js +7 -7
  93. package/components/mutually-exclusive/mutually-exclusive.textarea.spec.js +8 -8
  94. package/components/navigation/navigation.spec.js +0 -2
  95. package/components/pagination/_macro.spec.js +11 -53
  96. package/components/panel/_macro.njk +17 -17
  97. package/components/panel/_macro.spec.js +25 -25
  98. package/components/panel/_panel.scss +10 -9
  99. package/components/panel/example-panel-bare.njk +3 -4
  100. package/components/panel/example-panel-with-announcement.njk +6 -10
  101. package/components/panel/example-panel-with-error-summary.njk +2 -2
  102. package/components/panel/example-panel-with-information.njk +0 -1
  103. package/components/panel/example-panel-with-success-message.njk +1 -1
  104. package/components/panel/example-panel-with-warning.njk +2 -3
  105. package/components/password/password.dom.js +1 -1
  106. package/components/phase-banner/_macro.spec.js +3 -9
  107. package/components/question/_macro.njk +1 -1
  108. package/components/question/_macro.spec.js +5 -19
  109. package/components/question/_question.scss +1 -4
  110. package/components/question/example-question-interviewer-note.njk +1 -1
  111. package/components/quote/_macro.spec.js +2 -10
  112. package/components/radios/clear-radios.js +3 -3
  113. package/components/radios/radio-with-fieldset.js +4 -4
  114. package/components/radios/radios.dom.js +1 -1
  115. package/components/radios/radios.spec.js +26 -26
  116. package/components/related-content/_macro.spec.js +2 -4
  117. package/components/related-content/_section-macro.spec.js +2 -8
  118. package/components/relationships/example-relationships-error.njk +16 -18
  119. package/components/relationships/relationships.dom.js +1 -1
  120. package/components/relationships/relationships.js +2 -2
  121. package/components/reply/_macro.spec.js +3 -3
  122. package/components/reply/reply.dom.js +1 -1
  123. package/components/reply/reply.spec.js +3 -3
  124. package/components/section-navigation/_macro.spec.js +13 -21
  125. package/components/select/_macro.spec.js +6 -6
  126. package/components/share-page/_macro.spec.js +6 -14
  127. package/components/skip-to-content/_macro.spec.js +3 -11
  128. package/components/skip-to-content/skip-to-content.dom.js +1 -1
  129. package/components/skip-to-content/skip-to-content.js +1 -1
  130. package/components/skip-to-content/skip-to-content.spec.js +2 -2
  131. package/components/status/_macro.njk +2 -2
  132. package/components/status/_macro.spec.js +5 -9
  133. package/components/status/example-status-dead.njk +1 -1
  134. package/components/status/example-status-error.njk +1 -1
  135. package/components/status/example-status-pending.njk +1 -1
  136. package/components/status/example-status-small.njk +1 -1
  137. package/components/status/example-status-success.njk +1 -1
  138. package/components/summary/_macro.njk +4 -5
  139. package/components/summary/_macro.spec.js +27 -9
  140. package/components/table/_macro.spec.js +6 -10
  141. package/components/table/scrollable-table.dom.js +1 -1
  142. package/components/table/scrollable-table.js +1 -1
  143. package/components/table/sortable-table.js +4 -4
  144. package/components/table/table.spec.js +21 -17
  145. package/components/table-of-contents/_macro.njk +31 -31
  146. package/components/table-of-contents/_macro.spec.js +3 -11
  147. package/components/table-of-contents/toc.dom.js +1 -1
  148. package/components/table-of-contents/toc.spec.js +36 -32
  149. package/components/tabs/example-tabs-details.njk +1 -1
  150. package/components/tabs/tabs.dom.js +1 -1
  151. package/components/tabs/tabs.js +8 -8
  152. package/components/text-indent/_macro.spec.js +2 -6
  153. package/components/textarea/textarea.dom.js +1 -1
  154. package/components/textarea/textarea.spec.js +8 -8
  155. package/components/timeout-modal/_macro.spec.js +1 -3
  156. package/components/timeout-modal/timeout-modal.dom.js +1 -1
  157. package/components/timeout-modal/timeout-modal.spec.js +10 -10
  158. package/components/timeout-panel/_macro.njk +16 -17
  159. package/components/timeout-panel/_macro.spec.js +1 -1
  160. package/components/timeout-panel/timeout-panel.dom.js +1 -1
  161. package/components/timeout-panel/timeout-panel.spec.js +8 -8
  162. package/components/video/_macro.spec.js +1 -5
  163. package/components/video/video.dom.js +1 -1
  164. package/components/video/video.spec.js +16 -12
  165. package/css/main.css +1 -1
  166. package/favicons/safari-pinned-tab.svg +23 -23
  167. package/js/analytics.js +15 -14
  168. package/js/cookies-settings.dom.js +1 -1
  169. package/js/cookies-settings.spec.js +19 -19
  170. package/js/domready.js +1 -1
  171. package/js/fetch.js +1 -1
  172. package/js/inpagelink.js +3 -3
  173. package/js/main.js +1 -0
  174. package/js/print-button.js +1 -1
  175. package/js/timeout.js +1 -1
  176. package/package.json +2 -1
  177. package/scripts/main.es5.js +1 -1
  178. package/scripts/main.js +1 -1
  179. package/scss/base/_typography.scss +8 -2
  180. package/scss/main.scss +1 -0
  181. package/scss/overrides/hcm.scss +8 -1
  182. package/scss/vars/_colors.scss +2 -1
@@ -3,7 +3,7 @@
3
3
  "documents": [
4
4
  {
5
5
  "thumbnail": true,
6
- "url": '#',
6
+ "url": '#',
7
7
  "title": 'Including everyone in Census 2021',
8
8
  "metadata": {
9
9
  "type": {
@@ -19,7 +19,7 @@
19
19
  },
20
20
  {
21
21
  "thumbnail": true,
22
- "url": '#',
22
+ "url": '#',
23
23
  "title": 'Community handbook for Census 2021',
24
24
  "metadata": {
25
25
  "type": {
@@ -35,7 +35,7 @@
35
35
  },
36
36
  {
37
37
  "thumbnail": true,
38
- "url": '#',
38
+ "url": '#',
39
39
  "title": 'Census 2021 matters to everyone',
40
40
  "metadata": {
41
41
  "type": {
@@ -12,7 +12,7 @@
12
12
  "text": 'Topic'
13
13
  }
14
14
  },
15
- "description": '<p>Figures on <strong class="ons-highlight">crime</strong> levels and trends for England and Wales based primarily on two sets of statistics: the <strong class="ons-highlight">Crime</strong> Survey for England and Wales (CSEW) and police recorded crime data.</p>
15
+ "description": '<p>Figures on <mark>crime</mark> levels and trends for England and Wales based primarily on two sets of statistics: the <mark>Crime</mark> Survey for England and Wales (CSEW) and police recorded crime data.</p>
16
16
  <p>View all <a href="#0">datasets</a> or <a href="#0">publications</a> related to <a href="#0">Crime and justice</a></p>'
17
17
  }
18
18
  ]
@@ -12,7 +12,7 @@
12
12
  "text": 'Topic'
13
13
  }
14
14
  },
15
- "description": '<p>Figures on <strong class="ons-highlight">crime</strong> levels and trends for England and Wales based primarily on two sets of statistics: the <strong class="ons-highlight">Crime</strong> Survey for England and Wales (CSEW) and police recorded <strong class="ons-highlight">crime</strong> data.</p>
15
+ "description": '<p>Figures on <mark>crime</mark> levels and trends for England and Wales based primarily on two sets of statistics: the <mark>Crime</mark> Survey for England and Wales (CSEW) and police recorded <mark>crime</mark> data.</p>
16
16
  <p>View all <a href="#0">datasets</a> or <a href="#0">publications</a> related to <a href="#0">Crime and justice</a></p>'
17
17
  },
18
18
  {
@@ -29,7 +29,7 @@
29
29
  "short": '18 February 2021'
30
30
  }
31
31
  },
32
- "description": '<p>Domestic abuse and sexual assault outcomes for disabled people in England and Wales aged 16 to 59 years, with analysis by age, sex, impairment type, impairment severity, country and region using the <strong class="ons-highlight">Crime</strong> Survey for England and Wales (CSEW) data.</p>'
32
+ "description": '<p>Domestic abuse and sexual assault outcomes for disabled people in England and Wales aged 16 to 59 years, with analysis by age, sex, impairment type, impairment severity, country and region using the <mark>Crime</mark> Survey for England and Wales (CSEW) data.</p>'
33
33
  },
34
34
  {
35
35
  "url": '#0',
@@ -45,7 +45,7 @@
45
45
  "short": '2 December 2019'
46
46
  }
47
47
  },
48
- "description": '<p>An overview of published data on disability and <strong class="ons-highlight">crime</strong> in the UK and analysis of the experience of domestic abuse and sexual assault for disabled adults aged 16 to 59 years in England and Wales. Analysis by age, sex and impairment type.</p>'
48
+ "description": '<p>An overview of published data on disability and <mark>crime</mark> in the UK and analysis of the experience of domestic abuse and sexual assault for disabled adults aged 16 to 59 years in England and Wales. Analysis by age, sex and impairment type.</p>'
49
49
  },
50
50
  {
51
51
  "url": '#0',
@@ -5,19 +5,19 @@ function Util() {}
5
5
  Class manipulation functions
6
6
  */
7
7
 
8
- Util.hasClass = function(el, className) {
8
+ Util.hasClass = function (el, className) {
9
9
  if (el.classList) return el.classList.contains(className);
10
10
  else return !!el.className.match(new RegExp('(\\s|^)' + className + '(\\s|$)'));
11
11
  };
12
12
 
13
- Util.addClass = function(el, className) {
13
+ Util.addClass = function (el, className) {
14
14
  let classList = className.split(' ');
15
15
  if (el.classList) el.classList.add(classList[0]);
16
16
  else if (!Util.hasClass(el, classList[0])) el.className += ' ' + classList[0];
17
17
  if (classList.length > 1) Util.addClass(el, classList.slice(1).join(' '));
18
18
  };
19
19
 
20
- Util.removeClass = function(el, className) {
20
+ Util.removeClass = function (el, className) {
21
21
  let classList = className.split(' ');
22
22
  if (el.classList) el.classList.remove(classList[0]);
23
23
  else if (Util.hasClass(el, classList[0])) {
@@ -27,12 +27,12 @@ Util.removeClass = function(el, className) {
27
27
  if (classList.length > 1) Util.removeClass(el, classList.slice(1).join(' '));
28
28
  };
29
29
 
30
- Util.toggleClass = function(el, className, bool) {
30
+ Util.toggleClass = function (el, className, bool) {
31
31
  if (bool) Util.addClass(el, className);
32
32
  else Util.removeClass(el, className);
33
33
  };
34
34
 
35
- Util.setAttributes = function(el, attrs) {
35
+ Util.setAttributes = function (el, attrs) {
36
36
  for (let key in attrs) {
37
37
  el.setAttribute(key, attrs[key]);
38
38
  }
@@ -42,7 +42,7 @@ Util.setAttributes = function(el, attrs) {
42
42
  DOM manipulation
43
43
  */
44
44
 
45
- Util.getChildrenByClassName = function(el, className) {
45
+ Util.getChildrenByClassName = function (el, className) {
46
46
  let childrenByClass = [];
47
47
  for (let i = 0; i < el.children.length; i++) {
48
48
  if (Util.hasClass(el.children[i], className)) childrenByClass.push(el.children[i]);
@@ -50,7 +50,7 @@ Util.getChildrenByClassName = function(el, className) {
50
50
  return childrenByClass;
51
51
  };
52
52
 
53
- Util.is = function(elem, selector) {
53
+ Util.is = function (elem, selector) {
54
54
  if (selector.nodeType) {
55
55
  return elem === selector;
56
56
  }
@@ -68,11 +68,11 @@ Util.is = function(elem, selector) {
68
68
  };
69
69
 
70
70
  // Animate height of an element
71
- Util.setHeight = function(start, to, element, duration, cb) {
71
+ Util.setHeight = function (start, to, element, duration, cb) {
72
72
  let change = to - start,
73
73
  currentTime = null;
74
74
 
75
- let animateHeight = function(timestamp) {
75
+ let animateHeight = function (timestamp) {
76
76
  if (!currentTime) currentTime = timestamp;
77
77
  let progress = timestamp - currentTime;
78
78
  let val = parseInt((progress / duration) * change + start);
@@ -90,14 +90,14 @@ Util.setHeight = function(start, to, element, duration, cb) {
90
90
  };
91
91
 
92
92
  // Smooth Scroll
93
- Util.scrollTo = function(final, duration, cb, scrollEl) {
93
+ Util.scrollTo = function (final, duration, cb, scrollEl) {
94
94
  let element = scrollEl || window;
95
95
  let start = element.scrollTop || document.documentElement.scrollTop,
96
96
  currentTime = null;
97
97
 
98
98
  if (!scrollEl) start = window.scrollY || document.documentElement.scrollTop;
99
99
 
100
- let animateScroll = function(timestamp) {
100
+ let animateScroll = function (timestamp) {
101
101
  if (!currentTime) currentTime = timestamp;
102
102
  let progress = timestamp - currentTime;
103
103
  if (progress > duration) progress = duration;
@@ -118,7 +118,7 @@ Util.scrollTo = function(final, duration, cb, scrollEl) {
118
118
  */
119
119
 
120
120
  // Move focus to an element
121
- Util.moveFocus = function(element) {
121
+ Util.moveFocus = function (element) {
122
122
  if (!element) element = document.getElementsByTagName('body')[0];
123
123
  element.focus();
124
124
  if (document.activeElement !== element) {
@@ -128,15 +128,15 @@ Util.moveFocus = function(element) {
128
128
  };
129
129
 
130
130
  // Misc
131
- Util.getIndexInArray = function(array, el) {
131
+ Util.getIndexInArray = function (array, el) {
132
132
  return Array.prototype.indexOf.call(array, el);
133
133
  };
134
134
 
135
- Util.cssSupports = function(property, value) {
135
+ Util.cssSupports = function (property, value) {
136
136
  if ('CSS' in window) {
137
137
  return CSS.supports(property, value);
138
138
  } else {
139
- let jsProperty = property.replace(/-([a-z])/g, function(g) {
139
+ let jsProperty = property.replace(/-([a-z])/g, function (g) {
140
140
  return g[1].toUpperCase();
141
141
  });
142
142
  return jsProperty in document.body.style;
@@ -146,7 +146,7 @@ Util.cssSupports = function(property, value) {
146
146
  // Merge a set of user options into plugin defaults
147
147
  // https://gomakethings.com/vanilla-javascript-version-of-jquery-extend/
148
148
 
149
- Util.extend = function() {
149
+ Util.extend = function () {
150
150
  // Variables
151
151
  let extended = {};
152
152
  let deep = false;
@@ -160,7 +160,7 @@ Util.extend = function() {
160
160
  }
161
161
 
162
162
  // Merge the object into the extended object
163
- let merge = function(obj) {
163
+ let merge = function (obj) {
164
164
  for (let prop in obj) {
165
165
  if (Object.prototype.hasOwnProperty.call(obj, prop)) {
166
166
  // If deep merge and property is an object, merge properties
@@ -183,7 +183,7 @@ Util.extend = function() {
183
183
  };
184
184
 
185
185
  // Check if Reduced Motion is enabled
186
- Util.osHasReducedMotion = function() {
186
+ Util.osHasReducedMotion = function () {
187
187
  if (!window.matchMedia) return false;
188
188
  let matchMediaObj = window.matchMedia('(prefers-reduced-motion: reduce)');
189
189
  if (matchMediaObj) return matchMediaObj.matches;
@@ -191,7 +191,7 @@ Util.osHasReducedMotion = function() {
191
191
  };
192
192
 
193
193
  /*
194
- Polyfills
194
+ Polyfills
195
195
  */
196
196
 
197
197
  // Closest() method
@@ -200,7 +200,7 @@ if (!Element.prototype.matches) {
200
200
  }
201
201
 
202
202
  if (!Element.prototype.closest) {
203
- Element.prototype.closest = function(s) {
203
+ Element.prototype.closest = function (s) {
204
204
  let el = this;
205
205
  if (!document.documentElement.contains(el)) return null;
206
206
  do {
@@ -226,10 +226,10 @@ if (typeof window.CustomEvent !== 'function') {
226
226
  }
227
227
 
228
228
  /*
229
- Animation curves
229
+ Animation curves
230
230
  */
231
231
 
232
- Math.easeInOutQuad = function(t, b, c, d) {
232
+ Math.easeInOutQuad = function (t, b, c, d) {
233
233
  t /= d / 2;
234
234
  if (t < 1) return (c / 2) * t * t + b;
235
235
  t--;
@@ -238,8 +238,8 @@ Math.easeInOutQuad = function(t, b, c, d) {
238
238
 
239
239
  // FILTERS
240
240
 
241
- (function() {
242
- let Filter = function(opts) {
241
+ (function () {
242
+ let Filter = function (opts) {
243
243
  this.options = Util.extend(Filter.defaults, opts); // Used to store custom filter/sort functions
244
244
  this.element = this.options.element;
245
245
  this.elementId = this.element.getAttribute('id');
@@ -285,8 +285,8 @@ Math.easeInOutQuad = function(t, b, c, d) {
285
285
  filter.filterString[i] = ''; // Reset filtering
286
286
 
287
287
  // Get proper filter/sorting string based on selected controllers
288
- (function(i) {
289
- filter.controllers[i].addEventListener('change', function(event) {
288
+ (function (i) {
289
+ filter.controllers[i].addEventListener('change', function (event) {
290
290
  if (event.target.tagName.toLowerCase() == 'select') {
291
291
  // Select elements
292
292
  !event.target.getAttribute('data-filter')
@@ -310,7 +310,7 @@ Math.easeInOutQuad = function(t, b, c, d) {
310
310
  updateFilterArray(filter);
311
311
  });
312
312
 
313
- filter.controllers[i].addEventListener('click', function(event) {
313
+ filter.controllers[i].addEventListener('click', function (event) {
314
314
  // Return if target is select/input elements
315
315
  let filterEl = event.target.closest('[data-filter]');
316
316
  let sortEl = event.target.closest('[data-sort]');
@@ -330,9 +330,9 @@ Math.easeInOutQuad = function(t, b, c, d) {
330
330
  }
331
331
 
332
332
  // Handle resize - update grid coordinates in filter.itemsGrid
333
- window.addEventListener('resize', function() {
333
+ window.addEventListener('resize', function () {
334
334
  clearTimeout(filter.resizingId);
335
- filter.resizingId = setTimeout(function() {
335
+ filter.resizingId = setTimeout(function () {
336
336
  createGridInfo(filter);
337
337
  }, 300);
338
338
  });
@@ -341,7 +341,7 @@ Math.easeInOutQuad = function(t, b, c, d) {
341
341
  checkInitialFiltering(filter);
342
342
 
343
343
  // Reset filtering results if filter selection was changed by an external control (e.g., form reset)
344
- filter.element.addEventListener('update-filter-results', function() {
344
+ filter.element.addEventListener('update-filter-results', function () {
345
345
  // Reset filters first
346
346
  for (let i = 0; i < filter.controllers.length; i++) filter.filterString[i] = '';
347
347
  filter.sortingString = '';
@@ -478,7 +478,7 @@ Math.easeInOutQuad = function(t, b, c, d) {
478
478
  // Custom sort function -> user takes care of it
479
479
  filter.sortingList = filter.options[sortOptions[0]](filter.sortingList);
480
480
  } else {
481
- filter.sortingList.sort(function(left, right) {
481
+ filter.sortingList.sort(function (left, right) {
482
482
  let leftVal = left[0].getAttribute('data-sort-' + sortOptions[0]),
483
483
  rightVal = right[0].getAttribute('data-sort-' + sortOptions[0]);
484
484
  if (sortOptions[2] == 'number') {
@@ -596,7 +596,7 @@ Math.easeInOutQuad = function(t, b, c, d) {
596
596
  }
597
597
  }
598
598
 
599
- setTimeout(function() {
599
+ setTimeout(function () {
600
600
  for (let i = 0; i < filter.items.length; i++) {
601
601
  if (filter.filterList[i] && filter.items[i].getAttribute('data-scale') == 'on') {
602
602
  // Scale up item
@@ -635,7 +635,7 @@ Math.easeInOutQuad = function(t, b, c, d) {
635
635
  }, 50);
636
636
 
637
637
  // Wait for the end of transition of visible elements
638
- setTimeout(function() {
638
+ setTimeout(function () {
639
639
  resetItems(filter);
640
640
  }, filter.options.duration + 100);
641
641
  }
@@ -688,12 +688,12 @@ Math.easeInOutQuad = function(t, b, c, d) {
688
688
  // Get offset first visible element
689
689
  for (let i = 0; i < filter.items.length; i++) {
690
690
  if (!Util.hasClass(filter.items[i], 'ons-u-hidden')) {
691
- (itemStyle = window.getComputedStyle(filter.items[i])),
692
- (itemWidth = parseFloat(itemStyle.getPropertyValue('width'))),
693
- (itemHeight = parseFloat(itemStyle.getPropertyValue('height'))),
694
- (marginX = parseFloat(itemStyle.getPropertyValue('margin-left')) + parseFloat(itemStyle.getPropertyValue('margin-right'))),
695
- (marginY = parseFloat(itemStyle.getPropertyValue('margin-bottom')) + parseFloat(itemStyle.getPropertyValue('margin-top'))),
696
- (colNumber = parseInt((containerWidth + marginX) / (itemWidth + marginX)));
691
+ itemStyle = window.getComputedStyle(filter.items[i]);
692
+ itemWidth = parseFloat(itemStyle.getPropertyValue('width'));
693
+ itemHeight = parseFloat(itemStyle.getPropertyValue('height'));
694
+ marginX = parseFloat(itemStyle.getPropertyValue('margin-left')) + parseFloat(itemStyle.getPropertyValue('margin-right'));
695
+ marginY = parseFloat(itemStyle.getPropertyValue('margin-bottom')) + parseFloat(itemStyle.getPropertyValue('margin-top'));
696
+ colNumber = parseInt((containerWidth + marginX) / (itemWidth + marginX));
697
697
  filter.itemsGrid[0] = [filter.items[i].offsetLeft, filter.items[i].offsetTop]; // Left, top
698
698
  break;
699
699
  }
@@ -774,14 +774,14 @@ Math.easeInOutQuad = function(t, b, c, d) {
774
774
  })();
775
775
 
776
776
  // ADVANCED FILTERS
777
- (function() {
777
+ (function () {
778
778
  // The Adv Filter object is used to handle:
779
779
 
780
780
  // - number of results
781
781
  // - form reset
782
782
  // - filtering sections label (to show a preview of the option selected by the users)
783
783
 
784
- let AdvFilter = function(element) {
784
+ let AdvFilter = function (element) {
785
785
  this.element = element;
786
786
  this.form = document.getElementsByClassName('ons-js-adv-filter__form');
787
787
  this.resultsList = this.element.getElementsByClassName('ons-js-adv-filter__gallery')[0];
@@ -794,15 +794,15 @@ Math.easeInOutQuad = function(t, b, c, d) {
794
794
  function initAdvFilter(filter) {
795
795
  if (filter.form.length > 0) {
796
796
  // Reset form
797
- filter.form[0].addEventListener('reset', function() {
798
- setTimeout(function() {
797
+ filter.form[0].addEventListener('reset', function () {
798
+ setTimeout(function () {
799
799
  resetFilters(filter);
800
800
  resetGallery(filter);
801
801
  });
802
802
  });
803
803
 
804
804
  // Update section labels on form change
805
- filter.form[0].addEventListener('change', function(event) {
805
+ filter.form[0].addEventListener('change', function (event) {
806
806
  let section = event.target.closest('.ons-js-adv-filter__item');
807
807
  if (section) resetSelection(filter, section);
808
808
  else if (Util.is(event.target, '.ons-js-adv-filter__form')) {
@@ -815,7 +815,7 @@ Math.easeInOutQuad = function(t, b, c, d) {
815
815
 
816
816
  // Reset results count
817
817
  if (filter.resultsCount.length > 0) {
818
- filter.resultsList.addEventListener('filter-selection-updated', function() {
818
+ filter.resultsList.addEventListener('filter-selection-updated', function () {
819
819
  updateResultsCount(filter);
820
820
  });
821
821
  }
@@ -960,7 +960,7 @@ Math.easeInOutQuad = function(t, b, c, d) {
960
960
  let advFilter = document.getElementsByClassName('ons-js-adv-filter');
961
961
  if (advFilter.length > 0) {
962
962
  for (let i = 0; i < advFilter.length; i++) {
963
- (function(i) {
963
+ (function (i) {
964
964
  new AdvFilter(advFilter[i]);
965
965
  })(i);
966
966
  }
@@ -978,7 +978,7 @@ Math.easeInOutQuad = function(t, b, c, d) {
978
978
  element: gallery,
979
979
 
980
980
  // This is your gallery element
981
- priceRange: function(items) {
981
+ priceRange: function (items) {
982
982
  // This is the price custom function
983
983
  let filteredArray = [],
984
984
  minVal = document.getElementById('slider-min-value').value,
@@ -989,7 +989,7 @@ Math.easeInOutQuad = function(t, b, c, d) {
989
989
  }
990
990
  return filteredArray;
991
991
  },
992
- indexValue: function(items) {
992
+ indexValue: function (items) {
993
993
  // This is the index custom function
994
994
  let filteredArray = [],
995
995
  value = document.getElementById('index-value').value;
@@ -1004,7 +1004,7 @@ Math.easeInOutQuad = function(t, b, c, d) {
1004
1004
  })();
1005
1005
 
1006
1006
  // TOGGLE FILTERS
1007
- (function() {
1007
+ (function () {
1008
1008
  let filters = document.getElementsByClassName('ons-js-adv-filter');
1009
1009
 
1010
1010
  if (filters.length > 0) {
@@ -1017,25 +1017,25 @@ Math.easeInOutQuad = function(t, b, c, d) {
1017
1017
  let page = document.getElementsByClassName('ons-page')[0];
1018
1018
 
1019
1019
  // Detect click on filters trigger
1020
- filtersTrigger.addEventListener('click', function(event) {
1020
+ filtersTrigger.addEventListener('click', function (event) {
1021
1021
  event.preventDefault();
1022
1022
  toggleFilters(!Util.hasClass(filtersPanel, 'ons-adv-filter__panel--is-visible'));
1023
1023
  });
1024
1024
 
1025
1025
  // Detect click on update
1026
- filtersShow.addEventListener('click', function(event) {
1026
+ filtersShow.addEventListener('click', function (event) {
1027
1027
  event.preventDefault();
1028
1028
  filtersTrigger.click();
1029
1029
  });
1030
1030
 
1031
1031
  // Detect click on close
1032
- filtersClose.addEventListener('click', function(event) {
1032
+ filtersClose.addEventListener('click', function (event) {
1033
1033
  event.preventDefault();
1034
1034
  filtersTrigger.click();
1035
1035
  });
1036
1036
 
1037
1037
  // Listen for key events
1038
- window.addEventListener('keyup', function(event) {
1038
+ window.addEventListener('keyup', function (event) {
1039
1039
  // Listen for ESC key
1040
1040
  if ((event.keyCode && event.keyCode == 27) || (event.key && event.key.toLowerCase() == 'escape')) {
1041
1041
  // Close filter panel on mobile if open
@@ -1048,7 +1048,7 @@ Math.easeInOutQuad = function(t, b, c, d) {
1048
1048
  // Listen for resize
1049
1049
  let resizingId = false;
1050
1050
 
1051
- window.addEventListener('resize', function() {
1051
+ window.addEventListener('resize', function () {
1052
1052
  clearTimeout(resizingId);
1053
1053
  resizingId = setTimeout(doneResizing, 500);
1054
1054
  });
@@ -4,6 +4,7 @@ import { renderComponent, renderTemplate, setTestPage } from '../../tests/helper
4
4
 
5
5
  const iPhoneX = KnownDevices['iPhone X'];
6
6
 
7
+ /* eslint-disable indent */
7
8
  const EXAMPLE_PAGE = `
8
9
  <div class="ons-page">
9
10
  <div class="ons-js-adv-filter">
@@ -179,7 +180,8 @@ const EXAMPLE_PAGE = `
179
180
  </div>
180
181
  </div>
181
182
  </div>
182
- `;
183
+ `;
184
+ /* eslint-enable indent */
183
185
 
184
186
  const RENDERED_EXAMPLE_PAGE = renderTemplate(EXAMPLE_PAGE);
185
187
 
@@ -12,7 +12,7 @@
12
12
  {% endset %}
13
13
 
14
14
  {% call onsPanel({
15
- "type": "error",
15
+ "variant": "error",
16
16
  "id": params.id
17
17
  }) %}
18
18
  {{ content | safe }}
@@ -36,11 +36,7 @@ describe('macro: error', () => {
36
36
  ),
37
37
  );
38
38
 
39
- expect(
40
- $('.ons-panel__error')
41
- .text()
42
- .trim(),
43
- ).toBe('Example error text.');
39
+ expect($('.ons-panel__error').text().trim()).toBe('Example error text.');
44
40
  });
45
41
 
46
42
  it('applies the provided `attributes` to the error content paragraph', () => {
@@ -76,7 +72,7 @@ describe('macro: error', () => {
76
72
  FAKE_NESTED_CONTENT,
77
73
  );
78
74
 
79
- expect(panelSpy.occurrences[0].type).toBe('error');
75
+ expect(panelSpy.occurrences[0].variant).toBe('error');
80
76
  expect(panelSpy.occurrences[0].id).toBe('example-error');
81
77
  });
82
78
 
@@ -70,21 +70,13 @@ describe('macro: feedback', () => {
70
70
  }),
71
71
  );
72
72
 
73
- expect(
74
- $(`${expectedTitleTag}.ons-feedback__heading`)
75
- .text()
76
- .trim(),
77
- ).toBe('Feedback heading');
73
+ expect($(`${expectedTitleTag}.ons-feedback__heading`).text().trim()).toBe('Feedback heading');
78
74
  });
79
75
 
80
76
  it('has a default `headingLevel` of 2', () => {
81
77
  const $ = cheerio.load(renderComponent('feedback', EXAMPLE_FEEDBACK_MINIMAL));
82
78
 
83
- expect(
84
- $(`h2.ons-feedback__heading`)
85
- .text()
86
- .trim(),
87
- ).toBe('Feedback heading');
79
+ expect($(`h2.ons-feedback__heading`).text().trim()).toBe('Feedback heading');
88
80
  });
89
81
 
90
82
  it('has additional heading style classes', () => {
@@ -97,11 +89,7 @@ describe('macro: feedback', () => {
97
89
  it('has a paragraph with the provided `content`', () => {
98
90
  const $ = cheerio.load(renderComponent('feedback', EXAMPLE_FEEDBACK_MINIMAL));
99
91
 
100
- expect(
101
- $('p')
102
- .text()
103
- .trim(),
104
- ).toBe('Feedback content...');
92
+ expect($('p').text().trim()).toBe('Feedback content...');
105
93
  });
106
94
 
107
95
  it('has a link with the provided `url`', () => {
@@ -113,10 +101,6 @@ describe('macro: feedback', () => {
113
101
  it('has a link with the provided `linkText`', () => {
114
102
  const $ = cheerio.load(renderComponent('feedback', EXAMPLE_FEEDBACK_MINIMAL));
115
103
 
116
- expect(
117
- $('.ons-feedback__link')
118
- .text()
119
- .trim(),
120
- ).toBe('Feedback link text');
104
+ expect($('.ons-feedback__link').text().trim()).toBe('Feedback link text');
121
105
  });
122
106
  });
@@ -75,9 +75,7 @@ describe('macro: field', () => {
75
75
  it('calls with content', () => {
76
76
  const $ = cheerio.load(renderComponent('field', EXAMPLE_FIELD_BASIC, 'Example content...'));
77
77
 
78
- const content = $('.ons-field')
79
- .html()
80
- .trim();
78
+ const content = $('.ons-field').html().trim();
81
79
  expect(content).toEqual(expect.stringContaining('Example content...'));
82
80
  });
83
81
 
@@ -10,8 +10,7 @@
10
10
  margin: 0;
11
11
  padding: 0 0 1.5rem;
12
12
 
13
- strong,
14
- .ons-highlight {
13
+ strong {
15
14
  @extend .ons-highlight;
16
15
  }
17
16
  }
@@ -42,9 +42,7 @@ describe('macro: fieldset', () => {
42
42
  it('has the `description` text', () => {
43
43
  const $ = cheerio.load(renderComponent('fieldset', EXAMPLE_FIELDSET_BASIC));
44
44
 
45
- const title = $('.ons-fieldset__description')
46
- .html()
47
- .trim();
45
+ const title = $('.ons-fieldset__description').html().trim();
48
46
  expect(title).toBe('A fieldset description');
49
47
  });
50
48
 
@@ -122,9 +120,7 @@ describe('macro: fieldset', () => {
122
120
  it('calls with content', () => {
123
121
  const $ = cheerio.load(renderComponent('fieldset', EXAMPLE_FIELDSET_BASIC, 'Example content...'));
124
122
 
125
- const content = $('.ons-fieldset')
126
- .html()
127
- .trim();
123
+ const content = $('.ons-fieldset').html().trim();
128
124
  expect(content).toEqual(expect.stringContaining('Example content...'));
129
125
  });
130
126
 
@@ -179,9 +175,7 @@ describe('macro: fieldset', () => {
179
175
  }),
180
176
  );
181
177
 
182
- const title = $('.ons-fieldset__legend-title')
183
- .html()
184
- .trim();
178
+ const title = $('.ons-fieldset__legend-title').html().trim();
185
179
  expect(title).toBe('Fieldset legend');
186
180
  });
187
181
 
@@ -30,6 +30,14 @@
30
30
  vertical-align: middle;
31
31
  }
32
32
 
33
+ &__poweredBy-link {
34
+ &:focus {
35
+ .ons-icon--logo {
36
+ @extend %a-focus;
37
+ }
38
+ }
39
+ }
40
+
33
41
  .ons-icon--logo,
34
42
  .ons-icon--logo__group {
35
43
  fill: var(--ons-color-black) !important;
@@ -36,10 +36,9 @@
36
36
  <div class="ons-footer__warning">
37
37
  <div class="ons-container">
38
38
  {% call onsPanel({
39
- "type": "warn",
40
- "classes": "ons-panel--warn--footer"
41
- })
42
- %}
39
+ "variant": "warn",
40
+ "classes": "ons-panel--warn--footer"
41
+ }) %}
43
42
  {{ params.footerWarning | safe }}
44
43
  {% endcall %}
45
44
  </div>
@@ -158,9 +157,11 @@
158
157
  </div>
159
158
  {% endif %}
160
159
  {% if not params.poweredBy %}
161
- <div class="ons-footer__poweredby ons-u-mb-m">
162
- {{ onsLogo | safe }}
163
- </div>
160
+ <a class="ons-footer__poweredBy-link" {% if lang == "cy" %}href="https://cy.ons.gov.uk/"{% else %}href="https://www.ons.gov.uk/"{% endif %}>
161
+ <div class="ons-footer__poweredby-logo ons-u-mb-m">
162
+ {{ onsLogo | safe }}
163
+ </div>
164
+ </a>
164
165
  {% endif %}
165
166
  </div>
166
167
  {% if params.crest %}