@lion/ui 0.0.12 → 0.0.14
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/accordion/src/LionAccordion.js +22 -9
- package/components/accordion/test/lion-accordion.test.js +29 -32
- package/components/icon/src/LionIcon.js +11 -4
- package/components/input-tel/translations/bg.js +3 -1
- package/components/input-tel/translations/cs.js +3 -1
- package/components/input-tel/translations/de.js +3 -1
- package/components/input-tel/translations/en.js +3 -1
- package/components/input-tel/translations/es.js +3 -1
- package/components/input-tel/translations/fr.js +3 -1
- package/components/input-tel/translations/hu.js +3 -1
- package/components/input-tel/translations/it.js +3 -1
- package/components/input-tel/translations/nl.js +3 -1
- package/components/input-tel/translations/pl.js +3 -1
- package/components/input-tel/translations/ro.js +3 -1
- package/components/input-tel/translations/ru.js +3 -1
- package/components/input-tel/translations/sk.js +3 -1
- package/components/input-tel/translations/uk.js +3 -1
- package/components/input-tel/translations/zh.js +3 -1
- package/components/input-tel-dropdown/src/LionInputTelDropdown.js +5 -5
- package/components/listbox/src/ListboxMixin.js +0 -4
- package/components/listbox/types/ListboxMixinTypes.ts +1 -4
- package/components/localize/src/LocalizeMixin.js +4 -3
- package/components/overlays/src/OverlayController.js +14 -25
- package/components/overlays/src/utils/adopt-styles.js +136 -0
- package/components/overlays/test/OverlayController.test.js +8 -55
- package/components/overlays/test/local-positioning.test.js +1 -1
- package/components/overlays/test/utils-tests/adopt-styles.test.js +177 -0
- package/components/overlays/test-helpers/createShadowHost.js +16 -0
- package/components/overlays/{test/utils-tests/local-positioning-helpers.js → test-helpers/normalizeTransformStyle.js} +0 -0
- package/components/select-rich/src/LionSelectRich.js +12 -6
- package/components/select-rich/test/lion-select-rich.test.js +25 -1
- package/custom-elements.json +418 -113
- package/dist-types/components/accordion/src/LionAccordion.d.ts.map +1 -1
- package/dist-types/components/icon/src/LionIcon.d.ts.map +1 -1
- package/dist-types/components/input-tel/translations/bg-BG.d.ts +3 -1
- package/dist-types/components/input-tel/translations/bg.d.ts +3 -1
- package/dist-types/components/input-tel/translations/cs-CZ.d.ts +3 -1
- package/dist-types/components/input-tel/translations/cs.d.ts +3 -1
- package/dist-types/components/input-tel/translations/de-DE.d.ts +3 -1
- package/dist-types/components/input-tel/translations/de.d.ts +3 -1
- package/dist-types/components/input-tel/translations/en-AU.d.ts +3 -1
- package/dist-types/components/input-tel/translations/en-GB.d.ts +3 -1
- package/dist-types/components/input-tel/translations/en-US.d.ts +3 -1
- package/dist-types/components/input-tel/translations/en.d.ts +3 -1
- package/dist-types/components/input-tel/translations/es-ES.d.ts +3 -1
- package/dist-types/components/input-tel/translations/es.d.ts +3 -1
- package/dist-types/components/input-tel/translations/fr-BE.d.ts +3 -1
- package/dist-types/components/input-tel/translations/fr-FR.d.ts +3 -1
- package/dist-types/components/input-tel/translations/fr.d.ts +3 -1
- package/dist-types/components/input-tel/translations/hu-HU.d.ts +3 -1
- package/dist-types/components/input-tel/translations/hu.d.ts +3 -1
- package/dist-types/components/input-tel/translations/it-IT.d.ts +3 -1
- package/dist-types/components/input-tel/translations/it.d.ts +3 -1
- package/dist-types/components/input-tel/translations/nl-BE.d.ts +3 -1
- package/dist-types/components/input-tel/translations/nl-NL.d.ts +3 -1
- package/dist-types/components/input-tel/translations/nl.d.ts +3 -1
- package/dist-types/components/input-tel/translations/pl-PL.d.ts +3 -1
- package/dist-types/components/input-tel/translations/pl.d.ts +3 -1
- package/dist-types/components/input-tel/translations/ro-RO.d.ts +3 -1
- package/dist-types/components/input-tel/translations/ro.d.ts +3 -1
- package/dist-types/components/input-tel/translations/ru-RU.d.ts +3 -1
- package/dist-types/components/input-tel/translations/ru.d.ts +3 -1
- package/dist-types/components/input-tel/translations/sk-SK.d.ts +3 -1
- package/dist-types/components/input-tel/translations/sk.d.ts +3 -1
- package/dist-types/components/input-tel/translations/uk-UA.d.ts +3 -1
- package/dist-types/components/input-tel/translations/uk.d.ts +3 -1
- package/dist-types/components/input-tel/translations/zh.d.ts +3 -1
- package/dist-types/components/listbox/src/ListboxMixin.d.ts.map +1 -1
- package/dist-types/components/listbox/types/ListboxMixinTypes.d.ts +1 -2
- package/dist-types/components/listbox/types/ListboxMixinTypes.d.ts.map +1 -1
- package/dist-types/components/localize/src/LocalizeMixin.d.ts +1 -0
- package/dist-types/components/localize/src/LocalizeMixin.d.ts.map +1 -1
- package/dist-types/components/overlays/src/OverlayController.d.ts +5 -1
- package/dist-types/components/overlays/src/OverlayController.d.ts.map +1 -1
- package/dist-types/components/overlays/src/utils/adopt-styles.d.ts +24 -0
- package/dist-types/components/overlays/src/utils/adopt-styles.d.ts.map +1 -0
- package/dist-types/components/overlays/test/OverlayController.test.d.ts.map +1 -1
- package/dist-types/components/overlays/test/utils-tests/adopt-styles.test.d.ts +2 -0
- package/dist-types/components/overlays/test/utils-tests/adopt-styles.test.d.ts.map +1 -0
- package/dist-types/components/overlays/test-helpers/createShadowHost.d.ts +8 -0
- package/dist-types/components/overlays/test-helpers/createShadowHost.d.ts.map +1 -0
- package/dist-types/components/overlays/{test/utils-tests/local-positioning-helpers.d.ts → test-helpers/normalizeTransformStyle.d.ts} +1 -1
- package/dist-types/components/overlays/test-helpers/normalizeTransformStyle.d.ts.map +1 -0
- package/dist-types/components/select-rich/src/LionSelectRich.d.ts +8 -8
- package/dist-types/components/select-rich/src/LionSelectRich.d.ts.map +1 -1
- package/dist-types/tsconfig.tsbuildinfo +1 -1
- package/docs/components/button/use-cases.md +2 -0
- package/docs/components/checkbox-group/overview.md +2 -2
- package/docs/components/collapsible/overview.md +1 -1
- package/docs/components/combobox/overview.md +1 -1
- package/docs/components/combobox/src/demo-selection-display.js +1 -1
- package/docs/components/combobox/use-cases.md +1 -1
- package/docs/components/dialog/overview.md +1 -1
- package/docs/components/dialog/src/demoStyle.js +18 -0
- package/docs/components/fieldset/overview.md +5 -5
- package/docs/components/form/overview.md +3 -3
- package/docs/components/icon/use-cases.md +1 -1
- package/docs/components/input/overview.md +1 -1
- package/docs/components/input-amount/overview.md +3 -3
- package/docs/components/input-date/overview.md +3 -3
- package/docs/components/input-datepicker/overview.md +5 -5
- package/docs/components/input-email/overview.md +2 -2
- package/docs/components/input-iban/overview.md +2 -2
- package/docs/components/input-range/overview.md +2 -2
- package/docs/components/input-stepper/overview.md +1 -1
- package/docs/components/input-tel/overview.md +1 -1
- package/docs/components/input-tel/use-cases.md +6 -6
- package/docs/components/input-tel-dropdown/overview.md +1 -1
- package/docs/components/radio-group/overview.md +3 -3
- package/docs/components/select-rich/use-cases.md +30 -24
- package/docs/components/tabs/examples.md +1 -1
- package/docs/fundamentals/index.md +4 -4
- package/docs/fundamentals/node-tools/providence-analytics/LocalConfiguration.md +1 -1
- package/docs/fundamentals/node-tools/providence-analytics/QueryResult.md +1 -1
- package/docs/fundamentals/node-tools/providence-analytics/analyzer.md +1 -1
- package/docs/fundamentals/node-tools/providence-analytics/dashboard.md +1 -1
- package/docs/fundamentals/node-tools/providence-analytics/overview.md +3 -3
- package/docs/fundamentals/node-tools/publish-docs/overview.md +3 -3
- package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md +2 -2
- package/docs/fundamentals/systems/core/overview.md +1 -1
- package/docs/fundamentals/systems/form/formatting-and-parsing.md +4 -4
- package/docs/fundamentals/systems/form/model-value.md +1 -1
- package/docs/fundamentals/systems/form/overview.md +28 -28
- package/docs/fundamentals/systems/form/validate.md +1 -1
- package/docs/fundamentals/systems/localize/overview.md +4 -4
- package/docs/fundamentals/systems/overlays/assets/demo-el-using-overlaymixin.mjs +0 -16
- package/docs/fundamentals/systems/overlays/configuration.md +13 -25
- package/docs/fundamentals/systems/overlays/overview.md +5 -5
- package/docs/fundamentals/systems/overlays/use-cases.md +5 -5
- package/docs/fundamentals/tools/helpers/overview.md +1 -1
- package/docs/fundamentals/tools/singleton-manager/.gitignore +1 -0
- package/docs/fundamentals/tools/singleton-manager/example-complex/demo-app.js +93 -0
- package/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/overlays/index.js +30 -0
- package/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/overlays/instance.js +4 -0
- package/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-a/page-a.js +35 -0
- package/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-b/node_modules/overlays/index.js +30 -0
- package/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-b/node_modules/overlays/instance.js +4 -0
- package/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-b/page-b.js +49 -0
- package/docs/fundamentals/tools/singleton-manager/example-complex/overlayCompatibility.js +70 -0
- package/docs/fundamentals/tools/singleton-manager/example-fail/demo-app.js +91 -0
- package/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/overlays/index.js +30 -0
- package/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/overlays/instance.js +3 -0
- package/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-a/page-a.js +34 -0
- package/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-b/node_modules/overlays/index.js +30 -0
- package/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-b/node_modules/overlays/instance.js +3 -0
- package/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-b/page-b.js +34 -0
- package/docs/fundamentals/tools/singleton-manager/example-success/demo-app.js +93 -0
- package/docs/fundamentals/tools/singleton-manager/example-success/node_modules/overlays/index.js +30 -0
- package/docs/fundamentals/tools/singleton-manager/example-success/node_modules/overlays/instance.js +4 -0
- package/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-a/page-a.js +34 -0
- package/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-b/node_modules/overlays/index.js +30 -0
- package/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-b/node_modules/overlays/instance.js +4 -0
- package/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-b/page-b.js +34 -0
- package/docs/fundamentals/tools/singleton-manager/example-success/overlayCompatibility.js +23 -0
- package/docs/fundamentals/tools/singleton-manager/overview.md +4 -4
- package/docs/guides/how-to/create-a-custom-field.md +5 -5
- package/docs/guides/how-to/extend-a-native-input.md +2 -2
- package/docs/guides/index.md +8 -8
- package/docs/guides/principles/index.md +5 -5
- package/docs/guides/principles/styling.md +1 -1
- package/package.json +2 -2
- 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
|
|
47
|
+
.accordion ::slotted(.invoker) {
|
|
48
48
|
margin: 0;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
.accordion
|
|
51
|
+
.accordion ::slotted(.invoker)[expanded] {
|
|
52
52
|
font-weight: bold;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
.accordion
|
|
55
|
+
.accordion ::slotted(.content) {
|
|
56
56
|
margin: 0;
|
|
57
57
|
visibility: hidden;
|
|
58
58
|
display: none;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
.accordion
|
|
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 =
|
|
163
|
-
|
|
164
|
-
|
|
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
|
-
|
|
222
|
-
|
|
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
|
-
|
|
26
|
+
if (el.shadowRoot) {
|
|
27
|
+
const slot = el.shadowRoot?.querySelector('slot[name=_accordion]');
|
|
27
28
|
|
|
28
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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(
|
|
151
|
-
|
|
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(
|
|
158
|
-
|
|
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(
|
|
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(
|
|
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.
|
|
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.
|
|
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
|
-
|
|
450
|
-
|
|
451
|
-
)
|
|
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
|
-
|
|
466
|
-
|
|
467
|
-
)
|
|
461
|
+
expect(Array.from(getInvokers(el))[0]?.firstElementChild).to.have.attribute(
|
|
462
|
+
'aria-expanded',
|
|
463
|
+
'true',
|
|
464
|
+
);
|
|
468
465
|
});
|
|
469
466
|
});
|
|
470
467
|
|
|
@@ -194,11 +194,18 @@ export class LionIcon extends LitElement {
|
|
|
194
194
|
}
|
|
195
195
|
} else {
|
|
196
196
|
const iconIdBeforeResolve = this.iconId;
|
|
197
|
-
const svg = await this._iconManager.resolveIconForId(iconIdBeforeResolve);
|
|
198
197
|
|
|
199
|
-
//
|
|
200
|
-
|
|
201
|
-
|
|
198
|
+
// Wrap in try-catch so error is non-fatal.
|
|
199
|
+
// Failure to load an icon (asset) should not crash the entire app.
|
|
200
|
+
try {
|
|
201
|
+
const svg = await this._iconManager.resolveIconForId(iconIdBeforeResolve);
|
|
202
|
+
// update SVG if it did not change in the meantime to avoid race conditions
|
|
203
|
+
if (this.iconId === iconIdBeforeResolve) {
|
|
204
|
+
this.svg = svg;
|
|
205
|
+
}
|
|
206
|
+
} catch (e) {
|
|
207
|
+
// eslint-disable-next-line no-console
|
|
208
|
+
console.error(e);
|
|
202
209
|
}
|
|
203
210
|
}
|
|
204
211
|
}
|
|
@@ -92,9 +92,9 @@ export class LionInputTelDropdown extends LionInputTel {
|
|
|
92
92
|
},
|
|
93
93
|
labels: {
|
|
94
94
|
selectCountry: localize.msg('lion-input-tel:selectCountry'),
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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?.
|
|
128
|
+
<optgroup label="${refs?.dropdown?.labels?.preferredCountries}">
|
|
129
129
|
${data.regionMetaListPreferred.map(renderOption)}
|
|
130
130
|
</optgroup>
|
|
131
|
-
<optgroup label="${refs?.dropdown?.labels?.
|
|
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
|
|
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;
|
|
@@ -6,6 +6,7 @@ import { localize } from './singleton.js';
|
|
|
6
6
|
/**
|
|
7
7
|
* @typedef {import('lit/directive.js').DirectiveResult} DirectiveResult
|
|
8
8
|
* @typedef {import('../types/LocalizeMixinTypes.js').LocalizeMixin} LocalizeMixin
|
|
9
|
+
* @typedef {import('../types/LocalizeMixinTypes.js').NamespaceObject} NamespaceObject
|
|
9
10
|
*/
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -17,7 +18,7 @@ const LocalizeMixinImplementation = superclass =>
|
|
|
17
18
|
// @ts-ignore https://github.com/microsoft/TypeScript/issues/36821#issuecomment-588375051
|
|
18
19
|
class LocalizeMixin extends superclass {
|
|
19
20
|
/**
|
|
20
|
-
* @returns {
|
|
21
|
+
* @returns {NamespaceObject[]}
|
|
21
22
|
*/
|
|
22
23
|
static get localizeNamespaces() {
|
|
23
24
|
return [];
|
|
@@ -106,11 +107,11 @@ const LocalizeMixinImplementation = superclass =>
|
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
/**
|
|
109
|
-
* @returns {
|
|
110
|
+
* @returns {NamespaceObject[]}
|
|
110
111
|
* @private
|
|
111
112
|
*/
|
|
112
113
|
__getUniqueNamespaces() {
|
|
113
|
-
/** @type {
|
|
114
|
+
/** @type {NamespaceObject[]} */
|
|
114
115
|
const uniqueNamespaces = [];
|
|
115
116
|
|
|
116
117
|
// IE11 does not support iterable in the constructor
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { adoptStyles } from 'lit';
|
|
2
1
|
import { overlays } from './singleton.js';
|
|
3
2
|
import { containFocus } from './utils/contain-focus.js';
|
|
4
3
|
import { overlayShadowDomStyle } from './overlayShadowDomStyle.js';
|
|
4
|
+
import { _adoptStyleUtils } from './utils/adopt-styles.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @typedef {import('@lion/ui/types/overlays.js').OverlayConfig} OverlayConfig
|
|
@@ -13,22 +13,6 @@ import { overlayShadowDomStyle } from './overlayShadowDomStyle.js';
|
|
|
13
13
|
* @typedef {'setup'|'init'|'teardown'|'before-show'|'show'|'hide'|'add'|'remove'} OverlayPhase
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
const rootNodeStylesMap = new WeakSet();
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Returns element that adopts stylesheet
|
|
20
|
-
* @param {Element} shadowOrBodyEl
|
|
21
|
-
* @returns {ShadowRoot}
|
|
22
|
-
*/
|
|
23
|
-
function getRootNodeOrBodyElThatAdoptsStylesheet(shadowOrBodyEl) {
|
|
24
|
-
const rootNode = /** @type {* & DocumentOrShadowRoot} */ (shadowOrBodyEl.getRootNode());
|
|
25
|
-
if (rootNode === document) {
|
|
26
|
-
// @ts-ignore
|
|
27
|
-
return document.body;
|
|
28
|
-
}
|
|
29
|
-
return rootNode;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
16
|
/**
|
|
33
17
|
* From:
|
|
34
18
|
* - wrappingDialogNodeL1: `<dialog role="none"/>`
|
|
@@ -207,7 +191,7 @@ export class OverlayController extends EventTarget {
|
|
|
207
191
|
|
|
208
192
|
this.manager.add(this);
|
|
209
193
|
/** @protected */
|
|
210
|
-
this._contentId = `overlay-content--${Math.random().toString(36).
|
|
194
|
+
this._contentId = `overlay-content--${Math.random().toString(36).slice(2, 10)}`;
|
|
211
195
|
/** @private */
|
|
212
196
|
this.__originalAttrs = new Map();
|
|
213
197
|
this.updateConfig(config);
|
|
@@ -536,16 +520,20 @@ export class OverlayController extends EventTarget {
|
|
|
536
520
|
OverlayController.popperModule = preloadPopper();
|
|
537
521
|
}
|
|
538
522
|
}
|
|
539
|
-
this.
|
|
523
|
+
this.__handleOverlayStyles({ phase: 'init' });
|
|
540
524
|
this._handleFeatures({ phase: 'init' });
|
|
541
525
|
}
|
|
542
526
|
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
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 });
|
|
549
537
|
}
|
|
550
538
|
}
|
|
551
539
|
|
|
@@ -1284,6 +1272,7 @@ export class OverlayController extends EventTarget {
|
|
|
1284
1272
|
}
|
|
1285
1273
|
|
|
1286
1274
|
teardown() {
|
|
1275
|
+
this.__handleOverlayStyles({ phase: 'teardown' });
|
|
1287
1276
|
this._handleFeatures({ phase: 'teardown' });
|
|
1288
1277
|
}
|
|
1289
1278
|
|