@lion/ui 0.0.11 → 0.0.13

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 (160) hide show
  1. package/components/accordion/src/LionAccordion.js +22 -9
  2. package/components/accordion/test/lion-accordion.test.js +29 -32
  3. package/components/input-tel/translations/bg.js +3 -1
  4. package/components/input-tel/translations/cs.js +3 -1
  5. package/components/input-tel/translations/de.js +3 -1
  6. package/components/input-tel/translations/en.js +3 -1
  7. package/components/input-tel/translations/es.js +3 -1
  8. package/components/input-tel/translations/fr.js +3 -1
  9. package/components/input-tel/translations/hu.js +3 -1
  10. package/components/input-tel/translations/it.js +3 -1
  11. package/components/input-tel/translations/nl.js +3 -1
  12. package/components/input-tel/translations/pl.js +3 -1
  13. package/components/input-tel/translations/ro.js +3 -1
  14. package/components/input-tel/translations/ru.js +3 -1
  15. package/components/input-tel/translations/sk.js +3 -1
  16. package/components/input-tel/translations/uk.js +3 -1
  17. package/components/input-tel/translations/zh.js +3 -1
  18. package/components/input-tel-dropdown/src/LionInputTelDropdown.js +5 -5
  19. package/components/listbox/src/ListboxMixin.js +0 -4
  20. package/components/listbox/types/ListboxMixinTypes.ts +1 -4
  21. package/components/overlays/src/OverlayController.js +28 -34
  22. package/components/overlays/src/utils/adopt-styles.js +136 -0
  23. package/components/overlays/test/OverlayController.test.js +24 -55
  24. package/components/overlays/test/local-positioning.test.js +1 -1
  25. package/components/overlays/test/utils-tests/adopt-styles.test.js +177 -0
  26. package/components/overlays/test-helpers/createShadowHost.js +16 -0
  27. package/components/overlays/{test/utils-tests/local-positioning-helpers.js → test-helpers/normalizeTransformStyle.js} +0 -0
  28. package/components/select-rich/src/LionSelectRich.js +14 -6
  29. package/components/select-rich/test/lion-select-rich.test.js +25 -1
  30. package/components/tooltip/src/LionTooltip.js +16 -2
  31. package/components/tooltip/test/lion-tooltip.test.js +1 -2
  32. package/custom-elements.json +432 -183
  33. package/dist-types/components/accordion/src/LionAccordion.d.ts.map +1 -1
  34. package/dist-types/components/input-tel/translations/bg-BG.d.ts +3 -1
  35. package/dist-types/components/input-tel/translations/bg.d.ts +3 -1
  36. package/dist-types/components/input-tel/translations/cs-CZ.d.ts +3 -1
  37. package/dist-types/components/input-tel/translations/cs.d.ts +3 -1
  38. package/dist-types/components/input-tel/translations/de-DE.d.ts +3 -1
  39. package/dist-types/components/input-tel/translations/de.d.ts +3 -1
  40. package/dist-types/components/input-tel/translations/en-AU.d.ts +3 -1
  41. package/dist-types/components/input-tel/translations/en-GB.d.ts +3 -1
  42. package/dist-types/components/input-tel/translations/en-US.d.ts +3 -1
  43. package/dist-types/components/input-tel/translations/en.d.ts +3 -1
  44. package/dist-types/components/input-tel/translations/es-ES.d.ts +3 -1
  45. package/dist-types/components/input-tel/translations/es.d.ts +3 -1
  46. package/dist-types/components/input-tel/translations/fr-BE.d.ts +3 -1
  47. package/dist-types/components/input-tel/translations/fr-FR.d.ts +3 -1
  48. package/dist-types/components/input-tel/translations/fr.d.ts +3 -1
  49. package/dist-types/components/input-tel/translations/hu-HU.d.ts +3 -1
  50. package/dist-types/components/input-tel/translations/hu.d.ts +3 -1
  51. package/dist-types/components/input-tel/translations/it-IT.d.ts +3 -1
  52. package/dist-types/components/input-tel/translations/it.d.ts +3 -1
  53. package/dist-types/components/input-tel/translations/nl-BE.d.ts +3 -1
  54. package/dist-types/components/input-tel/translations/nl-NL.d.ts +3 -1
  55. package/dist-types/components/input-tel/translations/nl.d.ts +3 -1
  56. package/dist-types/components/input-tel/translations/pl-PL.d.ts +3 -1
  57. package/dist-types/components/input-tel/translations/pl.d.ts +3 -1
  58. package/dist-types/components/input-tel/translations/ro-RO.d.ts +3 -1
  59. package/dist-types/components/input-tel/translations/ro.d.ts +3 -1
  60. package/dist-types/components/input-tel/translations/ru-RU.d.ts +3 -1
  61. package/dist-types/components/input-tel/translations/ru.d.ts +3 -1
  62. package/dist-types/components/input-tel/translations/sk-SK.d.ts +3 -1
  63. package/dist-types/components/input-tel/translations/sk.d.ts +3 -1
  64. package/dist-types/components/input-tel/translations/uk-UA.d.ts +3 -1
  65. package/dist-types/components/input-tel/translations/uk.d.ts +3 -1
  66. package/dist-types/components/input-tel/translations/zh.d.ts +3 -1
  67. package/dist-types/components/listbox/src/ListboxMixin.d.ts.map +1 -1
  68. package/dist-types/components/listbox/types/ListboxMixinTypes.d.ts +1 -2
  69. package/dist-types/components/listbox/types/ListboxMixinTypes.d.ts.map +1 -1
  70. package/dist-types/components/overlays/src/OverlayController.d.ts +8 -5
  71. package/dist-types/components/overlays/src/OverlayController.d.ts.map +1 -1
  72. package/dist-types/components/overlays/src/utils/adopt-styles.d.ts +24 -0
  73. package/dist-types/components/overlays/src/utils/adopt-styles.d.ts.map +1 -0
  74. package/dist-types/components/overlays/test/OverlayController.test.d.ts.map +1 -1
  75. package/dist-types/components/overlays/test/utils-tests/adopt-styles.test.d.ts +2 -0
  76. package/dist-types/components/overlays/test/utils-tests/adopt-styles.test.d.ts.map +1 -0
  77. package/dist-types/components/overlays/test-helpers/createShadowHost.d.ts +8 -0
  78. package/dist-types/components/overlays/test-helpers/createShadowHost.d.ts.map +1 -0
  79. package/dist-types/components/overlays/{test/utils-tests/local-positioning-helpers.d.ts → test-helpers/normalizeTransformStyle.d.ts} +1 -1
  80. package/dist-types/components/overlays/test-helpers/normalizeTransformStyle.d.ts.map +1 -0
  81. package/dist-types/components/select-rich/src/LionSelectRich.d.ts +35 -3
  82. package/dist-types/components/select-rich/src/LionSelectRich.d.ts.map +1 -1
  83. package/dist-types/components/tooltip/src/LionTooltip.d.ts.map +1 -1
  84. package/dist-types/tsconfig.tsbuildinfo +1 -1
  85. package/docs/components/button/use-cases.md +2 -0
  86. package/docs/components/checkbox-group/overview.md +2 -2
  87. package/docs/components/collapsible/overview.md +1 -1
  88. package/docs/components/combobox/overview.md +1 -1
  89. package/docs/components/combobox/src/demo-selection-display.js +1 -1
  90. package/docs/components/combobox/use-cases.md +1 -1
  91. package/docs/components/dialog/overview.md +1 -1
  92. package/docs/components/dialog/src/demoStyle.js +18 -0
  93. package/docs/components/fieldset/overview.md +5 -5
  94. package/docs/components/form/overview.md +3 -3
  95. package/docs/components/icon/use-cases.md +1 -1
  96. package/docs/components/input/overview.md +1 -1
  97. package/docs/components/input-amount/overview.md +3 -3
  98. package/docs/components/input-date/overview.md +3 -3
  99. package/docs/components/input-datepicker/overview.md +5 -5
  100. package/docs/components/input-email/overview.md +2 -2
  101. package/docs/components/input-iban/overview.md +2 -2
  102. package/docs/components/input-range/overview.md +2 -2
  103. package/docs/components/input-stepper/overview.md +1 -1
  104. package/docs/components/input-tel/overview.md +1 -1
  105. package/docs/components/input-tel/use-cases.md +6 -6
  106. package/docs/components/input-tel-dropdown/overview.md +1 -1
  107. package/docs/components/radio-group/overview.md +3 -3
  108. package/docs/components/select-rich/use-cases.md +30 -24
  109. package/docs/components/tabs/examples.md +1 -1
  110. package/docs/fundamentals/index.md +4 -4
  111. package/docs/fundamentals/node-tools/providence-analytics/LocalConfiguration.md +1 -1
  112. package/docs/fundamentals/node-tools/providence-analytics/QueryResult.md +1 -1
  113. package/docs/fundamentals/node-tools/providence-analytics/analyzer.md +1 -1
  114. package/docs/fundamentals/node-tools/providence-analytics/dashboard.md +1 -1
  115. package/docs/fundamentals/node-tools/providence-analytics/overview.md +3 -3
  116. package/docs/fundamentals/node-tools/publish-docs/overview.md +3 -3
  117. package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md +2 -2
  118. package/docs/fundamentals/systems/core/overview.md +1 -1
  119. package/docs/fundamentals/systems/form/formatting-and-parsing.md +4 -4
  120. package/docs/fundamentals/systems/form/model-value.md +1 -1
  121. package/docs/fundamentals/systems/form/overview.md +28 -28
  122. package/docs/fundamentals/systems/form/validate.md +1 -1
  123. package/docs/fundamentals/systems/localize/overview.md +4 -4
  124. package/docs/fundamentals/systems/overlays/assets/demo-el-using-overlaymixin.mjs +0 -16
  125. package/docs/fundamentals/systems/overlays/configuration.md +18 -32
  126. package/docs/fundamentals/systems/overlays/overview.md +5 -5
  127. package/docs/fundamentals/systems/overlays/use-cases.md +5 -5
  128. package/docs/fundamentals/tools/helpers/overview.md +1 -1
  129. package/docs/fundamentals/tools/singleton-manager/.gitignore +1 -0
  130. package/docs/fundamentals/tools/singleton-manager/example-complex/demo-app.js +93 -0
  131. package/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/overlays/index.js +30 -0
  132. package/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/overlays/instance.js +4 -0
  133. package/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-a/page-a.js +35 -0
  134. package/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-b/node_modules/overlays/index.js +30 -0
  135. package/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-b/node_modules/overlays/instance.js +4 -0
  136. package/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-b/page-b.js +49 -0
  137. package/docs/fundamentals/tools/singleton-manager/example-complex/overlayCompatibility.js +70 -0
  138. package/docs/fundamentals/tools/singleton-manager/example-fail/demo-app.js +91 -0
  139. package/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/overlays/index.js +30 -0
  140. package/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/overlays/instance.js +3 -0
  141. package/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-a/page-a.js +34 -0
  142. package/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-b/node_modules/overlays/index.js +30 -0
  143. package/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-b/node_modules/overlays/instance.js +3 -0
  144. package/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-b/page-b.js +34 -0
  145. package/docs/fundamentals/tools/singleton-manager/example-success/demo-app.js +93 -0
  146. package/docs/fundamentals/tools/singleton-manager/example-success/node_modules/overlays/index.js +30 -0
  147. package/docs/fundamentals/tools/singleton-manager/example-success/node_modules/overlays/instance.js +4 -0
  148. package/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-a/page-a.js +34 -0
  149. package/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-b/node_modules/overlays/index.js +30 -0
  150. package/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-b/node_modules/overlays/instance.js +4 -0
  151. package/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-b/page-b.js +34 -0
  152. package/docs/fundamentals/tools/singleton-manager/example-success/overlayCompatibility.js +23 -0
  153. package/docs/fundamentals/tools/singleton-manager/overview.md +4 -4
  154. package/docs/guides/how-to/create-a-custom-field.md +5 -5
  155. package/docs/guides/how-to/extend-a-native-input.md +2 -2
  156. package/docs/guides/index.md +8 -8
  157. package/docs/guides/principles/index.md +5 -5
  158. package/docs/guides/principles/styling.md +1 -1
  159. package/package.json +2 -2
  160. package/dist-types/components/overlays/test/utils-tests/local-positioning-helpers.d.ts.map +0 -1
@@ -44,21 +44,21 @@ export class LionAccordion extends LitElement {
44
44
  flex-direction: column;
45
45
  }
46
46
 
47
- .accordion [slot='invoker'] {
47
+ .accordion ::slotted(.invoker) {
48
48
  margin: 0;
49
49
  }
50
50
 
51
- .accordion [slot='invoker'][expanded] {
51
+ .accordion ::slotted(.invoker)[expanded] {
52
52
  font-weight: bold;
53
53
  }
54
54
 
55
- .accordion [slot='content'] {
55
+ .accordion ::slotted(.content) {
56
56
  margin: 0;
57
57
  visibility: hidden;
58
58
  display: none;
59
59
  }
60
60
 
61
- .accordion [slot='content'][expanded] {
61
+ .accordion ::slotted(.content[expanded]) {
62
62
  visibility: visible;
63
63
  display: block;
64
64
  }
@@ -159,9 +159,15 @@ export class LionAccordion extends LitElement {
159
159
  * @private
160
160
  */
161
161
  __setupStore() {
162
- const accordion = this.shadowRoot?.querySelector('slot[name=_accordion]');
163
- const existingInvokers = accordion ? accordion.querySelectorAll('[slot=invoker]') : [];
164
- const existingContent = accordion ? accordion.querySelectorAll('[slot=content]') : [];
162
+ const accordion = /** @type {HTMLSlotElement} */ (
163
+ this.shadowRoot?.querySelector('slot[name=_accordion]')
164
+ );
165
+ const existingInvokers = accordion
166
+ ? accordion.assignedElements().filter(child => child.classList.contains('invoker'))
167
+ : [];
168
+ const existingContent = accordion
169
+ ? accordion.assignedElements().filter(child => child.classList.contains('content'))
170
+ : [];
165
171
 
166
172
  const invokers = /** @type {HTMLElement[]} */ ([
167
173
  ...Array.from(existingInvokers),
@@ -212,14 +218,21 @@ export class LionAccordion extends LitElement {
212
218
  const invokers = /** @type {HTMLElement[]} */ (
213
219
  Array.from(this.children).filter(child => child.slot === 'invoker')
214
220
  );
221
+
215
222
  const contents = /** @type {HTMLElement[]} */ (
216
223
  Array.from(this.children).filter(child => child.slot === 'content')
217
224
  );
225
+
218
226
  const accordion = this.shadowRoot?.querySelector('slot[name=_accordion]');
227
+
219
228
  if (accordion) {
220
229
  invokers.forEach((invoker, index) => {
221
- accordion.insertAdjacentElement('beforeend', invoker);
222
- accordion.insertAdjacentElement('beforeend', contents[index]);
230
+ invoker.classList.add('invoker');
231
+ // eslint-disable-next-line no-param-reassign
232
+ invoker.slot = '_accordion';
233
+
234
+ contents[index].classList.add('content');
235
+ contents[index].slot = '_accordion';
223
236
  });
224
237
  }
225
238
  }
@@ -23,27 +23,27 @@ const basicAccordion = html`
23
23
  * @param {Element} el
24
24
  */
25
25
  function getAccordionChildren(el) {
26
- const slot = el.shadowRoot?.querySelector('slot[name=_accordion]');
26
+ if (el.shadowRoot) {
27
+ const slot = el.shadowRoot?.querySelector('slot[name=_accordion]');
27
28
 
28
- return slot ? slot.children : [];
29
+ return slot && slot instanceof HTMLSlotElement ? slot.assignedElements() : [];
30
+ }
31
+
32
+ return [];
29
33
  }
30
34
 
31
35
  /**
32
36
  * @param {Element} el
33
37
  */
34
38
  function getInvokers(el) {
35
- const slot = el.shadowRoot?.querySelector('slot[name=_accordion]');
36
-
37
- return slot ? slot.querySelectorAll('[slot=invoker]') : [];
39
+ return getAccordionChildren(el).filter(child => child.classList.contains('invoker'));
38
40
  }
39
41
 
40
42
  /**
41
43
  * @param {Element} el
42
44
  */
43
45
  function getContents(el) {
44
- const slot = el.shadowRoot?.querySelector('slot[name=_accordion]');
45
-
46
- return slot ? slot.querySelectorAll('[slot=content]') : [];
46
+ return getAccordionChildren(el).filter(child => child.classList.contains('content'));
47
47
  }
48
48
 
49
49
  describe('<lion-accordion>', () => {
@@ -68,14 +68,14 @@ describe('<lion-accordion>', () => {
68
68
 
69
69
  expect(
70
70
  Array.from(getAccordionChildren(el)).find(
71
- child => child.slot === 'invoker' && child.hasAttribute('expanded'),
71
+ child => child.className === 'invoker' && child.hasAttribute('expanded'),
72
72
  )?.textContent,
73
73
  ).to.equal('invoker 2');
74
74
 
75
75
  el.expanded = [0];
76
76
  expect(
77
77
  Array.from(getAccordionChildren(el)).find(
78
- child => child.slot === 'invoker' && child.hasAttribute('expanded'),
78
+ child => child.className === 'invoker' && child.hasAttribute('expanded'),
79
79
  )?.textContent,
80
80
  ).to.equal('invoker 1');
81
81
  });
@@ -146,17 +146,16 @@ describe('<lion-accordion>', () => {
146
146
  `)
147
147
  );
148
148
  expect(el.focusedIndex).to.equal(1);
149
+
149
150
  expect(
150
- Array.from(getAccordionChildren(el)).find(
151
- child => child.slot === 'invoker' && child.firstElementChild?.hasAttribute('focused'),
152
- )?.textContent,
151
+ Array.from(getInvokers(el)).find(child => child.firstElementChild?.hasAttribute('focused'))
152
+ ?.textContent,
153
153
  ).to.equal('invoker 2');
154
154
 
155
155
  el.focusedIndex = 0;
156
156
  expect(
157
- Array.from(getAccordionChildren(el)).find(
158
- child => child.slot === 'invoker' && child.firstElementChild?.hasAttribute('focused'),
159
- )?.textContent,
157
+ Array.from(getInvokers(el)).find(child => child.firstElementChild?.hasAttribute('focused'))
158
+ ?.textContent,
160
159
  ).to.equal('invoker 1');
161
160
  });
162
161
 
@@ -360,14 +359,10 @@ describe('<lion-accordion>', () => {
360
359
  await el.updateComplete;
361
360
 
362
361
  expect(
363
- Array.from(getAccordionChildren(el)).find(
364
- child => child.slot === 'invoker' && child.hasAttribute('expanded'),
365
- )?.textContent,
362
+ Array.from(getInvokers(el)).find(child => child.hasAttribute('expanded'))?.textContent,
366
363
  ).to.equal('invoker 5');
367
364
  expect(
368
- Array.from(getAccordionChildren(el)).find(
369
- child => child.slot === 'content' && child.hasAttribute('expanded'),
370
- )?.textContent,
365
+ Array.from(getContents(el)).find(child => child.hasAttribute('expanded'))?.textContent,
371
366
  ).to.equal('content 5');
372
367
  });
373
368
 
@@ -410,11 +405,13 @@ describe('<lion-accordion>', () => {
410
405
  <div slot="content">content 2</div>
411
406
  </lion-accordion>
412
407
  `);
408
+
409
+ // console.log(getAccordionChildren(el));
413
410
  expect(
414
- Array.from(getAccordionChildren(el)).find(child => child.slot === 'content'),
411
+ Array.from(getAccordionChildren(el)).find(child => child.classList.contains('content')),
415
412
  ).to.not.have.attribute('tabindex');
416
413
  expect(
417
- Array.from(getAccordionChildren(el)).find(child => child.slot === 'content'),
414
+ Array.from(getAccordionChildren(el)).find(child => child.classList.contains('content')),
418
415
  ).to.not.have.attribute('tabindex');
419
416
  });
420
417
 
@@ -445,10 +442,10 @@ describe('<lion-accordion>', () => {
445
442
  <div slot="content">content</div>
446
443
  </lion-accordion>
447
444
  `);
448
- expect(
449
- Array.from(getAccordionChildren(el)).find(child => child.slot === 'invoker')
450
- ?.firstElementChild,
451
- ).to.have.attribute('aria-expanded', 'false');
445
+ expect(Array.from(getInvokers(el))[0]?.firstElementChild).to.have.attribute(
446
+ 'aria-expanded',
447
+ 'false',
448
+ );
452
449
  });
453
450
 
454
451
  it('adds aria-expanded="true" to invoker when its content is expanded', async () => {
@@ -461,10 +458,10 @@ describe('<lion-accordion>', () => {
461
458
  `)
462
459
  );
463
460
  el.expanded = [0];
464
- expect(
465
- Array.from(getAccordionChildren(el)).find(child => child.slot === 'invoker')
466
- ?.firstElementChild,
467
- ).to.have.attribute('aria-expanded', 'true');
461
+ expect(Array.from(getInvokers(el))[0]?.firstElementChild).to.have.attribute(
462
+ 'aria-expanded',
463
+ 'true',
464
+ );
468
465
  });
469
466
  });
470
467
 
@@ -1,4 +1,6 @@
1
1
  export default {
2
- selectCountry: 'Избор на държава',
2
+ allCountries: 'Всички държави',
3
3
  phoneNumber: 'Телефонен номер',
4
+ selectCountry: 'Избор на държава',
5
+ suggestedCountries: 'Предложени държави',
4
6
  };
@@ -1,4 +1,6 @@
1
1
  export default {
2
- selectCountry: 'Vybrat zemi',
2
+ allCountries: 'Všechny země',
3
3
  phoneNumber: 'Telefonní číslo',
4
+ selectCountry: 'Vybrat zemi',
5
+ suggestedCountries: 'Navrhované země',
4
6
  };
@@ -1,4 +1,6 @@
1
1
  export default {
2
- selectCountry: 'Land auswählen',
2
+ allCountries: 'Alle Länder',
3
3
  phoneNumber: 'Telefonnummer',
4
+ selectCountry: 'Land auswählen',
5
+ suggestedCountries: 'Vorgeschlagene Länder',
4
6
  };
@@ -1,4 +1,6 @@
1
1
  export default {
2
- selectCountry: 'Select country',
2
+ allCountries: 'All countries',
3
3
  phoneNumber: 'Phone number',
4
+ selectCountry: 'Select country',
5
+ suggestedCountries: 'Suggested countries',
4
6
  };
@@ -1,4 +1,6 @@
1
1
  export default {
2
- selectCountry: 'Seleccione país',
2
+ allCountries: 'Pays suggérés',
3
3
  phoneNumber: 'Número de teléfono',
4
+ selectCountry: 'Seleccione país',
5
+ suggestedCountries: 'Países sugeridos',
4
6
  };
@@ -1,4 +1,6 @@
1
1
  export default {
2
- selectCountry: 'Sélectionnez un pays',
2
+ allCountries: 'Tous les pays',
3
3
  phoneNumber: 'Numéro de téléphone',
4
+ selectCountry: 'Sélectionnez un pays',
5
+ suggestedCountries: 'Pays suggérés',
4
6
  };
@@ -1,4 +1,6 @@
1
1
  export default {
2
- selectCountry: 'Ország kiválasztása',
2
+ allCountries: 'Minden ország',
3
3
  phoneNumber: 'Telefonszám',
4
+ selectCountry: 'Ország kiválasztása',
5
+ suggestedCountries: 'Javasolt országok',
4
6
  };
@@ -1,4 +1,6 @@
1
1
  export default {
2
- selectCountry: 'Selezionare il paese',
2
+ allCountries: 'Tutti i paesi',
3
3
  phoneNumber: 'Numero di telefono',
4
+ selectCountry: 'Selezionare il paese',
5
+ suggestedCountries: 'Paesi consigliati',
4
6
  };
@@ -1,4 +1,6 @@
1
1
  export default {
2
- selectCountry: 'Selecteer land',
2
+ allCountries: 'Alle landen',
3
3
  phoneNumber: 'Telefoonnummer',
4
+ selectCountry: 'Selecteer land',
5
+ suggestedCountries: 'Voor gestelde landen',
4
6
  };
@@ -1,4 +1,6 @@
1
1
  export default {
2
- selectCountry: 'Wybierz kraj',
2
+ allCountries: 'Wszystkie kraje',
3
3
  phoneNumber: 'Numer telefonu',
4
+ selectCountry: 'Wybierz kraj',
5
+ suggestedCountries: 'Sugerowane kraje',
4
6
  };
@@ -1,4 +1,6 @@
1
1
  export default {
2
- selectCountry: 'Selectare țară',
2
+ allCountries: 'Toate țările',
3
3
  phoneNumber: 'Număr de telefon',
4
+ selectCountry: 'Selectare țară',
5
+ suggestedCountries: 'Țări sugerate',
4
6
  };
@@ -1,4 +1,6 @@
1
1
  export default {
2
- selectCountry: 'Выбрать страну',
2
+ allCountries: 'Все страны',
3
3
  phoneNumber: 'Номер телефона',
4
+ selectCountry: 'Выбрать страну',
5
+ suggestedCountries: 'Предлагаемые страны',
4
6
  };
@@ -1,4 +1,6 @@
1
1
  export default {
2
- selectCountry: 'Zvoliť krajinu',
2
+ allCountries: 'Všetky krajiny',
3
3
  phoneNumber: 'Telefónne číslo',
4
+ selectCountry: 'Zvoliť krajinu',
5
+ suggestedCountries: 'Odporúčané krajiny',
4
6
  };
@@ -1,4 +1,6 @@
1
1
  export default {
2
- selectCountry: 'Вибрати країну',
2
+ allCountries: 'Усі країни',
3
3
  phoneNumber: 'Номер телефону',
4
+ selectCountry: 'Вибрати країну',
5
+ suggestedCountries: 'Запропоновані країни',
4
6
  };
@@ -1,4 +1,6 @@
1
1
  export default {
2
- selectCountry: '选择国家/地区',
2
+ allCountries: '所有国家/地区',
3
3
  phoneNumber: '电话号码',
4
+ selectCountry: '选择国家/地区',
5
+ suggestedCountries: '建议的国家/地区',
4
6
  };
@@ -92,9 +92,9 @@ export class LionInputTelDropdown extends LionInputTel {
92
92
  },
93
93
  labels: {
94
94
  selectCountry: localize.msg('lion-input-tel:selectCountry'),
95
- // TODO: add translations
96
- allCountries: this._allCountriesLabel || 'All countries',
97
- preferredCountries: this._preferredCountriesLabel || 'Suggested countries',
95
+ allCountries: this._allCountriesLabel || localize.msg('lion-input-tel:allCountries'),
96
+ preferredCountries:
97
+ this._preferredCountriesLabel || localize.msg('lion-input-tel:suggestedCountries'),
98
98
  },
99
99
  },
100
100
  };
@@ -125,10 +125,10 @@ export class LionInputTelDropdown extends LionInputTel {
125
125
  >
126
126
  ${data?.regionMetaListPreferred?.length
127
127
  ? html`
128
- <optgroup label="${refs?.dropdown?.labels?._preferredCountries}">
128
+ <optgroup label="${refs?.dropdown?.labels?.preferredCountries}">
129
129
  ${data.regionMetaListPreferred.map(renderOption)}
130
130
  </optgroup>
131
- <optgroup label="${refs?.dropdown?.labels?._allCountries}">
131
+ <optgroup label="${refs?.dropdown?.labels?.allCountries}">
132
132
  ${data?.regionMetaList?.map(renderOption)}
133
133
  </optgroup>
134
134
  `
@@ -384,10 +384,6 @@ const ListboxMixinImplementation = superclass =>
384
384
  updated(changedProperties) {
385
385
  super.updated(changedProperties);
386
386
 
387
- if (this.formElements.length === 1) {
388
- this.singleOption = true;
389
- }
390
-
391
387
  if (changedProperties.has('disabled')) {
392
388
  if (this.disabled) {
393
389
  this.__requestOptionsToBeDisabled();
@@ -11,7 +11,7 @@ import { LionOption } from '../src/LionOption.js';
11
11
  export declare class ListboxHost {
12
12
  static get styles(): CSSResultArray;
13
13
  /**
14
- * When true, will synchronize activedescendant and selected element on
14
+ * When true, will synchronize active descendant and selected element on
15
15
  * arrow key navigation.
16
16
  * This behavior can usually be seen on <select> on the Windows platform.
17
17
  * Note that this behavior cannot be used when multiple-choice is true.
@@ -31,9 +31,6 @@ export declare class ListboxHost {
31
31
 
32
32
  public hasNoDefaultSelected: boolean;
33
33
 
34
- public singleOption: boolean;
35
- // protected _invokerNode: HTMLElement;
36
-
37
34
  public checkedIndex: number | number[];
38
35
 
39
36
  public activeIndex: number;
@@ -1,8 +1,7 @@
1
- import { EventTargetShim } from '@lion/ui/core.js';
2
- import { adoptStyles } from 'lit';
3
1
  import { overlays } from './singleton.js';
4
2
  import { containFocus } from './utils/contain-focus.js';
5
3
  import { overlayShadowDomStyle } from './overlayShadowDomStyle.js';
4
+ import { _adoptStyleUtils } from './utils/adopt-styles.js';
6
5
 
7
6
  /**
8
7
  * @typedef {import('@lion/ui/types/overlays.js').OverlayConfig} OverlayConfig
@@ -14,22 +13,6 @@ import { overlayShadowDomStyle } from './overlayShadowDomStyle.js';
14
13
  * @typedef {'setup'|'init'|'teardown'|'before-show'|'show'|'hide'|'add'|'remove'} OverlayPhase
15
14
  */
16
15
 
17
- const rootNodeStylesMap = new WeakSet();
18
-
19
- /**
20
- * Returns element that adopts stylesheet
21
- * @param {Element} shadowOrBodyEl
22
- * @returns {ShadowRoot}
23
- */
24
- function getRootNodeOrBodyElThatAdoptsStylesheet(shadowOrBodyEl) {
25
- const rootNode = /** @type {* & DocumentOrShadowRoot} */ (shadowOrBodyEl.getRootNode());
26
- if (rootNode === document) {
27
- // @ts-ignore
28
- return document.body;
29
- }
30
- return rootNode;
31
- }
32
-
33
16
  /**
34
17
  * From:
35
18
  * - wrappingDialogNodeL1: `<dialog role="none"/>`
@@ -129,7 +112,7 @@ const supportsCSSTypedObject = window.CSS?.number && document.body.attributeStyl
129
112
  * bottom/top/left/right sheets etc.
130
113
  *
131
114
  */
132
- export class OverlayController extends EventTargetShim {
115
+ export class OverlayController extends EventTarget {
133
116
  /**
134
117
  * @constructor
135
118
  * @param {OverlayConfig} config initial config. Will be remembered as shared config
@@ -208,7 +191,7 @@ export class OverlayController extends EventTargetShim {
208
191
 
209
192
  this.manager.add(this);
210
193
  /** @protected */
211
- this._contentId = `overlay-content--${Math.random().toString(36).substr(2, 10)}`;
194
+ this._contentId = `overlay-content--${Math.random().toString(36).slice(2, 10)}`;
212
195
  /** @private */
213
196
  this.__originalAttrs = new Map();
214
197
  this.updateConfig(config);
@@ -537,16 +520,20 @@ export class OverlayController extends EventTargetShim {
537
520
  OverlayController.popperModule = preloadPopper();
538
521
  }
539
522
  }
540
- this.__initOverlayStyles();
523
+ this.__handleOverlayStyles({ phase: 'init' });
541
524
  this._handleFeatures({ phase: 'init' });
542
525
  }
543
526
 
544
- __initOverlayStyles() {
545
- const rootNode = getRootNodeOrBodyElThatAdoptsStylesheet(this.contentWrapperNode);
546
- if (!rootNodeStylesMap.has(rootNode)) {
547
- // TODO: ideally we should also support a teardown
548
- adoptStyles(rootNode, [...(rootNode.adoptedStyleSheets || []), overlayShadowDomStyle]);
549
- rootNodeStylesMap.add(rootNode);
527
+ /**
528
+ * @param {{ phase: OverlayPhase }} config
529
+ * @private
530
+ */
531
+ __handleOverlayStyles({ phase }) {
532
+ const rootNode = /** @type {ShadowRoot} */ (this.contentWrapperNode?.getRootNode());
533
+ if (phase === 'init') {
534
+ _adoptStyleUtils.adoptStyle(rootNode, overlayShadowDomStyle);
535
+ } else if (phase === 'teardown') {
536
+ _adoptStyleUtils.adoptStyle(rootNode, overlayShadowDomStyle, { teardown: true });
550
537
  }
551
538
  }
552
539
 
@@ -973,22 +960,24 @@ export class OverlayController extends EventTargetShim {
973
960
  if (this.inheritsReferenceWidth) {
974
961
  this._handleInheritsReferenceWidth();
975
962
  }
976
-
977
963
  if (this.visibilityTriggerFunction) {
978
- this._handleUserInteraction({ phase });
964
+ this._handleVisibilityTriggers({ phase });
979
965
  }
980
966
  }
981
967
 
982
968
  /**
983
969
  * @param {{ phase: OverlayPhase }} config
984
970
  */
985
- _handleUserInteraction({ phase }) {
971
+ _handleVisibilityTriggers({ phase }) {
986
972
  if (typeof this.visibilityTriggerFunction === 'function') {
987
973
  if (phase === 'init') {
988
- this.__userInteractionHandler = this.visibilityTriggerFunction({ phase, controller: this });
974
+ this.__visibilityTriggerHandler = this.visibilityTriggerFunction({
975
+ phase,
976
+ controller: this,
977
+ });
989
978
  }
990
- if (this.__userInteractionHandler[phase]) {
991
- this.__userInteractionHandler[phase]();
979
+ if (this.__visibilityTriggerHandler[phase]) {
980
+ this.__visibilityTriggerHandler[phase]();
992
981
  }
993
982
  }
994
983
  }
@@ -1053,10 +1042,14 @@ export class OverlayController extends EventTargetShim {
1053
1042
  break;
1054
1043
  }
1055
1044
  case 'show':
1056
- this.backdropNode.classList.add(`overlays__backdrop--visible`);
1045
+ if (this.config.hasBackdrop) {
1046
+ this.backdropNode.classList.add(`overlays__backdrop--visible`);
1047
+ }
1057
1048
  this.__hasActiveBackdrop = true;
1058
1049
  break;
1059
1050
  case 'hide':
1051
+ case 'teardown':
1052
+ this.backdropNode.classList.remove(`overlays__backdrop--visible`);
1060
1053
  this.__hasActiveBackdrop = false;
1061
1054
  break;
1062
1055
  }
@@ -1279,6 +1272,7 @@ export class OverlayController extends EventTargetShim {
1279
1272
  }
1280
1273
 
1281
1274
  teardown() {
1275
+ this.__handleOverlayStyles({ phase: 'teardown' });
1282
1276
  this._handleFeatures({ phase: 'teardown' });
1283
1277
  }
1284
1278