@lion/ui 0.2.2 → 0.3.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.
- package/README.md +23 -72
- package/components/button/src/LionButton.js +1 -1
- package/components/checkbox-group/src/LionCheckboxIndeterminate.js +2 -2
- package/components/checkbox-group/test/lion-checkbox-indeterminate-integrations.test.js +6 -0
- package/components/checkbox-group/{test/lion-checkbox-indeterminate.test.js → test-suites/CheckboxIndeterminate.suite.js} +209 -187
- package/components/combobox/src/LionCombobox.js +3 -1
- package/components/combobox/test/lion-combobox.test.js +52 -0
- package/components/core/src/SlotMixin.js +3 -2
- package/components/core/test/SlotMixin.test.js +1 -1
- package/components/core/types/SlotMixinTypes.ts +4 -1
- package/components/dialog/test/lion-dialog.test.js +56 -0
- package/components/form-core/src/FocusMixin.js +33 -2
- package/components/form-core/src/LionField.js +3 -1
- package/components/form-core/src/validate/LionValidationFeedback.js +2 -5
- package/components/form-core/src/validate/ResultValidator.js +1 -1
- package/components/form-core/test/FocusMixin.test.js +33 -0
- package/components/form-core/types/validate/ValidateMixinTypes.ts +2 -2
- package/components/form-integrations/test/dialog-integrations.test.js +19 -0
- package/components/form-integrations/test/form-group-methods.test.js +11 -37
- package/components/form-integrations/test/form-integrations.test.js +4 -0
- package/components/form-integrations/test/helpers/umbrella-form.js +21 -18
- package/components/input-amount/src/LionInputAmount.js +13 -4
- package/components/input-amount/test/lion-input-amount.test.js +19 -20
- package/components/input-date/src/LionInputDate.js +2 -11
- package/components/input-datepicker/src/LionInputDatepicker.js +5 -2
- package/components/input-datepicker/test/lion-input-datepicker.test.js +20 -0
- package/components/input-file/src/FileHandle.js +98 -0
- package/components/input-file/src/LionInputFile.js +892 -0
- package/components/input-file/src/LionSelectedFileList.js +232 -0
- package/components/input-file/src/localizeNamespaceLoader.js +75 -0
- package/components/input-file/src/validators.js +114 -0
- package/components/input-file/test/FileValidators.test.js +170 -0
- package/components/input-file/test/lion-input-file.test.js +1168 -0
- package/components/input-file/test/lion-selected-file-list.test.js +207 -0
- package/components/input-file/translations/bg-BG.js +5 -0
- package/components/input-file/translations/bg.js +12 -0
- package/components/input-file/translations/cs-CZ.js +5 -0
- package/components/input-file/translations/cs.js +13 -0
- package/components/input-file/translations/de-DE.js +5 -0
- package/components/input-file/translations/de.js +12 -0
- package/components/input-file/translations/en-AU.js +5 -0
- package/components/input-file/translations/en-GB.js +5 -0
- package/components/input-file/translations/en-PH.js +5 -0
- package/components/input-file/translations/en-US.js +5 -0
- package/components/input-file/translations/en.js +12 -0
- package/components/input-file/translations/es-ES.js +5 -0
- package/components/input-file/translations/es.js +12 -0
- package/components/input-file/translations/fr-BE.js +5 -0
- package/components/input-file/translations/fr-FR.js +5 -0
- package/components/input-file/translations/fr.js +13 -0
- package/components/input-file/translations/hu-HU.js +5 -0
- package/components/input-file/translations/hu.js +12 -0
- package/components/input-file/translations/it-IT.js +5 -0
- package/components/input-file/translations/it.js +12 -0
- package/components/input-file/translations/nl-BE.js +5 -0
- package/components/input-file/translations/nl-NL.js +5 -0
- package/components/input-file/translations/nl.js +12 -0
- package/components/input-file/translations/pl-PL.js +5 -0
- package/components/input-file/translations/pl.js +12 -0
- package/components/input-file/translations/ro-RO.js +5 -0
- package/components/input-file/translations/ro.js +12 -0
- package/components/input-file/translations/ru-RU.js +5 -0
- package/components/input-file/translations/ru.js +12 -0
- package/components/input-file/translations/sk-SK.js +5 -0
- package/components/input-file/translations/sk.js +12 -0
- package/components/input-file/translations/uk-UA.js +5 -0
- package/components/input-file/translations/uk.js +12 -0
- package/components/input-file/translations/zh-CN.js +5 -0
- package/components/input-file/translations/zh.js +12 -0
- package/components/input-file/types/input-file.d.ts +32 -0
- package/components/input-tel-dropdown/src/LionInputTelDropdown.js +1 -4
- package/components/listbox/src/ListboxMixin.js +3 -2
- package/components/listbox/test-suites/ListboxMixin.suite.js +31 -1
- package/components/localize/src/number/utils/normalize-format-number-to-parts/forceNoSpaceBetweenCurrencySymbolAndNumber.js +22 -0
- package/components/localize/src/number/utils/normalize-format-number-to-parts/forceSymbols.js +64 -0
- package/components/localize/src/number/utils/normalize-format-number-to-parts/normalizeIntl.js +13 -7
- package/components/localize/test/number/formatNumber.test.js +6 -28
- package/custom-elements.json +13822 -9246
- package/dist-types/components/checkbox-group/test-suites/CheckboxIndeterminate.suite.d.ts +12 -0
- package/dist-types/components/checkbox-group/test-suites/CheckboxIndeterminate.suite.d.ts.map +1 -0
- package/dist-types/components/combobox/src/LionCombobox.d.ts.map +1 -1
- package/dist-types/components/combobox/test/lion-combobox.test.d.ts.map +1 -1
- package/dist-types/components/core/src/SlotMixin.d.ts.map +1 -1
- package/dist-types/components/core/types/SlotMixinTypes.d.ts +4 -0
- package/dist-types/components/core/types/SlotMixinTypes.d.ts.map +1 -1
- package/dist-types/components/dialog/test/lion-dialog.test.d.ts.map +1 -1
- package/dist-types/components/form-core/src/FocusMixin.d.ts.map +1 -1
- package/dist-types/components/form-core/src/LionField.d.ts +2 -1
- package/dist-types/components/form-core/src/LionField.d.ts.map +1 -1
- package/dist-types/components/form-core/src/validate/LionValidationFeedback.d.ts +4 -11
- package/dist-types/components/form-core/src/validate/LionValidationFeedback.d.ts.map +1 -1
- package/dist-types/components/form-core/src/validate/ResultValidator.d.ts +1 -1
- package/dist-types/components/form-core/types/validate/ValidateMixinTypes.d.ts +5 -0
- package/dist-types/components/form-core/types/validate/ValidateMixinTypes.d.ts.map +1 -1
- package/dist-types/components/form-integrations/test/dialog-integrations.test.d.ts.map +1 -1
- package/dist-types/components/form-integrations/test/form-group-methods.test.d.ts +1 -0
- package/dist-types/components/form-integrations/test/form-group-methods.test.d.ts.map +1 -1
- package/dist-types/components/form-integrations/test/helpers/umbrella-form.d.ts.map +1 -1
- package/dist-types/components/input-amount/src/LionInputAmount.d.ts +2 -4
- package/dist-types/components/input-amount/src/LionInputAmount.d.ts.map +1 -1
- package/dist-types/components/input-amount/test/lion-input-amount.test.d.ts +0 -1
- package/dist-types/components/input-amount/test/lion-input-amount.test.d.ts.map +1 -1
- package/dist-types/components/input-date/src/LionInputDate.d.ts.map +1 -1
- package/dist-types/components/input-datepicker/src/LionInputDatepicker.d.ts +1 -1
- package/dist-types/components/input-datepicker/src/LionInputDatepicker.d.ts.map +1 -1
- package/dist-types/components/input-file/src/FileHandle.d.ts +55 -0
- package/dist-types/components/input-file/src/FileHandle.d.ts.map +1 -0
- package/dist-types/components/input-file/src/LionInputFile.d.ts +230 -0
- package/dist-types/components/input-file/src/LionInputFile.d.ts.map +1 -0
- package/dist-types/components/input-file/src/LionSelectedFileList.d.ts +69 -0
- package/dist-types/components/input-file/src/LionSelectedFileList.d.ts.map +1 -0
- package/dist-types/components/input-file/src/localizeNamespaceLoader.d.ts +2 -0
- package/dist-types/components/input-file/src/localizeNamespaceLoader.d.ts.map +1 -0
- package/dist-types/components/input-file/src/validators.d.ts +58 -0
- package/dist-types/components/input-file/src/validators.d.ts.map +1 -0
- package/dist-types/components/input-file/test/FileValidators.test.d.ts +2 -0
- package/dist-types/components/input-file/test/FileValidators.test.d.ts.map +1 -0
- package/dist-types/components/input-file/test/lion-input-file.test.d.ts +5 -0
- package/dist-types/components/input-file/test/lion-input-file.test.d.ts.map +1 -0
- package/dist-types/components/input-file/test/lion-selected-file-list.test.d.ts +4 -0
- package/dist-types/components/input-file/test/lion-selected-file-list.test.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/bg-BG.d.ts +13 -0
- package/dist-types/components/input-file/translations/bg-BG.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/bg.d.ts +13 -0
- package/dist-types/components/input-file/translations/bg.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/cs-CZ.d.ts +13 -0
- package/dist-types/components/input-file/translations/cs-CZ.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/cs.d.ts +13 -0
- package/dist-types/components/input-file/translations/cs.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/de-DE.d.ts +13 -0
- package/dist-types/components/input-file/translations/de-DE.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/de.d.ts +13 -0
- package/dist-types/components/input-file/translations/de.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/en-AU.d.ts +13 -0
- package/dist-types/components/input-file/translations/en-AU.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/en-GB.d.ts +13 -0
- package/dist-types/components/input-file/translations/en-GB.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/en-PH.d.ts +13 -0
- package/dist-types/components/input-file/translations/en-PH.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/en-US.d.ts +13 -0
- package/dist-types/components/input-file/translations/en-US.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/en.d.ts +13 -0
- package/dist-types/components/input-file/translations/en.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/es-ES.d.ts +13 -0
- package/dist-types/components/input-file/translations/es-ES.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/es.d.ts +13 -0
- package/dist-types/components/input-file/translations/es.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/fr-BE.d.ts +13 -0
- package/dist-types/components/input-file/translations/fr-BE.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/fr-FR.d.ts +13 -0
- package/dist-types/components/input-file/translations/fr-FR.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/fr.d.ts +13 -0
- package/dist-types/components/input-file/translations/fr.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/hu-HU.d.ts +13 -0
- package/dist-types/components/input-file/translations/hu-HU.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/hu.d.ts +13 -0
- package/dist-types/components/input-file/translations/hu.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/it-IT.d.ts +13 -0
- package/dist-types/components/input-file/translations/it-IT.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/it.d.ts +13 -0
- package/dist-types/components/input-file/translations/it.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/nl-BE.d.ts +13 -0
- package/dist-types/components/input-file/translations/nl-BE.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/nl-NL.d.ts +13 -0
- package/dist-types/components/input-file/translations/nl-NL.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/nl.d.ts +13 -0
- package/dist-types/components/input-file/translations/nl.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/pl-PL.d.ts +13 -0
- package/dist-types/components/input-file/translations/pl-PL.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/pl.d.ts +13 -0
- package/dist-types/components/input-file/translations/pl.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/ro-RO.d.ts +13 -0
- package/dist-types/components/input-file/translations/ro-RO.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/ro.d.ts +13 -0
- package/dist-types/components/input-file/translations/ro.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/ru-RU.d.ts +13 -0
- package/dist-types/components/input-file/translations/ru-RU.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/ru.d.ts +13 -0
- package/dist-types/components/input-file/translations/ru.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/sk-SK.d.ts +13 -0
- package/dist-types/components/input-file/translations/sk-SK.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/sk.d.ts +13 -0
- package/dist-types/components/input-file/translations/sk.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/uk-UA.d.ts +13 -0
- package/dist-types/components/input-file/translations/uk-UA.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/uk.d.ts +13 -0
- package/dist-types/components/input-file/translations/uk.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/zh-CN.d.ts +13 -0
- package/dist-types/components/input-file/translations/zh-CN.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/zh.d.ts +13 -0
- package/dist-types/components/input-file/translations/zh.d.ts.map +1 -0
- package/dist-types/components/input-stepper/src/LionInputStepper.d.ts +6 -0
- package/dist-types/components/input-stepper/src/LionInputStepper.d.ts.map +1 -1
- package/dist-types/components/input-tel-dropdown/src/LionInputTelDropdown.d.ts +0 -1
- package/dist-types/components/input-tel-dropdown/src/LionInputTelDropdown.d.ts.map +1 -1
- package/dist-types/components/listbox/src/ListboxMixin.d.ts.map +1 -1
- package/dist-types/components/listbox/test-suites/ListboxMixin.suite.d.ts.map +1 -1
- package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/forceNoSpaceBetweenCurrencySymbolAndNumber.d.ts +14 -0
- package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/forceNoSpaceBetweenCurrencySymbolAndNumber.d.ts.map +1 -0
- package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/forceSymbols.d.ts +20 -0
- package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/forceSymbols.d.ts.map +1 -0
- package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/normalizeIntl.d.ts.map +1 -1
- package/dist-types/exports/checkbox-group-test-suites.d.ts +2 -0
- package/dist-types/exports/checkbox-group-test-suites.d.ts.map +1 -0
- package/dist-types/exports/define/lion-input-file.d.ts +2 -0
- package/dist-types/exports/define/lion-input-file.d.ts.map +1 -0
- package/dist-types/exports/define/lion-selected-file-list.d.ts +2 -0
- package/dist-types/exports/define/lion-selected-file-list.d.ts.map +1 -0
- package/dist-types/exports/input-file.d.ts +4 -0
- package/dist-types/exports/input-file.d.ts.map +1 -0
- package/dist-types/tsconfig.tsbuildinfo +1 -1
- package/docs/components/button/extensions/bootstrap-button.mjs +240 -0
- package/docs/components/button/extensions.md +30 -0
- package/docs/components/checkbox-group/overview.md +9 -10
- package/docs/components/checkbox-group/use-cases.md +110 -142
- package/docs/components/collapsible/overview.md +1 -1
- package/docs/components/combobox/{examples.md → extensions.md} +51 -43
- package/docs/components/combobox/overview.md +1 -1
- package/docs/components/combobox/src/google-combobox/google-combobox.js +4 -1
- package/docs/components/combobox/src/md-combobox/md-combobox.js +40 -38
- package/docs/components/combobox/src/wa-combobox/wa-combobox.js +204 -209
- package/docs/components/combobox/use-cases.md +1 -1
- package/docs/components/dialog/overview.md +1 -1
- 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-amount/use-cases.md +4 -2
- package/docs/components/input-date/overview.md +3 -3
- package/docs/components/input-datepicker/overview.md +5 -5
- package/docs/components/input-datepicker/use-cases.md +11 -0
- package/docs/components/input-email/overview.md +2 -2
- package/docs/components/input-file/index.md +3 -0
- package/docs/components/input-file/overview.md +32 -0
- package/docs/components/input-file/use-cases.md +424 -0
- 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/{examples.md → extensions.md} +1 -1
- 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 +1 -1
- 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/rationales/accessibility.md +28 -0
- package/docs/fundamentals/systems/core/SlotMixin.md +148 -0
- 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/use-cases.md +2 -0
- package/docs/fundamentals/systems/form/validate.md +1 -1
- package/docs/fundamentals/systems/localize/overview.md +4 -4
- package/docs/fundamentals/systems/overlays/_configuration-positioning.md +116 -0
- package/docs/fundamentals/systems/overlays/_edge-cases.md +145 -0
- 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/example-complex/index.md +21 -0
- package/docs/fundamentals/tools/singleton-manager/example-fail/index.md +19 -0
- package/docs/fundamentals/tools/singleton-manager/example-success/index.md +18 -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/create-a-form.md +88 -0
- package/docs/guides/how-to/extend-a-native-input.md +2 -2
- package/docs/guides/how-to/get-started.md +28 -1
- 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/checkbox-group-test-suites.js +1 -0
- package/exports/define/lion-input-file.js +3 -0
- package/exports/define/lion-selected-file-list.js +3 -0
- package/exports/input-file.js +3 -0
- package/package.json +3 -2
- package/components/localize/src/number/utils/normalize-format-number-to-parts/forceENAUSymbols.js +0 -25
- package/components/localize/src/number/utils/normalize-format-number-to-parts/forceYenSymbol.js +0 -15
- package/dist-types/components/checkbox-group/test/lion-checkbox-indeterminate.test.d.ts +0 -4
- package/dist-types/components/checkbox-group/test/lion-checkbox-indeterminate.test.d.ts.map +0 -1
- package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/forceENAUSymbols.d.ts +0 -14
- package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/forceENAUSymbols.d.ts.map +0 -1
- package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/forceYenSymbol.d.ts +0 -9
- package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/forceYenSymbol.d.ts.map +0 -1
- package/docs/components/combobox/src/google-combobox/assets/googlelogo_color_272x92dp.png +0 -0
- package/docs/components/dialog/src/demo-dialog-style.js +0 -3
- package/docs/components/select-rich/src/flags.png +0 -0
- package/docs/components/select-rich/src/flags@2x.png +0 -0
- package/docs/fundamentals/systems/form/assets/FormatMixinDiagram-1.svg +0 -1
- package/docs/fundamentals/systems/form/assets/FormatMixinDiagram-2.svg +0 -1
- package/docs/fundamentals/systems/form/assets/FormatMixinDiagram-3.svg +0 -84
- package/docs/fundamentals/tools/ajax/assets/naga.json +0 -9
- package/docs/fundamentals/tools/ajax/assets/pabu.json +0 -9
- package/docs/fundamentals/tools/singleton-manager/.gitignore +0 -1
- package/docs/override.js +0 -15
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
nextFrame,
|
|
14
14
|
unsafeStatic,
|
|
15
15
|
} from '@open-wc/testing';
|
|
16
|
+
import { sendKeys } from '@web/test-runner-commands';
|
|
16
17
|
import sinon from 'sinon';
|
|
17
18
|
import { getListboxMembers } from '../../../exports/listbox-test-helpers.js';
|
|
18
19
|
|
|
@@ -673,12 +674,41 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
673
674
|
mimicKeyPress(_listboxNode, 'Enter');
|
|
674
675
|
expect(options[1].checked).to.be.true;
|
|
675
676
|
});
|
|
677
|
+
|
|
678
|
+
it('submits form on [Enter] when inputNode is an instance of HTMLInputNode', async () => {
|
|
679
|
+
const submitSpy = sinon.spy(e => e.preventDefault());
|
|
680
|
+
const el = /** @type {HTMLFormElement} */ (
|
|
681
|
+
await _fixture(html`
|
|
682
|
+
<form @submit=${submitSpy}>
|
|
683
|
+
<${tag} name="foo">
|
|
684
|
+
<${optionTag} .choiceValue="${'Artichoke'}">Artichoke</${optionTag}>
|
|
685
|
+
<${optionTag} .choiceValue="${'Bla'}">Bla</${optionTag}>
|
|
686
|
+
<${optionTag} .choiceValue="${'Chard'}">Chard</${optionTag}>
|
|
687
|
+
</${tag}>
|
|
688
|
+
<button type="submit">submit</button>
|
|
689
|
+
</form>
|
|
690
|
+
`)
|
|
691
|
+
);
|
|
692
|
+
const listbox = /** @type {LionListbox} */ (el.querySelector('[name="foo"]'));
|
|
693
|
+
const { _inputNode } = getListboxMembers(listbox);
|
|
694
|
+
if (!(_inputNode instanceof HTMLInputElement)) {
|
|
695
|
+
return;
|
|
696
|
+
}
|
|
697
|
+
await listbox.updateComplete;
|
|
698
|
+
// @ts-ignore allow protected members in tests
|
|
699
|
+
|
|
700
|
+
_inputNode.focus();
|
|
701
|
+
await sendKeys({
|
|
702
|
+
press: 'Enter',
|
|
703
|
+
});
|
|
704
|
+
expect(submitSpy.callCount).to.equal(1);
|
|
705
|
+
});
|
|
676
706
|
});
|
|
677
707
|
|
|
678
708
|
describe('Space', () => {
|
|
679
709
|
it('selects active option when "_listboxReceivesNoFocus" is true', async () => {
|
|
680
710
|
// When listbox is not focusable (in case of a combobox), the user should be allowed
|
|
681
|
-
// to enter a space in the focusable element (
|
|
711
|
+
// to enter a space in the focusable element (textbox)
|
|
682
712
|
const el = /** @type {LionListbox} */ (
|
|
683
713
|
await fixture(html`
|
|
684
714
|
<${tag} opened name="foo" ._listboxReceivesNoFocus="${false}" autocomplete="none" show-all-on-empty>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Force no space between currency symbol and amount
|
|
3
|
+
*
|
|
4
|
+
* @typedef {import('../../../../types/LocalizeMixinTypes.js').FormatNumberPart} FormatNumberPart
|
|
5
|
+
* @param {FormatNumberPart[]} formattedParts
|
|
6
|
+
* @param {import('../../../../types/LocalizeMixinTypes.js').FormatNumberOptions} options
|
|
7
|
+
* @returns {FormatNumberPart[]}
|
|
8
|
+
*/
|
|
9
|
+
export function forceNoSpaceBetweenCurrencySymbolAndNumber(
|
|
10
|
+
formattedParts,
|
|
11
|
+
{ currency, currencyDisplay } = {},
|
|
12
|
+
) {
|
|
13
|
+
const result = formattedParts;
|
|
14
|
+
if (formattedParts.length > 1 && currencyDisplay === 'symbol' && currency) {
|
|
15
|
+
formattedParts.forEach((part, i) => {
|
|
16
|
+
if (part.type === 'literal') {
|
|
17
|
+
result[i].value = '';
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('../../../../types/LocalizeMixinTypes.js').FormatNumberPart} FormatNumberPart
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/** @type {Object.<string,string>} */
|
|
6
|
+
const CURRENCY_CODE_SYMBOL_MAP = {
|
|
7
|
+
EUR: '€',
|
|
8
|
+
USD: '$',
|
|
9
|
+
JPY: '¥',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Change the symbols differences in browsers
|
|
14
|
+
*
|
|
15
|
+
* @param {FormatNumberPart[]} formattedParts
|
|
16
|
+
* @param {import('../../../../types/LocalizeMixinTypes.js').FormatNumberOptions} options
|
|
17
|
+
* @param {string[]} currencyScope
|
|
18
|
+
* @returns {FormatNumberPart[]}
|
|
19
|
+
*/
|
|
20
|
+
export function forceSymbols(formattedParts, { currency, currencyDisplay } = {}, currencyScope) {
|
|
21
|
+
const result = formattedParts;
|
|
22
|
+
if (
|
|
23
|
+
formattedParts.length > 1 &&
|
|
24
|
+
currencyDisplay === 'symbol' &&
|
|
25
|
+
currency &&
|
|
26
|
+
currencyScope.includes(currency)
|
|
27
|
+
) {
|
|
28
|
+
formattedParts.forEach((part, i) => {
|
|
29
|
+
if (part.type === 'currency' && Object.keys(CURRENCY_CODE_SYMBOL_MAP).includes(currency)) {
|
|
30
|
+
result[i].value = CURRENCY_CODE_SYMBOL_MAP[currency];
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Change the symbols for fr-BE differences in browsers
|
|
39
|
+
*
|
|
40
|
+
* @param {FormatNumberPart[]} formattedParts
|
|
41
|
+
* @param {import('../../../../types/LocalizeMixinTypes.js').FormatNumberOptions} options
|
|
42
|
+
* @param {string[]} currencyScope
|
|
43
|
+
* @returns {FormatNumberPart[]}
|
|
44
|
+
*/
|
|
45
|
+
export function forceFRBESymbols(
|
|
46
|
+
formattedParts,
|
|
47
|
+
{ currency, currencyDisplay } = {},
|
|
48
|
+
currencyScope,
|
|
49
|
+
) {
|
|
50
|
+
const result = formattedParts;
|
|
51
|
+
if (
|
|
52
|
+
formattedParts.length > 1 &&
|
|
53
|
+
currencyDisplay === 'symbol' &&
|
|
54
|
+
currency &&
|
|
55
|
+
currencyScope.includes(currency)
|
|
56
|
+
) {
|
|
57
|
+
formattedParts.forEach((part, i) => {
|
|
58
|
+
if (part.type === 'currency' && Object.keys(CURRENCY_CODE_SYMBOL_MAP).includes(currency)) {
|
|
59
|
+
result[i].value = '$US';
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return result;
|
|
64
|
+
}
|
package/components/localize/src/number/utils/normalize-format-number-to-parts/normalizeIntl.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { getGroupSeparator } from '../../getGroupSeparator.js';
|
|
2
2
|
import { forceAddGroupSeparators } from './forceAddGroupSeparators.js';
|
|
3
3
|
import { forceCurrencyToEnd } from './forceCurrencyToEnd.js';
|
|
4
|
+
import { forceNoSpaceBetweenCurrencySymbolAndNumber } from './forceNoSpaceBetweenCurrencySymbolAndNumber.js';
|
|
4
5
|
import { forceNormalSpaces } from './forceNormalSpaces.js';
|
|
5
6
|
import { forceSpaceBetweenCurrencyCodeAndNumber } from './forceSpaceBetweenCurrencyCodeAndNumber.js';
|
|
6
|
-
import { forceYenSymbol } from './forceYenSymbol.js';
|
|
7
7
|
import { forceSpaceInsteadOfZeroForGroup } from './forceSpaceInsteadOfZeroForGroup.js';
|
|
8
8
|
import { forceTryCurrencyCode } from './forceTryCurrencyCode.js';
|
|
9
|
-
import {
|
|
9
|
+
import { forceFRBESymbols, forceSymbols } from './forceSymbols.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Normalizes function "formatNumberToParts"
|
|
@@ -33,9 +33,18 @@ export function normalizeIntl(formattedParts, options = {}, _locale) {
|
|
|
33
33
|
if (_locale === 'en-GB' || _locale === 'en-US' || _locale === 'en-AU' || _locale === 'en-PH') {
|
|
34
34
|
normalize = forceSpaceBetweenCurrencyCodeAndNumber(normalize, options);
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
if (_locale === 'en-AU') {
|
|
37
|
+
normalize = forceSymbols(normalize, options, ['EUR', 'USD', 'JPY']);
|
|
38
|
+
normalize = forceNoSpaceBetweenCurrencySymbolAndNumber(normalize, options);
|
|
39
|
+
}
|
|
40
|
+
if (_locale === 'en-PH') {
|
|
41
|
+
normalize = forceSymbols(normalize, options, ['USD', 'JPY']);
|
|
42
|
+
}
|
|
37
43
|
if (_locale === 'fr-FR' || _locale === 'fr-BE') {
|
|
38
|
-
normalize =
|
|
44
|
+
normalize = forceSymbols(normalize, options, ['JPY']);
|
|
45
|
+
}
|
|
46
|
+
if (_locale === 'fr-BE') {
|
|
47
|
+
normalize = forceFRBESymbols(normalize, options, ['USD']);
|
|
39
48
|
}
|
|
40
49
|
if (_locale === 'tr-TR') {
|
|
41
50
|
normalize = forceTryCurrencyCode(normalize, options);
|
|
@@ -43,9 +52,6 @@ export function normalizeIntl(formattedParts, options = {}, _locale) {
|
|
|
43
52
|
normalize = forceCurrencyToEnd(normalize);
|
|
44
53
|
}
|
|
45
54
|
}
|
|
46
|
-
if (_locale === 'en-AU') {
|
|
47
|
-
normalize = forceENAUSymbols(normalize, options);
|
|
48
|
-
}
|
|
49
55
|
}
|
|
50
56
|
return normalize;
|
|
51
57
|
}
|
|
@@ -2,12 +2,6 @@ import { expect } from '@open-wc/testing';
|
|
|
2
2
|
import { getLocalizeManager, formatNumber } from '@lion/ui/localize-no-side-effects.js';
|
|
3
3
|
import { localizeTearDown } from '@lion/ui/localize-test-helpers.js';
|
|
4
4
|
|
|
5
|
-
// TODO: This is broken only in Safari 13.1.2 Wait till ci is on 13.1.3 and remove
|
|
6
|
-
const isSafari = (() => {
|
|
7
|
-
const ua = navigator.userAgent.toLowerCase();
|
|
8
|
-
return ua.indexOf('safari') !== -1 && ua.indexOf('chrome') === -1;
|
|
9
|
-
})();
|
|
10
|
-
|
|
11
5
|
const currencyCode = /** @param {string} currency */ currency => ({
|
|
12
6
|
style: 'currency',
|
|
13
7
|
currencyDisplay: 'code',
|
|
@@ -278,19 +272,17 @@ Please specify .groupSeparator / .decimalSeparator on the formatOptions object t
|
|
|
278
272
|
});
|
|
279
273
|
|
|
280
274
|
describe('en-AU', () => {
|
|
281
|
-
// TODO: This is broken only in Safari 13.1.2 Wait till ci is on 13.1.3 and remove
|
|
282
|
-
if (isSafari) {
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
275
|
it('supports basics', () => {
|
|
287
276
|
localizeManager.locale = 'en-AU';
|
|
288
277
|
expect(formatNumber(123456.789, currencyCode('EUR'))).to.equal('EUR 123,456.79');
|
|
289
278
|
expect(formatNumber(123456.789, currencyCode('USD'))).to.equal('USD 123,456.79');
|
|
290
279
|
expect(formatNumber(123456.789, currencyCode('JPY'))).to.equal('JPY 123,457');
|
|
291
|
-
expect(formatNumber(123456.789, currencySymbol('EUR'))).to.equal('€123,456.79');
|
|
292
|
-
expect(formatNumber(123456.789, currencySymbol('
|
|
293
|
-
expect(formatNumber(123456.789, currencySymbol('
|
|
280
|
+
expect(formatNumber(123456.789, currencySymbol('EUR'))).to.equal('€123,456.79');
|
|
281
|
+
expect(formatNumber(-123456.789, currencySymbol('EUR'))).to.equal('−€123,456.79');
|
|
282
|
+
expect(formatNumber(123456.789, currencySymbol('USD'))).to.equal('$123,456.79');
|
|
283
|
+
expect(formatNumber(-123456.789, currencySymbol('USD'))).to.equal('−$123,456.79');
|
|
284
|
+
expect(formatNumber(123456.789, currencySymbol('JPY'))).to.equal('¥123,457');
|
|
285
|
+
expect(formatNumber(-123456.789, currencySymbol('JPY'))).to.equal('−¥123,457');
|
|
294
286
|
});
|
|
295
287
|
});
|
|
296
288
|
|
|
@@ -319,11 +311,6 @@ Please specify .groupSeparator / .decimalSeparator on the formatOptions object t
|
|
|
319
311
|
});
|
|
320
312
|
|
|
321
313
|
describe('nl-BE', () => {
|
|
322
|
-
// TODO: This is broken only in Safari 13.1.2 Wait till ci is on 13.1.3 and remove
|
|
323
|
-
if (isSafari) {
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
314
|
it('supports basics', () => {
|
|
328
315
|
localizeManager.locale = 'nl-BE';
|
|
329
316
|
expect(formatNumber(123456.789, currencyCode('EUR'))).to.equal('123.456,79 EUR');
|
|
@@ -349,10 +336,6 @@ Please specify .groupSeparator / .decimalSeparator on the formatOptions object t
|
|
|
349
336
|
|
|
350
337
|
describe('fr-BE', () => {
|
|
351
338
|
it('supports basics', () => {
|
|
352
|
-
// TODO: This test is broken on Safari, check and fix when the intl change is permanent
|
|
353
|
-
if (isSafari) {
|
|
354
|
-
return;
|
|
355
|
-
}
|
|
356
339
|
localizeManager.locale = 'fr-BE';
|
|
357
340
|
expect(formatNumber(123456.789, currencyCode('EUR'))).to.equal('123 456,79 EUR');
|
|
358
341
|
expect(formatNumber(123456.789, currencyCode('USD'))).to.equal('123 456,79 USD');
|
|
@@ -397,11 +380,6 @@ Please specify .groupSeparator / .decimalSeparator on the formatOptions object t
|
|
|
397
380
|
});
|
|
398
381
|
|
|
399
382
|
describe('tr-TR', () => {
|
|
400
|
-
// TODO: This is broken only in Safari 13.1.2 Wait till ci is on 13.1.3 and remove
|
|
401
|
-
if (isSafari) {
|
|
402
|
-
return;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
383
|
it('supports basics', () => {
|
|
406
384
|
localizeManager.locale = 'tr-TR';
|
|
407
385
|
expect(formatNumber(123456.789, currencyCode('EUR'))).to.equal('123.456,79 EUR');
|