@lion/ui 0.2.2 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -72
- package/components/button/src/LionButton.js +1 -1
- package/components/checkbox-group/src/LionCheckboxIndeterminate.js +2 -2
- package/components/checkbox-group/test/lion-checkbox-indeterminate-integrations.test.js +6 -0
- package/components/checkbox-group/{test/lion-checkbox-indeterminate.test.js → test-suites/CheckboxIndeterminate.suite.js} +209 -187
- package/components/combobox/src/LionCombobox.js +3 -1
- package/components/combobox/test/lion-combobox.test.js +52 -0
- package/components/core/src/SlotMixin.js +3 -2
- package/components/core/test/SlotMixin.test.js +1 -1
- package/components/core/types/SlotMixinTypes.ts +4 -1
- package/components/dialog/test/lion-dialog.test.js +56 -0
- package/components/form-core/src/FocusMixin.js +33 -2
- package/components/form-core/src/LionField.js +3 -1
- package/components/form-core/src/validate/LionValidationFeedback.js +2 -5
- package/components/form-core/src/validate/ResultValidator.js +1 -1
- package/components/form-core/test/FocusMixin.test.js +33 -0
- package/components/form-core/types/validate/ValidateMixinTypes.ts +2 -2
- package/components/form-integrations/test/dialog-integrations.test.js +19 -0
- package/components/form-integrations/test/form-group-methods.test.js +11 -37
- package/components/form-integrations/test/form-integrations.test.js +4 -0
- package/components/form-integrations/test/helpers/umbrella-form.js +21 -18
- package/components/input-amount/src/LionInputAmount.js +13 -4
- package/components/input-amount/test/lion-input-amount.test.js +19 -20
- package/components/input-date/src/LionInputDate.js +2 -11
- package/components/input-datepicker/src/LionInputDatepicker.js +5 -2
- package/components/input-datepicker/test/lion-input-datepicker.test.js +20 -0
- package/components/input-file/src/FileHandle.js +98 -0
- package/components/input-file/src/LionInputFile.js +892 -0
- package/components/input-file/src/LionSelectedFileList.js +232 -0
- package/components/input-file/src/localizeNamespaceLoader.js +75 -0
- package/components/input-file/src/validators.js +114 -0
- package/components/input-file/test/FileValidators.test.js +170 -0
- package/components/input-file/test/lion-input-file.test.js +1168 -0
- package/components/input-file/test/lion-selected-file-list.test.js +207 -0
- package/components/input-file/translations/bg-BG.js +5 -0
- package/components/input-file/translations/bg.js +12 -0
- package/components/input-file/translations/cs-CZ.js +5 -0
- package/components/input-file/translations/cs.js +13 -0
- package/components/input-file/translations/de-DE.js +5 -0
- package/components/input-file/translations/de.js +12 -0
- package/components/input-file/translations/en-AU.js +5 -0
- package/components/input-file/translations/en-GB.js +5 -0
- package/components/input-file/translations/en-PH.js +5 -0
- package/components/input-file/translations/en-US.js +5 -0
- package/components/input-file/translations/en.js +12 -0
- package/components/input-file/translations/es-ES.js +5 -0
- package/components/input-file/translations/es.js +12 -0
- package/components/input-file/translations/fr-BE.js +5 -0
- package/components/input-file/translations/fr-FR.js +5 -0
- package/components/input-file/translations/fr.js +13 -0
- package/components/input-file/translations/hu-HU.js +5 -0
- package/components/input-file/translations/hu.js +12 -0
- package/components/input-file/translations/it-IT.js +5 -0
- package/components/input-file/translations/it.js +12 -0
- package/components/input-file/translations/nl-BE.js +5 -0
- package/components/input-file/translations/nl-NL.js +5 -0
- package/components/input-file/translations/nl.js +12 -0
- package/components/input-file/translations/pl-PL.js +5 -0
- package/components/input-file/translations/pl.js +12 -0
- package/components/input-file/translations/ro-RO.js +5 -0
- package/components/input-file/translations/ro.js +12 -0
- package/components/input-file/translations/ru-RU.js +5 -0
- package/components/input-file/translations/ru.js +12 -0
- package/components/input-file/translations/sk-SK.js +5 -0
- package/components/input-file/translations/sk.js +12 -0
- package/components/input-file/translations/uk-UA.js +5 -0
- package/components/input-file/translations/uk.js +12 -0
- package/components/input-file/translations/zh-CN.js +5 -0
- package/components/input-file/translations/zh.js +12 -0
- package/components/input-file/types/input-file.d.ts +32 -0
- package/components/input-tel-dropdown/src/LionInputTelDropdown.js +1 -4
- package/components/listbox/src/ListboxMixin.js +3 -2
- package/components/listbox/test-suites/ListboxMixin.suite.js +31 -1
- package/components/localize/src/number/utils/normalize-format-number-to-parts/forceNoSpaceBetweenCurrencySymbolAndNumber.js +22 -0
- package/components/localize/src/number/utils/normalize-format-number-to-parts/forceSymbols.js +64 -0
- package/components/localize/src/number/utils/normalize-format-number-to-parts/normalizeIntl.js +13 -7
- package/components/localize/test/number/formatNumber.test.js +6 -28
- package/custom-elements.json +13822 -9246
- package/dist-types/components/checkbox-group/test-suites/CheckboxIndeterminate.suite.d.ts +12 -0
- package/dist-types/components/checkbox-group/test-suites/CheckboxIndeterminate.suite.d.ts.map +1 -0
- package/dist-types/components/combobox/src/LionCombobox.d.ts.map +1 -1
- package/dist-types/components/combobox/test/lion-combobox.test.d.ts.map +1 -1
- package/dist-types/components/core/src/SlotMixin.d.ts.map +1 -1
- package/dist-types/components/core/types/SlotMixinTypes.d.ts +4 -0
- package/dist-types/components/core/types/SlotMixinTypes.d.ts.map +1 -1
- package/dist-types/components/dialog/test/lion-dialog.test.d.ts.map +1 -1
- package/dist-types/components/form-core/src/FocusMixin.d.ts.map +1 -1
- package/dist-types/components/form-core/src/LionField.d.ts +2 -1
- package/dist-types/components/form-core/src/LionField.d.ts.map +1 -1
- package/dist-types/components/form-core/src/validate/LionValidationFeedback.d.ts +4 -11
- package/dist-types/components/form-core/src/validate/LionValidationFeedback.d.ts.map +1 -1
- package/dist-types/components/form-core/src/validate/ResultValidator.d.ts +1 -1
- package/dist-types/components/form-core/types/validate/ValidateMixinTypes.d.ts +5 -0
- package/dist-types/components/form-core/types/validate/ValidateMixinTypes.d.ts.map +1 -1
- package/dist-types/components/form-integrations/test/dialog-integrations.test.d.ts.map +1 -1
- package/dist-types/components/form-integrations/test/form-group-methods.test.d.ts +1 -0
- package/dist-types/components/form-integrations/test/form-group-methods.test.d.ts.map +1 -1
- package/dist-types/components/form-integrations/test/helpers/umbrella-form.d.ts.map +1 -1
- package/dist-types/components/input-amount/src/LionInputAmount.d.ts +2 -4
- package/dist-types/components/input-amount/src/LionInputAmount.d.ts.map +1 -1
- package/dist-types/components/input-amount/test/lion-input-amount.test.d.ts +0 -1
- package/dist-types/components/input-amount/test/lion-input-amount.test.d.ts.map +1 -1
- package/dist-types/components/input-date/src/LionInputDate.d.ts.map +1 -1
- package/dist-types/components/input-datepicker/src/LionInputDatepicker.d.ts +1 -1
- package/dist-types/components/input-datepicker/src/LionInputDatepicker.d.ts.map +1 -1
- package/dist-types/components/input-file/src/FileHandle.d.ts +55 -0
- package/dist-types/components/input-file/src/FileHandle.d.ts.map +1 -0
- package/dist-types/components/input-file/src/LionInputFile.d.ts +230 -0
- package/dist-types/components/input-file/src/LionInputFile.d.ts.map +1 -0
- package/dist-types/components/input-file/src/LionSelectedFileList.d.ts +69 -0
- package/dist-types/components/input-file/src/LionSelectedFileList.d.ts.map +1 -0
- package/dist-types/components/input-file/src/localizeNamespaceLoader.d.ts +2 -0
- package/dist-types/components/input-file/src/localizeNamespaceLoader.d.ts.map +1 -0
- package/dist-types/components/input-file/src/validators.d.ts +58 -0
- package/dist-types/components/input-file/src/validators.d.ts.map +1 -0
- package/dist-types/components/input-file/test/FileValidators.test.d.ts +2 -0
- package/dist-types/components/input-file/test/FileValidators.test.d.ts.map +1 -0
- package/dist-types/components/input-file/test/lion-input-file.test.d.ts +5 -0
- package/dist-types/components/input-file/test/lion-input-file.test.d.ts.map +1 -0
- package/dist-types/components/input-file/test/lion-selected-file-list.test.d.ts +4 -0
- package/dist-types/components/input-file/test/lion-selected-file-list.test.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/bg-BG.d.ts +13 -0
- package/dist-types/components/input-file/translations/bg-BG.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/bg.d.ts +13 -0
- package/dist-types/components/input-file/translations/bg.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/cs-CZ.d.ts +13 -0
- package/dist-types/components/input-file/translations/cs-CZ.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/cs.d.ts +13 -0
- package/dist-types/components/input-file/translations/cs.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/de-DE.d.ts +13 -0
- package/dist-types/components/input-file/translations/de-DE.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/de.d.ts +13 -0
- package/dist-types/components/input-file/translations/de.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/en-AU.d.ts +13 -0
- package/dist-types/components/input-file/translations/en-AU.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/en-GB.d.ts +13 -0
- package/dist-types/components/input-file/translations/en-GB.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/en-PH.d.ts +13 -0
- package/dist-types/components/input-file/translations/en-PH.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/en-US.d.ts +13 -0
- package/dist-types/components/input-file/translations/en-US.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/en.d.ts +13 -0
- package/dist-types/components/input-file/translations/en.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/es-ES.d.ts +13 -0
- package/dist-types/components/input-file/translations/es-ES.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/es.d.ts +13 -0
- package/dist-types/components/input-file/translations/es.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/fr-BE.d.ts +13 -0
- package/dist-types/components/input-file/translations/fr-BE.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/fr-FR.d.ts +13 -0
- package/dist-types/components/input-file/translations/fr-FR.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/fr.d.ts +13 -0
- package/dist-types/components/input-file/translations/fr.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/hu-HU.d.ts +13 -0
- package/dist-types/components/input-file/translations/hu-HU.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/hu.d.ts +13 -0
- package/dist-types/components/input-file/translations/hu.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/it-IT.d.ts +13 -0
- package/dist-types/components/input-file/translations/it-IT.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/it.d.ts +13 -0
- package/dist-types/components/input-file/translations/it.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/nl-BE.d.ts +13 -0
- package/dist-types/components/input-file/translations/nl-BE.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/nl-NL.d.ts +13 -0
- package/dist-types/components/input-file/translations/nl-NL.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/nl.d.ts +13 -0
- package/dist-types/components/input-file/translations/nl.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/pl-PL.d.ts +13 -0
- package/dist-types/components/input-file/translations/pl-PL.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/pl.d.ts +13 -0
- package/dist-types/components/input-file/translations/pl.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/ro-RO.d.ts +13 -0
- package/dist-types/components/input-file/translations/ro-RO.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/ro.d.ts +13 -0
- package/dist-types/components/input-file/translations/ro.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/ru-RU.d.ts +13 -0
- package/dist-types/components/input-file/translations/ru-RU.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/ru.d.ts +13 -0
- package/dist-types/components/input-file/translations/ru.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/sk-SK.d.ts +13 -0
- package/dist-types/components/input-file/translations/sk-SK.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/sk.d.ts +13 -0
- package/dist-types/components/input-file/translations/sk.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/uk-UA.d.ts +13 -0
- package/dist-types/components/input-file/translations/uk-UA.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/uk.d.ts +13 -0
- package/dist-types/components/input-file/translations/uk.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/zh-CN.d.ts +13 -0
- package/dist-types/components/input-file/translations/zh-CN.d.ts.map +1 -0
- package/dist-types/components/input-file/translations/zh.d.ts +13 -0
- package/dist-types/components/input-file/translations/zh.d.ts.map +1 -0
- package/dist-types/components/input-stepper/src/LionInputStepper.d.ts +6 -0
- package/dist-types/components/input-stepper/src/LionInputStepper.d.ts.map +1 -1
- package/dist-types/components/input-tel-dropdown/src/LionInputTelDropdown.d.ts +0 -1
- package/dist-types/components/input-tel-dropdown/src/LionInputTelDropdown.d.ts.map +1 -1
- package/dist-types/components/listbox/src/ListboxMixin.d.ts.map +1 -1
- package/dist-types/components/listbox/test-suites/ListboxMixin.suite.d.ts.map +1 -1
- package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/forceNoSpaceBetweenCurrencySymbolAndNumber.d.ts +14 -0
- package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/forceNoSpaceBetweenCurrencySymbolAndNumber.d.ts.map +1 -0
- package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/forceSymbols.d.ts +20 -0
- package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/forceSymbols.d.ts.map +1 -0
- package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/normalizeIntl.d.ts.map +1 -1
- package/dist-types/exports/checkbox-group-test-suites.d.ts +2 -0
- package/dist-types/exports/checkbox-group-test-suites.d.ts.map +1 -0
- package/dist-types/exports/define/lion-input-file.d.ts +2 -0
- package/dist-types/exports/define/lion-input-file.d.ts.map +1 -0
- package/dist-types/exports/define/lion-selected-file-list.d.ts +2 -0
- package/dist-types/exports/define/lion-selected-file-list.d.ts.map +1 -0
- package/dist-types/exports/input-file.d.ts +4 -0
- package/dist-types/exports/input-file.d.ts.map +1 -0
- package/dist-types/tsconfig.tsbuildinfo +1 -1
- package/docs/components/button/extensions/bootstrap-button.mjs +240 -0
- package/docs/components/button/extensions.md +30 -0
- package/docs/components/checkbox-group/overview.md +9 -10
- package/docs/components/checkbox-group/use-cases.md +110 -142
- package/docs/components/collapsible/overview.md +1 -1
- package/docs/components/combobox/{examples.md → extensions.md} +51 -43
- package/docs/components/combobox/overview.md +1 -1
- package/docs/components/combobox/src/google-combobox/google-combobox.js +4 -1
- package/docs/components/combobox/src/md-combobox/md-combobox.js +40 -38
- package/docs/components/combobox/src/wa-combobox/wa-combobox.js +204 -209
- package/docs/components/combobox/use-cases.md +1 -1
- package/docs/components/dialog/overview.md +1 -1
- package/docs/components/fieldset/overview.md +5 -5
- package/docs/components/form/overview.md +3 -3
- package/docs/components/icon/use-cases.md +1 -1
- package/docs/components/input/overview.md +1 -1
- package/docs/components/input-amount/overview.md +3 -3
- package/docs/components/input-amount/use-cases.md +4 -2
- package/docs/components/input-date/overview.md +3 -3
- package/docs/components/input-datepicker/overview.md +5 -5
- package/docs/components/input-datepicker/use-cases.md +11 -0
- package/docs/components/input-email/overview.md +2 -2
- package/docs/components/input-file/index.md +3 -0
- package/docs/components/input-file/overview.md +32 -0
- package/docs/components/input-file/use-cases.md +424 -0
- package/docs/components/input-iban/overview.md +2 -2
- package/docs/components/input-range/overview.md +2 -2
- package/docs/components/input-stepper/overview.md +1 -1
- package/docs/components/input-tel/overview.md +1 -1
- package/docs/components/input-tel/use-cases.md +6 -6
- package/docs/components/input-tel-dropdown/{examples.md → extensions.md} +1 -1
- package/docs/components/input-tel-dropdown/overview.md +1 -1
- package/docs/components/radio-group/overview.md +3 -3
- package/docs/components/select-rich/use-cases.md +1 -1
- package/docs/components/tabs/examples.md +1 -1
- package/docs/fundamentals/index.md +4 -4
- package/docs/fundamentals/node-tools/providence-analytics/LocalConfiguration.md +1 -1
- package/docs/fundamentals/node-tools/providence-analytics/QueryResult.md +1 -1
- package/docs/fundamentals/node-tools/providence-analytics/analyzer.md +1 -1
- package/docs/fundamentals/node-tools/providence-analytics/dashboard.md +1 -1
- package/docs/fundamentals/node-tools/providence-analytics/overview.md +3 -3
- package/docs/fundamentals/node-tools/publish-docs/overview.md +3 -3
- package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md +2 -2
- package/docs/fundamentals/rationales/accessibility.md +28 -0
- package/docs/fundamentals/systems/core/SlotMixin.md +148 -0
- package/docs/fundamentals/systems/core/overview.md +1 -1
- package/docs/fundamentals/systems/form/formatting-and-parsing.md +4 -4
- package/docs/fundamentals/systems/form/model-value.md +1 -1
- package/docs/fundamentals/systems/form/overview.md +28 -28
- package/docs/fundamentals/systems/form/use-cases.md +2 -0
- package/docs/fundamentals/systems/form/validate.md +1 -1
- package/docs/fundamentals/systems/localize/overview.md +4 -4
- package/docs/fundamentals/systems/overlays/_configuration-positioning.md +116 -0
- package/docs/fundamentals/systems/overlays/_edge-cases.md +145 -0
- package/docs/fundamentals/systems/overlays/configuration.md +2 -2
- package/docs/fundamentals/systems/overlays/overview.md +5 -5
- package/docs/fundamentals/systems/overlays/use-cases.md +2 -2
- package/docs/fundamentals/tools/helpers/overview.md +1 -1
- package/docs/fundamentals/tools/singleton-manager/example-complex/index.md +21 -0
- package/docs/fundamentals/tools/singleton-manager/example-fail/index.md +19 -0
- package/docs/fundamentals/tools/singleton-manager/example-success/index.md +18 -0
- package/docs/fundamentals/tools/singleton-manager/overview.md +4 -4
- package/docs/guides/how-to/create-a-custom-field.md +5 -5
- package/docs/guides/how-to/create-a-form.md +88 -0
- package/docs/guides/how-to/extend-a-native-input.md +2 -2
- package/docs/guides/how-to/get-started.md +28 -1
- package/docs/guides/index.md +8 -8
- package/docs/guides/principles/index.md +5 -5
- package/docs/guides/principles/styling.md +1 -1
- package/exports/checkbox-group-test-suites.js +1 -0
- package/exports/define/lion-input-file.js +3 -0
- package/exports/define/lion-selected-file-list.js +3 -0
- package/exports/input-file.js +3 -0
- package/package.json +3 -2
- package/components/localize/src/number/utils/normalize-format-number-to-parts/forceENAUSymbols.js +0 -25
- package/components/localize/src/number/utils/normalize-format-number-to-parts/forceYenSymbol.js +0 -15
- package/dist-types/components/checkbox-group/test/lion-checkbox-indeterminate.test.d.ts +0 -4
- package/dist-types/components/checkbox-group/test/lion-checkbox-indeterminate.test.d.ts.map +0 -1
- package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/forceENAUSymbols.d.ts +0 -14
- package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/forceENAUSymbols.d.ts.map +0 -1
- package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/forceYenSymbol.d.ts +0 -9
- package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/forceYenSymbol.d.ts.map +0 -1
- package/docs/components/combobox/src/google-combobox/assets/googlelogo_color_272x92dp.png +0 -0
- package/docs/components/dialog/src/demo-dialog-style.js +0 -3
- package/docs/components/select-rich/src/flags.png +0 -0
- package/docs/components/select-rich/src/flags@2x.png +0 -0
- package/docs/fundamentals/systems/form/assets/FormatMixinDiagram-1.svg +0 -1
- package/docs/fundamentals/systems/form/assets/FormatMixinDiagram-2.svg +0 -1
- package/docs/fundamentals/systems/form/assets/FormatMixinDiagram-3.svg +0 -84
- package/docs/fundamentals/tools/ajax/assets/naga.json +0 -9
- package/docs/fundamentals/tools/ajax/assets/pabu.json +0 -9
- package/docs/fundamentals/tools/singleton-manager/.gitignore +0 -1
- package/docs/override.js +0 -15
|
@@ -16,6 +16,7 @@ import '@lion/ui/define/lion-input-amount.js';
|
|
|
16
16
|
import '@lion/ui/define/lion-input-date.js';
|
|
17
17
|
import '@lion/ui/define/lion-input-datepicker.js';
|
|
18
18
|
import '@lion/ui/define/lion-input-email.js';
|
|
19
|
+
import '@lion/ui/define/lion-input-file.js';
|
|
19
20
|
import '@lion/ui/define/lion-input-tel.js';
|
|
20
21
|
import '@lion/ui/define/lion-input-tel-dropdown.js';
|
|
21
22
|
import '@lion/ui/define/lion-input-iban.js';
|
|
@@ -75,6 +76,7 @@ export const main = () => {
|
|
|
75
76
|
<lion-input-amount name="money" label="Money"></lion-input-amount>
|
|
76
77
|
<lion-input-iban name="iban" label="Iban"></lion-input-iban>
|
|
77
78
|
<lion-input-email name="email" label="Email"></lion-input-email>
|
|
79
|
+
<lion-input-file name="file" label="File"></lion-input-file>
|
|
78
80
|
<lion-input-tel name="tel" label="Telephone number"></lion-input-tel>
|
|
79
81
|
<lion-checkbox-group
|
|
80
82
|
label="What do you like?"
|
|
@@ -58,7 +58,7 @@ Validation happens on every change of `modelValue`. A change in modelValue can b
|
|
|
58
58
|
|
|
59
59
|
## When validation feedback will be shown
|
|
60
60
|
|
|
61
|
-
Although validation happens realtime under the hood, displaying validity feedback in realtime may not always lead to the desired User Experience. Together with [interaction states](https://github.com/ing-bank/lion/blob/
|
|
61
|
+
Although validation happens realtime under the hood, displaying validity feedback in realtime may not always lead to the desired User Experience. Together with [interaction states](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/fundamentals/systems/form/interaction-states.md),
|
|
62
62
|
validity states can determine whether a validation message should be shown along the input field.
|
|
63
63
|
|
|
64
64
|
## Assessing field validation state programmatically
|
|
@@ -9,15 +9,15 @@ In it's simplest form it is a function that returns the translated text for a na
|
|
|
9
9
|
- Formatting of numbers, amounts
|
|
10
10
|
- Formatting of dates
|
|
11
11
|
|
|
12
|
-
Further examples and a more in depth description can be found at the [Use Cases Page](https://github.com/ing-bank/lion/blob/
|
|
12
|
+
Further examples and a more in depth description can be found at the [Use Cases Page](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/fundamentals/systems/localize/use-cases.md).
|
|
13
13
|
|
|
14
14
|
## Content
|
|
15
15
|
|
|
16
16
|
| Feature | Description |
|
|
17
17
|
| ---------------------------------------- | --------------------------------------------- |
|
|
18
|
-
| [Translate Text](https://github.com/ing-bank/lion/blob/
|
|
19
|
-
| [Format Numbers](https://github.com/ing-bank/lion/blob/
|
|
20
|
-
| [Format Dates](https://github.com/ing-bank/lion/blob/
|
|
18
|
+
| [Translate Text](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/fundamentals/systems/localize/text.md) | Load and translate text in multiple languages |
|
|
19
|
+
| [Format Numbers](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/fundamentals/systems/localize/numbers.md) | Format numbers in multiple languages |
|
|
20
|
+
| [Format Dates](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/fundamentals/systems/localize/dates.md) | Format dates in multiple languages |
|
|
21
21
|
|
|
22
22
|
## Installation
|
|
23
23
|
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
eleventyExcludeFromCollections: true
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Systems >> Overlays >> Configuration >> Positioning ||40
|
|
6
|
+
|
|
7
|
+
```js script
|
|
8
|
+
import { html, render, LitElement } from '@mdjs/mdjs-preview';
|
|
9
|
+
import { ref, createRef } from 'lit/directives/ref.js';
|
|
10
|
+
import './assets/demo-el-using-overlaymixin.mjs';
|
|
11
|
+
import './assets/applyDemoOverlayStyles.mjs';
|
|
12
|
+
import './assets/demo-overlay-positioning.mjs';
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Overlays can have two different placement modes: relative to their anchor element and relative to the viewport.
|
|
16
|
+
Depending on screen size and viewing device, one placement mode might be suited better than the other.
|
|
17
|
+
|
|
18
|
+
> Note that, the placementMode option has the values 'local' (anchor) and 'global' (viewport). These refer to their
|
|
19
|
+
> legacy position in dom (global overlays were put in the body of the page). Since overlays are built with the native `<dialog>` element,
|
|
20
|
+
> no content is moved around anymore, so their names are a bit less intuitive.
|
|
21
|
+
|
|
22
|
+
## Relative to anchor
|
|
23
|
+
|
|
24
|
+
An anchor is usually the invoker button, it can also be a non interactive reference element.
|
|
25
|
+
Anchor placement uses Popper under the hood. It supports 9 positions:
|
|
26
|
+
`top-start`, `top`, `top-end`, `right-start`, `right`, `right-end`, `bottom-start`, `bottom`, `bottom-end`, `left-start`,`left`,`left-end`
|
|
27
|
+
|
|
28
|
+
```js story
|
|
29
|
+
export const localPositioning = () => html`<demo-overlay-positioning></demo-overlay-positioning>`;
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Relative to viewport
|
|
33
|
+
|
|
34
|
+
Viewport placement uses the flexbox layout mode, leveraging the best browser capabilities when
|
|
35
|
+
the content or screen size updates.
|
|
36
|
+
Supported modes:
|
|
37
|
+
`center`, `top-left`, `top`, `top-right`, `right`, `bottom-right`, `bottom`, `bottom-left`, `left`
|
|
38
|
+
|
|
39
|
+
```js story
|
|
40
|
+
export const globalPositioning = () =>
|
|
41
|
+
html`<demo-overlay-positioning
|
|
42
|
+
placement-mode="global"
|
|
43
|
+
simulate-viewport
|
|
44
|
+
></demo-overlay-positioning>`;
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## placementMode
|
|
48
|
+
|
|
49
|
+
The `placementMode` property determines the positioning of the `contentNode`:
|
|
50
|
+
|
|
51
|
+
- next to its reference node: `local`
|
|
52
|
+
- relative to the viewport: `global`
|
|
53
|
+
|
|
54
|
+
### Local
|
|
55
|
+
|
|
56
|
+
<!-- By default, the [`referenceNode`](./configuration-elements#referencenode) is the [invokerNode](https://github.com/home/runner/work/lion/lion/configuration-elements#invokernode). -->
|
|
57
|
+
|
|
58
|
+
```js story
|
|
59
|
+
export const placementLocal = () => {
|
|
60
|
+
const placementModeLocalConfig = { placementMode: 'local' };
|
|
61
|
+
return html`
|
|
62
|
+
<demo-el-using-overlaymixin .config=${placementModeLocalConfig}>
|
|
63
|
+
<button slot="invoker">Click me to open the local overlay!</button>
|
|
64
|
+
<div slot="content" class="demo-overlay">
|
|
65
|
+
Hello! You can close this notification here:
|
|
66
|
+
<button
|
|
67
|
+
class="close-button"
|
|
68
|
+
@click=${e => e.target.dispatchEvent(new Event('close-overlay', { bubbles: true }))}
|
|
69
|
+
>
|
|
70
|
+
⨯
|
|
71
|
+
</button>
|
|
72
|
+
</div>
|
|
73
|
+
</demo-el-using-overlaymixin>
|
|
74
|
+
`;
|
|
75
|
+
};
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Global
|
|
79
|
+
|
|
80
|
+
```js story
|
|
81
|
+
export const placementGlobal = () => {
|
|
82
|
+
const placementModeGlobalConfig = { placementMode: 'global' };
|
|
83
|
+
return html`
|
|
84
|
+
<demo-el-using-overlaymixin .config=${placementModeGlobalConfig}>
|
|
85
|
+
<button slot="invoker">Click me to open the global overlay!</button>
|
|
86
|
+
<div slot="content" class="demo-overlay">
|
|
87
|
+
Hello! You can close this notification here:
|
|
88
|
+
<button
|
|
89
|
+
class="close-button"
|
|
90
|
+
@click=${e => e.target.dispatchEvent(new Event('close-overlay', { bubbles: true }))}
|
|
91
|
+
>
|
|
92
|
+
⨯
|
|
93
|
+
</button>
|
|
94
|
+
</div>
|
|
95
|
+
</demo-el-using-overlaymixin>
|
|
96
|
+
`;
|
|
97
|
+
};
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## popperConfig
|
|
101
|
+
|
|
102
|
+
/** Viewport configuration. Will be used when placementMode is 'global' \*/
|
|
103
|
+
viewportConfig?: ViewportConfig;
|
|
104
|
+
/** Hides other overlays when multiple are opened (currently exclusive to globalOverlayController) _/
|
|
105
|
+
isBlocking?: boolean;
|
|
106
|
+
/\*\* Will align contentNode with referenceNode (invokerNode by default) for local overlays. Usually needed for dropdowns. 'max' will prevent contentNode from exceeding width of referenceNode, 'min' guarantees that contentNode will be at least as wide as referenceNode. 'full' will make sure that the invoker width always is the same. _/
|
|
107
|
+
inheritsReferenceWidth?: 'max' | 'full' | 'min' | 'none';
|
|
108
|
+
/\*_ Change the default of 9999 _/
|
|
109
|
+
zIndex?: number;
|
|
110
|
+
|
|
111
|
+
| Prop | Description | Type | | | |
|
|
112
|
+
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- | --- | --- | --- |
|
|
113
|
+
| placementMode | Determines the positioning anchor (viewport vs invokerNode/referenceNode) | 'global'\|'local' | | | |
|
|
114
|
+
| viewportConfig | Viewport positioning configuration. Will be used when placementMode is 'global' | {placement: ViewportPlacement} | | | |
|
|
115
|
+
| popperConfig | Anchor positioning configuration. Will be used when placementMode is 'local' | | | | |
|
|
116
|
+
| inheritsReferenceWidth | Will align contentNode with referenceNode for local overlays. Usually needed for dropdowns. 'max' will prevent contentNode from exceeding width of referenceNode, 'min' guarantees that contentNode will be at least as wide as referenceNode. 'full' will make sure that the invoker width always is the same. | 'max' \| 'full' \| 'min' \| 'none' | | | |
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
---
|
|
2
|
+
eleventyExcludeFromCollections: true
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Systems >> Overlays >> Edge cases ||10
|
|
6
|
+
|
|
7
|
+
```js script
|
|
8
|
+
import { html, render, LitElement } from '@mdjs/mdjs-preview';
|
|
9
|
+
import { ref, createRef } from 'lit/directives/ref.js';
|
|
10
|
+
import './assets/demo-el-using-overlaymixin.mjs';
|
|
11
|
+
import './assets/applyDemoOverlayStyles.mjs';
|
|
12
|
+
import './assets/demo-overlay-positioning.mjs';
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Notorious edge cases
|
|
16
|
+
|
|
17
|
+
These edge cases are not so much related to the edges of the viewport or the anchor, but more with the difficulties involved with the dom context of the overlay.
|
|
18
|
+
That is:
|
|
19
|
+
|
|
20
|
+
- a parent that has `overflow: hidden` applied
|
|
21
|
+
- a surrounding stacking context that does not allow to paint on top
|
|
22
|
+
- a transform applied to a parent
|
|
23
|
+
|
|
24
|
+
Note that our overlay uses the `<dialog>` element under the hood. It paints to the [top layer](https://github.com/whatwg/html/issues/4633) when it is configured as a modal overlay (that is, it uses `.showModal()` to open the dialog.)
|
|
25
|
+
|
|
26
|
+
### Overflow
|
|
27
|
+
|
|
28
|
+
A positioned parent with `overflow: hidden` can cause the overlay to be invisible. This can mainly occur in non-modal overlays being absolutely
|
|
29
|
+
positioned relative to their anchor.
|
|
30
|
+
|
|
31
|
+
See [css-tricks: popping-hidden-overflow](https://css-tricks.com/popping-hidden-overflow/#aa-the-solution)
|
|
32
|
+
|
|
33
|
+
#### Overflow: the problem
|
|
34
|
+
|
|
35
|
+
```js preview-story
|
|
36
|
+
export const edgeCaseOverflowProblem = () =>
|
|
37
|
+
html`
|
|
38
|
+
<div style="padding: 54px 24px 36px;">
|
|
39
|
+
<div
|
|
40
|
+
style="overflow: hidden; border: 1px black dashed; padding-top: 44px; padding-bottom: 16px;"
|
|
41
|
+
>
|
|
42
|
+
<div style="display: flex; justify-content: space-evenly; position: relative;">
|
|
43
|
+
<demo-overlay-el opened use-absolute>
|
|
44
|
+
<button slot="invoker" aria-label="local, non modal"></button>
|
|
45
|
+
<div slot="content">absolute (for demo)</div>
|
|
46
|
+
</demo-overlay-el>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
`;
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
#### Overflow: the solution
|
|
54
|
+
|
|
55
|
+
Two solutions are thinkable:
|
|
56
|
+
|
|
57
|
+
- use a modal overlay
|
|
58
|
+
- use the fixed positioning strategy for the non-modal overlay
|
|
59
|
+
|
|
60
|
+
Our overlay system makes sure that there's always a fixed layer that pops out of the hidden parent.
|
|
61
|
+
|
|
62
|
+
```js preview-story
|
|
63
|
+
export const edgeCaseOverflowSolution = () =>
|
|
64
|
+
html`
|
|
65
|
+
<div style="padding: 54px 24px 36px;">
|
|
66
|
+
<div
|
|
67
|
+
style="overflow: hidden; border: 1px black dashed; padding-top: 36px; padding-bottom: 16px;"
|
|
68
|
+
>
|
|
69
|
+
<div style="display: flex; justify-content: space-evenly; position: relative;">
|
|
70
|
+
<demo-overlay-el
|
|
71
|
+
opened
|
|
72
|
+
.config="${{ placementMode: 'local', trapsKeyboardFocus: false }}"
|
|
73
|
+
>
|
|
74
|
+
<button slot="invoker" aria-label="local, non modal"></button>
|
|
75
|
+
<div slot="content">no matter</div>
|
|
76
|
+
</demo-overlay-el>
|
|
77
|
+
|
|
78
|
+
<demo-overlay-el opened .config="${{ placementMode: 'local', trapsKeyboardFocus: true }}">
|
|
79
|
+
<button slot="invoker" aria-label="local, modal"></button>
|
|
80
|
+
<div slot="content">what configuration</div>
|
|
81
|
+
</demo-overlay-el>
|
|
82
|
+
|
|
83
|
+
<demo-overlay-el
|
|
84
|
+
opened
|
|
85
|
+
.config="${{ placementMode: 'local', popperConfig: { strategy: 'absolute' } }}"
|
|
86
|
+
>
|
|
87
|
+
<button slot="invoker" aria-label="local, absolute"></button>
|
|
88
|
+
<div slot="content">...it</div>
|
|
89
|
+
</demo-overlay-el>
|
|
90
|
+
|
|
91
|
+
<demo-overlay-el
|
|
92
|
+
opened
|
|
93
|
+
.config="${{ placementMode: 'local', popperConfig: { strategy: 'fixed' } }}"
|
|
94
|
+
>
|
|
95
|
+
<button slot="invoker" aria-label="local, fixed"></button>
|
|
96
|
+
<div slot="content">just</div>
|
|
97
|
+
</demo-overlay-el>
|
|
98
|
+
|
|
99
|
+
<demo-overlay-el opened .config="${{ placementMode: 'global' }}">
|
|
100
|
+
<button slot="invoker" aria-label="global"></button>
|
|
101
|
+
<div slot="content">works</div>
|
|
102
|
+
</demo-overlay-el>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
`;
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Stacking context
|
|
110
|
+
|
|
111
|
+
When using non modal overlays, always make sure that the surrounding [stacking context](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context) does not paint on top of your overlay.
|
|
112
|
+
The example below shows the difference between a modal and non-modal overlay placed in a stacking context with a lower priority than its parent/sibling contexts.
|
|
113
|
+
|
|
114
|
+
#### Stacking context: the problem
|
|
115
|
+
|
|
116
|
+
```js preview-story
|
|
117
|
+
export const edgeCaseStackProblem = () =>
|
|
118
|
+
html`
|
|
119
|
+
<div style="width: 300px; height: 300px; position: relative;">
|
|
120
|
+
<div
|
|
121
|
+
id="stacking-context-a"
|
|
122
|
+
style="position: absolute; z-index: 2; top: 0; width: 100px; height: 200px;"
|
|
123
|
+
>
|
|
124
|
+
I am on top and I don't care about your 9999
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
<div
|
|
128
|
+
id="stacking-context-b"
|
|
129
|
+
style="position: absolute; z-index: 1; top: 0; width: 200px; height: 200px;"
|
|
130
|
+
>
|
|
131
|
+
<demo-overlay-el no-dialog-el style="overflow:hidden; position: relative;">
|
|
132
|
+
<button slot="invoker">invoke</button>
|
|
133
|
+
<div slot="content">
|
|
134
|
+
The overlay can never be in front, since the parent stacking context has a lower
|
|
135
|
+
priority than its sibling.
|
|
136
|
+
<div id="stacking-context-b-inner" style="position: absolute; z-index: 9999;">
|
|
137
|
+
So, even if we add a new stacking context in our overlay with z-index 9999, it will
|
|
138
|
+
never be painted on top.
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
</demo-overlay-el>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
`;
|
|
145
|
+
```
|
|
@@ -68,7 +68,7 @@ export const placementGlobal = () => {
|
|
|
68
68
|
|
|
69
69
|
## isTooltip (placementMode: 'local')
|
|
70
70
|
|
|
71
|
-
As specified in the [overlay rationale](https://github.com/ing-bank/lion/blob/
|
|
71
|
+
As specified in the [overlay rationale](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/fundamentals/systems/overlays/rationale.md) there are only two official types of overlays: dialogs and tooltips. And their main differences are:
|
|
72
72
|
|
|
73
73
|
- Dialogs have a modal option, tooltips don’t
|
|
74
74
|
- Dialogs have interactive content, tooltips don’t
|
|
@@ -373,7 +373,7 @@ Features:
|
|
|
373
373
|
|
|
374
374
|
> Popper strictly is scoped on positioning. **It does not change the dimensions of the content node nor the invoker node**.
|
|
375
375
|
> This also means that if you use the arrow feature, you are in charge of styling it properly, use the data-popper-placement attribute for this.
|
|
376
|
-
> An example implementation can be found in [lion-tooltip](https://github.com/ing-bank/lion/blob/
|
|
376
|
+
> An example implementation can be found in [lion-tooltip](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/components/tooltip/overview.md), where an arrow is set by default.
|
|
377
377
|
|
|
378
378
|
To override the default options we set for local mode, you add a `popperConfig` object to the config passed to the OverlayController.
|
|
379
379
|
Here's a succinct overview of some often used popper properties:
|
|
@@ -6,7 +6,7 @@ Manages their position on the screen relative to other elements, including other
|
|
|
6
6
|
|
|
7
7
|
Its purpose is to make it easy to use our Overlay System declaratively. It can be easily extended where needed, to override event listeners and more.
|
|
8
8
|
|
|
9
|
-
See [lion-dialog](../../../components/dialog/overview.md) and [lion-tooltip](https://github.com/ing-bank/lion/blob/
|
|
9
|
+
See [lion-dialog](../../../components/dialog/overview.md) and [lion-tooltip](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/components/tooltip/overview.md) for example Web Component implementations using the Overlay System.
|
|
10
10
|
|
|
11
11
|
## Features
|
|
12
12
|
|
|
@@ -18,9 +18,9 @@ See [lion-dialog](../../../components/dialog/overview.md) and [lion-tooltip](htt
|
|
|
18
18
|
- lion-overlay web component:
|
|
19
19
|
- Show content when clicking the invoker
|
|
20
20
|
- Have a `.config` object to set or update the OverlayController's configuration
|
|
21
|
-
- [**OverlaysManager**](https://github.com/ing-bank/lion/blob/
|
|
22
|
-
- [**OverlayController**](https://github.com/ing-bank/lion/blob/
|
|
23
|
-
- [**OverlayMixin**](https://github.com/ing-bank/lion/blob/
|
|
21
|
+
- [**OverlaysManager**](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/fundamentals/systems/overlays/use-cases.md#overlaysmanager), a global repository keeping track of all different types of overlays
|
|
22
|
+
- [**OverlayController**](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/fundamentals/systems/overlays/use-cases.md#overlaycontroller), a single controller class for handling overlays
|
|
23
|
+
- [**OverlayMixin**](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/fundamentals/systems/overlays/use-cases.md#overlaymixin), a mixin that can be used to create webcomponents that use the OverlayController under the hood
|
|
24
24
|
|
|
25
25
|
Usually you will use `lion-dialog` (or `lion-tooltip` if this makes more sense).
|
|
26
26
|
|
|
@@ -110,4 +110,4 @@ class MyOverlayComponent extends OverlayMixin(LitElement) {
|
|
|
110
110
|
|
|
111
111
|
## Rationales
|
|
112
112
|
|
|
113
|
-
Please check the [system rationals](https://github.com/ing-bank/lion/blob/
|
|
113
|
+
Please check the [system rationals](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/fundamentals/systems/overlays/rationale.md) folder, where we go more in-depth.
|
|
@@ -21,7 +21,7 @@ The overlay system allows to create different types of overlays like dialogs, to
|
|
|
21
21
|
It's designed to be highly flexible, while still delivering sensible defaults.
|
|
22
22
|
On top of this, the system was built having accessibility in mind.
|
|
23
23
|
|
|
24
|
-
For a detailed rationale, please consult [Rationale](https://github.com/ing-bank/lion/blob/
|
|
24
|
+
For a detailed rationale, please consult [Rationale](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/fundamentals/systems/overlays/rationale.md).
|
|
25
25
|
|
|
26
26
|
```js preview-story
|
|
27
27
|
export const main = () => html`
|
|
@@ -67,7 +67,7 @@ Global refers to overlays where the content is positioned in a global root node
|
|
|
67
67
|
|
|
68
68
|
Overlays can be configured in many ways to suit your needs. We go in-depth into each option in the Overlay System - Configuration chapter.
|
|
69
69
|
|
|
70
|
-
We also export a few [preset configuration objects](https://github.com/ing-bank/lion/blob/
|
|
70
|
+
We also export a few [preset configuration objects](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/fundamentals/systems/overlays/configuration.md).
|
|
71
71
|
|
|
72
72
|
- withModalDialogConfig
|
|
73
73
|
- withDropdownConfig
|
|
@@ -9,7 +9,7 @@ Therefore, they may not have the same quality standards as our other packages.
|
|
|
9
9
|
|
|
10
10
|
| Package | Description |
|
|
11
11
|
| -------------------------------------- | ----------------------- |
|
|
12
|
-
| [sb-action-logger](https://github.com/ing-bank/lion/blob/
|
|
12
|
+
| [sb-action-logger](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/fundamentals/tools/helpers/action-logger.md) | Storybook action logger |
|
|
13
13
|
|
|
14
14
|
## Installation
|
|
15
15
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Tools >> Singleton Manager >> Example Complex ||40
|
|
2
|
+
|
|
3
|
+
In this SPA (Single Page Application) demo you will be able to reproduce the solution.
|
|
4
|
+
|
|
5
|
+
The outcome is the same but this time internally there are two instances of Overlay Managers.
|
|
6
|
+
And both are kept in sync buy an mediator with which the user actually interacts.
|
|
7
|
+
|
|
8
|
+
1. Click on Page A
|
|
9
|
+
2. Click on `block`
|
|
10
|
+
3. Click on Page B
|
|
11
|
+
4. Click on `unblock` => state is unblocked globally as there is only a single instance
|
|
12
|
+
|
|
13
|
+
With this solutions users can not break the app anymore.
|
|
14
|
+
|
|
15
|
+
<demo-app>Loading App...</demo-app>
|
|
16
|
+
|
|
17
|
+
<div id="overlay-target" style="margin-top: 50px;"></div>
|
|
18
|
+
|
|
19
|
+
```js script
|
|
20
|
+
import './demo-app.js';
|
|
21
|
+
```
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Tools >> Singleton Manager >> Example Fail ||20
|
|
2
|
+
|
|
3
|
+
In this SPA (Single Page Application) demo you will be able to reproduce the issue.
|
|
4
|
+
|
|
5
|
+
1. Click on Page A
|
|
6
|
+
2. Click on `block`
|
|
7
|
+
3. Click on Page B
|
|
8
|
+
4. Click on `unblock` => nothing happens
|
|
9
|
+
5. Click on `block` => both overlays are now blocked
|
|
10
|
+
|
|
11
|
+
In an real application this would now mean that your users can no longer interact with your application.
|
|
12
|
+
|
|
13
|
+
<demo-app>Loading App...</demo-app>
|
|
14
|
+
|
|
15
|
+
<div id="overlay-target" style="margin-top: 50px;"></div>
|
|
16
|
+
|
|
17
|
+
```js script
|
|
18
|
+
import './demo-app.js';
|
|
19
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Tools >> Singleton Manager >> Example Success ||30
|
|
2
|
+
|
|
3
|
+
In this SPA (Single Page Application) demo you will be able to reproduce the solution.
|
|
4
|
+
|
|
5
|
+
1. Click on Page A
|
|
6
|
+
2. Click on `block`
|
|
7
|
+
3. Click on Page B
|
|
8
|
+
4. Click on `unblock` => state is unblocked globally as there is only a single instance
|
|
9
|
+
|
|
10
|
+
With this solutions users can not break the app anymore.
|
|
11
|
+
|
|
12
|
+
<demo-app>Loading App...</demo-app>
|
|
13
|
+
|
|
14
|
+
<div id="overlay-target" style="margin-top: 50px;"></div>
|
|
15
|
+
|
|
16
|
+
```js script
|
|
17
|
+
import './demo-app.js';
|
|
18
|
+
```
|
|
@@ -9,7 +9,7 @@ Primarily useful if two major version of a package with a singleton is used.
|
|
|
9
9
|
npm i --save singleton-manager
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
⚠️ You need to make SURE that only ONE version of `singleton-manager` is installed. For how see [Non Goals](https://github.com/ing-bank/lion/blob/
|
|
12
|
+
⚠️ You need to make SURE that only ONE version of `singleton-manager` is installed. For how see [Non Goals](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/fundamentals/tools/singleton-manager/#non-goals).
|
|
13
13
|
|
|
14
14
|
### Example Singleton Users
|
|
15
15
|
|
|
@@ -159,7 +159,7 @@ Steps to reproduce:
|
|
|
159
159
|
1. Page A click on block
|
|
160
160
|
2. Page B => "Blocked: false" (even when hitting the refresh button)
|
|
161
161
|
|
|
162
|
-
➡️ See [it on the example page](https://github.com/ing-bank/lion/blob/
|
|
162
|
+
➡️ See [it on the example page](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/fundamentals/tools/singleton-manager/example-fail/index.md). <br>
|
|
163
163
|
➡️ See [the code](https://github.com/ing-bank/lion/tree/master/docs/fundamentals/tools/singleton-manager/example-fail/demo-app.js).
|
|
164
164
|
|
|
165
165
|
---
|
|
@@ -202,7 +202,7 @@ See it in action
|
|
|
202
202
|
npm run start:singleton
|
|
203
203
|
```
|
|
204
204
|
|
|
205
|
-
➡️ See [it on the example page](https://github.com/ing-bank/lion/blob/
|
|
205
|
+
➡️ See [it on the example page](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/fundamentals/tools/singleton-manager/example-success/index.md). <br>
|
|
206
206
|
➡️ See [the code](https://github.com/ing-bank/lion/tree/master/docs/fundamentals/tools/singleton-manager/example-success/demo-app.js).
|
|
207
207
|
|
|
208
208
|
---
|
|
@@ -243,7 +243,7 @@ See it in action
|
|
|
243
243
|
npm run start:singleton-complex
|
|
244
244
|
```
|
|
245
245
|
|
|
246
|
-
➡️ See [it on the example page](https://github.com/ing-bank/lion/blob/
|
|
246
|
+
➡️ See [it on the example page](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/fundamentals/tools/singleton-manager/example-complex/index.md). <br>
|
|
247
247
|
➡️ See [the code](https://github.com/ing-bank/lion/tree/master/docs/fundamentals/tools/singleton-manager/example-complex/demo-app.js).
|
|
248
248
|
|
|
249
249
|
---
|
|
@@ -75,9 +75,9 @@ if (!customElements.get('dummy-slider')) {
|
|
|
75
75
|
}
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
-
Custom Fields can be created in just a few steps. All you need is an interaction element (like for instance a slider, a listbox or a combobox) and connect it to the [LionField](https://github.com/ing-bank/lion/blob/
|
|
78
|
+
Custom Fields can be created in just a few steps. All you need is an interaction element (like for instance a slider, a listbox or a combobox) and connect it to the [LionField](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/components/input/overview.md).
|
|
79
79
|
|
|
80
|
-
> In case you want to extend a native element, follow [Extend a native Input](https://github.com/ing-bank/lion/blob/
|
|
80
|
+
> In case you want to extend a native element, follow [Extend a native Input](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/guides/how-to/extend-a-native-input.md).
|
|
81
81
|
|
|
82
82
|
## A) an interaction element
|
|
83
83
|
|
|
@@ -126,7 +126,7 @@ export const createAnInteractiveElement = () => {
|
|
|
126
126
|
## B) your LionField extension
|
|
127
127
|
|
|
128
128
|
Now we want to integrate the slider in our form system to enrich the user interface, get
|
|
129
|
-
validation support and all other [benefits of LionField](https://github.com/ing-bank/lion/blob/
|
|
129
|
+
validation support and all other [benefits of LionField](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/components/input/overview.md).
|
|
130
130
|
We start by creating a component `<slider-field>` that extends from `LionField`.
|
|
131
131
|
Then we follow the steps below:
|
|
132
132
|
|
|
@@ -139,7 +139,7 @@ Then we follow the steps below:
|
|
|
139
139
|
|
|
140
140
|
The `user-input-changed` event is listened to by the FormatMixin: it should be regarded as the
|
|
141
141
|
equivalent of the `input` event of the platform, but for custom built interaction elements.
|
|
142
|
-
You now synchronized [modelValue](https://github.com/ing-bank/lion/blob/
|
|
142
|
+
You now synchronized [modelValue](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/fundamentals/systems/form/model-value.md), which can be regarded as
|
|
143
143
|
the glue to integrate all other functionality like parsing/formatting/serializing, validating,
|
|
144
144
|
tracking interaction states etc.
|
|
145
145
|
|
|
@@ -147,7 +147,7 @@ Then we follow the steps below:
|
|
|
147
147
|
> because those properties will loose their reactivity (they won't be considered anymore in the
|
|
148
148
|
> update loop of LitElement).
|
|
149
149
|
> Whenever a .modelValue/.formattedValue/.serializedValue needs to be computed, use
|
|
150
|
-
> [parser/formatter/serializer](https://github.com/ing-bank/lion/blob/
|
|
150
|
+
> [parser/formatter/serializer](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/fundamentals/systems/form/formatting-and-parsing.md)
|
|
151
151
|
|
|
152
152
|
Implement with the following code:
|
|
153
153
|
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# How To >> Create a form ||15
|
|
2
|
+
|
|
3
|
+
Creating your own forms as an Application Developer is really simple. Only two rules need to be followed.
|
|
4
|
+
|
|
5
|
+
This guide is written for Application Developers that work with a fully styled and configured extension of Lion.
|
|
6
|
+
Say for instance we have a 'Wolf' extension layer with a set of styled/configured Lion form components:
|
|
7
|
+
|
|
8
|
+
- wolf-form
|
|
9
|
+
- wolf-fieldset
|
|
10
|
+
- wolf-input
|
|
11
|
+
- wolf-textarea
|
|
12
|
+
- ...and all other form components
|
|
13
|
+
|
|
14
|
+
## Two simple rules
|
|
15
|
+
|
|
16
|
+
When building a form, keep these things in mind:
|
|
17
|
+
|
|
18
|
+
- avoid shadow roots inside your form
|
|
19
|
+
- do not extend form components
|
|
20
|
+
|
|
21
|
+
## Avoiding shadow roots
|
|
22
|
+
|
|
23
|
+
Large or complex forms might need to be split up into multiple files. This composition could be achieved via:
|
|
24
|
+
|
|
25
|
+
- shared templates
|
|
26
|
+
- (web) components
|
|
27
|
+
|
|
28
|
+
In the latter case: make sure that your components don't have a shadow root.
|
|
29
|
+
This can be achieved in LitElement by providing the host as render root:
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
class MySubForm extends LitElement {
|
|
33
|
+
// This will make sure the component does not have a shadow root
|
|
34
|
+
createRenderRoot() {
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
render() {
|
|
39
|
+
return html`
|
|
40
|
+
<wolf-fieldset name="my-fieldset">
|
|
41
|
+
<wolf-input name="my-input"></wolf-input>
|
|
42
|
+
<wolf-texarea name="my-texarea"></wolf-texarea>
|
|
43
|
+
</wolf-fieldset>
|
|
44
|
+
`;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
customElements.define('my-sub-form', MySubForm);
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Our component can be used in our form like this:
|
|
51
|
+
|
|
52
|
+
```js
|
|
53
|
+
class MyForm extends LitElement {
|
|
54
|
+
render() {
|
|
55
|
+
return html`
|
|
56
|
+
<wolf-form>
|
|
57
|
+
<form>
|
|
58
|
+
<my-sub-form></my-sub-form>
|
|
59
|
+
</form>
|
|
60
|
+
</wolf-form>
|
|
61
|
+
`;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
> Today, rendering to light dom is the only way to [stay accessible](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/fundamentals/rationales/accessibility.md#shadow-roots-and-accessibility).
|
|
67
|
+
|
|
68
|
+
The registration mechanism relies on light dom by design: as soon as you do start to use shadow roots, you will notice that your form components won't register themselves anymore to their parents.
|
|
69
|
+
|
|
70
|
+
## Extending form components
|
|
71
|
+
|
|
72
|
+
Extending form components is not recommended for Application Developers: it should be left to the team that creates a Design System (Subclassers).
|
|
73
|
+
This team will add the styling and default configuration needed to make it fit the particular Design System.
|
|
74
|
+
|
|
75
|
+
With the toolbox provided by the team that creates your Design System, you should be able to build all your forms. Only if you have a really good reason, look into
|
|
76
|
+
[exceptional cases](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/guides/how-to/#exceptional-cases) below.
|
|
77
|
+
|
|
78
|
+
### Exceptional cases
|
|
79
|
+
|
|
80
|
+
If the form component you need is still missing, you have two options:
|
|
81
|
+
|
|
82
|
+
- is it a generic primitive that should be part of Lion? Request it in [Lion discussions](https://github.com/ing-bank/lion/discussions)
|
|
83
|
+
- is it a non generic component that is unique to your app?
|
|
84
|
+
- follow [create a custom field](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/guides/how-to/create-a-custom-field.md)
|
|
85
|
+
- follow [extend a native input](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/guides/how-to/extend-a-native-input.md)
|
|
86
|
+
|
|
87
|
+
It's also possible to extend other components, like LionListbox or LionCombobox. You need to be aware that you're building on top of protected apis.
|
|
88
|
+
Changing/overriding functionality is only recommended if the source code in `form-core` is fully understood.
|
|
@@ -11,9 +11,9 @@ import '../../fundamentals/systems/form/assets/h-output.js';
|
|
|
11
11
|
loadDefaultFeedbackMessages();
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
Input fields can be created by extending [LionInput](https://github.com/ing-bank/lion/blob/
|
|
14
|
+
Input fields can be created by extending [LionInput](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/components/input/overview.md).
|
|
15
15
|
|
|
16
|
-
> In case you want to wrap a custom form element, follow [Create a custom Field](https://github.com/ing-bank/lion/blob/
|
|
16
|
+
> In case you want to wrap a custom form element, follow [Create a custom Field](https://github.com/ing-bank/lion/blob/a19e02c443e21d4e6c62bb08bbe6db64f7446010/docs/guides/how-to/create-a-custom-field.md).
|
|
17
17
|
|
|
18
18
|
For this tutorial, we create an input that wraps native `input[type=datetime-local]`.
|
|
19
19
|
This is as simple as adding a type:
|