@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.
Files changed (124) hide show
  1. package/components/access-code/_macro.njk +2 -2
  2. package/components/access-code/_macro.spec.js +2 -2
  3. package/components/access-code/access-code.dom.js +11 -0
  4. package/components/access-code/{uac.js → access-code.js} +1 -1
  5. package/components/access-code/{uac.scss → access-code.scss} +1 -1
  6. package/components/access-code/example-access-code-error.njk +6 -6
  7. package/components/access-code/example-access-code.njk +4 -4
  8. package/components/accordion/_macro.njk +2 -2
  9. package/components/accordion/_macro.spec.js +3 -3
  10. package/components/accordion/accordion.dom.js +1 -1
  11. package/components/accordion/accordion.js +1 -1
  12. package/components/address-input/autosuggest.address.error.js +1 -1
  13. package/components/address-input/autosuggest.address.js +2 -2
  14. package/components/address-input/autosuggest.address.spec.js +5 -5
  15. package/components/autosuggest/_autosuggest.scss +11 -6
  16. package/components/autosuggest/_macro.njk +32 -31
  17. package/components/autosuggest/_macro.spec.js +18 -18
  18. package/components/autosuggest/autosuggest.spec.js +31 -31
  19. package/components/autosuggest/autosuggest.ui.js +8 -9
  20. package/components/breadcrumbs/_breadcrumbs.scss +6 -6
  21. package/components/breadcrumbs/_macro.njk +4 -4
  22. package/components/breadcrumbs/_macro.spec.js +13 -13
  23. package/components/button/_button.scss +27 -27
  24. package/components/button/_macro.spec.js +2 -2
  25. package/components/call-to-action/_macro.njk +1 -1
  26. package/components/card/_card.scss +14 -0
  27. package/components/card/_macro.njk +7 -8
  28. package/components/checkboxes/example-checkboxes-with-revealed-checkboxes-expanded.njk +88 -0
  29. package/components/checkboxes/example-checkboxes-with-revealed-radios-expanded.njk +70 -0
  30. package/components/checkboxes/example-checkboxes-with-revealed-select-expanded.njk +72 -0
  31. package/components/checkboxes/example-checkboxes-with-revealed-text-input-expanded.njk +60 -0
  32. package/components/content-pagination/_content-pagination.scss +1 -1
  33. package/components/date-input/_macro.njk +3 -3
  34. package/components/date-input/_macro.spec.js +118 -0
  35. package/components/date-input/example-date-input-error-for-single-field.njk +63 -0
  36. package/components/details/_details.scss +1 -1
  37. package/components/document-list/_macro.njk +5 -7
  38. package/components/document-list/_macro.spec.js +2 -2
  39. package/components/document-list/example-document-list-search-result-featured.njk +1 -1
  40. package/components/document-list/example-document-list-search-results.njk +3 -3
  41. package/components/external-link/_external-link.scss +3 -3
  42. package/components/external-link/_macro.njk +1 -1
  43. package/components/fieldset/_fieldset.scss +1 -1
  44. package/components/footer/_footer.scss +2 -2
  45. package/components/footer/example-footer-with-alternative-organisation.njk +5 -5
  46. package/components/header/_header.scss +8 -8
  47. package/components/header/_macro.njk +4 -4
  48. package/components/header/example-header-external-with-navigation.njk +5 -5
  49. package/components/header/example-header-external-with-service-links.njk +3 -3
  50. package/components/header/example-header-external-with-sub-navigation.njk +10 -10
  51. package/components/header/example-header-internal.njk +2 -2
  52. package/components/header/example-header-neutral-for-multicoloured-logo.njk +6 -6
  53. package/components/icon/_icon.scss +1 -1
  54. package/components/icon/_macro.njk +35 -35
  55. package/components/icon/_macro.spec.js +1 -1
  56. package/components/image/_image.scss +2 -2
  57. package/components/image/_macro.njk +4 -6
  58. package/components/image/_macro.spec.js +10 -10
  59. package/components/list/_list.scss +5 -2
  60. package/components/list/_macro.njk +22 -10
  61. package/components/list/_macro.spec.js +42 -0
  62. package/components/mutually-exclusive/_macro.njk +4 -3
  63. package/components/navigation/_macro.njk +6 -6
  64. package/components/navigation/_macro.spec.js +4 -4
  65. package/components/pagination/_macro.njk +17 -2
  66. package/components/pagination/_pagination.scss +14 -0
  67. package/components/pagination/example-pagination-first.njk +0 -2
  68. package/components/pagination/example-pagination-last.njk +0 -2
  69. package/components/pagination/example-pagination-with-no-range-indicator.njk +0 -2
  70. package/components/pagination/example-pagination.njk +0 -2
  71. package/components/panel/_macro.njk +1 -1
  72. package/components/panel/_panel.scss +7 -7
  73. package/components/password/_macro.njk +1 -1
  74. package/components/password/example-password.njk +1 -2
  75. package/components/question/example-question-interviewer-note.njk +1 -1
  76. package/components/quote/_quote.scss +1 -1
  77. package/components/radios/_macro.njk +1 -1
  78. package/components/radios/example-radios-with-clear-button-expanded.njk +98 -0
  79. package/components/radios/example-radios-with-revealed-checkboxes-expanded.njk +70 -0
  80. package/components/radios/example-radios-with-revealed-radios-expanded.njk +69 -0
  81. package/components/radios/example-radios-with-revealed-select-expanded.njk +70 -0
  82. package/components/radios/example-radios-with-revealed-text-input-expanded.njk +81 -0
  83. package/components/relationships/_macro.spec.js +9 -11
  84. package/components/relationships/example-relationships-error.njk +28 -28
  85. package/components/relationships/example-relationships-you.njk +29 -29
  86. package/components/relationships/example-relationships.njk +28 -28
  87. package/components/relationships/relationships.spec.js +13 -13
  88. package/components/reply/_macro.njk +5 -2
  89. package/components/reply/_macro.spec.js +7 -1
  90. package/components/section-navigation/_macro.njk +2 -1
  91. package/components/section-navigation/_macro.spec.js +2 -13
  92. package/components/skip-to-content/_macro.njk +2 -1
  93. package/components/skip-to-content/_macro.spec.js +17 -3
  94. package/components/skip-to-content/_skip.scss +1 -1
  95. package/components/skip-to-content/skip-to-content.dom.js +1 -1
  96. package/components/skip-to-content/skip-to-content.spec.js +3 -3
  97. package/components/summary/_summary.scss +1 -1
  98. package/components/table/_table.scss +6 -6
  99. package/components/table/sortable-table.js +1 -1
  100. package/components/tabs/_macro.njk +5 -5
  101. package/components/tabs/_macro.spec.js +1 -1
  102. package/components/tabs/example-tabs-details.njk +3 -0
  103. package/components/tabs/example-tabs.njk +0 -1
  104. package/components/textarea/example-textarea-error.njk +4 -4
  105. package/components/timeline/_macro.njk +18 -22
  106. package/components/timeline/_macro.spec.js +18 -0
  107. package/components/video/example-video.njk +1 -1
  108. package/components/video/video.js +10 -1
  109. package/components/video/video.spec.js +33 -0
  110. package/css/main.css +3 -3
  111. package/css/print.css +1 -1
  112. package/js/cookies-settings.js +1 -1
  113. package/js/main.js +1 -1
  114. package/package.json +19 -21
  115. package/scripts/main.es5.js +1 -1
  116. package/scripts/main.js +1 -1
  117. package/scss/base/_global.scss +1 -1
  118. package/scss/main.scss +1 -1
  119. package/scss/objects/_spacing.scss +3 -3
  120. package/scss/overrides/hcm.scss +10 -10
  121. package/scss/overrides/rtl.scss +2 -2
  122. package/scss/print.scss +2 -2
  123. package/components/access-code/uac.dom.js +0 -11
  124. /package/components/access-code/{uac.spec.js → access-code.spec.js} +0 -0
@@ -1,7 +1,7 @@
1
1
  {% from "components/input/_macro.njk" import onsInput %}
2
2
  {% from "components/panel/_macro.njk" import onsPanel %}
3
3
 
4
- {% macro onsUACInput(params) %}
4
+ {% macro onsAccessCode(params) %}
5
5
  {% set groupSize = params.groupSize | default(4) %}
6
6
  {% set extraSpaces = (params.maxlength | default(16) / groupSize) - 1 %}
7
7
  {% set maxlength = params.maxlength | default(16) + extraSpaces %}
@@ -11,7 +11,7 @@
11
11
  "id": params.id,
12
12
  "type": params.type,
13
13
  "name": params.name,
14
- "classes": "ons-uac__input ons-js-uac" + (" ons-u-mb-xs" if params.postTextboxLinkText else ""),
14
+ "classes": "ons-access-code__input ons-js-access-code" + (" ons-u-mb-xs" if params.postTextboxLinkText else ""),
15
15
  "label": params.label,
16
16
  "attributes": {
17
17
  "maxlength": maxlength,
@@ -150,13 +150,13 @@ describe('macro: access-code', () => {
150
150
  const $ = cheerio.load(
151
151
  renderComponent('access-code', {
152
152
  error: {
153
- id: 'uac-error',
153
+ id: 'access-code-error',
154
154
  text: 'Enter an access code',
155
155
  },
156
156
  }),
157
157
  );
158
158
 
159
- expect($('#uac-error').length).toBe(1);
159
+ expect($('#access-code-error').length).toBe(1);
160
160
  expect($('.ons-panel__error > strong').text()).toBe('Enter an access code');
161
161
  });
162
162
  });
@@ -0,0 +1,11 @@
1
+ import domready from '../../js/domready';
2
+
3
+ domready(async () => {
4
+ const accessCodeInputs = [...document.querySelectorAll('.ons-js-access-code')];
5
+
6
+ if (accessCodeInputs.length) {
7
+ const accessCode = (await import('./access-code')).default;
8
+
9
+ accessCodeInputs.forEach(element => new accessCode(element));
10
+ }
11
+ });
@@ -1,4 +1,4 @@
1
- export default class UAC {
1
+ export default class AccessCode {
2
2
  constructor(context) {
3
3
  this.input = context;
4
4
  const groupSize = parseInt(context.getAttribute('data-group-size'), 10);
@@ -1,4 +1,4 @@
1
- .ons-uac {
1
+ .ons-access-code {
2
2
  &__input {
3
3
  font-family: $font-mono !important;
4
4
  font-weight: $font-weight-bold;
@@ -3,7 +3,7 @@ title: "Example: Access code error"
3
3
  layout: ~
4
4
  ---
5
5
  {% extends "layout/_template.njk" %}
6
- {% from "components/access-code/_macro.njk" import onsUACInput %}
6
+ {% from "components/access-code/_macro.njk" import onsAccessCode %}
7
7
  {% from "components/button/_macro.njk" import onsButton %}
8
8
  {% from "components/panel/_macro.njk" import onsPanel %}
9
9
  {% from "components/details/_macro.njk" import onsDetails %}
@@ -27,7 +27,7 @@ layout: ~
27
27
  "itemsList": [
28
28
  {
29
29
  "text": "Enter an access code",
30
- "url": "#uac-error",
30
+ "url": "#access-code-error",
31
31
  "variants": "inPageLink"
32
32
  }
33
33
  ]
@@ -37,9 +37,9 @@ layout: ~
37
37
 
38
38
  <h1 class="ons-u-mt-l">Start study</h1>
39
39
 
40
- {{ onsUACInput({
41
- "id": "uac",
42
- "name": "uac",
40
+ {{ onsAccessCode({
41
+ "id": "access-code",
42
+ "name": "access-code",
43
43
  "postTextboxLinkText": "Where to find your access code",
44
44
  "postTextboxLinkUrl": "#0",
45
45
  "label": {
@@ -48,7 +48,7 @@ layout: ~
48
48
  },
49
49
  "securityMessage": "Your personal information is protected by law and will be kept confidential",
50
50
  "error": {
51
- "id": "uac-error",
51
+ "id": "access-code-error",
52
52
  "text": "Enter an access code"
53
53
  }
54
54
  }) }}
@@ -3,7 +3,7 @@ title: "Example: Access code"
3
3
  layout: ~
4
4
  ---
5
5
  {% extends "layout/_template.njk" %}
6
- {% from "components/access-code/_macro.njk" import onsUACInput %}
6
+ {% from "components/access-code/_macro.njk" import onsAccessCode %}
7
7
  {% from "components/button/_macro.njk" import onsButton %}
8
8
  {% from "components/panel/_macro.njk" import onsPanel %}
9
9
  {% from "components/details/_macro.njk" import onsDetails %}
@@ -17,9 +17,9 @@ layout: ~
17
17
  {% block main %}
18
18
  <h1 class="ons-u-mt-l">Start study</h1>
19
19
 
20
- {{ onsUACInput({
21
- "id": "uac",
22
- "name": "uac",
20
+ {{ onsAccessCode({
21
+ "id": "access-code",
22
+ "name": "access-code",
23
23
  "postTextboxLinkText": "Where to find your access code",
24
24
  "postTextboxLinkUrl": "#0",
25
25
  "label": {
@@ -15,9 +15,9 @@
15
15
  onsButton({
16
16
  "type": "button",
17
17
  "text": params.allButton.open,
18
- "classes": "ons-js-accordion-all ons-u-mb-s ons-u-d-no",
18
+ "classes": "ons-accordion__toggle-all ons-u-mb-s ons-u-d-no",
19
19
  "variants": ["secondary", "small"],
20
- "innerClasses": "ons-js-accordion-all-inner",
20
+ "innerClasses": "ons-accordion__toggle-all-inner",
21
21
  "attributes": attributes
22
22
  })
23
23
  }}
@@ -162,7 +162,7 @@ describe('macro: accordion', () => {
162
162
  }),
163
163
  );
164
164
 
165
- expect($('button.ons-js-accordion-all').length).toBe(1);
165
+ expect($('button.ons-accordion__toggle-all').length).toBe(1);
166
166
  });
167
167
 
168
168
  it('has additionally provided `attributes`', () => {
@@ -180,8 +180,8 @@ describe('macro: accordion', () => {
180
180
  }),
181
181
  );
182
182
 
183
- expect($('button.ons-js-accordion-all').attr('a')).toBe('123');
184
- expect($('button.ons-js-accordion-all').attr('b')).toBe('456');
183
+ expect($('button.ons-accordion__toggle-all').attr('a')).toBe('123');
184
+ expect($('button.ons-accordion__toggle-all').attr('b')).toBe('456');
185
185
  });
186
186
  });
187
187
  });
@@ -1,7 +1,7 @@
1
1
  import domready from '../../js/domready';
2
2
 
3
3
  async function initialiseAccordions() {
4
- const toggleAllButtons = [...document.querySelectorAll('.ons-js-accordion-all')];
4
+ const toggleAllButtons = [...document.querySelectorAll('.ons-accordion__toggle-all')];
5
5
 
6
6
  if (toggleAllButtons.length) {
7
7
  const detailsComponents = [...document.querySelectorAll('.ons-js-details')];
@@ -3,7 +3,7 @@ export default class Accordion {
3
3
  this.openDetailsEls = 0;
4
4
 
5
5
  this.button = button;
6
- this.buttonInner = button.querySelector('.ons-js-accordion-all-inner');
6
+ this.buttonInner = button.querySelector('.ons-accordion__toggle-all-inner');
7
7
  this.group = button.getAttribute('data-group');
8
8
  this.detailsEls = detailsEls.filter(details => details.group === this.group);
9
9
  this.totalDetailsEls = this.detailsEls.length;
@@ -2,7 +2,7 @@ import inPageLinks from '../../js/inpagelink';
2
2
 
3
3
  const classAutosuggest = 'ons-js-address-autosuggest';
4
4
  const classErrorPanel = 'ons-js-autosuggest-error-panel';
5
- const classInputContainer = 'ons-autosuggest-input';
5
+ const classInputContainer = 'ons-autosuggest';
6
6
  const classInput = 'ons-js-autosuggest-input';
7
7
  const classSearch = 'ons-js-address-input__search';
8
8
 
@@ -4,7 +4,7 @@ import AutosuggestUI from '../autosuggest/autosuggest.ui';
4
4
  import AddressError from './autosuggest.address.error';
5
5
  import AddressSetter from './autosuggest.address.setter';
6
6
 
7
- export const classInputContainer = 'ons-autosuggest-input';
7
+ export const classInputContainer = 'ons-autosuggest';
8
8
  export const classNotEditable = 'ons-js-address-not-editable';
9
9
  export const classMandatory = 'ons-js-address-mandatory';
10
10
  export const classSearch = 'ons-js-address-input__search';
@@ -205,7 +205,7 @@ export default class AutosuggestAddress {
205
205
  (townName === postTown ? postTown : townName + ', ' + postTown) +
206
206
  ', ' +
207
207
  postcode +
208
- ' (<span class="ons-autosuggest-input__group">' +
208
+ ' (<span class="ons-autosuggest__group">' +
209
209
  this.groupCount.replace(`{n}`, addressCount) +
210
210
  '</span>)',
211
211
  postcode,
@@ -241,7 +241,7 @@ describe('script: address-input', () => {
241
241
  await page.type('.ons-js-autosuggest-input', '2', { delay: 20 });
242
242
  await page.keyboard.press('ArrowDown');
243
243
 
244
- const selectedOption = await page.$eval('.ons-autosuggest-input__option--focused', node => node.textContent);
244
+ const selectedOption = await page.$eval('.ons-autosuggest__option--focused', node => node.textContent);
245
245
  expect(selectedOption.trim()).toBe('196 College Road, Birmingham, B44 8HF');
246
246
  });
247
247
 
@@ -267,7 +267,7 @@ describe('script: address-input', () => {
267
267
  });
268
268
 
269
269
  it('has expected suggestion entries', async () => {
270
- const suggestions = await page.$$eval('.ons-autosuggest-input__option', nodes => nodes.map(node => node.textContent.trim()));
270
+ const suggestions = await page.$$eval('.ons-autosuggest__option', nodes => nodes.map(node => node.textContent.trim()));
271
271
  expect(suggestions).toEqual(['196 College Road, Birmingham, B44 8HF', '196 College Road, Whitchurch, Cardiff, CF14 2NZ']);
272
272
  });
273
273
  });
@@ -313,7 +313,7 @@ describe('script: address-input', () => {
313
313
  });
314
314
 
315
315
  it('has expected suggestion entries', async () => {
316
- const suggestions = await page.$$eval('.ons-autosuggest-input__option', nodes => nodes.map(node => node.textContent.trim()));
316
+ const suggestions = await page.$$eval('.ons-autosuggest__option', nodes => nodes.map(node => node.textContent.trim()));
317
317
  expect(suggestions).toEqual(['1 Penlline Road, Whitchurch, Cardiff, CF14 2NZ', '2 Penlline Road, Whitchurch, Cardiff, CF14 2NZ']);
318
318
  });
319
319
 
@@ -353,7 +353,7 @@ describe('script: address-input', () => {
353
353
  });
354
354
 
355
355
  it('has expected suggestion entries', async () => {
356
- const suggestions = await page.$$eval('.ons-autosuggest-input__option', nodes => nodes.map(node => node.textContent.trim()));
356
+ const suggestions = await page.$$eval('.ons-autosuggest__option', nodes => nodes.map(node => node.textContent.trim()));
357
357
  expect(suggestions).toEqual([
358
358
  'Penlline Road, Whitchurch, Cardiff, CF14 2AA (41 addresses)',
359
359
  '197 College Road, Whitchurch, Cardiff, CF14 2AB',
@@ -376,7 +376,7 @@ describe('script: address-input', () => {
376
376
  });
377
377
 
378
378
  it('has expected suggestion entries', async () => {
379
- const suggestions = await page.$$eval('.ons-autosuggest-input__option', nodes => nodes.map(node => node.textContent.trim()));
379
+ const suggestions = await page.$$eval('.ons-autosuggest__option', nodes => nodes.map(node => node.textContent.trim()));
380
380
  expect(suggestions).toEqual(['197 College Road, Whitchurch, Cardiff, CF14 2AB']);
381
381
  });
382
382
 
@@ -1,4 +1,4 @@
1
- .ons-autosuggest-input {
1
+ .ons-autosuggest {
2
2
  position: relative;
3
3
 
4
4
  &__combobox {
@@ -57,8 +57,8 @@
57
57
  border-color: var(--ons-color-text-link-hover);
58
58
  color: var(--ons-color-white);
59
59
 
60
- .ons-autosuggest-input__group,
61
- .ons-autosuggest-input__category {
60
+ .ons-autosuggest__group,
61
+ .ons-autosuggest__category {
62
62
  color: var(--ons-color-white);
63
63
  }
64
64
  }
@@ -67,8 +67,8 @@
67
67
  background: var(--ons-color-focus);
68
68
  color: var(--ons-color-text-link-focus);
69
69
 
70
- .ons-autosuggest-input__group,
71
- .ons-autosuggest-input__category {
70
+ .ons-autosuggest__group,
71
+ .ons-autosuggest__category {
72
72
  color: var(--ons-color-text-link-focus);
73
73
  }
74
74
  }
@@ -91,6 +91,11 @@
91
91
  }
92
92
  }
93
93
 
94
+ &__wrapper {
95
+ max-width: max-content;
96
+ width: 100%;
97
+ }
98
+
94
99
  &__panel.ons-panel--warn {
95
100
  background: none;
96
101
  border: 0;
@@ -126,7 +131,7 @@
126
131
  }
127
132
 
128
133
  &--header {
129
- .ons-autosuggest-input__results {
134
+ .ons-autosuggest__results {
130
135
  border: none;
131
136
  box-shadow: 0 0 5px 0 rgba(34, 34, 34, 0.6);
132
137
  left: 0;
@@ -3,7 +3,7 @@
3
3
  {% macro onsAutosuggest(params) %}
4
4
  <div
5
5
  id="{{ params.id }}-container"
6
- class="{% if not params.externalInitialiser %}ons-js-autosuggest {% endif %}{% if params.isEditable == false %}ons-js-address-not-editable{% endif %}{% if params.mandatory == true %} ons-js-address-mandatory{% endif %} {% if params.containerClasses %} {{ params.containerClasses }}{% endif %} ons-autosuggest-input"
6
+ class="{% if not params.externalInitialiser %}ons-js-autosuggest {% endif %}{% if params.isEditable == false %}ons-js-address-not-editable{% endif %}{% if params.mandatory == true %} ons-js-address-mandatory{% endif %} {% if params.containerClasses %} {{ params.containerClasses }}{% endif %} ons-autosuggest"
7
7
  data-instructions="{{ params.instructions }}"
8
8
  data-aria-you-have-selected="{{ params.ariaYouHaveSelected }}"
9
9
  data-min-chars="{{ params.minChars }}"
@@ -36,38 +36,39 @@
36
36
  >
37
37
 
38
38
  {% set autosuggestResults %}
39
- <div class="ons-autosuggest-input__results ons-js-autosuggest-results">
40
- <div id="{{ params.resultsTitleId }}" class="ons-autosuggest-input__results-title ons-u-fs-s">{{ params.resultsTitle }}</div>
41
- <ul class="ons-autosuggest-input__listbox ons-js-autosuggest-listbox" title="{{ params.resultsTitle }}" role="listbox" id="{{ params.id }}-listbox" tabindex="-1"></ul>
39
+ <div class="ons-autosuggest__results ons-js-autosuggest-results">
40
+ <div id="{{ params.resultsTitleId }}" class="ons-autosuggest__results-title ons-u-fs-s">{{ params.resultsTitle }}</div>
41
+ <ul class="ons-autosuggest__listbox ons-js-autosuggest-listbox" title="{{ params.resultsTitle }}" role="listbox" id="{{ params.id }}-listbox" tabindex="-1"></ul>
42
42
  </div>
43
- <div class="ons-autosuggest-input__instructions ons-u-vh ons-js-autosuggest-instructions" id="{{ params.id }}-instructions" tabindex="-1">{{ params.instructions }}</div>
44
- <div class="ons-autosuggest-input__status ons-u-vh ons-js-autosuggest-aria-status" aria-live="assertive" aria-atomic="true" role="status" tabindex="-1"></div>
43
+ <div class="ons-autosuggest__instructions ons-u-vh ons-js-autosuggest-instructions" id="{{ params.id }}-instructions" tabindex="-1">{{ params.instructions }}</div>
44
+ <div class="ons-autosuggest__status ons-u-vh ons-js-autosuggest-aria-status" aria-live="assertive" aria-atomic="true" role="status" tabindex="-1"></div>
45
45
  {% endset %}
46
+ <div class="ons-autosuggest__wrapper">
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
+ }) }}
46
68
 
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
-
69
- {% if not params.mutuallyExclusive %}
70
- {{ autosuggestResults | safe }}
71
- {% endif %}
69
+ {% if not params.mutuallyExclusive %}
70
+ {{ autosuggestResults | safe }}
71
+ {% endif %}
72
+ </div>
72
73
  </div>
73
74
  {% endmacro %}
@@ -41,13 +41,13 @@ describe('macro: autosuggest', () => {
41
41
  it('has expected id on container element', () => {
42
42
  const $ = cheerio.load(renderComponent('autosuggest', EXAMPLE_AUTOSUGGEST));
43
43
 
44
- expect($('.ons-autosuggest-input').attr('id')).toBe('country-of-birth-container');
44
+ expect($('.ons-autosuggest').attr('id')).toBe('country-of-birth-container');
45
45
  });
46
46
 
47
47
  it('has the provided data attributes', () => {
48
48
  const $ = cheerio.load(renderComponent('autosuggest', EXAMPLE_AUTOSUGGEST));
49
49
 
50
- const $element = $('.ons-autosuggest-input');
50
+ const $element = $('.ons-autosuggest');
51
51
  expect($element.attr('data-allow-multiple')).toBeUndefined();
52
52
  expect($element.attr('data-min-chars')).toBe('2');
53
53
  expect($element.attr('data-aria-limited-results')).toBe('Type more characters to improve your search');
@@ -71,13 +71,13 @@ describe('macro: autosuggest', () => {
71
71
  }),
72
72
  );
73
73
 
74
- expect($('.ons-autosuggest-input').attr('data-allow-multiple')).toBe('true');
74
+ expect($('.ons-autosuggest').attr('data-allow-multiple')).toBe('true');
75
75
  });
76
76
 
77
77
  it('has a special class that indicates the component should initialise itself', () => {
78
78
  const $ = cheerio.load(renderComponent('autosuggest', EXAMPLE_AUTOSUGGEST));
79
79
 
80
- expect($('.ons-autosuggest-input').hasClass('ons-js-autosuggest')).toBe(true);
80
+ expect($('.ons-autosuggest').hasClass('ons-js-autosuggest')).toBe(true);
81
81
  });
82
82
 
83
83
  it('does not have a special class when the component has an external initialiser', () => {
@@ -88,7 +88,7 @@ describe('macro: autosuggest', () => {
88
88
  }),
89
89
  );
90
90
 
91
- expect($('.ons-autosuggest-input').hasClass('ons-js-autosuggest')).toBe(false);
91
+ expect($('.ons-autosuggest').hasClass('ons-js-autosuggest')).toBe(false);
92
92
  });
93
93
 
94
94
  it('has special class to indicate that component is not editable', () => {
@@ -99,7 +99,7 @@ describe('macro: autosuggest', () => {
99
99
  }),
100
100
  );
101
101
 
102
- expect($('.ons-autosuggest-input').hasClass('ons-js-address-not-editable')).toBe(true);
102
+ expect($('.ons-autosuggest').hasClass('ons-js-address-not-editable')).toBe(true);
103
103
  });
104
104
 
105
105
  it('has special class to indicate that component input is mandatory', () => {
@@ -110,7 +110,7 @@ describe('macro: autosuggest', () => {
110
110
  }),
111
111
  );
112
112
 
113
- expect($('.ons-autosuggest-input').hasClass('ons-js-address-mandatory')).toBe(true);
113
+ expect($('.ons-autosuggest').hasClass('ons-js-address-mandatory')).toBe(true);
114
114
  });
115
115
 
116
116
  it('has additionally provided container style classes', () => {
@@ -121,8 +121,8 @@ describe('macro: autosuggest', () => {
121
121
  }),
122
122
  );
123
123
 
124
- expect($('.ons-autosuggest-input').hasClass('extra-class')).toBe(true);
125
- expect($('.ons-autosuggest-input').hasClass('another-extra-class')).toBe(true);
124
+ expect($('.ons-autosuggest').hasClass('extra-class')).toBe(true);
125
+ expect($('.ons-autosuggest').hasClass('another-extra-class')).toBe(true);
126
126
  });
127
127
 
128
128
  describe('input', () => {
@@ -168,7 +168,7 @@ describe('macro: autosuggest', () => {
168
168
  it('is rendered `mutallyExclusive` parameter is not defined', () => {
169
169
  const $ = cheerio.load(renderComponent('autosuggest', EXAMPLE_AUTOSUGGEST));
170
170
 
171
- expect($('.ons-autosuggest-input__results').length).toBe(1);
171
+ expect($('.ons-autosuggest__results').length).toBe(1);
172
172
  });
173
173
 
174
174
  it('is not rendered when `mutallyExclusive` parameter is defined', () => {
@@ -179,20 +179,20 @@ describe('macro: autosuggest', () => {
179
179
  }),
180
180
  );
181
181
 
182
- expect($('.ons-autosuggest-input__results').length).toBe(0);
182
+ expect($('.ons-autosuggest__results').length).toBe(0);
183
183
  });
184
184
 
185
185
  it('renders div with the provided title identifier', () => {
186
186
  const $ = cheerio.load(renderComponent('autosuggest', EXAMPLE_AUTOSUGGEST));
187
187
 
188
- expect($('.ons-autosuggest-input__results-title').attr('id')).toBe('country-of-birth-suggestions');
188
+ expect($('.ons-autosuggest__results-title').attr('id')).toBe('country-of-birth-suggestions');
189
189
  });
190
190
 
191
191
  it('renders div with the provided title text', () => {
192
192
  const $ = cheerio.load(renderComponent('autosuggest', EXAMPLE_AUTOSUGGEST));
193
193
 
194
194
  expect(
195
- $('.ons-autosuggest-input__results-title')
195
+ $('.ons-autosuggest__results-title')
196
196
  .text()
197
197
  .trim(),
198
198
  ).toBe('Suggestions');
@@ -201,32 +201,32 @@ describe('macro: autosuggest', () => {
201
201
  it('renders list with a generated identifier', () => {
202
202
  const $ = cheerio.load(renderComponent('autosuggest', EXAMPLE_AUTOSUGGEST));
203
203
 
204
- expect($('.ons-autosuggest-input__listbox').attr('id')).toBe('country-of-birth-listbox');
204
+ expect($('.ons-autosuggest__listbox').attr('id')).toBe('country-of-birth-listbox');
205
205
  });
206
206
 
207
207
  it('renders an accessible list', () => {
208
208
  const $ = cheerio.load(renderComponent('autosuggest', EXAMPLE_AUTOSUGGEST));
209
209
 
210
- expect($('.ons-autosuggest-input__listbox').attr('title')).toBe('Suggestions');
210
+ expect($('.ons-autosuggest__listbox').attr('title')).toBe('Suggestions');
211
211
  });
212
212
 
213
213
  it('renders instructions with a generated identifier', () => {
214
214
  const $ = cheerio.load(renderComponent('autosuggest', EXAMPLE_AUTOSUGGEST));
215
215
 
216
- expect($('.ons-autosuggest-input__instructions').attr('id')).toBe('country-of-birth-instructions');
216
+ expect($('.ons-autosuggest__instructions').attr('id')).toBe('country-of-birth-instructions');
217
217
  });
218
218
 
219
219
  it('adds aria-atomic=true value to status container', () => {
220
220
  const $ = cheerio.load(renderComponent('autosuggest', EXAMPLE_AUTOSUGGEST));
221
221
 
222
- expect($('.ons-autosuggest-input__status').attr('aria-atomic')).toBe('true');
222
+ expect($('.ons-autosuggest__status').attr('aria-atomic')).toBe('true');
223
223
  });
224
224
 
225
225
  it('renders instructions text', () => {
226
226
  const $ = cheerio.load(renderComponent('autosuggest', EXAMPLE_AUTOSUGGEST));
227
227
 
228
228
  expect(
229
- $('.ons-autosuggest-input__instructions')
229
+ $('.ons-autosuggest__instructions')
230
230
  .text()
231
231
  .trim(),
232
232
  ).toBe('Use up and down keys to navigate.');