@ons/design-system 72.10.7 → 72.10.9

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 (45) hide show
  1. package/components/accordion/accordion.js +3 -2
  2. package/components/autosuggest/autosuggest.spec.js +2 -0
  3. package/components/autosuggest/autosuggest.ui.js +12 -7
  4. package/components/breadcrumbs/_breadcrumbs.scss +53 -0
  5. package/components/breadcrumbs/_macro.njk +33 -24
  6. package/components/breadcrumbs/_macro.spec.js +25 -0
  7. package/components/chart/_chart.scss +91 -0
  8. package/components/chart/_macro.njk +38 -7
  9. package/components/chart/_macro.spec.js +102 -13
  10. package/components/chart/bar-chart.js +9 -1
  11. package/components/chart/chart-iframe-resize.js +1 -1
  12. package/components/chart/chart.dom.js +5 -3
  13. package/components/chart/chart.js +8 -2
  14. package/components/chart/common-chart-options.js +9 -0
  15. package/components/chart/example-area-chart.njk +2 -1
  16. package/components/chart/example-bar-chart-with-axis-min-and-max-values.njk +0 -1
  17. package/components/chart/example-bar-chart-with-point-range-and-reference-line-annotations.njk +4 -4
  18. package/components/chart/example-bar-chart.njk +0 -1
  19. package/components/chart/example-iframe-chart.njk +2 -1
  20. package/components/chart/example-line-chart.njk +2 -1
  21. package/components/chart/range-annotations-options.js +1 -1
  22. package/components/download-resources/download-resources.spec.js +2 -0
  23. package/components/hero/_hero.scss +17 -22
  24. package/components/hero/_macro.njk +1 -1
  25. package/components/hero/_macro.spec.js +1 -1
  26. package/components/hero/example-hero-dark-with-external-breadcrumbs.njk +194 -0
  27. package/components/hero/example-hero-default-with-external-breadcrumbs.njk +201 -0
  28. package/components/hero/example-hero-grey-with-external-breadcrumbs.njk +243 -0
  29. package/components/hero/example-hero-navy-blue-with-external-breadcrumbs.njk +200 -0
  30. package/components/hero/example-hero-pale-blue-with-external-breadcrumbs.njk +201 -0
  31. package/components/icon/_macro.njk +1 -1
  32. package/components/mutually-exclusive/mutually-exclusive.js +3 -1
  33. package/components/radios/clear-radios.js +4 -2
  34. package/components/relationships/relationships.js +4 -2
  35. package/components/tabs/tabs.js +2 -2
  36. package/components/video/video.js +2 -0
  37. package/css/main.css +1 -1
  38. package/img/small/area-chart-screenshot.png +0 -0
  39. package/img/small/line-chart-screenshot.png +0 -0
  40. package/js/timeout.js +9 -6
  41. package/layout/_template.njk +4 -1
  42. package/package.json +7 -5
  43. package/scripts/main.es5.js +4 -2
  44. package/scripts/main.js +4 -2
  45. package/scss/objects/_page.scss +1 -1
@@ -0,0 +1,201 @@
1
+ ---
2
+ title: 'Example: Table of contents on full page'
3
+ layout: ~
4
+ ---
5
+
6
+ {% from "components/hero/_macro.njk" import onsHero %}
7
+ {% from "components/breadcrumbs/_macro.njk" import onsBreadcrumbs %}
8
+ {% extends "layout/_template.njk" %}
9
+ {%
10
+ set pageConfig = {
11
+ "header": {
12
+ "variants": 'basic',
13
+ "menuLinks": {
14
+ "id": "menu-links",
15
+ "keyLinks": [
16
+ {
17
+ 'heading': 'Taking part in a survey?',
18
+ 'description': 'It’s never been more important.'
19
+ },
20
+ {
21
+ 'heading': 'Release calendar',
22
+ 'description': 'View our latest and upcoming releases.'
23
+ },
24
+ {
25
+ 'heading': 'Explore local statistics',
26
+ 'url': '#0',
27
+ 'description': 'Explore statistics across the UK.'
28
+ }
29
+ ],
30
+ "columns": [
31
+ {
32
+ "groups": [
33
+ {
34
+ "heading": "People, population and community",
35
+ "groupItems": [
36
+ {
37
+ "text": "Armed forces community"
38
+ },
39
+ {
40
+ "text": "Births, deaths and marriages"
41
+ },
42
+ {
43
+ "text": "Crime and justice"
44
+ },
45
+ {
46
+ "text": "Cultural identity"
47
+ },
48
+ {
49
+ "text": "Education and childcare"
50
+ },
51
+ {
52
+ "text": "Elections"
53
+ },
54
+ {
55
+ "text": "Health and social care"
56
+ },
57
+ {
58
+ "text": "Household characteristics"
59
+ },
60
+ {
61
+ "text": "Housing"
62
+ },
63
+ {
64
+ "text": "Leisure and tourism"
65
+ },
66
+ {
67
+ "text": "Personal and household finances"
68
+ },
69
+ {
70
+ "text": "Population and migration"
71
+ },
72
+ {
73
+ "text": "Well-being"
74
+ }
75
+ ]
76
+ }
77
+ ]
78
+ },
79
+ {
80
+ "groups": [
81
+ {
82
+ "heading": "Business, industry and trade",
83
+ "groupItems": [
84
+ {
85
+ "text": "Business"
86
+ },
87
+ {
88
+ "text": "Changes to business"
89
+ },
90
+ {
91
+ "text": "Construction industry"
92
+ },
93
+ {
94
+ "text": "International trade"
95
+ },
96
+ {
97
+ "text": "IT and internet industry"
98
+ },
99
+ {
100
+ "text": "Manufacturing and production industry"
101
+ },
102
+ {
103
+ "text": "Retail industry",
104
+ "url": "#0"
105
+ },
106
+ {
107
+ "text": "Tourism industry"
108
+ }
109
+ ]
110
+ },
111
+ {
112
+ "heading": "Employment and labour market",
113
+ "url": "#0",
114
+ "groupItems":
115
+ [
116
+ {
117
+ "text": "People in work"
118
+ },
119
+ {
120
+ "text": "People not in work"
121
+ }
122
+ ]
123
+
124
+ }
125
+ ]
126
+ },
127
+ {
128
+ "groups": [
129
+ {
130
+ "heading": "Economy",
131
+ "groupItems": [
132
+ {
133
+ "text": "Economic output and productivity"
134
+ },
135
+ {
136
+ "text": "Government, public sector and taxes"
137
+ },
138
+ {
139
+ "text": "Gross Value Added (GVA)"
140
+ },
141
+ {
142
+ "text": "Investments, pensions and trusts"
143
+ },
144
+ {
145
+ "text": "Regional accounts"
146
+ },
147
+ {
148
+ "text": "Environmental accounts"
149
+ },
150
+ {
151
+ "text": "Gross Domestic Product (GDP)"
152
+ },
153
+ {
154
+ "text": "Inflation and price indices"
155
+ },
156
+ {
157
+ "text": "National accounts"
158
+ }
159
+ ]
160
+ }
161
+ ]
162
+ }
163
+ ]
164
+ }
165
+ }
166
+ }
167
+ %}
168
+ {% block pageContent %}
169
+ {{
170
+ onsBreadcrumbs({
171
+ "ariaLabel": 'Breadcrumbs',
172
+ "variant": "pale-blue",
173
+ "itemsList": [
174
+ {
175
+ "url": '/',
176
+ "text": 'Home'
177
+ },
178
+ {
179
+ "url": '/',
180
+ "text": 'Business, industry and trade'
181
+ },
182
+ {
183
+ "url": '/',
184
+ "text": 'Retail industry'
185
+ }
186
+ ]
187
+ })
188
+ }}
189
+ <main id="main-content">
190
+ {{
191
+ onsHero({
192
+ "topic": 'Topic',
193
+ "title": 'Retail Industry',
194
+ "text": 'Sales by retailers in Great Britain directly to end consumers, including spending on goods (in store and online)
195
+ (Retail Sales Index) and spending on services (Index of Services). The industry as a whole is used as an indicator
196
+ of how the wider economy is performing and the strength of consumer spending.',
197
+ "variants": 'pale-blue'
198
+ })
199
+ }}
200
+ </main>
201
+ {% endblock %}
@@ -701,7 +701,7 @@
701
701
  class="ons-icon--logo{{ iconClasses }}"
702
702
  >
703
703
  <title id="{{ params.altTextId | default ('official-statistics-alt') }}">
704
- {{ params.altText | default ('Official Statistics Badge') }}
704
+ {{ params.altText | default ('Official Statistics Badge - Accredited') }}
705
705
  </title>
706
706
  <path
707
707
  d="M12.4999 92.59C7.18988 92.59 2.87988 88.27 2.87988 82.97C2.87988 77.67 7.19988 73.35 12.4999 73.35H64.4999C69.8099 73.35 74.1199 77.67 74.1199 82.97C74.1199 88.27 69.7999 92.59 64.4999 92.59H12.4999Z"
@@ -1,3 +1,5 @@
1
+ import DOMPurify from 'dompurify';
2
+
1
3
  const exclusiveGroupItemClass = 'ons-js-exclusive-group-item';
2
4
  const optionClass = 'ons-js-exclusive-option';
3
5
  const voiceOverAlertClass = 'ons-js-exclusive-alert';
@@ -133,7 +135,7 @@ export default class MutuallyExclusive {
133
135
 
134
136
  // Only update aria-live if value changes to prevent typing from clearing the message before it's read
135
137
  if (deselectionMessage) {
136
- this.voiceOverAlertElement.innerHTML = deselectionMessage;
138
+ this.voiceOverAlertElement.innerHTML = DOMPurify.sanitize(deselectionMessage);
137
139
  }
138
140
  }
139
141
 
@@ -1,3 +1,5 @@
1
+ import DOMPurify from 'dompurify';
2
+
1
3
  let clearAlertAnnounced;
2
4
  export default class ClearRadios {
3
5
  constructor(inputs, button, otherInput) {
@@ -32,7 +34,7 @@ export default class ClearRadios {
32
34
  setClearAttributes() {
33
35
  this.button.classList.remove('ons-u-db-no-js_enabled');
34
36
  if (clearAlertAnnounced === false) {
35
- this.ariaElement.innerHTML = this.clearAlert;
37
+ this.ariaElement.innerHTML = DOMPurify.sanitize(this.clearAlert);
36
38
  clearAlertAnnounced = true;
37
39
  }
38
40
  }
@@ -49,7 +51,7 @@ export default class ClearRadios {
49
51
  }
50
52
 
51
53
  this.button.classList.add('ons-u-db-no-js_enabled');
52
- this.ariaElement.innerHTML = this.clearedAlert;
54
+ this.ariaElement.innerHTML = DOMPurify.sanitize(this.clearedAlert);
53
55
  clearAlertAnnounced = false;
54
56
  }
55
57
  }
@@ -1,3 +1,5 @@
1
+ import DOMPurify from 'dompurify';
2
+
1
3
  export default class Relationships {
2
4
  constructor(context) {
3
5
  this.context = context;
@@ -20,9 +22,9 @@ export default class Relationships {
20
22
  if (radio) {
21
23
  const title = radio.getAttribute('data-title');
22
24
 
23
- this.legend.innerHTML = title;
25
+ this.legend.innerHTML = DOMPurify.sanitize(title);
24
26
 
25
- this.playback.innerHTML = radio.getAttribute('data-playback');
27
+ this.playback.innerHTML = DOMPurify.sanitize(radio.getAttribute('data-playback'));
26
28
  }
27
29
  }
28
30
  }
@@ -134,7 +134,7 @@ export default class Tabs {
134
134
  window.removeEventListener('hashchange', this.component.boundOnHashChange, true);
135
135
  }
136
136
 
137
- // Handle haschange so that the browser can cycle through the tab history
137
+ // Handle hashchange so that the browser can cycle through the tab history
138
138
  onHashChange() {
139
139
  const hash = window.location.hash;
140
140
  const tabWithHash = this.getTab(hash);
@@ -259,7 +259,7 @@ export default class Tabs {
259
259
  }
260
260
 
261
261
  getPanel(tab) {
262
- const panelSelector = this.getHref(tab).replace(/\./g, '\\.');
262
+ const panelSelector = this.getHref(tab).replace(/([ .:[\]{}()<>?+*~=|^$!\\])/g, '\\$1');
263
263
  const panel = this.component.querySelector(panelSelector);
264
264
  return panel;
265
265
  }
@@ -1,3 +1,4 @@
1
+ import DOMPurify from 'dompurify';
1
2
  export default class Video {
2
3
  constructor(component) {
3
4
  this.component = component;
@@ -30,6 +31,7 @@ export default class Video {
30
31
  }
31
32
  addDNTtoVimeoVideos() {
32
33
  let src = this.iframe.getAttribute('data-src');
34
+ src = DOMPurify.sanitize(src);
33
35
  if (src.includes('player.vimeo.com/video') && src.includes('?dnt=1') === false) {
34
36
  src += '?dnt=1';
35
37
  return src;