@lion/ui 0.22.0 → 0.24.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 +65 -0
- 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 +45 -55
- 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 +598 -860
- 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 -357
- 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-core/types/choice-group/ChoiceGroupMixinTypes.ts +5 -0
- 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 +37 -26
- package/components/input-amount/src/formatters.js +4 -5
- package/components/input-amount/src/parsers.js +0 -3
- package/components/input-amount/test/formatters.test.js +102 -80
- package/components/input-amount/test/lion-input-amount-integrations.test.js +0 -4
- package/components/input-amount/test/lion-input-amount.test.js +155 -164
- 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 +40 -11
- package/components/input-tel/test/preprocessors.test.js +24 -13
- package/components/input-tel/test/validators.test.js +15 -13
- package/components/input-tel/test-helpers/mockPhoneUtilManager.js +7 -6
- 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 +4 -1
- package/components/listbox/src/LionOption.js +8 -7
- package/components/listbox/src/LionOptions.js +0 -3
- package/components/listbox/src/ListboxMixin.js +801 -819
- 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/listbox/types/ListboxMixinTypes.ts +7 -1
- 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/README.md +360 -0
- package/components/menu/src/InteractiveListMixin.js +866 -0
- package/components/menu/src/LionMenu.js +423 -0
- package/components/menu/src/MoreButtonMenuMixin.js +272 -0
- package/components/menu/src/MultiLevelListMixin.js +306 -0
- package/components/menu/src/utils/isInView.js +25 -0
- package/components/menu/src/utils/listItemInteractions.js +124 -0
- package/components/menu/test/InteractiveListMixin.test.js +2 -0
- package/components/menu/test/MoreButtonMenuMixin.test.js +5 -0
- package/components/menu/test/MultiLevelListMixin.test.js +2 -0
- package/components/menu/test/lion-menu-interactions.test.js +2 -0
- package/components/menu/test/lion-menu.test.js +18 -0
- package/components/menu/test-helpers/mimicKeyPress.js +19 -0
- package/components/menu/test-suites/InteractiveListMixin.suite.js +498 -0
- package/components/menu/test-suites/LionMenu.suite.js +107 -0
- package/components/menu/test-suites/LionMenuInteractions.suite.js +561 -0
- package/components/menu/test-suites/MoreButtonMenuMixin.suite.js +365 -0
- package/components/menu/test-suites/MultiLevelListMixin.suite.js +291 -0
- package/components/menu/types/InteractiveListMixinTypes.ts +126 -0
- package/components/menu/types/MoreButtonMenuMixinTypes.ts +51 -0
- package/components/menu/types/MultiLevelListMixinTypes.ts +28 -0
- package/components/menu/types/OverlayWithListInvokerMixinTypes.ts +61 -0
- package/components/overlays/NEXT.md +49 -0
- package/components/overlays/src/ArrowMixin.js +111 -127
- package/components/overlays/src/OverlayController.js +440 -246
- package/components/overlays/src/OverlayMixin.js +130 -68
- 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 +19 -19
- 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 +14 -6
- 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 +551 -533
- 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/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 +159 -188
- 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/overlays/types/ArrowMixinTypes.ts +1 -3
- package/components/overlays/types/OverlayConfig.ts +20 -5
- package/components/overlays/types/OverlayMixinTypes.ts +2 -0
- 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 +32 -43
- 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 +154 -101
- package/components/select-rich/test/lion-select-rich-upgrade.test.js +26 -0
- 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 +3312 -206
- package/dist-types/components/combobox/src/LionCombobox.d.ts +1 -1
- package/dist-types/components/combobox/src/LionCombobox.d.ts.map +1 -1
- 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/dialog/src/LionDialog.d.ts +6 -2
- package/dist-types/components/dialog/src/LionDialog.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/form-core/src/choice-group/ChoiceGroupMixin.d.ts.map +1 -1
- package/dist-types/components/form-core/types/choice-group/ChoiceGroupMixinTypes.d.ts +5 -0
- package/dist-types/components/form-core/types/choice-group/ChoiceGroupMixinTypes.d.ts.map +1 -1
- package/dist-types/components/input-amount/src/LionInputAmount.d.ts +3 -1
- package/dist-types/components/input-amount/src/LionInputAmount.d.ts.map +1 -1
- package/dist-types/components/input-amount/src/formatters.d.ts +6 -4
- package/dist-types/components/input-amount/src/formatters.d.ts.map +1 -1
- package/dist-types/components/input-datepicker/src/LionInputDatepicker.d.ts +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/listbox/src/LionOption.d.ts +5 -2
- package/dist-types/components/listbox/src/LionOption.d.ts.map +1 -1
- package/dist-types/components/listbox/src/ListboxMixin.d.ts.map +1 -1
- package/dist-types/components/listbox/types/ListboxMixinTypes.d.ts +7 -1
- package/dist-types/components/listbox/types/ListboxMixinTypes.d.ts.map +1 -1
- package/dist-types/components/menu/src/InteractiveListMixin.d.ts +35 -0
- package/dist-types/components/menu/src/InteractiveListMixin.d.ts.map +1 -0
- package/dist-types/components/menu/src/LionMenu.d.ts +129 -0
- package/dist-types/components/menu/src/LionMenu.d.ts.map +1 -0
- package/dist-types/components/menu/src/MoreButtonMenuMixin.d.ts +8 -0
- package/dist-types/components/menu/src/MoreButtonMenuMixin.d.ts.map +1 -0
- package/dist-types/components/menu/src/MultiLevelListMixin.d.ts +7 -0
- package/dist-types/components/menu/src/MultiLevelListMixin.d.ts.map +1 -0
- package/dist-types/components/menu/src/utils/isInView.d.ts +9 -0
- package/dist-types/components/menu/src/utils/isInView.d.ts.map +1 -0
- package/dist-types/components/menu/src/utils/listItemInteractions.d.ts +48 -0
- package/dist-types/components/menu/src/utils/listItemInteractions.d.ts.map +1 -0
- package/dist-types/components/menu/test/InteractiveListMixin.test.d.ts +2 -0
- package/dist-types/components/menu/test/InteractiveListMixin.test.d.ts.map +1 -0
- package/dist-types/components/menu/test/MoreButtonMenuMixin.test.d.ts +2 -0
- package/dist-types/components/menu/test/MoreButtonMenuMixin.test.d.ts.map +1 -0
- package/dist-types/components/menu/test/MultiLevelListMixin.test.d.ts +2 -0
- package/dist-types/components/menu/test/MultiLevelListMixin.test.d.ts.map +1 -0
- package/dist-types/components/menu/test/lion-menu-interactions.test.d.ts +2 -0
- package/dist-types/components/menu/test/lion-menu-interactions.test.d.ts.map +1 -0
- package/dist-types/components/menu/test/lion-menu.test.d.ts +2 -0
- package/dist-types/components/menu/test/lion-menu.test.d.ts.map +1 -0
- package/dist-types/components/menu/test-helpers/mimicKeyPress.d.ts +7 -0
- package/dist-types/components/menu/test-helpers/mimicKeyPress.d.ts.map +1 -0
- package/dist-types/components/menu/test-suites/InteractiveListMixin.suite.d.ts +11 -0
- package/dist-types/components/menu/test-suites/InteractiveListMixin.suite.d.ts.map +1 -0
- package/dist-types/components/menu/test-suites/LionMenu.suite.d.ts +9 -0
- package/dist-types/components/menu/test-suites/LionMenu.suite.d.ts.map +1 -0
- package/dist-types/components/menu/test-suites/LionMenuInteractions.suite.d.ts +5 -0
- package/dist-types/components/menu/test-suites/LionMenuInteractions.suite.d.ts.map +1 -0
- package/dist-types/components/menu/test-suites/MoreButtonMenuMixin.suite.d.ts +11 -0
- package/dist-types/components/menu/test-suites/MoreButtonMenuMixin.suite.d.ts.map +1 -0
- package/dist-types/components/menu/test-suites/MultiLevelListMixin.suite.d.ts +11 -0
- package/dist-types/components/menu/test-suites/MultiLevelListMixin.suite.d.ts.map +1 -0
- package/dist-types/components/menu/types/InteractiveListMixinTypes.d.ts +72 -0
- package/dist-types/components/menu/types/InteractiveListMixinTypes.d.ts.map +1 -0
- package/dist-types/components/menu/types/MoreButtonMenuMixinTypes.d.ts +30 -0
- package/dist-types/components/menu/types/MoreButtonMenuMixinTypes.d.ts.map +1 -0
- package/dist-types/components/menu/types/MultiLevelListMixinTypes.d.ts +16 -0
- package/dist-types/components/menu/types/MultiLevelListMixinTypes.d.ts.map +1 -0
- package/dist-types/components/menu/types/OverlayWithListInvokerMixinTypes.d.ts +35 -0
- package/dist-types/components/menu/types/OverlayWithListInvokerMixinTypes.d.ts.map +1 -0
- package/dist-types/components/overlays/src/OverlayController.d.ts +22 -5
- 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/src/utils/is-equal-config.d.ts.map +1 -1
- package/dist-types/components/overlays/types/ArrowMixinTypes.d.ts.map +1 -1
- package/dist-types/components/overlays/types/OverlayConfig.d.ts +12 -2
- package/dist-types/components/overlays/types/OverlayConfig.d.ts.map +1 -1
- package/dist-types/components/overlays/types/OverlayMixinTypes.d.ts +1 -0
- package/dist-types/components/overlays/types/OverlayMixinTypes.d.ts.map +1 -1
- 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 +13 -2
- package/dist-types/components/select-rich/src/LionSelectRich.d.ts.map +1 -1
- package/dist-types/components/select-rich/test/lion-select-rich-interaction.test.d.ts.map +1 -1
- package/dist-types/components/select-rich/test/lion-select-rich-upgrade.test.d.ts +2 -0
- package/dist-types/components/select-rich/test/lion-select-rich-upgrade.test.d.ts.map +1 -0
- package/dist-types/components/tooltip/src/LionTooltip.d.ts +1 -1
- package/dist-types/exports/define/lion-item.d.ts +2 -0
- package/dist-types/exports/define/lion-item.d.ts.map +1 -0
- package/dist-types/exports/define/lion-menu.d.ts +2 -0
- package/dist-types/exports/define/lion-menu.d.ts.map +1 -0
- package/dist-types/exports/define/lion-menuitem.d.ts +2 -0
- package/dist-types/exports/define/lion-menuitem.d.ts.map +1 -0
- package/dist-types/exports/menu-test-suites.d.ts +4 -0
- package/dist-types/exports/menu-test-suites.d.ts.map +1 -0
- package/dist-types/exports/menu.d.ts +3 -0
- package/dist-types/exports/menu.d.ts.map +1 -0
- package/dist-types/exports/overlays.d.ts +6 -0
- package/dist-types/exports/overlays.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 +53 -39
- 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/api-table.md +32 -6
- 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/api-table.md +9 -7
- package/docs/components/input-amount/overview.md +5 -5
- package/docs/components/input-amount/use-cases.md +17 -6
- package/docs/components/input-amount-dropdown/api-table.md +2 -0
- 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/api-table.md +63 -45
- 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/overview.md +2 -2
- package/docs/components/listbox/use-cases.md +3 -3
- package/docs/components/menu/api-table.md +44 -0
- package/docs/components/menu/applyMenuDemoStyles.js +173 -0
- package/docs/components/menu/extensions.md +262 -0
- package/docs/components/menu/index.md +13 -0
- package/docs/components/menu/migration.md +129 -0
- package/docs/components/menu/overview.md +448 -0
- package/docs/components/menu/src/DemoNavigationBar.js +441 -0
- package/docs/components/menu/src/DemoSpinButton.js +215 -0
- package/docs/components/menu/src/DemoToolbar.js +101 -0
- package/docs/components/menu/src/DemoTree.js +55 -0
- package/docs/components/menu/src/navigation-bar-types.js +41 -0
- package/docs/components/menu/use-cases.md +74 -0
- 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 +51 -33
- 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/api-table.md +33 -7
- 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 +3 -3
- 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 +46 -43
- 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 +2 -0
- package/exports/define/lion-listbox.js +0 -1
- package/exports/define/lion-menu.js +2 -0
- package/exports/define/lion-menuitem.js +2 -0
- 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/menu-test-suites.js +4 -0
- package/exports/menu.js +3 -0
- package/exports/overlays.js +6 -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/menu-test-suites.js +4 -0
- package/menu.js +3 -0
- package/overlays.js +6 -0
- package/package.json +35 -6
- package/vscode.html-custom-data.json +76 -8
- package/web-types.json +202 -17
|
@@ -38,485 +38,493 @@ import { FormRegisteringMixin } from './registration/FormRegisteringMixin.js';
|
|
|
38
38
|
* @type {FormControlMixin}
|
|
39
39
|
*/
|
|
40
40
|
// prettier-ignore
|
|
41
|
-
const FormControlMixinImplementation = /** @type {FormControlMixin} */
|
|
42
|
-
|
|
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
|
-
|
|
41
|
+
const FormControlMixinImplementation = /** @type {FormControlMixin} */superclass =>
|
|
42
|
+
// eslint-disable-next-line no-shadow, no-unused-vars
|
|
43
|
+
class FormControlMixin extends FormRegisteringMixin(DisabledMixin(SlotMixin(superclass))) {
|
|
44
|
+
/** @type {any} */
|
|
45
|
+
static get properties() {
|
|
46
|
+
return {
|
|
47
|
+
readOnly: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
attribute: 'readonly',
|
|
50
|
+
reflect: true
|
|
51
|
+
},
|
|
52
|
+
label: String,
|
|
53
|
+
// FIXME: { attribute: false } breaks a bunch of tests, but shouldn't...
|
|
54
|
+
labelSrOnly: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
attribute: 'label-sr-only',
|
|
57
|
+
reflect: true
|
|
58
|
+
},
|
|
59
|
+
helpText: {
|
|
60
|
+
type: String,
|
|
61
|
+
attribute: 'help-text'
|
|
62
|
+
},
|
|
63
|
+
modelValue: {
|
|
64
|
+
attribute: false
|
|
65
|
+
},
|
|
66
|
+
_ariaLabelledNodes: {
|
|
67
|
+
attribute: false
|
|
68
|
+
},
|
|
69
|
+
_ariaDescribedNodes: {
|
|
70
|
+
attribute: false
|
|
71
|
+
},
|
|
72
|
+
_repropagationRole: {
|
|
73
|
+
attribute: false
|
|
74
|
+
},
|
|
75
|
+
_isRepropagationEndpoint: {
|
|
76
|
+
attribute: false
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* The label text for the input node.
|
|
83
|
+
* When no light dom defined via [slot=label], this value will be used.
|
|
84
|
+
* @type {string}
|
|
85
|
+
*/
|
|
86
|
+
get label() {
|
|
87
|
+
return this.__label ?? (this._labelNode?.textContent || '');
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @param {string} newValue
|
|
92
|
+
*/
|
|
93
|
+
set label(newValue) {
|
|
94
|
+
const oldValue = this.label;
|
|
95
|
+
/** @type {string} */
|
|
96
|
+
this.__label = newValue;
|
|
97
|
+
this.requestUpdate('label', oldValue);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* The helpt text for the input node.
|
|
102
|
+
* When no light dom defined via [slot=help-text], this value will be used
|
|
103
|
+
* @type {string}
|
|
104
|
+
*/
|
|
105
|
+
get helpText() {
|
|
106
|
+
return this.__helpText ?? (this._helpTextNode?.textContent || '');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @param {string} newValue
|
|
111
|
+
*/
|
|
112
|
+
set helpText(newValue) {
|
|
113
|
+
const oldValue = this.helpText;
|
|
114
|
+
/** @type {string} */
|
|
115
|
+
this.__helpText = newValue;
|
|
116
|
+
this.requestUpdate('helpText', oldValue);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Will be used in validation messages to refer to the current field
|
|
121
|
+
* @type {string}
|
|
122
|
+
*/
|
|
123
|
+
get fieldName() {
|
|
124
|
+
return this.__fieldName || this.label || this.name || '';
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* @param {string} value
|
|
129
|
+
*/
|
|
130
|
+
set fieldName(value) {
|
|
131
|
+
/** @type {string} */
|
|
132
|
+
this.__fieldName = value;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @configure SlotMixin
|
|
137
|
+
*/
|
|
138
|
+
get slots() {
|
|
139
|
+
return {
|
|
140
|
+
...super.slots,
|
|
141
|
+
label: () => {
|
|
142
|
+
const label = document.createElement('label');
|
|
143
|
+
label.textContent = this.label;
|
|
144
|
+
return label;
|
|
145
|
+
},
|
|
146
|
+
'help-text': () => {
|
|
147
|
+
const helpText = document.createElement('div');
|
|
148
|
+
helpText.textContent = this.helpText;
|
|
149
|
+
return helpText;
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* The interactive (form) element. Can be a native element like input/textarea/select or
|
|
156
|
+
* an element with tabindex > -1
|
|
157
|
+
* @protected
|
|
158
|
+
*/
|
|
159
|
+
get _inputNode() {
|
|
160
|
+
return /** @type {HTMLElementWithValue} */this.__getDirectSlotChild('input');
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Element where label will be rendered to
|
|
165
|
+
* @protected
|
|
166
|
+
*/
|
|
167
|
+
get _labelNode() {
|
|
168
|
+
return /** @type {HTMLElement} */this.__getDirectSlotChild('label');
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Element where help text will be rendered to
|
|
173
|
+
* @protected
|
|
174
|
+
*/
|
|
175
|
+
get _helpTextNode() {
|
|
176
|
+
return /** @type {HTMLElement} */this.__getDirectSlotChild('help-text');
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Element where validation feedback will be rendered to
|
|
181
|
+
* @protected
|
|
182
|
+
*/
|
|
183
|
+
get _feedbackNode() {
|
|
184
|
+
return /** @type {LionValidationFeedback} */this.__getDirectSlotChild('feedback');
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* TODO: check if this is a false positive or if we can improve
|
|
189
|
+
* @configure ReactiveElement
|
|
190
|
+
*/
|
|
191
|
+
// @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
|
|
192
|
+
static enabledWarnings = super.enabledWarnings?.filter(w => w !== 'change-in-update') || [];
|
|
193
|
+
|
|
194
|
+
// N.B. add these label/helpText props for types + ce manifest output
|
|
195
|
+
// (explicity setting them to undefined does not have desired result)
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* The label text for the input node.
|
|
199
|
+
* When no value is defined, textContent of [slot=label] will be used
|
|
200
|
+
* @property {string} label
|
|
201
|
+
*/
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* The helpt text for the input node.
|
|
205
|
+
* When no value is defined, textContent of [slot=help-text] will be used
|
|
206
|
+
* @property {string} helpText
|
|
207
|
+
*/
|
|
208
|
+
|
|
209
|
+
constructor() {
|
|
210
|
+
super();
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* A Boolean attribute which, if present, indicates that the user should not be able to edit
|
|
214
|
+
* the value of the input. The difference between disabled and readonly is that read-only
|
|
215
|
+
* controls can still function, whereas disabled controls generally do not function as
|
|
216
|
+
* controls until they are enabled.
|
|
217
|
+
* (From: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly)
|
|
218
|
+
* @type {boolean}
|
|
219
|
+
*/
|
|
220
|
+
this.readOnly = false;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* The label will only be visible for srceen readers when true
|
|
224
|
+
* @type {boolean}
|
|
225
|
+
*/
|
|
226
|
+
this.labelSrOnly = false;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* The model value is the result of the parser function(when available).
|
|
230
|
+
* It should be considered as the internal value used for validation and reasoning/logic.
|
|
231
|
+
* The model value is 'ready for consumption' by the outside world (think of a Date
|
|
232
|
+
* object or a float). The modelValue can(and is recommended to) be used as both input
|
|
233
|
+
* value and output value of the `LionField`.
|
|
234
|
+
*
|
|
235
|
+
* Examples:
|
|
236
|
+
* - For a date input: a String '20/01/1999' will be converted to new Date('1999/01/20')
|
|
237
|
+
* - For a number input: a formatted String '1.234,56' will be converted to a Number:
|
|
238
|
+
* 1234.56
|
|
70
239
|
*/
|
|
71
|
-
set
|
|
72
|
-
|
|
73
|
-
/** @type {string} */
|
|
74
|
-
this.__label = newValue;
|
|
75
|
-
this.requestUpdate('label', oldValue);
|
|
76
|
-
}
|
|
77
|
-
|
|
240
|
+
// TODO: we can probably set this up properly once propert effects run from firstUpdated
|
|
241
|
+
// this.modelValue = undefined;
|
|
78
242
|
/**
|
|
79
|
-
*
|
|
80
|
-
* When no light dom defined via [slot=help-text], this value will be used
|
|
243
|
+
* Unique id that can be used in all light dom
|
|
81
244
|
* @type {string}
|
|
245
|
+
* @protected
|
|
82
246
|
*/
|
|
83
|
-
|
|
84
|
-
return this.__helpText ?? (this._helpTextNode?.textContent || '');
|
|
85
|
-
}
|
|
247
|
+
this._inputId = uuid(this.localName);
|
|
86
248
|
|
|
87
249
|
/**
|
|
88
|
-
*
|
|
250
|
+
* Contains all elements that should end up in aria-labelledby of `._inputNode`
|
|
251
|
+
* @type {HTMLElement[]}
|
|
89
252
|
*/
|
|
90
|
-
|
|
91
|
-
const oldValue = this.helpText;
|
|
92
|
-
/** @type {string} */
|
|
93
|
-
this.__helpText = newValue;
|
|
94
|
-
this.requestUpdate('helpText', oldValue);
|
|
95
|
-
}
|
|
253
|
+
this._ariaLabelledNodes = [];
|
|
96
254
|
|
|
97
255
|
/**
|
|
98
|
-
*
|
|
99
|
-
* @type {
|
|
256
|
+
* Contains all elements that should end up in aria-describedby of `._inputNode`
|
|
257
|
+
* @type {HTMLElement[]}
|
|
100
258
|
*/
|
|
101
|
-
|
|
102
|
-
return this.__fieldName || this.label || this.name || '';
|
|
103
|
-
}
|
|
259
|
+
this._ariaDescribedNodes = [];
|
|
104
260
|
|
|
105
261
|
/**
|
|
106
|
-
*
|
|
262
|
+
* Based on the role, details of handling model-value-changed repropagation differ.
|
|
263
|
+
* @type {'child'|'choice-group'|'fieldset'}
|
|
107
264
|
*/
|
|
108
|
-
|
|
109
|
-
/** @type {string} */
|
|
110
|
-
this.__fieldName = value;
|
|
111
|
-
}
|
|
265
|
+
this._repropagationRole = 'child';
|
|
112
266
|
|
|
113
267
|
/**
|
|
114
|
-
*
|
|
268
|
+
* By default, a field with _repropagationRole 'choice-group' will act as an
|
|
269
|
+
* 'endpoint'. This means it will be considered as an individual field: for
|
|
270
|
+
* a select, individual options will not be part of the formPath. They
|
|
271
|
+
* will.
|
|
272
|
+
* Similarly, components that (a11y wise) need to be fieldsets, but 'interaction wise'
|
|
273
|
+
* (from Application Developer perspective) need to be more like fields
|
|
274
|
+
* (think of an amount-input with a currency select box next to it), can set this
|
|
275
|
+
* to true to hide private internals in the formPath.
|
|
276
|
+
* @type {boolean}
|
|
115
277
|
*/
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
},
|
|
129
|
-
};
|
|
278
|
+
this._isRepropagationEndpoint = false;
|
|
279
|
+
this.addEventListener('model-value-changed', /** @type {EventListenerOrEventListenerObject} */this.__repropagateChildrenValues);
|
|
280
|
+
/** @type {EventListener} */
|
|
281
|
+
this._onLabelClick = this._onLabelClick.bind(this);
|
|
282
|
+
}
|
|
283
|
+
connectedCallback() {
|
|
284
|
+
super.connectedCallback();
|
|
285
|
+
this._enhanceLightDomClasses();
|
|
286
|
+
this._enhanceLightDomA11y();
|
|
287
|
+
this._triggerInitialModelValueChangedEvent();
|
|
288
|
+
if (this._labelNode) {
|
|
289
|
+
this._labelNode.addEventListener('click', this._onLabelClick);
|
|
130
290
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
*/
|
|
137
|
-
get _inputNode() {
|
|
138
|
-
return /** @type {HTMLElementWithValue} */ (this.__getDirectSlotChild('input'));
|
|
291
|
+
}
|
|
292
|
+
disconnectedCallback() {
|
|
293
|
+
super.disconnectedCallback();
|
|
294
|
+
if (this._labelNode) {
|
|
295
|
+
this._labelNode.removeEventListener('click', this._onLabelClick);
|
|
139
296
|
}
|
|
297
|
+
}
|
|
140
298
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
return /** @type {HTMLElement} */ (this.__getDirectSlotChild('label'));
|
|
299
|
+
/** @param {import('lit').PropertyValues } changedProperties */
|
|
300
|
+
updated(changedProperties) {
|
|
301
|
+
super.updated(changedProperties);
|
|
302
|
+
if (changedProperties.has('disabled')) {
|
|
303
|
+
this._inputNode?.setAttribute('aria-disabled', `${Boolean(this.disabled)}`);
|
|
147
304
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
* Element where help text will be rendered to
|
|
151
|
-
* @protected
|
|
152
|
-
*/
|
|
153
|
-
get _helpTextNode() {
|
|
154
|
-
return /** @type {HTMLElement} */ (this.__getDirectSlotChild('help-text'));
|
|
305
|
+
if (changedProperties.has('_ariaLabelledNodes')) {
|
|
306
|
+
this.__reflectAriaAttr('aria-labelledby', this._ariaLabelledNodes, this.__reorderAriaLabelledNodes);
|
|
155
307
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
* Element where validation feedback will be rendered to
|
|
159
|
-
* @protected
|
|
160
|
-
*/
|
|
161
|
-
get _feedbackNode() {
|
|
162
|
-
return /** @type {LionValidationFeedback} */ (this.__getDirectSlotChild('feedback'));
|
|
308
|
+
if (changedProperties.has('_ariaDescribedNodes')) {
|
|
309
|
+
this.__reflectAriaAttr('aria-describedby', this._ariaDescribedNodes, this.__reorderAriaDescribedNodes);
|
|
163
310
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
* TODO: check if this is a false positive or if we can improve
|
|
167
|
-
* @configure ReactiveElement
|
|
168
|
-
*/
|
|
169
|
-
// @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
|
|
170
|
-
static enabledWarnings = super.enabledWarnings?.filter(w => w !== 'change-in-update') || [];
|
|
171
|
-
|
|
172
|
-
// N.B. add these label/helpText props for types + ce manifest output
|
|
173
|
-
// (explicity setting them to undefined does not have desired result)
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* The label text for the input node.
|
|
177
|
-
* When no value is defined, textContent of [slot=label] will be used
|
|
178
|
-
* @property {string} label
|
|
179
|
-
*/
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* The helpt text for the input node.
|
|
183
|
-
* When no value is defined, textContent of [slot=help-text] will be used
|
|
184
|
-
* @property {string} helpText
|
|
185
|
-
*/
|
|
186
|
-
|
|
187
|
-
constructor() {
|
|
188
|
-
super();
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* A Boolean attribute which, if present, indicates that the user should not be able to edit
|
|
192
|
-
* the value of the input. The difference between disabled and readonly is that read-only
|
|
193
|
-
* controls can still function, whereas disabled controls generally do not function as
|
|
194
|
-
* controls until they are enabled.
|
|
195
|
-
* (From: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly)
|
|
196
|
-
* @type {boolean}
|
|
197
|
-
*/
|
|
198
|
-
this.readOnly = false;
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* The label will only be visible for srceen readers when true
|
|
202
|
-
* @type {boolean}
|
|
203
|
-
*/
|
|
204
|
-
this.labelSrOnly = false;
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* The model value is the result of the parser function(when available).
|
|
208
|
-
* It should be considered as the internal value used for validation and reasoning/logic.
|
|
209
|
-
* The model value is 'ready for consumption' by the outside world (think of a Date
|
|
210
|
-
* object or a float). The modelValue can(and is recommended to) be used as both input
|
|
211
|
-
* value and output value of the `LionField`.
|
|
212
|
-
*
|
|
213
|
-
* Examples:
|
|
214
|
-
* - For a date input: a String '20/01/1999' will be converted to new Date('1999/01/20')
|
|
215
|
-
* - For a number input: a formatted String '1.234,56' will be converted to a Number:
|
|
216
|
-
* 1234.56
|
|
217
|
-
*/
|
|
218
|
-
// TODO: we can probably set this up properly once propert effects run from firstUpdated
|
|
219
|
-
// this.modelValue = undefined;
|
|
220
|
-
/**
|
|
221
|
-
* Unique id that can be used in all light dom
|
|
222
|
-
* @type {string}
|
|
223
|
-
* @protected
|
|
224
|
-
*/
|
|
225
|
-
this._inputId = uuid(this.localName);
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Contains all elements that should end up in aria-labelledby of `._inputNode`
|
|
229
|
-
* @type {HTMLElement[]}
|
|
230
|
-
*/
|
|
231
|
-
this._ariaLabelledNodes = [];
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Contains all elements that should end up in aria-describedby of `._inputNode`
|
|
235
|
-
* @type {HTMLElement[]}
|
|
236
|
-
*/
|
|
237
|
-
this._ariaDescribedNodes = [];
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* Based on the role, details of handling model-value-changed repropagation differ.
|
|
241
|
-
* @type {'child'|'choice-group'|'fieldset'}
|
|
242
|
-
*/
|
|
243
|
-
this._repropagationRole = 'child';
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* By default, a field with _repropagationRole 'choice-group' will act as an
|
|
247
|
-
* 'endpoint'. This means it will be considered as an individual field: for
|
|
248
|
-
* a select, individual options will not be part of the formPath. They
|
|
249
|
-
* will.
|
|
250
|
-
* Similarly, components that (a11y wise) need to be fieldsets, but 'interaction wise'
|
|
251
|
-
* (from Application Developer perspective) need to be more like fields
|
|
252
|
-
* (think of an amount-input with a currency select box next to it), can set this
|
|
253
|
-
* to true to hide private internals in the formPath.
|
|
254
|
-
* @type {boolean}
|
|
255
|
-
*/
|
|
256
|
-
this._isRepropagationEndpoint = false;
|
|
257
|
-
|
|
258
|
-
this.addEventListener(
|
|
259
|
-
'model-value-changed',
|
|
260
|
-
/** @type {EventListenerOrEventListenerObject} */ (this.__repropagateChildrenValues),
|
|
261
|
-
);
|
|
262
|
-
/** @type {EventListener} */
|
|
263
|
-
this._onLabelClick = this._onLabelClick.bind(this);
|
|
311
|
+
if (changedProperties.has('label') && this.__label !== undefined && this._labelNode) {
|
|
312
|
+
this._labelNode.textContent = this.label;
|
|
264
313
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
super.connectedCallback();
|
|
268
|
-
this._enhanceLightDomClasses();
|
|
269
|
-
this._enhanceLightDomA11y();
|
|
270
|
-
this._triggerInitialModelValueChangedEvent();
|
|
271
|
-
|
|
272
|
-
if (this._labelNode) {
|
|
273
|
-
this._labelNode.addEventListener('click', this._onLabelClick);
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
disconnectedCallback() {
|
|
278
|
-
super.disconnectedCallback();
|
|
279
|
-
if (this._labelNode) {
|
|
280
|
-
this._labelNode.removeEventListener('click', this._onLabelClick);
|
|
281
|
-
}
|
|
314
|
+
if (changedProperties.has('helpText') && this.__helpText !== undefined && this._helpTextNode) {
|
|
315
|
+
this._helpTextNode.textContent = this.helpText;
|
|
282
316
|
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
new CustomEvent('form-element-name-changed', {
|
|
324
|
-
detail: { oldName: changedProperties.get('name'), newName: this.name },
|
|
325
|
-
bubbles: true,
|
|
326
|
-
}),
|
|
327
|
-
);
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
/** @protected */
|
|
332
|
-
_triggerInitialModelValueChangedEvent() {
|
|
333
|
-
this._dispatchInitialModelValueChangedEvent();
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
/** @protected */
|
|
337
|
-
_enhanceLightDomClasses() {
|
|
338
|
-
if (this._inputNode) {
|
|
339
|
-
this._inputNode.classList.add('form-control');
|
|
340
|
-
}
|
|
317
|
+
if (changedProperties.has('name')) {
|
|
318
|
+
this.dispatchEvent(/** @privateEvent */
|
|
319
|
+
new CustomEvent('form-element-name-changed', {
|
|
320
|
+
detail: {
|
|
321
|
+
oldName: changedProperties.get('name'),
|
|
322
|
+
newName: this.name
|
|
323
|
+
},
|
|
324
|
+
bubbles: true
|
|
325
|
+
}));
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/** @protected */
|
|
330
|
+
_triggerInitialModelValueChangedEvent() {
|
|
331
|
+
this._dispatchInitialModelValueChangedEvent();
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/** @protected */
|
|
335
|
+
_enhanceLightDomClasses() {
|
|
336
|
+
if (this._inputNode) {
|
|
337
|
+
this._inputNode.classList.add('form-control');
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/** @protected */
|
|
342
|
+
_enhanceLightDomA11y() {
|
|
343
|
+
const {
|
|
344
|
+
_inputNode,
|
|
345
|
+
_labelNode,
|
|
346
|
+
_helpTextNode,
|
|
347
|
+
_feedbackNode
|
|
348
|
+
} = this;
|
|
349
|
+
if (_inputNode) {
|
|
350
|
+
_inputNode.id = _inputNode.id || this._inputId;
|
|
351
|
+
}
|
|
352
|
+
if (_labelNode) {
|
|
353
|
+
_labelNode.setAttribute('for', this._inputId);
|
|
354
|
+
this.addToAriaLabelledBy(_labelNode, {
|
|
355
|
+
idPrefix: 'label'
|
|
356
|
+
});
|
|
341
357
|
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
if (_inputNode) {
|
|
348
|
-
_inputNode.id = _inputNode.id || this._inputId;
|
|
349
|
-
}
|
|
350
|
-
if (_labelNode) {
|
|
351
|
-
_labelNode.setAttribute('for', this._inputId);
|
|
352
|
-
this.addToAriaLabelledBy(_labelNode, { idPrefix: 'label' });
|
|
353
|
-
}
|
|
354
|
-
if (_helpTextNode) {
|
|
355
|
-
this.addToAriaDescribedBy(_helpTextNode, { idPrefix: 'help-text' });
|
|
356
|
-
}
|
|
357
|
-
if (_feedbackNode) {
|
|
358
|
-
// Generic focus/blur handling that works for both Fields/FormGroups
|
|
359
|
-
this.addEventListener('focusin', () => {
|
|
360
|
-
_feedbackNode.setAttribute('aria-live', 'polite');
|
|
361
|
-
});
|
|
362
|
-
this.addEventListener('focusout', () => {
|
|
363
|
-
_feedbackNode.setAttribute('aria-live', 'assertive');
|
|
364
|
-
});
|
|
365
|
-
|
|
366
|
-
this.addToAriaDescribedBy(_feedbackNode, { idPrefix: 'feedback' });
|
|
367
|
-
}
|
|
368
|
-
this._enhanceLightDomA11yForAdditionalSlots();
|
|
358
|
+
if (_helpTextNode) {
|
|
359
|
+
this.addToAriaDescribedBy(_helpTextNode, {
|
|
360
|
+
idPrefix: 'help-text'
|
|
361
|
+
});
|
|
369
362
|
}
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
additionalSlots = ['prefix', 'suffix', 'before', 'after'],
|
|
381
|
-
) {
|
|
382
|
-
additionalSlots.forEach(additionalSlot => {
|
|
383
|
-
const element = this.__getDirectSlotChild(additionalSlot);
|
|
384
|
-
if (element) {
|
|
385
|
-
if (element.hasAttribute('data-label')) {
|
|
386
|
-
this.addToAriaLabelledBy(element, { idPrefix: additionalSlot });
|
|
387
|
-
}
|
|
388
|
-
if (element.hasAttribute('data-description')) {
|
|
389
|
-
this.addToAriaDescribedBy(element, { idPrefix: additionalSlot });
|
|
390
|
-
}
|
|
391
|
-
}
|
|
363
|
+
if (_feedbackNode) {
|
|
364
|
+
// Generic focus/blur handling that works for both Fields/FormGroups
|
|
365
|
+
this.addEventListener('focusin', () => {
|
|
366
|
+
_feedbackNode.setAttribute('aria-live', 'polite');
|
|
367
|
+
});
|
|
368
|
+
this.addEventListener('focusout', () => {
|
|
369
|
+
_feedbackNode.setAttribute('aria-live', 'assertive');
|
|
370
|
+
});
|
|
371
|
+
this.addToAriaDescribedBy(_feedbackNode, {
|
|
372
|
+
idPrefix: 'feedback'
|
|
392
373
|
});
|
|
393
374
|
}
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
if (assignedNode.name === node.slot) {
|
|
418
|
-
orderedInsideNodes.push(node);
|
|
419
|
-
}
|
|
420
|
-
});
|
|
375
|
+
this._enhanceLightDomA11yForAdditionalSlots();
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Enhances additional slots(prefix, suffix, before, after) defined by developer.
|
|
380
|
+
*
|
|
381
|
+
* When boolean attribute data-label or data-description is found,
|
|
382
|
+
* the slot element will be connected to the input via aria-labelledby or aria-describedby
|
|
383
|
+
* @param {string[]} additionalSlots
|
|
384
|
+
* @protected
|
|
385
|
+
*/
|
|
386
|
+
_enhanceLightDomA11yForAdditionalSlots(additionalSlots = ['prefix', 'suffix', 'before', 'after']) {
|
|
387
|
+
additionalSlots.forEach(additionalSlot => {
|
|
388
|
+
const element = this.__getDirectSlotChild(additionalSlot);
|
|
389
|
+
if (element) {
|
|
390
|
+
if (element.hasAttribute('data-label')) {
|
|
391
|
+
this.addToAriaLabelledBy(element, {
|
|
392
|
+
idPrefix: additionalSlot
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
if (element.hasAttribute('data-description')) {
|
|
396
|
+
this.addToAriaDescribedBy(element, {
|
|
397
|
+
idPrefix: additionalSlot
|
|
421
398
|
});
|
|
422
|
-
// eslint-disable-next-line no-param-reassign
|
|
423
|
-
nodes = [...orderedInsideNodes, ...outsideNodes];
|
|
424
399
|
}
|
|
425
|
-
const string = nodes.map(n => n.id).join(' ');
|
|
426
|
-
this._inputNode.setAttribute(attrName, string);
|
|
427
400
|
}
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Will handle help text, validation feedback and character counter,
|
|
406
|
+
* prefix/suffix/before/after (if they contain data-description flag attr).
|
|
407
|
+
* Also, contents of id references that will be put in the <lion-field>._ariaDescribedby property
|
|
408
|
+
* from an external context, will be read by a screen reader.
|
|
409
|
+
* @param {string} attrName
|
|
410
|
+
* @param {Element[]} nodes
|
|
411
|
+
* @param {boolean|undefined} reorder
|
|
412
|
+
*/
|
|
413
|
+
__reflectAriaAttr(attrName, nodes, reorder) {
|
|
414
|
+
if (this._inputNode) {
|
|
415
|
+
if (reorder) {
|
|
416
|
+
const insideNodes = nodes.filter(n => this.contains(n));
|
|
417
|
+
const outsideNodes = nodes.filter(n => !this.contains(n));
|
|
418
|
+
const insideSlots = insideNodes.map(n => n.assignedSlot || n);
|
|
419
|
+
const orderedInsideSlots = [...getAriaElementsInRightDomOrder(insideSlots)];
|
|
420
|
+
/** @type {Element[]} */
|
|
421
|
+
const orderedInsideNodes = [];
|
|
422
|
+
orderedInsideSlots.forEach(assignedNode => {
|
|
423
|
+
insideNodes.forEach(node => {
|
|
424
|
+
// @ts-ignore
|
|
425
|
+
if (assignedNode.name === node.slot) {
|
|
426
|
+
orderedInsideNodes.push(node);
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
});
|
|
430
|
+
// eslint-disable-next-line no-param-reassign
|
|
431
|
+
nodes = [...orderedInsideNodes, ...outsideNodes];
|
|
432
|
+
}
|
|
433
|
+
const string = nodes.map(n => n.id).join(' ');
|
|
434
|
+
this._inputNode.setAttribute(attrName, string);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* Default Render Result:
|
|
440
|
+
* <div class="form-field__group-one">
|
|
441
|
+
* <div class="form-field__label">
|
|
442
|
+
* <slot name="label"></slot>
|
|
443
|
+
* </div>
|
|
444
|
+
* <small class="form-field__help-text">
|
|
445
|
+
* <slot name="help-text"></slot>
|
|
446
|
+
* </small>
|
|
447
|
+
* </div>
|
|
448
|
+
* <div class="form-field__group-two">
|
|
449
|
+
* <div class="input-group">
|
|
450
|
+
* <div class="input-group__before">
|
|
451
|
+
* <slot name="before"></slot>
|
|
452
|
+
* </div>
|
|
453
|
+
* <div class="input-group__container">
|
|
454
|
+
* <div class="input-group__prefix">
|
|
455
|
+
* <slot name="prefix"></slot>
|
|
456
|
+
* </div>
|
|
457
|
+
* <div class="input-group__input">
|
|
458
|
+
* <slot name="input"></slot>
|
|
459
|
+
* </div>
|
|
460
|
+
* <div class="input-group__suffix">
|
|
461
|
+
* <slot name="suffix"></slot>
|
|
462
|
+
* </div>
|
|
463
|
+
* </div>
|
|
464
|
+
* <div class="input-group__after">
|
|
465
|
+
* <slot name="after"></slot>
|
|
466
|
+
* </div>
|
|
467
|
+
* </div>
|
|
468
|
+
* <div class="form-field__feedback">
|
|
469
|
+
* <slot name="feedback"></slot>
|
|
470
|
+
* </div>
|
|
471
|
+
* </div>
|
|
472
|
+
*/
|
|
473
|
+
render() {
|
|
474
|
+
return html`
|
|
467
475
|
<div class="form-field__group-one">${this._groupOneTemplate()}</div>
|
|
468
476
|
<div class="form-field__group-two">${this._groupTwoTemplate()}</div>
|
|
469
477
|
`;
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* @return {TemplateResult}
|
|
482
|
+
* @protected
|
|
483
|
+
*/
|
|
484
|
+
_groupOneTemplate() {
|
|
485
|
+
return html` ${this._labelTemplate()} ${this._helpTextTemplate()} `;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* @return {TemplateResult}
|
|
490
|
+
* @protected
|
|
491
|
+
*/
|
|
492
|
+
_groupTwoTemplate() {
|
|
493
|
+
return html` ${this._inputGroupTemplate()} ${this._feedbackTemplate()} `;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* @return {TemplateResult}
|
|
498
|
+
* @protected
|
|
499
|
+
*/
|
|
500
|
+
// eslint-disable-next-line class-methods-use-this
|
|
501
|
+
_labelTemplate() {
|
|
502
|
+
return html`
|
|
495
503
|
<div class="form-field__label">
|
|
496
504
|
<slot name="label"></slot>
|
|
497
505
|
</div>
|
|
498
506
|
`;
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* @return {TemplateResult}
|
|
511
|
+
* @protected
|
|
512
|
+
*/
|
|
513
|
+
// eslint-disable-next-line class-methods-use-this
|
|
514
|
+
_helpTextTemplate() {
|
|
515
|
+
return html`
|
|
508
516
|
<small class="form-field__help-text">
|
|
509
517
|
<slot name="help-text"></slot>
|
|
510
518
|
</small>
|
|
511
519
|
`;
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* @return {TemplateResult}
|
|
524
|
+
* @protected
|
|
525
|
+
*/
|
|
526
|
+
_inputGroupTemplate() {
|
|
527
|
+
return html`
|
|
520
528
|
<div class="input-group">
|
|
521
529
|
${this._inputGroupBeforeTemplate()}
|
|
522
530
|
<div class="input-group__container">
|
|
@@ -526,188 +534,182 @@ const FormControlMixinImplementation = /** @type {FormControlMixin} */ (supercla
|
|
|
526
534
|
${this._inputGroupAfterTemplate()}
|
|
527
535
|
</div>
|
|
528
536
|
`;
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* @return {TemplateResult}
|
|
541
|
+
* @protected
|
|
542
|
+
*/
|
|
543
|
+
// eslint-disable-next-line class-methods-use-this
|
|
544
|
+
_inputGroupBeforeTemplate() {
|
|
545
|
+
return html`
|
|
538
546
|
<div class="input-group__before">
|
|
539
547
|
<slot name="before"></slot>
|
|
540
548
|
</div>
|
|
541
549
|
`;
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
? nothing
|
|
551
|
-
: html`
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* @return {TemplateResult | typeof nothing}
|
|
554
|
+
* @protected
|
|
555
|
+
*/
|
|
556
|
+
_inputGroupPrefixTemplate() {
|
|
557
|
+
return !Array.from(this.children).find(child => child.slot === 'prefix') ? nothing : html`
|
|
552
558
|
<div class="input-group__prefix">
|
|
553
559
|
<slot name="prefix"></slot>
|
|
554
560
|
</div>
|
|
555
561
|
`;
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* @return {TemplateResult}
|
|
566
|
+
* @protected
|
|
567
|
+
*/
|
|
568
|
+
// eslint-disable-next-line class-methods-use-this
|
|
569
|
+
_inputGroupInputTemplate() {
|
|
570
|
+
return html`
|
|
565
571
|
<div class="input-group__input">
|
|
566
572
|
<slot name="input"></slot>
|
|
567
573
|
</div>
|
|
568
574
|
`;
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
? nothing
|
|
578
|
-
: html`
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* @return {TemplateResult | typeof nothing}
|
|
579
|
+
* @protected
|
|
580
|
+
*/
|
|
581
|
+
_inputGroupSuffixTemplate() {
|
|
582
|
+
return !Array.from(this.children).find(child => child.slot === 'suffix') ? nothing : html`
|
|
579
583
|
<div class="input-group__suffix">
|
|
580
584
|
<slot name="suffix"></slot>
|
|
581
585
|
</div>
|
|
582
586
|
`;
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* @return {TemplateResult}
|
|
591
|
+
* @protected
|
|
592
|
+
*/
|
|
593
|
+
// eslint-disable-next-line class-methods-use-this
|
|
594
|
+
_inputGroupAfterTemplate() {
|
|
595
|
+
return html`
|
|
592
596
|
<div class="input-group__after">
|
|
593
597
|
<slot name="after"></slot>
|
|
594
598
|
</div>
|
|
595
599
|
`;
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* @return {TemplateResult}
|
|
604
|
+
* @protected
|
|
605
|
+
*/
|
|
606
|
+
// eslint-disable-next-line class-methods-use-this
|
|
607
|
+
_feedbackTemplate() {
|
|
608
|
+
return html`
|
|
605
609
|
<div class="form-field__feedback">
|
|
606
610
|
<slot name="feedback"></slot>
|
|
607
611
|
</div>
|
|
608
612
|
`;
|
|
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
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
return [
|
|
710
|
-
css`
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* Used for Required validation and computation of interaction states
|
|
617
|
+
* @param {any} modelValue
|
|
618
|
+
* @return {boolean}
|
|
619
|
+
* @protected
|
|
620
|
+
*/
|
|
621
|
+
_isEmpty(modelValue = /** @type {any} */this.modelValue) {
|
|
622
|
+
let value = modelValue;
|
|
623
|
+
if (/** @type {any} */this.modelValue instanceof Unparseable) {
|
|
624
|
+
value = /** @type {any} */this.modelValue.viewValue;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
// Checks for empty platform types: Objects, Arrays, Dates
|
|
628
|
+
if (typeof value === 'object' && value !== null && !(value instanceof Date)) {
|
|
629
|
+
return !Object.keys(value).length;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
// eslint-disable-next-line no-mixed-operators
|
|
633
|
+
// Checks for empty platform types: Numbers, Booleans
|
|
634
|
+
const isNumberValue = typeof value === 'number' && (value === 0 || Number.isNaN(value));
|
|
635
|
+
const isBooleanValue = typeof value === 'boolean' && value === false;
|
|
636
|
+
return !value && !isNumberValue && !isBooleanValue;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* All CSS below is written from a generic mindset, following BEM conventions:
|
|
641
|
+
* https://en.bem.info/methodology/
|
|
642
|
+
* Although the CSS and HTML are implemented by the component, they should be regarded as
|
|
643
|
+
* totally decoupled.
|
|
644
|
+
*
|
|
645
|
+
* Not only does this force us to write better structured css, it also allows for future
|
|
646
|
+
* reusability in many different ways like:
|
|
647
|
+
* - disabling shadow DOM for a component (for water proof encapsulation can be combined with
|
|
648
|
+
* a build step)
|
|
649
|
+
* - easier translation to more flexible, WebComponents agnostic solutions like JSS
|
|
650
|
+
* (allowing extends, mixins, reasoning, IDE integration, tree shaking etc.)
|
|
651
|
+
* - export to a CSS module for reuse in an outer context
|
|
652
|
+
*
|
|
653
|
+
*
|
|
654
|
+
* Please note that the HTML structure is purposely 'loose', allowing multiple design systems
|
|
655
|
+
* to be compatible
|
|
656
|
+
* with the CSS component.
|
|
657
|
+
* Note that every occurence of '::slotted(*)' can be rewritten to '> *' for use in an other
|
|
658
|
+
* context
|
|
659
|
+
*/
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* {block} .form-field
|
|
663
|
+
*
|
|
664
|
+
* Structure:
|
|
665
|
+
* - {element} .form-field__label : a wrapper element around the projected label
|
|
666
|
+
* - {element} .form-field__help-text (optional) : a wrapper element around the projected
|
|
667
|
+
* help-text
|
|
668
|
+
* - {block} .input-group : a container around the input element, including prefixes and
|
|
669
|
+
* suffixes
|
|
670
|
+
* - {element} .form-field__feedback (optional) : a wrapper element around the projected
|
|
671
|
+
* (validation) feedback message
|
|
672
|
+
*
|
|
673
|
+
* Modifiers:
|
|
674
|
+
* - {state} [disabled] when .form-control (<input>, <textarea> etc.) has disabled set
|
|
675
|
+
* to true
|
|
676
|
+
* - {state} [filled] whether <input> has a value
|
|
677
|
+
* - {state} [touched] whether the user had blurred the field once
|
|
678
|
+
* - {state} [dirty] whether the value has changed since initial value
|
|
679
|
+
*
|
|
680
|
+
* TODO: update states below
|
|
681
|
+
* These classes are now attributes. Check them agains the new attribute names inside ValidateMixin
|
|
682
|
+
* and InteractionStateMixin. Some states got renamed. Make sure to use the correct ones!
|
|
683
|
+
* - {state} .state-focused: when .form-control (<input>, <textarea> etc.) <input> has focus
|
|
684
|
+
* - {state} .state-invalid: when input has error(s) (regardless of whether they should be
|
|
685
|
+
* shown to the user)
|
|
686
|
+
* - {state} .state-error: when input has error(s) and this/these should be shown to the user
|
|
687
|
+
* - {state} .state-warning: when input has warning(s) and this/these should be shown to the
|
|
688
|
+
* user
|
|
689
|
+
* - {state} .state-info: when input has info feedback message(s) and this/these should be shown
|
|
690
|
+
* to the user
|
|
691
|
+
* - {state} .state-success: when input has success feedback message(s) and this/these should be
|
|
692
|
+
* shown to the user
|
|
693
|
+
*/
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* {block} .input-group
|
|
697
|
+
*
|
|
698
|
+
* Structure:
|
|
699
|
+
* - {element} .input-group__before (optional) : a prefix that resides outside the container
|
|
700
|
+
* - {element} .input-group__container : an inner container: this element contains all styling
|
|
701
|
+
* - {element} .input-group__prefix (optional) : a prefix that resides in the container,
|
|
702
|
+
* allowing it to be detectable as a :first-child
|
|
703
|
+
* - {element} .input-group__input : a wrapper around the form-control component
|
|
704
|
+
* - {block} .form-control : the actual input element (input/select/textarea)
|
|
705
|
+
* - {element} .input-group__suffix (optional) : a suffix that resides inside the container,
|
|
706
|
+
* allowing it to be detectable as a :last-child
|
|
707
|
+
* - {element} .input-group__bottom (optional) : placeholder element for additional styling
|
|
708
|
+
* (like an animated line for material design input)
|
|
709
|
+
* - {element} .input-group__after (optional) : a suffix that resides outside the container
|
|
710
|
+
*/
|
|
711
|
+
static get styles() {
|
|
712
|
+
return [css`
|
|
711
713
|
/**********************
|
|
712
714
|
{block} .form-field
|
|
713
715
|
********************/
|
|
@@ -770,223 +772,219 @@ const FormControlMixinImplementation = /** @type {FormControlMixin} */ (supercla
|
|
|
770
772
|
margin: 0; /* remove input margin in Safari */
|
|
771
773
|
font-size: 100%; /* normalize default input font-size */
|
|
772
774
|
}
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
/**
|
|
805
|
-
* Allows to remove element references from aria-labelledby attribute.
|
|
806
|
-
* @param {HTMLElement} element
|
|
807
|
-
*/
|
|
808
|
-
removeFromAriaLabelledBy(element) {
|
|
809
|
-
if (this._ariaLabelledNodes.includes(element)) {
|
|
810
|
-
this._ariaLabelledNodes.splice(this._ariaLabelledNodes.indexOf(element), 1);
|
|
811
|
-
this._ariaLabelledNodes = [...this._ariaLabelledNodes];
|
|
812
|
-
// This value will be read when we need to reflect to attr
|
|
813
|
-
/** @type {boolean} */
|
|
814
|
-
this.__reorderAriaLabelledNodes = false;
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
/**
|
|
819
|
-
* Allows to add element references to aria-describedby attribute.
|
|
820
|
-
* @param {HTMLElement} element
|
|
821
|
-
* @param {{idPrefix?:string; reorder?: boolean}} customConfig
|
|
822
|
-
*/
|
|
823
|
-
addToAriaDescribedBy(element, { idPrefix = '', reorder = true } = {}) {
|
|
824
|
-
// eslint-disable-next-line no-param-reassign
|
|
825
|
-
element.id = element.id || `${idPrefix}-${this._inputId}`;
|
|
826
|
-
if (!this._ariaDescribedNodes.includes(element)) {
|
|
827
|
-
this._ariaDescribedNodes = [...this._ariaDescribedNodes, element];
|
|
828
|
-
// This value will be read when we need to reflect to attr
|
|
829
|
-
/** @type {boolean} */
|
|
830
|
-
this.__reorderAriaDescribedNodes = Boolean(reorder);
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
/**
|
|
835
|
-
* Allows to remove element references from aria-describedby attribute.
|
|
836
|
-
* @param {HTMLElement} element
|
|
837
|
-
*/
|
|
838
|
-
removeFromAriaDescribedBy(element) {
|
|
839
|
-
if (this._ariaDescribedNodes.includes(element)) {
|
|
840
|
-
this._ariaDescribedNodes.splice(this._ariaDescribedNodes.indexOf(element), 1);
|
|
841
|
-
this._ariaDescribedNodes = [...this._ariaDescribedNodes];
|
|
842
|
-
// This value will be read when we need to reflect to attr
|
|
843
|
-
/** @type {boolean} */
|
|
844
|
-
this.__reorderAriaLabelledNodes = false;
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
/**
|
|
849
|
-
* @param {string} slotName
|
|
850
|
-
* @return {HTMLElement | undefined}
|
|
851
|
-
*/
|
|
852
|
-
__getDirectSlotChild(slotName) {
|
|
853
|
-
return /** @type {HTMLElement[]} */ (Array.from(this.children)).find(
|
|
854
|
-
el => el.slot === slotName,
|
|
855
|
-
);
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
_dispatchInitialModelValueChangedEvent() {
|
|
859
|
-
// When we are not a fieldset / choice-group, we don't need to wait for our children
|
|
860
|
-
// to send a unified event
|
|
861
|
-
if (this._repropagationRole === 'child') {
|
|
862
|
-
return;
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
// Initially we don't repropagate model-value-changed events coming
|
|
866
|
-
// from children. On firstUpdated we re-dispatch this event to maintain
|
|
867
|
-
// 'count consistency' (to not confuse the application developer with a
|
|
868
|
-
// large number of initial events). Initially the source field will not
|
|
869
|
-
// be part of the formPath but afterwards it will.
|
|
775
|
+
`];
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
/**
|
|
779
|
+
* This function exposes descripion elements that a FormGroup should expose to its
|
|
780
|
+
* children. See FormGroupMixin.__getAllDescriptionElementsInParentChain()
|
|
781
|
+
* @return {Array.<HTMLElement>}
|
|
782
|
+
* @protected
|
|
783
|
+
*/
|
|
784
|
+
// Returns dom references to all elements that should be referred to by field(s)
|
|
785
|
+
_getAriaDescriptionElements() {
|
|
786
|
+
return [this._helpTextNode, this._feedbackNode];
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
/**
|
|
790
|
+
* Allows to add extra element references to aria-labelledby attribute.
|
|
791
|
+
* @param {HTMLElement} element
|
|
792
|
+
* @param {{idPrefix?:string; reorder?: boolean}} customConfig
|
|
793
|
+
*/
|
|
794
|
+
addToAriaLabelledBy(element, {
|
|
795
|
+
idPrefix = '',
|
|
796
|
+
reorder = true
|
|
797
|
+
} = {}) {
|
|
798
|
+
// eslint-disable-next-line no-param-reassign
|
|
799
|
+
element.id = element.id || `${idPrefix}-${this._inputId}`;
|
|
800
|
+
if (!this._ariaLabelledNodes.includes(element)) {
|
|
801
|
+
this._ariaLabelledNodes = [...this._ariaLabelledNodes, element];
|
|
802
|
+
// This value will be read when we need to reflect to attr
|
|
870
803
|
/** @type {boolean} */
|
|
871
|
-
this.
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
);
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
//
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
804
|
+
this.__reorderAriaLabelledNodes = Boolean(reorder);
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
/**
|
|
809
|
+
* Allows to remove element references from aria-labelledby attribute.
|
|
810
|
+
* @param {HTMLElement} element
|
|
811
|
+
*/
|
|
812
|
+
removeFromAriaLabelledBy(element) {
|
|
813
|
+
if (this._ariaLabelledNodes.includes(element)) {
|
|
814
|
+
this._ariaLabelledNodes.splice(this._ariaLabelledNodes.indexOf(element), 1);
|
|
815
|
+
this._ariaLabelledNodes = [...this._ariaLabelledNodes];
|
|
816
|
+
// This value will be read when we need to reflect to attr
|
|
817
|
+
/** @type {boolean} */
|
|
818
|
+
this.__reorderAriaLabelledNodes = false;
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
/**
|
|
823
|
+
* Allows to add element references to aria-describedby attribute.
|
|
824
|
+
* @param {HTMLElement} element
|
|
825
|
+
* @param {{idPrefix?:string; reorder?: boolean}} customConfig
|
|
826
|
+
*/
|
|
827
|
+
addToAriaDescribedBy(element, {
|
|
828
|
+
idPrefix = '',
|
|
829
|
+
reorder = true
|
|
830
|
+
} = {}) {
|
|
831
|
+
// eslint-disable-next-line no-param-reassign
|
|
832
|
+
element.id = element.id || `${idPrefix}-${this._inputId}`;
|
|
833
|
+
if (!this._ariaDescribedNodes.includes(element)) {
|
|
834
|
+
this._ariaDescribedNodes = [...this._ariaDescribedNodes, element];
|
|
835
|
+
// This value will be read when we need to reflect to attr
|
|
836
|
+
/** @type {boolean} */
|
|
837
|
+
this.__reorderAriaDescribedNodes = Boolean(reorder);
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* Allows to remove element references from aria-describedby attribute.
|
|
843
|
+
* @param {HTMLElement} element
|
|
844
|
+
*/
|
|
845
|
+
removeFromAriaDescribedBy(element) {
|
|
846
|
+
if (this._ariaDescribedNodes.includes(element)) {
|
|
847
|
+
this._ariaDescribedNodes.splice(this._ariaDescribedNodes.indexOf(element), 1);
|
|
848
|
+
this._ariaDescribedNodes = [...this._ariaDescribedNodes];
|
|
849
|
+
// This value will be read when we need to reflect to attr
|
|
850
|
+
/** @type {boolean} */
|
|
851
|
+
this.__reorderAriaLabelledNodes = false;
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
/**
|
|
856
|
+
* @param {string} slotName
|
|
857
|
+
* @return {HTMLElement | undefined}
|
|
858
|
+
*/
|
|
859
|
+
__getDirectSlotChild(slotName) {
|
|
860
|
+
return /** @type {HTMLElement[]} */Array.from(this.children).find(el => el.slot === slotName);
|
|
861
|
+
}
|
|
862
|
+
_dispatchInitialModelValueChangedEvent() {
|
|
863
|
+
// When we are not a fieldset / choice-group, we don't need to wait for our children
|
|
864
|
+
// to send a unified event
|
|
865
|
+
if (this._repropagationRole === 'child') {
|
|
866
|
+
return;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
// Initially we don't repropagate model-value-changed events coming
|
|
870
|
+
// from children. On firstUpdated we re-dispatch this event to maintain
|
|
871
|
+
// 'count consistency' (to not confuse the application developer with a
|
|
872
|
+
// large number of initial events). Initially the source field will not
|
|
873
|
+
// be part of the formPath but afterwards it will.
|
|
874
|
+
/** @type {boolean} */
|
|
875
|
+
this.__repropagateChildrenInitialized = true;
|
|
876
|
+
this.dispatchEvent(new CustomEvent('model-value-changed', {
|
|
877
|
+
bubbles: true,
|
|
878
|
+
detail: (/** @type {ModelValueEventDetails} */{
|
|
879
|
+
formPath: [this],
|
|
880
|
+
initialize: true,
|
|
881
|
+
isTriggeredByUser: false
|
|
882
|
+
})
|
|
883
|
+
}));
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
/**
|
|
887
|
+
* Hook for Subclassers to add logic before repropagation
|
|
888
|
+
* @configurable
|
|
889
|
+
* @param {CustomEvent} ev
|
|
890
|
+
* @protected
|
|
891
|
+
*/
|
|
892
|
+
// eslint-disable-next-line class-methods-use-this, no-unused-vars
|
|
893
|
+
_onBeforeRepropagateChildrenValues(ev) {}
|
|
894
|
+
|
|
895
|
+
/**
|
|
896
|
+
* @param {CustomEvent} ev
|
|
897
|
+
*/
|
|
898
|
+
__repropagateChildrenValues(ev) {
|
|
899
|
+
// Allows sub classes to internally listen to the children change events
|
|
900
|
+
// (before stopImmediatePropagation is called below).
|
|
901
|
+
this._onBeforeRepropagateChildrenValues(ev);
|
|
902
|
+
// Normalize target, we also might get it from 'portals' (rich select)
|
|
903
|
+
const target = ev.detail && ev.detail.element || ev.target;
|
|
904
|
+
const isEndpoint = this._isRepropagationEndpoint || this._repropagationRole === 'choice-group';
|
|
905
|
+
|
|
906
|
+
// Prevent eternal loops after we sent the event below.
|
|
907
|
+
if (target === this) {
|
|
908
|
+
return;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
// A. Stop sibling handlers
|
|
912
|
+
//
|
|
913
|
+
// Make sure our sibling event listeners (added by Application developers) will not get
|
|
914
|
+
// the child model-value-changed event, but the repropagated one at the bottom of this
|
|
915
|
+
// method
|
|
916
|
+
ev.stopImmediatePropagation();
|
|
917
|
+
|
|
918
|
+
// B1. Are we still initializing? If so, halt...
|
|
919
|
+
//
|
|
920
|
+
// Stop repropagating children events before firstUpdated and make sure we de not
|
|
921
|
+
// repropagate init events of our children (we already sent our own
|
|
922
|
+
// initial model-value-change event in firstUpdated)
|
|
923
|
+
const isGroup = this._repropagationRole !== 'child'; // => fieldset or choice-group
|
|
924
|
+
const isSelfInitializing = isGroup && !this.__repropagateChildrenInitialized;
|
|
925
|
+
const isChildGroupInitializing = ev.detail && ev.detail.initialize;
|
|
926
|
+
if (isSelfInitializing || isChildGroupInitializing) {
|
|
927
|
+
return;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
// B2. Are we a single choice choice-group? If so, halt when target unchecked
|
|
931
|
+
// and something else is checked, meaning we will get
|
|
932
|
+
// another model-value-changed dispatch for the checked target
|
|
933
|
+
//
|
|
934
|
+
// We only send the checked changed up (not the unchecked). In this way a choice group
|
|
935
|
+
// (radio-group, checkbox-group, select/listbox) acts as an 'endpoint' (a single Field)
|
|
936
|
+
// just like the native <select>
|
|
937
|
+
if (!this._repropagationCondition(target)) {
|
|
938
|
+
return;
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
// C1. We are ready to dispatch. Create a formPath
|
|
942
|
+
//
|
|
943
|
+
// Compute the formPath. Choice groups are regarded 'end points'
|
|
944
|
+
let parentFormPath = [];
|
|
945
|
+
if (!isEndpoint) {
|
|
946
|
+
parentFormPath = ev.detail && ev.detail.formPath || [target];
|
|
947
|
+
}
|
|
948
|
+
const formPath = [...parentFormPath, this];
|
|
949
|
+
|
|
950
|
+
// C2. Finally, redispatch a fresh model-value-changed event from our host, consumable
|
|
951
|
+
// for an Application Developer
|
|
952
|
+
//
|
|
953
|
+
// Since for a11y everything needs to be in lightdom, we don't add 'composed:true'
|
|
954
|
+
this.dispatchEvent(new CustomEvent('model-value-changed', {
|
|
955
|
+
bubbles: true,
|
|
956
|
+
detail: (/** @type {ModelValueEventDetails} */{
|
|
957
|
+
formPath,
|
|
958
|
+
isTriggeredByUser: Boolean(ev.detail?.isTriggeredByUser)
|
|
959
|
+
})
|
|
960
|
+
}));
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
/**
|
|
964
|
+
* Based on provided target, this condition determines whether received model-value-changed
|
|
965
|
+
* event should be repropagated
|
|
966
|
+
* @param {FormControlHost} target
|
|
967
|
+
* @protected
|
|
968
|
+
* @overridable
|
|
969
|
+
*/
|
|
970
|
+
// eslint-disable-next-line class-methods-use-this
|
|
971
|
+
_repropagationCondition(target) {
|
|
972
|
+
return Boolean(target);
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
/**
|
|
976
|
+
* @overridable
|
|
977
|
+
* A Subclasser should only override this method if the interactive element
|
|
978
|
+
* ([slot=input]) is not a native element(like input, textarea, select)
|
|
979
|
+
* that already receives focus on label click.
|
|
980
|
+
*
|
|
981
|
+
* @example
|
|
982
|
+
* _onLabelClick() {
|
|
983
|
+
* this._invokerNode.focus();
|
|
984
|
+
* }
|
|
985
|
+
* @protected
|
|
986
|
+
*/
|
|
987
|
+
// eslint-disable-next-line class-methods-use-this
|
|
988
|
+
_onLabelClick() {}
|
|
989
|
+
};
|
|
992
990
|
export const FormControlMixin = dedupeMixin(FormControlMixinImplementation);
|