@ons/design-system 65.2.4 → 66.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/address-input/_macro.njk +12 -10
- package/components/address-input/_macro.spec.js +12 -10
- package/components/autosuggest/_macro.njk +38 -25
- package/components/autosuggest/_macro.spec.js +90 -17
- package/components/autosuggest/autosuggest.spec.js +18 -8
- package/components/autosuggest/autosuggest.ui.js +13 -8
- package/components/autosuggest/example-autosuggest-country-multiple.njk +7 -5
- package/components/autosuggest/example-autosuggest-country.njk +7 -5
- package/components/button/button.dom.js +1 -1
- package/components/card/_card.scss +6 -8
- package/components/card/_macro.njk +9 -27
- package/components/skip-to-content/_skip.scss +1 -1
- package/css/main.css +1 -1
- package/js/analytics.js +4 -7
- package/layout/_template.njk +7 -18
- package/package.json +3 -8
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- package/scss/objects/_page.scss +7 -0
|
@@ -110,17 +110,19 @@
|
|
|
110
110
|
onsAutosuggest({
|
|
111
111
|
"id": params.id + "-autosuggest",
|
|
112
112
|
"classes": "ons-address-input__autosuggest ons-u-mb-no",
|
|
113
|
-
"
|
|
114
|
-
|
|
115
|
-
"
|
|
116
|
-
|
|
117
|
-
|
|
113
|
+
"input": {
|
|
114
|
+
"width": "50",
|
|
115
|
+
"label": {
|
|
116
|
+
"text": params.label.text,
|
|
117
|
+
"id": params.label.id,
|
|
118
|
+
"classes": "ons-js-autosuggest-label"
|
|
119
|
+
},
|
|
120
|
+
"value": params.value,
|
|
121
|
+
"attributes": params.attributes,
|
|
122
|
+
"error": params.error,
|
|
123
|
+
"name": params.name,
|
|
124
|
+
"mutuallyExclusive": params.mutuallyExclusive
|
|
118
125
|
},
|
|
119
|
-
"value": params.value,
|
|
120
|
-
"attributes": params.attributes,
|
|
121
|
-
"error": params.error,
|
|
122
|
-
"name": params.name,
|
|
123
|
-
"mutuallyExclusive": params.mutuallyExclusive,
|
|
124
126
|
"externalInitialiser": true,
|
|
125
127
|
"APIDomain": params.APIDomain,
|
|
126
128
|
"APIDomainBearerToken": params.APIDomainBearerToken,
|
|
@@ -352,17 +352,19 @@ describe('macro: address-input', () => {
|
|
|
352
352
|
expect(autosuggestSpy.occurrences[0]).toEqual({
|
|
353
353
|
id: 'address-input-example-id-autosuggest',
|
|
354
354
|
classes: 'ons-address-input__autosuggest ons-u-mb-no',
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
355
|
+
input: {
|
|
356
|
+
width: '50',
|
|
357
|
+
label: {
|
|
358
|
+
text: '[params.label.text]',
|
|
359
|
+
id: '[params.label.id]',
|
|
360
|
+
classes: 'ons-js-autosuggest-label',
|
|
361
|
+
},
|
|
362
|
+
value: '[params.value]',
|
|
363
|
+
attributes: '[params.attributes]',
|
|
364
|
+
error: '[params.error]',
|
|
365
|
+
name: '[params.name]',
|
|
366
|
+
mutuallyExclusive: '[params.mutuallyExclusive]',
|
|
360
367
|
},
|
|
361
|
-
value: '[params.value]',
|
|
362
|
-
attributes: '[params.attributes]',
|
|
363
|
-
error: '[params.error]',
|
|
364
|
-
name: '[params.name]',
|
|
365
|
-
mutuallyExclusive: '[params.mutuallyExclusive]',
|
|
366
368
|
externalInitialiser: true,
|
|
367
369
|
APIDomain: '[params.APIDomain]',
|
|
368
370
|
APIDomainBearerToken: '[params.APIDomainBearerToken]',
|
|
@@ -37,37 +37,50 @@
|
|
|
37
37
|
>
|
|
38
38
|
|
|
39
39
|
{% set autosuggestResults %}
|
|
40
|
-
<div class="ons-autosuggest__results ons-js-autosuggest-results{% if params.width %} ons-input--w-{{ params.width }}{% else %} ons-input--w-20{% endif %}">
|
|
40
|
+
<div class="ons-autosuggest__results ons-js-autosuggest-results{% if params.input.width %} ons-input--w-{{ params.input.width }}{% else %} ons-input--w-20{% endif %}">
|
|
41
41
|
<div id="{{ params.resultsTitleId }}" class="ons-autosuggest__results-title ons-u-fs-s">{{ params.resultsTitle }}</div>
|
|
42
42
|
<ul class="ons-autosuggest__listbox ons-js-autosuggest-listbox" title="{{ params.resultsTitle }}" role="listbox" id="{{ params.id }}-listbox" tabindex="-1"></ul>
|
|
43
43
|
</div>
|
|
44
44
|
<div class="ons-autosuggest__instructions ons-u-vh ons-js-autosuggest-instructions" id="{{ params.id }}-instructions" tabindex="-1">{{ params.instructions }}</div>
|
|
45
45
|
<div class="ons-autosuggest__status ons-u-vh ons-js-autosuggest-aria-status" aria-live="assertive" aria-atomic="true" role="status" tabindex="-1"></div>
|
|
46
46
|
{% endset %}
|
|
47
|
-
{{ onsInput({
|
|
48
|
-
"id": params.id,
|
|
49
|
-
"classes": "ons-js-autosuggest-input " + (params.classes if params.classes else ''),
|
|
50
|
-
"width": params.width,
|
|
51
|
-
"label": {
|
|
52
|
-
"text": params.label.text,
|
|
53
|
-
"description": params.label.description,
|
|
54
|
-
"id": params.label.id,
|
|
55
|
-
"classes": params.label.classes
|
|
56
|
-
},
|
|
57
|
-
"autocomplete": params.autocomplete,
|
|
58
|
-
"legend": params.legend,
|
|
59
|
-
"legendClasses": params.legendClasses,
|
|
60
|
-
"value": params.value,
|
|
61
|
-
"attributes": params.attributes,
|
|
62
|
-
"error": params.error,
|
|
63
|
-
"mutuallyExclusive": params.mutuallyExclusive,
|
|
64
|
-
"accessiblePlaceholder": params.accessiblePlaceholder,
|
|
65
|
-
"name": params.name,
|
|
66
|
-
"autosuggestResults": autosuggestResults
|
|
67
|
-
}) }}
|
|
68
47
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
48
|
+
{{ onsInput({
|
|
49
|
+
"id": params.id,
|
|
50
|
+
"type": params.input.type,
|
|
51
|
+
"classes": "ons-js-autosuggest-input " + (params.input.classes if params.input.classes else ''),
|
|
52
|
+
"width": params.input.width,
|
|
53
|
+
"label": params.input.label,
|
|
54
|
+
"autocomplete": params.input.autocomplete,
|
|
55
|
+
"legend": params.input.legend,
|
|
56
|
+
"legendClasses": params.input.legendClasses,
|
|
57
|
+
"legendIsQuestionTitle": params.input.legendIsQuestionTitle,
|
|
58
|
+
"value": params.input.value,
|
|
59
|
+
"attributes": params.input.attributes,
|
|
60
|
+
"error": params.input.error,
|
|
61
|
+
"mutuallyExclusive": params.input.mutuallyExclusive,
|
|
62
|
+
"accessiblePlaceholder": params.input.accessiblePlaceholder,
|
|
63
|
+
"name": params.input.name,
|
|
64
|
+
"autosuggestResults": autosuggestResults,
|
|
65
|
+
"min": params.input.min,
|
|
66
|
+
"max": params.input.max,
|
|
67
|
+
"minLength": params.input.minLength,
|
|
68
|
+
"maxLength": params.input.maxLength,
|
|
69
|
+
"prefix": params.input.prefix,
|
|
70
|
+
"suffix": params.input.suffix,
|
|
71
|
+
"fieldId": params.input.fieldId,
|
|
72
|
+
"fieldClasses": params.input.fieldClasses,
|
|
73
|
+
"dontWrap": params.input.dontWrap,
|
|
74
|
+
"charCheckLimit": params.input.charCheckLimit,
|
|
75
|
+
"searchButton": params.input.searchButton,
|
|
76
|
+
"postTextboxLinkText": params.input.postTextboxLinkText,
|
|
77
|
+
"postTextboxLinkUrl": params.input.postTextboxLinkUrl,
|
|
78
|
+
"listeners": params.input.listeners
|
|
79
|
+
}) }}
|
|
80
|
+
|
|
81
|
+
{% if not params.mutuallyExclusive %}
|
|
82
|
+
{{ autosuggestResults | safe }}
|
|
83
|
+
{% endif %}
|
|
84
|
+
|
|
72
85
|
</div>
|
|
73
86
|
{% endmacro %}
|
|
@@ -7,13 +7,15 @@ import { renderComponent, templateFaker } from '../../tests/helpers/rendering';
|
|
|
7
7
|
|
|
8
8
|
const EXAMPLE_AUTOSUGGEST = {
|
|
9
9
|
id: 'country-of-birth',
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
input: {
|
|
11
|
+
label: {
|
|
12
|
+
text: 'Current name of country',
|
|
13
|
+
description: 'Enter your own answer or select from suggestions',
|
|
14
|
+
id: 'country-of-birth-label',
|
|
15
|
+
classes: 'extra-label-class',
|
|
16
|
+
},
|
|
17
|
+
autocomplete: 'off',
|
|
15
18
|
},
|
|
16
|
-
autocomplete: 'off',
|
|
17
19
|
instructions: 'Use up and down keys to navigate.',
|
|
18
20
|
ariaYouHaveSelected: 'You have selected',
|
|
19
21
|
ariaMinChars: 'Enter 3 or more characters for suggestions.',
|
|
@@ -132,21 +134,67 @@ describe('macro: autosuggest', () => {
|
|
|
132
134
|
|
|
133
135
|
faker.renderComponent('autosuggest', {
|
|
134
136
|
...EXAMPLE_AUTOSUGGEST,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
input: {
|
|
138
|
+
type: 'text',
|
|
139
|
+
classes: 'extra-class another-extra-class',
|
|
140
|
+
width: '7',
|
|
141
|
+
label: {
|
|
142
|
+
text: 'Current name of country',
|
|
143
|
+
description: 'Enter your own answer or select from suggestions',
|
|
144
|
+
id: 'country-of-birth-label',
|
|
145
|
+
classes: 'extra-label-class',
|
|
146
|
+
},
|
|
147
|
+
autocomplete: 'off',
|
|
148
|
+
legend: 'this is a legend',
|
|
149
|
+
legendClasses: 'legend-extra-class',
|
|
150
|
+
value: 'abc',
|
|
151
|
+
attributes: {
|
|
152
|
+
a: 42,
|
|
153
|
+
},
|
|
154
|
+
error: {
|
|
155
|
+
id: 'error-id',
|
|
156
|
+
text: 'An error occurred.',
|
|
157
|
+
},
|
|
158
|
+
mutuallyExclusive: null,
|
|
159
|
+
accessiblePlaceholder: true,
|
|
160
|
+
name: 'country-of-birth-test',
|
|
161
|
+
min: 1,
|
|
162
|
+
max: 10,
|
|
163
|
+
minLength: 1,
|
|
164
|
+
maxLength: 10,
|
|
165
|
+
prefix: {
|
|
166
|
+
title: 'Great British Pounds',
|
|
167
|
+
text: '£',
|
|
168
|
+
id: 'gbp-prefix',
|
|
169
|
+
},
|
|
170
|
+
suffix: {
|
|
171
|
+
title: 'Percentage of total',
|
|
172
|
+
text: '%',
|
|
173
|
+
id: 'percentage-suffix',
|
|
174
|
+
},
|
|
175
|
+
fieldId: 'field-id-test',
|
|
176
|
+
fieldClasses: 'field-class-test',
|
|
177
|
+
dontWrap: true,
|
|
178
|
+
charCheckLimit: {
|
|
179
|
+
limit: 200,
|
|
180
|
+
charCountSingular: 'You have {x} character remaining',
|
|
181
|
+
charCountPlural: 'You have {x} characters remaining',
|
|
182
|
+
charCountOverLimitSingular: '{x} character too many',
|
|
183
|
+
charCountOverLimitPlural: '{x} characters too many',
|
|
184
|
+
},
|
|
185
|
+
searchButton: {
|
|
186
|
+
text: 'Search',
|
|
187
|
+
},
|
|
188
|
+
postTextboxLinkText: 'Post textbox link text',
|
|
189
|
+
postTextboxLinkUrl: 'https://www.ons.gov.uk',
|
|
190
|
+
listeners: {
|
|
191
|
+
click: "function() { console.log('click'); }",
|
|
192
|
+
},
|
|
140
193
|
},
|
|
141
|
-
error: {
|
|
142
|
-
id: 'error-id',
|
|
143
|
-
text: 'An error occurred.',
|
|
144
|
-
},
|
|
145
|
-
mutuallyExclusive: null,
|
|
146
|
-
accessiblePlaceholder: true,
|
|
147
194
|
});
|
|
148
195
|
|
|
149
196
|
expect(inputSpy.occurrences[0]).toHaveProperty('id', 'country-of-birth');
|
|
197
|
+
expect(inputSpy.occurrences[0]).toHaveProperty('type', 'text');
|
|
150
198
|
expect(inputSpy.occurrences[0]).toHaveProperty('classes', 'ons-js-autosuggest-input extra-class another-extra-class');
|
|
151
199
|
expect(inputSpy.occurrences[0]).toHaveProperty('width', '7');
|
|
152
200
|
expect(inputSpy.occurrences[0]).toHaveProperty('label.text', 'Current name of country');
|
|
@@ -154,13 +202,38 @@ describe('macro: autosuggest', () => {
|
|
|
154
202
|
expect(inputSpy.occurrences[0]).toHaveProperty('label.id', 'country-of-birth-label');
|
|
155
203
|
expect(inputSpy.occurrences[0]).toHaveProperty('label.classes', 'extra-label-class');
|
|
156
204
|
expect(inputSpy.occurrences[0]).toHaveProperty('autocomplete', 'off');
|
|
205
|
+
expect(inputSpy.occurrences[0]).toHaveProperty('legend', 'this is a legend');
|
|
206
|
+
expect(inputSpy.occurrences[0]).toHaveProperty('legendClasses', 'legend-extra-class');
|
|
157
207
|
expect(inputSpy.occurrences[0]).toHaveProperty('value', 'abc');
|
|
158
208
|
expect(inputSpy.occurrences[0]).toHaveProperty('attributes.a', 42);
|
|
159
209
|
expect(inputSpy.occurrences[0]).toHaveProperty('error.id', 'error-id');
|
|
160
210
|
expect(inputSpy.occurrences[0]).toHaveProperty('error.text', 'An error occurred.');
|
|
161
211
|
expect(inputSpy.occurrences[0]).toHaveProperty('mutuallyExclusive', null);
|
|
162
212
|
expect(inputSpy.occurrences[0]).toHaveProperty('accessiblePlaceholder', true);
|
|
213
|
+
expect(inputSpy.occurrences[0]).toHaveProperty('name', 'country-of-birth-test');
|
|
163
214
|
expect(typeof inputSpy.occurrences[0].autosuggestResults).toBe('string');
|
|
215
|
+
expect(inputSpy.occurrences[0]).toHaveProperty('min', 1);
|
|
216
|
+
expect(inputSpy.occurrences[0]).toHaveProperty('max', 10);
|
|
217
|
+
expect(inputSpy.occurrences[0]).toHaveProperty('minLength', 1);
|
|
218
|
+
expect(inputSpy.occurrences[0]).toHaveProperty('maxLength', 10);
|
|
219
|
+
expect(inputSpy.occurrences[0]).toHaveProperty('prefix.title', 'Great British Pounds');
|
|
220
|
+
expect(inputSpy.occurrences[0]).toHaveProperty('prefix.text', '£');
|
|
221
|
+
expect(inputSpy.occurrences[0]).toHaveProperty('prefix.id', 'gbp-prefix');
|
|
222
|
+
expect(inputSpy.occurrences[0]).toHaveProperty('suffix.title', 'Percentage of total');
|
|
223
|
+
expect(inputSpy.occurrences[0]).toHaveProperty('suffix.text', '%');
|
|
224
|
+
expect(inputSpy.occurrences[0]).toHaveProperty('suffix.id', 'percentage-suffix');
|
|
225
|
+
expect(inputSpy.occurrences[0]).toHaveProperty('fieldId', 'field-id-test');
|
|
226
|
+
expect(inputSpy.occurrences[0]).toHaveProperty('fieldClasses', 'field-class-test');
|
|
227
|
+
expect(inputSpy.occurrences[0]).toHaveProperty('dontWrap', true);
|
|
228
|
+
expect(inputSpy.occurrences[0]).toHaveProperty('charCheckLimit.limit', 200);
|
|
229
|
+
expect(inputSpy.occurrences[0]).toHaveProperty('charCheckLimit.charCountSingular', 'You have {x} character remaining');
|
|
230
|
+
expect(inputSpy.occurrences[0]).toHaveProperty('charCheckLimit.charCountPlural', 'You have {x} characters remaining');
|
|
231
|
+
expect(inputSpy.occurrences[0]).toHaveProperty('charCheckLimit.charCountOverLimitSingular', '{x} character too many');
|
|
232
|
+
expect(inputSpy.occurrences[0]).toHaveProperty('charCheckLimit.charCountOverLimitPlural', '{x} characters too many');
|
|
233
|
+
expect(inputSpy.occurrences[0]).toHaveProperty('searchButton.text', 'Search');
|
|
234
|
+
expect(inputSpy.occurrences[0]).toHaveProperty('postTextboxLinkText', 'Post textbox link text');
|
|
235
|
+
expect(inputSpy.occurrences[0]).toHaveProperty('postTextboxLinkUrl', 'https://www.ons.gov.uk');
|
|
236
|
+
expect(inputSpy.occurrences[0]).toHaveProperty('listeners.click', "function() { console.log('click'); }");
|
|
164
237
|
});
|
|
165
238
|
});
|
|
166
239
|
|
|
@@ -3,13 +3,15 @@ import { renderComponent, setTestPage } from '../../tests/helpers/rendering';
|
|
|
3
3
|
|
|
4
4
|
const EXAMPLE_AUTOSUGGEST = {
|
|
5
5
|
id: 'country-of-birth',
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
input: {
|
|
7
|
+
label: {
|
|
8
|
+
text: 'Current name of country',
|
|
9
|
+
description: 'Enter your own answer or select from suggestions',
|
|
10
|
+
id: 'country-of-birth-label',
|
|
11
|
+
classes: 'extra-label-class',
|
|
12
|
+
},
|
|
13
|
+
autocomplete: 'off',
|
|
11
14
|
},
|
|
12
|
-
autocomplete: 'off',
|
|
13
15
|
instructions: 'Use up and down keys to navigate.',
|
|
14
16
|
ariaYouHaveSelected: 'You have selected',
|
|
15
17
|
ariaMinChars: 'Enter 3 or more characters for suggestions.',
|
|
@@ -597,12 +599,20 @@ describe('script: autosuggest', () => {
|
|
|
597
599
|
});
|
|
598
600
|
|
|
599
601
|
it('shows the API error message', async () => {
|
|
600
|
-
const
|
|
601
|
-
expect(
|
|
602
|
+
const resultsItemCount = await page.$$eval('.ons-js-autosuggest-results > *', (nodes) => nodes.length);
|
|
603
|
+
expect(resultsItemCount).toBe(1);
|
|
602
604
|
const warningText = await page.$eval('.ons-autosuggest__warning', (node) => node.textContent);
|
|
603
605
|
expect(warningText.trim()).toBe('!Sorry, there is a problem.');
|
|
604
606
|
});
|
|
605
607
|
|
|
608
|
+
it('the list and results element should be removed from the page', async () => {
|
|
609
|
+
const hasListBox = await page.$eval('.ons-autosuggest', (node) => node.classList.contains('.ons-js-autosuggest-listbox'));
|
|
610
|
+
const hasResultsTitle = await page.$eval('.ons-autosuggest', (node) => node.classList.contains('.ons-autosuggest__results-title'));
|
|
611
|
+
|
|
612
|
+
expect(hasListBox).toBe(false);
|
|
613
|
+
expect(hasResultsTitle).toBe(false);
|
|
614
|
+
});
|
|
615
|
+
|
|
606
616
|
it('the input should be disabled', async () => {
|
|
607
617
|
const hasDisabledAttribute = await page.$eval('.ons-js-autosuggest-input', (node) => node.hasAttribute('disabled'));
|
|
608
618
|
expect(hasDisabledAttribute).toBe(true);
|
|
@@ -43,6 +43,7 @@ export default class AutosuggestUI {
|
|
|
43
43
|
this.input = context.querySelector(`.${baseClass}-input`);
|
|
44
44
|
this.resultsContainer = context.querySelector(`.${baseClass}-results`);
|
|
45
45
|
this.listbox = this.resultsContainer.querySelector(`.${baseClass}-listbox`);
|
|
46
|
+
this.resultsTitleContainer = this.resultsContainer.querySelector(`.ons-autosuggest__results-title`);
|
|
46
47
|
this.instructions = context.querySelector(`.${baseClass}-instructions`);
|
|
47
48
|
this.ariaStatus = context.querySelector(`.${baseClass}-aria-status`);
|
|
48
49
|
this.form = context.closest('form');
|
|
@@ -376,7 +377,10 @@ export default class AutosuggestUI {
|
|
|
376
377
|
|
|
377
378
|
if (this.resultLimit === 100 && this.foundResults > this.resultLimit) {
|
|
378
379
|
let message = this.tooManyResults.replace('{n}', this.foundResults);
|
|
379
|
-
this.
|
|
380
|
+
this.resultsContainer.insertBefore(this.createWarningElement(message), this.resultsContainer.firstChild);
|
|
381
|
+
this.ariaStatus.setAttribute('aria-hidden', 'true');
|
|
382
|
+
this.listbox.remove();
|
|
383
|
+
this.resultsTitleContainer.remove();
|
|
380
384
|
}
|
|
381
385
|
|
|
382
386
|
this.setHighlightedResult(null);
|
|
@@ -414,9 +418,11 @@ export default class AutosuggestUI {
|
|
|
414
418
|
this.input.value = '';
|
|
415
419
|
this.label.classList.add('ons-u-lighter');
|
|
416
420
|
|
|
417
|
-
this.
|
|
418
|
-
this.
|
|
421
|
+
this.resultsContainer.insertBefore(this.createWarningElement(message), this.resultsContainer.firstChild);
|
|
422
|
+
this.ariaStatus.setAttribute('aria-hidden', 'true');
|
|
419
423
|
this.setAriaStatus(ariaMessage);
|
|
424
|
+
this.listbox.remove();
|
|
425
|
+
this.resultsTitleContainer.remove();
|
|
420
426
|
} else {
|
|
421
427
|
message = this.noResults;
|
|
422
428
|
this.listbox.innerHTML = `<li class="${classAutosuggestOption} ${classAutosuggestOptionNoResults}">${message}</li>`;
|
|
@@ -497,13 +503,12 @@ export default class AutosuggestUI {
|
|
|
497
503
|
}
|
|
498
504
|
|
|
499
505
|
createWarningElement(content) {
|
|
500
|
-
const
|
|
506
|
+
const warningContainer = document.createElement('div');
|
|
501
507
|
const warningElement = document.createElement('div');
|
|
502
508
|
const warningSpanElement = document.createElement('span');
|
|
503
509
|
const warningBodyElement = document.createElement('div');
|
|
504
510
|
|
|
505
|
-
|
|
506
|
-
warningListElement.className = 'ons-autosuggest__warning';
|
|
511
|
+
warningContainer.className = 'ons-autosuggest__warning';
|
|
507
512
|
warningElement.className = 'ons-panel ons-panel--warn ons-autosuggest__panel';
|
|
508
513
|
|
|
509
514
|
warningSpanElement.className = 'ons-panel__icon';
|
|
@@ -515,9 +520,9 @@ export default class AutosuggestUI {
|
|
|
515
520
|
|
|
516
521
|
warningElement.appendChild(warningSpanElement);
|
|
517
522
|
warningElement.appendChild(warningBodyElement);
|
|
518
|
-
|
|
523
|
+
warningContainer.appendChild(warningElement);
|
|
519
524
|
|
|
520
|
-
return
|
|
525
|
+
return warningContainer;
|
|
521
526
|
}
|
|
522
527
|
|
|
523
528
|
storeExistingSelections(value) {
|
|
@@ -5,12 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
{{ onsAutosuggest({
|
|
7
7
|
"id": "country-of-birth-autosuggest-multiple",
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
"input": {
|
|
9
|
+
"label": {
|
|
10
|
+
"text": "Passport",
|
|
11
|
+
"id": "country-of-birth-label-multiple",
|
|
12
|
+
"description": "Enter your own answer or select from suggestions. You can enter multiple countries if you have a passport for more than one."
|
|
13
|
+
},
|
|
14
|
+
"autocomplete": "off"
|
|
12
15
|
},
|
|
13
|
-
"autocomplete": "off",
|
|
14
16
|
"instructions": "Use up and down keys to navigate suggestions once you\'ve typed more than two characters. Use the enter key to select a suggestion. Touch device users, explore by touch or with swipe gestures.",
|
|
15
17
|
"ariaYouHaveSelected": "You have selected",
|
|
16
18
|
"ariaMinChars": "Enter 3 or more characters for suggestions.",
|
|
@@ -5,12 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
{{ onsAutosuggest({
|
|
7
7
|
"id": "country-of-birth-autosuggest",
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
"input": {
|
|
9
|
+
"label": {
|
|
10
|
+
"text": "Current name of country",
|
|
11
|
+
"description": "Enter your own answer or select from suggestions",
|
|
12
|
+
"id": "country-of-birth-label"
|
|
13
|
+
},
|
|
14
|
+
"autocomplete": "off"
|
|
12
15
|
},
|
|
13
|
-
"autocomplete": "off",
|
|
14
16
|
"instructions": "Use up and down keys to navigate suggestions once you\'ve typed more than two characters. Use the enter key to select a suggestion. Touch device users, explore by touch or with swipe gestures.",
|
|
15
17
|
"ariaYouHaveSelected": "You have selected",
|
|
16
18
|
"ariaMinChars": "Enter 3 or more characters for suggestions.",
|
|
@@ -6,7 +6,7 @@ async function submitButton() {
|
|
|
6
6
|
|
|
7
7
|
if (buttons.length) {
|
|
8
8
|
const SubmitButton = (await import('./button')).default;
|
|
9
|
-
buttons.forEach(button => {
|
|
9
|
+
buttons.forEach((button) => {
|
|
10
10
|
if (button.classList.contains('ons-js-timer')) {
|
|
11
11
|
submitType = 'timer';
|
|
12
12
|
} else if (button.classList.contains('ons-js-loader')) {
|
|
@@ -5,15 +5,13 @@
|
|
|
5
5
|
&__link {
|
|
6
6
|
display: flex;
|
|
7
7
|
flex-direction: column;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
&__image--reorder {
|
|
11
|
-
order: 1;
|
|
12
|
-
}
|
|
8
|
+
margin-bottom: 1rem;
|
|
9
|
+
width: fit-content;
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
& > .ons-card__title {
|
|
12
|
+
margin-bottom: 0;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
17
15
|
|
|
18
16
|
&__link:hover {
|
|
19
17
|
text-decoration-thickness: 3px;
|
|
@@ -5,36 +5,18 @@
|
|
|
5
5
|
{% set titleSize = params.titleSize | default('2') %}
|
|
6
6
|
|
|
7
7
|
<div class="ons-card">
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
</h{{ titleSize }}>
|
|
16
|
-
{% if params.image.smallSrc %}
|
|
17
|
-
<img class="ons-card__image ons-u-mb-s ons-card__image--reorder" height="200" width="303"{% if params.image.largeSrc %} srcset="{{ params.image.smallSrc }} 1x, {{ params.image.largeSrc }} 2x"{% endif %} src="{{ params.image.smallSrc }}" alt="{{ params.image.alt }}" loading="lazy">
|
|
18
|
-
{% elif params.image == true or params.image.placeholderURL %}
|
|
19
|
-
<img class="ons-card__image ons-u-mb-s ons-card__image--reorder" height="100" width="303" srcset="{{ params.image.placeholderURL if params.image.placeholderURL }}/img/small/placeholder-card.png 1x, {{ params.image.placeholderURL if params.image.placeholderURL }}/img/large/placeholder-card.png 2x" src="{{ params.image.placeholderURL if params.image.placeholderURL }}/img/small/placeholder-card.png" alt="" loading="lazy">
|
|
20
|
-
{% endif %}
|
|
21
|
-
{%- if params.url -%}
|
|
22
|
-
</a>
|
|
8
|
+
<a href="{{ params.url }}" class="ons-card__link">
|
|
9
|
+
{%- if params.image -%}
|
|
10
|
+
{% if params.image.smallSrc %}
|
|
11
|
+
<img class="ons-card__image ons-u-mb-s" height="200" width="303"{% if params.image.largeSrc %} srcset="{{ params.image.smallSrc }} 1x, {{ params.image.largeSrc }} 2x"{% endif %} src="{{ params.image.smallSrc }}" alt="{{ params.image.alt }}" loading="lazy">
|
|
12
|
+
{% elif params.image == true or params.image.placeholderURL %}
|
|
13
|
+
<img class="ons-card__image ons-u-mb-s " height="100" width="303" srcset="{{ params.image.placeholderURL if params.image.placeholderURL }}/img/small/placeholder-card.png 1x, {{ params.image.placeholderURL if params.image.placeholderURL }}/img/large/placeholder-card.png 2x" src="{{ params.image.placeholderURL if params.image.placeholderURL }}/img/small/placeholder-card.png" alt="" loading="lazy">
|
|
14
|
+
{% endif %}
|
|
23
15
|
{%- endif -%}
|
|
24
|
-
|
|
25
|
-
{%- else -%}
|
|
26
|
-
|
|
27
|
-
<h{{ titleSize }} class="ons-card__title {{ params.titleClasses | default('ons-u-fs-m') }}" id="{{ params.id }}">
|
|
28
|
-
{%- if params.url -%}
|
|
29
|
-
<a class="ons-card__link" href="{{ params.url }}">
|
|
30
|
-
{%- endif -%}
|
|
16
|
+
<h{{ titleSize }} class="ons-card__title {{ params.titleClasses | default('ons-u-fs-m')}}" id="{{ params.id }}">
|
|
31
17
|
{{ params.title }}
|
|
32
|
-
{%- if params.url -%}
|
|
33
|
-
</a>
|
|
34
|
-
{%- endif -%}
|
|
35
18
|
</h{{ titleSize }}>
|
|
36
|
-
|
|
37
|
-
{%- endif -%}
|
|
19
|
+
</a>
|
|
38
20
|
|
|
39
21
|
<p id="{{ params.textId }}">{{ params.text }}</p>
|
|
40
22
|
|