@ons/design-system 72.10.8 → 72.10.10

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 (66) hide show
  1. package/README.md +9 -5
  2. package/components/accordion/accordion.js +3 -2
  3. package/components/announcement-banner/_announcement-banner.scss +24 -0
  4. package/components/announcement-banner/_macro.njk +33 -0
  5. package/components/announcement-banner/_macro.spec.js +106 -0
  6. package/components/announcement-banner/_test_examples.js +22 -0
  7. package/components/announcement-banner/example-banner-black.njk +12 -0
  8. package/components/announcement-banner/example-banner-red.njk +13 -0
  9. package/components/announcement-banner/example-banner-teal.njk +13 -0
  10. package/components/autosuggest/autosuggest.spec.js +2 -0
  11. package/components/autosuggest/autosuggest.ui.js +12 -7
  12. package/components/breadcrumbs/_breadcrumbs.scss +53 -0
  13. package/components/breadcrumbs/_macro.njk +33 -24
  14. package/components/breadcrumbs/_macro.spec.js +25 -0
  15. package/components/button/_button.scss +29 -1
  16. package/components/chart/_chart.scss +88 -0
  17. package/components/chart/_macro.njk +25 -6
  18. package/components/chart/_macro.spec.js +1178 -640
  19. package/components/chart/bar-chart.js +8 -1
  20. package/components/chart/chart-iframe-resize.js +2 -2
  21. package/components/chart/common-chart-options.js +9 -0
  22. package/components/chart/example-bar-chart-with-axis-min-and-max-values.njk +0 -1
  23. package/components/chart/example-bar-chart-with-point-range-and-reference-line-annotations.njk +4 -4
  24. package/components/chart/example-bar-chart.njk +0 -1
  25. package/components/chart/example-iframe-chart.njk +1 -1
  26. package/components/chart/range-annotations-options.js +1 -1
  27. package/components/download-resources/download-resources.spec.js +2 -0
  28. package/components/duration/example-duration-error-for-single-field.njk +0 -1
  29. package/components/duration/example-duration-error.njk +0 -1
  30. package/components/footer/_macro.spec.js +2 -2
  31. package/components/header/_macro.njk +5 -16
  32. package/components/header/example-header-button-and-navigation.njk +133 -0
  33. package/components/header/example-header-external-with-navigation-and-search.njk +1 -1
  34. package/components/hero/_hero.scss +17 -22
  35. package/components/hero/_macro.njk +1 -1
  36. package/components/hero/_macro.spec.js +1 -1
  37. package/components/hero/example-hero-dark-with-external-breadcrumbs.njk +194 -0
  38. package/components/hero/example-hero-default-with-external-breadcrumbs.njk +201 -0
  39. package/components/hero/example-hero-grey-with-external-breadcrumbs.njk +243 -0
  40. package/components/hero/example-hero-navy-blue-with-external-breadcrumbs.njk +200 -0
  41. package/components/hero/example-hero-pale-blue-with-external-breadcrumbs.njk +201 -0
  42. package/components/icon/_macro.njk +1 -1
  43. package/components/mutually-exclusive/mutually-exclusive.js +3 -1
  44. package/components/navigation/_macro.njk +11 -16
  45. package/components/navigation/_navigation.scss +24 -0
  46. package/components/radios/clear-radios.js +4 -2
  47. package/components/relationships/relationships.js +4 -2
  48. package/components/table/_macro.njk +107 -112
  49. package/components/table/_macro.spec.js +35 -44
  50. package/components/table/_table.scss +0 -12
  51. package/components/table/example-table-sortable.njk +1 -1
  52. package/components/tabs/example-tabs-details.njk +1 -1
  53. package/components/textarea/_macro.njk +1 -0
  54. package/components/textarea/_macro.spec.js +1 -0
  55. package/components/timeout-panel/timeout-panel.spec.js +1 -1
  56. package/components/video/video.js +2 -0
  57. package/css/main.css +1 -1
  58. package/js/timeout.js +9 -6
  59. package/layout/_template.njk +13 -0
  60. package/package.json +6 -6
  61. package/scripts/main.es5.js +4 -2
  62. package/scripts/main.js +4 -2
  63. package/scss/main.scss +1 -0
  64. package/scss/vars/_colors.scss +3 -0
  65. package/scss/vars/_forms.scss +11 -0
  66. package/components/table/example-table-scrollable.njk +0 -158
package/js/timeout.js CHANGED
@@ -1,3 +1,5 @@
1
+ import DOMPurify from 'dompurify';
2
+
1
3
  export default class Timeout {
2
4
  constructor(context, sessionExpiryEndpoint, initialExpiryTime, enableTimeoutReset, startOnLoad) {
3
5
  this.context = context;
@@ -77,23 +79,23 @@ export default class Timeout {
77
79
  ($this.endWithFullStop ? '.' : '');
78
80
 
79
81
  if (timerExpired) {
80
- $this.countdown.innerHTML = '<span class="ons-u-fw-b">' + $this.countdownExpiredText + '</span>';
81
- $this.accessibleCountdown.innerHTML = $this.countdownExpiredText;
82
+ $this.countdown.innerHTML = DOMPurify.sanitize('<span class="ons-u-fw-b">' + $this.countdownExpiredText + '</span>');
83
+ $this.accessibleCountdown.innerHTML = DOMPurify.sanitize($this.countdownExpiredText);
82
84
  setTimeout($this.redirect.bind($this), 2000);
83
85
  } else {
84
86
  seconds--;
85
87
  $this.expiryTimeInMilliseconds = seconds * 1000;
86
- $this.countdown.innerHTML = timeLeftText;
88
+ $this.countdown.innerHTML = DOMPurify.sanitize(timeLeftText);
87
89
 
88
90
  if (minutesLeft < 1 && secondsLeft < 20) {
89
91
  $this.accessibleCountdown.setAttribute('aria-live', 'assertive');
90
92
  }
91
93
 
92
94
  if (!$this.timerRunOnce) {
93
- $this.accessibleCountdown.innerHTML = timeLeftText;
95
+ $this.accessibleCountdown.innerHTML = DOMPurify.sanitize(timeLeftText);
94
96
  $this.timerRunOnce = true;
95
97
  } else if (secondsLeft % 15 === 0) {
96
- $this.accessibleCountdown.innerHTML = timeLeftText;
98
+ $this.accessibleCountdown.innerHTML = DOMPurify.sanitize(timeLeftText);
97
99
  }
98
100
 
99
101
  timers.push(setTimeout(runTimer.bind($this), 1000));
@@ -165,7 +167,8 @@ export default class Timeout {
165
167
  }
166
168
 
167
169
  redirect() {
168
- window.location.replace(this.timeOutRedirectUrl);
170
+ const sanitizedUrl = DOMPurify.sanitize(this.timeOutRedirectUrl);
171
+ window.location.replace(sanitizedUrl);
169
172
  }
170
173
 
171
174
  clearTimers() {
@@ -146,6 +146,19 @@
146
146
  })
147
147
  }}
148
148
  {% endblock %}
149
+ {% block announcementBanner %}
150
+ {% if pageConfig.announcementBanner %}
151
+ {% from "components/announcement-banner/_macro.njk" import onsAnnouncementBanner %}
152
+ {{
153
+ onsAnnouncementBanner({
154
+ "variants": pageConfig.announcementBanner.variants,
155
+ "title": pageConfig.announcementBanner.title,
156
+ "description": pageConfig.announcementBanner.description,
157
+ "link": pageConfig.announcementBanner.link
158
+ })
159
+ }}
160
+ {% endif %}
161
+ {% endblock %}
149
162
  {% block header %}
150
163
  {{
151
164
  onsHeader({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ons/design-system",
3
3
  "description": "ONS Design System built CSS, JS, and Nunjucks templates",
4
- "version": "72.10.8",
4
+ "version": "72.10.10",
5
5
  "main": "index.js",
6
6
  "license": "MIT",
7
7
  "author": {
@@ -68,7 +68,7 @@
68
68
  "autoprefixer": "^10.4.21",
69
69
  "babel-plugin-istanbul": "^7.0.0",
70
70
  "babelify": "^10.0.0",
71
- "backstopjs": "^6.1.4",
71
+ "backstopjs": "^6.3.25",
72
72
  "browser-sync": "^3.0.4",
73
73
  "browserify": "^17.0.1",
74
74
  "chalk": "^4.1.2",
@@ -82,7 +82,7 @@
82
82
  "eslint-config-prettier": "^9.0.0",
83
83
  "eslint-plugin-prettier": "^5.0.0",
84
84
  "eslint-plugin-unused-imports": "^3.1.0",
85
- "express": "^4.17.1",
85
+ "express": "^5.0.0",
86
86
  "front-matter": "^4.0.2",
87
87
  "fs-extra": "^11.1.1",
88
88
  "fuse.js": "^7.0.0",
@@ -100,9 +100,9 @@
100
100
  "jest": "^29.6.1",
101
101
  "jest-axe": "^8.0.0",
102
102
  "jest-environment-jsdom": "^29.6.1",
103
- "jest-puppeteer": "^10.0.0",
103
+ "jest-puppeteer": "^11.0.0",
104
104
  "jsdom": "^26.1.0",
105
- "lighthouse": "^11.0.0",
105
+ "lighthouse": "^12.0.0",
106
106
  "lint-staged": "^15.2.0",
107
107
  "lodash": "^4.17.21",
108
108
  "mdn-polyfills": "^5.14.0",
@@ -114,7 +114,7 @@
114
114
  "prepend-file": "^2.0.1",
115
115
  "prettier": "^3.2.5",
116
116
  "prettier-plugin-jinja-template": "^1.4.0",
117
- "puppeteer": "^22.0.0",
117
+ "puppeteer": "^24.0.0",
118
118
  "remark-cli": "^12.0.0",
119
119
  "remark-lint": "^9.1.2",
120
120
  "remark-preset-lint-recommended": "^6.1.3",