@ons/design-system 69.0.0 → 70.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/README.md +1 -0
- package/components/autosuggest/_autosuggest.scss +1 -1
- package/components/card/_macro.njk +3 -3
- package/components/card/_macro.spec.js +4 -4
- package/components/date-input/_macro.njk +71 -69
- package/components/date-input/_macro.spec.js +20 -5
- package/components/date-input/example-date-input-double-field.njk +27 -0
- package/components/date-input/example-date-input-single-field.njk +18 -0
- package/components/duration/_macro.njk +52 -48
- package/components/duration/_macro.spec.js +112 -4
- package/components/duration/example-duration-error-for-single-field.njk +1 -1
- package/components/duration/example-duration-single-field.njk +24 -0
- package/components/feedback/_macro.njk +1 -1
- package/components/header/_macro.njk +1 -1
- package/components/header/_macro.spec.js +1 -1
- package/components/icon/_macro.njk +8 -8
- package/components/icon/_macro.spec.js +4 -4
- package/components/metadata/_macro.njk +10 -10
- package/components/multiple-input-fields/_macro.njk +49 -0
- package/components/section-navigation/_macro.njk +12 -12
- package/components/summary/_macro.njk +3 -3
- package/css/main.css +1 -1
- package/package.json +1 -1
- package/components/date-field-input/_macro.njk +0 -86
|
@@ -11,6 +11,15 @@ const EXAMPLE_DURATION_INPUT_BASE = {
|
|
|
11
11
|
description: 'Enter “0” into the years field if you have lived at this address for less than a year',
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
+
const EXAMPLE_DURATION_INPUT_BASE_WITH_ERROR = {
|
|
15
|
+
id: 'duration',
|
|
16
|
+
legendOrLabel: 'How long have you lived at this address?',
|
|
17
|
+
description: 'Enter “0” into the years field if you have lived at this address for less than a year',
|
|
18
|
+
error: {
|
|
19
|
+
text: 'Enter how long you have lived at this address',
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
14
23
|
const EXAMPLE_FIELD_1 = {
|
|
15
24
|
field1: {
|
|
16
25
|
id: 'address-duration-years',
|
|
@@ -35,6 +44,45 @@ const EXAMPLE_FIELD_2 = {
|
|
|
35
44
|
},
|
|
36
45
|
};
|
|
37
46
|
|
|
47
|
+
const EXAMPLE_FIELD_1_WITH_ERROR = {
|
|
48
|
+
field1: {
|
|
49
|
+
id: 'address-duration-years',
|
|
50
|
+
name: 'address-duration-years',
|
|
51
|
+
value: '0',
|
|
52
|
+
error: true,
|
|
53
|
+
suffix: {
|
|
54
|
+
text: 'Years',
|
|
55
|
+
id: 'address-duration-years-suffix',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const EXAMPLE_FIELD_2_WITH_ERROR = {
|
|
61
|
+
field2: {
|
|
62
|
+
id: 'address-duration-months',
|
|
63
|
+
name: 'address-duration-months',
|
|
64
|
+
value: '0',
|
|
65
|
+
error: true,
|
|
66
|
+
suffix: {
|
|
67
|
+
text: 'Months',
|
|
68
|
+
id: 'address-duration-months-suffix',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const EXAMPLE_FIELD_1_WITH_ERROR_FALSE = {
|
|
74
|
+
field1: {
|
|
75
|
+
id: 'address-duration-years',
|
|
76
|
+
name: 'address-duration-years',
|
|
77
|
+
value: '0',
|
|
78
|
+
error: false,
|
|
79
|
+
suffix: {
|
|
80
|
+
text: 'Years',
|
|
81
|
+
id: 'address-duration-years-suffix',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
|
|
38
86
|
const EXAMPLE_DURATION_SINGLE_FIELD = {
|
|
39
87
|
...EXAMPLE_DURATION_INPUT_BASE,
|
|
40
88
|
...EXAMPLE_FIELD_1,
|
|
@@ -46,6 +94,23 @@ const EXAMPLE_DURATION_MULTIPLE_FIELDS = {
|
|
|
46
94
|
...EXAMPLE_FIELD_2,
|
|
47
95
|
};
|
|
48
96
|
|
|
97
|
+
const EXAMPLE_DURATION_MULTIPLE_FIELDS_WITH_SINGLE_ERROR = {
|
|
98
|
+
...EXAMPLE_DURATION_INPUT_BASE_WITH_ERROR,
|
|
99
|
+
...EXAMPLE_FIELD_1,
|
|
100
|
+
...EXAMPLE_FIELD_2_WITH_ERROR,
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const EXAMPLE_DURATION_MULTIPLE_FIELDS_WITH_ERROR = {
|
|
104
|
+
...EXAMPLE_DURATION_INPUT_BASE_WITH_ERROR,
|
|
105
|
+
...EXAMPLE_FIELD_1_WITH_ERROR,
|
|
106
|
+
...EXAMPLE_FIELD_2_WITH_ERROR,
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const EXAMPLE_DURATION_MULTIPLE_FIELDS_WITH_ERROR_FALSE = {
|
|
110
|
+
...EXAMPLE_DURATION_INPUT_BASE,
|
|
111
|
+
...EXAMPLE_FIELD_1_WITH_ERROR_FALSE,
|
|
112
|
+
};
|
|
113
|
+
|
|
49
114
|
describe('macro: duration', () => {
|
|
50
115
|
describe('mode: multiple fields', () => {
|
|
51
116
|
it('passes jest-axe checks', async () => {
|
|
@@ -109,6 +174,12 @@ describe('macro: duration', () => {
|
|
|
109
174
|
expect($(div).hasClass('ons-field-group')).toBe(true);
|
|
110
175
|
});
|
|
111
176
|
|
|
177
|
+
it('has the correct number of inputs', () => {
|
|
178
|
+
const $ = cheerio.load(renderComponent('duration', EXAMPLE_DURATION_MULTIPLE_FIELDS));
|
|
179
|
+
const $inputs = $('.ons-input');
|
|
180
|
+
expect($inputs.length).toBe(2);
|
|
181
|
+
});
|
|
182
|
+
|
|
112
183
|
it('has the expected `fieldset` output', () => {
|
|
113
184
|
const faker = templateFaker();
|
|
114
185
|
const fieldsetSpy = faker.spy('fieldset');
|
|
@@ -141,10 +212,11 @@ describe('macro: duration', () => {
|
|
|
141
212
|
mutuallyExclusive: {
|
|
142
213
|
legendClasses: 'custom-legend-class',
|
|
143
214
|
dontWrap: true,
|
|
215
|
+
classes: undefined,
|
|
144
216
|
legendIsQuestionTitle: true,
|
|
145
217
|
error: false,
|
|
146
218
|
mutuallyExclusive: {
|
|
147
|
-
|
|
219
|
+
exclusiveOptions: {},
|
|
148
220
|
or: 'Or',
|
|
149
221
|
deselectMessage: 'Deselect message',
|
|
150
222
|
deselectGroupAdjective: 'Deselect group adjective',
|
|
@@ -166,10 +238,10 @@ describe('macro: duration', () => {
|
|
|
166
238
|
...EXAMPLE_DURATION_MULTIPLE_FIELDS,
|
|
167
239
|
legendClasses: 'custom-legend-class',
|
|
168
240
|
dontWrap: true,
|
|
241
|
+
classes: undefined,
|
|
169
242
|
legendIsQuestionTitle: true,
|
|
170
243
|
error: false,
|
|
171
244
|
mutuallyExclusive: {
|
|
172
|
-
checkbox: {},
|
|
173
245
|
or: 'Or',
|
|
174
246
|
deselectMessage: 'Deselect message',
|
|
175
247
|
deselectGroupAdjective: 'Deselect group adjective',
|
|
@@ -183,9 +255,9 @@ describe('macro: duration', () => {
|
|
|
183
255
|
description: 'Enter “0” into the years field if you have lived at this address for less than a year',
|
|
184
256
|
legendClasses: 'custom-legend-class',
|
|
185
257
|
dontWrap: true,
|
|
258
|
+
classes: undefined,
|
|
186
259
|
legendIsQuestionTitle: true,
|
|
187
260
|
error: false,
|
|
188
|
-
checkbox: {},
|
|
189
261
|
or: 'Or',
|
|
190
262
|
deselectMessage: 'Deselect message',
|
|
191
263
|
deselectGroupAdjective: 'Deselect group adjective',
|
|
@@ -215,7 +287,6 @@ describe('macro: duration', () => {
|
|
|
215
287
|
classes: '',
|
|
216
288
|
value: '0',
|
|
217
289
|
attributes: undefined,
|
|
218
|
-
classes: '',
|
|
219
290
|
error: undefined,
|
|
220
291
|
fieldId: 'duration',
|
|
221
292
|
label: {
|
|
@@ -226,10 +297,17 @@ describe('macro: duration', () => {
|
|
|
226
297
|
suffix: {
|
|
227
298
|
id: 'address-duration-years-suffix',
|
|
228
299
|
text: 'Years',
|
|
300
|
+
title: undefined,
|
|
229
301
|
},
|
|
230
302
|
});
|
|
231
303
|
});
|
|
232
304
|
|
|
305
|
+
it('has the correct number of inputs', () => {
|
|
306
|
+
const $ = cheerio.load(renderComponent('duration', EXAMPLE_DURATION_SINGLE_FIELD));
|
|
307
|
+
const $inputs = $('.ons-input');
|
|
308
|
+
expect($inputs.length).toBe(1);
|
|
309
|
+
});
|
|
310
|
+
|
|
233
311
|
it('has the expected `error` output', () => {
|
|
234
312
|
const faker = templateFaker();
|
|
235
313
|
const errorSpy = faker.spy('error');
|
|
@@ -244,4 +322,34 @@ describe('macro: duration', () => {
|
|
|
244
322
|
});
|
|
245
323
|
});
|
|
246
324
|
});
|
|
325
|
+
|
|
326
|
+
describe('mode: multiple fields with errors', () => {
|
|
327
|
+
it('passes jest-axe checks', async () => {
|
|
328
|
+
const $ = cheerio.load(renderComponent('duration', EXAMPLE_DURATION_MULTIPLE_FIELDS_WITH_SINGLE_ERROR));
|
|
329
|
+
|
|
330
|
+
const results = await axe($.html());
|
|
331
|
+
expect(results).toHaveNoViolations();
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
it('has the provided error class on one input', async () => {
|
|
335
|
+
const $ = cheerio.load(renderComponent('duration', EXAMPLE_DURATION_MULTIPLE_FIELDS_WITH_SINGLE_ERROR));
|
|
336
|
+
const $errorContent = $('.ons-input--error');
|
|
337
|
+
|
|
338
|
+
expect($errorContent.length).toBe(1);
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
it('has the provided error class on multiple inputs', async () => {
|
|
342
|
+
const $ = cheerio.load(renderComponent('duration', EXAMPLE_DURATION_MULTIPLE_FIELDS_WITH_ERROR));
|
|
343
|
+
const $errorContent = $('.ons-input--error');
|
|
344
|
+
|
|
345
|
+
expect($errorContent.length).toBe(2);
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
it('does not provide error class when error parameter set to false', async () => {
|
|
349
|
+
const $ = cheerio.load(renderComponent('duration', EXAMPLE_DURATION_MULTIPLE_FIELDS_WITH_ERROR_FALSE));
|
|
350
|
+
const $errorContent = $('.ons-input--error');
|
|
351
|
+
|
|
352
|
+
expect($errorContent.length).toBe(0);
|
|
353
|
+
});
|
|
354
|
+
});
|
|
247
355
|
});
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"legendOrLabel": 'How long do you spend travelling to and from work each day?',
|
|
7
7
|
"legendClasses": 'ons-u-vh',
|
|
8
8
|
"error": {
|
|
9
|
-
"text": "Enter a number that is less than 60",
|
|
9
|
+
"text": "Enter a number of minutes that is less than 60",
|
|
10
10
|
"id": "duration-error"
|
|
11
11
|
},
|
|
12
12
|
"field1": {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{% from "components/question/_macro.njk" import onsQuestion %}
|
|
2
|
+
{% from "components/duration/_macro.njk" import onsDuration %}
|
|
3
|
+
|
|
4
|
+
{% call onsQuestion({
|
|
5
|
+
"title": "How many years have you lived at this address?",
|
|
6
|
+
"description": "<p>Enter “0” into the years field if you have lived at this address for less than a year</p>",
|
|
7
|
+
"legendIsQuestionTitle": true
|
|
8
|
+
}) %}
|
|
9
|
+
{{ onsDuration({
|
|
10
|
+
"id": "address-duration-example-single",
|
|
11
|
+
"dontWrap": true,
|
|
12
|
+
"field1": {
|
|
13
|
+
"id": "address-duration-years-example",
|
|
14
|
+
"name": "address-duration-years",
|
|
15
|
+
"suffix": {
|
|
16
|
+
"text": "Years",
|
|
17
|
+
"id": "address-duration-years-suffix-example"
|
|
18
|
+
},
|
|
19
|
+
"attributes": {
|
|
20
|
+
"autocomplete": "off"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}) }}
|
|
24
|
+
{% endcall %}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{% macro onsFeedback(params) %}
|
|
2
|
-
{% set headingLevel = params.headingLevel | default(
|
|
2
|
+
{% set headingLevel = params.headingLevel | default(2) %}
|
|
3
3
|
<div {% if params.id %} id="{{ params.id }}"{% endif %} class="ons-feedback{% if params.classes %} {{ params.classes }}{% endif %}">
|
|
4
4
|
<h{{ headingLevel }} class="ons-feedback__heading{{ ' ' + params.headingClasses if params.headingClasses }}">
|
|
5
5
|
{{ params.heading }}
|
|
@@ -275,7 +275,7 @@ describe('macro: header', () => {
|
|
|
275
275
|
|
|
276
276
|
faker.renderComponent('header', EXAMPLE_HEADER_BASIC);
|
|
277
277
|
|
|
278
|
-
expect(iconsSpy.occurrences[0].altText).toBe('Office for National Statistics
|
|
278
|
+
expect(iconsSpy.occurrences[0].altText).toBe('Office for National Statistics homepage');
|
|
279
279
|
});
|
|
280
280
|
|
|
281
281
|
it('has the default masthead mobile logo icon alt text', () => {
|
|
@@ -130,8 +130,8 @@
|
|
|
130
130
|
</rect>
|
|
131
131
|
</svg>
|
|
132
132
|
{%- elif params.iconType == "ons-logo-en" -%}
|
|
133
|
-
<svg class="ons-icon--logo{{ iconClasses }}" xmlns="http://www.w3.org/2000/svg" width="197" height="19" viewBox="33 2 552 60" aria-labelledby="{{ params.altTextId | default ('ons-logo-en-alt') }}">
|
|
134
|
-
<title id="{{ params.altTextId | default ('ons-logo-en-alt') }}">{{ params.altText | default ('Office for National Statistics
|
|
133
|
+
<svg class="ons-icon--logo{{ iconClasses }}" xmlns="http://www.w3.org/2000/svg" width="197" height="19" viewBox="33 2 552 60" aria-labelledby="{{ params.altTextId | default ('ons-logo-en-alt') }}" role="img">
|
|
134
|
+
<title id="{{ params.altTextId | default ('ons-logo-en-alt') }}">{{ params.altText | default ('Office for National Statistics homepage') }}</title>
|
|
135
135
|
<g class="ons-icon--logo__group ons-icon--logo__group--secondary" fill="#a8bd3a">
|
|
136
136
|
<path d="M0,34.6c.8-1.69,1.39-3,2.32-4.6A38.28,38.28,0,0,1,0,23.4V34.6M5,3S0,3,0,9.25v1A62.12,62.12,0,0,0,4.2,27a43.77,43.77,0,0,1,9.42-10.79C21.69,9.21,31.16,5.13,45.9,3Z"/>
|
|
137
137
|
</g>
|
|
@@ -169,8 +169,8 @@
|
|
|
169
169
|
</g>
|
|
170
170
|
</svg>
|
|
171
171
|
{%- elif params.iconType == "ons-logo-cy" -%}
|
|
172
|
-
<svg class="ons-icon--logo{{ iconClasses }}" xmlns="http://www.w3.org/2000/svg" width="207" height="19" viewBox="15 2 620 60" aria-labelledby="{{ params.altTextId | default ('ons-logo-cy-alt') }}">
|
|
173
|
-
<title id="{{ params.altTextId | default ('ons-logo-cy-alt') }}">{{ params.altText | default ('
|
|
172
|
+
<svg class="ons-icon--logo{{ iconClasses }}" xmlns="http://www.w3.org/2000/svg" width="207" height="19" viewBox="15 2 620 60" aria-labelledby="{{ params.altTextId | default ('ons-logo-cy-alt') }}" role="img">
|
|
173
|
+
<title id="{{ params.altTextId | default ('ons-logo-cy-alt') }}">{{ params.altText | default ('Hafan Swyddfa Ystadegau Gwladol') }}</title>
|
|
174
174
|
<g class="ons-icon--logo__group ons-icon--logo__group--secondary" fill="#a8bd3a">
|
|
175
175
|
<path d="M0,34.6c.8-1.69,1.39-3,2.32-4.6A38.28,38.28,0,0,1,0,23.4V34.6M5,3S0,3,0,9.25v1A62.12,62.12,0,0,0,4.2,27a43.77,43.77,0,0,1,9.42-10.79C21.69,9.21,31.16,5.13,45.9,3Z"/>
|
|
176
176
|
</g>
|
|
@@ -204,8 +204,8 @@
|
|
|
204
204
|
</g>
|
|
205
205
|
</svg>
|
|
206
206
|
{%- elif params.iconType == "ons-logo-stacked-en" -%}
|
|
207
|
-
<svg class="ons-icon--logo{{ iconClasses }}" xmlns="http://www.w3.org/2000/svg" width="120" height="27" viewBox="0 5 595 116" aria-labelledby="{{ params.altTextId | default ('ons-logo-stacked-en-alt') }}">
|
|
208
|
-
<title id="{{ params.altTextId | default ('ons-logo-stacked-en-alt') }}">{{ params.altText | default ('Office for National Statistics
|
|
207
|
+
<svg class="ons-icon--logo{{ iconClasses }}" xmlns="http://www.w3.org/2000/svg" width="120" height="27" viewBox="0 5 595 116" aria-labelledby="{{ params.altTextId | default ('ons-logo-stacked-en-alt') }}" role="img">
|
|
208
|
+
<title id="{{ params.altTextId | default ('ons-logo-stacked-en-alt') }}">{{ params.altText | default ('Office for National Statistics homepage') }}</title>
|
|
209
209
|
<g class="ons-icon--logo__group ons-icon--logo__group--secondary" fill="#a8bd3a">
|
|
210
210
|
<path d="M0,70.5c1.8-3.7,3.6-7.2,5.6-10.7A127.94,127.94,0,0,1,0,42.6V70.5M10.9,0S0,0,0,13.5v7.2A128.06,128.06,0,0,0,7.9,56.2a114.75,114.75,0,0,1,22.3-26C47.8,15.1,71.5,4.7,103.7.1Z"/>
|
|
211
211
|
</g>
|
|
@@ -217,8 +217,8 @@
|
|
|
217
217
|
</g>
|
|
218
218
|
</svg>
|
|
219
219
|
{%- elif params.iconType == "ons-logo-stacked-cy" -%}
|
|
220
|
-
<svg class="ons-icon--logo{{ iconClasses }}" xmlns="http://www.w3.org/2000/svg" width="130" height="27" viewBox="0 5 645 116" aria-labelledby="{{ params.altTextId | default ('ons-logo-stacked-cy-alt') }}">
|
|
221
|
-
<title id="{{ params.altTextId | default ('ons-logo-stacked-en-alt') }}">{{ params.altText | default ('
|
|
220
|
+
<svg class="ons-icon--logo{{ iconClasses }}" xmlns="http://www.w3.org/2000/svg" width="130" height="27" viewBox="0 5 645 116" aria-labelledby="{{ params.altTextId | default ('ons-logo-stacked-cy-alt') }}" role="img">
|
|
221
|
+
<title id="{{ params.altTextId | default ('ons-logo-stacked-en-alt') }}">{{ params.altText | default ('Hafan Swyddfa Ystadegau Gwladol') }}</title>
|
|
222
222
|
<g class="ons-icon--logo__group ons-icon--logo__group--secondary" fill="#a8bd3a">
|
|
223
223
|
<path d="M0,70.5c1.8-3.7,3.6-7.2,5.6-10.7A127.94,127.94,0,0,1,0,42.6V70.5M10.9,0S0,0,0,13.5v7.2A128.06,128.06,0,0,0,7.9,56.2a114.75,114.75,0,0,1,22.3-26C47.8,15.1,71.5,4.7,103.7.1Z"/>
|
|
224
224
|
</g>
|
|
@@ -91,10 +91,10 @@ describe('macro: icon', () => {
|
|
|
91
91
|
});
|
|
92
92
|
|
|
93
93
|
describe.each([
|
|
94
|
-
['ons-logo-en', 'Office for National Statistics
|
|
95
|
-
['ons-logo-cy', '
|
|
96
|
-
['ons-logo-stacked-en', 'Office for National Statistics
|
|
97
|
-
['ons-logo-stacked-cy', '
|
|
94
|
+
['ons-logo-en', 'Office for National Statistics homepage'],
|
|
95
|
+
['ons-logo-cy', 'Hafan Swyddfa Ystadegau Gwladol'],
|
|
96
|
+
['ons-logo-stacked-en', 'Office for National Statistics homepage'],
|
|
97
|
+
['ons-logo-stacked-cy', 'Hafan Swyddfa Ystadegau Gwladol'],
|
|
98
98
|
['crest', 'Royal coat of arms of the United Kingdom'],
|
|
99
99
|
['ogl', 'Open Government License logo'],
|
|
100
100
|
])('icon type: %s', (iconType, expectedAltText) => {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{% from "components/description-list/_macro.njk" import onsDescriptionList %}
|
|
2
2
|
|
|
3
3
|
{% macro onsMetadata(params) %}
|
|
4
|
-
{{
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}}
|
|
4
|
+
{{
|
|
5
|
+
onsDescriptionList({
|
|
6
|
+
"id": params.id,
|
|
7
|
+
"classes": params.classes,
|
|
8
|
+
"descriptionListLabel": params.metadataLabel,
|
|
9
|
+
"termCol": params.termCol,
|
|
10
|
+
"descriptionCol": params.descriptionCol,
|
|
11
|
+
"itemsList": params.itemsList
|
|
12
|
+
})
|
|
13
|
+
}}
|
|
14
14
|
{% endmacro %}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{% from "components/mutually-exclusive/_macro.njk" import onsMutuallyExclusive %}
|
|
2
|
+
{% from "components/fieldset/_macro.njk" import onsFieldset %}
|
|
3
|
+
|
|
4
|
+
{% macro onsMultipleInputFields(params) %}
|
|
5
|
+
{% if params.numberOfFields > 1 %}
|
|
6
|
+
{% set fields %}
|
|
7
|
+
<div class="ons-field-group">
|
|
8
|
+
{{ params.fields | safe }}
|
|
9
|
+
</div>
|
|
10
|
+
{% endset %}
|
|
11
|
+
{% else %}
|
|
12
|
+
{{ params.fields | safe }}
|
|
13
|
+
{% endif %}
|
|
14
|
+
|
|
15
|
+
{% if params.mutuallyExclusive %}
|
|
16
|
+
{% call onsMutuallyExclusive({
|
|
17
|
+
"id": params.id,
|
|
18
|
+
"legend": params.legendOrLabel,
|
|
19
|
+
"legendClasses": params.legendClasses,
|
|
20
|
+
"description": params.description,
|
|
21
|
+
"classes": params.classes,
|
|
22
|
+
"dontWrap": params.dontWrap if params.numberOfFields > 1 else true,
|
|
23
|
+
"legendIsQuestionTitle": params.legendIsQuestionTitle,
|
|
24
|
+
"exclusiveOptions": params.mutuallyExclusive.exclusiveOptions,
|
|
25
|
+
"or": params.mutuallyExclusive.or,
|
|
26
|
+
"deselectMessage": params.mutuallyExclusive.deselectMessage,
|
|
27
|
+
"deselectGroupAdjective": params.mutuallyExclusive.deselectGroupAdjective,
|
|
28
|
+
"deselectExclusiveOptionAdjective": params.mutuallyExclusive.deselectExclusiveOptionAdjective,
|
|
29
|
+
"error": params.error
|
|
30
|
+
}) %}
|
|
31
|
+
{{ fields | safe }}
|
|
32
|
+
{% endcall %}
|
|
33
|
+
{% elif params.numberOfFields > 1 %}
|
|
34
|
+
{% call onsFieldset({
|
|
35
|
+
"id": params.id,
|
|
36
|
+
"legend": params.legendOrLabel,
|
|
37
|
+
"legendClasses": params.legendClasses,
|
|
38
|
+
"description": params.description,
|
|
39
|
+
"classes": params.classes,
|
|
40
|
+
"dontWrap": params.dontWrap,
|
|
41
|
+
"legendIsQuestionTitle": params.legendIsQuestionTitle,
|
|
42
|
+
"error": params.error
|
|
43
|
+
}) %}
|
|
44
|
+
{{ fields | safe }}
|
|
45
|
+
{% endcall %}
|
|
46
|
+
{% else %}
|
|
47
|
+
{{ fields | safe }}
|
|
48
|
+
{% endif %}
|
|
49
|
+
{% endmacro %}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{% macro onsSectionNavigation(params) %}
|
|
2
|
-
{% set headingLevel = params.headingLevel |
|
|
3
|
-
{% set sectionTitleHeadingLevel =
|
|
2
|
+
{% set headingLevel = params.headingLevel | default(2) %}
|
|
3
|
+
{% set sectionTitleHeadingLevel = headingLevel + 1 %}
|
|
4
4
|
<nav class="ons-section-nav{% if params.variants == 'vertical' %} ons-section-nav--vertical{% endif %} {% if params.classes %} {{ params.classes }} {% endif %}"{% if params.id %} id="{{ params.id }}"{% endif %} aria-labelledby="{{ params.hiddenTitleId | default("section-menu-nav-title")}}">
|
|
5
|
-
|
|
5
|
+
<h{{ headingLevel }} class="ons-u-vh" id="{{ params.hiddenTitleId | default("section-menu-nav-title") }}">{{ params.hiddenTitle | default("Pages in this section") }}</h{{ headingLevel }}>
|
|
6
6
|
{% if params.sections %}
|
|
7
7
|
{% for section in params.sections %}
|
|
8
|
-
{% set sectionItemHeadingLevel =
|
|
8
|
+
{% set sectionItemHeadingLevel = headingLevel + 2 if section.title else headingLevel + 1 %}
|
|
9
9
|
<div class="ons-section-nav__sub">
|
|
10
10
|
{% if section.title %}
|
|
11
11
|
<h{{ sectionTitleHeadingLevel }} class="ons-u-fs-r--b ons-u-mb-s">{{ section.title }}</h{{ sectionTitleHeadingLevel }}>
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
{% set isCurrent = false %}
|
|
19
19
|
{% endif %}
|
|
20
20
|
<li class="ons-section-nav__item{% if item.classes %}{{ ' ' + item.classes }}{% endif %}{% if isCurrent == true %} ons-section-nav__item--active{% endif %}">
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
{% if isCurrent == true %}
|
|
22
|
+
<h{{ sectionItemHeadingLevel }} class="ons-section-nav__link ons-section-nav__item-header" href="{{ item.url }}" aria-current="location">{{ item.title }}</h{{ sectionItemHeadingLevel }}>
|
|
23
|
+
{% else %}
|
|
24
|
+
<a class="ons-section-nav__link" href="{{ item.url }}">{{ item.title }}</a>
|
|
25
|
+
{% endif %}
|
|
26
|
+
{% if item.anchors and isCurrent == true %}
|
|
27
27
|
<ul class="ons-section-nav__sub-items ons-list ons-list--dashed ons-u-mt-xs ons-u-mb-xs">
|
|
28
28
|
{% for anchor in item.anchors %}
|
|
29
29
|
<li class="ons-section-nav__item ons-list__item">
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
{% endif %}
|
|
44
44
|
<ul class="ons-section-nav__list">
|
|
45
45
|
{% for item in params.itemsList %}
|
|
46
|
-
{% set sectionItemHeadingLevel =
|
|
46
|
+
{% set sectionItemHeadingLevel = headingLevel + 2 if params.title else headingLevel + 1 %}
|
|
47
47
|
{% if (params.currentPath and item.url == params.currentPath) or (params.tabQuery and params.tabQuery == item.title|lower) %}
|
|
48
48
|
{% set isCurrent = true %}
|
|
49
49
|
{% else %}
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
{% endif %}
|
|
52
52
|
<li class="ons-section-nav__item{% if item.classes %}{{ ' ' + item.classes }}{% endif %}{% if isCurrent == true %} ons-section-nav__item--active{% endif %}">
|
|
53
53
|
{% if isCurrent == true %}
|
|
54
|
-
<h{{ sectionItemHeadingLevel}} class="ons-section-nav__link ons-section-nav__item-header" href="{{ item.url }}" aria-current="location">{{ item.title }}</h{{ headingLevel + 2 if section.title else headingLevel + 1 }}>
|
|
54
|
+
<h{{ sectionItemHeadingLevel }} class="ons-section-nav__link ons-section-nav__item-header" href="{{ item.url }}" aria-current="location">{{ item.title }}</h{{ headingLevel + 2 if section.title else headingLevel + 1 }}>
|
|
55
55
|
{% else %}
|
|
56
56
|
<a class="ons-section-nav__link" href="{{ item.url }}">{{ item.title }}</a>
|
|
57
57
|
{% endif %}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{% macro onsSummary(params) %}
|
|
2
2
|
{% set className = "ons-summary" %}
|
|
3
|
-
{% set
|
|
3
|
+
{% set headingLevel = 2 %}
|
|
4
4
|
|
|
5
5
|
{% if params.variant == "hub" %}
|
|
6
6
|
{% set variantHub = true %}
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
{% for summary in params.summaries %}
|
|
18
18
|
{% if summary.summaryTitle %}
|
|
19
19
|
<h2 class="ons-summary__title ons-u-mb-m{{ " ons-u-mt-m" if loop.index > 1 else "" }}">{{ summary.summaryTitle }}</h2>
|
|
20
|
-
{% set
|
|
20
|
+
{% set headingLevel = 3 %}
|
|
21
21
|
{% endif %}
|
|
22
22
|
{% for group in summary.groups %}
|
|
23
23
|
<div {% if group.id %}id="{{ group.id }}" {% endif %} class="ons-summary__group{{ variantClasses }}">
|
|
24
24
|
{% if group.groupTitle %}
|
|
25
|
-
<h{{
|
|
25
|
+
<h{{ headingLevel }} class="ons-summary__group-title">{{ group.groupTitle }}</h{{ headingLevel }}>
|
|
26
26
|
{% endif %}
|
|
27
27
|
{% if group.rows %}
|
|
28
28
|
<dl class="ons-summary__items">
|