@lion/ui 0.23.0 → 0.25.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/README.md +50 -20
- package/components/accordion/src/LionAccordion.js +31 -42
- package/components/accordion/test/lion-accordion.test.js +108 -134
- package/components/button/src/LionButton.js +9 -12
- package/components/button/src/LionButtonReset.js +0 -5
- package/components/button/src/LionButtonSubmit.js +7 -12
- package/components/button/test/demos.screenshots-test.js +50 -11
- package/components/button/test/lion-button.test.js +0 -1
- package/components/button/test-suites/LionButton.suite.js +135 -145
- package/components/button/test-suites/LionButtonReset.suite.js +54 -72
- package/components/button/test-suites/LionButtonSubmit.suite.js +49 -68
- package/components/calendar/src/LionCalendar.js +151 -104
- package/components/calendar/src/calendarStyle.js +0 -1
- package/components/calendar/src/utils/createMonth.js +3 -4
- package/components/calendar/src/utils/createMultipleMonth.js +15 -7
- package/components/calendar/src/utils/createWeek.js +0 -2
- package/components/calendar/src/utils/dataTemplate.js +8 -4
- package/components/calendar/src/utils/dayTemplate.js +0 -6
- package/components/calendar/src/utils/getDayMonthYear.js +6 -2
- package/components/calendar/test/demos.screenshots-test.js +40 -9
- package/components/calendar/test/lion-calendar.test.js +171 -282
- package/components/calendar/test/utils/createMonth.test.js +61 -22
- package/components/calendar/test/utils/createMultipleMonth.test.js +14 -7
- package/components/calendar/test/utils/createWeek.test.js +51 -17
- package/components/calendar/test/utils/dataTemplate.test.js +3 -4
- package/components/calendar/test/utils/dayTemplate.test.js +106 -34
- package/components/calendar/test/utils/getFirstDayNextMonth.test.js +0 -1
- package/components/calendar/test/utils/getLastDayPreviousMonth.test.js +0 -1
- package/components/calendar/test/utils/isSameDate.test.js +0 -1
- package/components/calendar/test/utils/snapshots/monthTemplate_en-GB_Sunday_2018-12.js +1 -2
- package/components/calendar/test-helpers/CalendarObject.js +31 -62
- package/components/calendar/test-helpers/DayObject.js +7 -15
- package/components/calendar/test-suites/LionCalendar.suite.js +7 -9
- package/components/checkbox-group/src/LionCheckboxIndeterminate.js +17 -30
- package/components/checkbox-group/test/lion-checkbox-group-integrations.test.js +0 -1
- package/components/checkbox-group/test/lion-checkbox-group.test.js +21 -16
- package/components/checkbox-group/test/lion-checkbox-indeterminate-integrations.test.js +3 -3
- package/components/checkbox-group/test/lion-checkbox-integrations.test.js +3 -2
- package/components/checkbox-group/test/lion-checkbox.test.js +30 -16
- package/components/checkbox-group/test-suites/CheckboxIndeterminate.suite.js +147 -191
- package/components/collapsible/src/LionCollapsible.js +10 -15
- package/components/collapsible/test/lion-collapsible.test.js +4 -18
- package/components/combobox/src/LionCombobox.js +35 -53
- package/components/combobox/src/utils/makeMatchingTextBold.js +2 -5
- package/components/combobox/src/validators.js +0 -1
- package/components/combobox/test/lion-combobox-integrations.test.js +6 -6
- package/components/combobox/test/lion-combobox.test.js +576 -869
- package/components/combobox/test/validators.test.js +6 -13
- package/components/combobox/test-helpers/combobox-helpers.js +24 -11
- package/components/core/src/DisabledMixin.js +61 -66
- package/components/core/src/DisabledWithTabIndexMixin.js +76 -83
- package/components/core/src/EventTargetShim.js +1 -4
- package/components/core/src/ScopedElementsMixin.js +4 -15
- package/components/core/src/ScopedStylesController.js +1 -5
- package/components/core/src/SlotMixin.js +236 -239
- package/components/core/src/browserDetection.js +5 -12
- package/components/core/test/DisabledMixin.test.js +24 -39
- package/components/core/test/DisabledWithTabIndexMixin.test.js +21 -34
- package/components/core/test/EventTargetShim.test.js +0 -8
- package/components/core/test/ScopedElementsMixin.test.js +22 -38
- package/components/core/test/ScopedStylesController.test.js +11 -20
- package/components/core/test/SlotMixin.test.js +102 -154
- package/components/core/test-helpers/getCachedFixture.js +5 -11
- package/components/core/types/SlotMixinTypes.ts +8 -3
- package/components/dialog/src/LionDialog.js +4 -3
- package/components/dialog/test/lion-dialog.integration.test.js +10 -20
- package/components/dialog/test/lion-dialog.test.js +48 -62
- package/components/dialog/test-helpers/test-router.js +4 -6
- package/components/drawer/src/LionDrawer.js +18 -34
- package/components/drawer/src/drawerStyle.js +0 -1
- package/components/drawer/test/lion-drawer.test.js +1 -17
- package/components/fieldset/test/lion-fieldset.test.js +6 -4
- package/components/form/src/LionForm.js +18 -13
- package/components/form/test/lion-form.test.js +22 -52
- package/components/form-core/src/FocusMixin.js +172 -174
- package/components/form-core/src/FormControlMixin.js +811 -813
- package/components/form-core/src/FormatMixin.js +537 -537
- package/components/form-core/src/InteractionStateMixin.js +196 -183
- package/components/form-core/src/LionField.js +9 -5
- package/components/form-core/src/NativeTextFieldMixin.js +114 -116
- package/components/form-core/src/choice-group/ChoiceGroupMixin.js +322 -364
- package/components/form-core/src/choice-group/ChoiceInputMixin.js +306 -296
- package/components/form-core/src/choice-group/CustomChoiceGroupMixin.js +114 -139
- package/components/form-core/src/form-group/FormElementsHaveNoError.js +0 -2
- package/components/form-core/src/form-group/FormGroupMixin.js +551 -557
- package/components/form-core/src/registration/FormRegisteringMixin.js +72 -71
- package/components/form-core/src/registration/FormRegistrarMixin.js +201 -217
- package/components/form-core/src/registration/FormRegistrarPortalMixin.js +31 -37
- package/components/form-core/src/utils/SyncUpdatableMixin.js +106 -117
- package/components/form-core/src/utils/getAriaElementsInRightDomOrder.js +1 -2
- package/components/form-core/src/validate/LionValidationFeedback.js +12 -8
- package/components/form-core/src/validate/Unparseable.js +4 -2
- package/components/form-core/src/validate/ValidateMixin.js +829 -883
- package/components/form-core/src/validate/Validator.js +3 -6
- package/components/form-core/src/validate/resultValidators/DefaultSuccess.js +1 -2
- package/components/form-core/src/validate/validators/DateValidators.js +0 -5
- package/components/form-core/src/validate/validators/NumberValidators.js +1 -5
- package/components/form-core/src/validate/validators/Required.js +1 -1
- package/components/form-core/src/validate/validators/StringValidators.js +1 -8
- package/components/form-core/test/FocusMixin.test.js +96 -82
- package/components/form-core/test/FormControlMixin.test.js +120 -176
- package/components/form-core/test/FormRegistrationMixins.test.js +0 -2
- package/components/form-core/test/FormatMixin.test.js +0 -1
- package/components/form-core/test/InteractionStateMixin.test.js +0 -1
- package/components/form-core/test/NativeTextFieldMixin.test.js +0 -1
- package/components/form-core/test/choice-group/ChoiceGroupMixin.test.js +0 -1
- package/components/form-core/test/choice-group/ChoiceInputMixin.test.js +0 -1
- package/components/form-core/test/choice-group/CustomChoiceGroupMixin.integrations.test.js +6 -8
- package/components/form-core/test/choice-group/CustomChoiceGroupMixin.test.js +0 -3
- package/components/form-core/test/form-group/FormGroupMixin.test.js +0 -1
- package/components/form-core/test/lion-field.test.js +88 -98
- package/components/form-core/test/utils/SyncUpdatableMixin.test.js +51 -65
- package/components/form-core/test/utils/getAriaElementsInRightDomOrder.test.js +3 -3
- package/components/form-core/test/validate/DateValidators.test.js +5 -27
- package/components/form-core/test/validate/NumberValidators.test.js +4 -16
- package/components/form-core/test/validate/Required.test.js +8 -21
- package/components/form-core/test/validate/ResultValidator.test.js +1 -2
- package/components/form-core/test/validate/StringValidators.test.js +4 -35
- package/components/form-core/test/validate/ValidateMixin.test.js +0 -1
- package/components/form-core/test/validate/ValidateMixinFeedbackPart.test.js +0 -1
- package/components/form-core/test/validate/Validator.test.js +39 -34
- package/components/form-core/test/validate/lion-validation-feedback.test.js +81 -43
- package/components/form-core/test-helpers/ExampleValidators.js +0 -5
- package/components/form-core/test-helpers/getFormControlMembers.js +2 -2
- package/components/form-core/test-helpers/mimicUserInput.js +5 -1
- package/components/form-core/test-suites/FormRegistrationMixins.suite.js +65 -122
- package/components/form-core/test-suites/FormatMixin.suite.js +202 -227
- package/components/form-core/test-suites/InteractionStateMixin.suite.js +47 -60
- package/components/form-core/test-suites/NativeTextFieldMixin.suite.js +8 -11
- package/components/form-core/test-suites/ValidateMixin.suite.js +280 -359
- package/components/form-core/test-suites/ValidateMixinFeedbackPart.suite.js +112 -163
- package/components/form-core/test-suites/choice-group/ChoiceGroupMixin.suite.js +185 -218
- package/components/form-core/test-suites/choice-group/ChoiceInputMixin.suite.js +116 -109
- package/components/form-core/test-suites/choice-group/CustomChoiceGroupMixin.suite.js +36 -70
- package/components/form-core/test-suites/form-group/FormGroupMixin-input.suite.js +57 -65
- package/components/form-core/test-suites/form-group/FormGroupMixin.suite.js +664 -523
- package/components/form-core/translations/bg-BG.js +0 -1
- package/components/form-core/translations/cs-CZ.js +0 -1
- package/components/form-core/translations/de-DE.js +0 -1
- package/components/form-core/translations/en-AU.js +0 -1
- package/components/form-core/translations/en-GB.js +0 -1
- package/components/form-core/translations/en-US.js +0 -1
- package/components/form-core/translations/es-ES.js +0 -1
- package/components/form-core/translations/fr-BE.js +0 -1
- package/components/form-core/translations/fr-FR.js +0 -1
- package/components/form-core/translations/hu-HU.js +0 -1
- package/components/form-core/translations/it-IT.js +0 -1
- package/components/form-core/translations/nl-BE.js +0 -1
- package/components/form-core/translations/nl-NL.js +0 -1
- package/components/form-core/translations/pl-PL.js +0 -1
- package/components/form-core/translations/ro-RO.js +0 -1
- package/components/form-core/translations/ru-RU.js +0 -1
- package/components/form-core/translations/sk-SK.js +0 -1
- package/components/form-core/translations/tr-TR.js +0 -1
- package/components/form-core/translations/uk-UA.js +0 -1
- package/components/form-integrations/test/dialog-integrations.test.js +1 -4
- package/components/form-integrations/test/form-group-methods.test.js +28 -31
- package/components/form-integrations/test/form-integrations.test.js +27 -28
- package/components/form-integrations/test/form-validation-integrations.test.js +21 -29
- package/components/form-integrations/test/helpers/umbrella-form.js +3 -5
- package/components/form-integrations/test/model-value-consistency.test.js +75 -77
- package/components/form-integrations/test/model-value-event.test.js +10 -20
- package/components/helpers/src/SbActionLogger.js +13 -17
- package/components/helpers/src/SbLocaleSwitcher.js +5 -5
- package/components/helpers/src/sortEachDepth.js +0 -2
- package/components/helpers/test/renderLitAsNode.test.js +0 -4
- package/components/helpers/test/sb-action-logger.test.js +24 -55
- package/components/icon/src/IconManager.js +0 -2
- package/components/icon/src/LionIcon.js +2 -7
- package/components/icon/src/icons.js +0 -2
- package/components/icon/test/IconManager.test.js +0 -15
- package/components/icon/test/hammer.svg.js +3 -4
- package/components/icon/test/heart.svg.js +3 -4
- package/components/icon/test/lion-icon.test.js +14 -43
- package/components/input/src/LionInput.js +2 -8
- package/components/input/test/input-integrations.test.js +0 -5
- package/components/input/test/lion-input-integrations.test.js +0 -4
- package/components/input/test/lion-input.test.js +28 -58
- package/components/input/test-helpers/getInputMembers.js +2 -2
- package/components/input-amount/src/LionInputAmount.js +20 -20
- package/components/input-amount/src/formatters.js +0 -3
- package/components/input-amount/src/parsers.js +0 -3
- package/components/input-amount/test/formatters.test.js +24 -16
- package/components/input-amount/test/lion-input-amount-integrations.test.js +0 -4
- package/components/input-amount/test/lion-input-amount.test.js +123 -147
- package/components/input-amount/test/parsers.test.js +33 -17
- package/components/input-amount/test/preprocessors.test.js +0 -3
- package/components/input-amount-dropdown/src/LionInputAmountDropdown.js +49 -59
- package/components/input-amount-dropdown/src/currencyUtil.js +8 -7
- package/components/input-amount-dropdown/src/parsers.js +0 -1
- package/components/input-amount-dropdown/src/validators.js +0 -1
- package/components/input-amount-dropdown/test/LionInputAmountDropdown.test.js +34 -36
- package/components/input-amount-dropdown/test/lion-input-amount-dropdown-integrations.test.js +18 -13
- package/components/input-amount-dropdown/test-helpers/mimicUserChangingDropdown.js +5 -1
- package/components/input-amount-dropdown/test-suites/LionInputAmountDropdown.suite.js +132 -107
- package/components/input-date/src/LionInputDate.js +4 -3
- package/components/input-date/test/lion-input-date-integrations.test.js +0 -3
- package/components/input-date/test/lion-input-date.test.js +19 -32
- package/components/input-datepicker/src/LionInputDatepicker.js +17 -29
- package/components/input-datepicker/src/localizeNamespaceLoader.js +1 -2
- package/components/input-datepicker/test/lion-input-datepicker-integrations.test.js +0 -3
- package/components/input-datepicker/test/lion-input-datepicker.test.js +88 -153
- package/components/input-datepicker/test-helpers/DatepickerInputObject.js +9 -12
- package/components/input-datepicker/test-suites/LionInputDatepicker.suite.js +6 -4
- package/components/input-datepicker/translations/bg-BG.js +0 -1
- package/components/input-datepicker/translations/cs-CZ.js +0 -1
- package/components/input-datepicker/translations/de-DE.js +0 -1
- package/components/input-datepicker/translations/en-AU.js +0 -1
- package/components/input-datepicker/translations/en-GB.js +0 -1
- package/components/input-datepicker/translations/en-US.js +0 -1
- package/components/input-datepicker/translations/es-ES.js +0 -1
- package/components/input-datepicker/translations/fr-BE.js +0 -1
- package/components/input-datepicker/translations/fr-FR.js +0 -1
- package/components/input-datepicker/translations/hu-HU.js +0 -1
- package/components/input-datepicker/translations/it-IT.js +0 -1
- package/components/input-datepicker/translations/nl-BE.js +0 -1
- package/components/input-datepicker/translations/nl-NL.js +0 -1
- package/components/input-datepicker/translations/pl-PL.js +0 -1
- package/components/input-datepicker/translations/ro-RO.js +0 -1
- package/components/input-datepicker/translations/ru-RU.js +0 -1
- package/components/input-datepicker/translations/sk-SK.js +0 -1
- package/components/input-datepicker/translations/tr-TR.js +0 -1
- package/components/input-datepicker/translations/uk-UA.js +0 -1
- package/components/input-email/test/lion-input-email-integrations.test.js +0 -2
- package/components/input-email/test/lion-input-email.test.js +1 -7
- package/components/input-file/src/FileHandle.js +0 -3
- package/components/input-file/src/LionInputFile.js +85 -83
- package/components/input-file/src/LionSelectedFileList.js +12 -12
- package/components/input-file/src/validators.js +10 -9
- package/components/input-file/test/FileValidators.test.js +170 -80
- package/components/input-file/test/lion-input-file.test.js +160 -244
- package/components/input-file/test/lion-selected-file-list.test.js +13 -22
- package/components/input-file/translations/bg-BG.js +0 -1
- package/components/input-file/translations/cs-CZ.js +0 -1
- package/components/input-file/translations/de-DE.js +0 -1
- package/components/input-file/translations/en-AU.js +0 -1
- package/components/input-file/translations/en-GB.js +0 -1
- package/components/input-file/translations/en-PH.js +0 -1
- package/components/input-file/translations/en-US.js +0 -1
- package/components/input-file/translations/en.js +2 -1
- package/components/input-file/translations/es-ES.js +0 -1
- package/components/input-file/translations/fr-BE.js +0 -1
- package/components/input-file/translations/fr-FR.js +0 -1
- package/components/input-file/translations/hu-HU.js +0 -1
- package/components/input-file/translations/id-ID.js +0 -1
- package/components/input-file/translations/id.js +2 -1
- package/components/input-file/translations/it-IT.js +0 -1
- package/components/input-file/translations/nl-BE.js +0 -1
- package/components/input-file/translations/nl-NL.js +0 -1
- package/components/input-file/translations/pl-PL.js +0 -1
- package/components/input-file/translations/ro-RO.js +0 -1
- package/components/input-file/translations/ru-RU.js +0 -1
- package/components/input-file/translations/sk-SK.js +0 -1
- package/components/input-file/translations/uk-UA.js +0 -1
- package/components/input-file/translations/zh-CN.js +0 -1
- package/components/input-iban/src/validators.js +6 -11
- package/components/input-iban/test/formatters.test.js +0 -3
- package/components/input-iban/test/lion-input-iban-integrations.test.js +0 -2
- package/components/input-iban/test/lion-input-iban.test.js +1 -9
- package/components/input-iban/test/parsers.test.js +0 -2
- package/components/input-iban/test/validators.test.js +0 -12
- package/components/input-iban/translations/bg-BG.js +0 -1
- package/components/input-iban/translations/cs-CZ.js +0 -1
- package/components/input-iban/translations/de-DE.js +0 -1
- package/components/input-iban/translations/en-AU.js +0 -1
- package/components/input-iban/translations/en-GB.js +0 -1
- package/components/input-iban/translations/en-US.js +0 -1
- package/components/input-iban/translations/es-ES.js +0 -1
- package/components/input-iban/translations/fr-BE.js +0 -1
- package/components/input-iban/translations/fr-FR.js +0 -1
- package/components/input-iban/translations/hu-HU.js +0 -1
- package/components/input-iban/translations/it-IT.js +0 -1
- package/components/input-iban/translations/nl-BE.js +0 -1
- package/components/input-iban/translations/nl-NL.js +0 -1
- package/components/input-iban/translations/pl-PL.js +0 -1
- package/components/input-iban/translations/ro-RO.js +0 -1
- package/components/input-iban/translations/ru-RU.js +0 -1
- package/components/input-iban/translations/sk-SK.js +0 -1
- package/components/input-iban/translations/uk-UA.js +0 -1
- package/components/input-range/src/LionInputRange.js +18 -19
- package/components/input-range/test/lion-input-range.test.js +23 -48
- package/components/input-range/translations/bg-BG.js +0 -1
- package/components/input-range/translations/cs-CZ.js +0 -1
- package/components/input-range/translations/de-DE.js +0 -1
- package/components/input-range/translations/en-AU.js +0 -1
- package/components/input-range/translations/en-GB.js +0 -1
- package/components/input-range/translations/en-PH.js +0 -1
- package/components/input-range/translations/en-US.js +0 -1
- package/components/input-range/translations/es-ES.js +0 -1
- package/components/input-range/translations/fr-BE.js +0 -1
- package/components/input-range/translations/fr-FR.js +0 -1
- package/components/input-range/translations/hu-HU.js +0 -1
- package/components/input-range/translations/it-IT.js +0 -1
- package/components/input-range/translations/nl-BE.js +0 -1
- package/components/input-range/translations/nl-NL.js +0 -1
- package/components/input-range/translations/pl-PL.js +0 -1
- package/components/input-range/translations/ro-RO.js +0 -1
- package/components/input-range/translations/ru-RU.js +0 -1
- package/components/input-range/translations/sk-SK.js +0 -1
- package/components/input-range/translations/uk-UA.js +0 -1
- package/components/input-range/translations/zh-CN.js +0 -1
- package/components/input-stepper/src/LionInputStepper.js +19 -38
- package/components/input-stepper/test/lion-input-stepper-integrations.test.js +0 -1
- package/components/input-stepper/test/lion-input-stepper.test.js +0 -1
- package/components/input-stepper/test-suites/lion-input-stepper.integration.suite.js +0 -2
- package/components/input-stepper/test-suites/lion-input-stepper.suite.js +56 -105
- package/components/input-stepper/translations/bg-BG.js +0 -1
- package/components/input-stepper/translations/cs-CZ.js +0 -1
- package/components/input-stepper/translations/de-DE.js +0 -1
- package/components/input-stepper/translations/en-AU.js +0 -1
- package/components/input-stepper/translations/en-GB.js +0 -1
- package/components/input-stepper/translations/en-US.js +0 -1
- package/components/input-stepper/translations/es-ES.js +0 -1
- package/components/input-stepper/translations/fr-BE.js +0 -1
- package/components/input-stepper/translations/fr-FR.js +0 -1
- package/components/input-stepper/translations/hu-HU.js +0 -1
- package/components/input-stepper/translations/it-IT.js +0 -1
- package/components/input-stepper/translations/nl-BE.js +0 -1
- package/components/input-stepper/translations/nl-NL.js +0 -1
- package/components/input-stepper/translations/pl-PL.js +0 -1
- package/components/input-stepper/translations/ro-RO.js +0 -1
- package/components/input-stepper/translations/ru-RU.js +0 -1
- package/components/input-stepper/translations/sk-SK.js +0 -1
- package/components/input-stepper/translations/uk-UA.js +0 -1
- package/components/input-tel/src/LionInputTel.js +53 -37
- package/components/input-tel/src/PhoneUtilManager.js +6 -4
- package/components/input-tel/src/formatters.js +12 -10
- package/components/input-tel/src/parsers.js +3 -3
- package/components/input-tel/src/preprocessors.js +15 -7
- package/components/input-tel/src/validators.js +4 -6
- package/components/input-tel/test/LionInputTel.test.js +4 -2
- package/components/input-tel/test/formatters.test.js +22 -10
- package/components/input-tel/test/parsers.test.js +127 -11
- package/components/input-tel/test/preprocessors.test.js +24 -13
- package/components/input-tel/test/validators.test.js +7 -14
- package/components/input-tel/test-helpers/mockPhoneUtilManager.js +20 -8
- package/components/input-tel/test-suites/LionInputTel.suite.js +33 -73
- package/components/input-tel/translations/bg-BG.js +0 -1
- package/components/input-tel/translations/cs-CZ.js +0 -1
- package/components/input-tel/translations/de-DE.js +0 -1
- package/components/input-tel/translations/en-AU.js +0 -1
- package/components/input-tel/translations/en-GB.js +0 -1
- package/components/input-tel/translations/en-US.js +0 -1
- package/components/input-tel/translations/es-ES.js +0 -1
- package/components/input-tel/translations/fr-BE.js +0 -1
- package/components/input-tel/translations/fr-FR.js +0 -1
- package/components/input-tel/translations/hu-HU.js +0 -1
- package/components/input-tel/translations/it-IT.js +0 -1
- package/components/input-tel/translations/nl-BE.js +0 -1
- package/components/input-tel/translations/nl-NL.js +0 -1
- package/components/input-tel/translations/pl-PL.js +0 -1
- package/components/input-tel/translations/ro-RO.js +0 -1
- package/components/input-tel/translations/ru-RU.js +0 -1
- package/components/input-tel/translations/sk-SK.js +0 -1
- package/components/input-tel/translations/uk-UA.js +0 -1
- package/components/input-tel-dropdown/src/LionInputTelDropdown.js +10 -28
- package/components/input-tel-dropdown/src/regionCodeToLocale.js +3 -1
- package/components/input-tel-dropdown/test/LionInputTelDropdown.test.js +31 -38
- package/components/input-tel-dropdown/test/regionCodeToLocale.test.js +0 -1
- package/components/input-tel-dropdown/test-helpers/mimicUserChangingDropdown.js +5 -1
- package/components/input-tel-dropdown/test-suites/LionInputTelDropdown--parentheses.suite.js +16 -11
- package/components/input-tel-dropdown/test-suites/LionInputTelDropdown.suite.js +54 -79
- package/components/listbox/src/LionListbox.js +5 -2
- package/components/listbox/src/LionOption.js +8 -7
- package/components/listbox/src/LionOptions.js +0 -3
- package/components/listbox/src/ListboxMixin.js +786 -820
- package/components/listbox/test/lion-listbox.test.js +0 -1
- package/components/listbox/test/lion-option.test.js +53 -64
- package/components/listbox/test/lion-options.test.js +3 -4
- package/components/listbox/test-helpers/getListboxMembers.js +6 -3
- package/components/listbox/test-suites/ListboxMixin.suite.js +101 -261
- package/components/localize/src/LocalizeManager.js +40 -40
- package/components/localize/src/LocalizeMixin.js +130 -157
- package/components/localize/src/date/formatDate.js +1 -5
- package/components/localize/src/date/getDateFormatBasedOnLocale.js +5 -3
- package/components/localize/src/date/getMonthNames.js +3 -5
- package/components/localize/src/date/getWeekdayNames.js +1 -5
- package/components/localize/src/date/parseDate.js +5 -20
- package/components/localize/src/date/utils/normalizeIntlDate.js +0 -7
- package/components/localize/src/getLocalizeManager.js +0 -3
- package/components/localize/src/number/formatNumber.js +3 -7
- package/components/localize/src/number/formatNumberToParts.js +52 -18
- package/components/localize/src/number/getCurrencyName.js +5 -5
- package/components/localize/src/number/getFractionDigits.js +4 -4
- package/components/localize/src/number/getSeparatorsFromNumber.js +1 -3
- package/components/localize/src/number/parseNumber.js +0 -3
- package/components/localize/src/number/utils/normalize-format-number-to-parts/forceAddGroupSeparators.js +0 -1
- package/components/localize/src/number/utils/normalize-format-number-to-parts/forceSpaceBetweenCurrencyCodeAndNumber.js +4 -1
- package/components/localize/test/LocalizeManager.test.js +385 -278
- package/components/localize/test/LocalizeMixin.test.js +28 -112
- package/components/localize/test/date/formatDate.test.js +18 -48
- package/components/localize/test/date/getDateFormatBasedOnLocale.test.js +0 -3
- package/components/localize/test/date/getMonthNames.test.js +27 -12
- package/components/localize/test/date/getWeekdayNames.test.js +93 -49
- package/components/localize/test/date/normalizeDateTime.test.js +0 -2
- package/components/localize/test/date/parseDate.test.js +12 -16
- package/components/localize/test/getLocalizeManager.test.js +0 -3
- package/components/localize/test/isLocalizeESModule.test.js +32 -13
- package/components/localize/test/localize.test.js +0 -4
- package/components/localize/test/number/formatNumber.test.js +215 -106
- package/components/localize/test/number/formatNumberToParts.test.js +31 -38
- package/components/localize/test/number/getCurrencyName.test.js +20 -6
- package/components/localize/test/number/getDecimalSeparator.test.js +5 -4
- package/components/localize/test/number/getFractionDigits.test.js +0 -2
- package/components/localize/test/number/getGroupSeparator.test.js +0 -2
- package/components/localize/test/number/getSeparatorsFromNumber.test.js +5 -3
- package/components/localize/test/number/parseNumber.test.js +123 -56
- package/components/localize/test/side-effect-free-entrypoint.test.js +0 -6
- package/components/localize/test-helpers/fake-imports.js +11 -6
- package/components/localize/test-helpers/localizeTearDown.js +0 -1
- package/components/menu/src/InteractiveListMixin.js +637 -638
- package/components/menu/src/LionMenu.js +46 -59
- package/components/menu/src/MoreButtonMenuMixin.js +215 -238
- package/components/menu/src/MultiLevelListMixin.js +240 -246
- package/components/menu/src/utils/isInView.js +0 -1
- package/components/menu/src/utils/listItemInteractions.js +4 -4
- package/components/menu/test/InteractiveListMixin.test.js +0 -1
- package/components/menu/test/MoreButtonMenuMixin.test.js +3 -2
- package/components/menu/test/MultiLevelListMixin.test.js +0 -1
- package/components/menu/test/lion-menu-interactions.test.js +0 -1
- package/components/menu/test/lion-menu.test.js +6 -2
- package/components/menu/test-helpers/mimicKeyPress.js +12 -2
- package/components/menu/test-suites/InteractiveListMixin.suite.js +4 -43
- package/components/menu/test-suites/LionMenu.suite.js +1 -8
- package/components/menu/test-suites/LionMenuInteractions.suite.js +22 -44
- package/components/menu/test-suites/MoreButtonMenuMixin.suite.js +34 -41
- package/components/menu/test-suites/MultiLevelListMixin.suite.js +5 -23
- package/components/overlays/src/ArrowMixin.js +111 -127
- package/components/overlays/src/OverlayController.js +172 -152
- package/components/overlays/src/OverlayMixin.js +64 -69
- package/components/overlays/src/OverlaysManager.js +30 -32
- package/components/overlays/src/configurations/visibility-trigger-partials/withClickInteraction.js +0 -1
- package/components/overlays/src/configurations/visibility-trigger-partials/withHoverInteraction.js +11 -11
- package/components/overlays/src/configurations/withBottomSheetConfig.js +12 -13
- package/components/overlays/src/configurations/withDropdownConfig.js +4 -2
- package/components/overlays/src/configurations/withModalDialogConfig.js +12 -13
- package/components/overlays/src/configurations/withPopoverConfig.js +27 -25
- package/components/overlays/src/configurations/withTooltipConfig.js +15 -13
- package/components/overlays/src/overlayDocumentStyle.js +1 -1
- package/components/overlays/src/overlayShadowDomStyle.js +0 -1
- package/components/overlays/src/singleton.js +0 -2
- package/components/overlays/src/utils/adopt-styles.js +18 -18
- package/components/overlays/src/utils/deep-contains.js +7 -6
- package/components/overlays/src/utils/get-focusable-elements.js +7 -10
- package/components/overlays/src/utils/inert-siblings.js +2 -4
- package/components/overlays/src/utils/is-equal-config.js +2 -3
- package/components/overlays/src/utils/is-visible.js +0 -1
- package/components/overlays/src/utils/simulate-tab.js +1 -4
- package/components/overlays/src/utils/sort-by-tabindex.js +2 -4
- package/components/overlays/test/ArrowMixin.test.js +18 -30
- package/components/overlays/test/OverlayController.test.js +406 -555
- package/components/overlays/test/OverlayMixin.test.js +0 -2
- package/components/overlays/test/OverlaysManager.test.js +30 -35
- package/components/overlays/test/global-positioning.test.js +6 -10
- package/components/overlays/test/invoker-compatibility.test.js +37 -0
- package/components/overlays/test/local-positioning.test.js +101 -103
- package/components/overlays/test/utils-tests/active-element.test.js +12 -27
- package/components/overlays/test/utils-tests/adopt-styles.test.js +25 -56
- package/components/overlays/test/utils-tests/deep-contains.test.js +73 -74
- package/components/overlays/test/utils-tests/get-focusable-elements.test.js +6 -23
- package/components/overlays/test/utils-tests/is-equal-config.test.js +32 -13
- package/components/overlays/test/utils-tests/visibility.test.js +44 -79
- package/components/overlays/test-helpers/createShadowHost.js +5 -3
- package/components/overlays/test-helpers/normalizeTransformStyle.js +2 -4
- package/components/overlays/test-suites/OverlayMixin.suite.js +152 -181
- package/components/overlays/test-suites/WithHoverInteraction.suite.js +96 -79
- package/components/overlays/translations/bg-BG.js +0 -1
- package/components/overlays/translations/cs-CZ.js +0 -1
- package/components/overlays/translations/de-DE.js +0 -1
- package/components/overlays/translations/en-AU.js +0 -1
- package/components/overlays/translations/en-GB.js +0 -1
- package/components/overlays/translations/en-US.js +0 -1
- package/components/overlays/translations/es-ES.js +0 -1
- package/components/overlays/translations/fr-BE.js +0 -1
- package/components/overlays/translations/fr-FR.js +0 -1
- package/components/overlays/translations/hu-HU.js +0 -1
- package/components/overlays/translations/it-IT.js +0 -1
- package/components/overlays/translations/nl-BE.js +0 -1
- package/components/overlays/translations/nl-NL.js +0 -1
- package/components/overlays/translations/pl-PL.js +0 -1
- package/components/overlays/translations/ro-RO.js +0 -1
- package/components/overlays/translations/ru-RU.js +0 -1
- package/components/overlays/translations/sk-SK.js +0 -1
- package/components/overlays/translations/tr-TR.js +0 -1
- package/components/overlays/translations/uk-UA.js +0 -1
- package/components/pagination/src/LionPagination.js +9 -12
- package/components/pagination/test/lion-pagination.test.js +18 -50
- package/components/progress-indicator/src/LionProgressIndicator.js +10 -12
- package/components/progress-indicator/test/lion-progress-indicator.test.js +1 -22
- package/components/radio-group/src/LionRadioGroup.js +1 -2
- package/components/radio-group/test/lion-radio-group-integrations.test.js +0 -1
- package/components/radio-group/test/lion-radio-group.test.js +27 -27
- package/components/radio-group/test/lion-radio-integrations.test.js +3 -2
- package/components/radio-group/test/lion-radio.test.js +30 -16
- package/components/select/src/LionSelect.js +12 -13
- package/components/select/test/lion-select.test.js +7 -12
- package/components/select-rich/src/LionSelectInvoker.js +18 -11
- package/components/select-rich/src/LionSelectRich.js +22 -44
- package/components/select-rich/test/demos.screenshots-test.js +40 -9
- package/components/select-rich/test/lion-select-invoker.test.js +26 -43
- package/components/select-rich/test/lion-select-listbox-suite-integration.test.js +3 -3
- package/components/select-rich/test/lion-select-rich-dialog-integration.test.js +4 -9
- package/components/select-rich/test/lion-select-rich-interaction.test.js +116 -116
- package/components/select-rich/test/lion-select-rich-upgrade.test.js +3 -7
- package/components/select-rich/test/lion-select-rich.test.js +153 -195
- package/components/select-rich/test-helpers/getSelectRichMembers.js +4 -1
- package/components/steps/src/LionStep.js +21 -12
- package/components/steps/src/LionSteps.js +25 -25
- package/components/steps/test/lion-step.test.js +18 -25
- package/components/steps/test/lion-steps.test.js +45 -78
- package/components/switch/src/LionSwitch.js +2 -7
- package/components/switch/src/LionSwitchButton.js +5 -6
- package/components/switch/test/lion-switch-button.test.js +16 -28
- package/components/switch/test/lion-switch.test.js +17 -31
- package/components/tabs/src/LionTabs.js +25 -28
- package/components/tabs/test/lion-tabs.test.js +156 -154
- package/components/textarea/src/LionTextarea.js +4 -23
- package/components/textarea/test/lion-textarea-integrations.test.js +0 -5
- package/components/textarea/test/lion-textarea.test.js +2 -28
- package/components/tooltip/src/LionTooltip.js +6 -6
- package/components/tooltip/test/lion-tooltip.test.js +75 -102
- package/components/validate-messages/src/getLocalizedMessage.js +8 -7
- package/components/validate-messages/src/loadDefaultFeedbackMessages.js +3 -1
- package/components/validate-messages/src/loadDefaultFeedbackMessagesNoSideEffects.js +9 -5
- package/components/validate-messages/src/per-entrypoint/loadComboboxMessagesNoSideEffects.js +5 -2
- package/components/validate-messages/src/per-entrypoint/loadFormCoreMessagesNoSideEffects.js +99 -35
- package/components/validate-messages/src/per-entrypoint/loadInputTelMessagesNoSideEffects.js +4 -3
- package/components/validate-messages/test/loadDefaultFeedbackMessages.test.js +5 -3
- package/components/validate-messages/test/loadDefaultFeedbackMessagesNoSideEffects.test.js +80 -45
- package/components/validate-messages/translations/bg-BG.js +0 -1
- package/components/validate-messages/translations/cs-CZ.js +0 -1
- package/components/validate-messages/translations/de-DE.js +0 -1
- package/components/validate-messages/translations/en-AU.js +0 -1
- package/components/validate-messages/translations/en-GB.js +0 -1
- package/components/validate-messages/translations/en-PH.js +0 -1
- package/components/validate-messages/translations/en-US.js +0 -1
- package/components/validate-messages/translations/es-ES.js +0 -1
- package/components/validate-messages/translations/fr-BE.js +0 -1
- package/components/validate-messages/translations/fr-FR.js +0 -1
- package/components/validate-messages/translations/hu-HU.js +0 -1
- package/components/validate-messages/translations/it-IT.js +0 -1
- package/components/validate-messages/translations/nl-BE.js +0 -1
- package/components/validate-messages/translations/nl-NL.js +0 -1
- package/components/validate-messages/translations/pl-PL.js +0 -1
- package/components/validate-messages/translations/ro-RO.js +0 -1
- package/components/validate-messages/translations/ru-RU.js +0 -1
- package/components/validate-messages/translations/sk-SK.js +0 -1
- package/components/validate-messages/translations/tr-TR.js +0 -1
- package/components/validate-messages/translations/uk-UA.js +0 -1
- package/custom-elements.json +229 -85
- package/dist-types/components/core/src/SlotMixin.d.ts +6 -1
- package/dist-types/components/core/src/SlotMixin.d.ts.map +1 -1
- package/dist-types/components/core/types/SlotMixinTypes.d.ts +5 -1
- package/dist-types/components/core/types/SlotMixinTypes.d.ts.map +1 -1
- package/dist-types/components/form-core/src/LionField.d.ts +3 -1
- package/dist-types/components/form-core/src/LionField.d.ts.map +1 -1
- package/dist-types/components/input-tel/src/LionInputTel.d.ts +6 -6
- package/dist-types/components/input-tel/src/LionInputTel.d.ts.map +1 -1
- package/dist-types/components/input-tel/src/PhoneUtilManager.d.ts +2 -2
- package/dist-types/components/input-tel/src/PhoneUtilManager.d.ts.map +1 -1
- package/dist-types/components/input-tel/src/formatters.d.ts +2 -2
- package/dist-types/components/input-tel/src/formatters.d.ts.map +1 -1
- package/dist-types/components/input-tel/src/preprocessors.d.ts +2 -2
- package/dist-types/components/input-tel/src/preprocessors.d.ts.map +1 -1
- package/dist-types/components/input-tel/test/validators.test.d.ts +1 -1
- package/dist-types/components/input-tel/test/validators.test.d.ts.map +1 -1
- package/dist-types/components/input-tel/test-helpers/mockPhoneUtilManager.d.ts +5 -0
- package/dist-types/components/input-tel/test-helpers/mockPhoneUtilManager.d.ts.map +1 -1
- package/dist-types/components/listbox/src/LionListbox.d.ts +2 -2
- package/dist-types/components/listbox/src/LionListbox.d.ts.map +1 -1
- package/dist-types/components/listbox/src/LionOption.d.ts +5 -2
- package/dist-types/components/listbox/src/LionOption.d.ts.map +1 -1
- package/dist-types/components/overlays/src/OverlayController.d.ts +3 -1
- package/dist-types/components/overlays/src/OverlayController.d.ts.map +1 -1
- package/dist-types/components/overlays/src/OverlayMixin.d.ts.map +1 -1
- package/dist-types/components/overlays/src/OverlaysManager.d.ts.map +1 -1
- package/dist-types/components/overlays/src/overlayDocumentStyle.d.ts.map +1 -1
- package/dist-types/components/overlays/test/invoker-compatibility.test.d.ts +3 -0
- package/dist-types/components/overlays/test/invoker-compatibility.test.d.ts.map +1 -0
- package/dist-types/components/select-rich/src/LionSelectInvoker.d.ts +3 -1
- package/dist-types/components/select-rich/src/LionSelectInvoker.d.ts.map +1 -1
- package/dist-types/components/select-rich/src/LionSelectRich.d.ts +6 -5
- package/dist-types/components/select-rich/src/LionSelectRich.d.ts.map +1 -1
- package/dist-types/tsconfig.tsbuildinfo +1 -1
- package/docs/components/accordion/overview.md +2 -2
- package/docs/components/accordion/reference.md +2 -2
- package/docs/components/accordion/use-cases.md +2 -2
- package/docs/components/button/examples.md +2 -2
- package/docs/components/button/extensions.md +2 -2
- package/docs/components/button/overview.md +2 -2
- package/docs/components/button/use-cases.md +2 -2
- package/docs/components/calendar/overview.md +2 -2
- package/docs/components/calendar/use-cases.md +2 -2
- package/docs/components/checkbox-group/overview.md +4 -4
- package/docs/components/checkbox-group/use-cases.md +2 -2
- package/docs/components/collapsible/examples.md +2 -2
- package/docs/components/collapsible/overview.md +3 -3
- package/docs/components/collapsible/use-cases.md +2 -2
- package/docs/components/combobox/api-table.md +1 -1
- package/docs/components/combobox/extensions.md +2 -2
- package/docs/components/combobox/overview.md +3 -3
- package/docs/components/combobox/use-cases.md +3 -3
- package/docs/components/dialog/overview.md +3 -3
- package/docs/components/dialog/use-cases.md +2 -2
- package/docs/components/drawer/overview.md +2 -2
- package/docs/components/drawer/use-cases.md +2 -2
- package/docs/components/fieldset/overview.md +7 -7
- package/docs/components/fieldset/use-cases.md +2 -2
- package/docs/components/form/overview.md +5 -5
- package/docs/components/form/use-cases.md +4 -4
- package/docs/components/icon/overview.md +2 -2
- package/docs/components/icon/use-cases.md +3 -3
- package/docs/components/input/overview.md +3 -3
- package/docs/components/input/use-cases.md +2 -2
- package/docs/components/input-amount/overview.md +5 -5
- package/docs/components/input-amount/use-cases.md +2 -2
- package/docs/components/input-amount-dropdown/use-cases.md +2 -2
- package/docs/components/input-date/overview.md +5 -5
- package/docs/components/input-date/use-cases.md +2 -2
- package/docs/components/input-datepicker/overview.md +7 -7
- package/docs/components/input-datepicker/use-cases.md +2 -2
- package/docs/components/input-email/overview.md +4 -4
- package/docs/components/input-email/use-cases.md +2 -2
- package/docs/components/input-file/overview.md +3 -3
- package/docs/components/input-file/use-cases.md +2 -2
- package/docs/components/input-iban/overview.md +4 -4
- package/docs/components/input-iban/use-cases.md +2 -2
- package/docs/components/input-range/overview.md +4 -4
- package/docs/components/input-range/use-cases.md +2 -2
- package/docs/components/input-stepper/overview.md +3 -3
- package/docs/components/input-stepper/use-cases.md +2 -2
- package/docs/components/input-tel/overview.md +3 -3
- package/docs/components/input-tel/use-cases.md +8 -8
- package/docs/components/input-tel-dropdown/extensions.md +2 -2
- package/docs/components/input-tel-dropdown/overview.md +3 -3
- package/docs/components/input-tel-dropdown/use-cases.md +2 -2
- package/docs/components/listbox/api-table.md +4 -4
- package/docs/components/listbox/overview.md +2 -2
- package/docs/components/listbox/use-cases.md +3 -3
- package/docs/components/menu/extensions.md +2 -2
- package/docs/components/menu/migration.md +2 -2
- package/docs/components/menu/overview.md +2 -2
- package/docs/components/menu/use-cases.md +1 -1
- package/docs/components/pagination/overview.md +2 -2
- package/docs/components/pagination/use-cases.md +2 -2
- package/docs/components/progress-indicator/examples.md +2 -2
- package/docs/components/progress-indicator/overview.md +2 -2
- package/docs/components/radio-group/overview.md +5 -5
- package/docs/components/radio-group/use-cases.md +2 -2
- package/docs/components/select/overview.md +2 -2
- package/docs/components/select/use-cases.md +3 -3
- package/docs/components/select-rich/api-table.md +1 -1
- package/docs/components/select-rich/examples.md +2 -2
- package/docs/components/select-rich/overview.md +2 -2
- package/docs/components/select-rich/use-cases.md +4 -4
- package/docs/components/steps/overview.md +2 -2
- package/docs/components/steps/use-cases.md +2 -2
- package/docs/components/switch/overview.md +2 -2
- package/docs/components/switch/reference.md +2 -2
- package/docs/components/switch/use-cases.md +2 -2
- package/docs/components/tabs/examples.md +3 -3
- package/docs/components/tabs/overview.md +2 -2
- package/docs/components/tabs/use-cases.md +2 -2
- package/docs/components/textarea/overview.md +2 -2
- package/docs/components/textarea/use-cases.md +2 -2
- package/docs/components/tooltip/examples.md +2 -2
- package/docs/components/tooltip/overview.md +2 -2
- package/docs/components/tooltip/use-cases.md +2 -2
- package/docs/fundamentals/index.md +4 -4
- package/docs/fundamentals/node-tools/babel-plugin-extend-docs/index.md +2 -2
- package/docs/fundamentals/node-tools/babel-plugin-extend-docs/overview.md +2 -2
- package/docs/fundamentals/node-tools/providence-analytics/index.md +2 -2
- package/docs/fundamentals/node-tools/providence-analytics/overview.md +2 -2
- package/docs/fundamentals/node-tools/publish-docs/index.md +2 -2
- package/docs/fundamentals/node-tools/publish-docs/overview.md +5 -5
- package/docs/fundamentals/node-tools/remark-extend/index.md +2 -2
- package/docs/fundamentals/node-tools/remark-extend/overview.md +2 -2
- package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/index.md +2 -2
- package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md +4 -4
- package/docs/fundamentals/rationales/TypeScript.md +62 -2
- package/docs/fundamentals/rationales/accessibility.md +5 -5
- package/docs/fundamentals/rationales/side-effects.md +2 -2
- package/docs/fundamentals/rationales/versioning.md +2 -2
- package/docs/fundamentals/systems/core/SlotMixin.md +3 -3
- package/docs/fundamentals/systems/core/index.md +2 -2
- package/docs/fundamentals/systems/core/overview.md +3 -3
- package/docs/fundamentals/systems/form/formatting-and-parsing.md +6 -6
- package/docs/fundamentals/systems/form/index.md +2 -2
- package/docs/fundamentals/systems/form/interaction-states.md +2 -2
- package/docs/fundamentals/systems/form/model-value.md +3 -3
- package/docs/fundamentals/systems/form/overview.md +30 -30
- package/docs/fundamentals/systems/form/styling.md +2 -2
- package/docs/fundamentals/systems/form/use-cases.md +2 -2
- package/docs/fundamentals/systems/form/validate.md +4 -4
- package/docs/fundamentals/systems/icon/index.md +2 -2
- package/docs/fundamentals/systems/icon/overview.md +2 -2
- package/docs/fundamentals/systems/localize/dates.md +2 -2
- package/docs/fundamentals/systems/localize/index.md +2 -2
- package/docs/fundamentals/systems/localize/numbers.md +2 -2
- package/docs/fundamentals/systems/localize/overview.md +6 -6
- package/docs/fundamentals/systems/localize/rationale.md +2 -2
- package/docs/fundamentals/systems/localize/text.md +2 -2
- package/docs/fundamentals/systems/localize/use-cases.md +2 -2
- package/docs/fundamentals/systems/overlays/_edge-cases.md +2 -2
- package/docs/fundamentals/systems/overlays/api-table.md +1 -1
- package/docs/fundamentals/systems/overlays/configuration.md +4 -4
- package/docs/fundamentals/systems/overlays/index.md +2 -2
- package/docs/fundamentals/systems/overlays/overview.md +7 -7
- package/docs/fundamentals/systems/overlays/rationale.md +2 -2
- package/docs/fundamentals/systems/overlays/use-cases.md +4 -4
- package/docs/fundamentals/tools/ajax/index.md +2 -2
- package/docs/fundamentals/tools/ajax/overview.md +2 -2
- package/docs/fundamentals/tools/ajax/use-cases.md +2 -2
- package/docs/fundamentals/tools/helpers/action-logger.md +2 -2
- package/docs/fundamentals/tools/helpers/index.md +2 -2
- package/docs/fundamentals/tools/helpers/overview.md +3 -3
- package/docs/fundamentals/tools/singleton-manager/example-complex/index.md +2 -2
- package/docs/fundamentals/tools/singleton-manager/example-fail/index.md +2 -2
- package/docs/fundamentals/tools/singleton-manager/example-success/index.md +2 -2
- package/docs/fundamentals/tools/singleton-manager/index.md +2 -2
- package/docs/fundamentals/tools/singleton-manager/overview.md +6 -6
- package/docs/guides/how-to/create-a-custom-field.md +7 -7
- package/docs/guides/how-to/create-a-form.md +6 -6
- package/docs/guides/how-to/extend-a-native-input.md +4 -4
- package/docs/guides/how-to/get-started.md +2 -2
- package/docs/guides/how-to/index.md +1 -1
- package/docs/guides/index.md +8 -8
- package/docs/guides/principles/definitions-and-terms.md +2 -2
- package/docs/guides/principles/index.md +5 -5
- package/docs/guides/principles/scoped-elements.md +2 -2
- package/docs/guides/principles/styling.md +3 -3
- package/docs/guides/principles/subclasser-apis.md +2 -2
- package/exports/define/lion-accordion.js +0 -1
- package/exports/define/lion-button-reset.js +0 -1
- package/exports/define/lion-button-submit.js +0 -1
- package/exports/define/lion-button.js +0 -1
- package/exports/define/lion-calendar.js +0 -1
- package/exports/define/lion-checkbox-group.js +0 -1
- package/exports/define/lion-checkbox-indeterminate.js +0 -1
- package/exports/define/lion-checkbox.js +0 -1
- package/exports/define/lion-collapsible.js +0 -1
- package/exports/define/lion-combobox.js +0 -1
- package/exports/define/lion-dialog.js +0 -1
- package/exports/define/lion-drawer.js +0 -1
- package/exports/define/lion-field.js +0 -1
- package/exports/define/lion-fieldset.js +0 -1
- package/exports/define/lion-form.js +0 -1
- package/exports/define/lion-icon.js +0 -1
- package/exports/define/lion-input-amount-dropdown.js +0 -1
- package/exports/define/lion-input-amount.js +0 -1
- package/exports/define/lion-input-date.js +0 -1
- package/exports/define/lion-input-datepicker.js +0 -1
- package/exports/define/lion-input-email.js +0 -1
- package/exports/define/lion-input-file.js +0 -1
- package/exports/define/lion-input-iban.js +0 -1
- package/exports/define/lion-input-range.js +0 -1
- package/exports/define/lion-input-stepper.js +0 -1
- package/exports/define/lion-input-tel-dropdown.js +0 -1
- package/exports/define/lion-input-tel.js +0 -1
- package/exports/define/lion-input.js +0 -1
- package/exports/define/lion-item.js +0 -1
- package/exports/define/lion-listbox.js +0 -1
- package/exports/define/lion-menu.js +0 -1
- package/exports/define/lion-menuitem.js +0 -1
- package/exports/define/lion-option.js +0 -1
- package/exports/define/lion-options.js +0 -1
- package/exports/define/lion-pagination.js +0 -1
- package/exports/define/lion-progress-indicator.js +0 -1
- package/exports/define/lion-radio-group.js +0 -1
- package/exports/define/lion-radio.js +0 -1
- package/exports/define/lion-select-invoker.js +0 -1
- package/exports/define/lion-select-rich.js +0 -1
- package/exports/define/lion-select.js +0 -1
- package/exports/define/lion-selected-file-list.js +0 -1
- package/exports/define/lion-step.js +0 -1
- package/exports/define/lion-steps.js +0 -1
- package/exports/define/lion-switch-button.js +0 -1
- package/exports/define/lion-switch.js +0 -1
- package/exports/define/lion-tabs.js +0 -1
- package/exports/define/lion-textarea.js +0 -1
- package/exports/define/lion-tooltip.js +0 -1
- package/exports/define/lion-validation-feedback.js +0 -1
- package/exports/define-helpers/sb-action-logger.js +0 -1
- package/exports/define-helpers/sb-locale-switcher.js +0 -1
- package/exports/form-core.js +0 -8
- package/exports/localize-no-side-effects.js +0 -1
- package/exports/localize.js +0 -2
- package/exports/overlays.js +0 -4
- package/generated/awesome-phonenumber/LICENSE +22 -0
- package/generated/awesome-phonenumber/LICENSE.closure-library +176 -0
- package/generated/awesome-phonenumber/LICENSE.libphonenumber +176 -0
- package/generated/awesome-phonenumber/checksums.json +6 -0
- package/generated/awesome-phonenumber/index-esm.mjs +817 -0
- package/generated/awesome-phonenumber/index.d.ts +227 -0
- package/generated/awesome-phonenumber/index.js +45 -0
- package/generated/awesome-phonenumber/lib/index.js +710 -0
- package/generated/awesome-phonenumber/package.json +9 -0
- package/generated/awesome-phonenumber/provenance.json +13 -0
- package/package.json +38 -15
- package/vscode.html-custom-data.json +5 -5
- package/web-types.json +1 -1
- package/vendor/README.md +0 -61
- package/vendor/awesome-phonenumber-7.9.0-tlouisse.libphonenumber-9.0.41.tgz +0 -0
|
@@ -39,42 +39,37 @@ import { moveUserProvidedDefaultSlottablesToTarget } from '../../core/src/SlotMi
|
|
|
39
39
|
* @param {import('@open-wc/dedupe-mixin').Constructor<import('lit').LitElement>} superclass
|
|
40
40
|
*/
|
|
41
41
|
// prettier-ignore
|
|
42
|
-
const ListboxMixinImplementation = /** @type {ListboxMixin} */ (superclass
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
static get styles() {
|
|
74
|
-
return [
|
|
75
|
-
// @ts-ignore [ts7-2855] TS7 rejects field access via super (the parent declares this as a field). Dot form kept deliberately: bracket access is exempt from property mangling (terser keep_quoted), which could split this property into two names. Upstream fix: declare an accessor in the parent type
|
|
76
|
-
...(super.styles || []),
|
|
77
|
-
css`
|
|
42
|
+
const ListboxMixinImplementation = /** @type {ListboxMixin} */superclass => class ListboxMixin extends FormControlMixin(ScopedElementsMixin(ChoiceGroupMixin(SlotMixin(FormRegistrarMixin(superclass))))) {
|
|
43
|
+
/** @type {any} */
|
|
44
|
+
static get properties() {
|
|
45
|
+
return {
|
|
46
|
+
// TODO: rename to `axis` with the values 'block'|'inline' (see the TODO at the top of this
|
|
47
|
+
// file); keep `orientation`/`orientation="vertical"|"horizontal"` working as a deprecated alias
|
|
48
|
+
orientation: String,
|
|
49
|
+
selectionFollowsFocus: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
attribute: 'selection-follows-focus'
|
|
52
|
+
},
|
|
53
|
+
// TODO: rename to `wrap` (see the TODO at the top of this file); keep the old property and
|
|
54
|
+
// attribute working as a deprecated alias
|
|
55
|
+
rotateKeyboardNavigation: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
attribute: 'rotate-keyboard-navigation'
|
|
58
|
+
},
|
|
59
|
+
hasNoDefaultSelected: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
reflect: true,
|
|
62
|
+
attribute: 'has-no-default-selected'
|
|
63
|
+
},
|
|
64
|
+
_noTypeAhead: {
|
|
65
|
+
type: Boolean
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
static get styles() {
|
|
70
|
+
return [
|
|
71
|
+
// @ts-ignore [ts7-2855] TS7 rejects field access via super (the parent declares this as a field). Dot form kept deliberately: bracket access is exempt from property mangling (terser keep_quoted), which could split this property into two names. Upstream fix: declare an accessor in the parent type
|
|
72
|
+
...(super.styles || []), css`
|
|
78
73
|
:host {
|
|
79
74
|
display: block;
|
|
80
75
|
}
|
|
@@ -90,493 +85,479 @@ const ListboxMixinImplementation = /** @type {ListboxMixin} */ (superclass =>
|
|
|
90
85
|
:host([orientation='horizontal']) ::slotted([role='listbox']) {
|
|
91
86
|
display: flex;
|
|
92
87
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return html`
|
|
88
|
+
`];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @override FormControlMixin
|
|
93
|
+
* @protected
|
|
94
|
+
*/
|
|
95
|
+
// eslint-disable-next-line
|
|
96
|
+
_inputGroupInputTemplate() {
|
|
97
|
+
return html`
|
|
104
98
|
<div class="input-group__input">
|
|
105
99
|
<slot name="input"></slot>
|
|
106
100
|
<slot id="options-outlet"></slot>
|
|
107
101
|
</div>
|
|
108
102
|
`;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
103
|
+
}
|
|
104
|
+
static get scopedElements() {
|
|
105
|
+
return {
|
|
106
|
+
// @ts-expect-error [external] fix types scopedElements
|
|
107
|
+
...super.scopedElements,
|
|
108
|
+
'lion-options': LionOptions
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
get slots() {
|
|
112
|
+
return {
|
|
113
|
+
...super.slots,
|
|
114
|
+
input: () => {
|
|
115
|
+
const lionOptions = /** @type {import('./LionOptions.js').LionOptions} */
|
|
116
|
+
this.createScopedElement('lion-options');
|
|
117
|
+
lionOptions.setAttribute('data-tag-name', 'lion-options');
|
|
118
|
+
lionOptions.registrationTarget = this;
|
|
119
|
+
return lionOptions;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @configure FormControlMixin
|
|
126
|
+
*/
|
|
127
|
+
get _inputNode() {
|
|
128
|
+
return /** @type {HTMLElementWithValue} */this.querySelector('[slot="input"]');
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* @overridable
|
|
133
|
+
*/
|
|
134
|
+
get _listboxNode() {
|
|
135
|
+
// Cast to unknown first, since HTMLElementWithValue is not compatible with LionOptions
|
|
136
|
+
return /** @type {LionOptions} */ /** @type {unknown} */this._inputNode;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* @overridable
|
|
141
|
+
* @type {HTMLElement}
|
|
142
|
+
*/
|
|
143
|
+
get _listboxActiveDescendantNode() {
|
|
144
|
+
return /** @type {HTMLElement} */this._listboxNode.querySelector(`#${this._listboxActiveDescendant}`);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* @overridable
|
|
149
|
+
* @type {HTMLElement}
|
|
150
|
+
*/
|
|
151
|
+
get _listboxSlot() {
|
|
152
|
+
return /** @type {HTMLElement} */ /** @type {ShadowRoot} */this.shadowRoot.querySelector('slot[name=input]');
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* @overridable
|
|
157
|
+
* @type {HTMLElement}
|
|
158
|
+
*/
|
|
159
|
+
get _scrollTargetNode() {
|
|
160
|
+
return this._listboxNode;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* @overridable
|
|
165
|
+
* @type {HTMLElement}
|
|
166
|
+
*/
|
|
167
|
+
get _activeDescendantOwnerNode() {
|
|
168
|
+
return this._listboxNode;
|
|
169
|
+
}
|
|
170
|
+
get activeIndex() {
|
|
171
|
+
return this.formElements.findIndex(el => el.active === true);
|
|
172
|
+
}
|
|
173
|
+
set activeIndex(index) {
|
|
174
|
+
if (this.formElements[index]) {
|
|
175
|
+
const el = this.formElements[index];
|
|
176
|
+
this.__setChildActive(el);
|
|
177
|
+
} else {
|
|
178
|
+
this.__setChildActive(null);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* @type {number | number[]}
|
|
184
|
+
*/
|
|
185
|
+
get checkedIndex() {
|
|
186
|
+
const options = this.formElements;
|
|
187
|
+
if (!this.multipleChoice) {
|
|
188
|
+
return options.indexOf(options.find(o => o.checked));
|
|
189
|
+
}
|
|
190
|
+
return options.filter(o => o.checked).map(o => options.indexOf(o));
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* @deprecated
|
|
195
|
+
* This setter exists for backwards compatibility of single choice groups.
|
|
196
|
+
* A setter api would be confusing for a multipleChoice group. Use `setCheckedIndex` instead.
|
|
197
|
+
* @param {number|number[]} index
|
|
198
|
+
*/
|
|
199
|
+
set checkedIndex(index) {
|
|
200
|
+
this.setCheckedIndex(index);
|
|
201
|
+
}
|
|
202
|
+
constructor() {
|
|
203
|
+
super();
|
|
204
|
+
/**
|
|
205
|
+
* When setting this to true, on initial render, no option will be selected.
|
|
206
|
+
* It is advisable to override `_noSelectionTemplate` method in the select-invoker
|
|
207
|
+
* to render some kind of placeholder initially
|
|
208
|
+
*/
|
|
209
|
+
this.hasNoDefaultSelected = false;
|
|
210
|
+
/**
|
|
211
|
+
* Informs screen reader and affects keyboard navigation.
|
|
212
|
+
* By default 'vertical'
|
|
213
|
+
*/
|
|
214
|
+
this.orientation = 'vertical';
|
|
215
|
+
/**
|
|
216
|
+
* Will give first option active state when navigated to the next option from
|
|
217
|
+
* last option.
|
|
218
|
+
*/
|
|
219
|
+
this.rotateKeyboardNavigation = false;
|
|
220
|
+
/**
|
|
221
|
+
* When true, will synchronize activedescendant and selected element on
|
|
222
|
+
* arrow key navigation.
|
|
223
|
+
* This behavior can usually be seen on <select> on the Windows platform.
|
|
224
|
+
* Note that this behavior cannot be used when multiple-choice is true.
|
|
225
|
+
* See: https://www.w3.org/TR/wai-aria-practices/#kbd_selection_follows_focus
|
|
226
|
+
*/
|
|
227
|
+
this.selectionFollowsFocus = false;
|
|
228
|
+
/**
|
|
229
|
+
* When false, a user can type on which the focus will jump to the matching option
|
|
230
|
+
*/
|
|
231
|
+
this._noTypeAhead = false;
|
|
232
|
+
/**
|
|
233
|
+
* The pending char sequence that will set active list item
|
|
234
|
+
* @type {number}
|
|
235
|
+
* @protected
|
|
135
236
|
*/
|
|
136
|
-
|
|
137
|
-
return /** @type {HTMLElementWithValue} */ (this.querySelector('[slot="input"]'));
|
|
138
|
-
}
|
|
139
|
-
|
|
237
|
+
this._typeAheadTimeout = 1000;
|
|
140
238
|
/**
|
|
141
|
-
* @
|
|
239
|
+
* @type {number | null}
|
|
240
|
+
* @protected
|
|
142
241
|
*/
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
|
|
242
|
+
this._listboxActiveDescendant = null;
|
|
243
|
+
/** @private */
|
|
244
|
+
this.__hasInitialSelectedFormElement = false;
|
|
148
245
|
/**
|
|
149
|
-
* @
|
|
150
|
-
* @
|
|
246
|
+
* @type {'fieldset' | 'child' | 'choice-group'}
|
|
247
|
+
* @protected
|
|
151
248
|
*/
|
|
152
|
-
|
|
153
|
-
return /** @type {HTMLElement} */ (
|
|
154
|
-
this._listboxNode.querySelector(`#${this._listboxActiveDescendant}`)
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
|
|
249
|
+
this._repropagationRole = 'choice-group'; // configures FormControlMixin
|
|
158
250
|
/**
|
|
159
|
-
*
|
|
160
|
-
*
|
|
251
|
+
* When listbox is coupled to a textbox (in case we are dealing with a combobox),
|
|
252
|
+
* spaces should not select an element (they need to be put in the textbox)
|
|
253
|
+
* @protected
|
|
161
254
|
*/
|
|
162
|
-
|
|
163
|
-
return /** @type {HTMLElement} */ (
|
|
164
|
-
/** @type {ShadowRoot} */ (this.shadowRoot).querySelector('slot[name=input]')
|
|
165
|
-
);
|
|
166
|
-
}
|
|
255
|
+
this._listboxReceivesNoFocus = false;
|
|
167
256
|
|
|
168
257
|
/**
|
|
169
|
-
* @
|
|
170
|
-
* @
|
|
258
|
+
* @type {string | string[] | undefined}
|
|
259
|
+
* @protected
|
|
171
260
|
*/
|
|
172
|
-
|
|
173
|
-
return this._listboxNode;
|
|
174
|
-
}
|
|
261
|
+
this._oldModelValue = undefined;
|
|
175
262
|
|
|
176
263
|
/**
|
|
177
|
-
* @
|
|
178
|
-
* @
|
|
264
|
+
* @type {EventListener}
|
|
265
|
+
* @protected
|
|
179
266
|
*/
|
|
180
|
-
|
|
181
|
-
return this._listboxNode;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
get activeIndex() {
|
|
185
|
-
return this.formElements.findIndex(el => el.active === true);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
set activeIndex(index) {
|
|
189
|
-
if (this.formElements[index]) {
|
|
190
|
-
const el = this.formElements[index];
|
|
191
|
-
this.__setChildActive(el);
|
|
192
|
-
} else {
|
|
193
|
-
this.__setChildActive(null);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
267
|
+
this._listboxOnKeyDown = this._listboxOnKeyDown.bind(this);
|
|
197
268
|
/**
|
|
198
|
-
* @type {
|
|
269
|
+
* @type {EventListener}
|
|
270
|
+
* @protected
|
|
199
271
|
*/
|
|
200
|
-
|
|
201
|
-
const options = this.formElements;
|
|
202
|
-
if (!this.multipleChoice) {
|
|
203
|
-
return options.indexOf(options.find(o => o.checked));
|
|
204
|
-
}
|
|
205
|
-
return options.filter(o => o.checked).map(o => options.indexOf(o));
|
|
206
|
-
}
|
|
207
|
-
|
|
272
|
+
this._listboxOnClick = this._listboxOnClick.bind(this);
|
|
208
273
|
/**
|
|
209
|
-
* @
|
|
210
|
-
*
|
|
211
|
-
* A setter api would be confusing for a multipleChoice group. Use `setCheckedIndex` instead.
|
|
212
|
-
* @param {number|number[]} index
|
|
274
|
+
* @type {EventListener}
|
|
275
|
+
* @protected
|
|
213
276
|
*/
|
|
214
|
-
|
|
215
|
-
this.setCheckedIndex(index);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
constructor() {
|
|
219
|
-
super();
|
|
220
|
-
/**
|
|
221
|
-
* When setting this to true, on initial render, no option will be selected.
|
|
222
|
-
* It is advisable to override `_noSelectionTemplate` method in the select-invoker
|
|
223
|
-
* to render some kind of placeholder initially
|
|
224
|
-
*/
|
|
225
|
-
this.hasNoDefaultSelected = false;
|
|
226
|
-
/**
|
|
227
|
-
* Informs screen reader and affects keyboard navigation.
|
|
228
|
-
* By default 'vertical'
|
|
229
|
-
*/
|
|
230
|
-
this.orientation = 'vertical';
|
|
231
|
-
/**
|
|
232
|
-
* Will give first option active state when navigated to the next option from
|
|
233
|
-
* last option.
|
|
234
|
-
*/
|
|
235
|
-
this.rotateKeyboardNavigation = false;
|
|
236
|
-
/**
|
|
237
|
-
* When true, will synchronize activedescendant and selected element on
|
|
238
|
-
* arrow key navigation.
|
|
239
|
-
* This behavior can usually be seen on <select> on the Windows platform.
|
|
240
|
-
* Note that this behavior cannot be used when multiple-choice is true.
|
|
241
|
-
* See: https://www.w3.org/TR/wai-aria-practices/#kbd_selection_follows_focus
|
|
242
|
-
*/
|
|
243
|
-
this.selectionFollowsFocus = false;
|
|
244
|
-
/**
|
|
245
|
-
* When false, a user can type on which the focus will jump to the matching option
|
|
246
|
-
*/
|
|
247
|
-
this._noTypeAhead = false;
|
|
248
|
-
/**
|
|
249
|
-
* The pending char sequence that will set active list item
|
|
250
|
-
* @type {number}
|
|
251
|
-
* @protected
|
|
252
|
-
*/
|
|
253
|
-
this._typeAheadTimeout = 1000;
|
|
254
|
-
/**
|
|
255
|
-
* @type {number | null}
|
|
256
|
-
* @protected
|
|
257
|
-
*/
|
|
258
|
-
this._listboxActiveDescendant = null;
|
|
259
|
-
/** @private */
|
|
260
|
-
this.__hasInitialSelectedFormElement = false;
|
|
261
|
-
/**
|
|
262
|
-
* @type {'fieldset' | 'child' | 'choice-group'}
|
|
263
|
-
* @protected
|
|
264
|
-
*/
|
|
265
|
-
this._repropagationRole = 'choice-group'; // configures FormControlMixin
|
|
266
|
-
/**
|
|
267
|
-
* When listbox is coupled to a textbox (in case we are dealing with a combobox),
|
|
268
|
-
* spaces should not select an element (they need to be put in the textbox)
|
|
269
|
-
* @protected
|
|
270
|
-
*/
|
|
271
|
-
this._listboxReceivesNoFocus = false;
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* @type {string | string[] | undefined}
|
|
275
|
-
* @protected
|
|
276
|
-
*/
|
|
277
|
-
this._oldModelValue = undefined;
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* @type {EventListener}
|
|
281
|
-
* @protected
|
|
282
|
-
*/
|
|
283
|
-
this._listboxOnKeyDown = this._listboxOnKeyDown.bind(this);
|
|
284
|
-
/**
|
|
285
|
-
* @type {EventListener}
|
|
286
|
-
* @protected
|
|
287
|
-
*/
|
|
288
|
-
this._listboxOnClick = this._listboxOnClick.bind(this);
|
|
289
|
-
/**
|
|
290
|
-
* @type {EventListener}
|
|
291
|
-
* @protected
|
|
292
|
-
*/
|
|
293
|
-
this._listboxOnKeyUp = this._listboxOnKeyUp.bind(this);
|
|
294
|
-
/**
|
|
295
|
-
* @type {EventListener}
|
|
296
|
-
* @protected
|
|
297
|
-
*/
|
|
298
|
-
this._onChildActiveChanged = this._onChildActiveChanged.bind(this);
|
|
299
|
-
/**
|
|
300
|
-
* @type {EventListener}
|
|
301
|
-
* @private
|
|
302
|
-
*/
|
|
303
|
-
this.__proxyChildModelValueChanged = this.__proxyChildModelValueChanged.bind(this);
|
|
304
|
-
/**
|
|
305
|
-
* @type {EventListener}
|
|
306
|
-
* @private
|
|
307
|
-
*/
|
|
308
|
-
this.__preventScrollingWithArrowKeys = this.__preventScrollingWithArrowKeys.bind(this);
|
|
309
|
-
/**
|
|
310
|
-
* @type {string[]}
|
|
311
|
-
* @private
|
|
312
|
-
*/
|
|
313
|
-
this.__typedChars = [];
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
connectedCallback() {
|
|
317
|
-
if (this._listboxNode) {
|
|
318
|
-
// if there is none yet, it will be supplied via 'get slots'
|
|
319
|
-
this._listboxNode.registrationTarget = this;
|
|
320
|
-
}
|
|
321
|
-
super.connectedCallback();
|
|
322
|
-
this._setupListboxNode();
|
|
323
|
-
this.__setupEventListeners();
|
|
324
|
-
|
|
325
|
-
// TODO: should this be handled at a more generic level?
|
|
326
|
-
this.registrationComplete.then(() => {
|
|
327
|
-
this.__initInteractionStates();
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
|
|
277
|
+
this._listboxOnKeyUp = this._listboxOnKeyUp.bind(this);
|
|
331
278
|
/**
|
|
332
|
-
* @
|
|
279
|
+
* @type {EventListener}
|
|
280
|
+
* @protected
|
|
333
281
|
*/
|
|
334
|
-
|
|
335
|
-
super.firstUpdated(changedProperties);
|
|
336
|
-
this.__moveOptionsToListboxNode();
|
|
337
|
-
this.registrationComplete.then(() => {
|
|
338
|
-
/** @type {any[]} */
|
|
339
|
-
this._initialModelValue = this.modelValue;
|
|
340
|
-
});
|
|
341
|
-
|
|
342
|
-
// Every time new options are rendered from outside context, notify our parents
|
|
343
|
-
const observer = new MutationObserver(() => {
|
|
344
|
-
this._onListboxContentChanged();
|
|
345
|
-
});
|
|
346
|
-
observer.observe(this._listboxNode, { childList: true });
|
|
347
|
-
}
|
|
348
|
-
|
|
282
|
+
this._onChildActiveChanged = this._onChildActiveChanged.bind(this);
|
|
349
283
|
/**
|
|
350
|
-
* @
|
|
284
|
+
* @type {EventListener}
|
|
285
|
+
* @private
|
|
351
286
|
*/
|
|
352
|
-
|
|
353
|
-
super.updated(changedProperties);
|
|
354
|
-
|
|
355
|
-
if (changedProperties.has('disabled')) {
|
|
356
|
-
if (this.disabled) {
|
|
357
|
-
this.__requestOptionsToBeDisabled();
|
|
358
|
-
} else {
|
|
359
|
-
this.__retractRequestOptionsToBeDisabled();
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
disconnectedCallback() {
|
|
365
|
-
super.disconnectedCallback();
|
|
366
|
-
|
|
367
|
-
this._teardownListboxNode();
|
|
368
|
-
this.__teardownEventListeners();
|
|
369
|
-
}
|
|
370
|
-
|
|
287
|
+
this.__proxyChildModelValueChanged = this.__proxyChildModelValueChanged.bind(this);
|
|
371
288
|
/**
|
|
372
|
-
*
|
|
373
|
-
*
|
|
374
|
-
* For single choice, __onChildCheckedChanged we ensure that we uncheck siblings
|
|
375
|
-
* @param {number|number[]} index
|
|
289
|
+
* @type {EventListener}
|
|
290
|
+
* @private
|
|
376
291
|
*/
|
|
377
|
-
|
|
378
|
-
if (this.multipleChoice && Array.isArray(index)) {
|
|
379
|
-
this._uncheckChildren(this.formElements.filter(i => i === index));
|
|
380
|
-
index.forEach(i => {
|
|
381
|
-
if (this.formElements[i]) {
|
|
382
|
-
this.formElements[i].checked = !this.formElements[i].checked;
|
|
383
|
-
}
|
|
384
|
-
});
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
if (typeof index === 'number') {
|
|
389
|
-
if (index === -1) {
|
|
390
|
-
this._uncheckChildren();
|
|
391
|
-
}
|
|
392
|
-
if (this.formElements[index]) {
|
|
393
|
-
if (this.formElements[index].disabled) {
|
|
394
|
-
this._uncheckChildren();
|
|
395
|
-
} else if (this.multipleChoice) {
|
|
396
|
-
this.formElements[index].checked = !this.formElements[index].checked;
|
|
397
|
-
} else {
|
|
398
|
-
this.formElements[index].checked = true;
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
|
|
292
|
+
this.__preventScrollingWithArrowKeys = this.__preventScrollingWithArrowKeys.bind(this);
|
|
404
293
|
/**
|
|
405
|
-
* @
|
|
406
|
-
* @
|
|
407
|
-
* @param {Number} indexToInsertAt
|
|
294
|
+
* @type {string[]}
|
|
295
|
+
* @private
|
|
408
296
|
*/
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
297
|
+
this.__typedChars = [];
|
|
298
|
+
}
|
|
299
|
+
connectedCallback() {
|
|
300
|
+
if (this._listboxNode) {
|
|
301
|
+
// if there is none yet, it will be supplied via 'get slots'
|
|
302
|
+
this._listboxNode.registrationTarget = this;
|
|
303
|
+
}
|
|
304
|
+
super.connectedCallback();
|
|
305
|
+
this._setupListboxNode();
|
|
306
|
+
this.__setupEventListeners();
|
|
307
|
+
|
|
308
|
+
// TODO: should this be handled at a more generic level?
|
|
309
|
+
this.registrationComplete.then(() => {
|
|
310
|
+
this.__initInteractionStates();
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* @param {import('lit').PropertyValues } changedProperties
|
|
316
|
+
*/
|
|
317
|
+
firstUpdated(changedProperties) {
|
|
318
|
+
super.firstUpdated(changedProperties);
|
|
319
|
+
this.__moveOptionsToListboxNode();
|
|
320
|
+
this.registrationComplete.then(() => {
|
|
321
|
+
/** @type {any[]} */
|
|
322
|
+
this._initialModelValue = this.modelValue;
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
// Every time new options are rendered from outside context, notify our parents
|
|
326
|
+
const observer = new MutationObserver(() => {
|
|
327
|
+
this._onListboxContentChanged();
|
|
328
|
+
});
|
|
329
|
+
observer.observe(this._listboxNode, {
|
|
330
|
+
childList: true
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* @param {import('lit').PropertyValues } changedProperties
|
|
336
|
+
*/
|
|
337
|
+
updated(changedProperties) {
|
|
338
|
+
super.updated(changedProperties);
|
|
339
|
+
if (changedProperties.has('disabled')) {
|
|
415
340
|
if (this.disabled) {
|
|
416
|
-
|
|
341
|
+
this.__requestOptionsToBeDisabled();
|
|
342
|
+
} else {
|
|
343
|
+
this.__retractRequestOptionsToBeDisabled();
|
|
417
344
|
}
|
|
418
|
-
|
|
419
|
-
// TODO: small perf improvement could be made if logic below would be scheduled to next update,
|
|
420
|
-
// so it occurs once for all options
|
|
421
|
-
this.__setAttributeForAllFormElements('aria-setsize', this.formElements.length);
|
|
422
|
-
this.formElements.forEach((el, idx) => {
|
|
423
|
-
el.setAttribute('aria-posinset', idx + 1);
|
|
424
|
-
});
|
|
425
|
-
|
|
426
|
-
this.__proxyChildModelValueChanged(
|
|
427
|
-
/** @type {CustomEvent & { target: FormControlHost & LionOption; }} */ ({ target: child }),
|
|
428
|
-
);
|
|
429
|
-
this.resetInteractionState();
|
|
430
|
-
/* eslint-enable no-param-reassign */
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
resetInteractionState() {
|
|
434
|
-
super.resetInteractionState();
|
|
435
|
-
this.submitted = false;
|
|
436
345
|
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
if (code.startsWith('Key') || code.startsWith('Digit') || code.startsWith('Numpad')) {
|
|
458
|
-
ev.preventDefault();
|
|
459
|
-
this.__typedChars.push(key);
|
|
460
|
-
const chars = this.__typedChars.join('');
|
|
461
|
-
const matchedItemIndex =
|
|
462
|
-
// TODO: consider making this condition overridable for Subclassers by extracting it into protected method
|
|
463
|
-
this.formElements.findIndex(el => el.modelValue.value.toLowerCase().startsWith(chars));
|
|
464
|
-
if (matchedItemIndex >= 0) {
|
|
465
|
-
if (setAsChecked) {
|
|
466
|
-
this.setCheckedIndex(matchedItemIndex);
|
|
467
|
-
}
|
|
468
|
-
this.activeIndex = matchedItemIndex;
|
|
346
|
+
}
|
|
347
|
+
disconnectedCallback() {
|
|
348
|
+
super.disconnectedCallback();
|
|
349
|
+
this._teardownListboxNode();
|
|
350
|
+
this.__teardownEventListeners();
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* If an array is passed for multiple-choice, it will check the indexes in array, and uncheck the rest
|
|
355
|
+
* If a number is passed, the item with the passed index is checked without unchecking others
|
|
356
|
+
* For single choice, __onChildCheckedChanged we ensure that we uncheck siblings
|
|
357
|
+
* @param {number|number[]} index
|
|
358
|
+
*/
|
|
359
|
+
setCheckedIndex(index) {
|
|
360
|
+
if (this.multipleChoice && Array.isArray(index)) {
|
|
361
|
+
this._uncheckChildren(this.formElements.filter(i => i === index));
|
|
362
|
+
index.forEach(i => {
|
|
363
|
+
if (this.formElements[i]) {
|
|
364
|
+
this.formElements[i].checked = !this.formElements[i].checked;
|
|
469
365
|
}
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
// @ts-ignore
|
|
473
|
-
window.clearTimeout(this.__pendingTypeAheadTimeout);
|
|
474
|
-
}
|
|
475
|
-
this.__pendingTypeAheadTimeout = setTimeout(() => {
|
|
476
|
-
// schedule a timeout to reset __typedChars
|
|
477
|
-
this.__typedChars = [];
|
|
478
|
-
}, this._typeAheadTimeout);
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
/**
|
|
483
|
-
* @override ChoiceGroupMixin: in the select disabled options are still going to a possible
|
|
484
|
-
* value, for example when prefilling or programmatically setting it.
|
|
485
|
-
* @protected
|
|
486
|
-
*/
|
|
487
|
-
_getCheckedElements() {
|
|
488
|
-
return this.formElements.filter(el => el.checked);
|
|
366
|
+
});
|
|
367
|
+
return;
|
|
489
368
|
}
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
if (this._listboxNode) {
|
|
494
|
-
this.__setupListboxNodeInteractions();
|
|
495
|
-
} else if (this._listboxSlot) {
|
|
496
|
-
/**
|
|
497
|
-
* For ShadyDom the listboxNode is available right from the start so we can add those events
|
|
498
|
-
* immediately.
|
|
499
|
-
* For native ShadowDom the select gets rendered before the listboxNode is available so we
|
|
500
|
-
* will add an event to the slotchange and add the events once available.
|
|
501
|
-
*/
|
|
502
|
-
this._listboxSlot.addEventListener('slotchange', () => {
|
|
503
|
-
this.__setupListboxNodeInteractions();
|
|
504
|
-
});
|
|
369
|
+
if (typeof index === 'number') {
|
|
370
|
+
if (index === -1) {
|
|
371
|
+
this._uncheckChildren();
|
|
505
372
|
}
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
// eslint-disable-next-line class-methods-use-this
|
|
515
|
-
_onListboxContentChanged() {}
|
|
516
|
-
|
|
517
|
-
_teardownListboxNode() {
|
|
518
|
-
if (this._listboxNode) {
|
|
519
|
-
this._listboxNode.removeEventListener('keydown', this._listboxOnKeyDown);
|
|
520
|
-
this._listboxNode.removeEventListener('click', this._listboxOnClick);
|
|
521
|
-
this._listboxNode.removeEventListener('keyup', this._listboxOnKeyUp);
|
|
373
|
+
if (this.formElements[index]) {
|
|
374
|
+
if (this.formElements[index].disabled) {
|
|
375
|
+
this._uncheckChildren();
|
|
376
|
+
} else if (this.multipleChoice) {
|
|
377
|
+
this.formElements[index].checked = !this.formElements[index].checked;
|
|
378
|
+
} else {
|
|
379
|
+
this.formElements[index].checked = true;
|
|
380
|
+
}
|
|
522
381
|
}
|
|
523
382
|
}
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* @enhance FormRegistrarMixin: make sure children have specific default states when added
|
|
387
|
+
* @param {FormControlHost & LionOption} child
|
|
388
|
+
* @param {Number} indexToInsertAt
|
|
389
|
+
*/
|
|
390
|
+
addFormElement(child, indexToInsertAt) {
|
|
391
|
+
super.addFormElement(/** @type {FormControl} */child, indexToInsertAt);
|
|
392
|
+
// we need to adjust the elements being registered
|
|
393
|
+
/* eslint-disable no-param-reassign */
|
|
394
|
+
child.id = child.id || `${this.localName}-option-${uuid()}`;
|
|
395
|
+
if (this.disabled) {
|
|
396
|
+
child.makeRequestToBeDisabled();
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// TODO: small perf improvement could be made if logic below would be scheduled to next update,
|
|
400
|
+
// so it occurs once for all options
|
|
401
|
+
this.__setAttributeForAllFormElements('aria-setsize', this.formElements.length);
|
|
402
|
+
this.formElements.forEach((el, idx) => {
|
|
403
|
+
el.setAttribute('aria-posinset', idx + 1);
|
|
404
|
+
});
|
|
405
|
+
this.__proxyChildModelValueChanged(/** @type {CustomEvent & { target: FormControlHost & LionOption; }} */{
|
|
406
|
+
target: child
|
|
407
|
+
});
|
|
408
|
+
this.resetInteractionState();
|
|
409
|
+
/* eslint-enable no-param-reassign */
|
|
410
|
+
}
|
|
411
|
+
resetInteractionState() {
|
|
412
|
+
super.resetInteractionState();
|
|
413
|
+
this.submitted = false;
|
|
414
|
+
}
|
|
415
|
+
reset() {
|
|
416
|
+
this.modelValue = this._initialModelValue;
|
|
417
|
+
this.activeIndex = -1;
|
|
418
|
+
this.resetInteractionState();
|
|
419
|
+
}
|
|
420
|
+
clear() {
|
|
421
|
+
super.clear();
|
|
422
|
+
this.setCheckedIndex(-1);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* @param {KeyboardEvent} ev
|
|
427
|
+
* @param {{setAsChecked:boolean}} options
|
|
428
|
+
* @protected
|
|
429
|
+
*/
|
|
430
|
+
_handleTypeAhead(ev, {
|
|
431
|
+
setAsChecked
|
|
432
|
+
}) {
|
|
433
|
+
const {
|
|
434
|
+
key,
|
|
435
|
+
code
|
|
436
|
+
} = ev;
|
|
437
|
+
if (code.startsWith('Key') || code.startsWith('Digit') || code.startsWith('Numpad')) {
|
|
438
|
+
ev.preventDefault();
|
|
439
|
+
this.__typedChars.push(key);
|
|
440
|
+
const chars = this.__typedChars.join('');
|
|
441
|
+
const matchedItemIndex =
|
|
442
|
+
// TODO: consider making this condition overridable for Subclassers by extracting it into protected method
|
|
443
|
+
this.formElements.findIndex(el => el.modelValue.value.toLowerCase().startsWith(chars));
|
|
444
|
+
if (matchedItemIndex >= 0) {
|
|
445
|
+
if (setAsChecked) {
|
|
446
|
+
this.setCheckedIndex(matchedItemIndex);
|
|
447
|
+
}
|
|
448
|
+
this.activeIndex = matchedItemIndex;
|
|
552
449
|
}
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
* Handle various keyboard controls; UP/DOWN will shift focus; SPACE selects
|
|
558
|
-
* an item.
|
|
559
|
-
*
|
|
560
|
-
* @param {KeyboardEvent} ev - the keydown event object
|
|
561
|
-
* @protected
|
|
562
|
-
*/
|
|
563
|
-
_listboxOnKeyDown(ev) {
|
|
564
|
-
if (this.disabled) {
|
|
565
|
-
return;
|
|
450
|
+
if (this.__pendingTypeAheadTimeout) {
|
|
451
|
+
// Prevent that pending timeouts 'intersect' with new 'typeahead sessions'
|
|
452
|
+
// @ts-ignore
|
|
453
|
+
window.clearTimeout(this.__pendingTypeAheadTimeout);
|
|
566
454
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
455
|
+
this.__pendingTypeAheadTimeout = setTimeout(() => {
|
|
456
|
+
// schedule a timeout to reset __typedChars
|
|
457
|
+
this.__typedChars = [];
|
|
458
|
+
}, this._typeAheadTimeout);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* @override ChoiceGroupMixin: in the select disabled options are still going to a possible
|
|
464
|
+
* value, for example when prefilling or programmatically setting it.
|
|
465
|
+
* @protected
|
|
466
|
+
*/
|
|
467
|
+
_getCheckedElements() {
|
|
468
|
+
return this.formElements.filter(el => el.checked);
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
/** @protected */
|
|
472
|
+
_setupListboxNode() {
|
|
473
|
+
if (this._listboxNode) {
|
|
474
|
+
this.__setupListboxNodeInteractions();
|
|
475
|
+
} else if (this._listboxSlot) {
|
|
476
|
+
/**
|
|
477
|
+
* For ShadyDom the listboxNode is available right from the start so we can add those events
|
|
478
|
+
* immediately.
|
|
479
|
+
* For native ShadowDom the select gets rendered before the listboxNode is available so we
|
|
480
|
+
* will add an event to the slotchange and add the events once available.
|
|
481
|
+
*/
|
|
482
|
+
this._listboxSlot.addEventListener('slotchange', () => {
|
|
483
|
+
this.__setupListboxNodeInteractions();
|
|
573
484
|
});
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* A Subclasser can perform additional logic whenever the elements inside the listbox are
|
|
490
|
+
* updated. For instance, when a combobox does server side autocomplete, we want to
|
|
491
|
+
* match highlighted parts client side.
|
|
492
|
+
* @configurable
|
|
493
|
+
*/
|
|
494
|
+
// eslint-disable-next-line class-methods-use-this
|
|
495
|
+
_onListboxContentChanged() {}
|
|
496
|
+
_teardownListboxNode() {
|
|
497
|
+
if (this._listboxNode) {
|
|
498
|
+
this._listboxNode.removeEventListener('keydown', this._listboxOnKeyDown);
|
|
499
|
+
this._listboxNode.removeEventListener('click', this._listboxOnClick);
|
|
500
|
+
this._listboxNode.removeEventListener('keyup', this._listboxOnKeyUp);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* @param {number} currentIndex
|
|
506
|
+
* @param {number} [offset=1]
|
|
507
|
+
* @protected
|
|
508
|
+
*/
|
|
509
|
+
_getNextEnabledOption(currentIndex, offset = 1) {
|
|
510
|
+
return this.__getEnabledOption(currentIndex, offset);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* @param {number} currentIndex
|
|
515
|
+
* @param {number} [offset=-1]
|
|
516
|
+
* @protected
|
|
517
|
+
*/
|
|
518
|
+
_getPreviousEnabledOption(currentIndex, offset = -1) {
|
|
519
|
+
return this.__getEnabledOption(currentIndex, offset);
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* @overridable
|
|
524
|
+
* @param {Event & { target: LionOption }} ev
|
|
525
|
+
* @protected
|
|
526
|
+
*/
|
|
527
|
+
// eslint-disable-next-line no-unused-vars, class-methods-use-this
|
|
528
|
+
_onChildActiveChanged({
|
|
529
|
+
target
|
|
530
|
+
}) {
|
|
531
|
+
if (target.active === true) {
|
|
532
|
+
this.__setChildActive(target);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* @desc
|
|
538
|
+
* Handle various keyboard controls; UP/DOWN will shift focus; SPACE selects
|
|
539
|
+
* an item.
|
|
540
|
+
*
|
|
541
|
+
* @param {KeyboardEvent} ev - the keydown event object
|
|
542
|
+
* @protected
|
|
543
|
+
*/
|
|
544
|
+
_listboxOnKeyDown(ev) {
|
|
545
|
+
if (this.disabled) {
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
this._isHandlingUserInput = true;
|
|
549
|
+
setTimeout(() => {
|
|
550
|
+
// Since we can't control when subclasses are done handling keyboard input, we
|
|
551
|
+
// schedule a timeout to reset _isHandlingUserInput
|
|
552
|
+
this._isHandlingUserInput = false;
|
|
553
|
+
});
|
|
554
|
+
const {
|
|
555
|
+
key
|
|
556
|
+
} = ev;
|
|
557
|
+
switch (key) {
|
|
558
|
+
case ' ':
|
|
559
|
+
case 'Enter':
|
|
560
|
+
{
|
|
580
561
|
if (key === ' ' && this._listboxReceivesNoFocus) {
|
|
581
562
|
return;
|
|
582
563
|
}
|
|
@@ -586,368 +567,353 @@ const ListboxMixinImplementation = /** @type {ListboxMixin} */ (superclass =>
|
|
|
586
567
|
if (!this.formElements[this.activeIndex]) {
|
|
587
568
|
return;
|
|
588
569
|
}
|
|
589
|
-
|
|
590
570
|
if (this.formElements[this.activeIndex].disabled) {
|
|
591
571
|
return;
|
|
592
572
|
}
|
|
593
|
-
|
|
594
573
|
if (this.formElements[this.activeIndex].href) {
|
|
595
574
|
this.formElements[this.activeIndex].click();
|
|
596
575
|
}
|
|
597
|
-
|
|
598
576
|
this.setCheckedIndex(this.activeIndex);
|
|
599
577
|
break;
|
|
600
578
|
}
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
const keys = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'Home', 'End'];
|
|
654
|
-
if (keys.includes(key) && this.selectionFollowsFocus && !this.multipleChoice) {
|
|
655
|
-
this.setCheckedIndex(this.activeIndex);
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
/**
|
|
660
|
-
* @overridable
|
|
661
|
-
* @param {MouseEvent} ev
|
|
662
|
-
* @protected
|
|
663
|
-
*/
|
|
664
|
-
// eslint-disable-next-line class-methods-use-this, no-unused-vars
|
|
665
|
-
_listboxOnClick(ev) {
|
|
666
|
-
/**
|
|
667
|
-
For now we disable, handling click interactions via delegated click handlers, since
|
|
668
|
-
LionOption detects clicks itself and could now potentially be checked as offline dom.
|
|
669
|
-
When we enable both methods in multiple choice mode, we would 'cancel out' each other.
|
|
670
|
-
TODO: If we want to allow 'less smart' options (think of role=menu), we should enable this
|
|
671
|
-
again and disable click handling inside LionOption (since there would be no use case for
|
|
672
|
-
'orphan' options)
|
|
673
|
-
*/
|
|
674
|
-
// const option = /** @type {HTMLElement} */ (ev.target).closest('[role=option]');
|
|
675
|
-
// const foundIndex = this.formElements.indexOf(option);
|
|
676
|
-
// if (foundIndex > -1) {
|
|
677
|
-
// this.activeIndex = foundIndex;
|
|
678
|
-
// this.setCheckedIndex(foundIndex, 'toggle', );
|
|
679
|
-
// }
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
/**
|
|
683
|
-
* @overridable
|
|
684
|
-
* @param {KeyboardEvent} ev
|
|
685
|
-
* @protected
|
|
686
|
-
*/
|
|
687
|
-
// eslint-disable-next-line class-methods-use-this, no-unused-vars
|
|
688
|
-
_listboxOnKeyUp(ev) {
|
|
689
|
-
if (this.disabled) {
|
|
690
|
-
return;
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
this._isHandlingUserInput = true;
|
|
694
|
-
setTimeout(() => {
|
|
695
|
-
// Since we can't control when subclasses are done handling keyboard input, we
|
|
696
|
-
// schedule a timeout to reset _isHandlingUserInput
|
|
697
|
-
this._isHandlingUserInput = false;
|
|
698
|
-
});
|
|
699
|
-
|
|
700
|
-
const { key } = ev;
|
|
701
|
-
// eslint-disable-next-line default-case
|
|
702
|
-
switch (key) {
|
|
703
|
-
case 'ArrowUp':
|
|
704
|
-
case 'ArrowDown':
|
|
705
|
-
case 'Home':
|
|
706
|
-
case 'End':
|
|
707
|
-
case 'Enter':
|
|
708
|
-
ev.preventDefault();
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
/**
|
|
713
|
-
* @configure FormControlMixin
|
|
714
|
-
* @protected
|
|
715
|
-
*/
|
|
716
|
-
_onLabelClick() {
|
|
717
|
-
this._listboxNode.focus();
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
/**
|
|
721
|
-
* @param {HTMLElement} el element
|
|
722
|
-
* @param {HTMLElement} [scrollTargetEl] container
|
|
723
|
-
* @protected
|
|
724
|
-
* @description allow Subclassers to adjust the animation: like non smooth behavior, different timing etc.
|
|
725
|
-
*/
|
|
726
|
-
// eslint-disable-next-line class-methods-use-this, no-unused-vars
|
|
727
|
-
_scrollIntoView(el, scrollTargetEl) {
|
|
728
|
-
el.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
/** @private */
|
|
732
|
-
__setupEventListeners() {
|
|
733
|
-
this._listboxNode.addEventListener(
|
|
734
|
-
'active-changed',
|
|
735
|
-
/** @type {EventListener} */ (this._onChildActiveChanged),
|
|
736
|
-
);
|
|
737
|
-
this._listboxNode.addEventListener(
|
|
738
|
-
'model-value-changed',
|
|
739
|
-
/** @type {EventListener} */ (this.__proxyChildModelValueChanged),
|
|
740
|
-
);
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
/** @private */
|
|
744
|
-
__teardownEventListeners() {
|
|
745
|
-
this._listboxNode.removeEventListener(
|
|
746
|
-
'active-changed',
|
|
747
|
-
/** @type {EventListener} */ (this._onChildActiveChanged),
|
|
748
|
-
);
|
|
749
|
-
this._listboxNode.removeEventListener(
|
|
750
|
-
'model-value-changed',
|
|
751
|
-
/** @type {EventListener} */ (this.__proxyChildModelValueChanged),
|
|
752
|
-
);
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
/**
|
|
756
|
-
* @param {LionOption | null} el
|
|
757
|
-
* @private
|
|
758
|
-
*/
|
|
759
|
-
__setChildActive(el) {
|
|
760
|
-
this.formElements.forEach(formElement => {
|
|
761
|
-
// eslint-disable-next-line no-param-reassign
|
|
762
|
-
formElement.active = el === formElement;
|
|
763
|
-
});
|
|
764
|
-
if (!el) {
|
|
765
|
-
this._activeDescendantOwnerNode.removeAttribute('aria-activedescendant');
|
|
766
|
-
return;
|
|
767
|
-
}
|
|
768
|
-
this._activeDescendantOwnerNode.setAttribute('aria-activedescendant', el.id);
|
|
769
|
-
|
|
770
|
-
this._scrollIntoView(el, this._scrollTargetNode);
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
/**
|
|
774
|
-
* @param {LionOption|LionOption[]} [exclude]
|
|
775
|
-
* @protected
|
|
776
|
-
*/
|
|
777
|
-
_uncheckChildren(exclude = []) {
|
|
778
|
-
const excludes = Array.isArray(exclude) ? exclude : [exclude];
|
|
779
|
-
this.formElements.forEach(option => {
|
|
780
|
-
if (!excludes.includes(option)) {
|
|
781
|
-
// eslint-disable-next-line no-param-reassign
|
|
782
|
-
option.checked = false;
|
|
579
|
+
case 'ArrowUp':
|
|
580
|
+
ev.preventDefault();
|
|
581
|
+
if (this.orientation === 'vertical') {
|
|
582
|
+
this.activeIndex = this._getPreviousEnabledOption(this.activeIndex);
|
|
583
|
+
}
|
|
584
|
+
break;
|
|
585
|
+
case 'ArrowLeft':
|
|
586
|
+
if (this._listboxReceivesNoFocus) {
|
|
587
|
+
return;
|
|
588
|
+
}
|
|
589
|
+
ev.preventDefault();
|
|
590
|
+
if (this.orientation === 'horizontal') {
|
|
591
|
+
this.activeIndex = this._getPreviousEnabledOption(this.activeIndex);
|
|
592
|
+
}
|
|
593
|
+
break;
|
|
594
|
+
case 'ArrowDown':
|
|
595
|
+
ev.preventDefault();
|
|
596
|
+
if (this.orientation === 'vertical') {
|
|
597
|
+
this.activeIndex = this._getNextEnabledOption(this.activeIndex);
|
|
598
|
+
}
|
|
599
|
+
break;
|
|
600
|
+
case 'ArrowRight':
|
|
601
|
+
if (this._listboxReceivesNoFocus) {
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
604
|
+
ev.preventDefault();
|
|
605
|
+
if (this.orientation === 'horizontal') {
|
|
606
|
+
this.activeIndex = this._getNextEnabledOption(this.activeIndex);
|
|
607
|
+
}
|
|
608
|
+
break;
|
|
609
|
+
case 'Home':
|
|
610
|
+
if (this._listboxReceivesNoFocus) {
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
ev.preventDefault();
|
|
614
|
+
this.activeIndex = this._getNextEnabledOption(0, 0);
|
|
615
|
+
break;
|
|
616
|
+
case 'End':
|
|
617
|
+
if (this._listboxReceivesNoFocus) {
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
620
|
+
ev.preventDefault();
|
|
621
|
+
this.activeIndex = this._getPreviousEnabledOption(this.formElements.length - 1, 0);
|
|
622
|
+
break;
|
|
623
|
+
default:
|
|
624
|
+
if (!this._noTypeAhead) {
|
|
625
|
+
this._handleTypeAhead(ev, {
|
|
626
|
+
setAsChecked: this.selectionFollowsFocus && !this.multipleChoice
|
|
627
|
+
});
|
|
783
628
|
}
|
|
784
|
-
});
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
/**
|
|
788
|
-
* @param {Event & { target: LionOption }} cfgOrEvent
|
|
789
|
-
* @private
|
|
790
|
-
*/
|
|
791
|
-
__onChildCheckedChanged(cfgOrEvent) {
|
|
792
|
-
const { target } = cfgOrEvent;
|
|
793
|
-
if (cfgOrEvent.stopPropagation) {
|
|
794
|
-
cfgOrEvent.stopPropagation();
|
|
795
|
-
}
|
|
796
|
-
if (target.checked && !this.multipleChoice) {
|
|
797
|
-
this._uncheckChildren(target);
|
|
798
|
-
}
|
|
799
629
|
}
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
630
|
+
const keys = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'Home', 'End'];
|
|
631
|
+
if (keys.includes(key) && this.selectionFollowsFocus && !this.multipleChoice) {
|
|
632
|
+
this.setCheckedIndex(this.activeIndex);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* @overridable
|
|
638
|
+
* @param {MouseEvent} ev
|
|
639
|
+
* @protected
|
|
640
|
+
*/
|
|
641
|
+
// eslint-disable-next-line class-methods-use-this, no-unused-vars
|
|
642
|
+
_listboxOnClick(ev) {
|
|
643
|
+
/**
|
|
644
|
+
For now we disable, handling click interactions via delegated click handlers, since
|
|
645
|
+
LionOption detects clicks itself and could now potentially be checked as offline dom.
|
|
646
|
+
When we enable both methods in multiple choice mode, we would 'cancel out' each other.
|
|
647
|
+
TODO: If we want to allow 'less smart' options (think of role=menu), we should enable this
|
|
648
|
+
again and disable click handling inside LionOption (since there would be no use case for
|
|
649
|
+
'orphan' options)
|
|
650
|
+
*/
|
|
651
|
+
// const option = /** @type {HTMLElement} */ (ev.target).closest('[role=option]');
|
|
652
|
+
// const foundIndex = this.formElements.indexOf(option);
|
|
653
|
+
// if (foundIndex > -1) {
|
|
654
|
+
// this.activeIndex = foundIndex;
|
|
655
|
+
// this.setCheckedIndex(foundIndex, 'toggle', );
|
|
656
|
+
// }
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* @overridable
|
|
661
|
+
* @param {KeyboardEvent} ev
|
|
662
|
+
* @protected
|
|
663
|
+
*/
|
|
664
|
+
// eslint-disable-next-line class-methods-use-this, no-unused-vars
|
|
665
|
+
_listboxOnKeyUp(ev) {
|
|
666
|
+
if (this.disabled) {
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
this._isHandlingUserInput = true;
|
|
670
|
+
setTimeout(() => {
|
|
671
|
+
// Since we can't control when subclasses are done handling keyboard input, we
|
|
672
|
+
// schedule a timeout to reset _isHandlingUserInput
|
|
673
|
+
this._isHandlingUserInput = false;
|
|
674
|
+
});
|
|
675
|
+
const {
|
|
676
|
+
key
|
|
677
|
+
} = ev;
|
|
678
|
+
// eslint-disable-next-line default-case
|
|
679
|
+
switch (key) {
|
|
680
|
+
case 'ArrowUp':
|
|
681
|
+
case 'ArrowDown':
|
|
682
|
+
case 'Home':
|
|
683
|
+
case 'End':
|
|
684
|
+
case 'Enter':
|
|
685
|
+
ev.preventDefault();
|
|
811
686
|
}
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* @configure FormControlMixin
|
|
691
|
+
* @protected
|
|
692
|
+
*/
|
|
693
|
+
_onLabelClick() {
|
|
694
|
+
this._listboxNode.focus();
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* @param {HTMLElement} el element
|
|
699
|
+
* @param {HTMLElement} [scrollTargetEl] container
|
|
700
|
+
* @protected
|
|
701
|
+
* @description allow Subclassers to adjust the animation: like non smooth behavior, different timing etc.
|
|
702
|
+
*/
|
|
703
|
+
// eslint-disable-next-line class-methods-use-this, no-unused-vars
|
|
704
|
+
_scrollIntoView(el, scrollTargetEl) {
|
|
705
|
+
el.scrollIntoView({
|
|
706
|
+
behavior: 'smooth',
|
|
707
|
+
block: 'nearest'
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
/** @private */
|
|
712
|
+
__setupEventListeners() {
|
|
713
|
+
this._listboxNode.addEventListener('active-changed', /** @type {EventListener} */this._onChildActiveChanged);
|
|
714
|
+
this._listboxNode.addEventListener('model-value-changed', /** @type {EventListener} */this.__proxyChildModelValueChanged);
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
/** @private */
|
|
718
|
+
__teardownEventListeners() {
|
|
719
|
+
this._listboxNode.removeEventListener('active-changed', /** @type {EventListener} */this._onChildActiveChanged);
|
|
720
|
+
this._listboxNode.removeEventListener('model-value-changed', /** @type {EventListener} */this.__proxyChildModelValueChanged);
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* @param {LionOption | null} el
|
|
725
|
+
* @private
|
|
726
|
+
*/
|
|
727
|
+
__setChildActive(el) {
|
|
728
|
+
this.formElements.forEach(formElement => {
|
|
729
|
+
// eslint-disable-next-line no-param-reassign
|
|
730
|
+
formElement.active = el === formElement;
|
|
731
|
+
});
|
|
732
|
+
if (!el) {
|
|
733
|
+
this._activeDescendantOwnerNode.removeAttribute('aria-activedescendant');
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
this._activeDescendantOwnerNode.setAttribute('aria-activedescendant', el.id);
|
|
737
|
+
this._scrollIntoView(el, this._scrollTargetNode);
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
/**
|
|
741
|
+
* @param {LionOption|LionOption[]} [exclude]
|
|
742
|
+
* @protected
|
|
743
|
+
*/
|
|
744
|
+
_uncheckChildren(exclude = []) {
|
|
745
|
+
const excludes = Array.isArray(exclude) ? exclude : [exclude];
|
|
746
|
+
this.formElements.forEach(option => {
|
|
747
|
+
if (!excludes.includes(option)) {
|
|
748
|
+
// eslint-disable-next-line no-param-reassign
|
|
749
|
+
option.checked = false;
|
|
823
750
|
}
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
/**
|
|
755
|
+
* @param {Event & { target: LionOption }} cfgOrEvent
|
|
756
|
+
* @private
|
|
757
|
+
*/
|
|
758
|
+
__onChildCheckedChanged(cfgOrEvent) {
|
|
759
|
+
const {
|
|
760
|
+
target
|
|
761
|
+
} = cfgOrEvent;
|
|
762
|
+
if (cfgOrEvent.stopPropagation) {
|
|
763
|
+
cfgOrEvent.stopPropagation();
|
|
764
|
+
}
|
|
765
|
+
if (target.checked && !this.multipleChoice) {
|
|
766
|
+
this._uncheckChildren(target);
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* // TODO: add to choiceGroup
|
|
772
|
+
* @param {string} attribute
|
|
773
|
+
* @param {number} value
|
|
774
|
+
* @private
|
|
775
|
+
*/
|
|
776
|
+
__setAttributeForAllFormElements(attribute, value) {
|
|
777
|
+
this.formElements.forEach(formElement => {
|
|
778
|
+
formElement.setAttribute(attribute, value);
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
/**
|
|
783
|
+
* @param {CustomEvent & { target: LionOption; }} ev
|
|
784
|
+
* @private
|
|
785
|
+
*/
|
|
786
|
+
__proxyChildModelValueChanged(ev) {
|
|
787
|
+
// We need to redispatch the model-value-changed event on 'this', so it will
|
|
788
|
+
// align with FormControl.__repropagateChildrenValues method. Also, this makes
|
|
789
|
+
// it act like a portal, in case the listbox is put in a modal overlay on body level.
|
|
790
|
+
if (ev.stopPropagation) {
|
|
791
|
+
ev.stopPropagation();
|
|
792
|
+
}
|
|
793
|
+
this.__onChildCheckedChanged(ev);
|
|
794
|
+
|
|
795
|
+
// don't send this.modelValue as oldValue, since it will take modelValue getter which takes it from child elements, which is already the updated value
|
|
796
|
+
this.requestUpdate('modelValue', this._oldModelValue);
|
|
797
|
+
// only send model-value-changed if the event is caused by one of its children
|
|
798
|
+
if (ev.detail && ev.detail.formPath) {
|
|
799
|
+
this.dispatchEvent(new CustomEvent('model-value-changed', {
|
|
800
|
+
detail: (/** @type {ModelValueEventDetails} */{
|
|
801
|
+
formPath: ev.detail.formPath,
|
|
802
|
+
isTriggeredByUser: ev.detail.isTriggeredByUser || this._isHandlingUserInput,
|
|
803
|
+
element: ev.target
|
|
804
|
+
})
|
|
805
|
+
}));
|
|
806
|
+
}
|
|
807
|
+
this._oldModelValue = this.modelValue;
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* @param {number} currentIndex
|
|
812
|
+
* @param {number} offset
|
|
813
|
+
* @private
|
|
814
|
+
*/
|
|
815
|
+
__getEnabledOption(currentIndex, offset) {
|
|
816
|
+
/**
|
|
817
|
+
* @param {number} i
|
|
818
|
+
*/
|
|
819
|
+
const until = i => offset === 1 ? i < this.formElements.length : i >= 0;
|
|
820
|
+
|
|
821
|
+
// Try to find the next / previous option
|
|
822
|
+
for (let i = currentIndex + offset; until(i); i += offset) {
|
|
823
|
+
if (this.formElements[i] && !this.formElements[i].hasAttribute('aria-hidden')) {
|
|
824
|
+
return i;
|
|
839
825
|
}
|
|
840
|
-
this._oldModelValue = this.modelValue;
|
|
841
826
|
}
|
|
842
827
|
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
__getEnabledOption(currentIndex, offset) {
|
|
849
|
-
/**
|
|
850
|
-
* @param {number} i
|
|
851
|
-
*/
|
|
852
|
-
const until = i => (offset === 1 ? i < this.formElements.length : i >= 0);
|
|
853
|
-
|
|
854
|
-
// Try to find the next / previous option
|
|
855
|
-
for (let i = currentIndex + offset; until(i); i += offset) {
|
|
828
|
+
// If above was unsuccessful, try to find the next/previous either
|
|
829
|
+
// from end --> start or start --> end
|
|
830
|
+
if (this.rotateKeyboardNavigation) {
|
|
831
|
+
const startIndex = offset === -1 ? this.formElements.length - 1 : 0;
|
|
832
|
+
for (let i = startIndex; until(i); i += offset) {
|
|
856
833
|
if (this.formElements[i] && !this.formElements[i].hasAttribute('aria-hidden')) {
|
|
857
834
|
return i;
|
|
858
835
|
}
|
|
859
836
|
}
|
|
860
|
-
|
|
861
|
-
// If above was unsuccessful, try to find the next/previous either
|
|
862
|
-
// from end --> start or start --> end
|
|
863
|
-
if (this.rotateKeyboardNavigation) {
|
|
864
|
-
const startIndex = offset === -1 ? this.formElements.length - 1 : 0;
|
|
865
|
-
for (let i = startIndex; until(i); i += offset) {
|
|
866
|
-
if (this.formElements[i] && !this.formElements[i].hasAttribute('aria-hidden')) {
|
|
867
|
-
return i;
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
// If above was unsuccessful, return currentIndex that we started with
|
|
873
|
-
return currentIndex;
|
|
874
837
|
}
|
|
875
838
|
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
839
|
+
// If above was unsuccessful, return currentIndex that we started with
|
|
840
|
+
return currentIndex;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
/**
|
|
844
|
+
* Moves options put in unnamed slot to slot with [role="listbox"]
|
|
845
|
+
* @private
|
|
846
|
+
*/
|
|
847
|
+
__moveOptionsToListboxNode() {
|
|
848
|
+
const slot = /** @type {HTMLSlotElement} */
|
|
849
|
+
/** @type {ShadowRoot} */this.shadowRoot.getElementById('options-outlet');
|
|
850
|
+
if (slot) {
|
|
851
|
+
moveUserProvidedDefaultSlottablesToTarget(this, this._listboxNode);
|
|
852
|
+
slot.addEventListener('slotchange', () => {
|
|
886
853
|
moveUserProvidedDefaultSlottablesToTarget(this, this._listboxNode);
|
|
887
|
-
|
|
888
|
-
moveUserProvidedDefaultSlottablesToTarget(this, this._listboxNode);
|
|
889
|
-
});
|
|
890
|
-
}
|
|
854
|
+
});
|
|
891
855
|
}
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
/**
|
|
859
|
+
* @param {KeyboardEvent} ev
|
|
860
|
+
* @private
|
|
861
|
+
*/
|
|
862
|
+
__preventScrollingWithArrowKeys(ev) {
|
|
863
|
+
if (this.disabled) {
|
|
864
|
+
return;
|
|
865
|
+
}
|
|
866
|
+
const {
|
|
867
|
+
key
|
|
868
|
+
} = ev;
|
|
869
|
+
switch (key) {
|
|
870
|
+
case 'ArrowUp':
|
|
871
|
+
case 'ArrowDown':
|
|
872
|
+
case 'Home':
|
|
873
|
+
case 'End':
|
|
874
|
+
ev.preventDefault();
|
|
875
|
+
/* no default */
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
/**
|
|
880
|
+
* Helper method used within `._setupListboxNode`
|
|
881
|
+
* @private
|
|
882
|
+
*/
|
|
883
|
+
__setupListboxNodeInteractions() {
|
|
884
|
+
this._listboxNode.setAttribute('role', 'listbox');
|
|
885
|
+
this._listboxNode.setAttribute('aria-orientation', this.orientation);
|
|
886
|
+
this._listboxNode.setAttribute('aria-multiselectable', `${this.multipleChoice}`);
|
|
887
|
+
this._listboxNode.setAttribute('tabindex', '0');
|
|
888
|
+
this._listboxNode.addEventListener('click', this._listboxOnClick);
|
|
889
|
+
this._listboxNode.addEventListener('keyup', this._listboxOnKeyUp);
|
|
890
|
+
this._listboxNode.addEventListener('keydown', this._listboxOnKeyDown);
|
|
891
|
+
/** Since _scrollTargetNode can be _listboxNode, handle here */
|
|
892
|
+
this._scrollTargetNode.addEventListener('keydown', this.__preventScrollingWithArrowKeys);
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
// TODO: move to ChoiceGroupMixin?
|
|
896
|
+
/** @private */
|
|
897
|
+
__requestOptionsToBeDisabled() {
|
|
898
|
+
this.formElements.forEach(el => {
|
|
899
|
+
if (el.makeRequestToBeDisabled) {
|
|
900
|
+
el.makeRequestToBeDisabled();
|
|
900
901
|
}
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
902
|
+
});
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
/** @private */
|
|
906
|
+
__retractRequestOptionsToBeDisabled() {
|
|
907
|
+
this.formElements.forEach(el => {
|
|
908
|
+
if (el.retractRequestToBeDisabled) {
|
|
909
|
+
el.retractRequestToBeDisabled();
|
|
909
910
|
}
|
|
910
|
-
}
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
this._listboxNode.setAttribute('aria-orientation', this.orientation);
|
|
919
|
-
this._listboxNode.setAttribute('aria-multiselectable', `${this.multipleChoice}`);
|
|
920
|
-
this._listboxNode.setAttribute('tabindex', '0');
|
|
921
|
-
this._listboxNode.addEventListener('click', this._listboxOnClick);
|
|
922
|
-
this._listboxNode.addEventListener('keyup', this._listboxOnKeyUp);
|
|
923
|
-
this._listboxNode.addEventListener('keydown', this._listboxOnKeyDown);
|
|
924
|
-
/** Since _scrollTargetNode can be _listboxNode, handle here */
|
|
925
|
-
this._scrollTargetNode.addEventListener('keydown', this.__preventScrollingWithArrowKeys);
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
// TODO: move to ChoiceGroupMixin?
|
|
929
|
-
/** @private */
|
|
930
|
-
__requestOptionsToBeDisabled() {
|
|
931
|
-
this.formElements.forEach(el => {
|
|
932
|
-
if (el.makeRequestToBeDisabled) {
|
|
933
|
-
el.makeRequestToBeDisabled();
|
|
934
|
-
}
|
|
935
|
-
});
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
/** @private */
|
|
939
|
-
__retractRequestOptionsToBeDisabled() {
|
|
940
|
-
this.formElements.forEach(el => {
|
|
941
|
-
if (el.retractRequestToBeDisabled) {
|
|
942
|
-
el.retractRequestToBeDisabled();
|
|
943
|
-
}
|
|
944
|
-
});
|
|
945
|
-
}
|
|
946
|
-
|
|
947
|
-
/** @private */
|
|
948
|
-
__initInteractionStates() {
|
|
949
|
-
this.initInteractionState();
|
|
950
|
-
}
|
|
951
|
-
});
|
|
952
|
-
|
|
911
|
+
});
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
/** @private */
|
|
915
|
+
__initInteractionStates() {
|
|
916
|
+
this.initInteractionState();
|
|
917
|
+
}
|
|
918
|
+
};
|
|
953
919
|
export const ListboxMixin = dedupeMixin(ListboxMixinImplementation);
|