@lion/ui 0.23.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -20
- package/components/accordion/src/LionAccordion.js +31 -42
- package/components/accordion/test/lion-accordion.test.js +108 -134
- package/components/button/src/LionButton.js +9 -12
- package/components/button/src/LionButtonReset.js +0 -5
- package/components/button/src/LionButtonSubmit.js +7 -12
- package/components/button/test/demos.screenshots-test.js +50 -11
- package/components/button/test/lion-button.test.js +0 -1
- package/components/button/test-suites/LionButton.suite.js +135 -145
- package/components/button/test-suites/LionButtonReset.suite.js +54 -72
- package/components/button/test-suites/LionButtonSubmit.suite.js +49 -68
- package/components/calendar/src/LionCalendar.js +151 -104
- package/components/calendar/src/calendarStyle.js +0 -1
- package/components/calendar/src/utils/createMonth.js +3 -4
- package/components/calendar/src/utils/createMultipleMonth.js +15 -7
- package/components/calendar/src/utils/createWeek.js +0 -2
- package/components/calendar/src/utils/dataTemplate.js +8 -4
- package/components/calendar/src/utils/dayTemplate.js +0 -6
- package/components/calendar/src/utils/getDayMonthYear.js +6 -2
- package/components/calendar/test/demos.screenshots-test.js +40 -9
- package/components/calendar/test/lion-calendar.test.js +171 -282
- package/components/calendar/test/utils/createMonth.test.js +61 -22
- package/components/calendar/test/utils/createMultipleMonth.test.js +14 -7
- package/components/calendar/test/utils/createWeek.test.js +51 -17
- package/components/calendar/test/utils/dataTemplate.test.js +3 -4
- package/components/calendar/test/utils/dayTemplate.test.js +106 -34
- package/components/calendar/test/utils/getFirstDayNextMonth.test.js +0 -1
- package/components/calendar/test/utils/getLastDayPreviousMonth.test.js +0 -1
- package/components/calendar/test/utils/isSameDate.test.js +0 -1
- package/components/calendar/test/utils/snapshots/monthTemplate_en-GB_Sunday_2018-12.js +1 -2
- package/components/calendar/test-helpers/CalendarObject.js +31 -62
- package/components/calendar/test-helpers/DayObject.js +7 -15
- package/components/calendar/test-suites/LionCalendar.suite.js +7 -9
- package/components/checkbox-group/src/LionCheckboxIndeterminate.js +17 -30
- package/components/checkbox-group/test/lion-checkbox-group-integrations.test.js +0 -1
- package/components/checkbox-group/test/lion-checkbox-group.test.js +21 -16
- package/components/checkbox-group/test/lion-checkbox-indeterminate-integrations.test.js +3 -3
- package/components/checkbox-group/test/lion-checkbox-integrations.test.js +3 -2
- package/components/checkbox-group/test/lion-checkbox.test.js +30 -16
- package/components/checkbox-group/test-suites/CheckboxIndeterminate.suite.js +147 -191
- package/components/collapsible/src/LionCollapsible.js +10 -15
- package/components/collapsible/test/lion-collapsible.test.js +4 -18
- package/components/combobox/src/LionCombobox.js +35 -53
- package/components/combobox/src/utils/makeMatchingTextBold.js +2 -5
- package/components/combobox/src/validators.js +0 -1
- package/components/combobox/test/lion-combobox-integrations.test.js +6 -6
- package/components/combobox/test/lion-combobox.test.js +576 -869
- package/components/combobox/test/validators.test.js +6 -13
- package/components/combobox/test-helpers/combobox-helpers.js +24 -11
- package/components/core/src/DisabledMixin.js +61 -66
- package/components/core/src/DisabledWithTabIndexMixin.js +76 -83
- package/components/core/src/EventTargetShim.js +1 -4
- package/components/core/src/ScopedElementsMixin.js +4 -15
- package/components/core/src/ScopedStylesController.js +1 -5
- package/components/core/src/SlotMixin.js +236 -239
- package/components/core/src/browserDetection.js +5 -12
- package/components/core/test/DisabledMixin.test.js +24 -39
- package/components/core/test/DisabledWithTabIndexMixin.test.js +21 -34
- package/components/core/test/EventTargetShim.test.js +0 -8
- package/components/core/test/ScopedElementsMixin.test.js +22 -38
- package/components/core/test/ScopedStylesController.test.js +11 -20
- package/components/core/test/SlotMixin.test.js +102 -154
- package/components/core/test-helpers/getCachedFixture.js +5 -11
- package/components/core/types/SlotMixinTypes.ts +8 -3
- package/components/dialog/src/LionDialog.js +4 -3
- package/components/dialog/test/lion-dialog.integration.test.js +10 -20
- package/components/dialog/test/lion-dialog.test.js +48 -62
- package/components/dialog/test-helpers/test-router.js +4 -6
- package/components/drawer/src/LionDrawer.js +18 -34
- package/components/drawer/src/drawerStyle.js +0 -1
- package/components/drawer/test/lion-drawer.test.js +1 -17
- package/components/fieldset/test/lion-fieldset.test.js +6 -4
- package/components/form/src/LionForm.js +18 -13
- package/components/form/test/lion-form.test.js +22 -52
- package/components/form-core/src/FocusMixin.js +172 -174
- package/components/form-core/src/FormControlMixin.js +811 -813
- package/components/form-core/src/FormatMixin.js +537 -537
- package/components/form-core/src/InteractionStateMixin.js +196 -183
- package/components/form-core/src/LionField.js +9 -5
- package/components/form-core/src/NativeTextFieldMixin.js +114 -116
- package/components/form-core/src/choice-group/ChoiceGroupMixin.js +322 -364
- package/components/form-core/src/choice-group/ChoiceInputMixin.js +306 -296
- package/components/form-core/src/choice-group/CustomChoiceGroupMixin.js +114 -139
- package/components/form-core/src/form-group/FormElementsHaveNoError.js +0 -2
- package/components/form-core/src/form-group/FormGroupMixin.js +551 -557
- package/components/form-core/src/registration/FormRegisteringMixin.js +72 -71
- package/components/form-core/src/registration/FormRegistrarMixin.js +201 -217
- package/components/form-core/src/registration/FormRegistrarPortalMixin.js +31 -37
- package/components/form-core/src/utils/SyncUpdatableMixin.js +106 -117
- package/components/form-core/src/utils/getAriaElementsInRightDomOrder.js +1 -2
- package/components/form-core/src/validate/LionValidationFeedback.js +12 -8
- package/components/form-core/src/validate/Unparseable.js +4 -2
- package/components/form-core/src/validate/ValidateMixin.js +829 -883
- package/components/form-core/src/validate/Validator.js +3 -6
- package/components/form-core/src/validate/resultValidators/DefaultSuccess.js +1 -2
- package/components/form-core/src/validate/validators/DateValidators.js +0 -5
- package/components/form-core/src/validate/validators/NumberValidators.js +1 -5
- package/components/form-core/src/validate/validators/Required.js +1 -1
- package/components/form-core/src/validate/validators/StringValidators.js +1 -8
- package/components/form-core/test/FocusMixin.test.js +96 -82
- package/components/form-core/test/FormControlMixin.test.js +120 -176
- package/components/form-core/test/FormRegistrationMixins.test.js +0 -2
- package/components/form-core/test/FormatMixin.test.js +0 -1
- package/components/form-core/test/InteractionStateMixin.test.js +0 -1
- package/components/form-core/test/NativeTextFieldMixin.test.js +0 -1
- package/components/form-core/test/choice-group/ChoiceGroupMixin.test.js +0 -1
- package/components/form-core/test/choice-group/ChoiceInputMixin.test.js +0 -1
- package/components/form-core/test/choice-group/CustomChoiceGroupMixin.integrations.test.js +6 -8
- package/components/form-core/test/choice-group/CustomChoiceGroupMixin.test.js +0 -3
- package/components/form-core/test/form-group/FormGroupMixin.test.js +0 -1
- package/components/form-core/test/lion-field.test.js +88 -98
- package/components/form-core/test/utils/SyncUpdatableMixin.test.js +51 -65
- package/components/form-core/test/utils/getAriaElementsInRightDomOrder.test.js +3 -3
- package/components/form-core/test/validate/DateValidators.test.js +5 -27
- package/components/form-core/test/validate/NumberValidators.test.js +4 -16
- package/components/form-core/test/validate/Required.test.js +8 -21
- package/components/form-core/test/validate/ResultValidator.test.js +1 -2
- package/components/form-core/test/validate/StringValidators.test.js +4 -35
- package/components/form-core/test/validate/ValidateMixin.test.js +0 -1
- package/components/form-core/test/validate/ValidateMixinFeedbackPart.test.js +0 -1
- package/components/form-core/test/validate/Validator.test.js +39 -34
- package/components/form-core/test/validate/lion-validation-feedback.test.js +81 -43
- package/components/form-core/test-helpers/ExampleValidators.js +0 -5
- package/components/form-core/test-helpers/getFormControlMembers.js +2 -2
- package/components/form-core/test-helpers/mimicUserInput.js +5 -1
- package/components/form-core/test-suites/FormRegistrationMixins.suite.js +65 -122
- package/components/form-core/test-suites/FormatMixin.suite.js +202 -227
- package/components/form-core/test-suites/InteractionStateMixin.suite.js +47 -60
- package/components/form-core/test-suites/NativeTextFieldMixin.suite.js +8 -11
- package/components/form-core/test-suites/ValidateMixin.suite.js +280 -359
- package/components/form-core/test-suites/ValidateMixinFeedbackPart.suite.js +112 -163
- package/components/form-core/test-suites/choice-group/ChoiceGroupMixin.suite.js +185 -218
- package/components/form-core/test-suites/choice-group/ChoiceInputMixin.suite.js +116 -109
- package/components/form-core/test-suites/choice-group/CustomChoiceGroupMixin.suite.js +36 -70
- package/components/form-core/test-suites/form-group/FormGroupMixin-input.suite.js +57 -65
- package/components/form-core/test-suites/form-group/FormGroupMixin.suite.js +664 -523
- package/components/form-core/translations/bg-BG.js +0 -1
- package/components/form-core/translations/cs-CZ.js +0 -1
- package/components/form-core/translations/de-DE.js +0 -1
- package/components/form-core/translations/en-AU.js +0 -1
- package/components/form-core/translations/en-GB.js +0 -1
- package/components/form-core/translations/en-US.js +0 -1
- package/components/form-core/translations/es-ES.js +0 -1
- package/components/form-core/translations/fr-BE.js +0 -1
- package/components/form-core/translations/fr-FR.js +0 -1
- package/components/form-core/translations/hu-HU.js +0 -1
- package/components/form-core/translations/it-IT.js +0 -1
- package/components/form-core/translations/nl-BE.js +0 -1
- package/components/form-core/translations/nl-NL.js +0 -1
- package/components/form-core/translations/pl-PL.js +0 -1
- package/components/form-core/translations/ro-RO.js +0 -1
- package/components/form-core/translations/ru-RU.js +0 -1
- package/components/form-core/translations/sk-SK.js +0 -1
- package/components/form-core/translations/tr-TR.js +0 -1
- package/components/form-core/translations/uk-UA.js +0 -1
- package/components/form-integrations/test/dialog-integrations.test.js +1 -4
- package/components/form-integrations/test/form-group-methods.test.js +28 -31
- package/components/form-integrations/test/form-integrations.test.js +27 -28
- package/components/form-integrations/test/form-validation-integrations.test.js +21 -29
- package/components/form-integrations/test/helpers/umbrella-form.js +3 -5
- package/components/form-integrations/test/model-value-consistency.test.js +75 -77
- package/components/form-integrations/test/model-value-event.test.js +10 -20
- package/components/helpers/src/SbActionLogger.js +13 -17
- package/components/helpers/src/SbLocaleSwitcher.js +5 -5
- package/components/helpers/src/sortEachDepth.js +0 -2
- package/components/helpers/test/renderLitAsNode.test.js +0 -4
- package/components/helpers/test/sb-action-logger.test.js +24 -55
- package/components/icon/src/IconManager.js +0 -2
- package/components/icon/src/LionIcon.js +2 -7
- package/components/icon/src/icons.js +0 -2
- package/components/icon/test/IconManager.test.js +0 -15
- package/components/icon/test/hammer.svg.js +3 -4
- package/components/icon/test/heart.svg.js +3 -4
- package/components/icon/test/lion-icon.test.js +14 -43
- package/components/input/src/LionInput.js +2 -8
- package/components/input/test/input-integrations.test.js +0 -5
- package/components/input/test/lion-input-integrations.test.js +0 -4
- package/components/input/test/lion-input.test.js +28 -58
- package/components/input/test-helpers/getInputMembers.js +2 -2
- package/components/input-amount/src/LionInputAmount.js +20 -20
- package/components/input-amount/src/formatters.js +0 -3
- package/components/input-amount/src/parsers.js +0 -3
- package/components/input-amount/test/formatters.test.js +24 -16
- package/components/input-amount/test/lion-input-amount-integrations.test.js +0 -4
- package/components/input-amount/test/lion-input-amount.test.js +123 -147
- package/components/input-amount/test/parsers.test.js +33 -17
- package/components/input-amount/test/preprocessors.test.js +0 -3
- package/components/input-amount-dropdown/src/LionInputAmountDropdown.js +49 -59
- package/components/input-amount-dropdown/src/currencyUtil.js +8 -7
- package/components/input-amount-dropdown/src/parsers.js +0 -1
- package/components/input-amount-dropdown/src/validators.js +0 -1
- package/components/input-amount-dropdown/test/LionInputAmountDropdown.test.js +34 -36
- package/components/input-amount-dropdown/test/lion-input-amount-dropdown-integrations.test.js +18 -13
- package/components/input-amount-dropdown/test-helpers/mimicUserChangingDropdown.js +5 -1
- package/components/input-amount-dropdown/test-suites/LionInputAmountDropdown.suite.js +132 -107
- package/components/input-date/src/LionInputDate.js +4 -3
- package/components/input-date/test/lion-input-date-integrations.test.js +0 -3
- package/components/input-date/test/lion-input-date.test.js +19 -32
- package/components/input-datepicker/src/LionInputDatepicker.js +17 -29
- package/components/input-datepicker/src/localizeNamespaceLoader.js +1 -2
- package/components/input-datepicker/test/lion-input-datepicker-integrations.test.js +0 -3
- package/components/input-datepicker/test/lion-input-datepicker.test.js +88 -153
- package/components/input-datepicker/test-helpers/DatepickerInputObject.js +9 -12
- package/components/input-datepicker/test-suites/LionInputDatepicker.suite.js +6 -4
- package/components/input-datepicker/translations/bg-BG.js +0 -1
- package/components/input-datepicker/translations/cs-CZ.js +0 -1
- package/components/input-datepicker/translations/de-DE.js +0 -1
- package/components/input-datepicker/translations/en-AU.js +0 -1
- package/components/input-datepicker/translations/en-GB.js +0 -1
- package/components/input-datepicker/translations/en-US.js +0 -1
- package/components/input-datepicker/translations/es-ES.js +0 -1
- package/components/input-datepicker/translations/fr-BE.js +0 -1
- package/components/input-datepicker/translations/fr-FR.js +0 -1
- package/components/input-datepicker/translations/hu-HU.js +0 -1
- package/components/input-datepicker/translations/it-IT.js +0 -1
- package/components/input-datepicker/translations/nl-BE.js +0 -1
- package/components/input-datepicker/translations/nl-NL.js +0 -1
- package/components/input-datepicker/translations/pl-PL.js +0 -1
- package/components/input-datepicker/translations/ro-RO.js +0 -1
- package/components/input-datepicker/translations/ru-RU.js +0 -1
- package/components/input-datepicker/translations/sk-SK.js +0 -1
- package/components/input-datepicker/translations/tr-TR.js +0 -1
- package/components/input-datepicker/translations/uk-UA.js +0 -1
- package/components/input-email/test/lion-input-email-integrations.test.js +0 -2
- package/components/input-email/test/lion-input-email.test.js +1 -7
- package/components/input-file/src/FileHandle.js +0 -3
- package/components/input-file/src/LionInputFile.js +85 -83
- package/components/input-file/src/LionSelectedFileList.js +12 -12
- package/components/input-file/src/validators.js +10 -9
- package/components/input-file/test/FileValidators.test.js +170 -80
- package/components/input-file/test/lion-input-file.test.js +160 -244
- package/components/input-file/test/lion-selected-file-list.test.js +13 -22
- package/components/input-file/translations/bg-BG.js +0 -1
- package/components/input-file/translations/cs-CZ.js +0 -1
- package/components/input-file/translations/de-DE.js +0 -1
- package/components/input-file/translations/en-AU.js +0 -1
- package/components/input-file/translations/en-GB.js +0 -1
- package/components/input-file/translations/en-PH.js +0 -1
- package/components/input-file/translations/en-US.js +0 -1
- package/components/input-file/translations/en.js +2 -1
- package/components/input-file/translations/es-ES.js +0 -1
- package/components/input-file/translations/fr-BE.js +0 -1
- package/components/input-file/translations/fr-FR.js +0 -1
- package/components/input-file/translations/hu-HU.js +0 -1
- package/components/input-file/translations/id-ID.js +0 -1
- package/components/input-file/translations/id.js +2 -1
- package/components/input-file/translations/it-IT.js +0 -1
- package/components/input-file/translations/nl-BE.js +0 -1
- package/components/input-file/translations/nl-NL.js +0 -1
- package/components/input-file/translations/pl-PL.js +0 -1
- package/components/input-file/translations/ro-RO.js +0 -1
- package/components/input-file/translations/ru-RU.js +0 -1
- package/components/input-file/translations/sk-SK.js +0 -1
- package/components/input-file/translations/uk-UA.js +0 -1
- package/components/input-file/translations/zh-CN.js +0 -1
- package/components/input-iban/src/validators.js +6 -11
- package/components/input-iban/test/formatters.test.js +0 -3
- package/components/input-iban/test/lion-input-iban-integrations.test.js +0 -2
- package/components/input-iban/test/lion-input-iban.test.js +1 -9
- package/components/input-iban/test/parsers.test.js +0 -2
- package/components/input-iban/test/validators.test.js +0 -12
- package/components/input-iban/translations/bg-BG.js +0 -1
- package/components/input-iban/translations/cs-CZ.js +0 -1
- package/components/input-iban/translations/de-DE.js +0 -1
- package/components/input-iban/translations/en-AU.js +0 -1
- package/components/input-iban/translations/en-GB.js +0 -1
- package/components/input-iban/translations/en-US.js +0 -1
- package/components/input-iban/translations/es-ES.js +0 -1
- package/components/input-iban/translations/fr-BE.js +0 -1
- package/components/input-iban/translations/fr-FR.js +0 -1
- package/components/input-iban/translations/hu-HU.js +0 -1
- package/components/input-iban/translations/it-IT.js +0 -1
- package/components/input-iban/translations/nl-BE.js +0 -1
- package/components/input-iban/translations/nl-NL.js +0 -1
- package/components/input-iban/translations/pl-PL.js +0 -1
- package/components/input-iban/translations/ro-RO.js +0 -1
- package/components/input-iban/translations/ru-RU.js +0 -1
- package/components/input-iban/translations/sk-SK.js +0 -1
- package/components/input-iban/translations/uk-UA.js +0 -1
- package/components/input-range/src/LionInputRange.js +18 -19
- package/components/input-range/test/lion-input-range.test.js +23 -48
- package/components/input-range/translations/bg-BG.js +0 -1
- package/components/input-range/translations/cs-CZ.js +0 -1
- package/components/input-range/translations/de-DE.js +0 -1
- package/components/input-range/translations/en-AU.js +0 -1
- package/components/input-range/translations/en-GB.js +0 -1
- package/components/input-range/translations/en-PH.js +0 -1
- package/components/input-range/translations/en-US.js +0 -1
- package/components/input-range/translations/es-ES.js +0 -1
- package/components/input-range/translations/fr-BE.js +0 -1
- package/components/input-range/translations/fr-FR.js +0 -1
- package/components/input-range/translations/hu-HU.js +0 -1
- package/components/input-range/translations/it-IT.js +0 -1
- package/components/input-range/translations/nl-BE.js +0 -1
- package/components/input-range/translations/nl-NL.js +0 -1
- package/components/input-range/translations/pl-PL.js +0 -1
- package/components/input-range/translations/ro-RO.js +0 -1
- package/components/input-range/translations/ru-RU.js +0 -1
- package/components/input-range/translations/sk-SK.js +0 -1
- package/components/input-range/translations/uk-UA.js +0 -1
- package/components/input-range/translations/zh-CN.js +0 -1
- package/components/input-stepper/src/LionInputStepper.js +19 -38
- package/components/input-stepper/test/lion-input-stepper-integrations.test.js +0 -1
- package/components/input-stepper/test/lion-input-stepper.test.js +0 -1
- package/components/input-stepper/test-suites/lion-input-stepper.integration.suite.js +0 -2
- package/components/input-stepper/test-suites/lion-input-stepper.suite.js +56 -105
- package/components/input-stepper/translations/bg-BG.js +0 -1
- package/components/input-stepper/translations/cs-CZ.js +0 -1
- package/components/input-stepper/translations/de-DE.js +0 -1
- package/components/input-stepper/translations/en-AU.js +0 -1
- package/components/input-stepper/translations/en-GB.js +0 -1
- package/components/input-stepper/translations/en-US.js +0 -1
- package/components/input-stepper/translations/es-ES.js +0 -1
- package/components/input-stepper/translations/fr-BE.js +0 -1
- package/components/input-stepper/translations/fr-FR.js +0 -1
- package/components/input-stepper/translations/hu-HU.js +0 -1
- package/components/input-stepper/translations/it-IT.js +0 -1
- package/components/input-stepper/translations/nl-BE.js +0 -1
- package/components/input-stepper/translations/nl-NL.js +0 -1
- package/components/input-stepper/translations/pl-PL.js +0 -1
- package/components/input-stepper/translations/ro-RO.js +0 -1
- package/components/input-stepper/translations/ru-RU.js +0 -1
- package/components/input-stepper/translations/sk-SK.js +0 -1
- package/components/input-stepper/translations/uk-UA.js +0 -1
- package/components/input-tel/src/LionInputTel.js +53 -37
- package/components/input-tel/src/PhoneUtilManager.js +6 -4
- package/components/input-tel/src/formatters.js +12 -10
- package/components/input-tel/src/parsers.js +3 -3
- package/components/input-tel/src/preprocessors.js +15 -7
- package/components/input-tel/src/validators.js +4 -6
- package/components/input-tel/test/LionInputTel.test.js +4 -2
- package/components/input-tel/test/formatters.test.js +22 -10
- package/components/input-tel/test/parsers.test.js +127 -11
- package/components/input-tel/test/preprocessors.test.js +24 -13
- package/components/input-tel/test/validators.test.js +7 -14
- package/components/input-tel/test-helpers/mockPhoneUtilManager.js +20 -8
- package/components/input-tel/test-suites/LionInputTel.suite.js +33 -73
- package/components/input-tel/translations/bg-BG.js +0 -1
- package/components/input-tel/translations/cs-CZ.js +0 -1
- package/components/input-tel/translations/de-DE.js +0 -1
- package/components/input-tel/translations/en-AU.js +0 -1
- package/components/input-tel/translations/en-GB.js +0 -1
- package/components/input-tel/translations/en-US.js +0 -1
- package/components/input-tel/translations/es-ES.js +0 -1
- package/components/input-tel/translations/fr-BE.js +0 -1
- package/components/input-tel/translations/fr-FR.js +0 -1
- package/components/input-tel/translations/hu-HU.js +0 -1
- package/components/input-tel/translations/it-IT.js +0 -1
- package/components/input-tel/translations/nl-BE.js +0 -1
- package/components/input-tel/translations/nl-NL.js +0 -1
- package/components/input-tel/translations/pl-PL.js +0 -1
- package/components/input-tel/translations/ro-RO.js +0 -1
- package/components/input-tel/translations/ru-RU.js +0 -1
- package/components/input-tel/translations/sk-SK.js +0 -1
- package/components/input-tel/translations/uk-UA.js +0 -1
- package/components/input-tel-dropdown/src/LionInputTelDropdown.js +10 -28
- package/components/input-tel-dropdown/src/regionCodeToLocale.js +3 -1
- package/components/input-tel-dropdown/test/LionInputTelDropdown.test.js +31 -38
- package/components/input-tel-dropdown/test/regionCodeToLocale.test.js +0 -1
- package/components/input-tel-dropdown/test-helpers/mimicUserChangingDropdown.js +5 -1
- package/components/input-tel-dropdown/test-suites/LionInputTelDropdown--parentheses.suite.js +16 -11
- package/components/input-tel-dropdown/test-suites/LionInputTelDropdown.suite.js +54 -79
- package/components/listbox/src/LionListbox.js +5 -2
- package/components/listbox/src/LionOption.js +8 -7
- package/components/listbox/src/LionOptions.js +0 -3
- package/components/listbox/src/ListboxMixin.js +786 -820
- package/components/listbox/test/lion-listbox.test.js +0 -1
- package/components/listbox/test/lion-option.test.js +53 -64
- package/components/listbox/test/lion-options.test.js +3 -4
- package/components/listbox/test-helpers/getListboxMembers.js +6 -3
- package/components/listbox/test-suites/ListboxMixin.suite.js +101 -261
- package/components/localize/src/LocalizeManager.js +40 -40
- package/components/localize/src/LocalizeMixin.js +130 -157
- package/components/localize/src/date/formatDate.js +1 -5
- package/components/localize/src/date/getDateFormatBasedOnLocale.js +5 -3
- package/components/localize/src/date/getMonthNames.js +3 -5
- package/components/localize/src/date/getWeekdayNames.js +1 -5
- package/components/localize/src/date/parseDate.js +5 -20
- package/components/localize/src/date/utils/normalizeIntlDate.js +0 -7
- package/components/localize/src/getLocalizeManager.js +0 -3
- package/components/localize/src/number/formatNumber.js +3 -7
- package/components/localize/src/number/formatNumberToParts.js +52 -18
- package/components/localize/src/number/getCurrencyName.js +5 -5
- package/components/localize/src/number/getFractionDigits.js +4 -4
- package/components/localize/src/number/getSeparatorsFromNumber.js +1 -3
- package/components/localize/src/number/parseNumber.js +0 -3
- package/components/localize/src/number/utils/normalize-format-number-to-parts/forceAddGroupSeparators.js +0 -1
- package/components/localize/src/number/utils/normalize-format-number-to-parts/forceSpaceBetweenCurrencyCodeAndNumber.js +4 -1
- package/components/localize/test/LocalizeManager.test.js +385 -278
- package/components/localize/test/LocalizeMixin.test.js +28 -112
- package/components/localize/test/date/formatDate.test.js +18 -48
- package/components/localize/test/date/getDateFormatBasedOnLocale.test.js +0 -3
- package/components/localize/test/date/getMonthNames.test.js +27 -12
- package/components/localize/test/date/getWeekdayNames.test.js +93 -49
- package/components/localize/test/date/normalizeDateTime.test.js +0 -2
- package/components/localize/test/date/parseDate.test.js +12 -16
- package/components/localize/test/getLocalizeManager.test.js +0 -3
- package/components/localize/test/isLocalizeESModule.test.js +32 -13
- package/components/localize/test/localize.test.js +0 -4
- package/components/localize/test/number/formatNumber.test.js +215 -106
- package/components/localize/test/number/formatNumberToParts.test.js +31 -38
- package/components/localize/test/number/getCurrencyName.test.js +20 -6
- package/components/localize/test/number/getDecimalSeparator.test.js +5 -4
- package/components/localize/test/number/getFractionDigits.test.js +0 -2
- package/components/localize/test/number/getGroupSeparator.test.js +0 -2
- package/components/localize/test/number/getSeparatorsFromNumber.test.js +5 -3
- package/components/localize/test/number/parseNumber.test.js +123 -56
- package/components/localize/test/side-effect-free-entrypoint.test.js +0 -6
- package/components/localize/test-helpers/fake-imports.js +11 -6
- package/components/localize/test-helpers/localizeTearDown.js +0 -1
- package/components/menu/src/InteractiveListMixin.js +637 -638
- package/components/menu/src/LionMenu.js +46 -59
- package/components/menu/src/MoreButtonMenuMixin.js +215 -238
- package/components/menu/src/MultiLevelListMixin.js +240 -246
- package/components/menu/src/utils/isInView.js +0 -1
- package/components/menu/src/utils/listItemInteractions.js +4 -4
- package/components/menu/test/InteractiveListMixin.test.js +0 -1
- package/components/menu/test/MoreButtonMenuMixin.test.js +3 -2
- package/components/menu/test/MultiLevelListMixin.test.js +0 -1
- package/components/menu/test/lion-menu-interactions.test.js +0 -1
- package/components/menu/test/lion-menu.test.js +6 -2
- package/components/menu/test-helpers/mimicKeyPress.js +12 -2
- package/components/menu/test-suites/InteractiveListMixin.suite.js +4 -43
- package/components/menu/test-suites/LionMenu.suite.js +1 -8
- package/components/menu/test-suites/LionMenuInteractions.suite.js +22 -44
- package/components/menu/test-suites/MoreButtonMenuMixin.suite.js +34 -41
- package/components/menu/test-suites/MultiLevelListMixin.suite.js +5 -23
- package/components/overlays/src/ArrowMixin.js +111 -127
- package/components/overlays/src/OverlayController.js +172 -152
- package/components/overlays/src/OverlayMixin.js +64 -69
- package/components/overlays/src/OverlaysManager.js +30 -32
- package/components/overlays/src/configurations/visibility-trigger-partials/withClickInteraction.js +0 -1
- package/components/overlays/src/configurations/visibility-trigger-partials/withHoverInteraction.js +11 -11
- package/components/overlays/src/configurations/withBottomSheetConfig.js +12 -13
- package/components/overlays/src/configurations/withDropdownConfig.js +4 -2
- package/components/overlays/src/configurations/withModalDialogConfig.js +12 -13
- package/components/overlays/src/configurations/withPopoverConfig.js +27 -25
- package/components/overlays/src/configurations/withTooltipConfig.js +15 -13
- package/components/overlays/src/overlayDocumentStyle.js +1 -1
- package/components/overlays/src/overlayShadowDomStyle.js +0 -1
- package/components/overlays/src/singleton.js +0 -2
- package/components/overlays/src/utils/adopt-styles.js +18 -18
- package/components/overlays/src/utils/deep-contains.js +7 -6
- package/components/overlays/src/utils/get-focusable-elements.js +7 -10
- package/components/overlays/src/utils/inert-siblings.js +2 -4
- package/components/overlays/src/utils/is-equal-config.js +2 -3
- package/components/overlays/src/utils/is-visible.js +0 -1
- package/components/overlays/src/utils/simulate-tab.js +1 -4
- package/components/overlays/src/utils/sort-by-tabindex.js +2 -4
- package/components/overlays/test/ArrowMixin.test.js +18 -30
- package/components/overlays/test/OverlayController.test.js +406 -555
- package/components/overlays/test/OverlayMixin.test.js +0 -2
- package/components/overlays/test/OverlaysManager.test.js +30 -35
- package/components/overlays/test/global-positioning.test.js +6 -10
- package/components/overlays/test/invoker-compatibility.test.js +37 -0
- package/components/overlays/test/local-positioning.test.js +101 -103
- package/components/overlays/test/utils-tests/active-element.test.js +12 -27
- package/components/overlays/test/utils-tests/adopt-styles.test.js +25 -56
- package/components/overlays/test/utils-tests/deep-contains.test.js +73 -74
- package/components/overlays/test/utils-tests/get-focusable-elements.test.js +6 -23
- package/components/overlays/test/utils-tests/is-equal-config.test.js +32 -13
- package/components/overlays/test/utils-tests/visibility.test.js +44 -79
- package/components/overlays/test-helpers/createShadowHost.js +5 -3
- package/components/overlays/test-helpers/normalizeTransformStyle.js +2 -4
- package/components/overlays/test-suites/OverlayMixin.suite.js +152 -181
- package/components/overlays/test-suites/WithHoverInteraction.suite.js +96 -79
- package/components/overlays/translations/bg-BG.js +0 -1
- package/components/overlays/translations/cs-CZ.js +0 -1
- package/components/overlays/translations/de-DE.js +0 -1
- package/components/overlays/translations/en-AU.js +0 -1
- package/components/overlays/translations/en-GB.js +0 -1
- package/components/overlays/translations/en-US.js +0 -1
- package/components/overlays/translations/es-ES.js +0 -1
- package/components/overlays/translations/fr-BE.js +0 -1
- package/components/overlays/translations/fr-FR.js +0 -1
- package/components/overlays/translations/hu-HU.js +0 -1
- package/components/overlays/translations/it-IT.js +0 -1
- package/components/overlays/translations/nl-BE.js +0 -1
- package/components/overlays/translations/nl-NL.js +0 -1
- package/components/overlays/translations/pl-PL.js +0 -1
- package/components/overlays/translations/ro-RO.js +0 -1
- package/components/overlays/translations/ru-RU.js +0 -1
- package/components/overlays/translations/sk-SK.js +0 -1
- package/components/overlays/translations/tr-TR.js +0 -1
- package/components/overlays/translations/uk-UA.js +0 -1
- package/components/pagination/src/LionPagination.js +9 -12
- package/components/pagination/test/lion-pagination.test.js +18 -50
- package/components/progress-indicator/src/LionProgressIndicator.js +10 -12
- package/components/progress-indicator/test/lion-progress-indicator.test.js +1 -22
- package/components/radio-group/src/LionRadioGroup.js +1 -2
- package/components/radio-group/test/lion-radio-group-integrations.test.js +0 -1
- package/components/radio-group/test/lion-radio-group.test.js +27 -27
- package/components/radio-group/test/lion-radio-integrations.test.js +3 -2
- package/components/radio-group/test/lion-radio.test.js +30 -16
- package/components/select/src/LionSelect.js +12 -13
- package/components/select/test/lion-select.test.js +7 -12
- package/components/select-rich/src/LionSelectInvoker.js +18 -11
- package/components/select-rich/src/LionSelectRich.js +22 -44
- package/components/select-rich/test/demos.screenshots-test.js +40 -9
- package/components/select-rich/test/lion-select-invoker.test.js +26 -43
- package/components/select-rich/test/lion-select-listbox-suite-integration.test.js +3 -3
- package/components/select-rich/test/lion-select-rich-dialog-integration.test.js +4 -9
- package/components/select-rich/test/lion-select-rich-interaction.test.js +116 -116
- package/components/select-rich/test/lion-select-rich-upgrade.test.js +3 -7
- package/components/select-rich/test/lion-select-rich.test.js +153 -195
- package/components/select-rich/test-helpers/getSelectRichMembers.js +4 -1
- package/components/steps/src/LionStep.js +21 -12
- package/components/steps/src/LionSteps.js +25 -25
- package/components/steps/test/lion-step.test.js +18 -25
- package/components/steps/test/lion-steps.test.js +45 -78
- package/components/switch/src/LionSwitch.js +2 -7
- package/components/switch/src/LionSwitchButton.js +5 -6
- package/components/switch/test/lion-switch-button.test.js +16 -28
- package/components/switch/test/lion-switch.test.js +17 -31
- package/components/tabs/src/LionTabs.js +25 -28
- package/components/tabs/test/lion-tabs.test.js +156 -154
- package/components/textarea/src/LionTextarea.js +4 -23
- package/components/textarea/test/lion-textarea-integrations.test.js +0 -5
- package/components/textarea/test/lion-textarea.test.js +2 -28
- package/components/tooltip/src/LionTooltip.js +6 -6
- package/components/tooltip/test/lion-tooltip.test.js +75 -102
- package/components/validate-messages/src/getLocalizedMessage.js +8 -7
- package/components/validate-messages/src/loadDefaultFeedbackMessages.js +3 -1
- package/components/validate-messages/src/loadDefaultFeedbackMessagesNoSideEffects.js +9 -5
- package/components/validate-messages/src/per-entrypoint/loadComboboxMessagesNoSideEffects.js +5 -2
- package/components/validate-messages/src/per-entrypoint/loadFormCoreMessagesNoSideEffects.js +99 -35
- package/components/validate-messages/src/per-entrypoint/loadInputTelMessagesNoSideEffects.js +4 -3
- package/components/validate-messages/test/loadDefaultFeedbackMessages.test.js +5 -3
- package/components/validate-messages/test/loadDefaultFeedbackMessagesNoSideEffects.test.js +80 -45
- package/components/validate-messages/translations/bg-BG.js +0 -1
- package/components/validate-messages/translations/cs-CZ.js +0 -1
- package/components/validate-messages/translations/de-DE.js +0 -1
- package/components/validate-messages/translations/en-AU.js +0 -1
- package/components/validate-messages/translations/en-GB.js +0 -1
- package/components/validate-messages/translations/en-PH.js +0 -1
- package/components/validate-messages/translations/en-US.js +0 -1
- package/components/validate-messages/translations/es-ES.js +0 -1
- package/components/validate-messages/translations/fr-BE.js +0 -1
- package/components/validate-messages/translations/fr-FR.js +0 -1
- package/components/validate-messages/translations/hu-HU.js +0 -1
- package/components/validate-messages/translations/it-IT.js +0 -1
- package/components/validate-messages/translations/nl-BE.js +0 -1
- package/components/validate-messages/translations/nl-NL.js +0 -1
- package/components/validate-messages/translations/pl-PL.js +0 -1
- package/components/validate-messages/translations/ro-RO.js +0 -1
- package/components/validate-messages/translations/ru-RU.js +0 -1
- package/components/validate-messages/translations/sk-SK.js +0 -1
- package/components/validate-messages/translations/tr-TR.js +0 -1
- package/components/validate-messages/translations/uk-UA.js +0 -1
- package/custom-elements.json +229 -85
- package/dist-types/components/core/src/SlotMixin.d.ts +6 -1
- package/dist-types/components/core/src/SlotMixin.d.ts.map +1 -1
- package/dist-types/components/core/types/SlotMixinTypes.d.ts +5 -1
- package/dist-types/components/core/types/SlotMixinTypes.d.ts.map +1 -1
- package/dist-types/components/form-core/src/LionField.d.ts +3 -1
- package/dist-types/components/form-core/src/LionField.d.ts.map +1 -1
- package/dist-types/components/input-tel/src/LionInputTel.d.ts +6 -6
- package/dist-types/components/input-tel/src/LionInputTel.d.ts.map +1 -1
- package/dist-types/components/input-tel/src/PhoneUtilManager.d.ts +2 -2
- package/dist-types/components/input-tel/src/PhoneUtilManager.d.ts.map +1 -1
- package/dist-types/components/input-tel/src/formatters.d.ts +2 -2
- package/dist-types/components/input-tel/src/formatters.d.ts.map +1 -1
- package/dist-types/components/input-tel/src/preprocessors.d.ts +2 -2
- package/dist-types/components/input-tel/src/preprocessors.d.ts.map +1 -1
- package/dist-types/components/input-tel/test/validators.test.d.ts +1 -1
- package/dist-types/components/input-tel/test/validators.test.d.ts.map +1 -1
- package/dist-types/components/input-tel/test-helpers/mockPhoneUtilManager.d.ts +5 -0
- package/dist-types/components/input-tel/test-helpers/mockPhoneUtilManager.d.ts.map +1 -1
- package/dist-types/components/listbox/src/LionListbox.d.ts +2 -2
- package/dist-types/components/listbox/src/LionListbox.d.ts.map +1 -1
- package/dist-types/components/listbox/src/LionOption.d.ts +5 -2
- package/dist-types/components/listbox/src/LionOption.d.ts.map +1 -1
- package/dist-types/components/overlays/src/OverlayController.d.ts +3 -1
- package/dist-types/components/overlays/src/OverlayController.d.ts.map +1 -1
- package/dist-types/components/overlays/src/OverlayMixin.d.ts.map +1 -1
- package/dist-types/components/overlays/src/OverlaysManager.d.ts.map +1 -1
- package/dist-types/components/overlays/src/overlayDocumentStyle.d.ts.map +1 -1
- package/dist-types/components/overlays/test/invoker-compatibility.test.d.ts +3 -0
- package/dist-types/components/overlays/test/invoker-compatibility.test.d.ts.map +1 -0
- package/dist-types/components/select-rich/src/LionSelectInvoker.d.ts +3 -1
- package/dist-types/components/select-rich/src/LionSelectInvoker.d.ts.map +1 -1
- package/dist-types/components/select-rich/src/LionSelectRich.d.ts +6 -5
- package/dist-types/components/select-rich/src/LionSelectRich.d.ts.map +1 -1
- package/dist-types/tsconfig.tsbuildinfo +1 -1
- package/docs/components/accordion/overview.md +2 -2
- package/docs/components/accordion/reference.md +2 -2
- package/docs/components/accordion/use-cases.md +2 -2
- package/docs/components/button/examples.md +2 -2
- package/docs/components/button/extensions.md +2 -2
- package/docs/components/button/overview.md +2 -2
- package/docs/components/button/use-cases.md +2 -2
- package/docs/components/calendar/overview.md +2 -2
- package/docs/components/calendar/use-cases.md +2 -2
- package/docs/components/checkbox-group/overview.md +4 -4
- package/docs/components/checkbox-group/use-cases.md +2 -2
- package/docs/components/collapsible/examples.md +2 -2
- package/docs/components/collapsible/overview.md +3 -3
- package/docs/components/collapsible/use-cases.md +2 -2
- package/docs/components/combobox/api-table.md +1 -1
- package/docs/components/combobox/extensions.md +2 -2
- package/docs/components/combobox/overview.md +3 -3
- package/docs/components/combobox/use-cases.md +3 -3
- package/docs/components/dialog/overview.md +3 -3
- package/docs/components/dialog/use-cases.md +2 -2
- package/docs/components/drawer/overview.md +2 -2
- package/docs/components/drawer/use-cases.md +2 -2
- package/docs/components/fieldset/overview.md +7 -7
- package/docs/components/fieldset/use-cases.md +2 -2
- package/docs/components/form/overview.md +5 -5
- package/docs/components/form/use-cases.md +4 -4
- package/docs/components/icon/overview.md +2 -2
- package/docs/components/icon/use-cases.md +3 -3
- package/docs/components/input/overview.md +3 -3
- package/docs/components/input/use-cases.md +2 -2
- package/docs/components/input-amount/overview.md +5 -5
- package/docs/components/input-amount/use-cases.md +2 -2
- package/docs/components/input-amount-dropdown/use-cases.md +2 -2
- package/docs/components/input-date/overview.md +5 -5
- package/docs/components/input-date/use-cases.md +2 -2
- package/docs/components/input-datepicker/overview.md +7 -7
- package/docs/components/input-datepicker/use-cases.md +2 -2
- package/docs/components/input-email/overview.md +4 -4
- package/docs/components/input-email/use-cases.md +2 -2
- package/docs/components/input-file/overview.md +3 -3
- package/docs/components/input-file/use-cases.md +2 -2
- package/docs/components/input-iban/overview.md +4 -4
- package/docs/components/input-iban/use-cases.md +2 -2
- package/docs/components/input-range/overview.md +4 -4
- package/docs/components/input-range/use-cases.md +2 -2
- package/docs/components/input-stepper/overview.md +3 -3
- package/docs/components/input-stepper/use-cases.md +2 -2
- package/docs/components/input-tel/overview.md +3 -3
- package/docs/components/input-tel/use-cases.md +8 -8
- package/docs/components/input-tel-dropdown/extensions.md +2 -2
- package/docs/components/input-tel-dropdown/overview.md +3 -3
- package/docs/components/input-tel-dropdown/use-cases.md +2 -2
- package/docs/components/listbox/api-table.md +4 -4
- package/docs/components/listbox/overview.md +2 -2
- package/docs/components/listbox/use-cases.md +3 -3
- package/docs/components/menu/extensions.md +2 -2
- package/docs/components/menu/migration.md +2 -2
- package/docs/components/menu/overview.md +2 -2
- package/docs/components/menu/use-cases.md +1 -1
- package/docs/components/pagination/overview.md +2 -2
- package/docs/components/pagination/use-cases.md +2 -2
- package/docs/components/progress-indicator/examples.md +2 -2
- package/docs/components/progress-indicator/overview.md +2 -2
- package/docs/components/radio-group/overview.md +5 -5
- package/docs/components/radio-group/use-cases.md +2 -2
- package/docs/components/select/overview.md +2 -2
- package/docs/components/select/use-cases.md +3 -3
- package/docs/components/select-rich/api-table.md +1 -1
- package/docs/components/select-rich/examples.md +2 -2
- package/docs/components/select-rich/overview.md +2 -2
- package/docs/components/select-rich/use-cases.md +4 -4
- package/docs/components/steps/overview.md +2 -2
- package/docs/components/steps/use-cases.md +2 -2
- package/docs/components/switch/overview.md +2 -2
- package/docs/components/switch/reference.md +2 -2
- package/docs/components/switch/use-cases.md +2 -2
- package/docs/components/tabs/examples.md +3 -3
- package/docs/components/tabs/overview.md +2 -2
- package/docs/components/tabs/use-cases.md +2 -2
- package/docs/components/textarea/overview.md +2 -2
- package/docs/components/textarea/use-cases.md +2 -2
- package/docs/components/tooltip/examples.md +2 -2
- package/docs/components/tooltip/overview.md +2 -2
- package/docs/components/tooltip/use-cases.md +2 -2
- package/docs/fundamentals/index.md +4 -4
- package/docs/fundamentals/node-tools/babel-plugin-extend-docs/index.md +2 -2
- package/docs/fundamentals/node-tools/babel-plugin-extend-docs/overview.md +2 -2
- package/docs/fundamentals/node-tools/providence-analytics/index.md +2 -2
- package/docs/fundamentals/node-tools/providence-analytics/overview.md +2 -2
- package/docs/fundamentals/node-tools/publish-docs/index.md +2 -2
- package/docs/fundamentals/node-tools/publish-docs/overview.md +5 -5
- package/docs/fundamentals/node-tools/remark-extend/index.md +2 -2
- package/docs/fundamentals/node-tools/remark-extend/overview.md +2 -2
- package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/index.md +2 -2
- package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md +4 -4
- package/docs/fundamentals/rationales/TypeScript.md +62 -2
- package/docs/fundamentals/rationales/accessibility.md +5 -5
- package/docs/fundamentals/rationales/side-effects.md +2 -2
- package/docs/fundamentals/rationales/versioning.md +2 -2
- package/docs/fundamentals/systems/core/SlotMixin.md +3 -3
- package/docs/fundamentals/systems/core/index.md +2 -2
- package/docs/fundamentals/systems/core/overview.md +3 -3
- package/docs/fundamentals/systems/form/formatting-and-parsing.md +6 -6
- package/docs/fundamentals/systems/form/index.md +2 -2
- package/docs/fundamentals/systems/form/interaction-states.md +2 -2
- package/docs/fundamentals/systems/form/model-value.md +3 -3
- package/docs/fundamentals/systems/form/overview.md +30 -30
- package/docs/fundamentals/systems/form/styling.md +2 -2
- package/docs/fundamentals/systems/form/use-cases.md +2 -2
- package/docs/fundamentals/systems/form/validate.md +4 -4
- package/docs/fundamentals/systems/icon/index.md +2 -2
- package/docs/fundamentals/systems/icon/overview.md +2 -2
- package/docs/fundamentals/systems/localize/dates.md +2 -2
- package/docs/fundamentals/systems/localize/index.md +2 -2
- package/docs/fundamentals/systems/localize/numbers.md +2 -2
- package/docs/fundamentals/systems/localize/overview.md +6 -6
- package/docs/fundamentals/systems/localize/rationale.md +2 -2
- package/docs/fundamentals/systems/localize/text.md +2 -2
- package/docs/fundamentals/systems/localize/use-cases.md +2 -2
- package/docs/fundamentals/systems/overlays/_edge-cases.md +2 -2
- package/docs/fundamentals/systems/overlays/api-table.md +1 -1
- package/docs/fundamentals/systems/overlays/configuration.md +4 -4
- package/docs/fundamentals/systems/overlays/index.md +2 -2
- package/docs/fundamentals/systems/overlays/overview.md +7 -7
- package/docs/fundamentals/systems/overlays/rationale.md +2 -2
- package/docs/fundamentals/systems/overlays/use-cases.md +4 -4
- package/docs/fundamentals/tools/ajax/index.md +2 -2
- package/docs/fundamentals/tools/ajax/overview.md +2 -2
- package/docs/fundamentals/tools/ajax/use-cases.md +2 -2
- package/docs/fundamentals/tools/helpers/action-logger.md +2 -2
- package/docs/fundamentals/tools/helpers/index.md +2 -2
- package/docs/fundamentals/tools/helpers/overview.md +3 -3
- package/docs/fundamentals/tools/singleton-manager/example-complex/index.md +2 -2
- package/docs/fundamentals/tools/singleton-manager/example-fail/index.md +2 -2
- package/docs/fundamentals/tools/singleton-manager/example-success/index.md +2 -2
- package/docs/fundamentals/tools/singleton-manager/index.md +2 -2
- package/docs/fundamentals/tools/singleton-manager/overview.md +6 -6
- package/docs/guides/how-to/create-a-custom-field.md +7 -7
- package/docs/guides/how-to/create-a-form.md +6 -6
- package/docs/guides/how-to/extend-a-native-input.md +4 -4
- package/docs/guides/how-to/get-started.md +2 -2
- package/docs/guides/how-to/index.md +1 -1
- package/docs/guides/index.md +8 -8
- package/docs/guides/principles/definitions-and-terms.md +2 -2
- package/docs/guides/principles/index.md +5 -5
- package/docs/guides/principles/scoped-elements.md +2 -2
- package/docs/guides/principles/styling.md +3 -3
- package/docs/guides/principles/subclasser-apis.md +2 -2
- package/exports/define/lion-accordion.js +0 -1
- package/exports/define/lion-button-reset.js +0 -1
- package/exports/define/lion-button-submit.js +0 -1
- package/exports/define/lion-button.js +0 -1
- package/exports/define/lion-calendar.js +0 -1
- package/exports/define/lion-checkbox-group.js +0 -1
- package/exports/define/lion-checkbox-indeterminate.js +0 -1
- package/exports/define/lion-checkbox.js +0 -1
- package/exports/define/lion-collapsible.js +0 -1
- package/exports/define/lion-combobox.js +0 -1
- package/exports/define/lion-dialog.js +0 -1
- package/exports/define/lion-drawer.js +0 -1
- package/exports/define/lion-field.js +0 -1
- package/exports/define/lion-fieldset.js +0 -1
- package/exports/define/lion-form.js +0 -1
- package/exports/define/lion-icon.js +0 -1
- package/exports/define/lion-input-amount-dropdown.js +0 -1
- package/exports/define/lion-input-amount.js +0 -1
- package/exports/define/lion-input-date.js +0 -1
- package/exports/define/lion-input-datepicker.js +0 -1
- package/exports/define/lion-input-email.js +0 -1
- package/exports/define/lion-input-file.js +0 -1
- package/exports/define/lion-input-iban.js +0 -1
- package/exports/define/lion-input-range.js +0 -1
- package/exports/define/lion-input-stepper.js +0 -1
- package/exports/define/lion-input-tel-dropdown.js +0 -1
- package/exports/define/lion-input-tel.js +0 -1
- package/exports/define/lion-input.js +0 -1
- package/exports/define/lion-item.js +0 -1
- package/exports/define/lion-listbox.js +0 -1
- package/exports/define/lion-menu.js +0 -1
- package/exports/define/lion-menuitem.js +0 -1
- package/exports/define/lion-option.js +0 -1
- package/exports/define/lion-options.js +0 -1
- package/exports/define/lion-pagination.js +0 -1
- package/exports/define/lion-progress-indicator.js +0 -1
- package/exports/define/lion-radio-group.js +0 -1
- package/exports/define/lion-radio.js +0 -1
- package/exports/define/lion-select-invoker.js +0 -1
- package/exports/define/lion-select-rich.js +0 -1
- package/exports/define/lion-select.js +0 -1
- package/exports/define/lion-selected-file-list.js +0 -1
- package/exports/define/lion-step.js +0 -1
- package/exports/define/lion-steps.js +0 -1
- package/exports/define/lion-switch-button.js +0 -1
- package/exports/define/lion-switch.js +0 -1
- package/exports/define/lion-tabs.js +0 -1
- package/exports/define/lion-textarea.js +0 -1
- package/exports/define/lion-tooltip.js +0 -1
- package/exports/define/lion-validation-feedback.js +0 -1
- package/exports/define-helpers/sb-action-logger.js +0 -1
- package/exports/define-helpers/sb-locale-switcher.js +0 -1
- package/exports/form-core.js +0 -8
- package/exports/localize-no-side-effects.js +0 -1
- package/exports/localize.js +0 -2
- package/exports/overlays.js +0 -4
- package/generated/awesome-phonenumber/LICENSE +22 -0
- package/generated/awesome-phonenumber/LICENSE.closure-library +176 -0
- package/generated/awesome-phonenumber/LICENSE.libphonenumber +176 -0
- package/generated/awesome-phonenumber/checksums.json +6 -0
- package/generated/awesome-phonenumber/index-esm.mjs +817 -0
- package/generated/awesome-phonenumber/index.d.ts +227 -0
- package/generated/awesome-phonenumber/index.js +45 -0
- package/generated/awesome-phonenumber/lib/index.js +710 -0
- package/generated/awesome-phonenumber/package.json +9 -0
- package/generated/awesome-phonenumber/provenance.json +13 -0
- package/package.json +38 -15
- package/vscode.html-custom-data.json +5 -5
- package/web-types.json +1 -1
- package/vendor/README.md +0 -61
- package/vendor/awesome-phonenumber-7.9.0-tlouisse.libphonenumber-9.0.41.tgz +0 -0
|
@@ -31,609 +31,603 @@ import { FormElementsHaveNoError } from './FormElementsHaveNoError.js';
|
|
|
31
31
|
* @param {import('@open-wc/dedupe-mixin').Constructor<import('lit').LitElement>} superclass
|
|
32
32
|
*/
|
|
33
33
|
// prettier-ignore
|
|
34
|
-
const FormGroupMixinImplementation = /** @type {FormGroupMixin} */ (superclass
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Object keyed by formElements names, containing formElements' modelValues
|
|
59
|
-
*/
|
|
60
|
-
get modelValue() {
|
|
61
|
-
return this._getFromAllFormElements('modelValue');
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
set modelValue(values) {
|
|
65
|
-
// @ts-ignore [ts7-2565] TS7 checks definite assignment on this inferred field; private field: hoist to a class field with an initializer (the fix proven on LionAccordion)
|
|
66
|
-
if (this.__isInitialModelValue) {
|
|
67
|
-
this.__isInitialModelValue = false;
|
|
68
|
-
this.registrationComplete.then(() => {
|
|
69
|
-
this._setValueMapForAllFormElements('modelValue', values);
|
|
70
|
-
});
|
|
71
|
-
} else {
|
|
72
|
-
this._setValueMapForAllFormElements('modelValue', values);
|
|
34
|
+
const FormGroupMixinImplementation = /** @type {FormGroupMixin} */superclass => class FormGroupMixin extends FormRegistrarMixin(FormControlMixin(ValidateMixin(DisabledMixin(SlotMixin(superclass))))) {
|
|
35
|
+
/** @type {any} */
|
|
36
|
+
static get properties() {
|
|
37
|
+
return {
|
|
38
|
+
submitted: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
reflect: true
|
|
41
|
+
},
|
|
42
|
+
focused: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
reflect: true
|
|
45
|
+
},
|
|
46
|
+
dirty: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
reflect: true
|
|
49
|
+
},
|
|
50
|
+
touched: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
reflect: true
|
|
53
|
+
},
|
|
54
|
+
prefilled: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
reflect: true
|
|
73
57
|
}
|
|
74
|
-
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The host element with role group (or radio-group or form) containing necessary aria attributes
|
|
63
|
+
* @protected
|
|
64
|
+
*/
|
|
65
|
+
get _inputNode() {
|
|
66
|
+
return this;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Object keyed by formElements names, containing formElements' modelValues
|
|
71
|
+
*/
|
|
72
|
+
get modelValue() {
|
|
73
|
+
return this._getFromAllFormElements('modelValue');
|
|
74
|
+
}
|
|
75
|
+
set modelValue(values) {
|
|
76
|
+
// @ts-ignore [ts7-2565] TS7 checks definite assignment on this inferred field; private field: hoist to a class field with an initializer (the fix proven on LionAccordion)
|
|
77
|
+
if (this.__isInitialModelValue) {
|
|
78
|
+
this.__isInitialModelValue = false;
|
|
79
|
+
this.registrationComplete.then(() => {
|
|
80
|
+
this._setValueMapForAllFormElements('modelValue', values);
|
|
81
|
+
});
|
|
82
|
+
} else {
|
|
83
|
+
this._setValueMapForAllFormElements('modelValue', values);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Object keyed by formElements names, containing formElements' serializedValues
|
|
89
|
+
*/
|
|
90
|
+
get serializedValue() {
|
|
91
|
+
return this._getFromAllFormElements('serializedValue');
|
|
92
|
+
}
|
|
93
|
+
set serializedValue(values) {
|
|
94
|
+
// @ts-ignore [ts7-2565] TS7 checks definite assignment on this inferred field; private field: hoist to a class field with an initializer (the fix proven on LionAccordion)
|
|
95
|
+
if (this.__isInitialSerializedValue) {
|
|
96
|
+
this.__isInitialSerializedValue = false;
|
|
97
|
+
this.registrationComplete.then(() => {
|
|
98
|
+
this._setValueMapForAllFormElements('serializedValue', values);
|
|
99
|
+
});
|
|
100
|
+
} else {
|
|
101
|
+
this._setValueMapForAllFormElements('serializedValue', values);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Object keyed by formElements names, containing formElements' formattedValues
|
|
107
|
+
*/
|
|
108
|
+
get formattedValue() {
|
|
109
|
+
return this._getFromAllFormElements('formattedValue');
|
|
110
|
+
}
|
|
111
|
+
set formattedValue(values) {
|
|
112
|
+
this._setValueMapForAllFormElements('formattedValue', values);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* True when all of the children are prefilled (see InteractionStateMixin for more details.)
|
|
117
|
+
*/
|
|
118
|
+
get prefilled() {
|
|
119
|
+
return this._everyFormElementHas('prefilled');
|
|
120
|
+
}
|
|
121
|
+
constructor() {
|
|
122
|
+
super();
|
|
123
|
+
|
|
124
|
+
// ._inputNode === this, which always requires a value prop
|
|
125
|
+
this.value = '';
|
|
75
126
|
|
|
76
127
|
/**
|
|
77
|
-
*
|
|
128
|
+
* Disables all formElements in group
|
|
78
129
|
*/
|
|
79
|
-
|
|
80
|
-
return this._getFromAllFormElements('serializedValue');
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
set serializedValue(values) {
|
|
84
|
-
// @ts-ignore [ts7-2565] TS7 checks definite assignment on this inferred field; private field: hoist to a class field with an initializer (the fix proven on LionAccordion)
|
|
85
|
-
if (this.__isInitialSerializedValue) {
|
|
86
|
-
this.__isInitialSerializedValue = false;
|
|
87
|
-
this.registrationComplete.then(() => {
|
|
88
|
-
this._setValueMapForAllFormElements('serializedValue', values);
|
|
89
|
-
});
|
|
90
|
-
} else {
|
|
91
|
-
this._setValueMapForAllFormElements('serializedValue', values);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
130
|
+
this.disabled = false;
|
|
94
131
|
|
|
95
132
|
/**
|
|
96
|
-
*
|
|
133
|
+
* True when parent form is submitted
|
|
97
134
|
*/
|
|
98
|
-
|
|
99
|
-
return this._getFromAllFormElements('formattedValue');
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
set formattedValue(values) {
|
|
103
|
-
this._setValueMapForAllFormElements('formattedValue', values);
|
|
104
|
-
}
|
|
135
|
+
this.submitted = false;
|
|
105
136
|
|
|
106
137
|
/**
|
|
107
|
-
* True when
|
|
138
|
+
* True when any of the children is dirty (see InteractionStateMixin for more details.)
|
|
108
139
|
*/
|
|
109
|
-
|
|
110
|
-
return this._everyFormElementHas('prefilled');
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
constructor() {
|
|
114
|
-
super();
|
|
115
|
-
|
|
116
|
-
// ._inputNode === this, which always requires a value prop
|
|
117
|
-
this.value = '';
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Disables all formElements in group
|
|
121
|
-
*/
|
|
122
|
-
this.disabled = false;
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* True when parent form is submitted
|
|
126
|
-
*/
|
|
127
|
-
this.submitted = false;
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* True when any of the children is dirty (see InteractionStateMixin for more details.)
|
|
131
|
-
*/
|
|
132
|
-
this.dirty = false;
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* True when the group as a whole is blurred (see InteractionStateMixin for more details.)
|
|
136
|
-
*/
|
|
137
|
-
this.touched = false;
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* True when any of the children is focused.
|
|
141
|
-
*/
|
|
142
|
-
this.focused = false;
|
|
143
|
-
|
|
144
|
-
/** @private */
|
|
145
|
-
this.__addedSubValidators = false;
|
|
146
|
-
/** @private */
|
|
147
|
-
this.__isInitialModelValue = true;
|
|
148
|
-
/** @private */
|
|
149
|
-
this.__isInitialSerializedValue = true;
|
|
150
|
-
/** @private */
|
|
151
|
-
this._checkForOutsideClick = this._checkForOutsideClick.bind(this);
|
|
152
|
-
|
|
153
|
-
this.addEventListener('focusin', this._syncFocused);
|
|
154
|
-
this.addEventListener('focusout', this._onFocusOut);
|
|
155
|
-
this.addEventListener('dirty-changed', this._syncDirty);
|
|
156
|
-
this.addEventListener('validate-performed', this.__onChildValidatePerformed);
|
|
157
|
-
|
|
158
|
-
this.defaultValidators = [new FormElementsHaveNoError()];
|
|
159
|
-
|
|
160
|
-
this.__descriptionElementsInParentChain = new Set();
|
|
161
|
-
|
|
162
|
-
/** @type {{modelValue?:{[key:string]: any}, serializedValue?:{[key:string]: any}}} */
|
|
163
|
-
this.__pendingValues = { modelValue: {}, serializedValue: {} };
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
connectedCallback() {
|
|
167
|
-
super.connectedCallback();
|
|
168
|
-
this.setAttribute('role', 'group');
|
|
169
|
-
|
|
170
|
-
this.initComplete.then(() => {
|
|
171
|
-
this.__isInitialModelValue = false;
|
|
172
|
-
this.__isInitialSerializedValue = false;
|
|
173
|
-
this.__initInteractionStates();
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
disconnectedCallback() {
|
|
178
|
-
super.disconnectedCallback();
|
|
179
|
-
|
|
180
|
-
if (this.__hasActiveOutsideClickHandling) {
|
|
181
|
-
document.removeEventListener('click', this._checkForOutsideClick);
|
|
182
|
-
this.__hasActiveOutsideClickHandling = false;
|
|
183
|
-
}
|
|
184
|
-
this.__descriptionElementsInParentChain.clear();
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
__initInteractionStates() {
|
|
188
|
-
this.formElements.forEach(el => {
|
|
189
|
-
if (typeof el.initInteractionState === 'function') {
|
|
190
|
-
el.initInteractionState();
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
}
|
|
140
|
+
this.dirty = false;
|
|
194
141
|
|
|
195
142
|
/**
|
|
196
|
-
*
|
|
143
|
+
* True when the group as a whole is blurred (see InteractionStateMixin for more details.)
|
|
197
144
|
*/
|
|
198
|
-
|
|
199
|
-
this.registrationComplete.then(() => {
|
|
200
|
-
this._dispatchInitialModelValueChangedEvent();
|
|
201
|
-
});
|
|
202
|
-
}
|
|
145
|
+
this.touched = false;
|
|
203
146
|
|
|
204
147
|
/**
|
|
205
|
-
*
|
|
148
|
+
* True when any of the children is focused.
|
|
206
149
|
*/
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
150
|
+
this.focused = false;
|
|
151
|
+
|
|
152
|
+
/** @private */
|
|
153
|
+
this.__addedSubValidators = false;
|
|
154
|
+
/** @private */
|
|
155
|
+
this.__isInitialModelValue = true;
|
|
156
|
+
/** @private */
|
|
157
|
+
this.__isInitialSerializedValue = true;
|
|
158
|
+
/** @private */
|
|
159
|
+
this._checkForOutsideClick = this._checkForOutsideClick.bind(this);
|
|
160
|
+
this.addEventListener('focusin', this._syncFocused);
|
|
161
|
+
this.addEventListener('focusout', this._onFocusOut);
|
|
162
|
+
this.addEventListener('dirty-changed', this._syncDirty);
|
|
163
|
+
this.addEventListener('validate-performed', this.__onChildValidatePerformed);
|
|
164
|
+
this.defaultValidators = [new FormElementsHaveNoError()];
|
|
165
|
+
this.__descriptionElementsInParentChain = new Set();
|
|
166
|
+
|
|
167
|
+
/** @type {{modelValue?:{[key:string]: any}, serializedValue?:{[key:string]: any}}} */
|
|
168
|
+
this.__pendingValues = {
|
|
169
|
+
modelValue: {},
|
|
170
|
+
serializedValue: {}
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
connectedCallback() {
|
|
174
|
+
super.connectedCallback();
|
|
175
|
+
this.setAttribute('role', 'group');
|
|
176
|
+
this.initComplete.then(() => {
|
|
177
|
+
this.__isInitialModelValue = false;
|
|
178
|
+
this.__isInitialSerializedValue = false;
|
|
179
|
+
this.__initInteractionStates();
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
disconnectedCallback() {
|
|
183
|
+
super.disconnectedCallback();
|
|
184
|
+
if (this.__hasActiveOutsideClickHandling) {
|
|
185
|
+
document.removeEventListener('click', this._checkForOutsideClick);
|
|
186
|
+
this.__hasActiveOutsideClickHandling = false;
|
|
187
|
+
}
|
|
188
|
+
this.__descriptionElementsInParentChain.clear();
|
|
189
|
+
}
|
|
190
|
+
__initInteractionStates() {
|
|
191
|
+
this.formElements.forEach(el => {
|
|
192
|
+
if (typeof el.initInteractionState === 'function') {
|
|
193
|
+
el.initInteractionState();
|
|
216
194
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* @override from FormControlMixin
|
|
200
|
+
*/
|
|
201
|
+
_triggerInitialModelValueChangedEvent() {
|
|
202
|
+
this.registrationComplete.then(() => {
|
|
203
|
+
this._dispatchInitialModelValueChangedEvent();
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* @param {import('lit').PropertyValues } changedProperties
|
|
209
|
+
*/
|
|
210
|
+
updated(changedProperties) {
|
|
211
|
+
super.updated(changedProperties);
|
|
212
|
+
if (changedProperties.has('disabled')) {
|
|
213
|
+
if (this.disabled) {
|
|
214
|
+
this.__requestChildrenToBeDisabled();
|
|
215
|
+
} else {
|
|
216
|
+
this.__retractRequestChildrenToBeDisabled();
|
|
222
217
|
}
|
|
223
218
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
document.addEventListener('click', this._checkForOutsideClick);
|
|
228
|
-
this.__hasActiveOutsideClickHandling = true;
|
|
219
|
+
if (changedProperties.has('focused')) {
|
|
220
|
+
if (this.focused === true) {
|
|
221
|
+
this.__setupOutsideClickHandling();
|
|
229
222
|
}
|
|
230
223
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
224
|
+
}
|
|
225
|
+
__setupOutsideClickHandling() {
|
|
226
|
+
if (!this.__hasActiveOutsideClickHandling) {
|
|
227
|
+
document.addEventListener('click', this._checkForOutsideClick);
|
|
228
|
+
this.__hasActiveOutsideClickHandling = true;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* @param {Event} event
|
|
234
|
+
*/
|
|
235
|
+
_checkForOutsideClick(event) {
|
|
236
|
+
const outsideGroupClicked = !this.contains(/** @type {Node} */event.target);
|
|
237
|
+
if (outsideGroupClicked) {
|
|
238
|
+
this.touched = true;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
__requestChildrenToBeDisabled() {
|
|
242
|
+
this.formElements.forEach(child => {
|
|
243
|
+
if (child.makeRequestToBeDisabled) {
|
|
244
|
+
child.makeRequestToBeDisabled();
|
|
239
245
|
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
__retractRequestChildrenToBeDisabled() {
|
|
251
|
-
this.formElements.forEach(child => {
|
|
252
|
-
if (child.retractRequestToBeDisabled) {
|
|
253
|
-
child.retractRequestToBeDisabled();
|
|
254
|
-
}
|
|
255
|
-
});
|
|
256
|
-
}
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
__retractRequestChildrenToBeDisabled() {
|
|
249
|
+
this.formElements.forEach(child => {
|
|
250
|
+
if (child.retractRequestToBeDisabled) {
|
|
251
|
+
child.retractRequestToBeDisabled();
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
}
|
|
257
255
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
256
|
+
// eslint-disable-next-line class-methods-use-this
|
|
257
|
+
_inputGroupTemplate() {
|
|
258
|
+
return html`
|
|
261
259
|
<div class="input-group">
|
|
262
260
|
<slot></slot>
|
|
263
261
|
</div>
|
|
264
262
|
`;
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Handles interaction state 'submitted'.
|
|
267
|
+
* This allows children to enable visibility of validation feedback
|
|
268
|
+
*/
|
|
269
|
+
submitGroup() {
|
|
270
|
+
this.submitted = true;
|
|
271
|
+
this.formElements.forEach(child => {
|
|
272
|
+
if (typeof child.submitGroup === 'function') {
|
|
273
|
+
child.submitGroup();
|
|
274
|
+
} else {
|
|
275
|
+
child.submitted = true; // eslint-disable-line no-param-reassign
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Resets to initial/prefilled values and interaction states of all FormControls in group,
|
|
282
|
+
*/
|
|
283
|
+
resetGroup() {
|
|
284
|
+
this.formElements.forEach(child => {
|
|
285
|
+
if (typeof child.resetGroup === 'function') {
|
|
286
|
+
child.resetGroup();
|
|
287
|
+
} else if (typeof child.reset === 'function') {
|
|
288
|
+
child.reset();
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
this.resetInteractionState();
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Clears all values and resets all interaction states of all FormControls in group,
|
|
296
|
+
*/
|
|
297
|
+
clearGroup() {
|
|
298
|
+
this.formElements.forEach(child => {
|
|
299
|
+
if (typeof child.clearGroup === 'function') {
|
|
300
|
+
child.clearGroup();
|
|
301
|
+
} else if (typeof child.clear === 'function') {
|
|
302
|
+
child.clear();
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
this.resetInteractionState();
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Resets all interaction states for all formElements
|
|
310
|
+
*/
|
|
311
|
+
resetInteractionState() {
|
|
312
|
+
this.submitted = false;
|
|
313
|
+
this.touched = false;
|
|
314
|
+
this.dirty = false;
|
|
315
|
+
this.formElements.forEach(formElement => {
|
|
316
|
+
if (typeof formElement.resetInteractionState === 'function') {
|
|
317
|
+
formElement.resetInteractionState();
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* @override ValidateMixin
|
|
324
|
+
* Show the validity feedback when one of the following conditions is met:
|
|
325
|
+
*
|
|
326
|
+
* - submitted
|
|
327
|
+
* If the form is submitted, always show the error message.
|
|
328
|
+
*
|
|
329
|
+
* - prefilled
|
|
330
|
+
* all form elements already had a value when the group was initially rendered.
|
|
331
|
+
*
|
|
332
|
+
* - touched && dirty
|
|
333
|
+
* When a user has changed the value of (one of) the form elements (making it dirty)
|
|
334
|
+
* and then leaves the group as a whole (making it touched), an error message should
|
|
335
|
+
* be shown. Before that, the group is considered 'invalid, but not yet interacting'.
|
|
336
|
+
* @protected
|
|
337
|
+
* @param {string} type
|
|
338
|
+
* @param {InteractionStates} meta
|
|
339
|
+
*/
|
|
340
|
+
// eslint-disable-next-line class-methods-use-this, no-unused-vars
|
|
341
|
+
_showFeedbackConditionFor(type, meta) {
|
|
342
|
+
return meta.touched && meta.dirty || meta.prefilled || meta.submitted;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* @enhance ValidateMixin
|
|
347
|
+
*/
|
|
348
|
+
get _feedbackConditionMeta() {
|
|
349
|
+
return {
|
|
350
|
+
...super._feedbackConditionMeta,
|
|
351
|
+
submitted: this.submitted,
|
|
352
|
+
touched: this.touched,
|
|
353
|
+
dirty: this.dirty,
|
|
354
|
+
prefilled: this.prefilled
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* A filter function which will exclude a form field when returning false
|
|
360
|
+
* By default, exclude form fields which are disabled
|
|
361
|
+
*
|
|
362
|
+
* The type is be passed as well for more fine grained control, e.g.
|
|
363
|
+
* distinguish the filter when fetching modelValue versus serializedValue
|
|
364
|
+
*
|
|
365
|
+
* @param {FormControl} el
|
|
366
|
+
* @param {string} type
|
|
367
|
+
* @returns {boolean}
|
|
368
|
+
*/
|
|
369
|
+
// eslint-disable-next-line class-methods-use-this, no-unused-vars
|
|
370
|
+
_getFromAllFormElementsFilter(el, type) {
|
|
371
|
+
return !el.disabled;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Gets a keyed be name object for requested property (like modelValue/serializedValue)
|
|
376
|
+
* @param {string} property
|
|
377
|
+
* @param {(el: FormControl, property?: string) => boolean} [filterFn]
|
|
378
|
+
* @returns {{[name:string]: any}}
|
|
379
|
+
*/
|
|
380
|
+
_getFromAllFormElements(property, filterFn) {
|
|
381
|
+
/** @type {{[name:string]: any}} */
|
|
382
|
+
const result = {};
|
|
383
|
+
|
|
384
|
+
// Prioritizes imperatively passed filter function over the protected method
|
|
385
|
+
const _filterFn = filterFn || this._getFromAllFormElementsFilter;
|
|
386
|
+
|
|
387
|
+
// @ts-ignore [allow-protected]: allow Form internals to access this protected method
|
|
388
|
+
this.formElements._keys().forEach(name => {
|
|
389
|
+
const elem = this.formElements[name];
|
|
390
|
+
if (elem instanceof FormControlsCollection) {
|
|
391
|
+
result[name] = elem.filter(el => _filterFn(el, property)).map(el => el[property]);
|
|
392
|
+
} else if (_filterFn(elem, property)) {
|
|
393
|
+
if (typeof elem._getFromAllFormElements === 'function') {
|
|
394
|
+
result[name] = elem._getFromAllFormElements(property);
|
|
276
395
|
} else {
|
|
277
|
-
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Resets to initial/prefilled values and interaction states of all FormControls in group,
|
|
284
|
-
*/
|
|
285
|
-
resetGroup() {
|
|
286
|
-
this.formElements.forEach(child => {
|
|
287
|
-
if (typeof child.resetGroup === 'function') {
|
|
288
|
-
child.resetGroup();
|
|
289
|
-
} else if (typeof child.reset === 'function') {
|
|
290
|
-
child.reset();
|
|
291
|
-
}
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
this.resetInteractionState();
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* Clears all values and resets all interaction states of all FormControls in group,
|
|
299
|
-
*/
|
|
300
|
-
clearGroup() {
|
|
301
|
-
this.formElements.forEach(child => {
|
|
302
|
-
if (typeof child.clearGroup === 'function') {
|
|
303
|
-
child.clearGroup();
|
|
304
|
-
} else if (typeof child.clear === 'function') {
|
|
305
|
-
child.clear();
|
|
306
|
-
}
|
|
307
|
-
});
|
|
308
|
-
|
|
309
|
-
this.resetInteractionState();
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* Resets all interaction states for all formElements
|
|
314
|
-
*/
|
|
315
|
-
resetInteractionState() {
|
|
316
|
-
this.submitted = false;
|
|
317
|
-
this.touched = false;
|
|
318
|
-
this.dirty = false;
|
|
319
|
-
this.formElements.forEach(formElement => {
|
|
320
|
-
if (typeof formElement.resetInteractionState === 'function') {
|
|
321
|
-
formElement.resetInteractionState();
|
|
396
|
+
result[name] = elem[property];
|
|
322
397
|
}
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
* @override ValidateMixin
|
|
328
|
-
* Show the validity feedback when one of the following conditions is met:
|
|
329
|
-
*
|
|
330
|
-
* - submitted
|
|
331
|
-
* If the form is submitted, always show the error message.
|
|
332
|
-
*
|
|
333
|
-
* - prefilled
|
|
334
|
-
* all form elements already had a value when the group was initially rendered.
|
|
335
|
-
*
|
|
336
|
-
* - touched && dirty
|
|
337
|
-
* When a user has changed the value of (one of) the form elements (making it dirty)
|
|
338
|
-
* and then leaves the group as a whole (making it touched), an error message should
|
|
339
|
-
* be shown. Before that, the group is considered 'invalid, but not yet interacting'.
|
|
340
|
-
* @protected
|
|
341
|
-
* @param {string} type
|
|
342
|
-
* @param {InteractionStates} meta
|
|
343
|
-
*/
|
|
344
|
-
// eslint-disable-next-line class-methods-use-this, no-unused-vars
|
|
345
|
-
_showFeedbackConditionFor(type, meta) {
|
|
346
|
-
return (meta.touched && meta.dirty) || meta.prefilled || meta.submitted;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* @enhance ValidateMixin
|
|
351
|
-
*/
|
|
352
|
-
get _feedbackConditionMeta() {
|
|
353
|
-
return {
|
|
354
|
-
...super._feedbackConditionMeta,
|
|
355
|
-
submitted: this.submitted,
|
|
356
|
-
touched: this.touched,
|
|
357
|
-
dirty: this.dirty,
|
|
358
|
-
prefilled: this.prefilled,
|
|
359
|
-
};
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* A filter function which will exclude a form field when returning false
|
|
364
|
-
* By default, exclude form fields which are disabled
|
|
365
|
-
*
|
|
366
|
-
* The type is be passed as well for more fine grained control, e.g.
|
|
367
|
-
* distinguish the filter when fetching modelValue versus serializedValue
|
|
368
|
-
*
|
|
369
|
-
* @param {FormControl} el
|
|
370
|
-
* @param {string} type
|
|
371
|
-
* @returns {boolean}
|
|
372
|
-
*/
|
|
373
|
-
// eslint-disable-next-line class-methods-use-this, no-unused-vars
|
|
374
|
-
_getFromAllFormElementsFilter(el, type) {
|
|
375
|
-
return !el.disabled;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
/**
|
|
379
|
-
* Gets a keyed be name object for requested property (like modelValue/serializedValue)
|
|
380
|
-
* @param {string} property
|
|
381
|
-
* @param {(el: FormControl, property?: string) => boolean} [filterFn]
|
|
382
|
-
* @returns {{[name:string]: any}}
|
|
383
|
-
*/
|
|
384
|
-
_getFromAllFormElements(property, filterFn) {
|
|
385
|
-
/** @type {{[name:string]: any}} */
|
|
386
|
-
const result = {};
|
|
387
|
-
|
|
388
|
-
// Prioritizes imperatively passed filter function over the protected method
|
|
389
|
-
const _filterFn = filterFn || this._getFromAllFormElementsFilter;
|
|
390
|
-
|
|
391
|
-
// @ts-ignore [allow-protected]: allow Form internals to access this protected method
|
|
392
|
-
this.formElements._keys().forEach(name => {
|
|
393
|
-
const elem = this.formElements[name];
|
|
394
|
-
if (elem instanceof FormControlsCollection) {
|
|
395
|
-
result[name] = elem.filter(el => _filterFn(el, property)).map(el => el[property]);
|
|
396
|
-
} else if (_filterFn(elem, property)) {
|
|
397
|
-
if (typeof elem._getFromAllFormElements === 'function') {
|
|
398
|
-
result[name] = elem._getFromAllFormElements(property);
|
|
399
|
-
} else {
|
|
400
|
-
result[name] = elem[property];
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
});
|
|
404
|
-
return result;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
/**
|
|
408
|
-
* Sets the same value for requested property in all formElements
|
|
409
|
-
* @param {string | number} property
|
|
410
|
-
* @param {any} value
|
|
411
|
-
*/
|
|
412
|
-
_setValueForAllFormElements(property, value) {
|
|
413
|
-
this.formElements.forEach(el => {
|
|
414
|
-
el[property] = value; // eslint-disable-line no-param-reassign
|
|
415
|
-
});
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
/**
|
|
419
|
-
* Allows to set formElements values via a keyed object structure
|
|
420
|
-
* @param {string} property
|
|
421
|
-
* @param {{ [x: string]: any; }} values
|
|
422
|
-
*/
|
|
423
|
-
_setValueMapForAllFormElements(property, values) {
|
|
424
|
-
if (values && typeof values === 'object') {
|
|
425
|
-
Object.keys(values).forEach(name => {
|
|
426
|
-
if (Array.isArray(this.formElements[name])) {
|
|
427
|
-
this.formElements[name].forEach(
|
|
428
|
-
(/** @type {FormControl} */ el, /** @type {number} */ index) => {
|
|
429
|
-
// @ts-ignore [dynamic-property-access]
|
|
430
|
-
el[property] = values[name][index]; // eslint-disable-line no-param-reassign
|
|
431
|
-
},
|
|
432
|
-
);
|
|
433
|
-
}
|
|
434
|
-
if (this.formElements[name]) {
|
|
435
|
-
this.formElements[name][property] = values[name];
|
|
436
|
-
} else {
|
|
437
|
-
// @ts-ignore [dynamic-property-access]
|
|
438
|
-
this.__pendingValues[property][name] = values[name];
|
|
439
|
-
}
|
|
440
|
-
});
|
|
441
398
|
}
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
399
|
+
});
|
|
400
|
+
return result;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Sets the same value for requested property in all formElements
|
|
405
|
+
* @param {string | number} property
|
|
406
|
+
* @param {any} value
|
|
407
|
+
*/
|
|
408
|
+
_setValueForAllFormElements(property, value) {
|
|
409
|
+
this.formElements.forEach(el => {
|
|
410
|
+
el[property] = value; // eslint-disable-line no-param-reassign
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Allows to set formElements values via a keyed object structure
|
|
416
|
+
* @param {string} property
|
|
417
|
+
* @param {{ [x: string]: any; }} values
|
|
418
|
+
*/
|
|
419
|
+
_setValueMapForAllFormElements(property, values) {
|
|
420
|
+
if (values && typeof values === 'object') {
|
|
421
|
+
Object.keys(values).forEach(name => {
|
|
463
422
|
if (Array.isArray(this.formElements[name])) {
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
423
|
+
this.formElements[name].forEach((/** @type {FormControl} */el, /** @type {number} */index) => {
|
|
424
|
+
// @ts-ignore [dynamic-property-access]
|
|
425
|
+
el[property] = values[name][index]; // eslint-disable-line no-param-reassign
|
|
426
|
+
});
|
|
467
427
|
}
|
|
468
|
-
|
|
469
|
-
this.formElements[name]
|
|
470
|
-
|
|
471
|
-
);
|
|
472
|
-
});
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
/**
|
|
476
|
-
* Returns true when all of the formElements have requested property
|
|
477
|
-
* @param {string} property
|
|
478
|
-
*/
|
|
479
|
-
_everyFormElementHas(property) {
|
|
480
|
-
return Object.keys(this.formElements).every(name => {
|
|
481
|
-
if (Array.isArray(this.formElements[name])) {
|
|
428
|
+
if (this.formElements[name]) {
|
|
429
|
+
this.formElements[name][property] = values[name];
|
|
430
|
+
} else {
|
|
482
431
|
// @ts-ignore [dynamic-property-access]
|
|
483
|
-
|
|
432
|
+
this.__pendingValues[property][name] = values[name];
|
|
484
433
|
}
|
|
485
|
-
return !!this.formElements[name][property];
|
|
486
434
|
});
|
|
487
435
|
}
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
if (ev && this.isRegisteredFormElement(/** @type {FormControl} */ (ev.target))) {
|
|
500
|
-
this.validate();
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* Returns true when one of the formElements has requested
|
|
440
|
+
* @param {string} property
|
|
441
|
+
*/
|
|
442
|
+
_anyFormElementHas(property) {
|
|
443
|
+
return Object.keys(this.formElements).some(name => {
|
|
444
|
+
if (Array.isArray(this.formElements[name])) {
|
|
445
|
+
// @ts-ignore [dynamic-property-access]
|
|
446
|
+
return this.formElements[name].some((/** @type {FormControl} */el) => !!el[property]);
|
|
501
447
|
}
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
if (ev.target === lastEl) {
|
|
514
|
-
this.touched = true;
|
|
448
|
+
return !!this.formElements[name][property];
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* @param {string} state one of ValidateHost.validationTypes
|
|
454
|
+
*/
|
|
455
|
+
_anyFormElementHasFeedbackFor(state) {
|
|
456
|
+
return Object.keys(this.formElements).some(name => {
|
|
457
|
+
if (Array.isArray(this.formElements[name])) {
|
|
458
|
+
return this.formElements[name].some((/** @type {FormControl} */el) => Boolean(el.hasFeedbackFor && el.hasFeedbackFor.includes(state)));
|
|
515
459
|
}
|
|
516
|
-
this.
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
* In case one of the inputs was in error state as well, the SR user would
|
|
530
|
-
* first hear the local error, followed by #group-error
|
|
531
|
-
* @example
|
|
532
|
-
* ```html
|
|
533
|
-
* <lion-fieldset name="address">
|
|
534
|
-
* <lion-input name="street" label="Street" .modelValue="${'Park Avenue'}"></lion-input>
|
|
535
|
-
* <lion-input name="number" label="Number" .modelValue="${100}">...</lion-input>
|
|
536
|
-
* <div slot="feedback" id="group-error">
|
|
537
|
-
* Park Avenue only has numbers up to 80
|
|
538
|
-
* </div>
|
|
539
|
-
* </lion-fieldset>
|
|
540
|
-
* ```
|
|
541
|
-
*/
|
|
542
|
-
__storeAllDescriptionElementsInParentChain() {
|
|
543
|
-
const unTypedThis = /** @type {unknown} */ (this);
|
|
544
|
-
let parent = /** @type {FormControlHost & { _parentFormGroup:any }} */ (unTypedThis);
|
|
545
|
-
while (parent) {
|
|
546
|
-
// @ts-ignore [allow-protected]: in parent/child relations we are allowed to call protected methods
|
|
547
|
-
const descriptionElements = parent._getAriaDescriptionElements();
|
|
548
|
-
const orderedEls = getAriaElementsInRightDomOrder(descriptionElements, { reverse: true });
|
|
549
|
-
orderedEls.forEach(el => {
|
|
550
|
-
if (el.getAttribute('slot') === 'feedback') {
|
|
551
|
-
this.__descriptionElementsInParentChain.add(el);
|
|
552
|
-
}
|
|
553
|
-
});
|
|
554
|
-
// Also check if the newly added child needs to refer grandparents
|
|
555
|
-
parent = parent._parentFormGroup;
|
|
460
|
+
return Boolean(this.formElements[name].hasFeedbackFor && this.formElements[name].hasFeedbackFor.includes(state));
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Returns true when all of the formElements have requested property
|
|
466
|
+
* @param {string} property
|
|
467
|
+
*/
|
|
468
|
+
_everyFormElementHas(property) {
|
|
469
|
+
return Object.keys(this.formElements).every(name => {
|
|
470
|
+
if (Array.isArray(this.formElements[name])) {
|
|
471
|
+
// @ts-ignore [dynamic-property-access]
|
|
472
|
+
return this.formElements[name].every((/** @type {FormControl} */el) => !!el[property]);
|
|
556
473
|
}
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
474
|
+
return !!this.formElements[name][property];
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
// TODO: the same functionality has been implemented with model-value-changed event, which
|
|
479
|
+
// covers the same and works with FormRegistrarPortalMixin
|
|
480
|
+
/**
|
|
481
|
+
* Gets triggered by event 'validate-performed' which enabled us to handle 2 different situations
|
|
482
|
+
* - react on modelValue change, which says something about the validity as a whole
|
|
483
|
+
* (at least two checkboxes for instance) and nothing about the children's values
|
|
484
|
+
* - children validity states have changed, so fieldset needs to update itself based on that
|
|
485
|
+
* @param {Event} ev
|
|
486
|
+
*/
|
|
487
|
+
__onChildValidatePerformed(ev) {
|
|
488
|
+
if (ev && this.isRegisteredFormElement(/** @type {FormControl} */ev.target)) {
|
|
489
|
+
this.validate();
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
_syncFocused() {
|
|
493
|
+
this.focused = this._anyFormElementHas('focused');
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* @param {Event} ev
|
|
498
|
+
*/
|
|
499
|
+
_onFocusOut(ev) {
|
|
500
|
+
const lastEl = this.formElements[this.formElements.length - 1];
|
|
501
|
+
if (ev.target === lastEl) {
|
|
502
|
+
this.touched = true;
|
|
503
|
+
}
|
|
504
|
+
this.focused = false;
|
|
505
|
+
}
|
|
506
|
+
_syncDirty() {
|
|
507
|
+
this.dirty = this._anyFormElementHas('dirty');
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Traverses the _parentFormGroup tree, and gathers all aria description elements
|
|
512
|
+
* (feedback) that should be provided to children.
|
|
513
|
+
*
|
|
514
|
+
* In the example below, when the input for 'street' has focus, a screenreader user
|
|
515
|
+
* would hear the #group-error.
|
|
516
|
+
* In case one of the inputs was in error state as well, the SR user would
|
|
517
|
+
* first hear the local error, followed by #group-error
|
|
518
|
+
* @example
|
|
519
|
+
* ```html
|
|
520
|
+
* <lion-fieldset name="address">
|
|
521
|
+
* <lion-input name="street" label="Street" .modelValue="${'Park Avenue'}"></lion-input>
|
|
522
|
+
* <lion-input name="number" label="Number" .modelValue="${100}">...</lion-input>
|
|
523
|
+
* <div slot="feedback" id="group-error">
|
|
524
|
+
* Park Avenue only has numbers up to 80
|
|
525
|
+
* </div>
|
|
526
|
+
* </lion-fieldset>
|
|
527
|
+
* ```
|
|
528
|
+
*/
|
|
529
|
+
__storeAllDescriptionElementsInParentChain() {
|
|
530
|
+
const unTypedThis = /** @type {unknown} */this;
|
|
531
|
+
let parent = /** @type {FormControlHost & { _parentFormGroup:any }} */unTypedThis;
|
|
532
|
+
while (parent) {
|
|
533
|
+
// @ts-ignore [allow-protected]: in parent/child relations we are allowed to call protected methods
|
|
534
|
+
const descriptionElements = parent._getAriaDescriptionElements();
|
|
535
|
+
const orderedEls = getAriaElementsInRightDomOrder(descriptionElements, {
|
|
536
|
+
reverse: true
|
|
567
537
|
});
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
* @param {FormControl} child
|
|
572
|
-
*/
|
|
573
|
-
__unlinkParentMessages(child) {
|
|
574
|
-
this.__descriptionElementsInParentChain.forEach(el => {
|
|
575
|
-
if (typeof child.removeFromAriaDescribedBy === 'function') {
|
|
576
|
-
child.removeFromAriaDescribedBy(el);
|
|
538
|
+
orderedEls.forEach(el => {
|
|
539
|
+
if (el.getAttribute('slot') === 'feedback') {
|
|
540
|
+
this.__descriptionElementsInParentChain.add(el);
|
|
577
541
|
}
|
|
578
542
|
});
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
if (
|
|
590
|
-
child.
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
this.__storeAllDescriptionElementsInParentChain();
|
|
543
|
+
// Also check if the newly added child needs to refer grandparents
|
|
544
|
+
parent = parent._parentFormGroup;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* @param {FormControl} child
|
|
550
|
+
*/
|
|
551
|
+
__linkParentMessages(child) {
|
|
552
|
+
this.__descriptionElementsInParentChain.forEach(el => {
|
|
553
|
+
if (typeof child.addToAriaDescribedBy === 'function') {
|
|
554
|
+
child.addToAriaDescribedBy(el, {
|
|
555
|
+
reorder: false
|
|
556
|
+
});
|
|
594
557
|
}
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
child.serializedValue = pVals.serializedValue[child.name];
|
|
606
|
-
}
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* @param {FormControl} child
|
|
563
|
+
*/
|
|
564
|
+
__unlinkParentMessages(child) {
|
|
565
|
+
this.__descriptionElementsInParentChain.forEach(el => {
|
|
566
|
+
if (typeof child.removeFromAriaDescribedBy === 'function') {
|
|
567
|
+
child.removeFromAriaDescribedBy(el);
|
|
607
568
|
}
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
this.
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* @enhance FormRegistrarMixin: connects ValidateMixin and DisabledMixin.
|
|
574
|
+
* On top of this, error messages of children are linked to their parents
|
|
575
|
+
* @param {FormControl & {serializedValue:string|object}} child
|
|
576
|
+
* @param {number} indexToInsertAt
|
|
577
|
+
*/
|
|
578
|
+
addFormElement(child, indexToInsertAt) {
|
|
579
|
+
super.addFormElement(child, indexToInsertAt);
|
|
580
|
+
if (this.disabled) {
|
|
581
|
+
child.makeRequestToBeDisabled();
|
|
582
|
+
}
|
|
583
|
+
if (!this.__descriptionElementsInParentChain.size) {
|
|
584
|
+
this.__storeAllDescriptionElementsInParentChain();
|
|
585
|
+
}
|
|
586
|
+
this.__linkParentMessages(child);
|
|
587
|
+
this.validate({
|
|
588
|
+
clearCurrentResult: true
|
|
589
|
+
});
|
|
590
|
+
if (!child.modelValue) {
|
|
591
|
+
const pVals = this.__pendingValues;
|
|
592
|
+
if (pVals.modelValue && pVals.modelValue[child.name]) {
|
|
593
|
+
// eslint-disable-next-line no-param-reassign
|
|
594
|
+
child.modelValue = pVals.modelValue[child.name];
|
|
595
|
+
} else if (pVals.serializedValue && pVals.serializedValue[child.name]) {
|
|
596
|
+
// eslint-disable-next-line no-param-reassign
|
|
597
|
+
child.serializedValue = pVals.serializedValue[child.name];
|
|
627
598
|
}
|
|
628
|
-
this.__unlinkParentMessages(el);
|
|
629
599
|
}
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Gathers initial model values of all children. Used when resetGroup() is called.
|
|
604
|
+
*/
|
|
605
|
+
get _initialModelValue() {
|
|
606
|
+
return this._getFromAllFormElements('_initialModelValue');
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* @override FormRegistrarMixin; Connects ValidateMixin
|
|
611
|
+
* @param {FormRegisteringHost & FormControl} el
|
|
612
|
+
*/
|
|
613
|
+
removeFormElement(el) {
|
|
614
|
+
super.removeFormElement(el);
|
|
615
|
+
this.validate({
|
|
616
|
+
clearCurrentResult: true
|
|
617
|
+
});
|
|
618
|
+
if (typeof el.removeFromAriaLabelledBy === 'function' && this._labelNode) {
|
|
619
|
+
el.removeFromAriaLabelledBy(this._labelNode, {
|
|
620
|
+
reorder: false
|
|
621
|
+
});
|
|
636
622
|
}
|
|
637
|
-
|
|
623
|
+
this.__unlinkParentMessages(el);
|
|
624
|
+
}
|
|
638
625
|
|
|
626
|
+
/**
|
|
627
|
+
* @override FormControlMixin
|
|
628
|
+
*/
|
|
629
|
+
_isEmpty() {
|
|
630
|
+
return this.formElements.every(el => el._isEmpty?.());
|
|
631
|
+
}
|
|
632
|
+
};
|
|
639
633
|
export const FormGroupMixin = dedupeMixin(FormGroupMixinImplementation);
|