@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.
- package/README.md +9 -5
- package/components/accordion/accordion.js +3 -2
- package/components/announcement-banner/_announcement-banner.scss +24 -0
- package/components/announcement-banner/_macro.njk +33 -0
- package/components/announcement-banner/_macro.spec.js +106 -0
- package/components/announcement-banner/_test_examples.js +22 -0
- package/components/announcement-banner/example-banner-black.njk +12 -0
- package/components/announcement-banner/example-banner-red.njk +13 -0
- package/components/announcement-banner/example-banner-teal.njk +13 -0
- package/components/autosuggest/autosuggest.spec.js +2 -0
- package/components/autosuggest/autosuggest.ui.js +12 -7
- package/components/breadcrumbs/_breadcrumbs.scss +53 -0
- package/components/breadcrumbs/_macro.njk +33 -24
- package/components/breadcrumbs/_macro.spec.js +25 -0
- package/components/button/_button.scss +29 -1
- package/components/chart/_chart.scss +88 -0
- package/components/chart/_macro.njk +25 -6
- package/components/chart/_macro.spec.js +1178 -640
- package/components/chart/bar-chart.js +8 -1
- package/components/chart/chart-iframe-resize.js +2 -2
- package/components/chart/common-chart-options.js +9 -0
- package/components/chart/example-bar-chart-with-axis-min-and-max-values.njk +0 -1
- package/components/chart/example-bar-chart-with-point-range-and-reference-line-annotations.njk +4 -4
- package/components/chart/example-bar-chart.njk +0 -1
- package/components/chart/example-iframe-chart.njk +1 -1
- package/components/chart/range-annotations-options.js +1 -1
- package/components/download-resources/download-resources.spec.js +2 -0
- package/components/duration/example-duration-error-for-single-field.njk +0 -1
- package/components/duration/example-duration-error.njk +0 -1
- package/components/footer/_macro.spec.js +2 -2
- package/components/header/_macro.njk +5 -16
- package/components/header/example-header-button-and-navigation.njk +133 -0
- package/components/header/example-header-external-with-navigation-and-search.njk +1 -1
- package/components/hero/_hero.scss +17 -22
- package/components/hero/_macro.njk +1 -1
- package/components/hero/_macro.spec.js +1 -1
- package/components/hero/example-hero-dark-with-external-breadcrumbs.njk +194 -0
- package/components/hero/example-hero-default-with-external-breadcrumbs.njk +201 -0
- package/components/hero/example-hero-grey-with-external-breadcrumbs.njk +243 -0
- package/components/hero/example-hero-navy-blue-with-external-breadcrumbs.njk +200 -0
- package/components/hero/example-hero-pale-blue-with-external-breadcrumbs.njk +201 -0
- package/components/icon/_macro.njk +1 -1
- package/components/mutually-exclusive/mutually-exclusive.js +3 -1
- package/components/navigation/_macro.njk +11 -16
- package/components/navigation/_navigation.scss +24 -0
- package/components/radios/clear-radios.js +4 -2
- package/components/relationships/relationships.js +4 -2
- package/components/table/_macro.njk +107 -112
- package/components/table/_macro.spec.js +35 -44
- package/components/table/_table.scss +0 -12
- package/components/table/example-table-sortable.njk +1 -1
- package/components/tabs/example-tabs-details.njk +1 -1
- package/components/textarea/_macro.njk +1 -0
- package/components/textarea/_macro.spec.js +1 -0
- package/components/timeout-panel/timeout-panel.spec.js +1 -1
- package/components/video/video.js +2 -0
- package/css/main.css +1 -1
- package/js/timeout.js +9 -6
- package/layout/_template.njk +13 -0
- package/package.json +6 -6
- package/scripts/main.es5.js +4 -2
- package/scripts/main.js +4 -2
- package/scss/main.scss +1 -0
- package/scss/vars/_colors.scss +3 -0
- package/scss/vars/_forms.scss +11 -0
- package/components/table/example-table-scrollable.njk +0 -158
|
@@ -47,7 +47,14 @@ class BarChart {
|
|
|
47
47
|
tickWidth: 0,
|
|
48
48
|
tickLength: 0,
|
|
49
49
|
tickColor: 'transparent',
|
|
50
|
-
title: {
|
|
50
|
+
title: {
|
|
51
|
+
text: '', // Set to an empty string to hide the x-axis title for bar charts
|
|
52
|
+
textAlign: 'middle',
|
|
53
|
+
reserveSpace: false,
|
|
54
|
+
rotation: 0,
|
|
55
|
+
y: -25,
|
|
56
|
+
useHTML: true,
|
|
57
|
+
},
|
|
51
58
|
},
|
|
52
59
|
yAxis: {
|
|
53
60
|
labels: {
|
|
@@ -2,12 +2,12 @@ import pym from 'pym.js';
|
|
|
2
2
|
|
|
3
3
|
class ChartIframeResize {
|
|
4
4
|
static selector() {
|
|
5
|
-
return '.ons-chart__iframe-wrapper';
|
|
5
|
+
return '.ons-chart__iframe-wrapper iframe';
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
constructor(node) {
|
|
9
9
|
this.node = node;
|
|
10
|
-
new pym.
|
|
10
|
+
new pym.Child(this.node.getAttribute('id'), this.node.dataset.url, {
|
|
11
11
|
title: this.node.dataset.title,
|
|
12
12
|
});
|
|
13
13
|
}
|
package/components/chart/example-bar-chart-with-point-range-and-reference-line-annotations.njk
CHANGED
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
{
|
|
55
55
|
"text": "A test point annotation",
|
|
56
56
|
"point": {"x": 2, "y": 3},
|
|
57
|
-
"labelOffsetX":
|
|
58
|
-
"labelOffsetY":
|
|
57
|
+
"labelOffsetX": 50,
|
|
58
|
+
"labelOffsetY": 60
|
|
59
59
|
}
|
|
60
60
|
],
|
|
61
61
|
"rangeAnnotations": [
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"range": {"axisValue1": 5, "axisValue2": 6},
|
|
72
72
|
"axis": "y",
|
|
73
73
|
"labelOffsetX": -80,
|
|
74
|
-
"labelOffsetY":
|
|
74
|
+
"labelOffsetY": 230,
|
|
75
75
|
"labelWidth": 80
|
|
76
76
|
}
|
|
77
77
|
],
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"axis": "y",
|
|
89
89
|
"labelWidth": 100,
|
|
90
90
|
"labelOffsetX": 10,
|
|
91
|
-
"labelOffsetY":
|
|
91
|
+
"labelOffsetY": 170
|
|
92
92
|
}
|
|
93
93
|
]
|
|
94
94
|
})
|
|
@@ -27,7 +27,7 @@ may not be available in the future once Florence is decommissioned. #}
|
|
|
27
27
|
}
|
|
28
28
|
]
|
|
29
29
|
},
|
|
30
|
-
"iframeUrl": "
|
|
30
|
+
"iframeUrl": "/iframe/index.html",
|
|
31
31
|
"fallbackImageUrl": "/img/small/line-chart-screenshot.png"
|
|
32
32
|
})
|
|
33
33
|
}}
|
|
@@ -160,7 +160,7 @@ class RangeAnnotationsOptions {
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
// Create and add the connecting line
|
|
163
|
-
const line = document.createElement('
|
|
163
|
+
const line = document.createElement('tspan');
|
|
164
164
|
line.classList.add('ons-chart__connector-line');
|
|
165
165
|
line.setAttribute('data-range-annotation-line', true);
|
|
166
166
|
labelElement.appendChild(line);
|
|
@@ -432,11 +432,13 @@ describe('script: download-resources', () => {
|
|
|
432
432
|
});
|
|
433
433
|
|
|
434
434
|
describe('"Reset all filters" button', () => {
|
|
435
|
+
const { setTimeout } = require('node:timers/promises');
|
|
435
436
|
beforeEach(async () => {
|
|
436
437
|
await setTestPage('/test', RENDERED_EXAMPLE_PAGE);
|
|
437
438
|
await page.click('#general-public');
|
|
438
439
|
await page.click('#logo');
|
|
439
440
|
await page.click('.ons-js-adv-filter__reset');
|
|
441
|
+
await setTimeout(50);
|
|
440
442
|
});
|
|
441
443
|
|
|
442
444
|
it('resets state of all filter checkboxes ', async () => {
|
|
@@ -412,12 +412,12 @@ describe('macro: footer', () => {
|
|
|
412
412
|
});
|
|
413
413
|
});
|
|
414
414
|
describe('correct link for language', () => {
|
|
415
|
-
it('has the Welsh lang link when the default Welsh lang
|
|
415
|
+
it('has the Welsh lang link when the default Welsh lang ONS icon is present', () => {
|
|
416
416
|
const $ = cheerio.load(renderComponent('footer', { lang: 'cy' }));
|
|
417
417
|
|
|
418
418
|
expect($('.ons-footer__logo-link').attr('href')).toBe('https://cy.ons.gov.uk/');
|
|
419
419
|
});
|
|
420
|
-
it('has the English lang link when the default English lang
|
|
420
|
+
it('has the English lang link when the default English lang ONS icon is present', () => {
|
|
421
421
|
const $ = cheerio.load(renderComponent('footer', { lang: 'en' }));
|
|
422
422
|
|
|
423
423
|
expect($('.ons-footer__logo-link').attr('href')).toBe('https://www.ons.gov.uk/');
|
|
@@ -461,17 +461,12 @@
|
|
|
461
461
|
</div>
|
|
462
462
|
|
|
463
463
|
{% if params.button %}
|
|
464
|
-
{% if params.variants == 'neutral' %}
|
|
465
|
-
{% set buttonVariant = "ghost-dark" %}
|
|
466
|
-
{% else %}
|
|
467
|
-
{% set buttonVariant = "ghost" %}
|
|
468
|
-
{% endif %}
|
|
469
464
|
<div class="ons-grid__col ons-col-auto ons-u-flex-no-shrink">
|
|
470
465
|
{{
|
|
471
466
|
onsButton({
|
|
472
467
|
"text": params.button.text,
|
|
473
468
|
"classes": "ons-u-d-no@2xs@l" if params.navigation else "ons-u-d-no@2xs@m",
|
|
474
|
-
"variants":
|
|
469
|
+
"variants": "ghost",
|
|
475
470
|
"name": params.button.name,
|
|
476
471
|
"attributes": params.button.attributes,
|
|
477
472
|
"url": params.button.url,
|
|
@@ -482,19 +477,14 @@
|
|
|
482
477
|
</div>
|
|
483
478
|
{% endif %}
|
|
484
479
|
{% if params.navigation or params.siteSearchAutosuggest %}
|
|
485
|
-
<div class="ons-grid__col ons-col-auto ons-u-flex-no-shrink">
|
|
480
|
+
<div class="ons-grid__col ons-col-auto ons-u-flex-no-shrink ons-u-d-no@l">
|
|
486
481
|
{% if params.siteSearchAutosuggest %}
|
|
487
|
-
|
|
488
|
-
{% set buttonVariant = ["small", "ghost-dark"] %}
|
|
489
|
-
{% else %}
|
|
490
|
-
{% set buttonVariant = ["small", "ghost"] %}
|
|
491
|
-
{% endif %}
|
|
492
|
-
<span class="ons-grid ons-u-d-no@2xs@xs ons-u-ml-no ons-u-d-no@l">
|
|
482
|
+
<span class="ons-grid ons-u-ml-no ons-u-d-no@2xs@xs">
|
|
493
483
|
{{
|
|
494
484
|
onsButton({
|
|
495
485
|
"text": params.searchLinks.searchNavigationButtonText | default('Search'),
|
|
496
486
|
"classes": "ons-btn--search ons-u-ml-2xs ons-u-d-no ons-js-toggle-search",
|
|
497
|
-
"variants":
|
|
487
|
+
"variants": ["small", "ghost"],
|
|
498
488
|
"iconType": "search",
|
|
499
489
|
"iconPosition": "only",
|
|
500
490
|
"attributes": {
|
|
@@ -507,12 +497,11 @@
|
|
|
507
497
|
</span>
|
|
508
498
|
{% endif %}
|
|
509
499
|
{% if params.navigation.toggleNavigationButton %}
|
|
510
|
-
{% set buttonVariant = ["mobile", "ghost"] %}
|
|
511
500
|
{{
|
|
512
501
|
onsButton({
|
|
513
502
|
"text": params.navigation.toggleNavigationButton.text,
|
|
514
503
|
"classes": "ons-u-ml-2xs ons-u-d-no ons-js-navigation-button ons-u-d-no@l",
|
|
515
|
-
"variants":
|
|
504
|
+
"variants": ["mobile", "ghost"],
|
|
516
505
|
"attributes": {
|
|
517
506
|
"aria-label": params.navigation.toggleNavigationButton.ariaLabel | default("Toggle main menu") ,
|
|
518
507
|
"aria-controls": params.navigation.id,
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
---
|
|
2
|
+
'fullWidth': true
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
{% from "components/header/_macro.njk" import onsHeader %}
|
|
6
|
+
|
|
7
|
+
{{
|
|
8
|
+
onsHeader({
|
|
9
|
+
"title": 'ONS Service',
|
|
10
|
+
"mastheadLogoUrl": '#0',
|
|
11
|
+
"button": {
|
|
12
|
+
"text": 'Save and sign out',
|
|
13
|
+
"name": 'button-name',
|
|
14
|
+
"attributes": {
|
|
15
|
+
"a": 'b'
|
|
16
|
+
},
|
|
17
|
+
"url": '#0'
|
|
18
|
+
},
|
|
19
|
+
"navigation": {
|
|
20
|
+
"id": 'main-nav',
|
|
21
|
+
"ariaLabel": 'Main menu',
|
|
22
|
+
"currentPath": '#menu-item-3',
|
|
23
|
+
"currentPageTitle": 'Design system',
|
|
24
|
+
"itemsList": [
|
|
25
|
+
{
|
|
26
|
+
"text": 'Menu item 1',
|
|
27
|
+
"url": '#0'
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"text": 'Menu item 2',
|
|
31
|
+
"url": '#menu-item-2'
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"text": 'Menu item 3',
|
|
35
|
+
"url": '#0'
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"toggleNavigationButton": {
|
|
39
|
+
"text": 'Menu',
|
|
40
|
+
"ariaLabel": 'Toggle main menu'
|
|
41
|
+
},
|
|
42
|
+
"subNavigation": {
|
|
43
|
+
"id": 'sub-nav',
|
|
44
|
+
"overviewUrl": '#design-system',
|
|
45
|
+
"overviewText": 'Overview',
|
|
46
|
+
"ariaLabel": 'Section menu',
|
|
47
|
+
"currentPath": '#access-codes',
|
|
48
|
+
"itemsList": [
|
|
49
|
+
{
|
|
50
|
+
"text": 'Guidance',
|
|
51
|
+
"url": '#menu-item-3'
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"text": 'Foundations',
|
|
55
|
+
"url": '#0'
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"text": 'Components',
|
|
59
|
+
"url": '#0'
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"text": 'Patterns',
|
|
63
|
+
"url": '#patterns',
|
|
64
|
+
"sections": [
|
|
65
|
+
{
|
|
66
|
+
"sectionTitle": 'Ask users for...',
|
|
67
|
+
"children": [
|
|
68
|
+
{
|
|
69
|
+
"title": 'Access codes',
|
|
70
|
+
"url": '#access-codes'
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"title": 'Addresses',
|
|
74
|
+
"url": '#0'
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"title": 'Dates',
|
|
78
|
+
"url": '#0'
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"title": 'Durations',
|
|
82
|
+
"url": '#0'
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"title": 'Email addresses',
|
|
86
|
+
"url": '#0'
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"title": 'Numeric values',
|
|
90
|
+
"url": '#0'
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"title": 'Phone numbers',
|
|
94
|
+
"url": '#0'
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"sectionTitle": 'Help users to...',
|
|
100
|
+
"children": [
|
|
101
|
+
{
|
|
102
|
+
"title": 'Access support in multiple languages',
|
|
103
|
+
"url": '#0'
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"title": 'Change language',
|
|
107
|
+
"url": '#0'
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"title": 'Check answers',
|
|
111
|
+
"url": '#0'
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"title": 'Control cookies',
|
|
115
|
+
"url": '#0'
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"title": 'Correct errors',
|
|
119
|
+
"url": '#0'
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"title": 'Extend a session',
|
|
123
|
+
"url": '#0'
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
})
|
|
133
|
+
}}
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
42
|
"siteSearchAutosuggest": {
|
|
43
|
-
"autosuggestData":
|
|
43
|
+
"autosuggestData": "/examples/data/country-of-birth.json",
|
|
44
44
|
"label": "search",
|
|
45
45
|
"instructions": "instructions",
|
|
46
46
|
"ariaYouHaveSelected": "ariaYouHaveSelected",
|
|
@@ -88,7 +88,8 @@
|
|
|
88
88
|
@extend .ons-u-mb-no;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
&--dark
|
|
91
|
+
&--dark &,
|
|
92
|
+
&--navy-blue & {
|
|
92
93
|
&__details {
|
|
93
94
|
color: var(--ons-color-text-inverse);
|
|
94
95
|
|
|
@@ -97,10 +98,16 @@
|
|
|
97
98
|
}
|
|
98
99
|
|
|
99
100
|
a:hover {
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
text-decoration: underline solid var(--ons-color-text-inverse-link-hover) 2px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
a:focus {
|
|
105
|
+
color: var(--ons-color-text);
|
|
102
106
|
}
|
|
103
107
|
|
|
108
|
+
a:focus:hover {
|
|
109
|
+
text-decoration: none;
|
|
110
|
+
}
|
|
104
111
|
.ons-details__heading {
|
|
105
112
|
color: inherit;
|
|
106
113
|
}
|
|
@@ -129,7 +136,7 @@
|
|
|
129
136
|
height: 59px;
|
|
130
137
|
position: absolute;
|
|
131
138
|
right: 289px;
|
|
132
|
-
top:
|
|
139
|
+
top: 58px;
|
|
133
140
|
width: 59px;
|
|
134
141
|
}
|
|
135
142
|
}
|
|
@@ -141,7 +148,7 @@
|
|
|
141
148
|
position: absolute;
|
|
142
149
|
height: 30px;
|
|
143
150
|
right: 193px;
|
|
144
|
-
top:
|
|
151
|
+
top: 65px;
|
|
145
152
|
width: 30px;
|
|
146
153
|
}
|
|
147
154
|
}
|
|
@@ -150,7 +157,7 @@
|
|
|
150
157
|
@include mq(l) {
|
|
151
158
|
height: 60px;
|
|
152
159
|
right: 112px;
|
|
153
|
-
top:
|
|
160
|
+
top: 75px;
|
|
154
161
|
width: 60px;
|
|
155
162
|
background-color: var(--ons-color-white);
|
|
156
163
|
border-radius: 50%;
|
|
@@ -165,7 +172,7 @@
|
|
|
165
172
|
height: 60px;
|
|
166
173
|
position: absolute;
|
|
167
174
|
right: 208px;
|
|
168
|
-
top:
|
|
175
|
+
top: 130px;
|
|
169
176
|
width: 60px;
|
|
170
177
|
}
|
|
171
178
|
|
|
@@ -191,7 +198,7 @@
|
|
|
191
198
|
height: 14px;
|
|
192
199
|
position: absolute;
|
|
193
200
|
right: 222px;
|
|
194
|
-
top:
|
|
201
|
+
top: 237px;
|
|
195
202
|
width: 14px;
|
|
196
203
|
}
|
|
197
204
|
|
|
@@ -217,7 +224,7 @@
|
|
|
217
224
|
height: 15px;
|
|
218
225
|
position: absolute;
|
|
219
226
|
right: 135px;
|
|
220
|
-
top:
|
|
227
|
+
top: 238px;
|
|
221
228
|
width: 15px;
|
|
222
229
|
}
|
|
223
230
|
}
|
|
@@ -342,18 +349,6 @@
|
|
|
342
349
|
}
|
|
343
350
|
|
|
344
351
|
&__circle-1 {
|
|
345
|
-
@include mq(l) {
|
|
346
|
-
background-color: var(--ons-color-soft-blue-grey);
|
|
347
|
-
border-radius: 50%;
|
|
348
|
-
height: 440px;
|
|
349
|
-
position: absolute;
|
|
350
|
-
right: 59px;
|
|
351
|
-
top: -339px;
|
|
352
|
-
width: 440px;
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
&__circle-2 {
|
|
357
352
|
background-color: var(--ons-color-light-orange);
|
|
358
353
|
border-radius: 50%;
|
|
359
354
|
bottom: 4%;
|
|
@@ -379,7 +374,7 @@
|
|
|
379
374
|
}
|
|
380
375
|
}
|
|
381
376
|
|
|
382
|
-
&__circle-
|
|
377
|
+
&__circle-2 {
|
|
383
378
|
background-color: var(--ons-color-ocean-blue);
|
|
384
379
|
border-radius: 50%;
|
|
385
380
|
bottom: 7%;
|
|
@@ -109,7 +109,7 @@ describe('macro: hero', () => {
|
|
|
109
109
|
const $ = cheerio.load(renderComponent('hero', { ...EXAMPLE_HERO, variants: 'grey', officialStatisticsBadge: true }));
|
|
110
110
|
|
|
111
111
|
expect($('.ons-hero__badge').length).toBe(1);
|
|
112
|
-
expect($('.ons-hero__badge svg title').text().trim()).toBe('Official Statistics Badge');
|
|
112
|
+
expect($('.ons-hero__badge svg title').text().trim()).toBe('Official Statistics Badge - Accredited');
|
|
113
113
|
});
|
|
114
114
|
|
|
115
115
|
it('outputs the statistics badge as a link when officialStatisticsBadgeUrl is provided', () => {
|