@statistikzh/leu 0.24.1 → 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/.github/workflows/publish.yml +1 -8
- package/.release-please-manifest.json +1 -1
- package/.storybook/main.ts +18 -53
- package/.storybook/manager.ts +1 -4
- package/.storybook/preview.ts +23 -16
- package/.storybook/theme.ts +1 -1
- package/CHANGELOG.md +21 -0
- package/dist/Accordion-CDNyrB8d.js +241 -0
- package/dist/Accordion.d.ts +44 -44
- package/dist/Accordion.js +2 -249
- package/dist/Button-DSGPIcjm.d.ts +93 -0
- package/dist/Button-EdS9xr2J.js +524 -0
- package/dist/Button.d.ts +2 -85
- package/dist/Button.js +4 -504
- package/dist/ButtonGroup-BQqf8o_d.js +88 -0
- package/dist/ButtonGroup.d.ts +19 -19
- package/dist/ButtonGroup.js +5 -101
- package/dist/ChartWrapper-LiNHTNRw.js +158 -0
- package/dist/ChartWrapper.d.ts +26 -26
- package/dist/ChartWrapper.js +3 -163
- package/dist/Checkbox-BtDWmPab.js +198 -0
- package/dist/Checkbox.d.ts +35 -27
- package/dist/Checkbox.js +4 -157
- package/dist/CheckboxGroup-C8MbwW9u.js +81 -0
- package/dist/CheckboxGroup.d.ts +18 -18
- package/dist/CheckboxGroup.js +5 -82
- package/dist/Chip-Ch09jjYi.js +171 -0
- package/dist/Chip-DLKM9P7v.d.ts +18 -0
- package/dist/Chip.d.ts +2 -18
- package/dist/Chip.js +2 -166
- package/dist/ChipGroup-PvqVW-tm.js +125 -0
- package/dist/ChipGroup-Ta8Ht4jc.d.ts +42 -0
- package/dist/ChipGroup.d.ts +2 -43
- package/dist/ChipGroup.js +3 -132
- package/dist/ChipLink-BAxyQO2M.d.ts +17 -0
- package/dist/ChipLink.d.ts +2 -18
- package/dist/ChipLink.js +28 -28
- package/dist/ChipRemovable-DBjwt0CH.d.ts +25 -0
- package/dist/ChipRemovable.d.ts +2 -26
- package/dist/ChipRemovable.js +42 -43
- package/dist/ChipSelectable-CMJNcE4U.d.ts +32 -0
- package/dist/ChipSelectable.d.ts +2 -33
- package/dist/ChipSelectable.js +63 -72
- package/dist/Dialog-CV1JTkCn.js +241 -0
- package/dist/Dialog.d.ts +28 -28
- package/dist/Dialog.js +3 -240
- package/dist/Dropdown-DpFdFbA1.js +155 -0
- package/dist/Dropdown.d.ts +39 -41
- package/dist/Dropdown.js +8 -157
- package/dist/FileInput-5apX17JT.js +344 -0
- package/dist/FileInput.d.ts +56 -57
- package/dist/FileInput.js +6 -383
- package/dist/FormAssociatedMixin-BbFlza53.js +58 -0
- package/dist/FormAssociatedMixin-Cc74LjbC.d.ts +22 -0
- package/dist/Icon-DhAvH0XM.js +186 -0
- package/dist/Icon-Op80LrrO.d.ts +151 -0
- package/dist/Icon.d.ts +2 -4
- package/dist/Icon.js +2 -188
- package/dist/Input-CnEz-2dK.js +610 -0
- package/dist/Input-D2THgo7c.d.ts +169 -0
- package/dist/Input.d.ts +2 -166
- package/dist/Input.js +4 -626
- package/dist/LeuElement-B7NJzWwP.js +46 -0
- package/dist/LeuElement-pJFU18Xm.d.ts +11 -0
- package/dist/Menu-CQdx1ef3.d.ts +43 -0
- package/dist/Menu-DpiheIPk.js +136 -0
- package/dist/Menu.d.ts +2 -44
- package/dist/Menu.js +4 -157
- package/dist/MenuItem-CZTqGg5R.js +219 -0
- package/dist/MenuItem-QcgnRk_7.d.ts +63 -0
- package/dist/MenuItem.d.ts +2 -64
- package/dist/MenuItem.js +3 -227
- package/dist/Message-J4Kj7yHE.js +252 -0
- package/dist/Message.d.ts +53 -53
- package/dist/Message.js +3 -267
- package/dist/Pagination-Be8TcBoC.d.ts +76 -0
- package/dist/Pagination-CWqgusWZ.js +226 -0
- package/dist/Pagination.d.ts +2 -76
- package/dist/Pagination.js +6 -240
- package/dist/Placeholder-DMN6sMbp.js +95 -0
- package/dist/Placeholder.d.ts +15 -15
- package/dist/Placeholder.js +2 -89
- package/dist/Popup-Btgm2a3D.d.ts +61 -0
- package/dist/Popup-JQjuj26v.js +195 -0
- package/dist/Popup.d.ts +2 -62
- package/dist/Popup.js +2 -233
- package/dist/ProgressBar-CzN3fqiH.js +167 -0
- package/dist/ProgressBar.d.ts +21 -21
- package/dist/ProgressBar.js +2 -165
- package/dist/Radio-CX8aCsff.js +160 -0
- package/dist/Radio.d.ts +22 -22
- package/dist/Radio.js +2 -151
- package/dist/RadioGroup-CgEWQnC4.js +171 -0
- package/dist/RadioGroup.d.ts +35 -35
- package/dist/RadioGroup.js +3 -182
- package/dist/Range-DoW_ZdKm.js +496 -0
- package/dist/Range.d.ts +112 -112
- package/dist/Range.js +2 -586
- package/dist/ScrollTop-DxChetWq.js +130 -0
- package/dist/ScrollTop.d.ts +21 -21
- package/dist/ScrollTop.js +5 -118
- package/dist/Select-BCx79gOH.js +618 -0
- package/dist/Select.d.ts +130 -132
- package/dist/Select.js +9 -675
- package/dist/Spinner-CMo_o6Fy.d.ts +14 -0
- package/dist/Spinner-DJR4gv3Y.js +56 -0
- package/dist/Spinner.d.ts +2 -14
- package/dist/Spinner.js +2 -52
- package/dist/Table-DZz1ic3j.js +392 -0
- package/dist/Table.d.ts +61 -63
- package/dist/Table.js +7 -427
- package/dist/Tag-DsZS_8pl.js +76 -0
- package/dist/Tag.d.ts +8 -8
- package/dist/Tag.js +2 -74
- package/dist/VisuallyHidden-BkllVjlz.js +29 -0
- package/dist/VisuallyHidden-OeQvhxYn.d.ts +13 -0
- package/dist/VisuallyHidden.d.ts +2 -13
- package/dist/VisuallyHidden.js +2 -25
- package/dist/decorate-DwpAc4D0.js +9 -0
- package/dist/hasSlotController-BLtZurRh.d.ts +19 -0
- package/dist/hasSlotController-DjdfnOQp.js +38 -0
- package/dist/index.d.ts +33 -30
- package/dist/index.js +35 -45
- package/dist/leu-accordion.d.ts +7 -10
- package/dist/leu-accordion.js +4 -8
- package/dist/leu-button-group.d.ts +7 -10
- package/dist/leu-button-group.js +7 -12
- package/dist/leu-button.d.ts +7 -11
- package/dist/leu-button.js +6 -11
- package/dist/leu-chart-wrapper.d.ts +7 -12
- package/dist/leu-chart-wrapper.js +5 -9
- package/dist/leu-checkbox-group.d.ts +7 -10
- package/dist/leu-checkbox-group.js +7 -10
- package/dist/leu-checkbox.d.ts +7 -11
- package/dist/leu-checkbox.js +6 -8
- package/dist/leu-chip-group.d.ts +7 -12
- package/dist/leu-chip-group.js +5 -10
- package/dist/leu-chip-link.d.ts +7 -11
- package/dist/leu-chip-link.js +5 -8
- package/dist/leu-chip-removable.d.ts +7 -12
- package/dist/leu-chip-removable.js +6 -9
- package/dist/leu-chip-selectable.d.ts +7 -11
- package/dist/leu-chip-selectable.js +5 -8
- package/dist/leu-dialog.d.ts +7 -13
- package/dist/leu-dialog.js +5 -11
- package/dist/leu-dropdown.d.ts +7 -18
- package/dist/leu-dropdown.js +10 -17
- package/dist/leu-file-input.d.ts +7 -13
- package/dist/leu-file-input.js +8 -13
- package/dist/leu-icon.d.ts +7 -10
- package/dist/leu-icon.js +4 -7
- package/dist/leu-input.d.ts +7 -12
- package/dist/leu-input.js +6 -12
- package/dist/leu-menu-item.d.ts +7 -11
- package/dist/leu-menu-item.js +5 -9
- package/dist/leu-menu.d.ts +7 -12
- package/dist/leu-menu.js +6 -10
- package/dist/leu-message.d.ts +7 -11
- package/dist/leu-message.js +5 -10
- package/dist/leu-pagination.d.ts +7 -13
- package/dist/leu-pagination.js +8 -14
- package/dist/leu-placeholder.d.ts +7 -10
- package/dist/leu-placeholder.js +4 -5
- package/dist/leu-popup.d.ts +7 -11
- package/dist/leu-popup.js +4 -8
- package/dist/leu-progress-bar.d.ts +7 -10
- package/dist/leu-progress-bar.js +4 -8
- package/dist/leu-radio-group.d.ts +7 -10
- package/dist/leu-radio-group.js +5 -9
- package/dist/leu-radio.d.ts +7 -10
- package/dist/leu-radio.js +4 -7
- package/dist/leu-range.d.ts +7 -10
- package/dist/leu-range.js +4 -9
- package/dist/leu-scroll-top.d.ts +7 -12
- package/dist/leu-scroll-top.js +7 -13
- package/dist/leu-select.d.ts +7 -19
- package/dist/leu-select.js +11 -19
- package/dist/leu-spinner.d.ts +7 -10
- package/dist/leu-spinner.js +4 -5
- package/dist/leu-table.d.ts +7 -14
- package/dist/leu-table.js +9 -17
- package/dist/leu-tag.d.ts +7 -10
- package/dist/leu-tag.js +4 -7
- package/dist/leu-visually-hidden.d.ts +7 -10
- package/dist/leu-visually-hidden.js +4 -5
- package/dist/theme.css +1 -0
- package/dist/utils-hfk5Nwy8.js +28 -0
- package/dist/vscode.html-custom-data.json +43 -49
- package/dist/vue/index.d.ts +54 -60
- package/dist/web-types.json +89 -105
- package/eslint.config.mjs +79 -0
- package/package.json +45 -62
- package/scripts/generate-component/templates/stories/[name].stories.ts +1 -1
- package/src/components/accordion/Accordion.ts +1 -1
- package/src/components/button/Button.ts +62 -3
- package/src/components/button/test/button.test.ts +185 -7
- package/src/components/button-group/ButtonGroup.ts +1 -6
- package/src/components/button-group/stories/button-group.stories.ts +1 -1
- package/src/components/chart-wrapper/ChartWrapper.ts +1 -1
- package/src/components/chart-wrapper/stories/chart-wrapper.stories.ts +1 -1
- package/src/components/checkbox/Checkbox.ts +76 -12
- package/src/components/checkbox/CheckboxGroup.ts +1 -1
- package/src/components/checkbox/checkbox.css +4 -0
- package/src/components/checkbox/stories/checkbox.stories.ts +26 -3
- package/src/components/checkbox/test/checkbox.test.ts +147 -3
- package/src/components/chip/Chip.ts +1 -1
- package/src/components/chip/ChipGroup.ts +2 -2
- package/src/components/chip/stories/chip-removable.stories.ts +1 -1
- package/src/components/chip/test/chip-removable.test.ts +2 -2
- package/src/components/dialog/Dialog.ts +1 -1
- package/src/components/dialog/stories/dialog.stories.ts +0 -2
- package/src/components/dropdown/Dropdown.ts +1 -1
- package/src/components/dropdown/stories/dropdown.stories.ts +1 -1
- package/src/components/file-input/FileInput.ts +18 -20
- package/src/components/file-input/stories/file-input.stories.ts +2 -2
- package/src/components/file-input/test/file-input.test.ts +14 -1
- package/src/components/icon/Icon.ts +1 -1
- package/src/components/input/Input.ts +18 -7
- package/src/components/input/stories/input.stories.ts +24 -21
- package/src/components/menu/Menu.ts +4 -4
- package/src/components/menu/MenuItem.ts +1 -1
- package/src/components/menu/stories/menu-item.stories.ts +0 -2
- package/src/components/message/Message.ts +1 -1
- package/src/components/message/stories/message.stories.ts +2 -2
- package/src/components/pagination/Pagination.ts +1 -1
- package/src/components/pagination/stories/pagination.stories.ts +3 -3
- package/src/components/pagination/test/pagination.test.ts +1 -1
- package/src/components/placeholder/Placeholder.ts +1 -1
- package/src/components/placeholder/stories/placeholder.stories.ts +1 -1
- package/src/components/popup/Popup.ts +1 -1
- package/src/components/progress-bar/ProgressBar.ts +1 -1
- package/src/components/progress-bar/stories/progress-bar.stories.ts +1 -1
- package/src/components/radio/Radio.ts +1 -1
- package/src/components/radio/RadioGroup.ts +5 -5
- package/src/components/range/Range.ts +1 -1
- package/src/components/range/stories/range.stories.ts +2 -2
- package/src/components/scroll-top/ScrollTop.ts +1 -1
- package/src/components/scroll-top/scroll-top.css +20 -4
- package/src/components/select/Select.ts +2 -5
- package/src/components/spinner/Spinner.ts +1 -1
- package/src/components/table/Table.ts +1 -1
- package/src/components/tag/Tag.ts +1 -1
- package/src/components/tag/stories/tag.stories.ts +1 -1
- package/src/components/visually-hidden/VisuallyHidden.ts +1 -1
- package/src/docs/contributing.mdx +1 -1
- package/src/docs/installation.mdx +1 -1
- package/src/docs/theme.mdx +1 -1
- package/src/docs/usage.mdx +1 -1
- package/src/global.d.ts +1 -1
- package/src/lib/LeuElement.ts +1 -1
- package/src/lib/mixins/FormAssociatedMixin.ts +115 -0
- package/src/lib/styleMap.ts +1 -1
- package/src/styles/theme.css +1 -0
- package/tsdown.config.ts +35 -0
- package/web-test-runner.config.mjs +20 -2
- package/.eslintrc.json +0 -57
- package/dist/Icon.d-itcQ94ym.d.ts +0 -151
- package/dist/LeuElement-jrR2M5pZ.js +0 -42
- package/dist/LeuElement.d-BevHqLUu.d.ts +0 -10
- package/dist/_tslib-CNEFicEt.js +0 -30
- package/dist/components/accordion/Accordion.d.ts +0 -49
- package/dist/components/accordion/Accordion.d.ts.map +0 -1
- package/dist/components/accordion/leu-accordion.d.ts +0 -8
- package/dist/components/accordion/leu-accordion.d.ts.map +0 -1
- package/dist/components/accordion/stories/accordion.stories.d.ts +0 -26
- package/dist/components/accordion/stories/accordion.stories.d.ts.map +0 -1
- package/dist/components/accordion/test/accordion.test.d.ts +0 -2
- package/dist/components/accordion/test/accordion.test.d.ts.map +0 -1
- package/dist/components/button/Button.d.ts +0 -81
- package/dist/components/button/Button.d.ts.map +0 -1
- package/dist/components/button/leu-button.d.ts +0 -8
- package/dist/components/button/leu-button.d.ts.map +0 -1
- package/dist/components/button/stories/button.stories.d.ts +0 -19
- package/dist/components/button/stories/button.stories.d.ts.map +0 -1
- package/dist/components/button/test/button.test.d.ts +0 -3
- package/dist/components/button/test/button.test.d.ts.map +0 -1
- package/dist/components/button-group/ButtonGroup.d.ts +0 -25
- package/dist/components/button-group/ButtonGroup.d.ts.map +0 -1
- package/dist/components/button-group/leu-button-group.d.ts +0 -8
- package/dist/components/button-group/leu-button-group.d.ts.map +0 -1
- package/dist/components/button-group/stories/button-group.stories.d.ts +0 -15
- package/dist/components/button-group/stories/button-group.stories.d.ts.map +0 -1
- package/dist/components/button-group/test/button-group.test.d.ts +0 -3
- package/dist/components/button-group/test/button-group.test.d.ts.map +0 -1
- package/dist/components/chart-wrapper/ChartWrapper.d.ts +0 -34
- package/dist/components/chart-wrapper/ChartWrapper.d.ts.map +0 -1
- package/dist/components/chart-wrapper/leu-chart-wrapper.d.ts +0 -8
- package/dist/components/chart-wrapper/leu-chart-wrapper.d.ts.map +0 -1
- package/dist/components/chart-wrapper/stories/chart-wrapper.stories.d.ts +0 -47
- package/dist/components/chart-wrapper/stories/chart-wrapper.stories.d.ts.map +0 -1
- package/dist/components/chart-wrapper/test/chart-wrapper.test.d.ts +0 -2
- package/dist/components/chart-wrapper/test/chart-wrapper.test.d.ts.map +0 -1
- package/dist/components/checkbox/Checkbox.d.ts +0 -28
- package/dist/components/checkbox/Checkbox.d.ts.map +0 -1
- package/dist/components/checkbox/CheckboxGroup.d.ts +0 -22
- package/dist/components/checkbox/CheckboxGroup.d.ts.map +0 -1
- package/dist/components/checkbox/leu-checkbox-group.d.ts +0 -8
- package/dist/components/checkbox/leu-checkbox-group.d.ts.map +0 -1
- package/dist/components/checkbox/leu-checkbox.d.ts +0 -8
- package/dist/components/checkbox/leu-checkbox.d.ts.map +0 -1
- package/dist/components/checkbox/stories/checkbox-group.stories.d.ts +0 -29
- package/dist/components/checkbox/stories/checkbox-group.stories.d.ts.map +0 -1
- package/dist/components/checkbox/stories/checkbox.stories.d.ts +0 -22
- package/dist/components/checkbox/stories/checkbox.stories.d.ts.map +0 -1
- package/dist/components/checkbox/test/checkbox-group.test.d.ts +0 -3
- package/dist/components/checkbox/test/checkbox-group.test.d.ts.map +0 -1
- package/dist/components/checkbox/test/checkbox.test.d.ts +0 -2
- package/dist/components/checkbox/test/checkbox.test.d.ts.map +0 -1
- package/dist/components/chip/Chip.d.ts +0 -15
- package/dist/components/chip/Chip.d.ts.map +0 -1
- package/dist/components/chip/ChipGroup.d.ts +0 -38
- package/dist/components/chip/ChipGroup.d.ts.map +0 -1
- package/dist/components/chip/ChipLink.d.ts +0 -13
- package/dist/components/chip/ChipLink.d.ts.map +0 -1
- package/dist/components/chip/ChipRemovable.d.ts +0 -21
- package/dist/components/chip/ChipRemovable.d.ts.map +0 -1
- package/dist/components/chip/ChipSelectable.d.ts +0 -28
- package/dist/components/chip/ChipSelectable.d.ts.map +0 -1
- package/dist/components/chip/exports.d.ts +0 -5
- package/dist/components/chip/exports.d.ts.map +0 -1
- package/dist/components/chip/leu-chip-group.d.ts +0 -8
- package/dist/components/chip/leu-chip-group.d.ts.map +0 -1
- package/dist/components/chip/leu-chip-link.d.ts +0 -8
- package/dist/components/chip/leu-chip-link.d.ts.map +0 -1
- package/dist/components/chip/leu-chip-removable.d.ts +0 -8
- package/dist/components/chip/leu-chip-removable.d.ts.map +0 -1
- package/dist/components/chip/leu-chip-selectable.d.ts +0 -8
- package/dist/components/chip/leu-chip-selectable.d.ts.map +0 -1
- package/dist/components/chip/stories/chip-group.stories.d.ts +0 -40
- package/dist/components/chip/stories/chip-group.stories.d.ts.map +0 -1
- package/dist/components/chip/stories/chip-link.stories.d.ts +0 -27
- package/dist/components/chip/stories/chip-link.stories.d.ts.map +0 -1
- package/dist/components/chip/stories/chip-removable.stories.d.ts +0 -21
- package/dist/components/chip/stories/chip-removable.stories.d.ts.map +0 -1
- package/dist/components/chip/stories/chip-selectable.stories.d.ts +0 -35
- package/dist/components/chip/stories/chip-selectable.stories.d.ts.map +0 -1
- package/dist/components/chip/test/chip-group.test.d.ts +0 -4
- package/dist/components/chip/test/chip-group.test.d.ts.map +0 -1
- package/dist/components/chip/test/chip-link.test.d.ts +0 -2
- package/dist/components/chip/test/chip-link.test.d.ts.map +0 -1
- package/dist/components/chip/test/chip-removable.test.d.ts +0 -2
- package/dist/components/chip/test/chip-removable.test.d.ts.map +0 -1
- package/dist/components/chip/test/chip-selectable.test.d.ts +0 -2
- package/dist/components/chip/test/chip-selectable.test.d.ts.map +0 -1
- package/dist/components/chip/test/chip.test.d.ts +0 -2
- package/dist/components/chip/test/chip.test.d.ts.map +0 -1
- package/dist/components/dialog/Dialog.d.ts +0 -29
- package/dist/components/dialog/Dialog.d.ts.map +0 -1
- package/dist/components/dialog/leu-dialog.d.ts +0 -8
- package/dist/components/dialog/leu-dialog.d.ts.map +0 -1
- package/dist/components/dialog/stories/dialog.stories.d.ts +0 -19
- package/dist/components/dialog/stories/dialog.stories.d.ts.map +0 -1
- package/dist/components/dialog/test/dialog.test.d.ts +0 -2
- package/dist/components/dialog/test/dialog.test.d.ts.map +0 -1
- package/dist/components/dropdown/Dropdown.d.ts +0 -40
- package/dist/components/dropdown/Dropdown.d.ts.map +0 -1
- package/dist/components/dropdown/leu-dropdown.d.ts +0 -8
- package/dist/components/dropdown/leu-dropdown.d.ts.map +0 -1
- package/dist/components/dropdown/stories/dropdown.stories.d.ts +0 -25
- package/dist/components/dropdown/stories/dropdown.stories.d.ts.map +0 -1
- package/dist/components/dropdown/test/dropdown.test.d.ts +0 -2
- package/dist/components/dropdown/test/dropdown.test.d.ts.map +0 -1
- package/dist/components/file-input/FileInput.d.ts +0 -62
- package/dist/components/file-input/FileInput.d.ts.map +0 -1
- package/dist/components/file-input/leu-file-input.d.ts +0 -8
- package/dist/components/file-input/leu-file-input.d.ts.map +0 -1
- package/dist/components/file-input/stories/file-input.stories.d.ts +0 -34
- package/dist/components/file-input/stories/file-input.stories.d.ts.map +0 -1
- package/dist/components/file-input/test/file-input.test.d.ts +0 -2
- package/dist/components/file-input/test/file-input.test.d.ts.map +0 -1
- package/dist/components/icon/Icon.d.ts +0 -20
- package/dist/components/icon/Icon.d.ts.map +0 -1
- package/dist/components/icon/leu-icon.d.ts +0 -8
- package/dist/components/icon/leu-icon.d.ts.map +0 -1
- package/dist/components/icon/paths.d.ts +0 -127
- package/dist/components/icon/paths.d.ts.map +0 -1
- package/dist/components/icon/stories/icon.stories.d.ts +0 -32
- package/dist/components/icon/stories/icon.stories.d.ts.map +0 -1
- package/dist/components/icon/test/icon.test.d.ts +0 -2
- package/dist/components/icon/test/icon.test.d.ts.map +0 -1
- package/dist/components/input/Input.d.ts +0 -163
- package/dist/components/input/Input.d.ts.map +0 -1
- package/dist/components/input/leu-input.d.ts +0 -8
- package/dist/components/input/leu-input.d.ts.map +0 -1
- package/dist/components/input/stories/input.stories.d.ts +0 -35
- package/dist/components/input/stories/input.stories.d.ts.map +0 -1
- package/dist/components/input/test/input.test.d.ts +0 -2
- package/dist/components/input/test/input.test.d.ts.map +0 -1
- package/dist/components/menu/Menu.d.ts +0 -39
- package/dist/components/menu/Menu.d.ts.map +0 -1
- package/dist/components/menu/MenuItem.d.ts +0 -61
- package/dist/components/menu/MenuItem.d.ts.map +0 -1
- package/dist/components/menu/leu-menu-item.d.ts +0 -8
- package/dist/components/menu/leu-menu-item.d.ts.map +0 -1
- package/dist/components/menu/leu-menu.d.ts +0 -8
- package/dist/components/menu/leu-menu.d.ts.map +0 -1
- package/dist/components/menu/stories/menu-item.stories.d.ts +0 -24
- package/dist/components/menu/stories/menu-item.stories.d.ts.map +0 -1
- package/dist/components/menu/stories/menu.stories.d.ts +0 -26
- package/dist/components/menu/stories/menu.stories.d.ts.map +0 -1
- package/dist/components/menu/test/menu-item.test.d.ts +0 -3
- package/dist/components/menu/test/menu-item.test.d.ts.map +0 -1
- package/dist/components/menu/test/menu.test.d.ts +0 -4
- package/dist/components/menu/test/menu.test.d.ts.map +0 -1
- package/dist/components/message/Message.d.ts +0 -59
- package/dist/components/message/Message.d.ts.map +0 -1
- package/dist/components/message/leu-message.d.ts +0 -8
- package/dist/components/message/leu-message.d.ts.map +0 -1
- package/dist/components/message/stories/message.stories.d.ts +0 -179
- package/dist/components/message/stories/message.stories.d.ts.map +0 -1
- package/dist/components/message/test/message.test.d.ts +0 -2
- package/dist/components/message/test/message.test.d.ts.map +0 -1
- package/dist/components/pagination/Pagination.d.ts +0 -72
- package/dist/components/pagination/Pagination.d.ts.map +0 -1
- package/dist/components/pagination/leu-pagination.d.ts +0 -8
- package/dist/components/pagination/leu-pagination.d.ts.map +0 -1
- package/dist/components/pagination/stories/pagination.stories.d.ts +0 -25
- package/dist/components/pagination/stories/pagination.stories.d.ts.map +0 -1
- package/dist/components/pagination/test/pagination.test.d.ts +0 -2
- package/dist/components/pagination/test/pagination.test.d.ts.map +0 -1
- package/dist/components/placeholder/Placeholder.d.ts +0 -23
- package/dist/components/placeholder/Placeholder.d.ts.map +0 -1
- package/dist/components/placeholder/leu-placeholder.d.ts +0 -8
- package/dist/components/placeholder/leu-placeholder.d.ts.map +0 -1
- package/dist/components/placeholder/stories/placeholder.stories.d.ts +0 -27
- package/dist/components/placeholder/stories/placeholder.stories.d.ts.map +0 -1
- package/dist/components/placeholder/test/placeholder.test.d.ts +0 -2
- package/dist/components/placeholder/test/placeholder.test.d.ts.map +0 -1
- package/dist/components/popup/Popup.d.ts +0 -57
- package/dist/components/popup/Popup.d.ts.map +0 -1
- package/dist/components/popup/leu-popup.d.ts +0 -8
- package/dist/components/popup/leu-popup.d.ts.map +0 -1
- package/dist/components/popup/stories/popup.stories.d.ts +0 -28
- package/dist/components/popup/stories/popup.stories.d.ts.map +0 -1
- package/dist/components/popup/test/popup.test.d.ts +0 -2
- package/dist/components/popup/test/popup.test.d.ts.map +0 -1
- package/dist/components/progress-bar/ProgressBar.d.ts +0 -25
- package/dist/components/progress-bar/ProgressBar.d.ts.map +0 -1
- package/dist/components/progress-bar/leu-progress-bar.d.ts +0 -8
- package/dist/components/progress-bar/leu-progress-bar.d.ts.map +0 -1
- package/dist/components/progress-bar/stories/progress-bar.stories.d.ts +0 -48
- package/dist/components/progress-bar/stories/progress-bar.stories.d.ts.map +0 -1
- package/dist/components/progress-bar/test/progress-bar.test.d.ts +0 -2
- package/dist/components/progress-bar/test/progress-bar.test.d.ts.map +0 -1
- package/dist/components/radio/Radio.d.ts +0 -24
- package/dist/components/radio/Radio.d.ts.map +0 -1
- package/dist/components/radio/RadioGroup.d.ts +0 -39
- package/dist/components/radio/RadioGroup.d.ts.map +0 -1
- package/dist/components/radio/leu-radio-group.d.ts +0 -8
- package/dist/components/radio/leu-radio-group.d.ts.map +0 -1
- package/dist/components/radio/leu-radio.d.ts +0 -8
- package/dist/components/radio/leu-radio.d.ts.map +0 -1
- package/dist/components/radio/stories/radio-group.stories.d.ts +0 -29
- package/dist/components/radio/stories/radio-group.stories.d.ts.map +0 -1
- package/dist/components/radio/stories/radio.stories.d.ts +0 -22
- package/dist/components/radio/stories/radio.stories.d.ts.map +0 -1
- package/dist/components/radio/test/radio-group.test.d.ts +0 -3
- package/dist/components/radio/test/radio-group.test.d.ts.map +0 -1
- package/dist/components/radio/test/radio.test.d.ts +0 -2
- package/dist/components/radio/test/radio.test.d.ts.map +0 -1
- package/dist/components/range/Range.d.ts +0 -116
- package/dist/components/range/Range.d.ts.map +0 -1
- package/dist/components/range/leu-range.d.ts +0 -8
- package/dist/components/range/leu-range.d.ts.map +0 -1
- package/dist/components/range/stories/range.stories.d.ts +0 -231
- package/dist/components/range/stories/range.stories.d.ts.map +0 -1
- package/dist/components/range/test/range.test.d.ts +0 -2
- package/dist/components/range/test/range.test.d.ts.map +0 -1
- package/dist/components/scroll-top/ScrollTop.d.ts +0 -23
- package/dist/components/scroll-top/ScrollTop.d.ts.map +0 -1
- package/dist/components/scroll-top/leu-scroll-top.d.ts +0 -8
- package/dist/components/scroll-top/leu-scroll-top.d.ts.map +0 -1
- package/dist/components/scroll-top/stories/scroll-top.stories.d.ts +0 -8
- package/dist/components/scroll-top/stories/scroll-top.stories.d.ts.map +0 -1
- package/dist/components/scroll-top/test/scroll-top.test.d.ts +0 -2
- package/dist/components/scroll-top/test/scroll-top.test.d.ts.map +0 -1
- package/dist/components/select/Select.d.ts +0 -145
- package/dist/components/select/Select.d.ts.map +0 -1
- package/dist/components/select/leu-select.d.ts +0 -8
- package/dist/components/select/leu-select.d.ts.map +0 -1
- package/dist/components/select/stories/select.stories.d.ts +0 -23
- package/dist/components/select/stories/select.stories.d.ts.map +0 -1
- package/dist/components/select/test/fixtures.d.ts +0 -2
- package/dist/components/select/test/fixtures.d.ts.map +0 -1
- package/dist/components/select/test/select.test.d.ts +0 -3
- package/dist/components/select/test/select.test.d.ts.map +0 -1
- package/dist/components/spinner/Spinner.d.ts +0 -10
- package/dist/components/spinner/Spinner.d.ts.map +0 -1
- package/dist/components/spinner/leu-spinner.d.ts +0 -8
- package/dist/components/spinner/leu-spinner.d.ts.map +0 -1
- package/dist/components/spinner/stories/spinner.stories.d.ts +0 -16
- package/dist/components/spinner/stories/spinner.stories.d.ts.map +0 -1
- package/dist/components/spinner/test/spinner.test.d.ts +0 -2
- package/dist/components/spinner/test/spinner.test.d.ts.map +0 -1
- package/dist/components/table/Table.d.ts +0 -65
- package/dist/components/table/Table.d.ts.map +0 -1
- package/dist/components/table/leu-table.d.ts +0 -8
- package/dist/components/table/leu-table.d.ts.map +0 -1
- package/dist/components/table/stories/table.stories.d.ts +0 -15
- package/dist/components/table/stories/table.stories.d.ts.map +0 -1
- package/dist/components/table/test/table.test.d.ts +0 -2
- package/dist/components/table/test/table.test.d.ts.map +0 -1
- package/dist/components/tag/Tag.d.ts +0 -13
- package/dist/components/tag/Tag.d.ts.map +0 -1
- package/dist/components/tag/leu-tag.d.ts +0 -8
- package/dist/components/tag/leu-tag.d.ts.map +0 -1
- package/dist/components/tag/stories/tag.stories.d.ts +0 -136
- package/dist/components/tag/stories/tag.stories.d.ts.map +0 -1
- package/dist/components/tag/test/tag.test.d.ts +0 -2
- package/dist/components/tag/test/tag.test.d.ts.map +0 -1
- package/dist/components/visually-hidden/VisuallyHidden.d.ts +0 -9
- package/dist/components/visually-hidden/VisuallyHidden.d.ts.map +0 -1
- package/dist/components/visually-hidden/leu-visually-hidden.d.ts +0 -8
- package/dist/components/visually-hidden/leu-visually-hidden.d.ts.map +0 -1
- package/dist/components/visually-hidden/stories/visually-hidden.stories.d.ts +0 -13
- package/dist/components/visually-hidden/stories/visually-hidden.stories.d.ts.map +0 -1
- package/dist/components/visually-hidden/test/visually-hidden.test.d.ts +0 -2
- package/dist/components/visually-hidden/test/visually-hidden.test.d.ts.map +0 -1
- package/dist/hasSlotController-Bm2tipvG.js +0 -53
- package/dist/hasSlotController.d-emXwVXWF.d.ts +0 -23
- package/dist/index.d.ts.map +0 -1
- package/dist/lib/LeuElement.d.ts +0 -8
- package/dist/lib/LeuElement.d.ts.map +0 -1
- package/dist/lib/a11y.d.ts +0 -11
- package/dist/lib/a11y.d.ts.map +0 -1
- package/dist/lib/hasSlotController.d.ts +0 -20
- package/dist/lib/hasSlotController.d.ts.map +0 -1
- package/dist/lib/styleMap.d.ts +0 -61
- package/dist/lib/styleMap.d.ts.map +0 -1
- package/dist/lib/utils.d.ts +0 -23
- package/dist/lib/utils.d.ts.map +0 -1
- package/dist/styles/style.stories.d.ts +0 -6
- package/dist/styles/style.stories.d.ts.map +0 -1
- package/dist/utils-DBGsNSJW.js +0 -33
- package/rollup.config.js +0 -94
- package/web-dev-server.config.mjs +0 -30
|
@@ -0,0 +1,610 @@
|
|
|
1
|
+
import { t as LeuElement } from "./LeuElement-B7NJzWwP.js";
|
|
2
|
+
import { t as __decorate } from "./decorate-DwpAc4D0.js";
|
|
3
|
+
import { t as LeuIcon } from "./Icon-DhAvH0XM.js";
|
|
4
|
+
import { t as FormAssociatedMixin } from "./FormAssociatedMixin-BbFlza53.js";
|
|
5
|
+
import { css, html, nothing } from "lit";
|
|
6
|
+
import { property, state } from "lit/decorators.js";
|
|
7
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
8
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
9
|
+
import { createRef, ref } from "lit/directives/ref.js";
|
|
10
|
+
import { live } from "lit/directives/live.js";
|
|
11
|
+
//#region src/components/input/input.css?inline
|
|
12
|
+
var input_default = css`:host {
|
|
13
|
+
--input-color: var(--leu-color-black-100);
|
|
14
|
+
--input-color-disabled: var(--leu-color-black-20);
|
|
15
|
+
--input-color-invalid: var(--leu-color-func-red);
|
|
16
|
+
--input-color-focus: var(--leu-color-func-cyan);
|
|
17
|
+
--input-border-width: 2px;
|
|
18
|
+
|
|
19
|
+
--input-label-color: var(--leu-color-black-100);
|
|
20
|
+
--input-label-color-disabled: var(--input-color-disabled);
|
|
21
|
+
--input-label-color-empty: var(--leu-color-black-60);
|
|
22
|
+
|
|
23
|
+
--input-affix-color: var(--leu-color-black-60);
|
|
24
|
+
--input-affix-color-disabled: var(--input-color-disabled);
|
|
25
|
+
|
|
26
|
+
--input-border-color: var(--leu-color-black-40);
|
|
27
|
+
--input-border-color-focus: var(--input-color-focus);
|
|
28
|
+
--input-border-color-disabled: var(--leu-color-black-20);
|
|
29
|
+
--input-border-color-invalid: var(--input-color-invalid);
|
|
30
|
+
|
|
31
|
+
--input-error-color: var(--leu-color-black-0);
|
|
32
|
+
|
|
33
|
+
--input-clear-color: var(--leu-color-black-60);
|
|
34
|
+
|
|
35
|
+
--input-font-regular: var(--leu-font-family-regular);
|
|
36
|
+
--input-font-black: var(--leu-font-family-black);
|
|
37
|
+
|
|
38
|
+
--input-height: 4.5rem;
|
|
39
|
+
--input-height-small: 3rem;
|
|
40
|
+
|
|
41
|
+
display: block;
|
|
42
|
+
font-family: var(--input-font-regular);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
:host([disabled]) {
|
|
46
|
+
--input-color: var(--input-color-disabled);
|
|
47
|
+
--input-border-color: var(--input-border-color-disabled);
|
|
48
|
+
--input-label-color: var(--input-color-disabled);
|
|
49
|
+
--input-color-focus: var(--input-color-disabled);
|
|
50
|
+
--input-affix-color: var(--input-color-disabled);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
:host(:focus-within) {
|
|
54
|
+
outline: 2px solid var(--input-color-focus);
|
|
55
|
+
outline-offset: 2px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.input-wrapper {
|
|
59
|
+
position: relative;
|
|
60
|
+
display: flex;
|
|
61
|
+
gap: 0.5rem;
|
|
62
|
+
padding-left: 0.875rem;
|
|
63
|
+
padding-right: 0.875rem;
|
|
64
|
+
|
|
65
|
+
border: var(--input-border-width) solid var(--input-border-color);
|
|
66
|
+
border-radius: 2px;
|
|
67
|
+
background: var(--leu-color-black-0);
|
|
68
|
+
|
|
69
|
+
line-height: 1;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.input-wrapper:focus-within,
|
|
73
|
+
.input-wrapper:hover {
|
|
74
|
+
--input-border-color: var(--input-border-color-focus);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.input-wrapper--invalid:focus-within {
|
|
78
|
+
--input-border-color: var(--input-border-color-invalid);
|
|
79
|
+
border-radius: 2px 2px 0 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.input-wrapper--invalid,
|
|
83
|
+
.input-wrapper--invalid:hover {
|
|
84
|
+
--input-border-color: var(--input-border-color-invalid);
|
|
85
|
+
border-radius: 2px 2px 0 0;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.input {
|
|
89
|
+
-webkit-appearance: none;
|
|
90
|
+
-moz-appearance: none;
|
|
91
|
+
appearance: none;
|
|
92
|
+
display: block;
|
|
93
|
+
width: 100%;
|
|
94
|
+
|
|
95
|
+
font-size: 1rem;
|
|
96
|
+
line-height: 1;
|
|
97
|
+
color: var(--input-color);
|
|
98
|
+
|
|
99
|
+
border: 0;
|
|
100
|
+
background: var(--leu-color-black-0);
|
|
101
|
+
|
|
102
|
+
padding-top: 2rem;
|
|
103
|
+
|
|
104
|
+
padding-bottom: 1rem;
|
|
105
|
+
height: calc(var(--input-height) - var(--input-border-width) * 2);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.input:focus-visible {
|
|
109
|
+
outline: none;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
:host([size="small"]) .input {
|
|
113
|
+
--input-height: var(--input-height-small);
|
|
114
|
+
padding-top: 0.75rem;
|
|
115
|
+
padding-bottom: 0.75rem;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.prefix,
|
|
119
|
+
.suffix {
|
|
120
|
+
padding-top: calc(2rem - var(--input-border-width));
|
|
121
|
+
padding-bottom: calc(1rem - var(--input-border-width));
|
|
122
|
+
font-size: 1rem;
|
|
123
|
+
line-height: 1.5;
|
|
124
|
+
color: var(--input-affix-color);
|
|
125
|
+
pointer-events: none;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.prefix {
|
|
129
|
+
order: -1;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* Label styles for when the input has focus OR contains a value */
|
|
133
|
+
|
|
134
|
+
.label {
|
|
135
|
+
position: absolute;
|
|
136
|
+
left: 1rem;
|
|
137
|
+
|
|
138
|
+
line-height: 1.5;
|
|
139
|
+
color: var(--input-label-color);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/* is size regular AND (has focus OR contains a value) */
|
|
143
|
+
|
|
144
|
+
.input-wrapper--invalid .label,
|
|
145
|
+
:host(:not([size])) .label,
|
|
146
|
+
:host([size="regular"]) .label {
|
|
147
|
+
top: calc(0.75rem - var(--input-border-width));
|
|
148
|
+
|
|
149
|
+
font-size: 0.75rem;
|
|
150
|
+
font-family: var(--input-font-black);
|
|
151
|
+
|
|
152
|
+
transition: 0.15s ease-out;
|
|
153
|
+
transition-property: font-size, top;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/* is size small AND (has focus OR contains a value) */
|
|
157
|
+
|
|
158
|
+
:host([size="small"]) .label {
|
|
159
|
+
opacity: 0;
|
|
160
|
+
visibility: hidden;
|
|
161
|
+
|
|
162
|
+
font-size: 1rem;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
:host([required]) .label::after {
|
|
166
|
+
content: "*";
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/* is not disabled AND has focus AND is empty */
|
|
170
|
+
|
|
171
|
+
:host(:not([disabled]):not(:focus-within)) .input-wrapper--empty .label {
|
|
172
|
+
--input-label-color: var(--input-label-color-empty);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/* is empty AND has no focus */
|
|
176
|
+
|
|
177
|
+
:host(:not(:focus-within))
|
|
178
|
+
.input-wrapper--empty:not(.input-wrapper--invalid)
|
|
179
|
+
.label {
|
|
180
|
+
font-family: var(--input-font-regular);
|
|
181
|
+
font-size: 1rem;
|
|
182
|
+
top: calc(1.5rem - var(--input-border-width));
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/* is size small AND has no focus AND is empty */
|
|
186
|
+
|
|
187
|
+
:host(:not(:focus-within)[size="small"])
|
|
188
|
+
.input-wrapper--empty:not(.input-wrapper--invalid)
|
|
189
|
+
.label {
|
|
190
|
+
top: calc(0.75rem - var(--input-border-width));
|
|
191
|
+
opacity: 1;
|
|
192
|
+
visibility: visible;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/* The label has to behave a bit different when the input has a suffix or a prefix */
|
|
196
|
+
|
|
197
|
+
:host([suffix])
|
|
198
|
+
.input-wrapper--empty
|
|
199
|
+
.input:not(:focus)
|
|
200
|
+
+ .label {
|
|
201
|
+
top: calc(0.75rem - var(--input-border-width));
|
|
202
|
+
|
|
203
|
+
font-family: var(--input-font-black);
|
|
204
|
+
font-size: 0.75rem;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
:host([prefix])
|
|
208
|
+
.input-wrapper--empty
|
|
209
|
+
.input:not(:focus)
|
|
210
|
+
+ .label {
|
|
211
|
+
top: calc(0.75rem - var(--input-border-width));
|
|
212
|
+
|
|
213
|
+
font-family: var(--input-font-black);
|
|
214
|
+
font-size: 0.75rem;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.error {
|
|
218
|
+
list-style: none;
|
|
219
|
+
padding: 0.0625rem 1rem 0.1875rem;
|
|
220
|
+
margin: 0;
|
|
221
|
+
|
|
222
|
+
color: var(--input-error-color);
|
|
223
|
+
font-size: 0.75rem;
|
|
224
|
+
line-height: 1.5;
|
|
225
|
+
|
|
226
|
+
border: 2px solid var(--input-color-invalid);
|
|
227
|
+
border-radius: 0 0 2px 2px;
|
|
228
|
+
|
|
229
|
+
background-color: var(--input-color-invalid);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.clear-button {
|
|
233
|
+
--_length: 1.5rem;
|
|
234
|
+
|
|
235
|
+
align-self: center;
|
|
236
|
+
|
|
237
|
+
width: 1.5rem;
|
|
238
|
+
|
|
239
|
+
width: var(--_length);
|
|
240
|
+
height: 1.5rem;
|
|
241
|
+
height: var(--_length);
|
|
242
|
+
padding: 0;
|
|
243
|
+
|
|
244
|
+
cursor: pointer;
|
|
245
|
+
|
|
246
|
+
background: none;
|
|
247
|
+
color: var(--input-clear-color);
|
|
248
|
+
border: none;
|
|
249
|
+
|
|
250
|
+
/* border-radius is only defined for a nice focus outline */
|
|
251
|
+
border-radius: 2px;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.clear-button:focus-visible {
|
|
255
|
+
outline: 2px solid var(--input-color-focus);
|
|
256
|
+
outline-offset: 2px;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.clear-button:disabled {
|
|
260
|
+
cursor: default;
|
|
261
|
+
color: var(--input-color-disabled);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.icon {
|
|
265
|
+
align-self: center;
|
|
266
|
+
color: var(--input-color);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
:host(:not([disabled]):not(:focus-within)) .input-wrapper--empty .icon {
|
|
270
|
+
color: var(--input-label-color-empty);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.error-icon {
|
|
274
|
+
align-self: center;
|
|
275
|
+
color: var(--input-color-invalid);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.icon leu-icon, .error-icon leu-icon {
|
|
279
|
+
display: block;
|
|
280
|
+
}
|
|
281
|
+
`;
|
|
282
|
+
//#endregion
|
|
283
|
+
//#region src/components/input/Input.ts
|
|
284
|
+
const SIZES = Object.freeze({
|
|
285
|
+
SMALL: "small",
|
|
286
|
+
REGULAR: "regular"
|
|
287
|
+
});
|
|
288
|
+
/**
|
|
289
|
+
* TODO:
|
|
290
|
+
* - Add section to docs about how to mark up suffix and prefix for screenreaders
|
|
291
|
+
* - Handle validation
|
|
292
|
+
* - Infotext attribute or slot?
|
|
293
|
+
*/
|
|
294
|
+
const VALIDATION_MESSAGES = {
|
|
295
|
+
badInput: "Bitte überprüfen Sie das Format.",
|
|
296
|
+
patternMismatch: "Bitte überprüfen Sie das Format.",
|
|
297
|
+
rangeOverflow: (max) => `Der Wert darf nicht grösser als ${max} sein.`,
|
|
298
|
+
rangeUnderflow: (min) => `Der Wert darf nicht kleiner als ${min} sein.`,
|
|
299
|
+
stepMismatch: "Bitte überprüfen Sie das Format.",
|
|
300
|
+
tooLong: (maxlength) => `Die Eingabe muss kürzer als ${maxlength} Zeichen sein.`,
|
|
301
|
+
tooShort: (minlength) => `Die Eingabe muss länger als ${minlength} Zeichen sein.`,
|
|
302
|
+
typeMismatch: "Bitte überprüfen Sie das Format.",
|
|
303
|
+
valueMissing: "Bitte füllen Sie das Feld aus."
|
|
304
|
+
};
|
|
305
|
+
/**
|
|
306
|
+
* A text input element.
|
|
307
|
+
*
|
|
308
|
+
* @fires {CustomEvent} input - Dispatched when the value of the input element changes.
|
|
309
|
+
* @fires {CustomEvent} change - Dispatched when the value of the input element changes and the input element loses focus.
|
|
310
|
+
*
|
|
311
|
+
* @tagname leu-input
|
|
312
|
+
*/
|
|
313
|
+
var LeuInput = class LeuInput extends FormAssociatedMixin(LeuElement) {
|
|
314
|
+
constructor(..._args) {
|
|
315
|
+
super(..._args);
|
|
316
|
+
this.disabled = false;
|
|
317
|
+
this.required = false;
|
|
318
|
+
this.clearable = false;
|
|
319
|
+
this.value = "";
|
|
320
|
+
this.error = "";
|
|
321
|
+
this.label = "";
|
|
322
|
+
this.size = "regular";
|
|
323
|
+
this.type = "text";
|
|
324
|
+
this.validationMessages = {};
|
|
325
|
+
this.novalidate = false;
|
|
326
|
+
this._validity = null;
|
|
327
|
+
this._inputRef = createRef();
|
|
328
|
+
}
|
|
329
|
+
static {
|
|
330
|
+
this.dependencies = { "leu-icon": LeuIcon };
|
|
331
|
+
}
|
|
332
|
+
static {
|
|
333
|
+
this.styles = [LeuElement.styles, input_default];
|
|
334
|
+
}
|
|
335
|
+
static {
|
|
336
|
+
this.shadowRootOptions = {
|
|
337
|
+
...LeuElement.shadowRootOptions,
|
|
338
|
+
delegatesFocus: true
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
static resolveErrorMessage(message, refernceValue) {
|
|
342
|
+
if (typeof message === "function") return message(refernceValue);
|
|
343
|
+
return message;
|
|
344
|
+
}
|
|
345
|
+
get valueAsNumber() {
|
|
346
|
+
if (this.value === "") return NaN;
|
|
347
|
+
return Number(this.value);
|
|
348
|
+
}
|
|
349
|
+
formResetCallback() {
|
|
350
|
+
this.value = "";
|
|
351
|
+
}
|
|
352
|
+
setFormValue() {
|
|
353
|
+
this.internals.setFormValue(this.value);
|
|
354
|
+
}
|
|
355
|
+
willUpdate(changedProperties) {
|
|
356
|
+
if (changedProperties.has("value")) this.setFormValue();
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Method for handling the click event of the wrapper element.
|
|
360
|
+
* Redirect every click on the wrapper to the input element.
|
|
361
|
+
* This is only necessary for click events because the wrapper element
|
|
362
|
+
* looks like the input element. But the actual input field does not
|
|
363
|
+
* completely fill the wrapper element. Keyboard events don't need to be
|
|
364
|
+
* handled because the actual input element is focusable.
|
|
365
|
+
*/
|
|
366
|
+
handleWrapperClick(event) {
|
|
367
|
+
if (event.target === event.currentTarget) this._inputRef.value.focus();
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Method for handling the blur event of the input element.
|
|
371
|
+
* Checks validity of the input element and sets the validity state.
|
|
372
|
+
*/
|
|
373
|
+
handleBlur(event) {
|
|
374
|
+
this._validity = null;
|
|
375
|
+
if (!this.novalidate) event.target.checkValidity();
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Method for handling the invalid event of the input element.
|
|
379
|
+
* Sets the validity state.
|
|
380
|
+
*/
|
|
381
|
+
handleInvalid(event) {
|
|
382
|
+
this._validity = event.target.validity;
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Method for handling the change event of the input element.
|
|
386
|
+
* Sets the value property and dispatches a change event so that
|
|
387
|
+
* the event can be handled outside the shadow DOM.
|
|
388
|
+
* @fires {CustomEvent} change
|
|
389
|
+
*/
|
|
390
|
+
handleChange(event) {
|
|
391
|
+
if (event.target.validity.valid) this.value = event.target.value;
|
|
392
|
+
const customEvent = new CustomEvent(event.type, event);
|
|
393
|
+
this.dispatchEvent(customEvent);
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Method for handling the input event of the input element.
|
|
397
|
+
* Sets the value property and dispatches an input event so that
|
|
398
|
+
* the event can be handled outside the shadow DOM.
|
|
399
|
+
*/
|
|
400
|
+
handleInput(event) {
|
|
401
|
+
this.value = event.target.value;
|
|
402
|
+
const customEvent = new CustomEvent("input", {
|
|
403
|
+
bubbles: true,
|
|
404
|
+
composed: true
|
|
405
|
+
});
|
|
406
|
+
this.dispatchEvent(customEvent);
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Method for clearing the input element.
|
|
410
|
+
* Sets the value property to an empty string and dispatches
|
|
411
|
+
* an input and a change event.
|
|
412
|
+
* @fires {CustomEvent} input
|
|
413
|
+
* @fires {CustomEvent} change
|
|
414
|
+
*/
|
|
415
|
+
clear() {
|
|
416
|
+
this.value = "";
|
|
417
|
+
this._inputRef.value.focus();
|
|
418
|
+
this.dispatchEvent(new CustomEvent("input", {
|
|
419
|
+
bubbles: true,
|
|
420
|
+
composed: true
|
|
421
|
+
}));
|
|
422
|
+
this.dispatchEvent(new CustomEvent("change", {
|
|
423
|
+
bubbles: true,
|
|
424
|
+
composed: true
|
|
425
|
+
}));
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Merge custom and default validation messages.
|
|
429
|
+
* A validation message can be a function or a string.
|
|
430
|
+
* If it s a function, the function is called with the corresponding
|
|
431
|
+
* attribute value as argument.
|
|
432
|
+
* e.g.
|
|
433
|
+
* `tooLong(this.maxlength)`
|
|
434
|
+
* This way the framework user can create reasonable validation messages
|
|
435
|
+
*/
|
|
436
|
+
getValidationMessages() {
|
|
437
|
+
const validationMessages = {
|
|
438
|
+
...VALIDATION_MESSAGES,
|
|
439
|
+
...this.validationMessages
|
|
440
|
+
};
|
|
441
|
+
const { tooLong, tooShort, rangeOverflow, rangeUnderflow } = validationMessages;
|
|
442
|
+
validationMessages.tooLong = LeuInput.resolveErrorMessage(tooLong, this.maxlength);
|
|
443
|
+
validationMessages.tooShort = LeuInput.resolveErrorMessage(tooShort, this.minlength);
|
|
444
|
+
validationMessages.rangeOverflow = LeuInput.resolveErrorMessage(rangeOverflow, this.max);
|
|
445
|
+
validationMessages.rangeUnderflow = LeuInput.resolveErrorMessage(rangeUnderflow, this.min);
|
|
446
|
+
return validationMessages;
|
|
447
|
+
}
|
|
448
|
+
isInvalid() {
|
|
449
|
+
if (this.error) return true;
|
|
450
|
+
return this._validity === null || this.novalidate ? false : !this._validity.valid;
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Check input validation
|
|
454
|
+
*/
|
|
455
|
+
checkValidity() {
|
|
456
|
+
return this._inputRef.value?.checkValidity() ?? false;
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Creates an error list with an item for the given validity state.
|
|
460
|
+
*/
|
|
461
|
+
renderErrorMessages() {
|
|
462
|
+
if (!this.isInvalid()) return nothing;
|
|
463
|
+
const validationMessages = this.getValidationMessages();
|
|
464
|
+
let errorMessages = this._validity ? Object.entries(validationMessages).filter(([prop]) => this._validity[prop]).map(([_, message]) => message) : [];
|
|
465
|
+
if (this.error !== "") errorMessages = [this.error, errorMessages];
|
|
466
|
+
return html`
|
|
467
|
+
<ul class="error" aria-errormessage="input">
|
|
468
|
+
${errorMessages.map((message) => html`<li class="error-message">${message}</li>`)}
|
|
469
|
+
</ul>
|
|
470
|
+
`;
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* Determines the content that is displayed after the input element.
|
|
474
|
+
* This can be either an icon, a clear button or an error indicator icon.
|
|
475
|
+
*/
|
|
476
|
+
renderAfterContent() {
|
|
477
|
+
if (this.isInvalid()) return html`<div class="error-icon">
|
|
478
|
+
<leu-icon name="caution"></leu-icon>
|
|
479
|
+
</div>`;
|
|
480
|
+
if (this.clearable && this.value) return html`<button
|
|
481
|
+
class="clear-button"
|
|
482
|
+
@click=${this.clear}
|
|
483
|
+
aria-label="Eingabefeld zurücksetzen"
|
|
484
|
+
?disabled=${this.disabled}
|
|
485
|
+
>
|
|
486
|
+
<leu-icon name="clear"></leu-icon>
|
|
487
|
+
</button>`;
|
|
488
|
+
if (this.icon) return html`<div class="icon">
|
|
489
|
+
<leu-icon name=${this.icon}></leu-icon>
|
|
490
|
+
</div>`;
|
|
491
|
+
return nothing;
|
|
492
|
+
}
|
|
493
|
+
render() {
|
|
494
|
+
const isInvalid = this.isInvalid();
|
|
495
|
+
const inputWrapperClasses = {
|
|
496
|
+
"input-wrapper": true,
|
|
497
|
+
"input-wrapper--empty": !this.value,
|
|
498
|
+
"input-wrapper--invalid": isInvalid
|
|
499
|
+
};
|
|
500
|
+
return html`
|
|
501
|
+
<div
|
|
502
|
+
@click=${this.handleWrapperClick}
|
|
503
|
+
class=${classMap(inputWrapperClasses)}
|
|
504
|
+
>
|
|
505
|
+
<input
|
|
506
|
+
class="input"
|
|
507
|
+
id="input"
|
|
508
|
+
type=${this.type}
|
|
509
|
+
name=${this.name}
|
|
510
|
+
@change=${this.handleChange}
|
|
511
|
+
@blur=${this.handleBlur}
|
|
512
|
+
@input=${this.handleInput}
|
|
513
|
+
@invalid=${this.handleInvalid}
|
|
514
|
+
?disabled=${this.disabled}
|
|
515
|
+
?required=${this.required}
|
|
516
|
+
.value=${live(this.value ?? "")}
|
|
517
|
+
pattern=${ifDefined(this.pattern)}
|
|
518
|
+
min=${ifDefined(this.min)}
|
|
519
|
+
max=${ifDefined(this.max)}
|
|
520
|
+
maxlength=${ifDefined(this.maxlength)}
|
|
521
|
+
minlength=${ifDefined(this.minlength)}
|
|
522
|
+
step=${ifDefined(this.step)}
|
|
523
|
+
ref=${ref(this._inputRef)}
|
|
524
|
+
aria-invalid=${isInvalid}
|
|
525
|
+
/>
|
|
526
|
+
<label for="input" class="label">${this.label}</label>
|
|
527
|
+
${this.prefix ? html`<div class="prefix" .aria-hidden=${true}>${this.prefix}</div>` : nothing}
|
|
528
|
+
${this.suffix ? html`<div class="suffix" .aria-hidden=${true}>${this.suffix}</div>` : nothing}
|
|
529
|
+
${this.renderAfterContent()}
|
|
530
|
+
</div>
|
|
531
|
+
${this.renderErrorMessages()}
|
|
532
|
+
`;
|
|
533
|
+
}
|
|
534
|
+
};
|
|
535
|
+
__decorate([property({
|
|
536
|
+
type: Boolean,
|
|
537
|
+
reflect: true
|
|
538
|
+
})], LeuInput.prototype, "disabled", void 0);
|
|
539
|
+
__decorate([property({
|
|
540
|
+
type: Boolean,
|
|
541
|
+
reflect: true
|
|
542
|
+
})], LeuInput.prototype, "required", void 0);
|
|
543
|
+
__decorate([property({
|
|
544
|
+
type: Boolean,
|
|
545
|
+
reflect: true
|
|
546
|
+
})], LeuInput.prototype, "clearable", void 0);
|
|
547
|
+
__decorate([property({
|
|
548
|
+
type: String,
|
|
549
|
+
reflect: true
|
|
550
|
+
})], LeuInput.prototype, "value", void 0);
|
|
551
|
+
__decorate([property({
|
|
552
|
+
type: String,
|
|
553
|
+
reflect: true
|
|
554
|
+
})], LeuInput.prototype, "error", void 0);
|
|
555
|
+
__decorate([property({
|
|
556
|
+
type: String,
|
|
557
|
+
reflect: true
|
|
558
|
+
})], LeuInput.prototype, "label", void 0);
|
|
559
|
+
__decorate([property({
|
|
560
|
+
type: String,
|
|
561
|
+
reflect: true
|
|
562
|
+
})], LeuInput.prototype, "prefix", void 0);
|
|
563
|
+
__decorate([property({
|
|
564
|
+
type: String,
|
|
565
|
+
reflect: true
|
|
566
|
+
})], LeuInput.prototype, "suffix", void 0);
|
|
567
|
+
__decorate([property({
|
|
568
|
+
type: String,
|
|
569
|
+
reflect: true
|
|
570
|
+
})], LeuInput.prototype, "size", void 0);
|
|
571
|
+
__decorate([property({
|
|
572
|
+
type: String,
|
|
573
|
+
reflect: true
|
|
574
|
+
})], LeuInput.prototype, "icon", void 0);
|
|
575
|
+
__decorate([property({
|
|
576
|
+
type: String,
|
|
577
|
+
reflect: true
|
|
578
|
+
})], LeuInput.prototype, "pattern", void 0);
|
|
579
|
+
__decorate([property({
|
|
580
|
+
type: String,
|
|
581
|
+
reflect: true
|
|
582
|
+
})], LeuInput.prototype, "type", void 0);
|
|
583
|
+
__decorate([property({
|
|
584
|
+
type: Number,
|
|
585
|
+
reflect: true
|
|
586
|
+
})], LeuInput.prototype, "min", void 0);
|
|
587
|
+
__decorate([property({
|
|
588
|
+
type: Number,
|
|
589
|
+
reflect: true
|
|
590
|
+
})], LeuInput.prototype, "max", void 0);
|
|
591
|
+
__decorate([property({
|
|
592
|
+
type: Number,
|
|
593
|
+
reflect: true
|
|
594
|
+
})], LeuInput.prototype, "step", void 0);
|
|
595
|
+
__decorate([property({
|
|
596
|
+
type: Number,
|
|
597
|
+
reflect: true
|
|
598
|
+
})], LeuInput.prototype, "maxlength", void 0);
|
|
599
|
+
__decorate([property({
|
|
600
|
+
type: Number,
|
|
601
|
+
reflect: true
|
|
602
|
+
})], LeuInput.prototype, "minlength", void 0);
|
|
603
|
+
__decorate([property({ type: Object })], LeuInput.prototype, "validationMessages", void 0);
|
|
604
|
+
__decorate([property({
|
|
605
|
+
type: Boolean,
|
|
606
|
+
reflect: true
|
|
607
|
+
})], LeuInput.prototype, "novalidate", void 0);
|
|
608
|
+
__decorate([state()], LeuInput.prototype, "_validity", void 0);
|
|
609
|
+
//#endregion
|
|
610
|
+
export { SIZES as n, LeuInput as t };
|