@ons/design-system 64.0.0 → 65.0.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 (71) hide show
  1. package/components/access-code/_macro.njk +2 -2
  2. package/components/access-code/_macro.spec.js +2 -2
  3. package/components/access-code/access-code.dom.js +11 -0
  4. package/components/access-code/{uac.js → access-code.js} +1 -1
  5. package/components/access-code/{uac.scss → access-code.scss} +1 -1
  6. package/components/access-code/example-access-code-error.njk +6 -6
  7. package/components/access-code/example-access-code.njk +4 -4
  8. package/components/accordion/_macro.njk +2 -2
  9. package/components/accordion/_macro.spec.js +3 -3
  10. package/components/accordion/accordion.dom.js +1 -1
  11. package/components/accordion/accordion.js +1 -1
  12. package/components/breadcrumbs/_breadcrumbs.scss +6 -6
  13. package/components/breadcrumbs/_macro.njk +4 -4
  14. package/components/breadcrumbs/_macro.spec.js +13 -13
  15. package/components/button/_button.scss +27 -27
  16. package/components/button/_macro.spec.js +2 -2
  17. package/components/call-to-action/_macro.njk +1 -1
  18. package/components/date-input/_macro.njk +3 -3
  19. package/components/date-input/_macro.spec.js +118 -0
  20. package/components/date-input/example-date-input-error-for-single-field.njk +63 -0
  21. package/components/details/_details.scss +1 -1
  22. package/components/external-link/_external-link.scss +3 -3
  23. package/components/external-link/_macro.njk +1 -1
  24. package/components/footer/_footer.scss +2 -2
  25. package/components/footer/example-footer-with-alternative-organisation.njk +5 -5
  26. package/components/header/_header.scss +8 -8
  27. package/components/icon/_icon.scss +1 -1
  28. package/components/icon/_macro.njk +35 -35
  29. package/components/icon/_macro.spec.js +1 -1
  30. package/components/image/_image.scss +2 -2
  31. package/components/image/_macro.njk +4 -6
  32. package/components/image/_macro.spec.js +10 -10
  33. package/components/mutually-exclusive/_macro.njk +4 -3
  34. package/components/pagination/_macro.njk +2 -2
  35. package/components/pagination/example-pagination-first.njk +0 -2
  36. package/components/pagination/example-pagination-last.njk +0 -2
  37. package/components/pagination/example-pagination-with-no-range-indicator.njk +0 -2
  38. package/components/pagination/example-pagination.njk +0 -2
  39. package/components/panel/_macro.njk +1 -1
  40. package/components/panel/_panel.scss +7 -7
  41. package/components/password/_macro.njk +1 -1
  42. package/components/password/example-password.njk +1 -2
  43. package/components/quote/_quote.scss +1 -1
  44. package/components/radios/_macro.njk +1 -1
  45. package/components/skip-to-content/_macro.njk +2 -1
  46. package/components/skip-to-content/_macro.spec.js +17 -3
  47. package/components/skip-to-content/_skip.scss +1 -1
  48. package/components/skip-to-content/skip-to-content.dom.js +1 -1
  49. package/components/skip-to-content/skip-to-content.spec.js +3 -3
  50. package/components/summary/_summary.scss +1 -1
  51. package/components/table/_table.scss +6 -6
  52. package/components/table/sortable-table.js +1 -1
  53. package/components/timeline/_macro.njk +18 -22
  54. package/components/timeline/_macro.spec.js +18 -0
  55. package/components/video/example-video.njk +1 -1
  56. package/components/video/video.js +10 -1
  57. package/components/video/video.spec.js +33 -0
  58. package/css/main.css +3 -3
  59. package/css/print.css +1 -1
  60. package/js/main.js +1 -1
  61. package/package.json +1 -1
  62. package/scripts/main.es5.js +1 -1
  63. package/scripts/main.js +1 -1
  64. package/scss/base/_global.scss +1 -1
  65. package/scss/main.scss +1 -1
  66. package/scss/objects/_spacing.scss +3 -3
  67. package/scss/overrides/hcm.scss +6 -6
  68. package/scss/overrides/rtl.scss +2 -2
  69. package/scss/print.scss +1 -1
  70. package/components/access-code/uac.dom.js +0 -11
  71. /package/components/access-code/{uac.spec.js → access-code.spec.js} +0 -0
@@ -11,6 +11,15 @@ const EXAMPLE_DATE_INPUT_BASE = {
11
11
  description: 'For example, 31 3 1980',
12
12
  };
13
13
 
14
+ const EXAMPLE_DATE_INPUT_BASE_WITH_ERROR = {
15
+ id: 'date',
16
+ legendOrLabel: 'Date of birth',
17
+ description: 'For example, 31 3 1980',
18
+ error: {
19
+ text: 'Enter a date that is after 1 January 2019',
20
+ },
21
+ };
22
+
14
23
  const EXAMPLE_DAY_FIELD = {
15
24
  day: {
16
25
  label: {
@@ -53,6 +62,66 @@ const EXAMPLE_YEAR_FIELD = {
53
62
  },
54
63
  };
55
64
 
65
+ const EXAMPLE_DAY_FIELD_WITH_ERROR = {
66
+ day: {
67
+ label: {
68
+ text: 'Day',
69
+ description: 'The day',
70
+ },
71
+ value: 'Day',
72
+ error: true,
73
+ name: 'day',
74
+ attributes: {
75
+ autocomplete: 'bday-day',
76
+ },
77
+ },
78
+ };
79
+
80
+ const EXAMPLE_MONTH_FIELD_WITH_ERROR = {
81
+ month: {
82
+ label: {
83
+ text: 'Month',
84
+ description: 'The month',
85
+ },
86
+ value: 'Month',
87
+ error: true,
88
+ name: 'month',
89
+ attributes: {
90
+ autocomplete: 'bday-month',
91
+ },
92
+ },
93
+ };
94
+
95
+ const EXAMPLE_YEAR_FIELD_WITH_ERROR = {
96
+ year: {
97
+ label: {
98
+ text: 'Year',
99
+ description: 'The year',
100
+ },
101
+ value: 'Year',
102
+ error: true,
103
+ name: 'year',
104
+ attributes: {
105
+ autocomplete: 'bday-year',
106
+ },
107
+ },
108
+ };
109
+
110
+ const EXAMPLE_YEAR_FIELD_WITH_NO_ERROR = {
111
+ year: {
112
+ label: {
113
+ text: 'Year',
114
+ description: 'The year',
115
+ },
116
+ value: 'Year',
117
+ name: 'year',
118
+ error: false,
119
+ attributes: {
120
+ autocomplete: 'bday-year',
121
+ },
122
+ },
123
+ };
124
+
56
125
  const EXAMPLE_DATE_SINGLE_FIELD = {
57
126
  ...EXAMPLE_DATE_INPUT_BASE,
58
127
  ...EXAMPLE_YEAR_FIELD,
@@ -65,6 +134,25 @@ const EXAMPLE_DATE_MULTIPLE_FIELDS = {
65
134
  ...EXAMPLE_YEAR_FIELD,
66
135
  };
67
136
 
137
+ const EXAMPLE_DATE_MULTIPLE_FIELDS_WITH_SINGLE_ERROR = {
138
+ ...EXAMPLE_DATE_INPUT_BASE_WITH_ERROR,
139
+ ...EXAMPLE_DAY_FIELD,
140
+ ...EXAMPLE_MONTH_FIELD,
141
+ ...EXAMPLE_YEAR_FIELD_WITH_ERROR,
142
+ };
143
+
144
+ const EXAMPLE_DATE_MULTIPLE_FIELDS_WITH_ERROR = {
145
+ ...EXAMPLE_DATE_INPUT_BASE_WITH_ERROR,
146
+ ...EXAMPLE_DAY_FIELD_WITH_ERROR,
147
+ ...EXAMPLE_MONTH_FIELD_WITH_ERROR,
148
+ ...EXAMPLE_YEAR_FIELD_WITH_ERROR,
149
+ };
150
+
151
+ const EXAMPLE_DATE_MULTIPLE_FIELDS_WITH_NO_ERROR = {
152
+ ...EXAMPLE_DATE_INPUT_BASE,
153
+ ...EXAMPLE_YEAR_FIELD_WITH_NO_ERROR,
154
+ };
155
+
68
156
  describe('macro: date input', () => {
69
157
  describe('mode: multiple fields', () => {
70
158
  it('passes jest-axe checks', async () => {
@@ -282,4 +370,34 @@ describe('macro: date input', () => {
282
370
  });
283
371
  });
284
372
  });
373
+
374
+ describe('mode: multiple fields with single field error', () => {
375
+ it('passes jest-axe checks', async () => {
376
+ const $ = cheerio.load(renderComponent('date-input', EXAMPLE_DATE_MULTIPLE_FIELDS_WITH_SINGLE_ERROR));
377
+
378
+ const results = await axe($.html());
379
+ expect(results).toHaveNoViolations();
380
+ });
381
+
382
+ it('has the provided error class on one input', async () => {
383
+ const $ = cheerio.load(renderComponent('date-input', EXAMPLE_DATE_MULTIPLE_FIELDS_WITH_SINGLE_ERROR));
384
+ const $errorContent = $('.ons-input--error');
385
+
386
+ expect($errorContent.length).toBe(1);
387
+ });
388
+
389
+ it('has the provided error class on multiple inputs', async () => {
390
+ const $ = cheerio.load(renderComponent('date-input', EXAMPLE_DATE_MULTIPLE_FIELDS_WITH_ERROR));
391
+ const $errorContent = $('.ons-input--error');
392
+
393
+ expect($errorContent.length).toBe(3);
394
+ });
395
+
396
+ it('does not provide error class when error parameter set to false', async () => {
397
+ const $ = cheerio.load(renderComponent('date-input', EXAMPLE_DATE_MULTIPLE_FIELDS_WITH_NO_ERROR));
398
+ const $errorContent = $('.ons-input--error');
399
+
400
+ expect($errorContent.length).toBe(0);
401
+ });
402
+ });
285
403
  });
@@ -0,0 +1,63 @@
1
+
2
+ {% from "components/date-input/_macro.njk" import onsDateInput %}
3
+ {{
4
+ onsDateInput({
5
+ "id": "period-from-date",
6
+ "legendOrLabel": "Period from:",
7
+ "description": "For example, 31 3 2019",
8
+ "day": {
9
+ "label": {
10
+ "text": "Day"
11
+ },
12
+ "name": "day",
13
+ "value": "1"
14
+ },
15
+ "month": {
16
+ "label": {
17
+ "text": "Month"
18
+ },
19
+ "name": "month",
20
+ "value": "1"
21
+ },
22
+ "year": {
23
+ "label": {
24
+ "text": "Year"
25
+ },
26
+ "name": "year",
27
+ "value": "2019"
28
+ }
29
+ })
30
+ }}
31
+
32
+ {{
33
+ onsDateInput({
34
+ "id": "period-to-date",
35
+ "legendOrLabel": "Period to:",
36
+ "description": "For example, 31 3 2020",
37
+ "day": {
38
+ "label": {
39
+ "text": "Day"
40
+ },
41
+ "name": "day",
42
+ "value": "31"
43
+ },
44
+ "month": {
45
+ "label": {
46
+ "text": "Month"
47
+ },
48
+ "name": "month",
49
+ "value": "12"
50
+ },
51
+ "year": {
52
+ "label": {
53
+ "text": "Year"
54
+ },
55
+ "name": "year",
56
+ "value": "2018",
57
+ "error": true
58
+ },
59
+ "error": {
60
+ "text": "Enter a date that is after 1 January 2019"
61
+ }
62
+ })
63
+ }}
@@ -22,7 +22,7 @@ $details-caret-width: 1.5rem;
22
22
  margin-left: -$details-caret-width;
23
23
  padding-left: $details-caret-width;
24
24
  }
25
- .ons-details__icon .ons-svg-icon {
25
+ .ons-details__icon .ons-icon {
26
26
  fill: var(--ons-color-text-link-focus);
27
27
  }
28
28
  }
@@ -3,19 +3,19 @@
3
3
  visibility: hidden;
4
4
  white-space: nowrap;
5
5
  }
6
- .ons-svg-icon {
6
+ .ons-icon {
7
7
  fill: var(--ons-color-grey-100);
8
8
  margin: 0 0 0 0.25rem;
9
9
  padding-bottom: 0.1rem;
10
10
  visibility: visible;
11
11
  }
12
12
  &:focus {
13
- .ons-svg-icon {
13
+ .ons-icon {
14
14
  fill: var(--ons-color-black);
15
15
  }
16
16
  }
17
17
  &:hover {
18
- .ons-svg-icon {
18
+ .ons-icon {
19
19
  fill: var(--ons-color-text-link-hover);
20
20
  .ons-footer & {
21
21
  fill: var(--ons-color-black);
@@ -3,7 +3,7 @@
3
3
  <a href="{{ params.url }}" class="ons-external-link{% if params.classes %} {{ params.classes }}{% endif %}" target="_blank" rel="noopener">
4
4
  <span class="ons-external-link__text">
5
5
  {{- params.linkText | safe -}}
6
- </span><span class="ons-external-link__icon">&nbsp;<svg class="ons-svg-icon" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true">
6
+ </span><span class="ons-external-link__icon">&nbsp;<svg class="ons-icon" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true">
7
7
  <path d="M13.5,9H13a.5.5,0,0,0-.5.5v3h-9v-9h3A.5.5,0,0,0,7,3V2.5A.5.5,0,0,0,6.5,2h-4a.5.5,0,0,0-.5.5v11a.5.5,0,0,0,.5.5h11a.5.5,0,0,0,.5-.5v-4A.5.5,0,0,0,13.5,9Z" transform="translate(-2 -1.99)"/>
8
8
  <path d="M8.83,7.88a.51.51,0,0,0,.71,0l2.31-2.32,1.28,1.28A.51.51,0,0,0,14,6.49v-4a.52.52,0,0,0-.5-.5h-4A.51.51,0,0,0,9,2.52a.58.58,0,0,0,.14.33l1.28,1.28L8.12,6.46a.51.51,0,0,0,0,.71Z" transform="translate(-2 -1.99)"/>
9
9
  </svg></span><span class="ons-external-link__new-window-description ons-u-vh"> ({{- params.newWindowDescription | default("opens in a new tab") -}})</span></a>
@@ -30,8 +30,8 @@
30
30
  vertical-align: middle;
31
31
  }
32
32
 
33
- .ons-svg-logo,
34
- .ons-svg-logo__group {
33
+ .ons-icon--logo,
34
+ .ons-icon--logo__group {
35
35
  fill: var(--ons-color-black) !important;
36
36
  }
37
37
 
@@ -4,18 +4,18 @@
4
4
  {% from "components/footer/_macro.njk" import onsFooter %}
5
5
  {{
6
6
  onsFooter({
7
- "poweredBy": '<svg class="ons-svg-logo ons-svg-logo--nisra" xmlns="http://www.w3.org/2000/svg" width="170" height="56" viewBox="0 1 170 54" aria-labelledby="poweredby-alt">
7
+ "poweredBy": '<svg class="ons-icon--logo ons-icon--logo--nisra" xmlns="http://www.w3.org/2000/svg" width="170" height="56" viewBox="0 1 170 54" aria-labelledby="poweredby-alt">
8
8
  <title id="poweredby-alt">NISRA - Northern Ireland Statistics and Research Agency</title>
9
- <g class="ons-svg-logo__group" fill="#3d7cc9">
9
+ <g class="ons-icon--logo__group" fill="#3d7cc9">
10
10
  <path d="M0,39.3c2.7,4.7,6.1,8.1,10.8,10.8c4.6,2.7,9.7,4,14.7,4c7,0,13.8-2.5,19.2-7.1c0.3-0.3,0.6-0.5,0.9-0.8 c2.1-2,3.9-4.2,5.5-6.9l-15.2-8.8l-1.2-0.7l-8.6-4.9l-0.6-0.4L25,24.8L6.4,35.6l-1.1,0.6L0,39.3L0,39.3z"></path>
11
11
  </g>
12
- <g class="ons-svg-logo__group" fill="#cddb00">
12
+ <g class="ons-icon--logo__group" fill="#cddb00">
13
13
  <path d="M36.4,7.2c-0.4-0.1-0.8-0.3-1.2-0.4c-2.9-0.9-5.9-1.4-9.1-1.4v18.1l9.1,5.3l1.2,0.7l15.2,8.8l1,0.6l-0.6,1 c-1.5,2.6-3.3,4.9-5.4,6.9l5,2.9c2.7-4.7,3.9-9.3,3.9-14.7C55.6,22.2,47.6,11.4,36.4,7.2L36.4,7.2z"></path>
14
14
  </g>
15
- <g class="ons-svg-logo__group" fill="#00205c">
15
+ <g class="ons-icon--logo__group" fill="#00205c">
16
16
  <path d="M6.2,34.4L25,23.5V4.2h1.2c3.1,0,6.2,0.5,9.1,1.4V0c-5.4,0-10,1.2-14.7,4C9.5,10.3,4.2,22.6,6.2,34.4z"></path>
17
17
  </g>
18
- <g class="ons-svg-logo__group ons-svg-logo__group--text" fill="#00205c">
18
+ <g class="ons-icon--logo__group ons-icon--logo__group--text" fill="#00205c">
19
19
  <path d="M94.5,48.4l-1-0.2c-0.4-0.1-0.7-0.2-0.7-0.5s0.3-0.5,0.8-0.5c0.7,0,0.8,0.4,0.8,0.5l0.9-0.2c-0.3-0.9-1.2-1.1-1.8-1.1 c-1.5,0-1.7,1-1.7,1.5c0,1.1,1,1.3,1.4,1.3l0.8,0.2c0.2,0,0.5,0.2,0.5,0.5c0,0.5-0.7,0.6-1,0.6c-0.7,0-0.9-0.3-1-0.6l-0.8,0.2 c0.2,0.7,0.9,1.1,1.9,1.1c0.6,0,2-0.2,2-1.5C95.6,49,95.2,48.5,94.5,48.4z M91.2,49c0-1.3-0.6-2.5-2.1-2.5c-1.3,0-2.1,1-2.1,2.4 c0,1.1,0.6,2.4,2.1,2.4c0.9,0,1.7-0.4,2-1.4l-0.9-0.2c-0.1,0.2-0.3,0.7-1,0.7c-0.4,0-0.7-0.1-0.9-0.4c-0.3-0.4-0.2-0.7-0.2-1H91.2z M88.3,47.7c0.2-0.3,0.5-0.4,0.8-0.4c0.4,0,0.6,0.2,0.8,0.4c0.2,0.3,0.2,0.5,0.2,0.7h-2C88.1,48.2,88.2,48,88.3,47.7z M148.6,49.6l-1.1-3h-1.1l1.6,4.3l0.1,0.3c0,0.1-0.1,0.5-0.3,0.7c-0.2,0.2-0.4,0.1-1,0.1v0.8h0.6c0.4,0,0.9-0.1,1.2-1l1.8-5.2
20
20
  h-0.8L148.6,49.6z M100.4,49c0-1.3-0.6-2.5-2.1-2.5c-1.3,0-2.1,1-2.1,2.4c0,1.1,0.6,2.4,2.1,2.4c0.9,0,1.7-0.4,2-1.4l-0.9-0.2
21
21
  c-0.1,0.2-0.3,0.7-1,0.7c-0.4,0-0.7-0.1-0.9-0.4c-0.3-0.4-0.2-0.7-0.2-1H100.4z M97.5,47.7c0.2-0.3,0.5-0.4,0.8-0.4
@@ -79,10 +79,10 @@
79
79
  &--neutral & {
80
80
  &__top {
81
81
  background: var(--ons-color-header-masthead-internal);
82
- .ons-svg-logo {
82
+ .ons-icon--logo {
83
83
  display: block;
84
- .ons-svg-logo__group--text,
85
- .ons-svg-logo__group--primary {
84
+ .ons-icon--logo__group--text,
85
+ .ons-icon--logo__group--primary {
86
86
  fill: var(--ons-color-white);
87
87
  }
88
88
  }
@@ -91,7 +91,7 @@
91
91
  background-color: transparent;
92
92
  box-shadow: none;
93
93
  outline: 3px solid var(--ons-color-focus);
94
- .ons-svg-logo {
94
+ .ons-icon--logo {
95
95
  fill: var(--ons-color-text-link-focus);
96
96
  }
97
97
  }
@@ -140,7 +140,7 @@
140
140
  }
141
141
  }
142
142
 
143
- .ons-svg-logo {
143
+ .ons-icon--logo {
144
144
  display: block;
145
145
  }
146
146
 
@@ -155,9 +155,9 @@
155
155
 
156
156
  &__org-logo-link {
157
157
  &:focus {
158
- .ons-svg-logo {
158
+ .ons-icon--logo {
159
159
  fill: var(--ons-color-black) !important;
160
- .ons-svg-logo__group {
160
+ .ons-icon--logo__group {
161
161
  fill: var(--ons-color-black) !important;
162
162
  }
163
163
  }
@@ -207,7 +207,7 @@
207
207
  &:first-child {
208
208
  margin-left: 0;
209
209
  }
210
- .ons-svg-icon {
210
+ .ons-icon {
211
211
  clip-path: circle(9px at center);
212
212
  margin-right: 0.5rem;
213
213
  }
@@ -1,4 +1,4 @@
1
- .ons-svg-icon {
1
+ .ons-icon {
2
2
  height: 1rem;
3
3
  vertical-align: middle;
4
4
  width: 1rem;