@ons/design-system 72.4.0 → 72.5.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 (46) hide show
  1. package/components/button/_button.scss +171 -3
  2. package/components/button/_macro.njk +4 -0
  3. package/components/card/_card.scss +5 -0
  4. package/components/card/_macro.njk +10 -2
  5. package/components/card/_macro.spec.js +58 -0
  6. package/components/card/example-card-set-with-headline-figures.njk +62 -0
  7. package/components/chart/_chart.scss +29 -0
  8. package/components/chart/_macro.njk +101 -0
  9. package/components/chart/_macro.spec.js +437 -0
  10. package/components/chart/bar-chart.js +160 -0
  11. package/components/chart/chart-constants.js +21 -0
  12. package/components/chart/chart.dom.js +8 -0
  13. package/components/chart/chart.js +157 -0
  14. package/components/chart/column-chart.js +48 -0
  15. package/components/chart/common-chart-options.js +200 -0
  16. package/components/chart/example-bar-chart.njk +54 -0
  17. package/components/chart/example-clustered-bar-chart.njk +60 -0
  18. package/components/chart/example-clustered-column-chart.njk +72 -0
  19. package/components/chart/example-column-chart.njk +52 -0
  20. package/components/chart/example-line-chart.njk +219 -0
  21. package/components/chart/example-stacked-bar-chart.njk +60 -0
  22. package/components/chart/example-stacked-column-chart.njk +65 -0
  23. package/components/chart/line-chart.js +47 -0
  24. package/components/chart/specific-chart-options.js +22 -0
  25. package/components/footer/_footer.scss +12 -0
  26. package/components/footer/_macro.njk +38 -17
  27. package/components/header/_header.scss +18 -2
  28. package/components/header/_macro.njk +81 -8
  29. package/components/header/_macro.spec.js +97 -0
  30. package/components/header/example-header-with-search-button.njk +190 -0
  31. package/components/header/header.spec.js +128 -0
  32. package/components/hero/_hero.scss +8 -7
  33. package/components/hero/_macro.njk +45 -26
  34. package/components/hero/example-hero-grey.njk +1 -0
  35. package/components/icon/_macro.njk +8 -8
  36. package/components/input/_input.scss +15 -0
  37. package/components/input/_macro.njk +3 -3
  38. package/components/navigation/navigation.dom.js +17 -0
  39. package/components/navigation/navigation.js +72 -2
  40. package/css/main.css +1 -1
  41. package/js/main.js +2 -0
  42. package/package.json +4 -1
  43. package/scripts/main.es5.js +1 -1
  44. package/scripts/main.js +1 -1
  45. package/scss/main.scss +1 -0
  46. package/scss/utilities/_grid.scss +13 -4
@@ -0,0 +1,219 @@
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
+ "series": [
164
+ {
165
+ "name": 'CPIH',
166
+ "data": [
167
+ 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,
168
+ 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,
169
+ 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,
170
+ 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,
171
+ 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,
172
+ 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,
173
+ 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,
174
+ 3.8, 3.8, 3.0, 2.8, 2.8, 3.1, 3.1, 2.6, 3.2
175
+ ]
176
+ },
177
+ {
178
+ "name": 'Goods',
179
+ "data": [
180
+ 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,
181
+ -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,
182
+ 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,
183
+ 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,
184
+ 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,
185
+ -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,
186
+ 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,
187
+ 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,
188
+ -1.4, -0.5, -0.9, -1.4, -0.3
189
+ ]
190
+ },
191
+ {
192
+ "name": 'Services',
193
+ "data": [
194
+ 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,
195
+ 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,
196
+ 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,
197
+ 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,
198
+ 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,
199
+ 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,
200
+ 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,
201
+ 6.0, 6.0, 6.0, 5.9, 6.0, 5.7, 5.9, 5.6, 5.6
202
+ ]
203
+ },
204
+ {
205
+ "name": 'CPIH excl energy, food, alcohol & tobacco',
206
+ "data": [
207
+ 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,
208
+ 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,
209
+ 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,
210
+ 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,
211
+ 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,
212
+ 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,
213
+ 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,
214
+ 4.8, 4.7, 4.4, 4.2, 4.2, 4.1, 4.3, 4.0, 4.1
215
+ ]
216
+ }
217
+ ]
218
+ })
219
+ }}
@@ -0,0 +1,60 @@
1
+ {% from "components/chart/_macro.njk" import onsChart %}
2
+ {{
3
+ onsChart({
4
+ "chartType": "bar",
5
+ "description": "Volume sales, seasonally adjusted, Great Britain, January 2022 to January 2025",
6
+ "theme": "primary",
7
+ "title": "Food stores showed a strong rise on the month, while non-food stores fell",
8
+ "subtitle": "Figure 6: Upward contribution from housing and household services (including energy) saw the annual CPIH inflation rate rise",
9
+ "id": "uuid",
10
+ "useStackedLayout": true,
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
+ "series": [
31
+ {
32
+ "data": [5, 3, 4, 6],
33
+ "dataLabels": false,
34
+ "name": "2022"
35
+ },
36
+ {
37
+ "data": [2, 2, 3, 7],
38
+ "dataLabels": false,
39
+ "name": "2023"
40
+ },
41
+ {
42
+ "data": [3, 4, 4, 1],
43
+ "dataLabels": false,
44
+ "name": "2024"
45
+ }
46
+ ],
47
+ "xAxis": {
48
+ "categories": [
49
+ "Food stores",
50
+ "Non-food stores",
51
+ "Non-store retailing ",
52
+ "Automotive fuel"
53
+ ],
54
+ "type": "linear"
55
+ },
56
+ "yAxis": {
57
+ "title": "Percent (%)"
58
+ }
59
+ })
60
+ }}
@@ -0,0 +1,65 @@
1
+ {% from "components/chart/_macro.njk" import onsChart %}
2
+ {{
3
+ onsChart({
4
+ "chartType": "column",
5
+ "description": "Volume sales, seasonally adjusted, Great Britain, January 2022 to January 2025",
6
+ "theme": "primary",
7
+ "title": "Food stores showed a strong rise on the month, while non-food stores fell",
8
+ "subtitle": "Figure 6: Upward contribution from housing and household services (including energy) saw the annual CPIH inflation rate rise",
9
+ "id": "uuid",
10
+ "useStackedLayout": true,
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
+ "series": [
31
+ {
32
+ "data": [5, 3, 4, 6, 2, 2, 3, 7],
33
+ "dataLabels": false,
34
+ "name": "2022"
35
+ },
36
+ {
37
+ "data": [2, 2, 3, 7, 3, 4, 4, 1],
38
+ "dataLabels": false,
39
+ "name": "2023"
40
+ },
41
+ {
42
+ "data": [3, 4, 4, 1, 5, 3, 4, 6],
43
+ "dataLabels": false,
44
+ "name": "2024"
45
+ }
46
+ ],
47
+ "xAxis": {
48
+ "categories": [
49
+ "Food stores",
50
+ "Non-food stores",
51
+ "Non-store retailing ",
52
+ "Automotive fuel",
53
+ "Household goods stores",
54
+ "Clothing stores",
55
+ "Other stores",
56
+ "All retailing"
57
+ ],
58
+ "title": "Items",
59
+ "type": "linear"
60
+ },
61
+ "yAxis": {
62
+ "title": "Percentage of GDP (%)"
63
+ }
64
+ })
65
+ }}
@@ -0,0 +1,47 @@
1
+ class LineChart {
2
+ getLineChartOptions = () => {
3
+ return {
4
+ legend: {
5
+ // Specific legend symbol width and height for line charts
6
+ symbolWidth: 20,
7
+ symbolHeight: 3,
8
+ },
9
+ plotOptions: {
10
+ line: {
11
+ lineWidth: 3,
12
+ linecap: 'round',
13
+ // In a later PR we will update the marker styles
14
+ marker: {
15
+ enabled: false,
16
+ radius: 4,
17
+ symbol: 'circle',
18
+ lineWidth: 0,
19
+ },
20
+ },
21
+ },
22
+ };
23
+ };
24
+
25
+ updateLastPointMarker = (currentChart) => {
26
+ currentChart.series.forEach((series) => {
27
+ // If markers are disabled, hide them all but the last point marker
28
+ if (series.options.marker.enabled.enabled === undefined) {
29
+ const points = series.points;
30
+ if (points && points.length > 0) {
31
+ // Show only the last point marker
32
+ const lastPoint = points[points.length - 1];
33
+ lastPoint.update(
34
+ {
35
+ marker: {
36
+ enabled: true,
37
+ },
38
+ },
39
+ false,
40
+ );
41
+ }
42
+ }
43
+ });
44
+ };
45
+ }
46
+
47
+ export default LineChart;
@@ -0,0 +1,22 @@
1
+ import ChartConstants from './chart-constants';
2
+
3
+ // Options that rely on the chart config but are not specific to the chart type
4
+ class SpecificChartOptions {
5
+ constructor(theme, type, config) {
6
+ this.constants = ChartConstants.constants();
7
+ this.theme = theme;
8
+ this.config = config;
9
+
10
+ this.options = {
11
+ colors: this.theme === 'alternate' ? this.constants.alternateTheme : this.constants.primaryTheme,
12
+ chart: {
13
+ type: type,
14
+ marginTop: this.config.legend.enabled ? undefined : 50,
15
+ },
16
+ };
17
+ }
18
+
19
+ getOptions = () => this.options;
20
+ }
21
+
22
+ export default SpecificChartOptions;
@@ -62,4 +62,16 @@
62
62
  @extend .ons-u-mb-2xs;
63
63
  }
64
64
  }
65
+
66
+ &__logo-large {
67
+ @include mq('2xs', 414px) {
68
+ display: none;
69
+ }
70
+ }
71
+
72
+ &__logo-small {
73
+ @include mq(415px) {
74
+ display: none;
75
+ }
76
+ }
65
77
  }
@@ -9,23 +9,44 @@
9
9
  {% endif %}
10
10
  {% set extraLogo = params.footerLogo.logos.logo2 %}
11
11
  {% set onsLogo %}
12
- {% if params.lang == 'cy' %}
13
- {{-
14
- onsIcon({
15
- "iconType": 'ons-logo-stacked-cy' if extraLogo else 'ons-logo-cy',
16
- "altText": 'Swyddfa Ystadegau Gwladol',
17
- "altTextId": 'ons-logo-cy-footer-alt'
18
- })
19
- -}}
20
- {% else %}
21
- {{-
22
- onsIcon({
23
- "iconType": 'ons-logo-stacked-en' if extraLogo else 'ons-logo-en' ,
24
- "altText": 'Office for National Statistics',
25
- "altTextId": 'ons-logo-en-footer-alt'
26
- })
27
- -}}
28
- {% endif %}
12
+ <div class="ons-footer__logo-large">
13
+ {% if params.lang == 'cy' %}
14
+ {{-
15
+ onsIcon({
16
+ "iconType": 'ons-logo-stacked-cy' if extraLogo else 'ons-logo-cy',
17
+ "altText": 'Swyddfa Ystadegau Gwladol',
18
+ "altTextId": 'ons-logo-cy-footer-alt'
19
+ })
20
+ -}}
21
+ {% else %}
22
+ {{-
23
+ onsIcon({
24
+ "iconType": 'ons-logo-stacked-en' if extraLogo else 'ons-logo-en',
25
+ "altText": 'Office for National Statistics',
26
+ "altTextId": 'ons-logo-en-footer-alt'
27
+ })
28
+ -}}
29
+ {% endif %}
30
+ </div>
31
+ <div class="ons-footer__logo-small">
32
+ {% if params.lang == 'cy' %}
33
+ {{-
34
+ onsIcon({
35
+ "iconType": 'ons-logo-stacked-cy',
36
+ "altText": 'Swyddfa Ystadegau Gwladol',
37
+ "altTextId": 'ons-logo-stacked-cy-footer-alt'
38
+ })
39
+ -}}
40
+ {% else %}
41
+ {{-
42
+ onsIcon({
43
+ "iconType": 'ons-logo-stacked-en',
44
+ "altText": 'Office for National Statistics',
45
+ "altTextId": 'ons-logo-stacked-en-footer-alt'
46
+ })
47
+ -}}
48
+ {% endif %}
49
+ </div>
29
50
  {% endset %}
30
51
 
31
52
  <footer class="ons-footer">
@@ -168,13 +168,13 @@
168
168
  }
169
169
 
170
170
  &__org-logo--large {
171
- @include mq('2xs', 454px) {
171
+ @include mq('2xs', 460px) {
172
172
  display: none;
173
173
  }
174
174
  }
175
175
 
176
176
  &__org-logo--small {
177
- @include mq(455px) {
177
+ @include mq(461px) {
178
178
  display: none;
179
179
  }
180
180
  }
@@ -278,6 +278,22 @@
278
278
  }
279
279
  }
280
280
 
281
+ &-nav-search {
282
+ background-color: var(--ons-color-branded-tint);
283
+ margin-bottom: 1rem;
284
+ @extend .ons-u-pt-2xl;
285
+ @extend .ons-u-pb-2xl;
286
+
287
+ width: 100%;
288
+ &__input {
289
+ border-bottom: 1px solid var(--ons-color-ocean-blue);
290
+ @extend .ons-u-mb-2xl;
291
+ @extend .ons-u-pb-2xl;
292
+
293
+ row-gap: 1rem;
294
+ }
295
+ }
296
+
281
297
  .ons-btn {
282
298
  top: 0 !important;
283
299
  }
@@ -180,20 +180,21 @@
180
180
  {% endif %}
181
181
  </div>
182
182
  {% endif %}
183
- {% if params.menuLinks %}
184
- <div class="ons-header__links ons-grid__col ons-u-ml-auto">
183
+
184
+ {% if params.variants == "basic" %}
185
+ <div class="ons-grid__col ons-col-auto">
185
186
  {% if params.menuLinks %}
186
- <div class="ons-grid__col ons-col-auto">
187
+ <div class="ons-header__links ons-grid__col">
187
188
  {{
188
189
  onsButton({
189
- "text": params.menuLinks.toggleNavButton.text | default("Menu"),
190
- "classes": "ons-u-fs-s--b ons-js-toggle-services button-nav",
190
+ "text": params.menuLinks.toggleMenuButton.text | default("Menu"),
191
+ "classes": "ons-u-fs-s--b ons-js-toggle-nav-menu button-nav",
191
192
  "type": "button",
192
193
  "variants": "menu",
193
194
  "iconType": "chevron",
194
195
  "iconPosition": "before",
195
196
  "attributes": {
196
- "aria-label": params.menuLinks.toggleNavButton.ariaLabel | default("Toggle menu"),
197
+ "aria-label": params.menuLinks.toggleMenuButton.ariaLabel | default("Toggle menu"),
197
198
  "aria-controls": params.menuLinks.id,
198
199
  "aria-expanded": "false"
199
200
  }
@@ -201,6 +202,23 @@
201
202
  }}
202
203
  </div>
203
204
  {% endif %}
205
+ {% if params.searchLinks %}
206
+ <div class="ons-header__links ons-grid__col">
207
+ {{
208
+ onsButton({
209
+ "classes": "ons-u-fs-s--b ons-js-toggle-header-search ons-btn--search ons-btn--search-icon",
210
+ "type": "button",
211
+ "variants": "search",
212
+ "iconType": "search",
213
+ "attributes": {
214
+ "aria-label": params.searchLinks.searchButtonAriaLabel | default("Toggle search"),
215
+ "aria-controls": params.searchLinks.id,
216
+ "aria-expanded": "false"
217
+ }
218
+ })
219
+ }}
220
+ </div>
221
+ {% endif %}
204
222
  </div>
205
223
  {% endif %}
206
224
  </div>
@@ -240,9 +258,10 @@
240
258
  {% endif %}
241
259
  </nav>
242
260
  {% endif %}
243
- {% if params.menuLinks %}
261
+
262
+ {% if params.variants == "basic" and params.menuLinks %}
244
263
  <nav
245
- class="ons-u-d-no ons-js-services-mobile-nav ons-header-nav-menu ons-u-mb-s ons-u-pt-2xl"
264
+ class="ons-u-d-no ons-js-nav-menu ons-header-nav-menu ons-u-mb-s ons-u-pt-2xl"
246
265
  id="{{ params.menuLinks.id }}"
247
266
  aria-label="{{ params.menuLinks.ariaLabel | default("Menu navigation") }}"
248
267
  >
@@ -312,6 +331,60 @@
312
331
  {% endif %}
313
332
  </nav>
314
333
  {% endif %}
334
+
335
+ {% if params.variants == "basic" and params.searchLinks %}
336
+ <nav
337
+ class="ons-u-d-no ons-js-header-search ons-header-nav-search {{ params.searchLinks.classes }}"
338
+ id="{{ params.searchLinks.id }}"
339
+ aria-label="{{ params.searchLinks.searchNavigationAriaLabel | default('Search navigation') }}"
340
+ >
341
+ <div class="ons-container">
342
+ <div class="ons-header-nav-search__input">
343
+ {% from "components/input/_macro.njk" import onsInput %}
344
+ {{
345
+ onsInput({
346
+ "id": 'search-field',
347
+ "width": 'full',
348
+ "label": {
349
+ "text": 'Search the ONS',
350
+ "id": "header-search-input-label"
351
+ },
352
+ "searchButton": {
353
+ "visuallyHideButtonText": true,
354
+ "text": 'Search',
355
+ "iconType": 'search',
356
+ 'variant': 'header'
357
+
358
+ }
359
+ })
360
+ }}
361
+ </div>
362
+ </div>
363
+ {% if params.searchLinks %}
364
+ <div class="ons-container">
365
+ <h2 class="ons-u-fs-r--b ons-u-mb-s ons-header-nav-search__heading">{{ params.searchLinks.heading }}</h2>
366
+ <ul class="ons-list ons-list--bare ons-list--inline">
367
+ {% for item in params.searchLinks.itemsList %}
368
+ {# Limiting the popular searches to 5 #}
369
+ {% if loop.index <= 5 %}
370
+ <li class="ons-list__item">
371
+ {% if item.text %}
372
+ {% if item.url %}
373
+ <a href="{{ item.url }}" class="ons-u-fs-r ons-header-nav-search__text"
374
+ >{{ item.text }}
375
+ </a>
376
+ {% else %}
377
+ <p class="ons-u-fs-r ons-header-nav-search__text">{{ item.text }}</p>
378
+ {% endif %}
379
+ {% endif %}
380
+ </li>
381
+ {% endif %}
382
+ {% endfor %}
383
+ </ul>
384
+ </div>
385
+ {% endif %}
386
+ </nav>
387
+ {% endif %}
315
388
  </div>
316
389
  {% if params.variants != "basic" %}
317
390
  <div class="ons-header__main">