@lion/ui 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/accordion/src/LionAccordion.js +3 -2
- package/components/button/src/LionButton.js +6 -10
- package/components/button/src/LionButtonReset.js +2 -0
- package/components/button/src/LionButtonSubmit.js +2 -0
- package/components/button/test-suites/LionButton.suite.js +0 -14
- package/components/checkbox-group/src/LionCheckbox.js +3 -0
- package/components/checkbox-group/src/LionCheckboxGroup.js +2 -0
- package/components/checkbox-group/src/LionCheckboxIndeterminate.js +3 -0
- package/components/collapsible/src/LionCollapsible.js +4 -1
- package/components/combobox/src/LionCombobox.js +5 -0
- package/components/dialog/src/LionDialog.js +3 -0
- package/components/drawer/src/LionDrawer.js +9 -0
- package/components/fieldset/src/LionFieldset.js +1 -1
- package/components/form/src/LionForm.js +0 -1
- package/components/form-core/src/FormControlMixin.js +10 -0
- package/components/form-core/src/FormatMixin.js +1 -1
- package/components/form-core/src/validate/LionValidationFeedback.js +8 -10
- package/components/form-core/src/validate/ValidateMixin.js +23 -3
- package/components/form-core/test/validate/lion-validation-feedback.test.js +0 -22
- package/components/form-core/test-suites/ValidateMixinFeedbackPart.suite.js +119 -0
- package/components/form-core/types/validate/validate.ts +1 -0
- package/components/icon/src/LionIcon.js +2 -0
- package/components/input-amount-dropdown/src/LionInputAmountDropdown.js +557 -0
- package/components/input-amount-dropdown/src/currencyUtil.js +324 -0
- package/components/input-amount-dropdown/src/formatters.js +24 -0
- package/components/input-amount-dropdown/src/localizeNamespaceLoader.js +7 -0
- package/components/input-amount-dropdown/src/parsers.js +23 -0
- package/components/input-amount-dropdown/src/serializers.js +24 -0
- package/components/input-amount-dropdown/src/validators.js +22 -0
- package/components/input-amount-dropdown/test/LionInputAmountDropdown.test.js +199 -0
- package/components/input-amount-dropdown/test-helpers/mimicUserChangingDropdown.js +22 -0
- package/components/input-amount-dropdown/test-suites/LionInputAmountDropdown.suite.js +322 -0
- package/components/input-amount-dropdown/translations/en.js +5 -0
- package/components/input-amount-dropdown/types/index.ts +234 -0
- package/components/input-file/src/LionInputFile.js +9 -0
- package/components/input-tel/src/LionInputTel.js +3 -0
- package/components/input-tel/types/index.ts +6 -0
- package/components/input-tel-dropdown/src/LionInputTelDropdown.js +2 -0
- package/components/listbox/src/LionListbox.js +2 -0
- package/components/localize/src/number/getFractionDigits.js +1 -1
- package/components/overlays/src/OverlayMixin.js +4 -0
- package/components/progress-indicator/src/LionProgressIndicator.js +4 -0
- package/components/radio-group/src/LionRadioGroup.js +3 -1
- package/components/select/src/LionSelect.js +4 -0
- package/components/select-rich/src/LionSelectInvoker.js +2 -0
- package/components/select-rich/src/LionSelectRich.js +2 -0
- package/components/steps/src/LionStep.js +0 -1
- package/components/steps/src/LionSteps.js +0 -1
- package/components/switch/src/LionSwitch.js +3 -0
- package/components/switch/src/LionSwitchButton.js +5 -0
- package/components/tabs/src/LionTabs.js +8 -0
- package/custom-elements.json +5581 -1475
- package/dist-types/components/accordion/src/LionAccordion.d.ts +3 -2
- package/dist-types/components/accordion/src/LionAccordion.d.ts.map +1 -1
- package/dist-types/components/button/src/LionButton.d.ts +2 -1
- package/dist-types/components/button/src/LionButton.d.ts.map +1 -1
- package/dist-types/components/button/src/LionButtonReset.d.ts +2 -0
- package/dist-types/components/button/src/LionButtonReset.d.ts.map +1 -1
- package/dist-types/components/button/src/LionButtonSubmit.d.ts +2 -0
- package/dist-types/components/button/src/LionButtonSubmit.d.ts.map +1 -1
- package/dist-types/components/button/test-suites/LionButton.suite.d.ts.map +1 -1
- package/dist-types/components/checkbox-group/src/LionCheckbox.d.ts +3 -0
- package/dist-types/components/checkbox-group/src/LionCheckbox.d.ts.map +1 -1
- package/dist-types/components/checkbox-group/src/LionCheckboxGroup.d.ts +2 -0
- package/dist-types/components/checkbox-group/src/LionCheckboxGroup.d.ts.map +1 -1
- package/dist-types/components/checkbox-group/src/LionCheckboxIndeterminate.d.ts +3 -0
- package/dist-types/components/checkbox-group/src/LionCheckboxIndeterminate.d.ts.map +1 -1
- package/dist-types/components/collapsible/src/LionCollapsible.d.ts +3 -1
- package/dist-types/components/collapsible/src/LionCollapsible.d.ts.map +1 -1
- package/dist-types/components/combobox/src/LionCombobox.d.ts +5 -0
- package/dist-types/components/combobox/src/LionCombobox.d.ts.map +1 -1
- package/dist-types/components/dialog/src/LionDialog.d.ts +3 -0
- package/dist-types/components/dialog/src/LionDialog.d.ts.map +1 -1
- package/dist-types/components/drawer/src/LionDrawer.d.ts +9 -0
- package/dist-types/components/drawer/src/LionDrawer.d.ts.map +1 -1
- package/dist-types/components/fieldset/src/LionFieldset.d.ts +1 -1
- package/dist-types/components/form/src/LionForm.d.ts.map +1 -1
- package/dist-types/components/form-core/src/FormControlMixin.d.ts.map +1 -1
- package/dist-types/components/form-core/src/validate/LionValidationFeedback.d.ts +4 -3
- package/dist-types/components/form-core/src/validate/LionValidationFeedback.d.ts.map +1 -1
- package/dist-types/components/form-core/src/validate/ValidateMixin.d.ts.map +1 -1
- package/dist-types/components/form-core/test-suites/ValidateMixinFeedbackPart.suite.d.ts.map +1 -1
- package/dist-types/components/form-core/types/validate/validate.d.ts +1 -0
- package/dist-types/components/form-core/types/validate/validate.d.ts.map +1 -1
- package/dist-types/components/icon/src/LionIcon.d.ts +2 -0
- package/dist-types/components/icon/src/LionIcon.d.ts.map +1 -1
- package/dist-types/components/input-amount-dropdown/src/LionInputAmountDropdown.d.ts +221 -0
- package/dist-types/components/input-amount-dropdown/src/LionInputAmountDropdown.d.ts.map +1 -0
- package/dist-types/components/input-amount-dropdown/src/currencyUtil.d.ts +24 -0
- package/dist-types/components/input-amount-dropdown/src/currencyUtil.d.ts.map +1 -0
- package/dist-types/components/input-amount-dropdown/src/formatters.d.ts +4 -0
- package/dist-types/components/input-amount-dropdown/src/formatters.d.ts.map +1 -0
- package/dist-types/components/input-amount-dropdown/src/localizeNamespaceLoader.d.ts +2 -0
- package/dist-types/components/input-amount-dropdown/src/localizeNamespaceLoader.d.ts.map +1 -0
- package/dist-types/components/input-amount-dropdown/src/parsers.d.ts +2 -0
- package/dist-types/components/input-amount-dropdown/src/parsers.d.ts.map +1 -0
- package/dist-types/components/input-amount-dropdown/src/serializers.d.ts +3 -0
- package/dist-types/components/input-amount-dropdown/src/serializers.d.ts.map +1 -0
- package/dist-types/components/input-amount-dropdown/src/validators.d.ts +12 -0
- package/dist-types/components/input-amount-dropdown/src/validators.d.ts.map +1 -0
- package/dist-types/components/input-amount-dropdown/test/LionInputAmountDropdown.test.d.ts +7 -0
- package/dist-types/components/input-amount-dropdown/test/LionInputAmountDropdown.test.d.ts.map +1 -0
- package/dist-types/components/input-amount-dropdown/test-helpers/mimicUserChangingDropdown.d.ts +12 -0
- package/dist-types/components/input-amount-dropdown/test-helpers/mimicUserChangingDropdown.d.ts.map +1 -0
- package/dist-types/components/input-amount-dropdown/test-suites/LionInputAmountDropdown.suite.d.ts +13 -0
- package/dist-types/components/input-amount-dropdown/test-suites/LionInputAmountDropdown.suite.d.ts.map +1 -0
- package/dist-types/components/input-amount-dropdown/translations/en.d.ts +7 -0
- package/dist-types/components/input-amount-dropdown/translations/en.d.ts.map +1 -0
- package/dist-types/components/input-amount-dropdown/types/index.d.ts +86 -0
- package/dist-types/components/input-amount-dropdown/types/index.d.ts.map +1 -0
- package/dist-types/components/input-file/src/LionInputFile.d.ts +9 -0
- package/dist-types/components/input-file/src/LionInputFile.d.ts.map +1 -1
- package/dist-types/components/input-tel/src/LionInputTel.d.ts +3 -0
- package/dist-types/components/input-tel/src/LionInputTel.d.ts.map +1 -1
- package/dist-types/components/input-tel/types/index.d.ts +1 -1
- package/dist-types/components/input-tel/types/index.d.ts.map +1 -1
- package/dist-types/components/input-tel-dropdown/src/LionInputTelDropdown.d.ts +2 -0
- package/dist-types/components/input-tel-dropdown/src/LionInputTelDropdown.d.ts.map +1 -1
- package/dist-types/components/listbox/src/LionListbox.d.ts +2 -0
- package/dist-types/components/listbox/src/LionListbox.d.ts.map +1 -1
- package/dist-types/components/localize/src/number/getFractionDigits.d.ts +1 -1
- package/dist-types/components/overlays/src/OverlayMixin.d.ts +4 -0
- package/dist-types/components/overlays/src/OverlayMixin.d.ts.map +1 -1
- package/dist-types/components/progress-indicator/src/LionProgressIndicator.d.ts +3 -0
- package/dist-types/components/progress-indicator/src/LionProgressIndicator.d.ts.map +1 -1
- package/dist-types/components/radio-group/src/LionRadioGroup.d.ts +3 -1
- package/dist-types/components/radio-group/src/LionRadioGroup.d.ts.map +1 -1
- package/dist-types/components/select/src/LionSelect.d.ts +3 -0
- package/dist-types/components/select/src/LionSelect.d.ts.map +1 -1
- package/dist-types/components/select-rich/src/LionSelectInvoker.d.ts +2 -0
- package/dist-types/components/select-rich/src/LionSelectInvoker.d.ts.map +1 -1
- package/dist-types/components/select-rich/src/LionSelectRich.d.ts +3 -1
- package/dist-types/components/select-rich/src/LionSelectRich.d.ts.map +1 -1
- package/dist-types/components/steps/src/LionStep.d.ts +0 -1
- package/dist-types/components/steps/src/LionStep.d.ts.map +1 -1
- package/dist-types/components/steps/src/LionSteps.d.ts +0 -1
- package/dist-types/components/steps/src/LionSteps.d.ts.map +1 -1
- package/dist-types/components/switch/src/LionSwitch.d.ts +3 -0
- package/dist-types/components/switch/src/LionSwitch.d.ts.map +1 -1
- package/dist-types/components/switch/src/LionSwitchButton.d.ts +5 -0
- package/dist-types/components/switch/src/LionSwitchButton.d.ts.map +1 -1
- package/dist-types/components/tabs/src/LionTabs.d.ts +8 -0
- package/dist-types/components/tabs/src/LionTabs.d.ts.map +1 -1
- package/dist-types/exports/define/lion-input-amount-dropdown.d.ts +2 -0
- package/dist-types/exports/define/lion-input-amount-dropdown.d.ts.map +1 -0
- package/dist-types/exports/input-amount-dropdown-test-helpers.d.ts +2 -0
- package/dist-types/exports/input-amount-dropdown-test-helpers.d.ts.map +1 -0
- package/dist-types/exports/input-amount-dropdown-test-suites.d.ts +2 -0
- package/dist-types/exports/input-amount-dropdown-test-suites.d.ts.map +1 -0
- package/dist-types/exports/input-amount-dropdown.d.ts +2 -0
- package/dist-types/exports/input-amount-dropdown.d.ts.map +1 -0
- package/dist-types/tsconfig.tsbuildinfo +1 -1
- package/docs/components/accordion/api-table.md +8 -0
- package/docs/components/button/api-table.md +0 -3
- package/docs/components/checkbox-group/overview.md +2 -2
- package/docs/components/collapsible/api-table.md +7 -0
- package/docs/components/collapsible/overview.md +1 -1
- package/docs/components/combobox/api-table.md +7 -0
- package/docs/components/combobox/overview.md +1 -1
- package/docs/components/combobox/use-cases.md +1 -1
- package/docs/components/dialog/overview.md +1 -1
- package/docs/components/drawer/api-table.md +8 -0
- package/docs/components/fieldset/overview.md +5 -5
- package/docs/components/form/overview.md +3 -3
- package/docs/components/form/use-cases.md +2 -2
- 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-amount-dropdown/api-table.md +210 -0
- package/docs/components/input-amount-dropdown/index.md +13 -0
- package/docs/components/input-amount-dropdown/use-cases.md +103 -0
- 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-file/api-table.md +7 -0
- package/docs/components/input-file/overview.md +1 -1
- 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/listbox/use-cases.md +1 -1
- package/docs/components/radio-group/overview.md +3 -3
- package/docs/components/select/use-cases.md +1 -1
- package/docs/components/select-rich/api-table.md +0 -1
- package/docs/components/select-rich/use-cases.md +1 -1
- package/docs/components/tabs/api-table.md +7 -0
- package/docs/components/tabs/examples.md +1 -1
- package/docs/fundamentals/index.md +4 -4
- 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/rationales/accessibility.md +1 -1
- package/docs/fundamentals/systems/core/SlotMixin.md +1 -1
- 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 +19 -3
- package/docs/fundamentals/systems/localize/overview.md +4 -4
- package/docs/fundamentals/systems/overlays/configuration.md +2 -2
- package/docs/fundamentals/systems/overlays/overview.md +5 -5
- package/docs/fundamentals/systems/overlays/use-cases.md +2 -2
- package/docs/fundamentals/tools/helpers/overview.md +1 -1
- 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/create-a-form.md +4 -4
- 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/exports/define/lion-input-amount-dropdown.js +3 -0
- package/exports/input-amount-dropdown-test-helpers.js +1 -0
- package/exports/input-amount-dropdown-test-suites.js +1 -0
- package/exports/input-amount-dropdown.js +1 -0
- package/input-amount-dropdown-test-helpers.js +1 -0
- package/input-amount-dropdown-test-suites.js +1 -0
- package/input-amount-dropdown.js +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import { LionInputAmountDropdown } from '@lion/ui/input-amount-dropdown.js';
|
|
2
|
+
import sinon from 'sinon';
|
|
3
|
+
import {
|
|
4
|
+
fixtureSync as _fixtureSync,
|
|
5
|
+
fixture as _fixture,
|
|
6
|
+
unsafeStatic,
|
|
7
|
+
aTimeout,
|
|
8
|
+
defineCE,
|
|
9
|
+
expect,
|
|
10
|
+
html,
|
|
11
|
+
} from '@open-wc/testing';
|
|
12
|
+
|
|
13
|
+
import { isActiveElement } from '../../core/test-helpers/isActiveElement.js';
|
|
14
|
+
import { mimicUserChangingDropdown } from '../test-helpers/mimicUserChangingDropdown.js';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @typedef {import('../types/index.js').TemplateDataForDropdownInputAmount} TemplateDataForDropdownInputAmount
|
|
18
|
+
* @typedef {HTMLSelectElement|HTMLElement & {modelValue:string}} DropdownElement
|
|
19
|
+
* @typedef {import('lit').TemplateResult} TemplateResult
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
const fixture = /** @type {(arg: string | TemplateResult) => Promise<LionInputAmountDropdown>} */ (
|
|
23
|
+
_fixture
|
|
24
|
+
);
|
|
25
|
+
const fixtureSync = /** @type {(arg: string | TemplateResult) => LionInputAmountDropdown} */ (
|
|
26
|
+
_fixtureSync
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @param {DropdownElement | HTMLSelectElement} dropdownEl
|
|
31
|
+
* @returns {string}
|
|
32
|
+
*/
|
|
33
|
+
function getDropdownValue(dropdownEl) {
|
|
34
|
+
if ('modelValue' in dropdownEl) {
|
|
35
|
+
return dropdownEl.modelValue;
|
|
36
|
+
}
|
|
37
|
+
return dropdownEl.value;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @param {{ klass:LionInputAmountDropdown }} config
|
|
42
|
+
*/
|
|
43
|
+
// @ts-expect-error
|
|
44
|
+
export function runInputAmountDropdownSuite({ klass } = { klass: LionInputAmountDropdown }) {
|
|
45
|
+
// @ts-ignore
|
|
46
|
+
const tagName = defineCE(/** @type {* & HTMLElement} */ (class extends klass {}));
|
|
47
|
+
const tag = unsafeStatic(tagName);
|
|
48
|
+
|
|
49
|
+
describe('LionInputAmountDropdown', () => {
|
|
50
|
+
it('syncs value of dropdown on init if input has no value', async () => {
|
|
51
|
+
const el = await fixture(html` <${tag}></${tag}> `);
|
|
52
|
+
expect(el.value).to.equal('');
|
|
53
|
+
expect(getDropdownValue(/** @type {DropdownElement} */ (el.refs.dropdown.value))).to.equal(
|
|
54
|
+
'GBP',
|
|
55
|
+
);
|
|
56
|
+
expect(el.modelValue).to.eql({ currency: 'GBP' });
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('syncs value of dropdown on reset if input has no value', async () => {
|
|
60
|
+
const el = await fixture(html` <${tag}></${tag}> `);
|
|
61
|
+
el.modelValue = { currency: 'EUR', amount: 123 };
|
|
62
|
+
await el.updateComplete;
|
|
63
|
+
el.reset();
|
|
64
|
+
await el.updateComplete;
|
|
65
|
+
expect(el.modelValue).to.eql({ currency: 'GBP' });
|
|
66
|
+
expect(el.value).to.equal('');
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('syncs value of dropdown on init if input has no value does not influence interaction states', async () => {
|
|
70
|
+
const el = await fixture(html` <${tag}></${tag}> `);
|
|
71
|
+
expect(el.dirty).to.be.false;
|
|
72
|
+
expect(el.prefilled).to.be.false;
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('syncs value of dropdown on reset also resets interaction states', async () => {
|
|
76
|
+
const el = await fixture(html` <${tag}></${tag}> `);
|
|
77
|
+
el.modelValue = { currency: 'EUR', amount: 123 };
|
|
78
|
+
await el.updateComplete;
|
|
79
|
+
|
|
80
|
+
expect(el.dirty).to.be.true;
|
|
81
|
+
expect(el.prefilled).to.be.false;
|
|
82
|
+
el.reset();
|
|
83
|
+
await el.updateComplete;
|
|
84
|
+
expect(el.dirty).to.be.false;
|
|
85
|
+
expect(el.prefilled).to.be.false;
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('syncs value of dropdown when preferredCurrency is set', async () => {
|
|
89
|
+
const el = await fixture(html` <${tag}
|
|
90
|
+
.preferredCurrencies="${['JPY', 'EUR']}"
|
|
91
|
+
></${tag}> `);
|
|
92
|
+
expect(el.modelValue).to.eql({ currency: 'JPY' });
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it('sets correct interaction states on init if input has a value', async () => {
|
|
96
|
+
const el = await fixture(
|
|
97
|
+
html` <${tag} .modelValue="${{ currency: 'EUR', amount: 123 }}"></${tag}> `,
|
|
98
|
+
);
|
|
99
|
+
expect(el.dirty).to.be.false;
|
|
100
|
+
expect(el.prefilled).to.be.true;
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
describe('Dropdown display', () => {
|
|
104
|
+
it('calls `templates.dropdown` with TemplateDataForDropdownInputAmount object', async () => {
|
|
105
|
+
const modelValue = { currency: 'EUR', amount: 123 };
|
|
106
|
+
const el = fixtureSync(html` <${tag}
|
|
107
|
+
.modelValue="${modelValue}"
|
|
108
|
+
.allowedCurrencies="${['EUR', 'GBP']}"
|
|
109
|
+
.preferredCurrencies="${['GBP']}"
|
|
110
|
+
></${tag}> `);
|
|
111
|
+
const spy = sinon.spy(
|
|
112
|
+
/** @type {typeof LionInputAmountDropdown} */ (el.constructor).templates,
|
|
113
|
+
'dropdown',
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
await el.updateComplete;
|
|
117
|
+
const dropdownNode = el.refs.dropdown.value;
|
|
118
|
+
const templateDataForDropdown = /** @type {TemplateDataForDropdownInputAmount} */ (
|
|
119
|
+
spy.args[0][0]
|
|
120
|
+
);
|
|
121
|
+
expect(templateDataForDropdown).to.eql(
|
|
122
|
+
/** @type {TemplateDataForDropdownInputAmount} */ ({
|
|
123
|
+
data: {
|
|
124
|
+
currency: 'EUR',
|
|
125
|
+
regionMetaList: [
|
|
126
|
+
{
|
|
127
|
+
currencyCode: 'EUR',
|
|
128
|
+
currencySymbol: '€',
|
|
129
|
+
nameForLocale: 'Euro',
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
regionMetaListPreferred: [
|
|
133
|
+
{
|
|
134
|
+
currencyCode: 'GBP',
|
|
135
|
+
currencySymbol: '£',
|
|
136
|
+
nameForLocale: 'British Pound',
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
},
|
|
140
|
+
refs: {
|
|
141
|
+
dropdown: {
|
|
142
|
+
labels: {
|
|
143
|
+
selectCurrency: 'Select currency',
|
|
144
|
+
allCurrencies: 'All currencies',
|
|
145
|
+
preferredCurrencies: 'Suggested currencies',
|
|
146
|
+
},
|
|
147
|
+
listeners: {
|
|
148
|
+
// @ts-expect-error [allow-protected]
|
|
149
|
+
change: el._onDropdownValueChange,
|
|
150
|
+
// @ts-expect-error [allow-protected]
|
|
151
|
+
'model-value-changed': el._onDropdownValueChange,
|
|
152
|
+
},
|
|
153
|
+
props: { style: 'height: 100%;' },
|
|
154
|
+
ref: {
|
|
155
|
+
value: dropdownNode,
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
// @ts-expect-error [allow-protected]
|
|
159
|
+
input: el._inputNode,
|
|
160
|
+
},
|
|
161
|
+
}),
|
|
162
|
+
);
|
|
163
|
+
spy.restore();
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it('can override "all-currencies-label"', async () => {
|
|
167
|
+
const el = fixtureSync(html` <${tag}
|
|
168
|
+
.preferredCurrencies="${['GBP']}"
|
|
169
|
+
></${tag}> `);
|
|
170
|
+
const spy = sinon.spy(
|
|
171
|
+
/** @type {typeof LionInputAmountDropdown} */ (el.constructor).templates,
|
|
172
|
+
'dropdown',
|
|
173
|
+
);
|
|
174
|
+
// @ts-expect-error [allow-protected]
|
|
175
|
+
el._allCurrenciesLabel = 'foo';
|
|
176
|
+
await el.updateComplete;
|
|
177
|
+
const templateDataForDropdown = /** @type {TemplateDataForDropdownInputAmount} */ (
|
|
178
|
+
spy.args[0][0]
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
expect(templateDataForDropdown.refs.dropdown.labels.allCurrencies).to.eql('foo');
|
|
182
|
+
spy.restore();
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
it('can override "preferred-currencies-label"', async () => {
|
|
186
|
+
const el = fixtureSync(html` <${tag}
|
|
187
|
+
.preferredCurrencies="${['GBP']}"
|
|
188
|
+
></${tag}> `);
|
|
189
|
+
const spy = sinon.spy(
|
|
190
|
+
/** @type {typeof LionInputAmountDropdown} */ (el.constructor).templates,
|
|
191
|
+
'dropdown',
|
|
192
|
+
);
|
|
193
|
+
// @ts-expect-error [allow-protected]
|
|
194
|
+
el._preferredCurrenciesLabel = 'foo';
|
|
195
|
+
await el.updateComplete;
|
|
196
|
+
const templateDataForDropdown = /** @type {TemplateDataForDropdownInputAmount} */ (
|
|
197
|
+
spy.args[0][0]
|
|
198
|
+
);
|
|
199
|
+
expect(templateDataForDropdown.refs.dropdown.labels.preferredCurrencies).to.eql('foo');
|
|
200
|
+
spy.restore();
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
it('syncs dropdown value initially from locale', async () => {
|
|
204
|
+
const el = await fixture(html` <${tag} .allowedCurrencies="${['GBP']}"></${tag}> `);
|
|
205
|
+
expect(getDropdownValue(/** @type {DropdownElement} */ (el.refs.dropdown.value))).to.equal(
|
|
206
|
+
'GBP',
|
|
207
|
+
);
|
|
208
|
+
expect(el.modelValue).to.eql({
|
|
209
|
+
currency: 'GBP',
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
it('syncs disabled attribute to dropdown', async () => {
|
|
214
|
+
const el = await fixture(html` <${tag} disabled></${tag}> `);
|
|
215
|
+
expect(/** @type {HTMLElement} */ (el.refs.dropdown.value)?.hasAttribute('disabled')).to.be
|
|
216
|
+
.true;
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
it('disables dropdown on readonly', async () => {
|
|
220
|
+
const el = await fixture(html` <${tag} readonly></${tag}> `);
|
|
221
|
+
expect(/** @type {HTMLElement} */ (el.refs.dropdown.value)?.hasAttribute('disabled')).to.be
|
|
222
|
+
.true;
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
it('renders to prefix slot in light dom', async () => {
|
|
226
|
+
const el = await fixture(html` <${tag} .allowedCurrencies="${['GBP']}"></${tag}> `);
|
|
227
|
+
const prefixSlot = /** @type {HTMLElement} */ (
|
|
228
|
+
/** @type {HTMLElement} */ (el.refs.dropdown.value)
|
|
229
|
+
);
|
|
230
|
+
expect(prefixSlot.getAttribute('slot')).to.equal('prefix');
|
|
231
|
+
expect(prefixSlot.slot).to.equal('prefix');
|
|
232
|
+
expect(prefixSlot.parentElement).to.equal(el);
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
it('renders to suffix slot in light dom', async () => {
|
|
236
|
+
class WithSuffixRenderInputAmountDropdown extends LionInputAmountDropdown {
|
|
237
|
+
constructor() {
|
|
238
|
+
super();
|
|
239
|
+
|
|
240
|
+
this._dropdownSlot = 'suffix';
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
const suffixTagName = defineCE(WithSuffixRenderInputAmountDropdown);
|
|
245
|
+
const suffixTag = unsafeStatic(suffixTagName);
|
|
246
|
+
|
|
247
|
+
const el = await fixture(html`
|
|
248
|
+
<${suffixTag}
|
|
249
|
+
.allowedCurrencies="${['GBP']}"
|
|
250
|
+
></${suffixTag}>
|
|
251
|
+
`);
|
|
252
|
+
const prefixSlot = /** @type {HTMLElement} */ (
|
|
253
|
+
/** @type {HTMLElement} */ (el.refs.dropdown.value)
|
|
254
|
+
);
|
|
255
|
+
expect(prefixSlot.getAttribute('slot')).to.equal('suffix');
|
|
256
|
+
expect(prefixSlot.slot).to.equal('suffix');
|
|
257
|
+
expect(prefixSlot.parentElement).to.equal(el);
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
it('rerenders light dom when CurrencyUtil loaded', async () => {
|
|
261
|
+
const el = await fixture(html` <${tag} .allowedCurrencies="${['GBP']}"></${tag}> `);
|
|
262
|
+
// @ts-ignore
|
|
263
|
+
const spy = sinon.spy(el, '__rerenderSlot');
|
|
264
|
+
await aTimeout(0);
|
|
265
|
+
expect(spy).to.have.been.calledWith('prefix');
|
|
266
|
+
spy.restore();
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
describe('On dropdown value change', () => {
|
|
271
|
+
it('changes the currently active currency code in the textbox', async () => {
|
|
272
|
+
const el = await fixture(html`
|
|
273
|
+
<${tag}
|
|
274
|
+
.allowedCurrencies="${['GBP', 'EUR']}"
|
|
275
|
+
.modelValue="${{ currency: 'GBP', amount: 123 }}"
|
|
276
|
+
></${tag}>
|
|
277
|
+
`);
|
|
278
|
+
// @ts-ignore
|
|
279
|
+
mimicUserChangingDropdown(el.refs.dropdown.value, 'EUR');
|
|
280
|
+
await el.updateComplete;
|
|
281
|
+
expect(el.currency).to.equal('EUR');
|
|
282
|
+
expect(el.modelValue).to.eql({ amount: 123, currency: 'EUR' });
|
|
283
|
+
await el.updateComplete;
|
|
284
|
+
expect(el.value).to.equal('123.00');
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
it('changes the currently active country code in the textbox when empty', async () => {
|
|
288
|
+
const el = await fixture(html` <${tag} .allowedCurrencies="${['GBP', 'EUR']}"></${tag}> `);
|
|
289
|
+
el.value = '';
|
|
290
|
+
// @ts-ignore
|
|
291
|
+
mimicUserChangingDropdown(el.refs.dropdown.value, 'EUR');
|
|
292
|
+
await el.updateComplete;
|
|
293
|
+
await el.updateComplete;
|
|
294
|
+
|
|
295
|
+
expect(el.modelValue).to.eql({ currency: 'EUR', amount: '' });
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
it('keeps focus on dropdownElement after selection if selected via unopened dropdown', async () => {
|
|
299
|
+
const el = await fixture(
|
|
300
|
+
html` <${tag} .allowedCurrencies="${[
|
|
301
|
+
'GBP',
|
|
302
|
+
'EUR',
|
|
303
|
+
]}" .modelValue="${{ currency: 'GBP', amount: 123 }}"></${tag}> `,
|
|
304
|
+
);
|
|
305
|
+
const dropdownElement = el.refs.dropdown.value;
|
|
306
|
+
// @ts-ignore
|
|
307
|
+
mimicUserChangingDropdown(dropdownElement, 'EUR');
|
|
308
|
+
await el.updateComplete;
|
|
309
|
+
// @ts-expect-error [allow-protected-in-tests]
|
|
310
|
+
expect(isActiveElement(el._inputNode)).to.be.false;
|
|
311
|
+
});
|
|
312
|
+
});
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
describe('is empty', () => {
|
|
316
|
+
it('ignores initial currencyCode', async () => {
|
|
317
|
+
const el = await fixture(html` <${tag}></${tag}> `);
|
|
318
|
+
// @ts-ignore
|
|
319
|
+
expect(el._isEmpty(), 'empty').to.be.true;
|
|
320
|
+
});
|
|
321
|
+
});
|
|
322
|
+
}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { LionSelectRich } from '@lion/ui/select-rich.js';
|
|
2
|
+
import { LionCombobox } from '@lion/ui/combobox.js';
|
|
3
|
+
import { OverlayController } from '../../overlays/src/OverlayController.js';
|
|
4
|
+
|
|
5
|
+
type RefTemplateData = {
|
|
6
|
+
ref?: { value?: HTMLElement };
|
|
7
|
+
props?: { [key: string]: any };
|
|
8
|
+
listeners?: { [key: string]: any };
|
|
9
|
+
labels?: { [key: string]: any };
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type RegionMeta = {
|
|
13
|
+
currencyCode: CurrencyCode;
|
|
14
|
+
nameForLocale?: string;
|
|
15
|
+
currencySymbol?: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type OnDropdownChangeEvent = Event & {
|
|
19
|
+
target: { value?: string; modelValue?: string; _overlayCtrl?: OverlayController };
|
|
20
|
+
detail?: { initialize: boolean };
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type DropdownRef = { value: HTMLSelectElement | LionSelectRich | LionCombobox | undefined };
|
|
24
|
+
|
|
25
|
+
export type TemplateDataForDropdownInputAmount = {
|
|
26
|
+
refs: {
|
|
27
|
+
dropdown: RefTemplateData & {
|
|
28
|
+
ref: DropdownRef;
|
|
29
|
+
props: { style: string };
|
|
30
|
+
listeners: {
|
|
31
|
+
change: (event: OnDropdownChangeEvent) => void;
|
|
32
|
+
'model-value-changed': (event: OnDropdownChangeEvent) => void;
|
|
33
|
+
};
|
|
34
|
+
labels: { selectCurrency: string };
|
|
35
|
+
};
|
|
36
|
+
input: HTMLInputElement;
|
|
37
|
+
};
|
|
38
|
+
data: {
|
|
39
|
+
currency: CurrencyCode | string;
|
|
40
|
+
regionMetaList: RegionMeta[];
|
|
41
|
+
regionMetaListPreferred: RegionMeta[];
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export type AmountDropdownModelValue = {
|
|
46
|
+
currency?: CurrencyCode | string;
|
|
47
|
+
amount?: number | string;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* All currency codes according to i18n
|
|
52
|
+
*/
|
|
53
|
+
export type CurrencyCode =
|
|
54
|
+
| 'EUR'
|
|
55
|
+
| 'AED'
|
|
56
|
+
| 'AFN'
|
|
57
|
+
| 'XCD'
|
|
58
|
+
| 'ALL'
|
|
59
|
+
| 'AMD'
|
|
60
|
+
| 'AOA'
|
|
61
|
+
| 'ARS'
|
|
62
|
+
| 'USD'
|
|
63
|
+
| 'AUD'
|
|
64
|
+
| 'AWG'
|
|
65
|
+
| 'AZN'
|
|
66
|
+
| 'BAM'
|
|
67
|
+
| 'BBD'
|
|
68
|
+
| 'BDT'
|
|
69
|
+
| 'XOF'
|
|
70
|
+
| 'BGN'
|
|
71
|
+
| 'BHD'
|
|
72
|
+
| 'BIF'
|
|
73
|
+
| 'BMD'
|
|
74
|
+
| 'BND'
|
|
75
|
+
| 'BOB'
|
|
76
|
+
| 'BRL'
|
|
77
|
+
| 'BSD'
|
|
78
|
+
| 'BTN'
|
|
79
|
+
| 'NOK'
|
|
80
|
+
| 'BWP'
|
|
81
|
+
| 'BYN'
|
|
82
|
+
| 'BZD'
|
|
83
|
+
| 'CAD'
|
|
84
|
+
| 'CDF'
|
|
85
|
+
| 'XAF'
|
|
86
|
+
| 'CHF'
|
|
87
|
+
| 'NZD'
|
|
88
|
+
| 'CLP'
|
|
89
|
+
| 'CNY'
|
|
90
|
+
| 'COP'
|
|
91
|
+
| 'CRC'
|
|
92
|
+
| 'CUP'
|
|
93
|
+
| 'CVE'
|
|
94
|
+
| 'ANG'
|
|
95
|
+
| 'CZK'
|
|
96
|
+
| 'DJF'
|
|
97
|
+
| 'DKK'
|
|
98
|
+
| 'DOP'
|
|
99
|
+
| 'DZD'
|
|
100
|
+
| 'EGP'
|
|
101
|
+
| 'MAD'
|
|
102
|
+
| 'ERN'
|
|
103
|
+
| 'ETB'
|
|
104
|
+
| 'FJD'
|
|
105
|
+
| 'FKP'
|
|
106
|
+
| 'GBP'
|
|
107
|
+
| 'GEL'
|
|
108
|
+
| 'GHS'
|
|
109
|
+
| 'GIP'
|
|
110
|
+
| 'GMD'
|
|
111
|
+
| 'GNF'
|
|
112
|
+
| 'GTQ'
|
|
113
|
+
| 'GYD'
|
|
114
|
+
| 'HKD'
|
|
115
|
+
| 'HNL'
|
|
116
|
+
| 'HTG'
|
|
117
|
+
| 'HUF'
|
|
118
|
+
| 'IDR'
|
|
119
|
+
| 'ILS'
|
|
120
|
+
| 'INR'
|
|
121
|
+
| 'IQD'
|
|
122
|
+
| 'IRR'
|
|
123
|
+
| 'ISK'
|
|
124
|
+
| 'JMD'
|
|
125
|
+
| 'JOD'
|
|
126
|
+
| 'JPY'
|
|
127
|
+
| 'KES'
|
|
128
|
+
| 'KGS'
|
|
129
|
+
| 'KHR'
|
|
130
|
+
| 'KMF'
|
|
131
|
+
| 'KPW'
|
|
132
|
+
| 'KRW'
|
|
133
|
+
| 'KWD'
|
|
134
|
+
| 'KYD'
|
|
135
|
+
| 'KZT'
|
|
136
|
+
| 'LAK'
|
|
137
|
+
| 'LBP'
|
|
138
|
+
| 'LKR'
|
|
139
|
+
| 'LRD'
|
|
140
|
+
| 'LSL'
|
|
141
|
+
| 'LYD'
|
|
142
|
+
| 'MDL'
|
|
143
|
+
| 'MGA'
|
|
144
|
+
| 'MKD'
|
|
145
|
+
| 'MMK'
|
|
146
|
+
| 'MNT'
|
|
147
|
+
| 'MOP'
|
|
148
|
+
| 'MRU'
|
|
149
|
+
| 'MUR'
|
|
150
|
+
| 'MVR'
|
|
151
|
+
| 'MWK'
|
|
152
|
+
| 'MXN'
|
|
153
|
+
| 'MYR'
|
|
154
|
+
| 'MZN'
|
|
155
|
+
| 'NAD'
|
|
156
|
+
| 'XPF'
|
|
157
|
+
| 'NGN'
|
|
158
|
+
| 'NIO'
|
|
159
|
+
| 'NPR'
|
|
160
|
+
| 'OMR'
|
|
161
|
+
| 'PAB'
|
|
162
|
+
| 'PEN'
|
|
163
|
+
| 'PGK'
|
|
164
|
+
| 'PHP'
|
|
165
|
+
| 'PKR'
|
|
166
|
+
| 'PLN'
|
|
167
|
+
| 'PYG'
|
|
168
|
+
| 'QAR'
|
|
169
|
+
| 'RON'
|
|
170
|
+
| 'RSD'
|
|
171
|
+
| 'RUB'
|
|
172
|
+
| 'RWF'
|
|
173
|
+
| 'SAR'
|
|
174
|
+
| 'SBD'
|
|
175
|
+
| 'SCR'
|
|
176
|
+
| 'SDG'
|
|
177
|
+
| 'SEK'
|
|
178
|
+
| 'SGD'
|
|
179
|
+
| 'SHP'
|
|
180
|
+
| 'SLE'
|
|
181
|
+
| 'SOS'
|
|
182
|
+
| 'SRD'
|
|
183
|
+
| 'SSP'
|
|
184
|
+
| 'STN'
|
|
185
|
+
| 'SVC'
|
|
186
|
+
| 'SYP'
|
|
187
|
+
| 'SZL'
|
|
188
|
+
| 'THB'
|
|
189
|
+
| 'TJS'
|
|
190
|
+
| 'TMT'
|
|
191
|
+
| 'TND'
|
|
192
|
+
| 'TOP'
|
|
193
|
+
| 'TRY'
|
|
194
|
+
| 'TTD'
|
|
195
|
+
| 'TWD'
|
|
196
|
+
| 'TZS'
|
|
197
|
+
| 'UAH'
|
|
198
|
+
| 'UGX'
|
|
199
|
+
| 'UYU'
|
|
200
|
+
| 'UZS'
|
|
201
|
+
| 'VED'
|
|
202
|
+
| 'VES'
|
|
203
|
+
| 'VND'
|
|
204
|
+
| 'VUV'
|
|
205
|
+
| 'WST'
|
|
206
|
+
| 'XCG'
|
|
207
|
+
| 'YER'
|
|
208
|
+
| 'ZAR'
|
|
209
|
+
| 'ZMW'
|
|
210
|
+
| 'ZWG';
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Type for country to currency list.
|
|
214
|
+
* The type is set to Partial as there are some islands that don't have a corresponding
|
|
215
|
+
* currencyCode as a standard (at the time of writing at least).
|
|
216
|
+
*
|
|
217
|
+
* Said missing countries code: AC, TA, XK
|
|
218
|
+
*/
|
|
219
|
+
export type countryToCurrencyList = Partial<{
|
|
220
|
+
[key in import('../../input-tel/types/index.js').RegionCode]: CurrencyCode;
|
|
221
|
+
}>;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Represents a mapping of region codes to currency codes using a Map.
|
|
225
|
+
*/
|
|
226
|
+
export type RegionToCurrencyMap = Map<
|
|
227
|
+
import('../../input-tel/types/index.js').RegionCode,
|
|
228
|
+
CurrencyCode
|
|
229
|
+
>;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Represents a set of all unique currency codes derived from the RegionToCurrencyMap values.
|
|
233
|
+
*/
|
|
234
|
+
export type AllCurrenciesSet = Set<CurrencyCode>;
|
|
@@ -31,6 +31,15 @@ function formatBytes(bytes, decimals = 2) {
|
|
|
31
31
|
return `${parseFloat((bytes / k ** i).toFixed(dm))}${sizes[i]}`;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* LionInputFile: A file input component
|
|
36
|
+
* This component allows users to select files, displays selected files, and handles file uploads.
|
|
37
|
+
*
|
|
38
|
+
* @slot file-select-button - [private] The button to open the file dialog
|
|
39
|
+
* @slot selected-file-list - [private] The list of selected files
|
|
40
|
+
*
|
|
41
|
+
* @customElement lion-input-file
|
|
42
|
+
*/
|
|
34
43
|
export class LionInputFile extends ScopedElementsMixin(LocalizeMixin(LionField)) {
|
|
35
44
|
static get scopedElements() {
|
|
36
45
|
return {
|
|
@@ -18,6 +18,9 @@ import { localizeNamespaceLoader } from './localizeNamespaceLoader.js';
|
|
|
18
18
|
* @typedef {FormatOptions & {regionCode: RegionCode; formatStrategy: PhoneNumberFormat; formatCountryCodeStyle: string;}} FormatOptionsTel
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* @customElement lion-input-tel
|
|
23
|
+
*/
|
|
21
24
|
export class LionInputTel extends LocalizeMixin(LionInput) {
|
|
22
25
|
/**
|
|
23
26
|
* @configure LitElement
|
|
@@ -36,6 +36,7 @@ export type RegionCode =
|
|
|
36
36
|
| 'BR'
|
|
37
37
|
| 'BS'
|
|
38
38
|
| 'BT'
|
|
39
|
+
| 'BV'
|
|
39
40
|
| 'BW'
|
|
40
41
|
| 'BY'
|
|
41
42
|
| 'BZ'
|
|
@@ -91,11 +92,13 @@ export type RegionCode =
|
|
|
91
92
|
| 'GP'
|
|
92
93
|
| 'GQ'
|
|
93
94
|
| 'GR'
|
|
95
|
+
| 'GS'
|
|
94
96
|
| 'GT'
|
|
95
97
|
| 'GU'
|
|
96
98
|
| 'GW'
|
|
97
99
|
| 'GY'
|
|
98
100
|
| 'HK'
|
|
101
|
+
| 'HM'
|
|
99
102
|
| 'HN'
|
|
100
103
|
| 'HR'
|
|
101
104
|
| 'HT'
|
|
@@ -180,6 +183,7 @@ export type RegionCode =
|
|
|
180
183
|
| 'PK'
|
|
181
184
|
| 'PL'
|
|
182
185
|
| 'PM'
|
|
186
|
+
| 'PN'
|
|
183
187
|
| 'PR'
|
|
184
188
|
| 'PS'
|
|
185
189
|
| 'PT'
|
|
@@ -215,6 +219,7 @@ export type RegionCode =
|
|
|
215
219
|
| 'TA'
|
|
216
220
|
| 'TC'
|
|
217
221
|
| 'TD'
|
|
222
|
+
| 'TF'
|
|
218
223
|
| 'TG'
|
|
219
224
|
| 'TH'
|
|
220
225
|
| 'TJ'
|
|
@@ -230,6 +235,7 @@ export type RegionCode =
|
|
|
230
235
|
| 'TZ'
|
|
231
236
|
| 'UA'
|
|
232
237
|
| 'UG'
|
|
238
|
+
| 'UM'
|
|
233
239
|
| 'US'
|
|
234
240
|
| 'UY'
|
|
235
241
|
| 'UZ'
|
|
@@ -40,6 +40,8 @@ import { regionCodeToLocale } from './regionCodeToLocale.js';
|
|
|
40
40
|
* possible. Also, it doesn't need to be a `FormControl`, because it's purely a helper element
|
|
41
41
|
* to provide better UX: the modelValue (the text field) contains all needed info, since it's in
|
|
42
42
|
* `e164` format that contains all info (both region code and national phone number).
|
|
43
|
+
*
|
|
44
|
+
* @customElement lion-input-tel-dropdown
|
|
43
45
|
*/
|
|
44
46
|
export class LionInputTelDropdown extends LionInputTel {
|
|
45
47
|
refs = {
|
|
@@ -7,6 +7,8 @@ import { ListboxMixin } from './ListboxMixin.js';
|
|
|
7
7
|
/**
|
|
8
8
|
* LionListbox: implements the wai-aria listbox design pattern and integrates it as a Lion
|
|
9
9
|
* FormControl
|
|
10
|
+
*
|
|
11
|
+
* @customElement lion-listbox
|
|
10
12
|
*/
|
|
11
13
|
export class LionListbox extends ListboxMixin(
|
|
12
14
|
FocusMixin(InteractionStateMixin(ValidateMixin(LitElement))),
|
|
@@ -5,7 +5,7 @@ import { formatNumberToParts } from './formatNumberToParts.js';
|
|
|
5
5
|
* getFractionDigits('JOD'); // return 3
|
|
6
6
|
*
|
|
7
7
|
* @typedef {import('../../types/LocalizeMixinTypes.js').FormatNumberPart} FormatNumberPart
|
|
8
|
-
* @param {string} [currency="EUR"] Currency code e.g. EUR
|
|
8
|
+
* @param {import('../../../input-amount-dropdown/types/index.js').CurrencyCode | string} [currency="EUR"] Currency code e.g. EUR
|
|
9
9
|
* @returns {number} fraction for the given currency
|
|
10
10
|
*/
|
|
11
11
|
export function getFractionDigits(currency = 'EUR') {
|
|
@@ -9,6 +9,10 @@ import { isEqualConfig } from './utils/is-equal-config.js';
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
+
* @slot backdrop - The backdrop element for the overlay
|
|
13
|
+
* @slot content - The content element for the overlay
|
|
14
|
+
* @slot invoker - The invoker element for the overlay
|
|
15
|
+
*
|
|
12
16
|
* @type {OverlayMixin}
|
|
13
17
|
* @param {import('@open-wc/dedupe-mixin').Constructor<import('lit').LitElement>} superclass
|
|
14
18
|
*/
|
|
@@ -5,6 +5,10 @@ import { getLocalizeManager, LocalizeMixin } from '@lion/ui/localize-no-side-eff
|
|
|
5
5
|
/**
|
|
6
6
|
* @typedef {import('lit').TemplateResult} TemplateResult
|
|
7
7
|
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @customElement lion-progress-indicator
|
|
11
|
+
*/
|
|
8
12
|
export class LionProgressIndicator extends LocalizeMixin(LitElement) {
|
|
9
13
|
static get properties() {
|
|
10
14
|
return {
|
|
@@ -2,7 +2,9 @@ import { LitElement } from 'lit';
|
|
|
2
2
|
import { ChoiceGroupMixin, FormGroupMixin } from '@lion/ui/form-core.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* A wrapper around multiple radios.
|
|
5
|
+
* LionRadioGroup: A wrapper around multiple radios.
|
|
6
|
+
*
|
|
7
|
+
* @customElement lion-radio-group
|
|
6
8
|
*/
|
|
7
9
|
export class LionRadioGroup extends ChoiceGroupMixin(FormGroupMixin(LitElement)) {
|
|
8
10
|
connectedCallback() {
|