@ons/design-system 64.0.0 → 65.1.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/address-input/autosuggest.address.error.js +1 -1
- package/components/address-input/autosuggest.address.js +2 -2
- package/components/address-input/autosuggest.address.spec.js +5 -5
- package/components/autosuggest/_autosuggest.scss +11 -6
- package/components/autosuggest/_macro.njk +32 -31
- package/components/autosuggest/_macro.spec.js +18 -18
- package/components/autosuggest/autosuggest.spec.js +31 -31
- package/components/autosuggest/autosuggest.ui.js +8 -9
- 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/card/_card.scss +14 -0
- package/components/card/_macro.njk +7 -8
- package/components/checkboxes/example-checkboxes-with-revealed-checkboxes-expanded.njk +88 -0
- package/components/checkboxes/example-checkboxes-with-revealed-radios-expanded.njk +70 -0
- package/components/checkboxes/example-checkboxes-with-revealed-select-expanded.njk +72 -0
- package/components/checkboxes/example-checkboxes-with-revealed-text-input-expanded.njk +60 -0
- package/components/content-pagination/_content-pagination.scss +1 -1
- 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/document-list/_macro.njk +5 -7
- package/components/document-list/_macro.spec.js +2 -2
- package/components/document-list/example-document-list-search-result-featured.njk +1 -1
- package/components/document-list/example-document-list-search-results.njk +3 -3
- package/components/external-link/_external-link.scss +3 -3
- package/components/external-link/_macro.njk +1 -1
- package/components/fieldset/_fieldset.scss +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/header/_macro.njk +4 -4
- package/components/header/example-header-external-with-navigation.njk +5 -5
- package/components/header/example-header-external-with-service-links.njk +3 -3
- package/components/header/example-header-external-with-sub-navigation.njk +10 -10
- package/components/header/example-header-internal.njk +2 -2
- package/components/header/example-header-neutral-for-multicoloured-logo.njk +6 -6
- 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/list/_list.scss +5 -2
- package/components/list/_macro.njk +22 -10
- package/components/list/_macro.spec.js +42 -0
- package/components/mutually-exclusive/_macro.njk +4 -3
- package/components/navigation/_macro.njk +6 -6
- package/components/navigation/_macro.spec.js +4 -4
- package/components/pagination/_macro.njk +17 -2
- package/components/pagination/_pagination.scss +14 -0
- 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/question/example-question-interviewer-note.njk +1 -1
- package/components/quote/_quote.scss +1 -1
- package/components/radios/_macro.njk +1 -1
- package/components/radios/example-radios-with-clear-button-expanded.njk +98 -0
- package/components/radios/example-radios-with-revealed-checkboxes-expanded.njk +70 -0
- package/components/radios/example-radios-with-revealed-radios-expanded.njk +69 -0
- package/components/radios/example-radios-with-revealed-select-expanded.njk +70 -0
- package/components/radios/example-radios-with-revealed-text-input-expanded.njk +81 -0
- package/components/relationships/_macro.spec.js +9 -11
- package/components/relationships/example-relationships-error.njk +28 -28
- package/components/relationships/example-relationships-you.njk +29 -29
- package/components/relationships/example-relationships.njk +28 -28
- package/components/relationships/relationships.spec.js +13 -13
- package/components/reply/_macro.njk +5 -2
- package/components/reply/_macro.spec.js +7 -1
- package/components/section-navigation/_macro.njk +2 -1
- package/components/section-navigation/_macro.spec.js +2 -13
- 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/_summary.scss +1 -1
- package/components/table/_table.scss +6 -6
- package/components/table/sortable-table.js +1 -1
- package/components/tabs/_macro.njk +5 -5
- package/components/tabs/_macro.spec.js +1 -1
- package/components/tabs/example-tabs-details.njk +3 -0
- package/components/tabs/example-tabs.njk +0 -1
- package/components/textarea/example-textarea-error.njk +4 -4
- 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/cookies-settings.js +1 -1
- package/js/main.js +1 -1
- package/package.json +19 -21
- 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 -1
- package/scss/objects/_spacing.scss +3 -3
- package/scss/overrides/hcm.scss +10 -10
- package/scss/overrides/rtl.scss +2 -2
- package/scss/print.scss +2 -2
- package/components/access-code/uac.dom.js +0 -11
- /package/components/access-code/{uac.spec.js → access-code.spec.js} +0 -0
|
@@ -88,7 +88,7 @@ describe('script: autosuggest', () => {
|
|
|
88
88
|
await page.type('.ons-js-autosuggest-input', 'Unite', { delay: 20 });
|
|
89
89
|
await page.keyboard.press('ArrowDown');
|
|
90
90
|
|
|
91
|
-
const selectedOption = await page.$eval('.ons-
|
|
91
|
+
const selectedOption = await page.$eval('.ons-autosuggest__option--focused', node => node.textContent);
|
|
92
92
|
expect(selectedOption.trim()).toBe('United States of America');
|
|
93
93
|
});
|
|
94
94
|
|
|
@@ -99,7 +99,7 @@ describe('script: autosuggest', () => {
|
|
|
99
99
|
await page.keyboard.press('ArrowDown');
|
|
100
100
|
await page.keyboard.press('ArrowDown');
|
|
101
101
|
|
|
102
|
-
const selectedOption = await page.$eval('.ons-
|
|
102
|
+
const selectedOption = await page.$eval('.ons-autosuggest__option--focused', node => node.textContent);
|
|
103
103
|
expect(selectedOption.trim()).toBe('United States Virgin Islands');
|
|
104
104
|
});
|
|
105
105
|
|
|
@@ -110,10 +110,10 @@ describe('script: autosuggest', () => {
|
|
|
110
110
|
await page.keyboard.press('ArrowDown');
|
|
111
111
|
await page.keyboard.press('ArrowDown');
|
|
112
112
|
|
|
113
|
-
const ariaSelectedValue = await page.$eval('.ons-
|
|
113
|
+
const ariaSelectedValue = await page.$eval('.ons-autosuggest__option--focused', node => node.getAttribute('aria-selected'));
|
|
114
114
|
expect(ariaSelectedValue).toBe('true');
|
|
115
115
|
|
|
116
|
-
const selectedOptionId = await page.$eval('.ons-
|
|
116
|
+
const selectedOptionId = await page.$eval('.ons-autosuggest__option--focused', node => node.getAttribute('id'));
|
|
117
117
|
const ariaActiveDescendant = await page.$eval('.ons-js-autosuggest-input', node => node.getAttribute('aria-activedescendant'));
|
|
118
118
|
expect(ariaActiveDescendant).toBe(selectedOptionId);
|
|
119
119
|
});
|
|
@@ -135,7 +135,7 @@ describe('script: autosuggest', () => {
|
|
|
135
135
|
await page.keyboard.press('ArrowDown');
|
|
136
136
|
await page.keyboard.press('ArrowDown');
|
|
137
137
|
|
|
138
|
-
const selectedSuggestionCount = await page.$$eval('.ons-
|
|
138
|
+
const selectedSuggestionCount = await page.$$eval('.ons-autosuggest__option[aria-selected=true]', nodes => nodes.length);
|
|
139
139
|
expect(selectedSuggestionCount).toBe(1);
|
|
140
140
|
});
|
|
141
141
|
|
|
@@ -147,7 +147,7 @@ describe('script: autosuggest', () => {
|
|
|
147
147
|
await page.keyboard.press('ArrowDown');
|
|
148
148
|
await page.keyboard.press('ArrowDown');
|
|
149
149
|
|
|
150
|
-
const selectedOption = await page.$eval('.ons-
|
|
150
|
+
const selectedOption = await page.$eval('.ons-autosuggest__option--focused', node => node.textContent);
|
|
151
151
|
expect(selectedOption.trim()).toBe('United States Virgin Islands');
|
|
152
152
|
});
|
|
153
153
|
|
|
@@ -174,7 +174,7 @@ describe('script: autosuggest', () => {
|
|
|
174
174
|
await page.type('.ons-js-autosuggest-input', 'Unite', { delay: 20 });
|
|
175
175
|
await page.keyboard.press('ArrowUp');
|
|
176
176
|
|
|
177
|
-
const selectedOption = await page.$eval('.ons-
|
|
177
|
+
const selectedOption = await page.$eval('.ons-autosuggest__option--focused', node => node.textContent);
|
|
178
178
|
expect(selectedOption.trim()).toBe('United States of America');
|
|
179
179
|
});
|
|
180
180
|
|
|
@@ -186,7 +186,7 @@ describe('script: autosuggest', () => {
|
|
|
186
186
|
await page.keyboard.press('ArrowDown');
|
|
187
187
|
await page.keyboard.press('ArrowUp');
|
|
188
188
|
|
|
189
|
-
const selectedOption = await page.$eval('.ons-
|
|
189
|
+
const selectedOption = await page.$eval('.ons-autosuggest__option--focused', node => node.textContent);
|
|
190
190
|
expect(selectedOption.trim()).toBe('United States of America');
|
|
191
191
|
});
|
|
192
192
|
|
|
@@ -198,10 +198,10 @@ describe('script: autosuggest', () => {
|
|
|
198
198
|
await page.keyboard.press('ArrowDown');
|
|
199
199
|
await page.keyboard.press('ArrowUp');
|
|
200
200
|
|
|
201
|
-
const ariaSelectedValue = await page.$eval('.ons-
|
|
201
|
+
const ariaSelectedValue = await page.$eval('.ons-autosuggest__option--focused', node => node.getAttribute('aria-selected'));
|
|
202
202
|
expect(ariaSelectedValue).toBe('true');
|
|
203
203
|
|
|
204
|
-
const selectedOptionId = await page.$eval('.ons-
|
|
204
|
+
const selectedOptionId = await page.$eval('.ons-autosuggest__option--focused', node => node.getAttribute('id'));
|
|
205
205
|
const ariaActiveDescendant = await page.$eval('.ons-js-autosuggest-input', node => node.getAttribute('aria-activedescendant'));
|
|
206
206
|
expect(ariaActiveDescendant).toBe(selectedOptionId);
|
|
207
207
|
});
|
|
@@ -214,7 +214,7 @@ describe('script: autosuggest', () => {
|
|
|
214
214
|
await page.keyboard.press('ArrowDown');
|
|
215
215
|
await page.keyboard.press('ArrowUp');
|
|
216
216
|
|
|
217
|
-
const selectedSuggestionCount = await page.$$eval('.ons-
|
|
217
|
+
const selectedSuggestionCount = await page.$$eval('.ons-autosuggest__option[aria-selected=true]', nodes => nodes.length);
|
|
218
218
|
expect(selectedSuggestionCount).toBe(1);
|
|
219
219
|
});
|
|
220
220
|
|
|
@@ -225,7 +225,7 @@ describe('script: autosuggest', () => {
|
|
|
225
225
|
await page.keyboard.press('ArrowUp');
|
|
226
226
|
await page.keyboard.press('ArrowUp');
|
|
227
227
|
|
|
228
|
-
const selectedOption = await page.$eval('.ons-
|
|
228
|
+
const selectedOption = await page.$eval('.ons-autosuggest__option--focused', node => node.textContent);
|
|
229
229
|
expect(selectedOption.trim()).toBe('United States of America');
|
|
230
230
|
});
|
|
231
231
|
|
|
@@ -264,15 +264,15 @@ describe('script: autosuggest', () => {
|
|
|
264
264
|
await page.type('.ons-js-autosuggest-input', 'Unite', { delay: 20 });
|
|
265
265
|
await page.keyboard.press('Tab');
|
|
266
266
|
|
|
267
|
-
const suggestionCountSample1 = await page.$$eval('.ons-
|
|
267
|
+
const suggestionCountSample1 = await page.$$eval('.ons-autosuggest__option', nodes => nodes.length);
|
|
268
268
|
expect(suggestionCountSample1).toBe(2);
|
|
269
269
|
|
|
270
270
|
await page.waitForTimeout(200);
|
|
271
|
-
const suggestionCountSample2 = await page.$$eval('.ons-
|
|
271
|
+
const suggestionCountSample2 = await page.$$eval('.ons-autosuggest__option', nodes => nodes.length);
|
|
272
272
|
expect(suggestionCountSample2).toBe(2);
|
|
273
273
|
|
|
274
274
|
await page.waitForTimeout(320);
|
|
275
|
-
const suggestionCountSample3 = await page.$$eval('.ons-
|
|
275
|
+
const suggestionCountSample3 = await page.$$eval('.ons-autosuggest__option', nodes => nodes.length);
|
|
276
276
|
expect(suggestionCountSample3).toBe(0);
|
|
277
277
|
});
|
|
278
278
|
|
|
@@ -294,7 +294,7 @@ describe('script: autosuggest', () => {
|
|
|
294
294
|
await page.keyboard.press('Tab');
|
|
295
295
|
await page.waitForTimeout(320);
|
|
296
296
|
|
|
297
|
-
const hasClass = await page.$eval('.ons-autosuggest
|
|
297
|
+
const hasClass = await page.$eval('.ons-autosuggest', node => node.classList.contains('ons-autosuggest--has-results'));
|
|
298
298
|
expect(hasClass).toBe(false);
|
|
299
299
|
});
|
|
300
300
|
|
|
@@ -316,7 +316,7 @@ describe('script: autosuggest', () => {
|
|
|
316
316
|
await setTestPage('/test', renderComponent('autosuggest', EXAMPLE_AUTOSUGGEST));
|
|
317
317
|
|
|
318
318
|
await page.type('.ons-js-autosuggest-input', 'Unite', { delay: 20 });
|
|
319
|
-
await page.click('.ons-
|
|
319
|
+
await page.click('.ons-autosuggest__option:nth-child(2)');
|
|
320
320
|
|
|
321
321
|
const inputValue = await page.$eval('.ons-js-autosuggest-input', node => node.value);
|
|
322
322
|
expect(inputValue).toBe('United States Virgin Islands');
|
|
@@ -329,7 +329,7 @@ describe('script: autosuggest', () => {
|
|
|
329
329
|
|
|
330
330
|
await page.type('.ons-js-autosuggest-input', 'En', { delay: 20 });
|
|
331
331
|
|
|
332
|
-
const suggestionCount = await page.$$eval('.ons-
|
|
332
|
+
const suggestionCount = await page.$$eval('.ons-autosuggest__option', nodes => nodes.length);
|
|
333
333
|
expect(suggestionCount).toBe(0);
|
|
334
334
|
});
|
|
335
335
|
|
|
@@ -338,7 +338,7 @@ describe('script: autosuggest', () => {
|
|
|
338
338
|
|
|
339
339
|
await page.type('.ons-js-autosuggest-input', 'Eng', { delay: 20 });
|
|
340
340
|
|
|
341
|
-
const suggestionCount = await page.$$eval('.ons-
|
|
341
|
+
const suggestionCount = await page.$$eval('.ons-autosuggest__option', nodes => nodes.length);
|
|
342
342
|
expect(suggestionCount).toBe(1);
|
|
343
343
|
});
|
|
344
344
|
});
|
|
@@ -349,9 +349,9 @@ describe('script: autosuggest', () => {
|
|
|
349
349
|
|
|
350
350
|
await page.type('.ons-js-autosuggest-input', 'state', { delay: 20 });
|
|
351
351
|
await page.keyboard.press('ArrowDown');
|
|
352
|
-
await page.hover('.ons-
|
|
352
|
+
await page.hover('.ons-autosuggest__option:nth-child(2)');
|
|
353
353
|
|
|
354
|
-
const focusedClassCount = await page.$$eval('.ons-
|
|
354
|
+
const focusedClassCount = await page.$$eval('.ons-autosuggest__option--focused', nodes => nodes.length);
|
|
355
355
|
expect(focusedClassCount).toBe(0);
|
|
356
356
|
});
|
|
357
357
|
});
|
|
@@ -368,10 +368,10 @@ describe('script: autosuggest', () => {
|
|
|
368
368
|
|
|
369
369
|
await page.type('.ons-js-autosuggest-input', 'state', { delay: 20 });
|
|
370
370
|
await page.keyboard.press('ArrowDown');
|
|
371
|
-
await page.hover('.ons-
|
|
371
|
+
await page.hover('.ons-autosuggest__option:nth-child(2)');
|
|
372
372
|
await page.hover('#dummy');
|
|
373
373
|
|
|
374
|
-
const focusedClassCount = await page.$$eval('.ons-
|
|
374
|
+
const focusedClassCount = await page.$$eval('.ons-autosuggest__option--focused', nodes => nodes.length);
|
|
375
375
|
expect(focusedClassCount).toBe(1);
|
|
376
376
|
});
|
|
377
377
|
});
|
|
@@ -384,7 +384,7 @@ describe('script: autosuggest', () => {
|
|
|
384
384
|
await page.keyboard.press('ArrowDown');
|
|
385
385
|
await page.type('.ons-js-autosuggest-input', 'd', { delay: 20 });
|
|
386
386
|
|
|
387
|
-
const focusedNodeCount = await page.$$eval('.ons-
|
|
387
|
+
const focusedNodeCount = await page.$$eval('.ons-autosuggest__option--focused', nodes => nodes.length);
|
|
388
388
|
expect(focusedNodeCount).toBe(0);
|
|
389
389
|
});
|
|
390
390
|
|
|
@@ -402,7 +402,7 @@ describe('script: autosuggest', () => {
|
|
|
402
402
|
|
|
403
403
|
await page.type('.ons-js-autosuggest-input', 'Unite', { delay: 20 });
|
|
404
404
|
|
|
405
|
-
const emboldened = await page.$$eval('.ons-
|
|
405
|
+
const emboldened = await page.$$eval('.ons-autosuggest__option strong', nodes => nodes.map(node => node.textContent));
|
|
406
406
|
expect(emboldened).toEqual(['Unite', 'Unite']);
|
|
407
407
|
});
|
|
408
408
|
|
|
@@ -411,9 +411,9 @@ describe('script: autosuggest', () => {
|
|
|
411
411
|
|
|
412
412
|
await page.type('.ons-js-autosuggest-input', 'tland', { delay: 20 });
|
|
413
413
|
|
|
414
|
-
const matchCount = await page.$$eval('.ons-
|
|
414
|
+
const matchCount = await page.$$eval('.ons-autosuggest__option', nodes => nodes.length);
|
|
415
415
|
expect(matchCount).toBe(2);
|
|
416
|
-
const emboldened = await page.$$eval('.ons-
|
|
416
|
+
const emboldened = await page.$$eval('.ons-autosuggest__option strong', nodes => nodes.map(node => node.textContent));
|
|
417
417
|
expect(emboldened).toEqual(['tland']);
|
|
418
418
|
});
|
|
419
419
|
|
|
@@ -452,7 +452,7 @@ describe('script: autosuggest', () => {
|
|
|
452
452
|
|
|
453
453
|
await page.type('.ons-js-autosuggest-input', 'abc', { delay: 20 });
|
|
454
454
|
|
|
455
|
-
const noResultsContent = await page.$eval('.ons-
|
|
455
|
+
const noResultsContent = await page.$eval('.ons-autosuggest__option--no-results', node => node.textContent);
|
|
456
456
|
expect(noResultsContent).toBe('No suggestions found.');
|
|
457
457
|
});
|
|
458
458
|
|
|
@@ -496,7 +496,7 @@ describe('script: autosuggest', () => {
|
|
|
496
496
|
|
|
497
497
|
await page.type('.ons-js-autosuggest-input', 'abc', { delay: 20 });
|
|
498
498
|
|
|
499
|
-
const matchCount = await page.$$eval('.ons-
|
|
499
|
+
const matchCount = await page.$$eval('.ons-autosuggest__option', nodes => nodes.length);
|
|
500
500
|
expect(matchCount).toBe(0);
|
|
501
501
|
});
|
|
502
502
|
|
|
@@ -534,7 +534,7 @@ describe('script: autosuggest', () => {
|
|
|
534
534
|
it('shows the type more message', async () => {
|
|
535
535
|
const listItemCount = await page.$$eval('.ons-js-autosuggest-listbox > *', nodes => nodes.length);
|
|
536
536
|
expect(listItemCount).toBe(1);
|
|
537
|
-
const noResultsText = await page.$eval('.ons-
|
|
537
|
+
const noResultsText = await page.$eval('.ons-autosuggest__option--no-results', node => node.innerText);
|
|
538
538
|
expect(noResultsText.trim()).toBe('Continue entering to get suggestions');
|
|
539
539
|
});
|
|
540
540
|
});
|
|
@@ -565,7 +565,7 @@ describe('script: autosuggest', () => {
|
|
|
565
565
|
it('shows the API error message', async () => {
|
|
566
566
|
const listItemCount = await page.$$eval('.ons-js-autosuggest-listbox > *', nodes => nodes.length);
|
|
567
567
|
expect(listItemCount).toBe(1);
|
|
568
|
-
const warningText = await page.$eval('.ons-
|
|
568
|
+
const warningText = await page.$eval('.ons-autosuggest__warning', node => node.textContent);
|
|
569
569
|
expect(warningText.trim()).toBe('!Sorry, there is a problem.');
|
|
570
570
|
});
|
|
571
571
|
|
|
@@ -4,12 +4,12 @@ import runFuse from './fuse-config';
|
|
|
4
4
|
|
|
5
5
|
export const baseClass = 'ons-js-autosuggest';
|
|
6
6
|
|
|
7
|
-
export const classAutosuggestOption = 'ons-
|
|
7
|
+
export const classAutosuggestOption = 'ons-autosuggest__option';
|
|
8
8
|
export const classAutosuggestOptionFocused = `${classAutosuggestOption}--focused`;
|
|
9
9
|
export const classAutosuggestOptionNoResults = `${classAutosuggestOption}--no-results`;
|
|
10
10
|
export const classAutosuggestOptionMoreResults = `${classAutosuggestOption}--more-results ons-u-fs-s`;
|
|
11
|
-
export const classAutosuggestHasResults = 'ons-autosuggest
|
|
12
|
-
export const classAutosuggestResultsTitle = 'ons-
|
|
11
|
+
export const classAutosuggestHasResults = 'ons-autosuggest--has-results';
|
|
12
|
+
export const classAutosuggestResultsTitle = 'ons-autosuggest__results-title';
|
|
13
13
|
|
|
14
14
|
export default class AutosuggestUI {
|
|
15
15
|
constructor({
|
|
@@ -117,7 +117,7 @@ export default class AutosuggestUI {
|
|
|
117
117
|
this.input.setAttribute('autocomplete', this.input.getAttribute('autocomplete') || 'off');
|
|
118
118
|
this.input.setAttribute('role', 'combobox');
|
|
119
119
|
|
|
120
|
-
this.context.classList.add('ons-autosuggest
|
|
120
|
+
this.context.classList.add('ons-autosuggest--initialised');
|
|
121
121
|
|
|
122
122
|
this.bindEventListeners();
|
|
123
123
|
}
|
|
@@ -350,8 +350,7 @@ export default class AutosuggestUI {
|
|
|
350
350
|
listElement.setAttribute('id', `${this.listboxId}__option--${index}`);
|
|
351
351
|
listElement.setAttribute('role', 'option');
|
|
352
352
|
if (result.category) {
|
|
353
|
-
innerHTML =
|
|
354
|
-
innerHTML + `<span class="ons-autosuggest-input__category ons-u-lighter ons-u-fs-s ons-u-db">${result.category}</span>`;
|
|
353
|
+
innerHTML = innerHTML + `<span class="ons-autosuggest__category ons-u-lighter ons-u-fs-s ons-u-db">${result.category}</span>`;
|
|
355
354
|
}
|
|
356
355
|
listElement.innerHTML = innerHTML;
|
|
357
356
|
listElement.addEventListener('click', () => {
|
|
@@ -434,7 +433,7 @@ export default class AutosuggestUI {
|
|
|
434
433
|
option.classList.add(classAutosuggestOptionFocused);
|
|
435
434
|
option.setAttribute('aria-selected', true);
|
|
436
435
|
this.input.setAttribute('aria-activedescendant', option.getAttribute('id'));
|
|
437
|
-
const groupedResult = option.querySelector('.ons-
|
|
436
|
+
const groupedResult = option.querySelector('.ons-autosuggest__group');
|
|
438
437
|
const optionText = option.innerHTML.replace('<strong>', '').replace('</strong>', '');
|
|
439
438
|
if (groupedResult) {
|
|
440
439
|
let groupedAriaMsg = this.ariaGroupedResults.replace('{n}', groupedResult.innerHTML);
|
|
@@ -503,8 +502,8 @@ export default class AutosuggestUI {
|
|
|
503
502
|
const warningBodyElement = document.createElement('div');
|
|
504
503
|
|
|
505
504
|
warningListElement.setAttribute('aria-hidden', 'true');
|
|
506
|
-
warningListElement.className = 'ons-
|
|
507
|
-
warningElement.className = 'ons-panel ons-panel--warn ons-
|
|
505
|
+
warningListElement.className = 'ons-autosuggest__warning';
|
|
506
|
+
warningElement.className = 'ons-panel ons-panel--warn ons-autosuggest__panel';
|
|
508
507
|
|
|
509
508
|
warningSpanElement.className = 'ons-panel__icon';
|
|
510
509
|
warningSpanElement.setAttribute('aria-hidden', 'true');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
$breadcrumb-chevron-height: 0.65rem;
|
|
2
2
|
|
|
3
|
-
.ons-
|
|
3
|
+
.ons-breadcrumbs {
|
|
4
4
|
align-items: center;
|
|
5
5
|
display: flex;
|
|
6
6
|
padding: 1rem 0;
|
|
@@ -20,7 +20,7 @@ $breadcrumb-chevron-height: 0.65rem;
|
|
|
20
20
|
display: none;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
.ons-
|
|
23
|
+
.ons-icon {
|
|
24
24
|
height: $breadcrumb-chevron-height;
|
|
25
25
|
margin: 0 0.2rem;
|
|
26
26
|
vertical-align: middle;
|
|
@@ -30,7 +30,7 @@ $breadcrumb-chevron-height: 0.65rem;
|
|
|
30
30
|
&:nth-last-child(1) {
|
|
31
31
|
// small screen last child
|
|
32
32
|
direction: rtl;
|
|
33
|
-
.ons-
|
|
33
|
+
.ons-icon {
|
|
34
34
|
margin-left: -0.13rem;
|
|
35
35
|
transform: rotate(180deg);
|
|
36
36
|
}
|
|
@@ -46,7 +46,7 @@ $breadcrumb-chevron-height: 0.65rem;
|
|
|
46
46
|
&:nth-last-child(1) {
|
|
47
47
|
// last child
|
|
48
48
|
direction: ltr;
|
|
49
|
-
.ons-
|
|
49
|
+
.ons-icon {
|
|
50
50
|
display: none;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -54,13 +54,13 @@ $breadcrumb-chevron-height: 0.65rem;
|
|
|
54
54
|
&:first-child:nth-last-child(1) {
|
|
55
55
|
//first and last child
|
|
56
56
|
direction: rtl;
|
|
57
|
-
.ons-
|
|
57
|
+
.ons-icon {
|
|
58
58
|
display: inline-block;
|
|
59
59
|
vertical-align: middle;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
&:not(:last-child).ons-
|
|
63
|
+
&:not(:last-child).ons-icon {
|
|
64
64
|
//not last child
|
|
65
65
|
margin: 0;
|
|
66
66
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{% from "components/icon/_macro.njk" import onsIcon %}
|
|
2
2
|
|
|
3
3
|
{% macro onsBreadcrumbs(params) %}
|
|
4
|
-
<nav class="ons-
|
|
5
|
-
<ol class="ons-
|
|
4
|
+
<nav class="ons-breadcrumbs{{ ' ' + params.classes if params.classes else '' }}" aria-label="{{ params.ariaLabel | default("Breadcrumbs") }}" {% if params.id %} id="{{ params.id }}"{% endif %}>
|
|
5
|
+
<ol class="ons-breadcrumbs__items ons-u-fs-s">
|
|
6
6
|
{% for item in params.itemsList %}
|
|
7
|
-
<li class="ons-
|
|
8
|
-
<a class="ons-
|
|
7
|
+
<li class="ons-breadcrumbs__item{{ ' ' + item.itemClasses if item.itemClasses else '' }}" id="breadcrumb-{{ loop.index }}">
|
|
8
|
+
<a class="ons-breadcrumbs__link{{ ' ' + item.linkClasses if item.linkClasses else '' }}" href="{{ item.url }}"{% if item.id %} id="{{ item.id }}"{% endif %}
|
|
9
9
|
{% if item.attributes %}{% for attribute, value in (item.attributes.items() if item.attributes is mapping and item.attributes.items else item.attributes) %}{{attribute}}="{{value}}" {% endfor %}{% endif %}
|
|
10
10
|
>{{ item.text }}</a>
|
|
11
11
|
{{
|
|
@@ -58,62 +58,62 @@ describe('macro: breadcrumbs', () => {
|
|
|
58
58
|
it('has additionally provided style classes', () => {
|
|
59
59
|
const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS));
|
|
60
60
|
|
|
61
|
-
expect($('.ons-
|
|
62
|
-
expect($('.ons-
|
|
61
|
+
expect($('.ons-breadcrumbs').hasClass('extra-class')).toBe(true);
|
|
62
|
+
expect($('.ons-breadcrumbs').hasClass('another-extra-class')).toBe(true);
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
it('has a default `aria-label` of "Breadcrumbs"', () => {
|
|
66
66
|
const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS_MINIMAL));
|
|
67
67
|
|
|
68
|
-
expect($('.ons-
|
|
68
|
+
expect($('.ons-breadcrumbs').attr('aria-label')).toBe('Breadcrumbs');
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
it('has the provided `ariaLabel` for `aria-label`', () => {
|
|
72
72
|
const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS));
|
|
73
73
|
|
|
74
|
-
expect($('.ons-
|
|
74
|
+
expect($('.ons-breadcrumbs').attr('aria-label')).toBe('Breadcrumbs label');
|
|
75
75
|
});
|
|
76
76
|
|
|
77
77
|
it('has the provided `id`', () => {
|
|
78
78
|
const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS));
|
|
79
79
|
|
|
80
|
-
expect($('.ons-
|
|
80
|
+
expect($('.ons-breadcrumbs').attr('id')).toBe('example-breadcrumbs');
|
|
81
81
|
});
|
|
82
82
|
|
|
83
83
|
it('has additionally provided style classes on `item` element', () => {
|
|
84
84
|
const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS));
|
|
85
85
|
|
|
86
|
-
expect($('.ons-
|
|
87
|
-
expect($('.ons-
|
|
86
|
+
expect($('.ons-breadcrumbs__item:first').hasClass('item-extra-class')).toBe(true);
|
|
87
|
+
expect($('.ons-breadcrumbs__item:first').hasClass('item-another-extra-class')).toBe(true);
|
|
88
88
|
});
|
|
89
89
|
|
|
90
90
|
it('has additionally provided style classes on `link` element', () => {
|
|
91
91
|
const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS));
|
|
92
92
|
|
|
93
|
-
expect($('.ons-
|
|
94
|
-
expect($('.ons-
|
|
93
|
+
expect($('.ons-breadcrumbs__link:first').hasClass('link-extra-class')).toBe(true);
|
|
94
|
+
expect($('.ons-breadcrumbs__link:first').hasClass('link-another-extra-class')).toBe(true);
|
|
95
95
|
});
|
|
96
96
|
|
|
97
97
|
it('has provided `url` on `link` elements', () => {
|
|
98
98
|
const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS));
|
|
99
99
|
|
|
100
|
-
const urls = mapAll($('.ons-
|
|
100
|
+
const urls = mapAll($('.ons-breadcrumbs__link'), node => node.attr('href'));
|
|
101
101
|
expect(urls).toEqual(['https://example.com/', 'https://example.com/guide/']);
|
|
102
102
|
});
|
|
103
103
|
|
|
104
104
|
it('has provided `text` on `link` elements', () => {
|
|
105
105
|
const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS));
|
|
106
106
|
|
|
107
|
-
const labels = mapAll($('.ons-
|
|
107
|
+
const labels = mapAll($('.ons-breadcrumbs__link'), node => node.text().trim());
|
|
108
108
|
expect(labels).toEqual(['Home', 'Guide']);
|
|
109
109
|
});
|
|
110
110
|
|
|
111
111
|
it('has provided `attributes` on `link` elements', () => {
|
|
112
112
|
const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS));
|
|
113
113
|
|
|
114
|
-
const testValuesA = mapAll($('.ons-
|
|
114
|
+
const testValuesA = mapAll($('.ons-breadcrumbs__link'), node => node.attr('data-a'));
|
|
115
115
|
expect(testValuesA).toEqual(['123', '789']);
|
|
116
|
-
const testValuesB = mapAll($('.ons-
|
|
116
|
+
const testValuesB = mapAll($('.ons-breadcrumbs__link'), node => node.attr('data-b'));
|
|
117
117
|
expect(testValuesB).toEqual(['456', 'ABC']);
|
|
118
118
|
});
|
|
119
119
|
|
|
@@ -31,7 +31,7 @@ $button-shadow-size: 3px;
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
&--search {
|
|
34
|
-
.ons-
|
|
34
|
+
.ons-icon {
|
|
35
35
|
@include mq(s, l) {
|
|
36
36
|
margin-right: 0.5rem;
|
|
37
37
|
}
|
|
@@ -49,7 +49,7 @@ $button-shadow-size: 3px;
|
|
|
49
49
|
pointer-events: none;
|
|
50
50
|
position: relative;
|
|
51
51
|
|
|
52
|
-
.ons-
|
|
52
|
+
.ons-icon {
|
|
53
53
|
fill: var(--ons-color-text-inverse);
|
|
54
54
|
height: 18px;
|
|
55
55
|
margin-top: -$button-shadow-size;
|
|
@@ -76,7 +76,7 @@ $button-shadow-size: 3px;
|
|
|
76
76
|
box-shadow: 0 ems($button-shadow-size) 0 var(--ons-color-text-link-focus);
|
|
77
77
|
color: var(--ons-color-text-link-focus);
|
|
78
78
|
|
|
79
|
-
.ons-
|
|
79
|
+
.ons-icon {
|
|
80
80
|
fill: var(--ons-color-text-link-focus);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
@@ -93,7 +93,7 @@ $button-shadow-size: 3px;
|
|
|
93
93
|
box-shadow: none;
|
|
94
94
|
color: var(--ons-color-text-inverse);
|
|
95
95
|
|
|
96
|
-
.ons-
|
|
96
|
+
.ons-icon {
|
|
97
97
|
fill: var(--ons-color-text-inverse);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
@@ -112,7 +112,7 @@ $button-shadow-size: 3px;
|
|
|
112
112
|
&--small & {
|
|
113
113
|
&__inner {
|
|
114
114
|
padding: 0.5em 0.7em;
|
|
115
|
-
.ons-
|
|
115
|
+
.ons-icon {
|
|
116
116
|
height: 16px;
|
|
117
117
|
width: 16px;
|
|
118
118
|
}
|
|
@@ -141,7 +141,7 @@ $button-shadow-size: 3px;
|
|
|
141
141
|
color: var(--ons-color-text);
|
|
142
142
|
font-weight: $font-weight-regular;
|
|
143
143
|
|
|
144
|
-
.ons-
|
|
144
|
+
.ons-icon {
|
|
145
145
|
fill: var(--ons-color-text);
|
|
146
146
|
}
|
|
147
147
|
}
|
|
@@ -177,7 +177,7 @@ $button-shadow-size: 3px;
|
|
|
177
177
|
outline: inherit;
|
|
178
178
|
|
|
179
179
|
&__inner {
|
|
180
|
-
.ons-
|
|
180
|
+
.ons-icon {
|
|
181
181
|
fill: var(--ons-color-text);
|
|
182
182
|
}
|
|
183
183
|
}
|
|
@@ -196,7 +196,7 @@ $button-shadow-size: 3px;
|
|
|
196
196
|
color: var(--ons-color-text-link);
|
|
197
197
|
font-weight: $font-weight-regular;
|
|
198
198
|
padding: 0;
|
|
199
|
-
.ons-
|
|
199
|
+
.ons-icon {
|
|
200
200
|
fill: var(--ons-color-text-link);
|
|
201
201
|
}
|
|
202
202
|
}
|
|
@@ -205,7 +205,7 @@ $button-shadow-size: 3px;
|
|
|
205
205
|
&--text-link-inverse & {
|
|
206
206
|
&__inner {
|
|
207
207
|
color: var(--ons-color-text-inverse-link);
|
|
208
|
-
.ons-
|
|
208
|
+
.ons-icon {
|
|
209
209
|
fill: var(--ons-color-text-inverse-link);
|
|
210
210
|
}
|
|
211
211
|
}
|
|
@@ -217,7 +217,7 @@ $button-shadow-size: 3px;
|
|
|
217
217
|
&__inner {
|
|
218
218
|
background: none;
|
|
219
219
|
color: var(--ons-color-text-link-hover);
|
|
220
|
-
.ons-
|
|
220
|
+
.ons-icon {
|
|
221
221
|
fill: var(--ons-color-text-link-hover);
|
|
222
222
|
}
|
|
223
223
|
}
|
|
@@ -228,7 +228,7 @@ $button-shadow-size: 3px;
|
|
|
228
228
|
&--text-link-inverse.active & {
|
|
229
229
|
&__inner {
|
|
230
230
|
color: var(--ons-color-text-inverse-link-hover);
|
|
231
|
-
.ons-
|
|
231
|
+
.ons-icon {
|
|
232
232
|
fill: var(--ons-color-text-inverse-link-hover);
|
|
233
233
|
}
|
|
234
234
|
}
|
|
@@ -247,7 +247,7 @@ $button-shadow-size: 3px;
|
|
|
247
247
|
background-color: var(--ons-color-focus);
|
|
248
248
|
box-shadow: 0 -2px var(--ons-color-focus), 0 4px var(--ons-color-text-link-focus) !important;
|
|
249
249
|
color: var(--ons-color-text-link-focus);
|
|
250
|
-
.ons-
|
|
250
|
+
.ons-icon {
|
|
251
251
|
fill: var(--ons-color-text-link-focus);
|
|
252
252
|
}
|
|
253
253
|
}
|
|
@@ -259,7 +259,7 @@ $button-shadow-size: 3px;
|
|
|
259
259
|
border: 2px solid rgba(255, 255, 255, 0.6);
|
|
260
260
|
box-shadow: none;
|
|
261
261
|
color: var(--ons-color-text-inverse);
|
|
262
|
-
.ons-
|
|
262
|
+
.ons-icon {
|
|
263
263
|
fill: var(--ons-color-text-inverse);
|
|
264
264
|
}
|
|
265
265
|
}
|
|
@@ -271,7 +271,7 @@ $button-shadow-size: 3px;
|
|
|
271
271
|
border: 2px solid var(--ons-color-black);
|
|
272
272
|
box-shadow: none;
|
|
273
273
|
color: var(--ons-color-text);
|
|
274
|
-
.ons-
|
|
274
|
+
.ons-icon {
|
|
275
275
|
fill: var(--ons-color-text);
|
|
276
276
|
}
|
|
277
277
|
}
|
|
@@ -306,7 +306,7 @@ $button-shadow-size: 3px;
|
|
|
306
306
|
&--dropdown:focus:hover & {
|
|
307
307
|
&__inner {
|
|
308
308
|
color: var(--ons-color-text);
|
|
309
|
-
.ons-
|
|
309
|
+
.ons-icon {
|
|
310
310
|
fill: var(--ons-color-text);
|
|
311
311
|
}
|
|
312
312
|
}
|
|
@@ -326,7 +326,7 @@ $button-shadow-size: 3px;
|
|
|
326
326
|
background: rgba(0, 0, 0, 0.2);
|
|
327
327
|
border-color: rgba(255, 255, 255, 0.6);
|
|
328
328
|
color: var(--ons-color-text-inverse);
|
|
329
|
-
.ons-
|
|
329
|
+
.ons-icon {
|
|
330
330
|
fill: var(--ons-color-text-inverse);
|
|
331
331
|
}
|
|
332
332
|
}
|
|
@@ -340,7 +340,7 @@ $button-shadow-size: 3px;
|
|
|
340
340
|
background: var(--ons-color-black);
|
|
341
341
|
border-color: var(--ons-color-black);
|
|
342
342
|
color: var(--ons-color-white);
|
|
343
|
-
.ons-
|
|
343
|
+
.ons-icon {
|
|
344
344
|
fill: var(--ons-color-white);
|
|
345
345
|
}
|
|
346
346
|
}
|
|
@@ -352,7 +352,7 @@ $button-shadow-size: 3px;
|
|
|
352
352
|
&__inner {
|
|
353
353
|
background: var(--ons-color-focus);
|
|
354
354
|
color: var(--ons-color-text-link-focus);
|
|
355
|
-
.ons-
|
|
355
|
+
.ons-icon {
|
|
356
356
|
fill: var(--ons-color-text-link-focus);
|
|
357
357
|
}
|
|
358
358
|
}
|
|
@@ -364,7 +364,7 @@ $button-shadow-size: 3px;
|
|
|
364
364
|
&__inner {
|
|
365
365
|
border-color: var(--ons-color-text-link-focus);
|
|
366
366
|
box-shadow: 0 0 0 1px var(--ons-color-text-link-focus);
|
|
367
|
-
.ons-
|
|
367
|
+
.ons-icon {
|
|
368
368
|
fill: var(--ons-color-black);
|
|
369
369
|
}
|
|
370
370
|
}
|
|
@@ -374,7 +374,7 @@ $button-shadow-size: 3px;
|
|
|
374
374
|
&__inner {
|
|
375
375
|
position: relative;
|
|
376
376
|
transition: color 0.3s ease-in-out;
|
|
377
|
-
.ons-
|
|
377
|
+
.ons-icon {
|
|
378
378
|
height: 27px;
|
|
379
379
|
left: 50%;
|
|
380
380
|
margin: 0;
|
|
@@ -389,7 +389,7 @@ $button-shadow-size: 3px;
|
|
|
389
389
|
}
|
|
390
390
|
|
|
391
391
|
&--loader.ons-btn--small {
|
|
392
|
-
.ons-
|
|
392
|
+
.ons-icon {
|
|
393
393
|
height: 24px;
|
|
394
394
|
width: 24px;
|
|
395
395
|
}
|
|
@@ -398,7 +398,7 @@ $button-shadow-size: 3px;
|
|
|
398
398
|
&--loader.ons-is-loading & {
|
|
399
399
|
&__inner {
|
|
400
400
|
color: transparent;
|
|
401
|
-
.ons-
|
|
401
|
+
.ons-icon {
|
|
402
402
|
margin-left: 0 !important;
|
|
403
403
|
opacity: 1;
|
|
404
404
|
}
|
|
@@ -423,14 +423,14 @@ $button-shadow-size: 3px;
|
|
|
423
423
|
|
|
424
424
|
&--mobile[aria-expanded='true'],
|
|
425
425
|
&--text-link[aria-expanded='true'] {
|
|
426
|
-
.ons-
|
|
426
|
+
.ons-icon {
|
|
427
427
|
transform: rotate(270deg);
|
|
428
428
|
}
|
|
429
429
|
}
|
|
430
430
|
|
|
431
431
|
&--mobile,
|
|
432
432
|
&--text-link {
|
|
433
|
-
.ons-
|
|
433
|
+
.ons-icon {
|
|
434
434
|
transform: rotate(90deg);
|
|
435
435
|
}
|
|
436
436
|
|
|
@@ -479,7 +479,7 @@ $button-shadow-size: 3px;
|
|
|
479
479
|
padding: 0.6rem 1rem;
|
|
480
480
|
text-align: left;
|
|
481
481
|
|
|
482
|
-
.ons-
|
|
482
|
+
.ons-icon {
|
|
483
483
|
fill: var(--ons-color-branded-text);
|
|
484
484
|
float: right;
|
|
485
485
|
margin-top: 3px;
|
|
@@ -491,7 +491,7 @@ $button-shadow-size: 3px;
|
|
|
491
491
|
&__inner {
|
|
492
492
|
background: var(--ons-color-branded-secondary);
|
|
493
493
|
color: var(--ons-color-white);
|
|
494
|
-
.ons-
|
|
494
|
+
.ons-icon {
|
|
495
495
|
fill: var(--ons-color-white);
|
|
496
496
|
}
|
|
497
497
|
}
|
|
@@ -502,7 +502,7 @@ $button-shadow-size: 3px;
|
|
|
502
502
|
&__inner {
|
|
503
503
|
background: var(--ons-color-branded-secondary);
|
|
504
504
|
color: var(--ons-color-white);
|
|
505
|
-
.ons-
|
|
505
|
+
.ons-icon {
|
|
506
506
|
fill: var(--ons-color-white);
|
|
507
507
|
}
|
|
508
508
|
}
|