@statistikzh/leu 0.24.2 → 0.26.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/.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/CONTRIBUTING.md +19 -8
- package/dist/Accordion-B04QkmHz.js +241 -0
- package/dist/Accordion.d.ts +44 -44
- package/dist/Accordion.js +2 -249
- package/dist/Button-BgNUxmo_.d.ts +99 -0
- package/dist/Button-BkhqVjug.js +564 -0
- package/dist/Button.d.ts +2 -85
- package/dist/Button.js +5 -504
- package/dist/ButtonGroup-B8U9fDvM.js +88 -0
- package/dist/ButtonGroup.d.ts +19 -19
- package/dist/ButtonGroup.js +6 -101
- package/dist/ChartWrapper-CSMFwz9e.js +158 -0
- package/dist/ChartWrapper.d.ts +26 -26
- package/dist/ChartWrapper.js +3 -163
- package/dist/Checkbox-Dd1QLpfn.js +198 -0
- package/dist/Checkbox.d.ts +35 -27
- package/dist/Checkbox.js +4 -157
- package/dist/CheckboxGroup-Bz2eWEFL.js +81 -0
- package/dist/CheckboxGroup.d.ts +18 -18
- package/dist/CheckboxGroup.js +5 -82
- package/dist/Chip-DLKM9P7v.d.ts +18 -0
- package/dist/Chip-XAQIIsXq.js +171 -0
- package/dist/Chip.d.ts +2 -18
- package/dist/Chip.js +2 -166
- package/dist/ChipGroup-DLqfK2kn.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-DHuXR_oo.js +241 -0
- package/dist/Dialog.d.ts +28 -28
- package/dist/Dialog.js +3 -240
- package/dist/Dropdown-DtFTePbc.js +155 -0
- package/dist/Dropdown.d.ts +39 -41
- package/dist/Dropdown.js +9 -157
- package/dist/FileInput-b8sbLDPI.js +344 -0
- package/dist/FileInput.d.ts +56 -57
- package/dist/FileInput.js +7 -383
- package/dist/FormAssociatedMixin-Cc74LjbC.d.ts +22 -0
- package/dist/FormAssociatedMixin-DLPvFtbT.js +58 -0
- package/dist/Icon-C_yYuynf.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-D2THgo7c.d.ts +169 -0
- package/dist/Input-DEOVocTa.js +610 -0
- package/dist/Input.d.ts +2 -166
- package/dist/Input.js +4 -626
- package/dist/LeuElement-BeFrgKes.js +46 -0
- package/dist/LeuElement-pJFU18Xm.d.ts +11 -0
- package/dist/Menu-BeqqtCw6.js +136 -0
- package/dist/Menu-CQdx1ef3.d.ts +43 -0
- package/dist/Menu.d.ts +2 -44
- package/dist/Menu.js +4 -157
- package/dist/MenuItem-DVg8-1Bq.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-BhknWvAF.js +252 -0
- package/dist/Message.d.ts +53 -53
- package/dist/Message.js +3 -267
- package/dist/Pagination-CqkHh-Vd.d.ts +76 -0
- package/dist/Pagination-DJI5MIi_.js +226 -0
- package/dist/Pagination.d.ts +2 -76
- package/dist/Pagination.js +7 -240
- package/dist/Placeholder-BJybFwSg.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-DNlm_9AA.js +195 -0
- package/dist/Popup.d.ts +2 -62
- package/dist/Popup.js +2 -233
- package/dist/ProgressBar-B0wYj1KF.js +167 -0
- package/dist/ProgressBar.d.ts +21 -21
- package/dist/ProgressBar.js +2 -165
- package/dist/Radio-DMCL8c4D.js +160 -0
- package/dist/Radio.d.ts +22 -22
- package/dist/Radio.js +2 -151
- package/dist/RadioGroup-CM6IyBlq.js +171 -0
- package/dist/RadioGroup.d.ts +35 -35
- package/dist/RadioGroup.js +3 -182
- package/dist/Range-B72rtfln.js +496 -0
- package/dist/Range.d.ts +112 -112
- package/dist/Range.js +2 -586
- package/dist/ScrollTop-BFAqBVDR.js +130 -0
- package/dist/ScrollTop.d.ts +21 -21
- package/dist/ScrollTop.js +6 -134
- package/dist/Select-vxl3BvD4.js +618 -0
- package/dist/Select.d.ts +130 -132
- package/dist/Select.js +10 -675
- package/dist/Spinner-CrM1enM0.d.ts +14 -0
- package/dist/Spinner-DDTqijTO.js +56 -0
- package/dist/Spinner.d.ts +2 -14
- package/dist/Spinner.js +2 -52
- package/dist/Table-BgCxfBcm.js +392 -0
- package/dist/Table.d.ts +61 -63
- package/dist/Table.js +8 -427
- package/dist/Tag-DK2KkPIQ.js +76 -0
- package/dist/Tag.d.ts +8 -8
- package/dist/Tag.js +2 -74
- package/dist/VisuallyHidden-OeQvhxYn.d.ts +13 -0
- package/dist/VisuallyHidden-pll3amXE.js +29 -0
- package/dist/VisuallyHidden.d.ts +2 -13
- package/dist/VisuallyHidden.js +2 -25
- package/dist/decorate-DwpAc4D0.js +9 -0
- package/dist/hasSlotController-DSBCVzPD.js +38 -0
- package/dist/hasSlotController-DWPyZ52b.d.ts +19 -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 +8 -12
- package/dist/leu-button.d.ts +7 -11
- package/dist/leu-button.js +7 -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 +11 -17
- package/dist/leu-file-input.d.ts +7 -13
- package/dist/leu-file-input.js +9 -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 +9 -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 +8 -13
- package/dist/leu-select.d.ts +7 -19
- package/dist/leu-select.js +12 -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 +10 -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/utils-hfk5Nwy8.js +28 -0
- package/dist/vscode.html-custom-data.json +7 -8
- package/dist/vue/index.d.ts +5 -9
- package/dist/web-types.json +18 -24
- package/eslint.config.mjs +79 -0
- package/package.json +44 -60
- 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 +76 -5
- package/src/components/button/button.css +37 -9
- package/src/components/button/stories/button.stories.ts +23 -0
- package/src/components/button/test/button.test.ts +214 -9
- 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/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/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-BfXSO7MN.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,496 @@
|
|
|
1
|
+
import { t as LeuElement } from "./LeuElement-BeFrgKes.js";
|
|
2
|
+
import { t as __decorate } from "./decorate-DwpAc4D0.js";
|
|
3
|
+
import { n as isNumber, t as clamp } from "./utils-hfk5Nwy8.js";
|
|
4
|
+
import { css, html, nothing } from "lit";
|
|
5
|
+
import { property, query } from "lit/decorators.js";
|
|
6
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
7
|
+
//#region src/components/range/range.css?inline
|
|
8
|
+
var range_default = css`:host {
|
|
9
|
+
--range-color: var(--leu-color-black-40);
|
|
10
|
+
--range-color-disabled: var(--leu-color-black-20);
|
|
11
|
+
--range-color-focus: var(--leu-color-func-cyan);
|
|
12
|
+
|
|
13
|
+
--range-track-background-color: var(--leu-color-black-10);
|
|
14
|
+
--range-track-height: 4px;
|
|
15
|
+
--range-track-radius: var(--range-track-height);
|
|
16
|
+
|
|
17
|
+
--range-track-value-color: var(--leu-color-func-cyan);
|
|
18
|
+
--range-track-value-width: 0;
|
|
19
|
+
--range-track-value-min: 0;
|
|
20
|
+
|
|
21
|
+
--range-thumb-color: var(--leu-color-black-0);
|
|
22
|
+
--range-thumb-border-color: var(--range-color);
|
|
23
|
+
--range-thumb-hover-border-color: var(--leu-color-black-100);
|
|
24
|
+
--range-thumb-diameter: 32px;
|
|
25
|
+
|
|
26
|
+
--range-value-color: var(--leu-color-black-100);
|
|
27
|
+
--range-value-color-disabled: var(--range-color-disabled);
|
|
28
|
+
|
|
29
|
+
--range-font-regular: var(--leu-font-family-regular);
|
|
30
|
+
--range-font-black: var(--leu-font-family-black);
|
|
31
|
+
|
|
32
|
+
display: block;
|
|
33
|
+
|
|
34
|
+
font-family: var(--range-font-regular);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
:host([disabled]) {
|
|
38
|
+
--range-track-background: var(--range-color-disabled);
|
|
39
|
+
--range-track-value-color: var(--range-color-disabled);
|
|
40
|
+
--range-thumb-border-color: var(--range-color-disabled);
|
|
41
|
+
--range-thumb-hover-border-color: var(--range-color-disabled);
|
|
42
|
+
--range-value-color: var(--range-value-color-disabled);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.container {
|
|
46
|
+
position: relative;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.label {
|
|
50
|
+
display: inline-block;
|
|
51
|
+
margin-bottom: 0.5rem;
|
|
52
|
+
color: var(--leu-color-black-100);
|
|
53
|
+
font: var(--leu-t-regular-regular-font);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
:host([hide-label]) .label {
|
|
57
|
+
clip: rect(0 0 0 0);
|
|
58
|
+
border: 0;
|
|
59
|
+
height: 1px;
|
|
60
|
+
margin: -1px !important;
|
|
61
|
+
overflow: hidden;
|
|
62
|
+
padding: 0 !important;
|
|
63
|
+
position: absolute;
|
|
64
|
+
width: 1px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.outputs {
|
|
68
|
+
position: relative;
|
|
69
|
+
height: 1.5rem;
|
|
70
|
+
margin-bottom: 0.25rem;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.output {
|
|
74
|
+
position: absolute;
|
|
75
|
+
|
|
76
|
+
text-align: center;
|
|
77
|
+
font: var(--leu-t-tiny-black-font);
|
|
78
|
+
color: var(--range-value-color);
|
|
79
|
+
|
|
80
|
+
min-width: var(--range-thumb-diameter);
|
|
81
|
+
|
|
82
|
+
--_stop: calc(100% - var(--range-thumb-diameter));
|
|
83
|
+
--_start: 0%;
|
|
84
|
+
|
|
85
|
+
left: calc(var(--value) * (var(--_stop) - 0%) + 0%);
|
|
86
|
+
|
|
87
|
+
left: calc(var(--value) * (var(--_stop) - var(--_start)) + var(--_start));
|
|
88
|
+
transform: translateX(calc(-50% + var(--range-thumb-diameter) / 2));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.inputs {
|
|
92
|
+
position: relative;
|
|
93
|
+
z-index: 1;
|
|
94
|
+
height: var(--range-thumb-diameter);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.range {
|
|
98
|
+
-webkit-appearance: none;
|
|
99
|
+
-moz-appearance: none;
|
|
100
|
+
appearance: none;
|
|
101
|
+
width: 100%;
|
|
102
|
+
height: var(--range-thumb-diameter);
|
|
103
|
+
padding: 0;
|
|
104
|
+
margin: 0;
|
|
105
|
+
background: transparent;
|
|
106
|
+
|
|
107
|
+
--_track-background: linear-gradient(
|
|
108
|
+
to right,
|
|
109
|
+
var(--range-track-background-color) calc(var(--low) * 100%),
|
|
110
|
+
var(--range-track-value-color) 0,
|
|
111
|
+
var(--range-track-value-color) calc(var(--high) * 100%),
|
|
112
|
+
var(--range-track-background-color) 0
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.range--ghost {
|
|
117
|
+
position: absolute;
|
|
118
|
+
top: 0;
|
|
119
|
+
left: 0;
|
|
120
|
+
z-index: 1;
|
|
121
|
+
pointer-events: none;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.range:focus {
|
|
125
|
+
outline: none;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/* Thumb */
|
|
129
|
+
|
|
130
|
+
.range::-moz-range-thumb {
|
|
131
|
+
cursor: pointer;
|
|
132
|
+
background: var(--range-thumb-color);
|
|
133
|
+
|
|
134
|
+
border: 2px var(--range-thumb-border-color) solid;
|
|
135
|
+
border-radius: 50%;
|
|
136
|
+
|
|
137
|
+
height: var(--range-thumb-diameter);
|
|
138
|
+
width: var(--range-thumb-diameter);
|
|
139
|
+
|
|
140
|
+
pointer-events: all;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.range:disabled::-moz-range-thumb {
|
|
144
|
+
cursor: not-allowed;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.range:focus-visible::-moz-range-thumb {
|
|
148
|
+
outline: 2px solid var(--range-color-focus);
|
|
149
|
+
outline-offset: 2px;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.range::-moz-range-thumb:hover,
|
|
153
|
+
.range:focus-visible::-moz-range-thumb {
|
|
154
|
+
border-color: var(--range-thumb-hover-border-color);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.range::-webkit-slider-thumb {
|
|
158
|
+
-webkit-appearance: none;
|
|
159
|
+
appearance: none;
|
|
160
|
+
cursor: pointer;
|
|
161
|
+
background: var(--range-thumb-color);
|
|
162
|
+
|
|
163
|
+
border: 2px var(--range-thumb-border-color) solid;
|
|
164
|
+
border-radius: 50%;
|
|
165
|
+
|
|
166
|
+
height: var(--range-thumb-diameter);
|
|
167
|
+
width: var(--range-thumb-diameter);
|
|
168
|
+
margin-top: calc(var(--range-thumb-diameter) / -2 + 2px);
|
|
169
|
+
|
|
170
|
+
pointer-events: all;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.range:disabled::-webkit-slider-thumb {
|
|
174
|
+
cursor: not-allowed;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.range:focus::-webkit-slider-thumb {
|
|
178
|
+
outline: 2px solid var(--range-color-focus);
|
|
179
|
+
outline-offset: 2px;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.range:focus::-webkit-slider-thumb,
|
|
183
|
+
.range::-webkit-slider-thumb:hover {
|
|
184
|
+
border-color: var(--range-thumb-hover-border-color);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/* Track */
|
|
188
|
+
|
|
189
|
+
.range::-moz-range-track {
|
|
190
|
+
background: var(--_track-background);
|
|
191
|
+
border-radius: var(--range-track-radius);
|
|
192
|
+
height: var(--range-track-height);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.range--ghost::-moz-range-track {
|
|
196
|
+
background: transparent;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.range::-webkit-slider-runnable-track {
|
|
200
|
+
background: var(--_track-background);
|
|
201
|
+
border-radius: var(--range-track-radius);
|
|
202
|
+
height: var(--range-track-height);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.range--ghost::-webkit-slider-runnable-track {
|
|
206
|
+
background: transparent;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/* Ticks */
|
|
210
|
+
|
|
211
|
+
.ticks {
|
|
212
|
+
position: absolute;
|
|
213
|
+
top: calc(
|
|
214
|
+
var(--range-thumb-diameter) / 2 + var(--range-track-height)
|
|
215
|
+
);
|
|
216
|
+
left: calc(var(--range-thumb-diameter) / 2);
|
|
217
|
+
right: calc(var(--range-thumb-diameter) / 2);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.tick {
|
|
221
|
+
z-index: -1;
|
|
222
|
+
position: absolute;
|
|
223
|
+
top: 50%;
|
|
224
|
+
width: 2px;
|
|
225
|
+
height: 0.5rem;
|
|
226
|
+
background-color: var(--range-track-background-color);
|
|
227
|
+
transform: translateY(-50%);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.tick-labels {
|
|
231
|
+
display: flex;
|
|
232
|
+
justify-content: space-between;
|
|
233
|
+
color: var(--leu-color-black-60);
|
|
234
|
+
font: var(--leu-t-tiny-regular-font);
|
|
235
|
+
margin-top: 0.25rem;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.tick-label--max {
|
|
239
|
+
text-align: right;
|
|
240
|
+
}
|
|
241
|
+
`;
|
|
242
|
+
//#endregion
|
|
243
|
+
//#region src/components/range/Range.ts
|
|
244
|
+
const defaultValueConverter = {
|
|
245
|
+
fromAttribute(value) {
|
|
246
|
+
return value.split(",").map((v) => Number(v.trim()));
|
|
247
|
+
},
|
|
248
|
+
toAttribute(value) {
|
|
249
|
+
return value.join(",");
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
const RANGE_LABELS = ["Von", "Bis"];
|
|
253
|
+
/**
|
|
254
|
+
* @tagname leu-range
|
|
255
|
+
*/
|
|
256
|
+
var LeuRange = class extends LeuElement {
|
|
257
|
+
constructor(..._args) {
|
|
258
|
+
super(..._args);
|
|
259
|
+
this.defaultValue = [50];
|
|
260
|
+
this.min = 0;
|
|
261
|
+
this.max = 100;
|
|
262
|
+
this.step = 1;
|
|
263
|
+
this.name = "";
|
|
264
|
+
this.label = "";
|
|
265
|
+
this.hideLabel = false;
|
|
266
|
+
this.disabled = false;
|
|
267
|
+
this.multiple = false;
|
|
268
|
+
this.showTicks = false;
|
|
269
|
+
this.showRangeLabels = false;
|
|
270
|
+
this.prefix = "";
|
|
271
|
+
this.suffix = "";
|
|
272
|
+
this._value = this.defaultValue.map((v) => this.clampAndRoundValue(v));
|
|
273
|
+
}
|
|
274
|
+
static {
|
|
275
|
+
this.styles = [LeuElement.styles, range_default];
|
|
276
|
+
}
|
|
277
|
+
static {
|
|
278
|
+
this.shadowRootOptions = {
|
|
279
|
+
...LeuElement.shadowRootOptions,
|
|
280
|
+
delegatesFocus: true
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* The value of the range slider.
|
|
285
|
+
* String input is parsed as a comma-separated list of numbers.
|
|
286
|
+
* In multiple mode, if only a single value is provided, the second handle will be set to the minimum value.
|
|
287
|
+
* In single mode, only the first value will be used.
|
|
288
|
+
*/
|
|
289
|
+
set value(value) {
|
|
290
|
+
let nextValue = [];
|
|
291
|
+
if (typeof value === "string") nextValue = value.split(",").map((v) => Number(v.trim())).filter(isNumber);
|
|
292
|
+
else if (isNumber(value)) nextValue = [value];
|
|
293
|
+
else if (Array.isArray(value)) nextValue = value.map((v) => Number(v)).filter(isNumber);
|
|
294
|
+
if (nextValue.length === 0) return;
|
|
295
|
+
if (this.multiple && nextValue.length === 1) nextValue.unshift(this.min);
|
|
296
|
+
this._value = nextValue.slice(0, this.multiple ? 2 : 1).map((v) => this.clampAndRoundValue(v));
|
|
297
|
+
}
|
|
298
|
+
get value() {
|
|
299
|
+
return this._value.join(",");
|
|
300
|
+
}
|
|
301
|
+
get valueAsArray() {
|
|
302
|
+
return this._value.slice();
|
|
303
|
+
}
|
|
304
|
+
get valueLow() {
|
|
305
|
+
return Math.min(...this._value);
|
|
306
|
+
}
|
|
307
|
+
get valueHigh() {
|
|
308
|
+
return Math.max(...this._value);
|
|
309
|
+
}
|
|
310
|
+
updated() {
|
|
311
|
+
this.updateStyles();
|
|
312
|
+
}
|
|
313
|
+
willUpdate(changedProperties) {
|
|
314
|
+
if (changedProperties.has("defaultValue")) this.value = this.defaultValue.map((v) => this.clampAndRoundValue(v));
|
|
315
|
+
if (changedProperties.has("min") || changedProperties.has("max") || changedProperties.has("step")) this._value = this._value.map((v) => this.clampAndRoundValue(v));
|
|
316
|
+
if (changedProperties.has("multiple") && this.multiple) {
|
|
317
|
+
if (this._value.length === 1) this._value = [this.min, this._value[0]];
|
|
318
|
+
} else if (changedProperties.has("multiple") && !this.multiple) this._value = [this.valueLow];
|
|
319
|
+
}
|
|
320
|
+
updateStyles() {
|
|
321
|
+
const normalizedRange = this.getNormalizedRange();
|
|
322
|
+
this.container?.style.setProperty("--low", normalizedRange[0].toString());
|
|
323
|
+
this.container?.style.setProperty("--high", normalizedRange[1].toString());
|
|
324
|
+
(this.multiple ? [this.inputBase, this.inputGhost] : [this.inputBase]).forEach((input) => {
|
|
325
|
+
const output = input.id === "input-base" ? this.outputBase : this.outputGhost;
|
|
326
|
+
const normalizedValue = this.getNormalizedValue(input.valueAsNumber);
|
|
327
|
+
output.style.setProperty("--value", normalizedValue.toString());
|
|
328
|
+
output.value = this.formatValue(input.valueAsNumber);
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
clampAndRoundValue(value) {
|
|
332
|
+
const clampedValue = clamp(value, this.min, this.max);
|
|
333
|
+
return Math.round((clampedValue - this.min) / this.step) * this.step + this.min;
|
|
334
|
+
}
|
|
335
|
+
handleInput(e) {
|
|
336
|
+
e.stopPropagation();
|
|
337
|
+
if (this.multiple) this.value = [this.inputBase.valueAsNumber, this.inputGhost.valueAsNumber];
|
|
338
|
+
else this.value = [this.inputBase.valueAsNumber];
|
|
339
|
+
this.dispatchEvent(new CustomEvent("input", {
|
|
340
|
+
composed: true,
|
|
341
|
+
bubbles: true,
|
|
342
|
+
detail: {
|
|
343
|
+
value: this.value,
|
|
344
|
+
valueAsArray: this.valueAsArray
|
|
345
|
+
}
|
|
346
|
+
}));
|
|
347
|
+
}
|
|
348
|
+
getNormalizedValue(value) {
|
|
349
|
+
return (value - this.min) / (this.max - this.min);
|
|
350
|
+
}
|
|
351
|
+
getNormalizedRange() {
|
|
352
|
+
if (this.multiple) return this.valueAsArray.map((value) => this.getNormalizedValue(value)).sort((a, b) => a - b);
|
|
353
|
+
return [0, this.getNormalizedValue(this.valueAsArray[0])];
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* This event handler is only applied to the "base" input element and only when in "multiple" mode.
|
|
357
|
+
* It handles pointer events on the *track* and the thumb.
|
|
358
|
+
* This method determines if the interaction was closer to the base or the ghost input.
|
|
359
|
+
*/
|
|
360
|
+
handlePointerDown(e) {
|
|
361
|
+
const clickValue = this.min + (this.max - this.min) * e.offsetX / this.offsetWidth;
|
|
362
|
+
const middleValue = (this.valueAsArray[0] + this.valueAsArray[1]) / 2;
|
|
363
|
+
if (e.target.valueAsNumber === this.valueLow === clickValue > middleValue)
|
|
364
|
+
/**
|
|
365
|
+
* As the pointerdown event is fired before the input event, we first overwrite the value
|
|
366
|
+
* of the input element that was not clicked on. The active input element will update itself.
|
|
367
|
+
*/
|
|
368
|
+
this.inputGhost.value = e.target.value;
|
|
369
|
+
}
|
|
370
|
+
formatValue(value) {
|
|
371
|
+
if (this.valueFormatter) return this.valueFormatter(value);
|
|
372
|
+
return `${this.prefix}${value}${this.suffix}`;
|
|
373
|
+
}
|
|
374
|
+
renderTicks() {
|
|
375
|
+
if (!this.showTicks) return nothing;
|
|
376
|
+
return html`<div class="ticks">
|
|
377
|
+
${Array.from({ length: (this.max - this.min) / this.step + 1 }, (_, i) => this.min + i * this.step).map((tick) => html`<span
|
|
378
|
+
class="tick"
|
|
379
|
+
style="left: ${this.getNormalizedValue(tick) * 100}%"
|
|
380
|
+
></span>`)}
|
|
381
|
+
</div>`;
|
|
382
|
+
}
|
|
383
|
+
render() {
|
|
384
|
+
const inputs = this.multiple ? ["base", "ghost"] : ["base"];
|
|
385
|
+
const { multiple, disabled, label, valueAsArray } = this;
|
|
386
|
+
return html`
|
|
387
|
+
<div
|
|
388
|
+
id="container"
|
|
389
|
+
class="container"
|
|
390
|
+
role=${ifDefined(multiple ? "group" : void 0)}
|
|
391
|
+
aria-labelledby=${ifDefined(multiple ? "group-label" : void 0)}
|
|
392
|
+
>
|
|
393
|
+
${multiple ? html`<span id="group-label" class="label">${label}</span>` : html`<label for="input-base" class="label">${label}</label>`}
|
|
394
|
+
<div class="outputs">
|
|
395
|
+
${inputs.map((type, index) => html`<output
|
|
396
|
+
class="output"
|
|
397
|
+
for="input-${type}"
|
|
398
|
+
value=${this.formatValue(valueAsArray[index])}
|
|
399
|
+
></output>`)}
|
|
400
|
+
</div>
|
|
401
|
+
<div class="inputs">
|
|
402
|
+
${inputs.map((type, index) => html`
|
|
403
|
+
<input
|
|
404
|
+
@input=${this.handleInput}
|
|
405
|
+
@pointerdown=${multiple && !disabled && index === 0 ? this.handlePointerDown : void 0}
|
|
406
|
+
type="range"
|
|
407
|
+
class="range range--${type}"
|
|
408
|
+
id="input-${type}"
|
|
409
|
+
name=${this.name}
|
|
410
|
+
min=${this.min}
|
|
411
|
+
max=${this.max}
|
|
412
|
+
step=${this.step}
|
|
413
|
+
aria-label=${ifDefined(multiple ? RANGE_LABELS[index] : void 0)}
|
|
414
|
+
?disabled=${disabled}
|
|
415
|
+
.value=${valueAsArray[index].toString()}
|
|
416
|
+
/>
|
|
417
|
+
`)}
|
|
418
|
+
${this.renderTicks()}
|
|
419
|
+
</div>
|
|
420
|
+
</div>
|
|
421
|
+
${this.showRangeLabels ? html`<div class="tick-labels">
|
|
422
|
+
<span class="tick-label tick-label--min"
|
|
423
|
+
>${this.formatValue(this.min)}</span
|
|
424
|
+
>
|
|
425
|
+
<span class="tick-label tick-label--max"
|
|
426
|
+
>${this.formatValue(this.max)}</span
|
|
427
|
+
>
|
|
428
|
+
</div>` : nothing}
|
|
429
|
+
`;
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
__decorate([property({
|
|
433
|
+
converter: defaultValueConverter,
|
|
434
|
+
attribute: "value",
|
|
435
|
+
reflect: true
|
|
436
|
+
})], LeuRange.prototype, "defaultValue", void 0);
|
|
437
|
+
__decorate([property({
|
|
438
|
+
type: Number,
|
|
439
|
+
reflect: true
|
|
440
|
+
})], LeuRange.prototype, "min", void 0);
|
|
441
|
+
__decorate([property({
|
|
442
|
+
type: Number,
|
|
443
|
+
reflect: true
|
|
444
|
+
})], LeuRange.prototype, "max", void 0);
|
|
445
|
+
__decorate([property({
|
|
446
|
+
type: Number,
|
|
447
|
+
reflect: true
|
|
448
|
+
})], LeuRange.prototype, "step", void 0);
|
|
449
|
+
__decorate([property({
|
|
450
|
+
type: String,
|
|
451
|
+
reflect: true
|
|
452
|
+
})], LeuRange.prototype, "name", void 0);
|
|
453
|
+
__decorate([property({
|
|
454
|
+
type: String,
|
|
455
|
+
reflect: true
|
|
456
|
+
})], LeuRange.prototype, "label", void 0);
|
|
457
|
+
__decorate([property({
|
|
458
|
+
type: Boolean,
|
|
459
|
+
reflect: true,
|
|
460
|
+
attribute: "hide-label"
|
|
461
|
+
})], LeuRange.prototype, "hideLabel", void 0);
|
|
462
|
+
__decorate([property({
|
|
463
|
+
type: Boolean,
|
|
464
|
+
reflect: true
|
|
465
|
+
})], LeuRange.prototype, "disabled", void 0);
|
|
466
|
+
__decorate([property({
|
|
467
|
+
type: Boolean,
|
|
468
|
+
reflect: true
|
|
469
|
+
})], LeuRange.prototype, "multiple", void 0);
|
|
470
|
+
__decorate([property({
|
|
471
|
+
type: Boolean,
|
|
472
|
+
reflect: true,
|
|
473
|
+
attribute: "show-ticks"
|
|
474
|
+
})], LeuRange.prototype, "showTicks", void 0);
|
|
475
|
+
__decorate([property({
|
|
476
|
+
type: Boolean,
|
|
477
|
+
reflect: true,
|
|
478
|
+
attribute: "show-range-labels"
|
|
479
|
+
})], LeuRange.prototype, "showRangeLabels", void 0);
|
|
480
|
+
__decorate([property({
|
|
481
|
+
type: String,
|
|
482
|
+
reflect: true
|
|
483
|
+
})], LeuRange.prototype, "prefix", void 0);
|
|
484
|
+
__decorate([property({
|
|
485
|
+
type: String,
|
|
486
|
+
reflect: true
|
|
487
|
+
})], LeuRange.prototype, "suffix", void 0);
|
|
488
|
+
__decorate([property({ attribute: false })], LeuRange.prototype, "valueFormatter", void 0);
|
|
489
|
+
__decorate([property({ attribute: false })], LeuRange.prototype, "value", null);
|
|
490
|
+
__decorate([query("#container")], LeuRange.prototype, "container", void 0);
|
|
491
|
+
__decorate([query("#input-base")], LeuRange.prototype, "inputBase", void 0);
|
|
492
|
+
__decorate([query("#input-ghost")], LeuRange.prototype, "inputGhost", void 0);
|
|
493
|
+
__decorate([query("output[for=input-base]")], LeuRange.prototype, "outputBase", void 0);
|
|
494
|
+
__decorate([query("output[for=input-ghost]")], LeuRange.prototype, "outputGhost", void 0);
|
|
495
|
+
//#endregion
|
|
496
|
+
export { LeuRange as t };
|