@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.
Files changed (66) hide show
  1. package/README.md +9 -5
  2. package/components/accordion/accordion.js +3 -2
  3. package/components/announcement-banner/_announcement-banner.scss +24 -0
  4. package/components/announcement-banner/_macro.njk +33 -0
  5. package/components/announcement-banner/_macro.spec.js +106 -0
  6. package/components/announcement-banner/_test_examples.js +22 -0
  7. package/components/announcement-banner/example-banner-black.njk +12 -0
  8. package/components/announcement-banner/example-banner-red.njk +13 -0
  9. package/components/announcement-banner/example-banner-teal.njk +13 -0
  10. package/components/autosuggest/autosuggest.spec.js +2 -0
  11. package/components/autosuggest/autosuggest.ui.js +12 -7
  12. package/components/breadcrumbs/_breadcrumbs.scss +53 -0
  13. package/components/breadcrumbs/_macro.njk +33 -24
  14. package/components/breadcrumbs/_macro.spec.js +25 -0
  15. package/components/button/_button.scss +29 -1
  16. package/components/chart/_chart.scss +88 -0
  17. package/components/chart/_macro.njk +25 -6
  18. package/components/chart/_macro.spec.js +1178 -640
  19. package/components/chart/bar-chart.js +8 -1
  20. package/components/chart/chart-iframe-resize.js +2 -2
  21. package/components/chart/common-chart-options.js +9 -0
  22. package/components/chart/example-bar-chart-with-axis-min-and-max-values.njk +0 -1
  23. package/components/chart/example-bar-chart-with-point-range-and-reference-line-annotations.njk +4 -4
  24. package/components/chart/example-bar-chart.njk +0 -1
  25. package/components/chart/example-iframe-chart.njk +1 -1
  26. package/components/chart/range-annotations-options.js +1 -1
  27. package/components/download-resources/download-resources.spec.js +2 -0
  28. package/components/duration/example-duration-error-for-single-field.njk +0 -1
  29. package/components/duration/example-duration-error.njk +0 -1
  30. package/components/footer/_macro.spec.js +2 -2
  31. package/components/header/_macro.njk +5 -16
  32. package/components/header/example-header-button-and-navigation.njk +133 -0
  33. package/components/header/example-header-external-with-navigation-and-search.njk +1 -1
  34. package/components/hero/_hero.scss +17 -22
  35. package/components/hero/_macro.njk +1 -1
  36. package/components/hero/_macro.spec.js +1 -1
  37. package/components/hero/example-hero-dark-with-external-breadcrumbs.njk +194 -0
  38. package/components/hero/example-hero-default-with-external-breadcrumbs.njk +201 -0
  39. package/components/hero/example-hero-grey-with-external-breadcrumbs.njk +243 -0
  40. package/components/hero/example-hero-navy-blue-with-external-breadcrumbs.njk +200 -0
  41. package/components/hero/example-hero-pale-blue-with-external-breadcrumbs.njk +201 -0
  42. package/components/icon/_macro.njk +1 -1
  43. package/components/mutually-exclusive/mutually-exclusive.js +3 -1
  44. package/components/navigation/_macro.njk +11 -16
  45. package/components/navigation/_navigation.scss +24 -0
  46. package/components/radios/clear-radios.js +4 -2
  47. package/components/relationships/relationships.js +4 -2
  48. package/components/table/_macro.njk +107 -112
  49. package/components/table/_macro.spec.js +35 -44
  50. package/components/table/_table.scss +0 -12
  51. package/components/table/example-table-sortable.njk +1 -1
  52. package/components/tabs/example-tabs-details.njk +1 -1
  53. package/components/textarea/_macro.njk +1 -0
  54. package/components/textarea/_macro.spec.js +1 -0
  55. package/components/timeout-panel/timeout-panel.spec.js +1 -1
  56. package/components/video/video.js +2 -0
  57. package/css/main.css +1 -1
  58. package/js/timeout.js +9 -6
  59. package/layout/_template.njk +13 -0
  60. package/package.json +6 -6
  61. package/scripts/main.es5.js +4 -2
  62. package/scripts/main.js +4 -2
  63. package/scss/main.scss +1 -0
  64. package/scss/vars/_colors.scss +3 -0
  65. package/scss/vars/_forms.scss +11 -0
  66. 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: { align: 'high', textAlign: 'middle', reserveSpace: false, rotation: 0, y: -25, useHTML: true },
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.Parent(this.node.getAttribute('id'), this.node.dataset.url, {
10
+ new pym.Child(this.node.getAttribute('id'), this.node.dataset.url, {
11
11
  title: this.node.dataset.title,
12
12
  });
13
13
  }
@@ -57,6 +57,15 @@ class CommonChartOptions {
57
57
  },
58
58
  accessibility: {
59
59
  enabled: true,
60
+ keyboardNavigation: {
61
+ focusBorder: {
62
+ enabled: false,
63
+ },
64
+ enabled: true,
65
+ seriesNavigation: {
66
+ mode: 'serialize',
67
+ },
68
+ },
60
69
  },
61
70
  yAxis: {
62
71
  labels: {
@@ -38,7 +38,6 @@
38
38
  "Non-store retailing",
39
39
  "Automotive fuel"
40
40
  ],
41
- "title": "Retailing",
42
41
  "type": "linear"
43
42
  },
44
43
  "yAxis": {
@@ -54,8 +54,8 @@
54
54
  {
55
55
  "text": "A test point annotation",
56
56
  "point": {"x": 2, "y": 3},
57
- "labelOffsetX": 40,
58
- "labelOffsetY": -30
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": 220,
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": 140
91
+ "labelOffsetY": 170
92
92
  }
93
93
  ]
94
94
  })
@@ -42,7 +42,6 @@
42
42
  "Non-store retailing",
43
43
  "Automotive fuel"
44
44
  ],
45
- "title": "Retailing",
46
45
  "type": "linear"
47
46
  },
48
47
  "yAxis": {
@@ -27,7 +27,7 @@ may not be available in the future once Florence is decommissioned. #}
27
27
  }
28
28
  ]
29
29
  },
30
- "iframeUrl": "https://www.ons.gov.uk/visualisations/dvc3294/fig01/index.html",
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('div');
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 () => {
@@ -1,4 +1,3 @@
1
- {% from "components/question/_macro.njk" import onsQuestion %}
2
1
  {% from "components/duration/_macro.njk" import onsDuration %}
3
2
 
4
3
  {{
@@ -1,4 +1,3 @@
1
- {% from "components/question/_macro.njk" import onsQuestion %}
2
1
  {% from "components/duration/_macro.njk" import onsDuration %}
3
2
 
4
3
  {{
@@ -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 ons icon is present', () => {
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 ons icon is present', () => {
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": buttonVariant,
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
- {% if params.variants == 'neutral' %}
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": buttonVariant,
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": buttonVariant,
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": "/examples/data/country-of-birth.json",
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
- color: var(--ons-color-text-inverse-link-hover);
101
- text-decoration-thickness: 2px;
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: -11px;
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: 11px;
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: 25px;
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: 80px;
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: 187px;
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: 188px;
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-3 {
377
+ &__circle-2 {
383
378
  background-color: var(--ons-color-ocean-blue);
384
379
  border-radius: 50%;
385
380
  bottom: 7%;
@@ -16,7 +16,7 @@
16
16
  </div>
17
17
  {% elif params.variants == 'pale-blue' %}
18
18
  <div class="ons-hero__circles" aria-hidden="true">
19
- {% for i in range(1, 4) %}
19
+ {% for i in range(1, 3) %}
20
20
  <div class="ons-hero__circle-{{ i }}"></div>
21
21
  {% endfor %}
22
22
  </div>
@@ -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', () => {