@ons/design-system 72.5.0 → 72.6.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 (37) hide show
  1. package/components/chart/_chart.scss +51 -0
  2. package/components/chart/_macro.njk +27 -3
  3. package/components/chart/_macro.spec.js +388 -0
  4. package/components/chart/annotations-options.js +78 -0
  5. package/components/chart/bar-chart.js +6 -2
  6. package/components/chart/chart.js +111 -26
  7. package/components/chart/column-chart.js +2 -2
  8. package/components/chart/common-chart-options.js +97 -50
  9. package/components/chart/example-bar-chart-with-annotations.njk +62 -0
  10. package/components/chart/example-bar-chart.njk +1 -0
  11. package/components/chart/example-bar-with-line-chart.njk +64 -0
  12. package/components/chart/example-clustered-column-chart.njk +3 -1
  13. package/components/chart/example-column-chart-with-annotations.njk +62 -0
  14. package/components/chart/example-column-chart.njk +3 -1
  15. package/components/chart/example-column-with-line-chart.njk +62 -0
  16. package/components/chart/example-line-chart-with-annotations.njk +235 -0
  17. package/components/chart/example-line-chart.njk +4 -2
  18. package/components/chart/example-stacked-column-chart.njk +3 -1
  19. package/components/chart/line-chart.js +2 -7
  20. package/components/hero/_hero.scss +31 -0
  21. package/components/hero/_macro.njk +20 -9
  22. package/components/hero/_macro.spec.js +94 -0
  23. package/components/hero/example-hero-grey.njk +8 -0
  24. package/components/icon/_macro.njk +1 -1
  25. package/components/pagination/_pagination.scss +7 -1
  26. package/components/summary/_macro.njk +1 -1
  27. package/components/summary/_macro.spec.js +6 -0
  28. package/components/table-of-contents/_macro.njk +40 -0
  29. package/components/table-of-contents/_macro.spec.js +72 -0
  30. package/components/table-of-contents/_table-of-contents.scss +11 -0
  31. package/components/table-of-contents/example-table-of-contents-related-links-with-button.njk +60 -0
  32. package/css/main.css +1 -1
  33. package/js/cookies-functions.js +11 -6
  34. package/js/cookies-functions.spec.js +44 -0
  35. package/package.json +1 -1
  36. package/scripts/main.es5.js +1 -1
  37. package/scripts/main.js +1 -1
@@ -0,0 +1,62 @@
1
+ {% from "components/chart/_macro.njk" import onsChart %}
2
+
3
+ {{
4
+ onsChart({
5
+ "chartType": "column",
6
+ "description": "Volume sales, seasonally adjusted, Great Britain, January 2022 to January 2025",
7
+ "theme": "primary",
8
+ "title": "Food stores showed a strong rise on the month, while non-food stores fell",
9
+ "subtitle": "Figure 6: Upward contribution from housing and household services (including energy) saw the annual CPIH inflation rate rise",
10
+ "id": "uuid",
11
+ "caption": "Source: Monthly Business Survey, Retail Sales Inquiry from the Office for National Statistics",
12
+ "download": {
13
+ 'title': 'Download Figure 1 data',
14
+ 'itemsList': [
15
+ {
16
+ "text": "Excel spreadsheet (XLSX format, 18KB)",
17
+ "url": "#"
18
+ },
19
+ {
20
+ "text": "Simple text file (CSV format, 25KB)",
21
+ "url": "#"
22
+ },
23
+ {
24
+ "text": "Image (PNG format, 25KB)",
25
+ "url": "#"
26
+ }
27
+ ]
28
+ },
29
+ "legend": true,
30
+ "xAxis": {
31
+ "categories": ["One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten"],
32
+ "type": "linear"
33
+ },
34
+ "yAxis": {
35
+ "title": "Percent (%)"
36
+ },
37
+ "series": [
38
+ {
39
+ "data": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
40
+ "dataLabels": true,
41
+ "name": "Values"
42
+ },
43
+ {
44
+ "data": [
45
+ ["One", 6],
46
+ ["Two", 4],
47
+ ["Three", 5],
48
+ ["Four", 7],
49
+ ["Five", 2],
50
+ ["Six", 9],
51
+ ["Seven", 3],
52
+ ["Eight", 8],
53
+ ["Nine", 2],
54
+ ["Ten", 1]
55
+ ],
56
+ "dataLabels": false,
57
+ "name": "Another test data source",
58
+ "type": "line"
59
+ }
60
+ ]
61
+ })
62
+ }}
@@ -0,0 +1,235 @@
1
+ {% from "components/chart/_macro.njk" import onsChart %}
2
+
3
+ {{
4
+ onsChart({
5
+ "chartType": "line",
6
+ "description": "Line chart showing the annual rate of inflation for the Consumer Prices Index including owner occupiers’ housing costs (CPIH) and its components.",
7
+ "theme": "alternate",
8
+ "title": "Sales volumes and values saw moderate growth in July 2024",
9
+ "subtitle": "Figure 6: Upward contribution from housing and household services (including energy) saw the annual CPIH inflation rate rise",
10
+ "id": "id",
11
+ "headingLevel": 4,
12
+ "caption": "Source: Monthly Business Survey, Retails Sales Inquiry from the Office for National Statistics",
13
+ "download": {
14
+ 'title': 'Download Figure 1 data',
15
+ 'itemsList': [
16
+ {
17
+ "text": "Excel spreadsheet (XLSX format, 18KB)",
18
+ "url": "#"
19
+ },
20
+ {
21
+ "text": "Simple text file (CSV format, 25KB)",
22
+ "url": "#"
23
+ },
24
+ {
25
+
26
+ "text": "Image (PNG format, 25KB)",
27
+ "url": "#"
28
+ }
29
+ ]},
30
+ "legend": "true",
31
+ "xAxis": {
32
+ "title": "Year",
33
+ "type": "linear",
34
+ "labelFormat": "{value:,.f}",
35
+ "categories": [
36
+ 'Oct 2014',
37
+ 'Nov 2014',
38
+ 'Dec 2014',
39
+ 'Jan 2015',
40
+ 'Feb 2015',
41
+ 'Mar 2015',
42
+ 'Apr 2015',
43
+ 'May 2015',
44
+ 'Jun 2015',
45
+ 'Jul 2015',
46
+ 'Aug 2015',
47
+ 'Sep 2015',
48
+ 'Oct 2015',
49
+ 'Nov 2015',
50
+ 'Dec 2015',
51
+ 'Jan 2016',
52
+ 'Feb 2016',
53
+ 'Mar 2016',
54
+ 'Apr 2016',
55
+ 'May 2016',
56
+ 'Jun 2016',
57
+ 'Jul 2016',
58
+ 'Aug 2016',
59
+ 'Sep 2016',
60
+ 'Oct 2016',
61
+ 'Nov 2016',
62
+ 'Dec 2016',
63
+ 'Jan 2017',
64
+ 'Feb 2017',
65
+ 'Mar 2017',
66
+ 'Apr 2017',
67
+ 'May 2017',
68
+ 'Jun 2017',
69
+ 'Jul 2017',
70
+ 'Aug 2017',
71
+ 'Sep 2017',
72
+ 'Oct 2017',
73
+ 'Nov 2017',
74
+ 'Dec 2017',
75
+ 'Jan 2018',
76
+ 'Feb 2018',
77
+ 'Mar 2018',
78
+ 'Apr 2018',
79
+ 'May 2018',
80
+ 'Jun 2018',
81
+ 'Jul 2018',
82
+ 'Aug 2018',
83
+ 'Sep 2018',
84
+ 'Oct 2018',
85
+ 'Nov 2018',
86
+ 'Dec 2018',
87
+ 'Jan 2019',
88
+ 'Feb 2019',
89
+ 'Mar 2019',
90
+ 'Apr 2019',
91
+ 'May 2019',
92
+ 'Jun 2019',
93
+ 'Jul 2019',
94
+ 'Aug 2019',
95
+ 'Sep 2019',
96
+ 'Oct 2019',
97
+ 'Nov 2019',
98
+ 'Dec 2019',
99
+ 'Jan 2020',
100
+ 'Feb 2020',
101
+ 'Mar 2020',
102
+ 'Apr 2020',
103
+ 'May 2020',
104
+ 'Jun 2020',
105
+ 'Jul 2020',
106
+ 'Aug 2020',
107
+ 'Sep 2020',
108
+ 'Oct 2020',
109
+ 'Nov 2020',
110
+ 'Dec 2020',
111
+ 'Jan 2021',
112
+ 'Feb 2021',
113
+ 'Mar 2021',
114
+ 'Apr 2021',
115
+ 'May 2021',
116
+ 'Jun 2021',
117
+ 'Jul 2021',
118
+ 'Aug 2021',
119
+ 'Sep 2021',
120
+ 'Oct 2021',
121
+ 'Nov 2021',
122
+ 'Dec 2021',
123
+ 'Jan 2022',
124
+ 'Feb 2022',
125
+ 'Mar 2022',
126
+ 'Apr 2022',
127
+ 'May 2022',
128
+ 'Jun 2022',
129
+ 'Jul 2022',
130
+ 'Aug 2022',
131
+ 'Sep 2022',
132
+ 'Oct 2022',
133
+ 'Nov 2022',
134
+ 'Dec 2022',
135
+ 'Jan 2023',
136
+ 'Feb 2023',
137
+ 'Mar 2023',
138
+ 'Apr 2023',
139
+ 'May 2023',
140
+ 'Jun 2023',
141
+ 'Jul 2023',
142
+ 'Aug 2023',
143
+ 'Sep 2023',
144
+ 'Oct 2023',
145
+ 'Nov 2023',
146
+ 'Dec 2023',
147
+ 'Jan 2024',
148
+ 'Feb 2024',
149
+ 'Mar 2024',
150
+ 'Apr 2024',
151
+ 'May 2024',
152
+ 'Jun 2024',
153
+ 'Jul 2024',
154
+ 'Aug 2024',
155
+ 'Sep 2024',
156
+ 'Oct 2024'
157
+ ]
158
+ },
159
+ "yAxis": {
160
+ "title": "Sales",
161
+ "labelFormat": "{value:,.f}"
162
+ },
163
+ "percentageHeightDesktop": 35,
164
+ "percentageHeightMobile": 90,
165
+ "series": [
166
+ {
167
+ "name": 'CPIH',
168
+ "data": [
169
+ 1.3, 1.1, 0.7, 0.5, 0.4, 0.3, 0.3, 0.4, 0.3, 0.5, 0.4, 0.2, 0.2, 0.4, 0.5, 0.6,
170
+ 0.6, 0.8, 0.7, 0.7, 0.8, 0.9, 1.0, 1.3, 1.3, 1.5, 1.8, 1.9, 2.3, 2.3, 2.6, 2.7,
171
+ 2.6, 2.6, 2.7, 2.8, 2.8, 2.8, 2.7, 2.7, 2.5, 2.3, 2.2, 2.3, 2.3, 2.3, 2.4, 2.2,
172
+ 2.2, 2.2, 2.0, 1.8, 1.8, 1.8, 2.0, 1.9, 1.9, 2.0, 1.7, 1.7, 1.5, 1.5, 1.4, 1.8,
173
+ 1.7, 1.5, 0.9, 0.7, 0.8, 1.1, 0.5, 0.7, 0.9, 0.6, 0.8, 0.9, 0.7, 1.0, 1.6, 2.1,
174
+ 2.4, 2.1, 3.0, 2.9, 3.8, 4.6, 4.8, 4.9, 5.5, 6.2, 7.8, 7.9, 8.2, 8.8, 8.6, 8.8,
175
+ 9.6, 9.3, 9.2, 8.8, 9.2, 8.9, 7.8, 7.9, 7.3, 6.4, 6.3, 6.3, 4.7, 4.2, 4.2, 4.2,
176
+ 3.8, 3.8, 3.0, 2.8, 2.8, 3.1, 3.1, 2.6, 3.2
177
+ ]
178
+ },
179
+ {
180
+ "name": 'Goods',
181
+ "data": [
182
+ 0.3, -0.2, -1.0, -1.5, -2.0, -2.1, -1.9, -1.8, -2.0, -1.8, -2.0, -2.4, -2.1,
183
+ -1.9, -2.1, -1.5, -1.6, -1.7, -1.6, -1.8, -1.7, -1.5, -1.4, -0.5, -0.4, 0.2,
184
+ 0.7, 1.1, 1.9, 2.5, 2.4, 3.0, 2.6, 2.7, 3.1, 3.2, 3.3, 3.3, 3.4, 3.2, 3.0, 2.4,
185
+ 2.6, 2.5, 2.5, 2.6, 2.7, 2.5, 2.3, 2.1, 1.8, 1.2, 1.3, 1.3, 1.4, 1.5, 1.5, 1.7,
186
+ 1.2, 0.9, 0.4, 0.5, 0.6, 1.3, 1.0, 0.6, -0.4, -0.9, -0.5, 0.0, -0.2, -0.3, 0.1,
187
+ -0.7, -0.2, -0.2, -0.5, 0.1, 1.6, 2.3, 2.9, 2.5, 3.3, 3.5, 4.9, 6.5, 6.9, 7.2,
188
+ 8.3, 9.4, 12.4, 12.4, 12.7, 13.6, 13.0, 13.2, 14.8, 14.1, 13.4, 13.3, 13.4,
189
+ 12.7, 10.0, 9.7, 8.5, 6.1, 6.3, 6.2, 2.9, 2.0, 1.9, 1.8, 1.1, 0.9, -0.8, -1.3,
190
+ -1.4, -0.5, -0.9, -1.4, -0.3
191
+ ]
192
+ },
193
+ {
194
+ "name": 'Services',
195
+ "data": [
196
+ 2.2, 2.1, 2.1, 2.1, 2.2, 2.2, 2.0, 2.1, 2.1, 2.2, 2.2, 2.2, 2.1, 2.2, 2.5, 2.2,
197
+ 2.3, 2.6, 2.4, 2.6, 2.7, 2.6, 2.7, 2.6, 2.5, 2.4, 2.5, 2.5, 2.6, 2.2, 2.8, 2.6,
198
+ 2.5, 2.4, 2.5, 2.5, 2.4, 2.4, 2.2, 2.3, 2.1, 2.1, 1.9, 2.1, 2.0, 2.0, 2.2, 2.0,
199
+ 2.1, 2.2, 2.1, 2.2, 2.2, 2.2, 2.5, 2.3, 2.2, 2.2, 2.0, 2.2, 2.2, 2.2, 1.9, 2.1,
200
+ 2.2, 2.2, 1.9, 1.8, 1.7, 2.0, 1.0, 1.5, 1.5, 1.5, 1.6, 1.7, 1.6, 1.6, 1.7, 1.9,
201
+ 2.1, 1.8, 2.7, 2.5, 2.9, 3.0, 3.1, 3.1, 3.2, 3.7, 4.1, 4.3, 4.5, 4.9, 5.1, 5.3,
202
+ 5.3, 5.4, 5.8, 5.2, 5.6, 5.7, 6.0, 6.3, 6.3, 6.5, 6.1, 6.3, 6.2, 6.0, 6.0, 6.1,
203
+ 6.0, 6.0, 6.0, 5.9, 6.0, 5.7, 5.9, 5.6, 5.6
204
+ ]
205
+ },
206
+ {
207
+ "name": 'CPIH excl energy, food, alcohol & tobacco',
208
+ "data": [
209
+ 1.5, 1.3, 1.4, 1.5, 1.4, 1.2, 1.1, 1.2, 1.0, 1.3, 1.2, 1.2, 1.3, 1.4, 1.5, 1.4,
210
+ 1.4, 1.6, 1.5, 1.5, 1.6, 1.6, 1.5, 1.7, 1.6, 1.7, 1.8, 1.8, 2.1, 1.9, 2.4, 2.5,
211
+ 2.4, 2.4, 2.6, 2.5, 2.5, 2.5, 2.3, 2.4, 2.2, 2.1, 2.0, 2.0, 1.8, 1.8, 1.9, 1.8,
212
+ 1.8, 1.8, 1.8, 1.8, 1.8, 1.8, 1.7, 1.7, 1.7, 1.9, 1.5, 1.6, 1.7, 1.7, 1.4, 1.6,
213
+ 1.7, 1.6, 1.5, 1.3, 1.5, 1.8, 1.0, 1.4, 1.5, 1.2, 1.5, 1.5, 1.1, 1.3, 1.5, 2.0,
214
+ 2.3, 1.9, 2.9, 2.7, 3.1, 3.6, 3.8, 4.0, 4.6, 5.1, 5.4, 5.2, 5.2, 5.5, 5.6, 5.8,
215
+ 5.8, 5.7, 5.8, 5.3, 5.7, 5.7, 6.2, 6.5, 6.4, 6.4, 5.9, 5.9, 5.6, 5.2, 5.2, 5.1,
216
+ 4.8, 4.7, 4.4, 4.2, 4.2, 4.1, 4.3, 4.0, 4.1
217
+ ]
218
+ }
219
+ ],
220
+ "annotations": [
221
+ {
222
+ "text": "A test annotation",
223
+ "point": {"x": 10, "y": 1.3},
224
+ "labelOffsetX": 10,
225
+ "labelOffsetY": -50
226
+ },
227
+ {
228
+ "text": "Another test annotation",
229
+ "point": {"x": 48, "y": 1.8},
230
+ "labelOffsetX": 30,
231
+ "labelOffsetY": -70
232
+ }
233
+ ]
234
+ })
235
+ }}
@@ -27,7 +27,7 @@
27
27
  "url": "#"
28
28
  }
29
29
  ]},
30
- "legend": "true",
30
+ "legend": true,
31
31
  "xAxis": {
32
32
  "title": "Year",
33
33
  "type": "linear",
@@ -214,6 +214,8 @@
214
214
  4.8, 4.7, 4.4, 4.2, 4.2, 4.1, 4.3, 4.0, 4.1
215
215
  ]
216
216
  }
217
- ]
217
+ ],
218
+ "percentageHeightDesktop": 35,
219
+ "percentageHeightMobile": 90
218
220
  })
219
221
  }}
@@ -60,6 +60,8 @@
60
60
  },
61
61
  "yAxis": {
62
62
  "title": "Percentage of GDP (%)"
63
- }
63
+ },
64
+ "percentageHeightDesktop": 35,
65
+ "percentageHeightMobile": 90
64
66
  })
65
67
  }}
@@ -1,11 +1,6 @@
1
1
  class LineChart {
2
2
  getLineChartOptions = () => {
3
3
  return {
4
- legend: {
5
- // Specific legend symbol width and height for line charts
6
- symbolWidth: 20,
7
- symbolHeight: 3,
8
- },
9
4
  plotOptions: {
10
5
  line: {
11
6
  lineWidth: 3,
@@ -22,8 +17,8 @@ class LineChart {
22
17
  };
23
18
  };
24
19
 
25
- updateLastPointMarker = (currentChart) => {
26
- currentChart.series.forEach((series) => {
20
+ updateLastPointMarker = (series) => {
21
+ series.forEach((series) => {
27
22
  // If markers are disabled, hide them all but the last point marker
28
23
  if (series.options.marker.enabled.enabled === undefined) {
29
24
  const points = series.points;
@@ -1,4 +1,14 @@
1
1
  // Default
2
+ @mixin panel-variant($name, $color, $color-bg) {
3
+ .ons-hero__panel {
4
+ &--#{$name} {
5
+ background: $color-bg;
6
+ border-color: $color !important;
7
+ outline: 1px solid transparent; // Add transparent outline because Windows High Contrast Mode doesn't show background
8
+ }
9
+ }
10
+ }
11
+
2
12
  .ons-hero {
3
13
  background-color: var(--ons-color-hero-bg);
4
14
  display: flex;
@@ -73,6 +83,7 @@
73
83
 
74
84
  &__badge-link {
75
85
  display: block;
86
+ width: fit-content;
76
87
  }
77
88
 
78
89
  &--topic {
@@ -99,6 +110,22 @@
99
110
  }
100
111
  }
101
112
 
113
+ &__information {
114
+ display: flex;
115
+ flex-wrap: wrap;
116
+ column-gap: 1rem;
117
+
118
+ & .ons-hero__panel {
119
+ padding: 0.5rem 1rem;
120
+ border-left: 5px solid transparent;
121
+ @extend .ons-u-fs-r--b;
122
+ }
123
+
124
+ & .ons-hero__link {
125
+ padding: 0.5rem 0;
126
+ }
127
+ }
128
+
102
129
  &__pre-title {
103
130
  margin-bottom: 0.5rem;
104
131
 
@@ -435,3 +462,7 @@
435
462
  }
436
463
  }
437
464
  }
465
+
466
+ @include panel-variant(ons-red, var(--ons-color-errors), var(--ons-color-errors-tint));
467
+ @include panel-variant(ons-green, var(--ons-color-success), var(--ons-color-success-tint));
468
+ @include panel-variant(ons-orange, var(--ons-color-pending), var(--ons-color-pending-tint));
@@ -77,15 +77,26 @@
77
77
  </div>
78
78
  {% endif %}
79
79
  </div>
80
-
81
- {% if params.variants == "grey" and params.censusLogo == true %}
82
- <div class="ons-hero__census-logo">
83
- {{-
84
- onsIcon({
85
- "iconType": 'census-logo'
86
- })
87
- -}}
88
- </div>
80
+ {% if params.variants == "grey" %}
81
+ {% if params.censusLogo == true %}
82
+ <div class="ons-hero__census-logo">
83
+ {{-
84
+ onsIcon({
85
+ "iconType": 'census-logo'
86
+ })
87
+ -}}
88
+ </div>
89
+ {% endif %}
90
+ {% if params.informationPanel %}
91
+ <div class="ons-hero__information ons-u-mt-s">
92
+ <div class="ons-hero__panel ons-hero__panel--{{ params.informationPanel.panelType }}">
93
+ {{- params.informationPanel.panelText -}}
94
+ </div>
95
+ <div class="ons-hero__link">
96
+ <a href="{{ params.informationPanel.panelLink.url }}">{{ params.informationPanel.panelLink.text }}</a>
97
+ </div>
98
+ </div>
99
+ {% endif %}
89
100
  {% endif %}
90
101
 
91
102
  {% if params.button %}
@@ -112,6 +112,22 @@ describe('macro: hero', () => {
112
112
  expect($('.ons-hero__badge svg title').text().trim()).toBe('Offical Statistics Badge');
113
113
  });
114
114
 
115
+ it('outputs the statistics badge as a link when officialStatisticsBadgeUrl is provided', () => {
116
+ const $ = cheerio.load(
117
+ renderComponent('hero', {
118
+ ...EXAMPLE_HERO,
119
+ variants: 'grey',
120
+ officialStatisticsBadge: true,
121
+ officialStatisticsBadgeUrl: 'https://example.com/badge',
122
+ }),
123
+ );
124
+
125
+ expect($('.ons-hero__badge-link').length).toBe(1);
126
+ expect($('.ons-hero__badge-link').attr('href')).toBe('https://example.com/badge');
127
+ expect($('.ons-hero__badge-link').attr('target')).toBe('_blank');
128
+ expect($('.ons-hero__badge-link').attr('rel')).toBe('noopener noreferrer');
129
+ });
130
+
115
131
  it('outputs the Census 2021 Logo when censusLogo is set to true and variants is set to "grey"', () => {
116
132
  const $ = cheerio.load(renderComponent('hero', { ...EXAMPLE_HERO, variants: 'grey', censusLogo: true }));
117
133
 
@@ -136,6 +152,84 @@ describe('macro: hero', () => {
136
152
  expect($('.ons-hero--grey').length).toBe(1);
137
153
  });
138
154
 
155
+ describe('when `informationPanel` is provided and the variant is set to `grey`', () => {
156
+ describe('and `panelText` and `panelLink` are provided', () => {
157
+ it('renders the information panel with correct text and link`', () => {
158
+ const $ = cheerio.load(
159
+ renderComponent('hero', {
160
+ ...EXAMPLE_HERO,
161
+ variants: 'grey',
162
+ informationPanel: {
163
+ panelText: 'Some panel text',
164
+ panelType: 'ons-green',
165
+ panelLink: {
166
+ text: 'Some link text',
167
+ url: '#0',
168
+ },
169
+ },
170
+ }),
171
+ );
172
+
173
+ expect($('.ons-hero__information').length).toBe(1);
174
+ expect($('.ons-hero__panel').length).toBe(1);
175
+ expect($('.ons-hero__panel').text().trim()).toBe('Some panel text');
176
+ expect($('.ons-hero__link > a').text().trim()).toBe('Some link text');
177
+ expect($('.ons-hero__link > a').attr('href')).toBe('#0');
178
+ });
179
+ });
180
+
181
+ describe('and `panelType` is set to `ons-green`', () => {
182
+ it('renders the green information panel`', () => {
183
+ const $ = cheerio.load(
184
+ renderComponent('hero', {
185
+ ...EXAMPLE_HERO,
186
+ variants: 'grey',
187
+ informationPanel: {
188
+ panelText: 'Some panel text',
189
+ panelType: 'ons-green',
190
+ },
191
+ }),
192
+ );
193
+
194
+ expect($('.ons-hero__panel').hasClass('ons-hero__panel--ons-green')).toBe(true);
195
+ });
196
+ });
197
+
198
+ describe('and `panelType` is set to `ons-red`', () => {
199
+ it('renders the red information panel`', () => {
200
+ const $ = cheerio.load(
201
+ renderComponent('hero', {
202
+ ...EXAMPLE_HERO,
203
+ variants: 'grey',
204
+ informationPanel: {
205
+ panelText: 'Some panel text',
206
+ panelType: 'ons-red',
207
+ },
208
+ }),
209
+ );
210
+
211
+ expect($('.ons-hero__panel').hasClass('ons-hero__panel--ons-red')).toBe(true);
212
+ });
213
+ });
214
+
215
+ describe('and `panelType` is set to `ons-orange`', () => {
216
+ it('renders the orange information panel`', () => {
217
+ const $ = cheerio.load(
218
+ renderComponent('hero', {
219
+ ...EXAMPLE_HERO,
220
+ variants: 'grey',
221
+ informationPanel: {
222
+ panelText: 'Some panel text',
223
+ panelType: 'ons-orange',
224
+ },
225
+ }),
226
+ );
227
+
228
+ expect($('.ons-hero__panel').hasClass('ons-hero__panel--ons-orange')).toBe(true);
229
+ });
230
+ });
231
+ });
232
+
139
233
  it('outputs the correct breadcrumbs', () => {
140
234
  const $ = cheerio.load(
141
235
  renderComponent('hero', {
@@ -9,6 +9,14 @@
9
9
  "detailsColumns": '12',
10
10
  "officialStatisticsBadge": true,
11
11
  "officialStatisticsBadgeUrl": 'https://uksa.statisticsauthority.gov.uk/about-the-authority/uk-statistical-system/types-of-official-statistics/',
12
+ "informationPanel":{
13
+ "panelText": 'Latest release',
14
+ "panelType": 'ons-green',
15
+ "panelLink": {
16
+ "text": 'View previous releases',
17
+ "url": '#0'
18
+ }
19
+ },
12
20
  "topic": 'Statistical article',
13
21
  "title": 'Retail sales rise amid summer discounts and sporting events, according to a first estimate',
14
22
  "text": 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum id mattis ligula, nec sollicitudin arcu. Donec non tristique tellus. Donec eget malesuada lorem.',
@@ -703,7 +703,7 @@
703
703
  xmlns="http://www.w3.org/2000/svg"
704
704
  width="75"
705
705
  height="90"
706
- viewBox="-5 0 90 90"
706
+ viewBox="-6 0 90 90"
707
707
  fill="none"
708
708
  title="ons-official-statistics-badge"
709
709
  focusable="false"
@@ -7,7 +7,6 @@ $pagination-item-width: 2.5rem;
7
7
  }
8
8
 
9
9
  &__items {
10
- margin: 0 $pagination-item-padding * -1;
11
10
  padding: 0;
12
11
  }
13
12
 
@@ -17,6 +16,7 @@ $pagination-item-width: 2.5rem;
17
16
 
18
17
  &--previous,
19
18
  &--next {
19
+ margin: 0 $pagination-item-padding * -1;
20
20
  display: inline-block;
21
21
  }
22
22
 
@@ -25,6 +25,12 @@ $pagination-item-width: 2.5rem;
25
25
  display: inline-block;
26
26
  }
27
27
  }
28
+
29
+ @include mq('2xs', m) {
30
+ &--previous ~ &--next {
31
+ margin: 0;
32
+ }
33
+ }
28
34
  }
29
35
 
30
36
  &__item,
@@ -104,7 +104,7 @@
104
104
  </dd>
105
105
  {% endif %}
106
106
  {% if item.actions %}
107
- <dd class="ons-summary__actions">
107
+ <dd class="ons-summary__actions" {% if item.id %}id="{{ item.id }}"{% endif %}>
108
108
  {% for action in item.actions %}
109
109
  {% if loop.index > 1 %}<span class="ons-summary__spacer"></span>{% endif %}
110
110
  <a
@@ -514,6 +514,12 @@ describe('macro: summary', () => {
514
514
  ).toBe('Action 2');
515
515
  });
516
516
 
517
+ it('has the correct `id` added to the actions', () => {
518
+ const $ = cheerio.load(renderComponent('summary', EXAMPLE_SUMMARY_BASIC));
519
+
520
+ expect($('.ons-summary__items .ons-summary__item:nth-of-type(2) .ons-summary__actions').attr('id')).toBe('item-id-2');
521
+ });
522
+
517
523
  it('has the correct visually hidden <span> text', () => {
518
524
  const $ = cheerio.load(renderComponent('summary', EXAMPLE_SUMMARY_BASIC));
519
525