@ons/design-system 63.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.
- package/components/access-code/_macro.njk +2 -2
- package/components/access-code/_macro.spec.js +2 -2
- package/components/access-code/access-code.dom.js +11 -0
- package/components/access-code/{uac.js → access-code.js} +1 -1
- package/components/access-code/{uac.scss → access-code.scss} +1 -1
- package/components/access-code/example-access-code-error.njk +6 -6
- package/components/access-code/example-access-code.njk +4 -4
- package/components/accordion/_macro.njk +2 -2
- package/components/accordion/_macro.spec.js +3 -3
- package/components/accordion/accordion.dom.js +1 -1
- package/components/accordion/accordion.js +1 -1
- package/components/breadcrumbs/_breadcrumbs.scss +6 -6
- package/components/breadcrumbs/_macro.njk +4 -4
- package/components/breadcrumbs/_macro.spec.js +13 -13
- package/components/button/_button.scss +27 -27
- package/components/button/_macro.spec.js +2 -2
- package/components/call-to-action/_macro.njk +1 -1
- package/components/char-check-limit/_macro.njk +1 -1
- package/components/char-check-limit/_macro.spec.js +1 -1
- package/components/char-check-limit/character-check.spec.js +16 -16
- package/components/checkboxes/_macro.njk +3 -1
- package/components/checkboxes/example-checkboxes-with-descriptions.njk +1 -0
- package/components/cookies-banner/_macro.njk +2 -2
- package/components/cookies-banner/_macro.spec.js +2 -2
- package/components/date-input/_macro.njk +3 -3
- package/components/date-input/_macro.spec.js +118 -0
- package/components/date-input/example-date-input-error-for-single-field.njk +63 -0
- package/components/details/_details.scss +1 -1
- package/components/external-link/_external-link.scss +3 -3
- package/components/external-link/_macro.njk +1 -1
- package/components/footer/_footer.scss +2 -2
- package/components/footer/example-footer-with-alternative-organisation.njk +5 -5
- package/components/header/_header.scss +8 -8
- package/components/icon/_icon.scss +1 -1
- package/components/icon/_macro.njk +35 -35
- package/components/icon/_macro.spec.js +1 -1
- package/components/image/_image.scss +2 -2
- package/components/image/_macro.njk +4 -6
- package/components/image/_macro.spec.js +10 -10
- package/components/input/_input.scss +6 -0
- package/components/input/_macro.njk +20 -13
- package/components/input/_macro.spec.js +2 -22
- package/components/{search/example-search-with-character-check.njk → input/example-input-search-with-character-check.njk} +1 -2
- package/components/{search/example-search-with-placeholder.njk → input/example-input-search-with-placeholder.njk} +1 -2
- package/components/{search/example-search.njk → input/example-input-search.njk} +1 -2
- package/components/mutually-exclusive/_macro.njk +4 -3
- package/components/mutually-exclusive/mutually-exclusive.textarea.spec.js +1 -1
- package/components/pagination/_macro.njk +2 -2
- package/components/pagination/example-pagination-first.njk +0 -2
- package/components/pagination/example-pagination-last.njk +0 -2
- package/components/pagination/example-pagination-with-no-range-indicator.njk +0 -2
- package/components/pagination/example-pagination.njk +0 -2
- package/components/panel/_macro.njk +1 -1
- package/components/panel/_panel.scss +7 -7
- package/components/password/_macro.njk +1 -1
- package/components/password/example-password.njk +1 -2
- package/components/quote/_quote.scss +1 -1
- package/components/radios/_macro.njk +1 -1
- package/components/select/_macro.njk +1 -2
- package/components/skip-to-content/_macro.njk +2 -1
- package/components/skip-to-content/_macro.spec.js +17 -3
- package/components/skip-to-content/_skip.scss +1 -1
- package/components/skip-to-content/skip-to-content.dom.js +1 -1
- package/components/skip-to-content/skip-to-content.spec.js +3 -3
- package/components/summary/_macro.njk +1 -2
- package/components/summary/_macro.spec.js +7 -22
- package/components/summary/_summary.scss +1 -1
- package/components/summary/example-summary-grouped-total.njk +0 -2
- package/components/summary/example-summary-grouped-with-errors.njk +0 -4
- package/components/summary/example-summary-grouped.njk +0 -19
- package/components/summary/example-summary-household.njk +0 -5
- package/components/summary/example-summary-hub.njk +0 -8
- package/components/summary/example-summary-multiple.njk +0 -4
- package/components/summary/example-summary.njk +0 -4
- package/components/table/_macro.njk +1 -1
- package/components/table/_macro.spec.js +16 -0
- package/components/table/_table.scss +6 -6
- package/components/table/example-table-numeric.njk +6 -3
- package/components/table/sortable-table.js +1 -1
- package/components/tabs/_macro.njk +4 -3
- package/components/tabs/_macro.spec.js +23 -0
- package/components/tabs/_tabs.scss +11 -15
- package/components/tabs/example-tabs.njk +6 -6
- package/components/tabs/tabs.js +24 -8
- package/components/tabs/tabs.spec.js +40 -2
- package/components/textarea/_macro.njk +2 -2
- package/components/textarea/_macro.spec.js +2 -2
- package/components/textarea/textarea.spec.js +6 -10
- package/components/timeline/_macro.njk +18 -22
- package/components/timeline/_macro.spec.js +18 -0
- package/components/video/example-video.njk +1 -1
- package/components/video/video.js +10 -1
- package/components/video/video.spec.js +33 -0
- package/css/main.css +3 -3
- package/css/print.css +1 -1
- package/js/main.js +1 -1
- package/package.json +1 -1
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- package/scss/base/_global.scss +1 -1
- package/scss/main.scss +1 -2
- package/scss/objects/_spacing.scss +3 -3
- package/scss/overrides/hcm.scss +6 -6
- package/scss/overrides/rtl.scss +2 -2
- package/scss/print.scss +1 -1
- package/components/access-code/uac.dom.js +0 -11
- package/components/search/_macro.njk +0 -30
- package/components/search/_macro.spec.js +0 -69
- package/components/search/_search.scss +0 -9
- /package/components/access-code/{uac.spec.js → access-code.spec.js} +0 -0
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
"actions": [
|
|
24
24
|
{
|
|
25
25
|
"text": "Change",
|
|
26
|
-
"ariaLabel": "Change answer",
|
|
27
26
|
"url": "#0"
|
|
28
27
|
}
|
|
29
28
|
]
|
|
@@ -42,7 +41,6 @@
|
|
|
42
41
|
"actions": [
|
|
43
42
|
{
|
|
44
43
|
"text": "Change",
|
|
45
|
-
"ariaLabel": "Change answer",
|
|
46
44
|
"url": "#0"
|
|
47
45
|
}
|
|
48
46
|
]
|
|
@@ -61,7 +59,6 @@
|
|
|
61
59
|
"actions": [
|
|
62
60
|
{
|
|
63
61
|
"text": "Change",
|
|
64
|
-
"ariaLabel": "Change answer",
|
|
65
62
|
"url": "#0"
|
|
66
63
|
}
|
|
67
64
|
]
|
|
@@ -85,7 +82,6 @@
|
|
|
85
82
|
"actions": [
|
|
86
83
|
{
|
|
87
84
|
"text": "Change",
|
|
88
|
-
"ariaLabel": "Change answer",
|
|
89
85
|
"url": "#0"
|
|
90
86
|
}
|
|
91
87
|
]
|
|
@@ -104,7 +100,6 @@
|
|
|
104
100
|
"actions": [
|
|
105
101
|
{
|
|
106
102
|
"text": "Change",
|
|
107
|
-
"ariaLabel": "Change answer",
|
|
108
103
|
"url": "#0"
|
|
109
104
|
}
|
|
110
105
|
]
|
|
@@ -128,7 +123,6 @@
|
|
|
128
123
|
"actions": [
|
|
129
124
|
{
|
|
130
125
|
"text": "Change",
|
|
131
|
-
"ariaLabel": "Change answer",
|
|
132
126
|
"url": "#0"
|
|
133
127
|
}
|
|
134
128
|
]
|
|
@@ -147,7 +141,6 @@
|
|
|
147
141
|
"actions": [
|
|
148
142
|
{
|
|
149
143
|
"text": "Change",
|
|
150
|
-
"ariaLabel": "Change answer",
|
|
151
144
|
"url": "#0"
|
|
152
145
|
}
|
|
153
146
|
]
|
|
@@ -171,12 +164,10 @@
|
|
|
171
164
|
"actions": [
|
|
172
165
|
{
|
|
173
166
|
"text": "Change",
|
|
174
|
-
"ariaLabel": "Change answer",
|
|
175
167
|
"url": "#0"
|
|
176
168
|
},
|
|
177
169
|
{
|
|
178
170
|
"text": "Remove",
|
|
179
|
-
"ariaLabel": "Remove company",
|
|
180
171
|
"url": "#0"
|
|
181
172
|
}
|
|
182
173
|
]
|
|
@@ -191,7 +182,6 @@
|
|
|
191
182
|
"actions": [
|
|
192
183
|
{
|
|
193
184
|
"text": "Change",
|
|
194
|
-
"ariaLabel": "Change answer",
|
|
195
185
|
"url": "#0"
|
|
196
186
|
}
|
|
197
187
|
]
|
|
@@ -206,7 +196,6 @@
|
|
|
206
196
|
"actions": [
|
|
207
197
|
{
|
|
208
198
|
"text": "Change",
|
|
209
|
-
"ariaLabel": "Change answer",
|
|
210
199
|
"url": "#0"
|
|
211
200
|
}
|
|
212
201
|
]
|
|
@@ -225,12 +214,10 @@
|
|
|
225
214
|
"actions": [
|
|
226
215
|
{
|
|
227
216
|
"text": "Change",
|
|
228
|
-
"ariaLabel": "Change answer",
|
|
229
217
|
"url": "#0"
|
|
230
218
|
},
|
|
231
219
|
{
|
|
232
220
|
"text": "Remove",
|
|
233
|
-
"ariaLabel": "Remove company",
|
|
234
221
|
"url": "#0"
|
|
235
222
|
}
|
|
236
223
|
]
|
|
@@ -245,7 +232,6 @@
|
|
|
245
232
|
"actions": [
|
|
246
233
|
{
|
|
247
234
|
"text": "Change",
|
|
248
|
-
"ariaLabel": "Change answer",
|
|
249
235
|
"url": "#0"
|
|
250
236
|
}
|
|
251
237
|
]
|
|
@@ -260,7 +246,6 @@
|
|
|
260
246
|
"actions": [
|
|
261
247
|
{
|
|
262
248
|
"text": "Change",
|
|
263
|
-
"ariaLabel": "Change answer",
|
|
264
249
|
"url": "#0"
|
|
265
250
|
}
|
|
266
251
|
]
|
|
@@ -292,7 +277,6 @@
|
|
|
292
277
|
"actions": [
|
|
293
278
|
{
|
|
294
279
|
"text": "Change",
|
|
295
|
-
"ariaLabel": "Change answer",
|
|
296
280
|
"url": "#0"
|
|
297
281
|
}
|
|
298
282
|
]
|
|
@@ -307,7 +291,6 @@
|
|
|
307
291
|
"actions": [
|
|
308
292
|
{
|
|
309
293
|
"text": "Change",
|
|
310
|
-
"ariaLabel": "Change answer",
|
|
311
294
|
"url": "#0"
|
|
312
295
|
}
|
|
313
296
|
]
|
|
@@ -322,7 +305,6 @@
|
|
|
322
305
|
"actions": [
|
|
323
306
|
{
|
|
324
307
|
"text": "Change",
|
|
325
|
-
"ariaLabel": "Change answer",
|
|
326
308
|
"url": "#0"
|
|
327
309
|
}
|
|
328
310
|
]
|
|
@@ -337,7 +319,6 @@
|
|
|
337
319
|
"actions": [
|
|
338
320
|
{
|
|
339
321
|
"text": "Change",
|
|
340
|
-
"ariaLabel": "Change answer",
|
|
341
322
|
"url": "#0"
|
|
342
323
|
}
|
|
343
324
|
]
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
"actions": [
|
|
16
16
|
{
|
|
17
17
|
"text": "Change",
|
|
18
|
-
"ariaLabel": "Change details for Joe Bloggs",
|
|
19
18
|
"url": "#0"
|
|
20
19
|
}
|
|
21
20
|
]
|
|
@@ -30,12 +29,10 @@
|
|
|
30
29
|
"actions": [
|
|
31
30
|
{
|
|
32
31
|
"text": "Change",
|
|
33
|
-
"ariaLabel": "Change details for Barry Scott",
|
|
34
32
|
"url": "#0"
|
|
35
33
|
},
|
|
36
34
|
{
|
|
37
35
|
"text": "Remove",
|
|
38
|
-
"ariaLabel": "Remove Barry Scott",
|
|
39
36
|
"url": "#0"
|
|
40
37
|
}
|
|
41
38
|
]
|
|
@@ -50,12 +47,10 @@
|
|
|
50
47
|
"actions": [
|
|
51
48
|
{
|
|
52
49
|
"text": "Change",
|
|
53
|
-
"ariaLabel": "Change details for Susan Gill",
|
|
54
50
|
"url": "#0"
|
|
55
51
|
},
|
|
56
52
|
{
|
|
57
53
|
"text": "Remove",
|
|
58
|
-
"ariaLabel": "Remove Susan Gill",
|
|
59
54
|
"url": "#0"
|
|
60
55
|
}
|
|
61
56
|
]
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
"actions": [
|
|
21
21
|
{
|
|
22
22
|
"text": "View answers",
|
|
23
|
-
"ariaLabel": "View answers for People who live here",
|
|
24
23
|
"url": "#0"
|
|
25
24
|
}
|
|
26
25
|
]
|
|
@@ -40,7 +39,6 @@
|
|
|
40
39
|
"actions": [
|
|
41
40
|
{
|
|
42
41
|
"text": "View answers",
|
|
43
|
-
"ariaLabel": "View answers for Accommodation",
|
|
44
42
|
"url": "#0"
|
|
45
43
|
}
|
|
46
44
|
]
|
|
@@ -60,7 +58,6 @@
|
|
|
60
58
|
"actions": [
|
|
61
59
|
{
|
|
62
60
|
"text": "View answers",
|
|
63
|
-
"ariaLabel": "View answers for Mary Smith",
|
|
64
61
|
"url": "#0"
|
|
65
62
|
}
|
|
66
63
|
]
|
|
@@ -79,7 +76,6 @@
|
|
|
79
76
|
"actions": [
|
|
80
77
|
{
|
|
81
78
|
"text": "Continue with section",
|
|
82
|
-
"ariaLabel": "Continue with John Smith's section",
|
|
83
79
|
"url": "#0"
|
|
84
80
|
}
|
|
85
81
|
]
|
|
@@ -98,7 +94,6 @@
|
|
|
98
94
|
"actions": [
|
|
99
95
|
{
|
|
100
96
|
"text": "Start section",
|
|
101
|
-
"ariaLabel": "Start Billy Smith's section",
|
|
102
97
|
"url": "#0"
|
|
103
98
|
}
|
|
104
99
|
]
|
|
@@ -117,7 +112,6 @@
|
|
|
117
112
|
"actions": [
|
|
118
113
|
{
|
|
119
114
|
"text": "Start section",
|
|
120
|
-
"ariaLabel": "Start Sally Smith's section",
|
|
121
115
|
"url": "#0"
|
|
122
116
|
}
|
|
123
117
|
]
|
|
@@ -136,7 +130,6 @@
|
|
|
136
130
|
"actions": [
|
|
137
131
|
{
|
|
138
132
|
"text": "Start section",
|
|
139
|
-
"ariaLabel": "Start Wilhelmina Susannah Clementine-Smith's section",
|
|
140
133
|
"url": "#0"
|
|
141
134
|
}
|
|
142
135
|
]
|
|
@@ -155,7 +148,6 @@
|
|
|
155
148
|
"actions": [
|
|
156
149
|
{
|
|
157
150
|
"text": "Start section",
|
|
158
|
-
"ariaLabel": "Start Vera Jones's section",
|
|
159
151
|
"url": "#0"
|
|
160
152
|
}
|
|
161
153
|
]
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
"actions": [
|
|
21
21
|
{
|
|
22
22
|
"text": "Change",
|
|
23
|
-
"ariaLabel": "Change answer",
|
|
24
23
|
"url": "#0"
|
|
25
24
|
}
|
|
26
25
|
]
|
|
@@ -35,7 +34,6 @@
|
|
|
35
34
|
"actions": [
|
|
36
35
|
{
|
|
37
36
|
"text": "Change",
|
|
38
|
-
"ariaLabel": "Change answer",
|
|
39
37
|
"url": "#0"
|
|
40
38
|
}
|
|
41
39
|
]
|
|
@@ -50,7 +48,6 @@
|
|
|
50
48
|
"actions": [
|
|
51
49
|
{
|
|
52
50
|
"text": "Change",
|
|
53
|
-
"ariaLabel": "Change answer",
|
|
54
51
|
"url": "#0"
|
|
55
52
|
}
|
|
56
53
|
]
|
|
@@ -65,7 +62,6 @@
|
|
|
65
62
|
"actions": [
|
|
66
63
|
{
|
|
67
64
|
"text": "Change",
|
|
68
|
-
"ariaLabel": "Change answer",
|
|
69
65
|
"url": "#0"
|
|
70
66
|
}
|
|
71
67
|
]
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
"actions": [
|
|
25
25
|
{
|
|
26
26
|
"text": "Change",
|
|
27
|
-
"ariaLabel": "Change answer",
|
|
28
27
|
"url": "#0"
|
|
29
28
|
}
|
|
30
29
|
]
|
|
@@ -45,7 +44,6 @@
|
|
|
45
44
|
"actions": [
|
|
46
45
|
{
|
|
47
46
|
"text": "Change",
|
|
48
|
-
"ariaLabel": "Change answer",
|
|
49
47
|
"url": "#0"
|
|
50
48
|
}
|
|
51
49
|
]
|
|
@@ -70,7 +68,6 @@
|
|
|
70
68
|
"actions": [
|
|
71
69
|
{
|
|
72
70
|
"text": "Change",
|
|
73
|
-
"ariaLabel": "Change answer",
|
|
74
71
|
"url": "#0"
|
|
75
72
|
}
|
|
76
73
|
]
|
|
@@ -91,7 +88,6 @@
|
|
|
91
88
|
"actions": [
|
|
92
89
|
{
|
|
93
90
|
"text": "Change",
|
|
94
|
-
"ariaLabel": "Change answer",
|
|
95
91
|
"url": "#0"
|
|
96
92
|
}
|
|
97
93
|
]
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<thead class="ons-table__head">
|
|
16
16
|
<tr class="ons-table__row">
|
|
17
17
|
{% for th in params.ths %}
|
|
18
|
-
<th scope="col" class="ons-table__header{{ ' ' + th.thClasses if th.thClasses }}{{ " ons-table__header--numeric" if th.numeric }}"{% if 'sortable' in variants %} aria-sort="{{- th.ariaSort | default('none') -}}"{% endif %}>
|
|
18
|
+
<th scope="col" class="ons-table__header{{ ' ' + th.thClasses if th.thClasses }}{{ " ons-table__header--numeric" if th.numeric }}"{% if 'sortable' in variants %} aria-sort="{{- th.ariaSort | default('none') -}}"{% endif %}{% if th.widthPercentage %} width="{{ th.widthPercentage }}%"{% endif %}>
|
|
19
19
|
<span class="ons-table__header-text">{{- th.value -}}</span>
|
|
20
20
|
{% if 'sortable' in variants %}
|
|
21
21
|
{{
|
|
@@ -80,6 +80,22 @@ describe('macro: table', () => {
|
|
|
80
80
|
expect($('.ons-table__header').hasClass('another-extra-column-class')).toBe(true);
|
|
81
81
|
});
|
|
82
82
|
|
|
83
|
+
it('adds additional width attribute to column header', () => {
|
|
84
|
+
const $ = cheerio.load(
|
|
85
|
+
renderComponent('table', {
|
|
86
|
+
...EXAMPLE_TABLE,
|
|
87
|
+
ths: [
|
|
88
|
+
{
|
|
89
|
+
value: 'Column 1',
|
|
90
|
+
widthPercentage: 50,
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
}),
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
expect($('.ons-table__header').attr('width')).toBe('50%');
|
|
97
|
+
});
|
|
98
|
+
|
|
83
99
|
it('does not add "numeric" modifier class to column header when `td.numeric` is not provided', () => {
|
|
84
100
|
const $ = cheerio.load(renderComponent('table', EXAMPLE_TABLE));
|
|
85
101
|
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
|
|
156
156
|
&--sortable {
|
|
157
157
|
[aria-sort='descending'].ons-table__header {
|
|
158
|
-
.ons-
|
|
158
|
+
.ons-icon {
|
|
159
159
|
.ons-topTriangle {
|
|
160
160
|
fill: var(--ons-color-grey-15);
|
|
161
161
|
}
|
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
.ons-table__sort-button:focus {
|
|
167
|
-
.ons-
|
|
167
|
+
.ons-icon {
|
|
168
168
|
.ons-topTriangle {
|
|
169
169
|
fill: #e3ba02;
|
|
170
170
|
}
|
|
@@ -173,7 +173,7 @@
|
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
[aria-sort='ascending'].ons-table__header {
|
|
176
|
-
.ons-
|
|
176
|
+
.ons-icon {
|
|
177
177
|
.ons-topTriangle {
|
|
178
178
|
fill: var(--ons-color-text);
|
|
179
179
|
}
|
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
.ons-table__sort-button:focus {
|
|
185
|
-
.ons-
|
|
185
|
+
.ons-icon {
|
|
186
186
|
.ons-bottomTriangle {
|
|
187
187
|
fill: #e3ba02;
|
|
188
188
|
}
|
|
@@ -210,7 +210,7 @@
|
|
|
210
210
|
text-underline-position: under;
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
-
.ons-
|
|
213
|
+
.ons-icon {
|
|
214
214
|
fill: var(--ons-color-grey-75);
|
|
215
215
|
height: 16px;
|
|
216
216
|
margin-left: 0.2rem;
|
|
@@ -220,7 +220,7 @@
|
|
|
220
220
|
|
|
221
221
|
&:focus {
|
|
222
222
|
@extend %a-focus;
|
|
223
|
-
.ons-
|
|
223
|
+
.ons-icon {
|
|
224
224
|
fill: var(--ons-color-black);
|
|
225
225
|
}
|
|
226
226
|
}
|
|
@@ -4,15 +4,18 @@
|
|
|
4
4
|
"caption": "A basic table with numeric values",
|
|
5
5
|
"ths": [
|
|
6
6
|
{
|
|
7
|
-
"value": "Country"
|
|
7
|
+
"value": "Country",
|
|
8
|
+
"widthPercentage": 50
|
|
8
9
|
},
|
|
9
10
|
{
|
|
10
11
|
"value": "Population mid-2020",
|
|
11
|
-
"numeric": true
|
|
12
|
+
"numeric": true,
|
|
13
|
+
"widthPercentage": 25
|
|
12
14
|
},
|
|
13
15
|
{
|
|
14
16
|
"value": "% change 2019 to 2020",
|
|
15
|
-
"numeric": true
|
|
17
|
+
"numeric": true,
|
|
18
|
+
"widthPercentage": 25
|
|
16
19
|
}
|
|
17
20
|
],
|
|
18
21
|
"trs": [
|
|
@@ -29,7 +29,7 @@ export default class TableSort {
|
|
|
29
29
|
createHeadingButtons(heading, i) {
|
|
30
30
|
const text = heading.textContent.trim();
|
|
31
31
|
heading.querySelector('.ons-table__header-text').remove();
|
|
32
|
-
heading.querySelector('.ons-
|
|
32
|
+
heading.querySelector('.ons-icon').classList.remove('ons-u-d-no');
|
|
33
33
|
const button = document.createElement('button');
|
|
34
34
|
button.setAttribute('aria-label', this.table.getAttribute('data-aria-sort') + ' ' + text);
|
|
35
35
|
button.setAttribute('type', 'button');
|
|
@@ -12,17 +12,18 @@
|
|
|
12
12
|
>
|
|
13
13
|
{% set titleTag = params.titleTag | default("h2") %}
|
|
14
14
|
<{{ titleTag }} class="ons-tabs__title ons-u-fs-r--b ons-u-mt-no">{{ params.title }}</{{ titleTag }}>
|
|
15
|
-
|
|
15
|
+
<div>
|
|
16
16
|
<ul class="ons-tabs__list">
|
|
17
17
|
{%- for tab in params.tabs -%}
|
|
18
18
|
<li class="ons-tab__list-item"><a href="#{{ tab.id if tab.id else tab.title|trim|replace(' ','-')|lower}}" class="ons-tab" data-ga="click" data-ga-category="tabs" data-ga-action="Show: {{ tab.title }}" data-ga-label="Show: {{ tab.title }}">{{ tab.title }}{% if tab.hiddenSpan %}<span class='ons-u-d-no'>{{tab.hiddenSpan}}</span>{% endif %}</a></li>
|
|
19
19
|
{%- endfor -%}
|
|
20
20
|
</ul>
|
|
21
|
-
|
|
21
|
+
</div>
|
|
22
22
|
{% for tab in params.tabs %}
|
|
23
23
|
<section id="{{ tab.id if tab.id else tab.title|trim|replace(' ','-')|lower }}" class="ons-tabs__panel">
|
|
24
|
+
{% if tab.showTitle %}<h2 id="{{ tab.title|trim|replace(' ','-')|lower + '-content-title' }}" class="ons-u-vh">{{ tab.title }}</h2>{% endif %}
|
|
24
25
|
{{ tab.content | safe }}
|
|
25
26
|
</section>
|
|
26
|
-
{% endfor %}
|
|
27
|
+
{% endfor %}
|
|
27
28
|
</section>
|
|
28
29
|
{% endmacro %}
|
|
@@ -22,6 +22,23 @@ const EXAMPLE_TABS = {
|
|
|
22
22
|
],
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
+
const EXAMPLE_TABS_WITH_SHOWTITLE = {
|
|
26
|
+
title: 'Example tabs',
|
|
27
|
+
tabs: [
|
|
28
|
+
{
|
|
29
|
+
id: 'first-tab',
|
|
30
|
+
title: 'Tab 1',
|
|
31
|
+
showTitle: true,
|
|
32
|
+
content: 'Example content...',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: 'second-tab',
|
|
36
|
+
title: 'Tab 2',
|
|
37
|
+
content: 'Some nested <strong>strong element</strong>...',
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
};
|
|
41
|
+
|
|
25
42
|
const EXAMPLE_TABS_WITHOUT_TAB_IDS = {
|
|
26
43
|
title: 'Example tabs',
|
|
27
44
|
tabs: [
|
|
@@ -127,4 +144,10 @@ describe('macro: tabs', () => {
|
|
|
127
144
|
.trim(),
|
|
128
145
|
).toBe('Some nested <strong>strong element</strong>...');
|
|
129
146
|
});
|
|
147
|
+
|
|
148
|
+
it('displays a h2 when showTitle set to true', () => {
|
|
149
|
+
const $ = cheerio.load(renderComponent('tabs', EXAMPLE_TABS_WITH_SHOWTITLE));
|
|
150
|
+
|
|
151
|
+
expect($('.ons-tabs__panel:first').find('h2').length).toBe(1);
|
|
152
|
+
});
|
|
130
153
|
});
|
|
@@ -11,24 +11,19 @@
|
|
|
11
11
|
margin: 0 0 1rem;
|
|
12
12
|
overflow: visible;
|
|
13
13
|
padding: 0;
|
|
14
|
-
|
|
14
|
+
width: max-content;
|
|
15
15
|
// Tabs
|
|
16
16
|
&--row {
|
|
17
17
|
margin: 0;
|
|
18
18
|
position: relative;
|
|
19
|
-
|
|
20
|
-
&::after {
|
|
21
|
-
background: var(--ons-color-borders);
|
|
22
|
-
bottom: 0;
|
|
23
|
-
box-shadow: 0 1px 0 0 var(--ons-color-page-light);
|
|
24
|
-
content: '';
|
|
25
|
-
height: 1px;
|
|
26
|
-
left: 0;
|
|
27
|
-
position: absolute;
|
|
28
|
-
width: 100%;
|
|
29
|
-
}
|
|
30
19
|
}
|
|
31
20
|
}
|
|
21
|
+
&__container {
|
|
22
|
+
border-bottom: 1px solid var(--ons-color-borders);
|
|
23
|
+
margin: 0;
|
|
24
|
+
padding: 0;
|
|
25
|
+
z-index: -2;
|
|
26
|
+
}
|
|
32
27
|
}
|
|
33
28
|
|
|
34
29
|
.ons-tab__list-item {
|
|
@@ -81,10 +76,12 @@
|
|
|
81
76
|
// Tab when selected
|
|
82
77
|
&[aria-selected='true'] {
|
|
83
78
|
background-color: var(--ons-color-page-light);
|
|
84
|
-
border-bottom:
|
|
79
|
+
border-bottom: 2px white;
|
|
85
80
|
border-color: var(--ons-color-borders);
|
|
86
81
|
border-radius: 3px 3px 0 0;
|
|
82
|
+
position: relative;
|
|
87
83
|
text-decoration: none;
|
|
84
|
+
top: 1px;
|
|
88
85
|
z-index: 1;
|
|
89
86
|
|
|
90
87
|
&:focus {
|
|
@@ -109,7 +106,7 @@
|
|
|
109
106
|
}
|
|
110
107
|
|
|
111
108
|
&:focus {
|
|
112
|
-
box-shadow: 0 0 0
|
|
109
|
+
box-shadow: 0 0 0 0 var(--ons-color-page-light), 0 0 0 2px var(--ons-color-text-link-focus), 0 0 0 6px var(--ons-color-focus);
|
|
113
110
|
outline: 3px solid transparent; // Add transparent outline because Windows High Contrast Mode doesn't show box-shadows
|
|
114
111
|
z-index: 1;
|
|
115
112
|
}
|
|
@@ -137,7 +134,6 @@
|
|
|
137
134
|
}
|
|
138
135
|
|
|
139
136
|
.ons-tabs__list--row {
|
|
140
|
-
margin-bottom: -1px;
|
|
141
137
|
padding: 0;
|
|
142
138
|
}
|
|
143
139
|
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
{
|
|
8
8
|
"id": "ukis",
|
|
9
9
|
"title": 'UKIS',
|
|
10
|
+
"showTitle": true,
|
|
10
11
|
"hiddenSpan": 'for UKIS',
|
|
11
|
-
"content": '<
|
|
12
|
-
<h3>Aim of this survey</h3>
|
|
12
|
+
"content": '<h3>Aim of this survey</h3>
|
|
13
13
|
<p class="ons-u-fs-r">The aim of the UK Innovation Survey (UKIS) is to collect data from businesses about various aspects of their innovation related activities. Using this data we can measure the level, types and trends in innovation.</p>
|
|
14
14
|
<h3>How we’ll use this data</h3>
|
|
15
15
|
<p class="ons-u-fs-r">The UKIS data is a major source of evidence to inform government policy. It is used to promote innovation activities among businesses to boost economic growth. It is an important contribution to the European-wide Community Innovation Survey (CIS). The CIS is used for international benchmarking and comparison purposes.</p>
|
|
@@ -18,16 +18,16 @@
|
|
|
18
18
|
{
|
|
19
19
|
"id": "vacancy-survey",
|
|
20
20
|
"title": 'Vacancy survey',
|
|
21
|
-
"
|
|
22
|
-
<h3>Purpose</h3>
|
|
21
|
+
"showTitle": true,
|
|
22
|
+
"content": '<h3>Purpose</h3>
|
|
23
23
|
<p class="ons-u-fs-r">The Vacancy Survey is a regular survey of businesses, which provides an accurate and comprehensive measure of the total number of vacancies across the economy and fills a gap in the information available regarding the demand for labour. Before the Vacancy Survey was introduced, the only information available nationally about vacancies was from records of vacancies notified to Job Centres by employers. This provided only a partial picture, possibly less than half of all vacancies, because employers are under no obligation to notify vacancies to Job Centres. This business based survey has a more complete coverage and is included in the monthly ONS Labour Market Statistical Bulletin.</p>
|
|
24
24
|
<p>You can <a href="https://www.ons.gov.uk/surveys/informationforbusinesses/businesssurveys/vacancysurvey">find more information on the Vacancy Survey on the ONS website</a>.</p>'
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
"id": "monthly-business-survey",
|
|
28
28
|
"title": 'Monthly Business Survey',
|
|
29
|
-
"
|
|
30
|
-
<h3>Aim of this survey</h3>
|
|
29
|
+
"showTitle": true,
|
|
30
|
+
"content": '<h3>Aim of this survey</h3>
|
|
31
31
|
<p class="ons-u-fs-r">The Monthly Business Survey (MBS) collects monthly information on employment of businesses in Great Britain. Your response contributes to Labour Market Statistics.</p>
|
|
32
32
|
<h4>What you need to know</h4>
|
|
33
33
|
<p class="ons-u-fs-r">To complete the survey, you will need the following information to answer the survey questions:</p>
|
package/components/tabs/tabs.js
CHANGED
|
@@ -10,7 +10,6 @@ const classTabTitle = 'ons-tabs__title';
|
|
|
10
10
|
const classTabList = 'ons-tabs__list';
|
|
11
11
|
const classTabListItems = 'ons-tab__list-item';
|
|
12
12
|
const classTabsPanel = 'ons-tabs__panel';
|
|
13
|
-
|
|
14
13
|
const matchMediaUtil = matchMedia;
|
|
15
14
|
|
|
16
15
|
export default class Tabs {
|
|
@@ -22,6 +21,7 @@ export default class Tabs {
|
|
|
22
21
|
this.tabsTitle = component.querySelector(`.${classTabTitle}`);
|
|
23
22
|
this.tabs = [...component.getElementsByClassName(classTab)];
|
|
24
23
|
this.tabList = component.getElementsByClassName(classTabList);
|
|
24
|
+
this.tabListContainer = this.tabList[0].parentElement;
|
|
25
25
|
this.tabListItems = [...component.getElementsByClassName(classTabListItems)];
|
|
26
26
|
this.tabPanels = [...component.getElementsByClassName(classTabsPanel)];
|
|
27
27
|
|
|
@@ -31,7 +31,6 @@ export default class Tabs {
|
|
|
31
31
|
this.jsTabAsListClass = 'ons-tab--row';
|
|
32
32
|
|
|
33
33
|
this.noInitialActiveTab = this.component.getAttribute('data-no-initial-active-tab');
|
|
34
|
-
|
|
35
34
|
if (matchMediaUtil.hasMatchMedia()) {
|
|
36
35
|
this.setupViewportChecks();
|
|
37
36
|
} else {
|
|
@@ -40,11 +39,22 @@ export default class Tabs {
|
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
// Set up checks for responsive functionality
|
|
43
|
-
// The tabs will display as tabs
|
|
44
|
-
// Tabs will display as a TOC list and show full content for <
|
|
45
|
-
// Aria tags are added only
|
|
42
|
+
// The tabs will display as tabs up until this.breakpoint is reached
|
|
43
|
+
// Tabs will display as a TOC list and show full content for <this.breakpoint viewports
|
|
44
|
+
// Aria tags are added only in toc view
|
|
46
45
|
setupViewportChecks() {
|
|
47
|
-
|
|
46
|
+
const breakpoint = () => {
|
|
47
|
+
let finalBreakpoint = 0;
|
|
48
|
+
this.tabListItems.forEach(tab => {
|
|
49
|
+
finalBreakpoint += tab.offsetWidth;
|
|
50
|
+
});
|
|
51
|
+
if (finalBreakpoint < 450) {
|
|
52
|
+
return (finalBreakpoint = 450);
|
|
53
|
+
} else {
|
|
54
|
+
return finalBreakpoint;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
this.viewport = matchMediaUtil(`(min-width: ${breakpoint()}px)`);
|
|
48
58
|
this.viewport.addListener(this.checkViewport.bind(this));
|
|
49
59
|
this.checkViewport();
|
|
50
60
|
}
|
|
@@ -62,9 +72,12 @@ export default class Tabs {
|
|
|
62
72
|
this.tabList[0].classList.add(this.jsTabListAsRowClass);
|
|
63
73
|
|
|
64
74
|
this.tabsTitle.classList.add('ons-u-vh');
|
|
65
|
-
|
|
75
|
+
this.tabListContainer.classList.add('ons-tabs__container');
|
|
66
76
|
this.tabPanels.forEach(panel => {
|
|
67
77
|
panel.setAttribute('tabindex', '0');
|
|
78
|
+
if (panel.querySelector('[id*="content-title"]')) {
|
|
79
|
+
panel.firstElementChild.classList.add('ons-u-vh');
|
|
80
|
+
}
|
|
68
81
|
});
|
|
69
82
|
|
|
70
83
|
this.tabListItems.forEach(item => {
|
|
@@ -96,11 +109,14 @@ export default class Tabs {
|
|
|
96
109
|
makeList() {
|
|
97
110
|
this.tabList[0].removeAttribute('role');
|
|
98
111
|
this.tabList[0].classList.remove(this.jsTabListAsRowClass);
|
|
99
|
-
|
|
112
|
+
this.tabListContainer.classList.remove('ons-tabs__container');
|
|
100
113
|
this.tabsTitle.classList.remove('ons-u-vh');
|
|
101
114
|
|
|
102
115
|
this.tabPanels.forEach(panel => {
|
|
103
116
|
panel.removeAttribute('tabindex', '0');
|
|
117
|
+
if (panel.firstElementChild.classList.contains('ons-u-vh')) {
|
|
118
|
+
panel.firstElementChild.classList.remove('ons-u-vh');
|
|
119
|
+
}
|
|
104
120
|
});
|
|
105
121
|
|
|
106
122
|
this.tabListItems.forEach(item => {
|