@lion/ui 0.4.2 → 0.5.1

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 (175) hide show
  1. package/components/button/src/LionButton.js +2 -2
  2. package/components/calendar/src/LionCalendar.js +1 -1
  3. package/components/calendar/test-helpers/DayObject.js +2 -2
  4. package/components/collapsible/src/LionCollapsible.js +1 -0
  5. package/components/combobox/src/LionCombobox.js +79 -28
  6. package/components/combobox/test/lion-combobox-integrations.test.js +5 -0
  7. package/components/combobox/test/lion-combobox.test.js +290 -23
  8. package/components/combobox/test-helpers/combobox-helpers.js +5 -2
  9. package/components/core/src/browserDetection.js +8 -0
  10. package/components/drawer/src/LionDrawer.js +2 -0
  11. package/components/form-core/src/FocusMixin.js +2 -0
  12. package/components/form-core/src/FormControlMixin.js +1 -1
  13. package/components/form-core/src/choice-group/ChoiceGroupMixin.js +1 -0
  14. package/components/form-core/src/choice-group/CustomChoiceGroupMixin.js +173 -0
  15. package/components/form-core/src/utils/getAriaElementsInRightDomOrder.js +7 -14
  16. package/components/form-core/src/validate/validators/Required.js +2 -2
  17. package/components/form-core/test/choice-group/CustomChoiceGroupMixin.integrations.test.js +55 -0
  18. package/components/form-core/test/choice-group/CustomChoiceGroupMixin.test.js +16 -0
  19. package/components/form-core/test/utils/getAriaElementsInRightDomOrder.test.js +0 -25
  20. package/components/form-core/test/validate/StringValidators.test.js +1 -1
  21. package/components/form-core/test-helpers/ExampleValidators.js +1 -3
  22. package/components/form-core/test-suites/FormRegistrationMixins.suite.js +2 -0
  23. package/components/form-core/test-suites/NativeTextFieldMixin.suite.js +4 -4
  24. package/components/form-core/test-suites/ValidateMixin.suite.js +27 -0
  25. package/components/form-core/test-suites/ValidateMixinFeedbackPart.suite.js +11 -2
  26. package/components/form-core/test-suites/choice-group/ChoiceGroupMixin.suite.js +1 -0
  27. package/components/form-core/test-suites/choice-group/CustomChoiceGroupMixin.suite.js +265 -0
  28. package/components/form-core/types/choice-group/ChoiceGroupMixinTypes.ts +1 -1
  29. package/components/form-core/types/choice-group/CustomChoiceGroupMixinTypes.ts +30 -0
  30. package/components/form-core/types/choice-group/index.ts +1 -0
  31. package/components/helpers/src/SbActionLogger.js +1 -0
  32. package/components/icon/src/LionIcon.js +1 -9
  33. package/components/icon/test/lion-icon.test.js +2 -0
  34. package/components/input-datepicker/src/LionInputDatepicker.js +2 -6
  35. package/components/input-range/test/lion-input-range.test.js +12 -6
  36. package/components/listbox/src/LionOptions.js +5 -5
  37. package/components/listbox/src/ListboxMixin.js +1 -16
  38. package/components/listbox/test/lion-options.test.js +1 -1
  39. package/components/listbox/test-suites/ListboxMixin.suite.js +1 -1
  40. package/components/localize/src/date/getMonthNames.js +3 -0
  41. package/components/localize/src/date/parseDate.js +5 -1
  42. package/components/localize/src/date/utils/forceDotsForNlnl.js +11 -0
  43. package/components/localize/src/number/utils/normalize-format-number-to-parts/forceAddGroupSeparators.js +3 -1
  44. package/components/localize/src/number/utils/normalize-format-number-to-parts/forceSymbols.js +2 -0
  45. package/components/localize/src/number/utils/normalize-format-number-to-parts/normalizeIntl.js +1 -0
  46. package/components/localize/test/date/getMonthNames.test.js +1 -0
  47. package/components/localize/test/date/parseDate.test.js +6 -0
  48. package/components/localize/test-helpers/fake-imports.js +1 -0
  49. package/components/overlays/src/OverlaysManager.js +4 -15
  50. package/components/overlays/src/utils/adopt-styles.js +6 -1
  51. package/components/overlays/test/OverlaysManager.test.js +12 -11
  52. package/components/overlays/test/utils-tests/adopt-styles.test.js +61 -0
  53. package/components/overlays/test-suites/OverlayMixin.suite.js +2 -2
  54. package/components/radio-group/src/LionRadioGroup.js +1 -1
  55. package/components/radio-group/test/lion-radio-group.test.js +29 -0
  56. package/components/select/test/lion-select.test.js +1 -1
  57. package/components/switch/src/LionSwitch.js +3 -1
  58. package/components/switch/src/LionSwitchButton.js +2 -5
  59. package/components/tabs/src/LionTabs.js +7 -7
  60. package/components/textarea/src/LionTextarea.js +1 -1
  61. package/components/validate-messages/translations/de.js +3 -3
  62. package/custom-elements.json +103123 -61806
  63. package/dist-types/components/button/src/LionButton.d.ts.map +1 -1
  64. package/dist-types/components/collapsible/src/LionCollapsible.d.ts.map +1 -1
  65. package/dist-types/components/combobox/src/LionCombobox.d.ts +13 -8
  66. package/dist-types/components/combobox/src/LionCombobox.d.ts.map +1 -1
  67. package/dist-types/components/combobox/test-helpers/combobox-helpers.d.ts.map +1 -1
  68. package/dist-types/components/core/src/browserDetection.d.ts +2 -0
  69. package/dist-types/components/drawer/src/LionDrawer.d.ts.map +1 -1
  70. package/dist-types/components/form-core/src/FocusMixin.d.ts.map +1 -1
  71. package/dist-types/components/form-core/src/choice-group/ChoiceGroupMixin.d.ts.map +1 -1
  72. package/dist-types/components/form-core/src/choice-group/CustomChoiceGroupMixin.d.ts +4 -0
  73. package/dist-types/components/form-core/src/choice-group/CustomChoiceGroupMixin.d.ts.map +1 -0
  74. package/dist-types/components/form-core/src/utils/getAriaElementsInRightDomOrder.d.ts +5 -5
  75. package/dist-types/components/form-core/src/utils/getAriaElementsInRightDomOrder.d.ts.map +1 -1
  76. package/dist-types/components/form-core/test/choice-group/CustomChoiceGroupMixin.integrations.test.d.ts +2 -0
  77. package/dist-types/components/form-core/test/choice-group/CustomChoiceGroupMixin.integrations.test.d.ts.map +1 -0
  78. package/dist-types/components/form-core/test/choice-group/CustomChoiceGroupMixin.test.d.ts +6 -0
  79. package/dist-types/components/form-core/test/choice-group/CustomChoiceGroupMixin.test.d.ts.map +1 -0
  80. package/dist-types/components/form-core/test-helpers/ExampleValidators.d.ts +0 -1
  81. package/dist-types/components/form-core/test-helpers/ExampleValidators.d.ts.map +1 -1
  82. package/dist-types/components/form-core/test-suites/FormRegistrationMixins.suite.d.ts.map +1 -1
  83. package/dist-types/components/form-core/test-suites/ValidateMixin.suite.d.ts.map +1 -1
  84. package/dist-types/components/form-core/test-suites/ValidateMixinFeedbackPart.suite.d.ts.map +1 -1
  85. package/dist-types/components/form-core/test-suites/choice-group/ChoiceGroupMixin.suite.d.ts.map +1 -1
  86. package/dist-types/components/form-core/test-suites/choice-group/CustomChoiceGroupMixin.suite.d.ts +14 -0
  87. package/dist-types/components/form-core/test-suites/choice-group/CustomChoiceGroupMixin.suite.d.ts.map +1 -0
  88. package/dist-types/components/form-core/types/choice-group/ChoiceGroupMixinTypes.d.ts +1 -1
  89. package/dist-types/components/form-core/types/choice-group/ChoiceGroupMixinTypes.d.ts.map +1 -1
  90. package/dist-types/components/form-core/types/choice-group/CustomChoiceGroupMixinTypes.d.ts +18 -0
  91. package/dist-types/components/form-core/types/choice-group/CustomChoiceGroupMixinTypes.d.ts.map +1 -0
  92. package/dist-types/components/form-core/types/choice-group/index.d.ts +1 -0
  93. package/dist-types/components/form-core/types/choice-group/index.d.ts.map +1 -1
  94. package/dist-types/components/helpers/src/SbActionLogger.d.ts.map +1 -1
  95. package/dist-types/components/icon/src/LionIcon.d.ts +0 -9
  96. package/dist-types/components/icon/src/LionIcon.d.ts.map +1 -1
  97. package/dist-types/components/input-datepicker/src/LionInputDatepicker.d.ts +0 -2
  98. package/dist-types/components/input-datepicker/src/LionInputDatepicker.d.ts.map +1 -1
  99. package/dist-types/components/listbox/src/LionOptions.d.ts +0 -5
  100. package/dist-types/components/listbox/src/LionOptions.d.ts.map +1 -1
  101. package/dist-types/components/listbox/src/ListboxMixin.d.ts.map +1 -1
  102. package/dist-types/components/localize/src/date/getMonthNames.d.ts.map +1 -1
  103. package/dist-types/components/localize/src/date/parseDate.d.ts.map +1 -1
  104. package/dist-types/components/localize/src/date/utils/forceDotsForNlnl.d.ts +5 -0
  105. package/dist-types/components/localize/src/date/utils/forceDotsForNlnl.d.ts.map +1 -0
  106. package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/forceAddGroupSeparators.d.ts.map +1 -1
  107. package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/forceSymbols.d.ts.map +1 -1
  108. package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/normalizeIntl.d.ts.map +1 -1
  109. package/dist-types/components/localize/test-helpers/fake-imports.d.ts.map +1 -1
  110. package/dist-types/components/overlays/src/OverlaysManager.d.ts +0 -4
  111. package/dist-types/components/overlays/src/OverlaysManager.d.ts.map +1 -1
  112. package/dist-types/components/overlays/src/utils/adopt-styles.d.ts.map +1 -1
  113. package/dist-types/components/overlays/test/OverlaysManager.test.d.ts.map +1 -1
  114. package/dist-types/components/switch/src/LionSwitch.d.ts.map +1 -1
  115. package/dist-types/components/switch/src/LionSwitchButton.d.ts +0 -5
  116. package/dist-types/components/switch/src/LionSwitchButton.d.ts.map +1 -1
  117. package/dist-types/components/tabs/src/LionTabs.d.ts.map +1 -1
  118. package/dist-types/exports/types/form-core.d.ts +1 -1
  119. package/dist-types/exports/types/form-core.d.ts.map +1 -1
  120. package/dist-types/tsconfig.tsbuildinfo +1 -1
  121. package/docs/components/checkbox-group/overview.md +2 -2
  122. package/docs/components/collapsible/assets/CustomCollapsible.js +4 -0
  123. package/docs/components/collapsible/overview.md +1 -1
  124. package/docs/components/combobox/overview.md +1 -1
  125. package/docs/components/combobox/src/demo-selection-display.js +8 -35
  126. package/docs/components/combobox/use-cases.md +24 -1
  127. package/docs/components/dialog/overview.md +1 -1
  128. package/docs/components/fieldset/overview.md +5 -5
  129. package/docs/components/form/overview.md +3 -3
  130. package/docs/components/icon/use-cases.md +1 -1
  131. package/docs/components/input/overview.md +1 -1
  132. package/docs/components/input-amount/overview.md +3 -3
  133. package/docs/components/input-date/overview.md +3 -3
  134. package/docs/components/input-datepicker/overview.md +5 -5
  135. package/docs/components/input-email/overview.md +2 -2
  136. package/docs/components/input-file/overview.md +1 -1
  137. package/docs/components/input-iban/overview.md +2 -2
  138. package/docs/components/input-range/overview.md +2 -2
  139. package/docs/components/input-stepper/overview.md +1 -1
  140. package/docs/components/input-tel/overview.md +1 -1
  141. package/docs/components/input-tel/use-cases.md +6 -6
  142. package/docs/components/input-tel-dropdown/overview.md +1 -1
  143. package/docs/components/radio-group/overview.md +3 -3
  144. package/docs/components/select-rich/use-cases.md +1 -1
  145. package/docs/components/tabs/examples.md +1 -1
  146. package/docs/fundamentals/index.md +4 -4
  147. package/docs/fundamentals/node-tools/providence-analytics/LocalConfiguration.md +1 -1
  148. package/docs/fundamentals/node-tools/providence-analytics/QueryResult.md +1 -1
  149. package/docs/fundamentals/node-tools/providence-analytics/analyzer.md +1 -1
  150. package/docs/fundamentals/node-tools/providence-analytics/dashboard.md +1 -1
  151. package/docs/fundamentals/node-tools/providence-analytics/overview.md +3 -3
  152. package/docs/fundamentals/node-tools/publish-docs/overview.md +3 -3
  153. package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md +2 -2
  154. package/docs/fundamentals/rationales/accessibility.md +3 -3
  155. package/docs/fundamentals/systems/core/SlotMixin.md +1 -1
  156. package/docs/fundamentals/systems/core/overview.md +1 -1
  157. package/docs/fundamentals/systems/form/formatting-and-parsing.md +4 -4
  158. package/docs/fundamentals/systems/form/model-value.md +1 -1
  159. package/docs/fundamentals/systems/form/overview.md +28 -28
  160. package/docs/fundamentals/systems/form/validate.md +18 -2
  161. package/docs/fundamentals/systems/localize/overview.md +4 -4
  162. package/docs/fundamentals/systems/overlays/configuration.md +3 -2
  163. package/docs/fundamentals/systems/overlays/overview.md +5 -5
  164. package/docs/fundamentals/systems/overlays/use-cases.md +2 -2
  165. package/docs/fundamentals/tools/helpers/overview.md +1 -1
  166. package/docs/fundamentals/tools/singleton-manager/example-complex/overlayCompatibility.js +1 -2
  167. package/docs/fundamentals/tools/singleton-manager/overview.md +4 -4
  168. package/docs/guides/how-to/create-a-custom-field.md +5 -5
  169. package/docs/guides/how-to/create-a-form.md +4 -4
  170. package/docs/guides/how-to/extend-a-native-input.md +2 -2
  171. package/docs/guides/index.md +8 -8
  172. package/docs/guides/principles/index.md +5 -5
  173. package/docs/guides/principles/styling.md +1 -1
  174. package/exports/types/form-core.ts +5 -1
  175. package/package.json +2 -2
@@ -1,3 +1,5 @@
1
+ import { browserDetection } from '@lion/ui/core.js';
2
+
1
3
  // See: https://github.com/ing-bank/lion/issues/1880
2
4
 
3
5
  /**
@@ -106,7 +108,10 @@ export function adoptStyle(renderRoot, style, { teardown = false } = {}) {
106
108
  return;
107
109
  }
108
110
 
109
- if (!_adoptStyleUtils.supportsAdoptingStyleSheets) {
111
+ // ios seems to have issues when using the adoptedStyleSheets where some styles are applied
112
+ // while others are ignored so the overlays are rendered incorrectly, to mitigate it we use
113
+ // traditional "stylesheet".
114
+ if (!_adoptStyleUtils.supportsAdoptingStyleSheets || browserDetection.isIOS) {
110
115
  adoptStyleWhenAdoptedStylesheetsNotSupported(renderRoot, style, { teardown });
111
116
  return;
112
117
  }
@@ -1,7 +1,8 @@
1
1
  import { expect, fixture } from '@open-wc/testing';
2
2
  import { html } from 'lit/static-html.js';
3
+ import sinon from 'sinon';
4
+ import { browserDetection } from '@lion/ui/core.js';
3
5
  import { OverlayController, OverlaysManager } from '@lion/ui/overlays.js';
4
- import { _browserDetection } from '../src/OverlaysManager.js';
5
6
 
6
7
  /**
7
8
  * @typedef {import('../types/OverlayConfig.js').OverlayConfig} OverlayConfig
@@ -101,24 +102,24 @@ describe('OverlaysManager', () => {
101
102
  });
102
103
 
103
104
  describe('Browser/device edge cases', () => {
104
- const isIOSOriginal = _browserDetection.isIOS;
105
- const isMacSafariOriginal = _browserDetection.isMacSafari;
105
+ const isIOSDetectionStub = sinon.stub(browserDetection, 'isIOS');
106
+ const isMacSafariDetectionStub = sinon.stub(browserDetection, 'isMacSafari');
106
107
 
107
108
  function mockIOS() {
108
- _browserDetection.isIOS = true;
109
- _browserDetection.isMacSafari = false;
109
+ isIOSDetectionStub.value(true);
110
+ isMacSafariDetectionStub.value(false);
110
111
  }
111
112
 
112
113
  function mockMacSafari() {
113
114
  // When we are iOS
114
- _browserDetection.isIOS = false;
115
- _browserDetection.isMacSafari = true;
115
+ isIOSDetectionStub.value(false);
116
+ isMacSafariDetectionStub.value(true);
116
117
  }
117
118
 
118
119
  afterEach(() => {
119
120
  // Restore original values
120
- _browserDetection.isIOS = isIOSOriginal;
121
- _browserDetection.isMacSafari = isMacSafariOriginal;
121
+ isIOSDetectionStub.restore();
122
+ isMacSafariDetectionStub.restore();
122
123
  });
123
124
 
124
125
  describe('When initialized with "preventsScroll: true"', () => {
@@ -137,8 +138,8 @@ describe('OverlaysManager', () => {
137
138
  );
138
139
 
139
140
  // When we are not iOS nor MacSafari
140
- _browserDetection.isIOS = false;
141
- _browserDetection.isMacSafari = false;
141
+ isIOSDetectionStub.value(false);
142
+ isMacSafariDetectionStub.value(false);
142
143
 
143
144
  const dialog2 = new OverlayController({ ...defaultOptions, preventsScroll: true }, mngr);
144
145
  await dialog2.show();
@@ -1,4 +1,5 @@
1
1
  import { expect } from '@open-wc/testing';
2
+ import { browserDetection } from '@lion/ui/core.js';
2
3
  import { css } from 'lit';
3
4
  import sinon from 'sinon';
4
5
  import {
@@ -164,6 +165,66 @@ describe('adoptStyle()', () => {
164
165
  });
165
166
  });
166
167
 
168
+ describe('Fallback when IOS user opens overlay', () => {
169
+ it('adds a "traditional" stylesheet to the body', async () => {
170
+ const browserDetectionStub = sinon.stub(browserDetection, 'isIOS').value(true);
171
+
172
+ const myCssResult = css`
173
+ .check {
174
+ color: blue;
175
+ }
176
+ `;
177
+ const root = document;
178
+ adoptStyle(root, myCssResult);
179
+
180
+ const sheets = Array.from(document.body.querySelectorAll('style'));
181
+ const lastAddedSheet = sheets[sheets.length - 1];
182
+ expect(lastAddedSheet.textContent).to.equal(myCssResult.cssText);
183
+ browserDetectionStub.restore();
184
+ });
185
+
186
+ describe('Teardown', () => {
187
+ it('removes a "traditional" stylesheet from the shadowRoot', async () => {
188
+ const browserDetectionStub = sinon.stub(browserDetection, 'isIOS').value(true);
189
+
190
+ const { shadowHost, cleanupShadowHost } = createShadowHost();
191
+ const myCssResult = css`
192
+ .check {
193
+ color: blue;
194
+ }
195
+ `;
196
+ const root = /** @type {ShadowRoot} */ (shadowHost.shadowRoot);
197
+
198
+ adoptStyle(root, myCssResult);
199
+ const sheets1 = Array.from(root.querySelectorAll('style'));
200
+ const lastAddedSheet1 = sheets1[sheets1.length - 1];
201
+ expect(lastAddedSheet1.textContent).to.equal(myCssResult.cssText);
202
+ adoptStyle(root, myCssResult, { teardown: true });
203
+ const sheets2 = Array.from(root.querySelectorAll('style'));
204
+ const lastAddedSheet2 = sheets2[sheets2.length - 1];
205
+ expect(lastAddedSheet2?.textContent).to.not.equal(myCssResult.cssText);
206
+
207
+ const myCSSStyleSheet = new CSSStyleSheet();
208
+ myCSSStyleSheet.insertRule('.check { color: blue; }');
209
+
210
+ adoptStyle(root, myCSSStyleSheet);
211
+ const sheets3 = Array.from(root.querySelectorAll('style'));
212
+ const lastAddedSheet3 = sheets3[sheets3.length - 1];
213
+ expect(lastAddedSheet3.textContent).to.equal(
214
+ serializeConstructableStylesheet(myCSSStyleSheet),
215
+ );
216
+ adoptStyle(root, myCSSStyleSheet, { teardown: true });
217
+ const sheets4 = Array.from(root.querySelectorAll('style'));
218
+ const lastAddedSheet4 = sheets4[sheets4.length - 1];
219
+ expect(lastAddedSheet4?.textContent).to.not.equal(myCSSStyleSheet);
220
+
221
+ cleanupShadowHost();
222
+
223
+ browserDetectionStub.restore();
224
+ });
225
+ });
226
+ });
227
+
167
228
  describe('adoptStyles()', () => {
168
229
  it('calls "adoptStyle" for all entries in CSSResult|CSSStylesheet[]', async () => {
169
230
  const spy = sinon.spy(_adoptStyleUtils, 'adoptStyle');
@@ -4,7 +4,7 @@ import sinon from 'sinon';
4
4
  import { overlays as overlaysManager, OverlayController } from '@lion/ui/overlays.js';
5
5
 
6
6
  import '@lion/ui/define/lion-dialog.js';
7
- import { _browserDetection } from '../src/OverlaysManager.js';
7
+ import { browserDetection } from '@lion/ui/core.js';
8
8
 
9
9
  /**
10
10
  * @typedef {import('../types/OverlayConfig.js').OverlayConfig} OverlayConfig
@@ -99,7 +99,7 @@ export function runOverlayMixinSuite({ tagString, tag, suffix = '' }) {
99
99
  // For now, we skip this test for MacSafari, since the body.overlays-scroll-lock-ios-fix
100
100
  // class results in a scrollbar when preventsScroll is true.
101
101
  // However, fully functioning interacive elements (input fields) in the dialog are more important
102
- if (_browserDetection.isMacSafari && elWithBigParent._overlayCtrl.preventsScroll) {
102
+ if (browserDetection.isMacSafari && elWithBigParent._overlayCtrl.preventsScroll) {
103
103
  return;
104
104
  }
105
105
 
@@ -23,7 +23,7 @@ export class LionRadioGroup extends ChoiceGroupMixin(FormGroupMixin(LitElement))
23
23
  child.reset();
24
24
  // If the value was initially checked save this
25
25
  if (child.checked) {
26
- initValue = child.value;
26
+ initValue = child.choiceValue;
27
27
  }
28
28
  }
29
29
  });
@@ -49,6 +49,35 @@ describe('<lion-radio-group>', () => {
49
49
  await el.updateComplete;
50
50
  expect(el.modelValue).to.deep.equal('female');
51
51
  });
52
+
53
+ it('restores default values if changes were made to a group containing options with formatters', async () => {
54
+ const formatter = /** @type {(modelValue: { value: string}) => string} */ modelValue =>
55
+ modelValue.value.charAt(0);
56
+ const el = await fixture(html`
57
+ <lion-radio-group name="gender" label="Gender">
58
+ <lion-radio label="Male" .formatter=${formatter} .choiceValue=${'male'}></lion-radio>
59
+ <lion-radio
60
+ label="Female"
61
+ .formatter=${formatter}
62
+ .modelValue=${{ value: 'female', checked: true }}
63
+ ></lion-radio>
64
+ <lion-radio label="Other" .formatter=${formatter} .choiceValue=${'other'}></lion-radio>
65
+ </lion-radio-group>
66
+ `);
67
+ el.formElements[0].checked = true;
68
+ expect(el.modelValue).to.deep.equal('male');
69
+
70
+ el.resetGroup();
71
+ expect(el.modelValue).to.deep.equal('female');
72
+
73
+ el.formElements[2].checked = true;
74
+ expect(el.modelValue).to.deep.equal('other');
75
+
76
+ el.resetGroup();
77
+ await el.formElements[1].updateComplete;
78
+ await el.updateComplete;
79
+ expect(el.modelValue).to.deep.equal('female');
80
+ });
52
81
  });
53
82
 
54
83
  it('should have role = radiogroup', async () => {
@@ -60,7 +60,7 @@ describe('lion-select', () => {
60
60
  expect(lionSelect.formattedValue).to.equal('');
61
61
 
62
62
  const select = /** @type {HTMLSlotElement} */ (
63
- lionSelect.shadowRoot?.querySelector('slot[name=input]')
63
+ /** @type {ShadowRoot} */ (lionSelect.shadowRoot).querySelector('slot[name=input]')
64
64
  ).assignedElements()[0];
65
65
  const options = select.querySelectorAll('option');
66
66
  options[1].textContent = 'Item 2';
@@ -100,7 +100,9 @@ export class LionSwitch extends ScopedElementsMixin(ChoiceInputMixin(LionField))
100
100
  /** @param {import('lit').PropertyValues } changedProperties */
101
101
  updated(changedProperties) {
102
102
  super.updated(changedProperties);
103
- this._syncButtonSwitch();
103
+ if (changedProperties.has('disabled')) {
104
+ this._syncButtonSwitch();
105
+ }
104
106
  }
105
107
 
106
108
  /**
@@ -4,10 +4,6 @@ import { DisabledWithTabIndexMixin } from '@lion/ui/core.js';
4
4
  export class LionSwitchButton extends DisabledWithTabIndexMixin(LitElement) {
5
5
  static get properties() {
6
6
  return {
7
- role: {
8
- type: String,
9
- reflect: true,
10
- },
11
7
  checked: {
12
8
  type: Boolean,
13
9
  reflect: true,
@@ -76,7 +72,6 @@ export class LionSwitchButton extends DisabledWithTabIndexMixin(LitElement) {
76
72
  // inputNode = this, which always requires a value prop
77
73
  this.value = '';
78
74
 
79
- this.role = 'switch';
80
75
  this.checked = false;
81
76
  this.__initialized = false;
82
77
  /** @protected */
@@ -89,6 +84,7 @@ export class LionSwitchButton extends DisabledWithTabIndexMixin(LitElement) {
89
84
 
90
85
  connectedCallback() {
91
86
  super.connectedCallback();
87
+ this.setAttribute('role', 'switch');
92
88
  this.setAttribute('aria-checked', `${this.checked}`);
93
89
  this.addEventListener('click', this._toggleChecked);
94
90
  this.addEventListener('keydown', this.__handleKeydown);
@@ -146,6 +142,7 @@ export class LionSwitchButton extends DisabledWithTabIndexMixin(LitElement) {
146
142
 
147
143
  /** @param {import('lit').PropertyValues } changedProperties */
148
144
  updated(changedProperties) {
145
+ super.updated(changedProperties);
149
146
  if (changedProperties.has('disabled')) {
150
147
  this.setAttribute('aria-disabled', `${this.disabled}`); // create mixin if we need it in more places
151
148
  }
@@ -345,6 +345,13 @@ export class LionTabs extends LitElement {
345
345
  }
346
346
  }
347
347
 
348
+ /**
349
+ * @return {number}
350
+ */
351
+ get selectedIndex() {
352
+ return this.__selectedIndex || 0;
353
+ }
354
+
348
355
  /**
349
356
  * @param {number} value The new index
350
357
  */
@@ -371,13 +378,6 @@ export class LionTabs extends LitElement {
371
378
  this.requestUpdate('selectedIndex', stale);
372
379
  }
373
380
 
374
- /**
375
- * @return {number}
376
- */
377
- get selectedIndex() {
378
- return this.__selectedIndex || 0;
379
- }
380
-
381
381
  /** @protected */
382
382
  get _pairCount() {
383
383
  return (this.__store && this.__store.length) || 0;
@@ -198,7 +198,7 @@ export class LionTextarea extends NativeTextFieldMixin(LionFieldWithTextArea) {
198
198
  let count = 3; // max tasks to wait for
199
199
  // @ts-ignore this property is added by webcomponentsjs polyfill for old browsers
200
200
  while (count !== 0 && !this.__shady_native_contains(this._inputNode)) {
201
- // eslint-disable-next-line no-await-in-loop
201
+ // eslint-disable-next-line no-await-in-loop, no-promise-executor-return
202
202
  await new Promise(resolve => setTimeout(resolve));
203
203
  count -= 1;
204
204
  }
@@ -5,8 +5,8 @@ export default {
5
5
  MinLength: 'Du musst mindestens {params} Zeichen eingeben.',
6
6
  MaxLength: 'Du kannst maximal {params} Zeichen eingeben.',
7
7
  MinMaxLength: 'Du musst zwischen {params.min} und {params.max} Zeichen eingeben.',
8
- Pattern: 'Geben Sie ein gültiges {fieldName} ein.',
9
- IsNumber: 'Geben Sie ein gültiges {fieldName} ein.',
8
+ Pattern: 'Geben Sie ein gültige {fieldName} ein.',
9
+ IsNumber: 'Geben Sie ein gültige {fieldName} ein.',
10
10
  MinNumber: 'Geben Sie für {fieldName} einen Wert über {params} ein.',
11
11
  MaxNumber: 'Geben Sie für {fieldName} einen Wert unter {params} ein.',
12
12
  MinMaxNumber:
@@ -27,7 +27,7 @@ export default {
27
27
  MinLength: 'Du solltest mindestens {params} Zeichen eingeben.',
28
28
  MaxLength: 'Du kannst maximal {params} Zeichen eingeben.',
29
29
  MinMaxLength: 'Du solltest zwischen {params.min} und {params.max} Zeichen eingeben.',
30
- IsNumber: 'Geben Sie ein gültiges {fieldName} ein.',
30
+ IsNumber: 'Geben Sie ein gültige {fieldName} ein.',
31
31
  MinNumber: 'Geben Sie für {fieldName} einen Wert über {params} ein.',
32
32
  MaxNumber: 'Geben Sie für {fieldName} einen Wert unter {params} ein.',
33
33
  MinMaxNumber: