@ons/design-system 73.0.3 → 73.0.4
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.
- package/components/accordion/_macro.njk +2 -0
- package/components/accordion/_macro.spec.js +39 -0
- package/components/accordion/accordion.js +2 -0
- package/components/accordion/example-accordion.njk +6 -1
- package/components/back-to-top/example-full-page-back-to-top.njk +2 -2
- package/components/button/example-button-new-window.njk +1 -0
- package/components/chart/chart-constants.js +2 -1
- package/components/chart/chart.js +2 -0
- package/components/chart/example-area-chart-with-axis-min-and-max-values.njk +1 -1
- package/components/chart/example-clustered-column-chart.njk +1 -1
- package/components/chart/example-line-chart-with-annotations.njk +1 -1
- package/components/chart/example-line-chart-with-axis-min-and-max-values.njk +1 -1
- package/components/chart/example-line-chart-with-custom-reference-line-value.njk +1 -1
- package/components/chart/example-line-chart-with-markers.njk +1 -37
- package/components/chart/example-line-chart-with-range-annotations-inside.njk +1 -1
- package/components/chart/example-line-chart-with-range-annotations-outside-left-right.njk +1 -1
- package/components/chart/example-line-chart-with-range-annotations-outside-top-bottom.njk +1 -1
- package/components/chart/example-line-chart-with-reference-line-annotations.njk +1 -1
- package/components/chart/example-line-chart.njk +1 -1
- package/components/chart/example-scatter-chart-with-axis-min-and-max-values.njk +1 -1
- package/components/chart/example-scatter-chart.njk +1 -1
- package/components/chart/example-stacked-column-chart.njk +26 -37
- package/components/chart/specific-chart-options.js +16 -1
- package/components/cookies-banner/_macro.njk +1 -3
- package/components/featured-article/example-featured-article-with-chart.njk +1 -1
- package/components/icon/_macro.njk +2 -2
- package/components/icon/_macro.spec.js +2 -2
- package/components/list/example-inline-list-with-social-icon-prefix.njk +2 -2
- package/components/related-content/example-related-content-social-media.njk +2 -2
- package/components/share-page/_macro.njk +6 -6
- package/components/share-page/_macro.spec.js +9 -9
- package/components/share-page/example-share-page.njk +1 -1
- package/layout/_template.njk +5 -5
- package/package.json +1 -1
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- /package/favicons/{twitter.png → x.png} +0 -0
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
{%
|
|
9
9
|
set attributes = attributes | setAttributes({
|
|
10
10
|
"data-close-all": params.allButton.close,
|
|
11
|
+
"data-open-aria-label": params.allButton.openAriaLabel | default("Show all buttons"),
|
|
12
|
+
"data-close-aria-label": params.allButton.closeAriaLabel | default("Hide all buttons"),
|
|
11
13
|
"data-group": params.id
|
|
12
14
|
})
|
|
13
15
|
%}
|
|
@@ -202,7 +202,46 @@ describe('FOR: Macro: Accordion', () => {
|
|
|
202
202
|
expect($('button.ons-accordion__toggle-all').attr('b')).toBe('456');
|
|
203
203
|
});
|
|
204
204
|
});
|
|
205
|
+
|
|
206
|
+
describe('WHEN: openAriaLabel and closeAriaLabel are provided', () => {
|
|
207
|
+
const $ = cheerio.load(
|
|
208
|
+
renderComponent('accordion', {
|
|
209
|
+
...EXAMPLE_ACCORDION,
|
|
210
|
+
allButton: {
|
|
211
|
+
open: 'Open label',
|
|
212
|
+
close: 'Close label',
|
|
213
|
+
openAriaLabel: 'Open all sections',
|
|
214
|
+
closeAriaLabel: 'Close all sections',
|
|
215
|
+
},
|
|
216
|
+
}),
|
|
217
|
+
);
|
|
218
|
+
test('THEN: renders toggle all button with provided openAriaLabel', () => {
|
|
219
|
+
expect($('button.ons-accordion__toggle-all').attr('data-open-aria-label')).toBe('Open all sections');
|
|
220
|
+
});
|
|
221
|
+
test('THEN: renders toggle all button with provided closeAriaLabel', () => {
|
|
222
|
+
expect($('button.ons-accordion__toggle-all').attr('data-close-aria-label')).toBe('Close all sections');
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
describe('WHEN: openAriaLabel and closeAriaLabel are NOT provided', () => {
|
|
227
|
+
const $ = cheerio.load(
|
|
228
|
+
renderComponent('accordion', {
|
|
229
|
+
...EXAMPLE_ACCORDION,
|
|
230
|
+
allButton: {
|
|
231
|
+
open: 'Open label',
|
|
232
|
+
close: 'Close label',
|
|
233
|
+
},
|
|
234
|
+
}),
|
|
235
|
+
);
|
|
236
|
+
test('THEN: renders toggle all button with default openAriaLabel', () => {
|
|
237
|
+
expect($('button.ons-accordion__toggle-all').attr('data-open-aria-label')).toBe('Show all buttons');
|
|
238
|
+
});
|
|
239
|
+
test('THEN: renders toggle all button with default closeAriaLabel', () => {
|
|
240
|
+
expect($('button.ons-accordion__toggle-all').attr('data-close-aria-label')).toBe('Hide all buttons');
|
|
241
|
+
});
|
|
242
|
+
});
|
|
205
243
|
});
|
|
244
|
+
|
|
206
245
|
describe('GIVEN: Params: saveState', () => {
|
|
207
246
|
describe('WHEN: saveState param is not provided', () => {
|
|
208
247
|
const $ = cheerio.load(
|
|
@@ -55,9 +55,11 @@ export default class Accordion {
|
|
|
55
55
|
if (this.canClose()) {
|
|
56
56
|
this.buttonInner.innerHTML = DOMPurify.sanitize(this.closeButton);
|
|
57
57
|
this.button.setAttribute('data-ga-label', this.buttonOpen);
|
|
58
|
+
this.button.setAttribute('aria-label', this.button.getAttribute('data-close-aria-label'));
|
|
58
59
|
this.button.setAttribute('aria-expanded', 'true');
|
|
59
60
|
} else {
|
|
60
61
|
this.buttonInner.innerHTML = DOMPurify.sanitize(this.buttonOpen);
|
|
62
|
+
this.button.setAttribute('aria-label', this.button.getAttribute('data-open-aria-label'));
|
|
61
63
|
this.button.setAttribute('data-ga-label', this.closeButton);
|
|
62
64
|
this.button.setAttribute('aria-expanded', 'false');
|
|
63
65
|
}
|
|
@@ -5,7 +5,12 @@
|
|
|
5
5
|
"id": "accordion-example",
|
|
6
6
|
"allButton": {
|
|
7
7
|
"open": "Show all",
|
|
8
|
-
"close": "Hide all"
|
|
8
|
+
"close": "Hide all",
|
|
9
|
+
"openAriaLabel": "Show all sections",
|
|
10
|
+
"closeAriaLabel": "Hide all sections",
|
|
11
|
+
"attributes": {
|
|
12
|
+
"data-toggle-button": "accordion-toggle-all"
|
|
13
|
+
}
|
|
9
14
|
},
|
|
10
15
|
"itemsList": [
|
|
11
16
|
{
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
class ChartConstants {
|
|
2
2
|
static constants() {
|
|
3
3
|
const constants = {
|
|
4
|
-
primaryTheme: ['#206095', '#
|
|
4
|
+
primaryTheme: ['#206095', '#a8bd3a', '#871a5b', '#f66068', '#05341a', '#27a0cc'],
|
|
5
|
+
linePrimaryTheme: ['#206095', '#a8bd3a', '#871a5b', '#f66068', '#27a0cc', '#05341a'],
|
|
5
6
|
// Alternate theme colours from https://service-manual.ons.gov.uk/data-visualisation/colours/using-colours-in-charts
|
|
6
7
|
alternateTheme: ['#206095', '#27A0CC', '#871A5B', '#A8BD3A', '#F66068'],
|
|
7
8
|
labelColor: '#414042',
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
onsChart({
|
|
5
5
|
"chartType": "area",
|
|
6
6
|
"description": "Area chart showing the annual rate of inflation for the Consumer Prices Index including owner occupiers’ housing costs (CPIH) and its components.",
|
|
7
|
-
"theme": "
|
|
7
|
+
"theme": "primary",
|
|
8
8
|
"title": "Sales volumes and values saw moderate growth in July 2024",
|
|
9
9
|
"subtitle": "Figure 6: Upward contribution from housing and household services (including energy) saw the annual CPIH inflation rate rise",
|
|
10
10
|
"id": "id",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
onsChart({
|
|
5
5
|
"chartType": "column",
|
|
6
6
|
"description": "Volume sales, monthly percentage change, seasonally adjusted, Great Britain, October 2024",
|
|
7
|
-
"theme": "
|
|
7
|
+
"theme": "primary",
|
|
8
8
|
"title": "Clothing stores fell back, following three months of growth",
|
|
9
9
|
"subtitle": "Volume sales, monthly percentage change, seasonally adjusted, Great Britain, October 2024",
|
|
10
10
|
"id": "uuid",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
onsChart({
|
|
5
5
|
"chartType": "line",
|
|
6
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": "
|
|
7
|
+
"theme": "primary",
|
|
8
8
|
"title": "Sales volumes and values saw moderate growth in July 2024",
|
|
9
9
|
"subtitle": "Figure 6: Upward contribution from housing and household services (including energy) saw the annual CPIH inflation rate rise",
|
|
10
10
|
"id": "id",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
onsChart({
|
|
5
5
|
"chartType": "line",
|
|
6
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": "
|
|
7
|
+
"theme": "primary",
|
|
8
8
|
"title": "Sales volumes and values saw moderate growth in July 2024",
|
|
9
9
|
"subtitle": "Figure 6: Upward contribution from housing and household services (including energy) saw the annual CPIH inflation rate rise",
|
|
10
10
|
"id": "id",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
onsChart({
|
|
5
5
|
"chartType": "line",
|
|
6
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": "
|
|
7
|
+
"theme": "primary",
|
|
8
8
|
"title": "Sales volumes and values saw moderate growth in July 2024",
|
|
9
9
|
"subtitle": "Figure 6: Upward contribution from housing and household services (including energy) saw the annual CPIH inflation rate rise",
|
|
10
10
|
"id": "id",
|
|
@@ -38,11 +38,7 @@
|
|
|
38
38
|
'Dec 2014',
|
|
39
39
|
'Jan 2015',
|
|
40
40
|
'Feb 2015',
|
|
41
|
-
'Mar 2015'
|
|
42
|
-
'Apr 2015',
|
|
43
|
-
'May 2015',
|
|
44
|
-
'Jun 2015',
|
|
45
|
-
'Jul 2015'
|
|
41
|
+
'Mar 2015'
|
|
46
42
|
]
|
|
47
43
|
},
|
|
48
44
|
"yAxis": {
|
|
@@ -98,38 +94,6 @@
|
|
|
98
94
|
],
|
|
99
95
|
"marker": true,
|
|
100
96
|
"connectNulls": true
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
"name": 'Extra test series 3',
|
|
104
|
-
"data": [
|
|
105
|
-
5.5, 5.3, 5.4, 5.5, 5.4, 5.2, 5.1, 5.2, 5.0, 5.3
|
|
106
|
-
],
|
|
107
|
-
"marker": true,
|
|
108
|
-
"connectNulls": true
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
"name": 'Extra test series 4',
|
|
112
|
-
"data": [
|
|
113
|
-
-3.5, -3.3, -3.4, -3.5, -3.4, -3.2, -3.1, -3.2, -3.0, -3.3
|
|
114
|
-
],
|
|
115
|
-
"marker": true,
|
|
116
|
-
"connectNulls": true
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
"name": 'Extra test series 5',
|
|
120
|
-
"data": [
|
|
121
|
-
-4.5, -4.3, -4.4, -4.5, -4.4, -4.2, -4.1, -4.2, -4.0, -4.3
|
|
122
|
-
],
|
|
123
|
-
"marker": true,
|
|
124
|
-
"connectNulls": true
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
"name": 'Extra test series 6',
|
|
128
|
-
"data": [
|
|
129
|
-
-5.5, -5.3, -5.4, -5.5, -5.4, -5.2, -5.1, -5.2, -5.0, -5.3
|
|
130
|
-
],
|
|
131
|
-
"marker": true,
|
|
132
|
-
"connectNulls": true
|
|
133
97
|
}
|
|
134
98
|
],
|
|
135
99
|
"percentageHeightDesktop": 35,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
onsChart({
|
|
5
5
|
"chartType": "line",
|
|
6
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": "
|
|
7
|
+
"theme": "primary",
|
|
8
8
|
"title": "Sales volumes and values saw moderate growth in July 2024",
|
|
9
9
|
"subtitle": "Figure 6: Upward contribution from housing and household services (including energy) saw the annual CPIH inflation rate rise",
|
|
10
10
|
"id": "id",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
onsChart({
|
|
5
5
|
"chartType": "line",
|
|
6
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": "
|
|
7
|
+
"theme": "primary",
|
|
8
8
|
"title": "Sales volumes and values saw moderate growth in July 2024",
|
|
9
9
|
"subtitle": "Figure 6: Upward contribution from housing and household services (including energy) saw the annual CPIH inflation rate rise",
|
|
10
10
|
"id": "id",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
onsChart({
|
|
5
5
|
"chartType": "line",
|
|
6
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": "
|
|
7
|
+
"theme": "primary",
|
|
8
8
|
"title": "Sales volumes and values saw moderate growth in July 2024",
|
|
9
9
|
"subtitle": "Figure 6: Upward contribution from housing and household services (including energy) saw the annual CPIH inflation rate rise",
|
|
10
10
|
"id": "id",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
onsChart({
|
|
5
5
|
"chartType": "line",
|
|
6
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": "
|
|
7
|
+
"theme": "primary",
|
|
8
8
|
"title": "Sales volumes and values saw moderate growth in July 2024",
|
|
9
9
|
"subtitle": "Figure 6: Upward contribution from housing and household services (including energy) saw the annual CPIH inflation rate rise",
|
|
10
10
|
"id": "id",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
onsChart({
|
|
5
5
|
"chartType": "line",
|
|
6
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": "
|
|
7
|
+
"theme": "primary",
|
|
8
8
|
"title": "Sales volumes and values saw moderate growth in July 2024",
|
|
9
9
|
"subtitle": "Figure 6: Upward contribution from housing and household services (including energy) saw the annual CPIH inflation rate rise",
|
|
10
10
|
"id": "id",
|
|
@@ -2,66 +2,55 @@
|
|
|
2
2
|
{{
|
|
3
3
|
onsChart({
|
|
4
4
|
"chartType": "column",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "Monthly percentage change in retail sales volume by store type, Great Britain, January to June 2025",
|
|
6
6
|
"theme": "primary",
|
|
7
7
|
"title": "Food stores showed a strong rise on the month, while non-food stores fell",
|
|
8
|
-
"subtitle": "Figure 6: Upward contribution
|
|
8
|
+
"subtitle": "Figure 6: Upward contribution to monthly percentage change in total retail sales",
|
|
9
9
|
"id": "uuid",
|
|
10
10
|
"useStackedLayout": true,
|
|
11
11
|
"caption": "Source: Monthly Business Survey, Retail Sales Inquiry from the Office for National Statistics",
|
|
12
12
|
"download": {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"text": "Simple text file (CSV format, 25KB)",
|
|
21
|
-
"url": "#"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"text": "Image (PNG format, 25KB)",
|
|
25
|
-
"url": "#"
|
|
26
|
-
}
|
|
13
|
+
"title": "Download Figure 6 data",
|
|
14
|
+
"itemsList": [
|
|
15
|
+
{ "text": "Excel spreadsheet (XLSX format, 22KB)", "url": "#" },
|
|
16
|
+
{ "text": "Simple text file (CSV format, 28KB)", "url": "#" },
|
|
17
|
+
{ "text": "Image (PNG format, 32KB)", "url": "#" }
|
|
27
18
|
]
|
|
28
19
|
},
|
|
29
20
|
"legend": true,
|
|
30
21
|
"series": [
|
|
31
22
|
{
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"name": "2022"
|
|
23
|
+
"name": "Food stores",
|
|
24
|
+
"data": [1.5, 0.8, 1.2, 0.9, 1.1, 1.4]
|
|
35
25
|
},
|
|
36
26
|
{
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"name": "2023"
|
|
27
|
+
"name": "Non-food stores",
|
|
28
|
+
"data": [0.5, -0.2, 0.6, 0.8, 0.3, 0.4]
|
|
40
29
|
},
|
|
41
30
|
{
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
|
|
31
|
+
"name": "Non-store retailing",
|
|
32
|
+
"data": [0.2, 0.1, 0.3, 0.2, 0.4, 0.3]
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "Automotive fuel",
|
|
36
|
+
"data": [0.3, 0.2, -0.1, 0.4, 0.2, 0.5]
|
|
45
37
|
}
|
|
46
38
|
],
|
|
47
39
|
"xAxis": {
|
|
48
40
|
"categories": [
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"Other stores",
|
|
56
|
-
"All retailing"
|
|
41
|
+
"Jan 2025",
|
|
42
|
+
"Feb 2025",
|
|
43
|
+
"Mar 2025",
|
|
44
|
+
"Apr 2025",
|
|
45
|
+
"May 2025",
|
|
46
|
+
"Jun 2025"
|
|
57
47
|
],
|
|
58
|
-
"title": "
|
|
59
|
-
"type": "linear"
|
|
48
|
+
"title": "Month"
|
|
60
49
|
},
|
|
61
50
|
"yAxis": {
|
|
62
|
-
"title": "
|
|
51
|
+
"title": "Monthly percentage change (%)"
|
|
63
52
|
},
|
|
64
|
-
"percentageHeightDesktop":
|
|
53
|
+
"percentageHeightDesktop": 40,
|
|
65
54
|
"percentageHeightMobile": 90
|
|
66
55
|
})
|
|
67
56
|
}}
|
|
@@ -8,7 +8,12 @@ class SpecificChartOptions {
|
|
|
8
8
|
this.config = config;
|
|
9
9
|
|
|
10
10
|
this.options = {
|
|
11
|
-
colors:
|
|
11
|
+
colors:
|
|
12
|
+
this.theme === 'alternate'
|
|
13
|
+
? this.constants.alternateTheme
|
|
14
|
+
: type == 'line'
|
|
15
|
+
? this.constants.linePrimaryTheme
|
|
16
|
+
: this.constants.primaryTheme,
|
|
12
17
|
chart: {
|
|
13
18
|
type: type,
|
|
14
19
|
marginTop: this.config.legend.enabled ? (type === 'boxplot' ? 50 : undefined) : 50,
|
|
@@ -41,6 +46,16 @@ class SpecificChartOptions {
|
|
|
41
46
|
};
|
|
42
47
|
}
|
|
43
48
|
|
|
49
|
+
limitSeriesToThemeLength = () => {
|
|
50
|
+
// Get the theme array from ChartConstants based on the theme name
|
|
51
|
+
const themeArray = this.theme === 'alternate' ? this.constants.alternateTheme : this.constants.primaryTheme;
|
|
52
|
+
|
|
53
|
+
// Limit the series to the theme array length
|
|
54
|
+
if (this.config.series.length > themeArray.length) {
|
|
55
|
+
this.config.series.length = themeArray.length;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
44
59
|
getOptions = () => this.options;
|
|
45
60
|
|
|
46
61
|
getMobileOptions = (xAxisTickInterval, yAxisTickInterval) => {
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
{% if params.lang == 'cy' %}
|
|
5
5
|
{% set ariaLabel = 'Cwcis' %}
|
|
6
6
|
{% set serviceName = 'ons.gov.uk' %}
|
|
7
|
-
{% set defaultCookiesLink = '/cwics' %}
|
|
8
7
|
{% set statementTitle = 'Cwcis ar' %}
|
|
9
8
|
{% set settingsLinkText = 'Gweld cwcis' %}
|
|
10
9
|
{% set acceptButtonText = 'Derbyn cwcis ychwanegol' %}
|
|
@@ -20,7 +19,6 @@
|
|
|
20
19
|
{% else %}
|
|
21
20
|
{% set ariaLabel = 'Cookies banner' %}
|
|
22
21
|
{% set serviceName = 'ons.gov.uk' %}
|
|
23
|
-
{% set defaultCookiesLink = '/cookies' %}
|
|
24
22
|
{% set statementTitle = 'Cookies on' %}
|
|
25
23
|
{% set settingsLinkText = 'View cookies' %}
|
|
26
24
|
{% set acceptButtonText = 'Accept additional cookies' %}
|
|
@@ -36,7 +34,7 @@
|
|
|
36
34
|
{% endif %}
|
|
37
35
|
|
|
38
36
|
{% if not isDesignSystemExample %}
|
|
39
|
-
{% set settingsLinkUrl = params.settingsLinkUrl | default(
|
|
37
|
+
{% set settingsLinkUrl = params.settingsLinkUrl | default('/cookies') %}
|
|
40
38
|
{% else %}
|
|
41
39
|
{% set settingsLinkUrl = '#0' %}
|
|
42
40
|
{% endif %}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"chart": {
|
|
19
19
|
"chartType": "line",
|
|
20
20
|
"description": "Line chart showing the annual rate of inflation for the Consumer Prices Index including owner occupiers’ housing costs (CPIH) and its components.",
|
|
21
|
-
"theme": "
|
|
21
|
+
"theme": "primary",
|
|
22
22
|
"title": "Sales volumes and values saw moderate growth in July 2024",
|
|
23
23
|
"subtitle": "Figure 6: Upward contribution from housing and household services (including energy) saw the annual CPIH inflation rate rise",
|
|
24
24
|
"id": "id",
|
|
@@ -241,10 +241,10 @@
|
|
|
241
241
|
d="M32,16.0986285 C32.0009185,7.5342974 25.337417,0.468462963 16.8372092,0.0203294753 C8.33700136,-0.427804013 0.97607758,5.89865855 0.0874346352,14.4161886 C-0.801208309,22.9337186 5.09355054,30.6602611 13.5009524,31.9979281 L13.5009524,20.7518951 L9.44,20.7518951 L9.44,16.0986285 L13.5009524,16.0986285 L13.5009524,12.549267 C13.5009524,8.5169471 15.8857143,6.28613892 19.5428571,6.28613892 C20.742535,6.30277426 21.9393895,6.40782423 23.1238095,6.60044523 L23.1238095,10.5637711 L21.1047619,10.5637711 C19.1161905,10.5637711 18.4990476,11.8056643 18.4990476,13.0782216 L18.4990476,16.0986285 L22.9409524,16.0986285 L22.2247619,20.7518951 L18.4990476,20.7518951 L18.4990476,31.9979281 C26.2735701,30.760956 31.9991507,24.0182672 32,16.0986285 L32,16.0986285 Z"
|
|
242
242
|
/>
|
|
243
243
|
</svg>
|
|
244
|
-
{%- elif params.iconType == "
|
|
244
|
+
{%- elif params.iconType == "x" -%}
|
|
245
245
|
<svg
|
|
246
246
|
class="{% if params.iconSize %}ons-icon ons-icon--{{ params.iconSize }}{% else %}ons-icon{% endif %}{{ iconClasses }}"
|
|
247
|
-
id="icon-
|
|
247
|
+
id="icon-x"
|
|
248
248
|
viewBox="0 0 90.01 90.01"
|
|
249
249
|
xmlns="http://www.w3.org/2000/svg"
|
|
250
250
|
focusable="false"
|
|
@@ -22,7 +22,7 @@ describe('macro: icon', () => {
|
|
|
22
22
|
'search',
|
|
23
23
|
'sort-sprite',
|
|
24
24
|
'facebook',
|
|
25
|
-
'
|
|
25
|
+
'x',
|
|
26
26
|
'instagram',
|
|
27
27
|
'linkedin',
|
|
28
28
|
'loader',
|
|
@@ -80,7 +80,7 @@ describe('macro: icon', () => {
|
|
|
80
80
|
'quote',
|
|
81
81
|
'search',
|
|
82
82
|
'facebook',
|
|
83
|
-
'
|
|
83
|
+
'x',
|
|
84
84
|
'instagram',
|
|
85
85
|
'linkedin',
|
|
86
86
|
])('icon type: %s', (iconType) => {
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
}
|
|
22
22
|
%}
|
|
23
23
|
{% endif %}
|
|
24
|
-
{% if params.
|
|
24
|
+
{% if params.x and params.x == true %}
|
|
25
25
|
{%
|
|
26
|
-
set
|
|
26
|
+
set x =
|
|
27
27
|
{
|
|
28
|
-
"url": 'https://
|
|
29
|
-
"text": '
|
|
30
|
-
"iconType": '
|
|
28
|
+
"url": 'https://x.com/intent/tweet?original_referer&text=' ~ params.pageTitle|urlencode ~ '&url=' ~ params.pageUrl|urlencode,
|
|
29
|
+
"text": 'X',
|
|
30
|
+
"iconType": 'x',
|
|
31
31
|
"rel": 'noreferrer external',
|
|
32
32
|
"target": '_blank'
|
|
33
33
|
}
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"variants": 'inline',
|
|
39
39
|
"iconPosition": 'before',
|
|
40
40
|
"iconSize": params.iconSize | default("2xl"),
|
|
41
|
-
"itemsList": [facebook,
|
|
41
|
+
"itemsList": [facebook, x]
|
|
42
42
|
})
|
|
43
43
|
}}
|
|
44
44
|
{% endmacro %}
|
|
@@ -10,7 +10,7 @@ const EXAMPLE_SHARE_PAGE = {
|
|
|
10
10
|
pageTitle: 'An example page',
|
|
11
11
|
pageUrl: 'https://example.com/an-example-page',
|
|
12
12
|
facebook: true,
|
|
13
|
-
|
|
13
|
+
x: true,
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
describe('macro: share-page', () => {
|
|
@@ -50,16 +50,16 @@ describe('macro: share-page', () => {
|
|
|
50
50
|
expect(listsSpy.occurrences[0].iconSize).toBe('xl');
|
|
51
51
|
});
|
|
52
52
|
|
|
53
|
-
describe('Share on
|
|
53
|
+
describe('Share on X', () => {
|
|
54
54
|
it('has a link with the expected url', () => {
|
|
55
55
|
const faker = templateFaker();
|
|
56
56
|
const listsSpy = faker.spy('list');
|
|
57
57
|
|
|
58
58
|
faker.renderComponent('share-page', EXAMPLE_SHARE_PAGE);
|
|
59
59
|
|
|
60
|
-
const
|
|
61
|
-
expect(
|
|
62
|
-
'https://
|
|
60
|
+
const xItem = listsSpy.occurrences[0].itemsList.find((item) => item.text === 'X');
|
|
61
|
+
expect(xItem.url).toBe(
|
|
62
|
+
'https://x.com/intent/tweet?original_referer&text=An%20example%20page&url=https%3A%2F%2Fexample.com%2Fan-example-page',
|
|
63
63
|
);
|
|
64
64
|
});
|
|
65
65
|
|
|
@@ -69,10 +69,10 @@ describe('macro: share-page', () => {
|
|
|
69
69
|
|
|
70
70
|
faker.renderComponent('share-page', EXAMPLE_SHARE_PAGE);
|
|
71
71
|
|
|
72
|
-
const
|
|
73
|
-
expect(
|
|
74
|
-
expect(
|
|
75
|
-
expect(
|
|
72
|
+
const xItem = listsSpy.occurrences[0].itemsList.find((item) => item.text === 'X');
|
|
73
|
+
expect(xItem.rel).toContain('noreferrer');
|
|
74
|
+
expect(xItem.rel).toContain('external');
|
|
75
|
+
expect(xItem.target).toBe('_blank');
|
|
76
76
|
});
|
|
77
77
|
});
|
|
78
78
|
|
package/layout/_template.njk
CHANGED
|
@@ -103,16 +103,16 @@
|
|
|
103
103
|
|
|
104
104
|
{% if pageConfig.social %}
|
|
105
105
|
{%
|
|
106
|
-
set
|
|
107
|
-
assetsUrl + '/favicons/
|
|
106
|
+
set xImagePath = pageConfig.social.xImage if pageConfig.social.xImage else
|
|
107
|
+
assetsUrl + '/favicons/x.png'
|
|
108
108
|
%}
|
|
109
|
-
<!--
|
|
109
|
+
<!-- X -->
|
|
110
110
|
<meta name="twitter:card" content="summary" />
|
|
111
|
-
<meta name="twitter:site" content="{{ pageConfig.social.
|
|
111
|
+
<meta name="twitter:site" content="{{ pageConfig.social.xSite }}" />
|
|
112
112
|
<meta name="twitter:url" content="{{ pageConfig.meta.canonicalUrl | default(pageConfig.absoluteUrl) }}" />
|
|
113
113
|
<meta name="twitter:title" content="{{ pageConfig.social.title | default(pageConfig.title) }}" />
|
|
114
114
|
<meta name="twitter:description" content="{{ pageConfig.social.description | default(pageConfig.description) }}" />
|
|
115
|
-
<meta name="twitter:image" content="{{
|
|
115
|
+
<meta name="twitter:image" content="{{ xImagePath }}" />
|
|
116
116
|
{% endif %}
|
|
117
117
|
{% endblock %}
|
|
118
118
|
|