@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
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "UI component library of the canton of zurich",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "statistikzh",
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.25.0",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"module": "dist/index.js",
|
|
@@ -24,18 +24,17 @@
|
|
|
24
24
|
"homepage": "https://github.com/statistikzh/leu/",
|
|
25
25
|
"scripts": {
|
|
26
26
|
"analyze": "cem analyze --config custom-elements-manifest.config.js",
|
|
27
|
-
"build": "
|
|
28
|
-
"build:js": "
|
|
29
|
-
"build:types": "tsc -p tsconfig.build.json",
|
|
27
|
+
"build": "npm run build:js && npm run build:css && npm run analyze",
|
|
28
|
+
"build:js": "tsdown",
|
|
30
29
|
"build:css": "postcss src/styles/theme.css -o dist/theme.css && cp dist/theme.css .storybook/static/",
|
|
31
30
|
"watch:css": "nodemon --watch 'src/styles/*' -e css --exec npm run build:css",
|
|
32
31
|
"lint": "npm run lint:eslint && npm run lint:prettier",
|
|
33
|
-
"lint:eslint": "eslint
|
|
32
|
+
"lint:eslint": "eslint .",
|
|
34
33
|
"lint:prettier": "prettier \"**/*.{.ts,js,mjs,md,mdx,html,json}\" --check",
|
|
35
34
|
"lint:stylelint": "stylelint \"**/*.{ts,js,css}\" --ignore-path .gitignore",
|
|
36
35
|
"lint:types": "tsc",
|
|
37
36
|
"format": "npm run format:eslint && npm run format:prettier",
|
|
38
|
-
"format:eslint": "eslint
|
|
37
|
+
"format:eslint": "eslint . --fix",
|
|
39
38
|
"format:prettier": "prettier \"**/*.{ts,js,mjs,md,mdx,html,json}\" --write",
|
|
40
39
|
"test": "web-test-runner --coverage",
|
|
41
40
|
"test:watch": "web-test-runner --watch",
|
|
@@ -45,69 +44,57 @@
|
|
|
45
44
|
"storybook:build": "npm run analyze && npm run build:css && storybook build --output-dir docs"
|
|
46
45
|
},
|
|
47
46
|
"dependencies": {
|
|
48
|
-
"@floating-ui/dom": "^1.6
|
|
49
|
-
"lit": "^3.
|
|
47
|
+
"@floating-ui/dom": "^1.7.6",
|
|
48
|
+
"lit": "^3.3.2"
|
|
50
49
|
},
|
|
51
50
|
"devDependencies": {
|
|
52
|
-
"@commitlint/cli": "^
|
|
53
|
-
"@commitlint/config-conventional": "^
|
|
54
|
-
"@custom-elements-manifest/analyzer": "^0.
|
|
55
|
-
"@open-wc/eslint-config": "^
|
|
51
|
+
"@commitlint/cli": "^20.4.4",
|
|
52
|
+
"@commitlint/config-conventional": "^20.4.4",
|
|
53
|
+
"@custom-elements-manifest/analyzer": "^0.11.0",
|
|
54
|
+
"@open-wc/eslint-config": "^13.0.0",
|
|
56
55
|
"@open-wc/testing": "^4.0.0",
|
|
57
|
-
"@rollup/plugin-commonjs": "^28.0.2",
|
|
58
56
|
"@rollup/plugin-json": "^6.1.0",
|
|
59
|
-
"@rollup/plugin-replace": "^6.0.
|
|
60
|
-
"@storybook/addon-a11y": "^
|
|
61
|
-
"@storybook/addon-
|
|
62
|
-
"@storybook/addon-
|
|
63
|
-
"@storybook/
|
|
64
|
-
"@
|
|
65
|
-
"@storybook/core-events": "^8.5.8",
|
|
66
|
-
"@storybook/manager-api": "^8.5.8",
|
|
67
|
-
"@storybook/theming": "^8.5.8",
|
|
68
|
-
"@storybook/web-components": "^8.5.8",
|
|
57
|
+
"@rollup/plugin-replace": "^6.0.3",
|
|
58
|
+
"@storybook/addon-a11y": "^10.2.19",
|
|
59
|
+
"@storybook/addon-designs": "^11.1.2",
|
|
60
|
+
"@storybook/addon-docs": "^10.2.19",
|
|
61
|
+
"@storybook/web-components-vite": "^10.2.19",
|
|
62
|
+
"@tsdown/css": "^0.21.3",
|
|
69
63
|
"@types/mocha": "^10.0.10",
|
|
70
|
-
"@
|
|
71
|
-
"@typescript-eslint/parser": "^8.34.0",
|
|
72
|
-
"@web/dev-server": "^0.4.6",
|
|
73
|
-
"@web/dev-server-esbuild": "^1.0.4",
|
|
64
|
+
"@web/dev-server-esbuild": "^1.0.5",
|
|
74
65
|
"@web/dev-server-rollup": "^0.6.4",
|
|
75
|
-
"@web/
|
|
76
|
-
"@web/storybook-framework-web-components": "^0.2.0",
|
|
77
|
-
"@web/test-runner": "^0.20.0",
|
|
66
|
+
"@web/test-runner": "^0.20.2",
|
|
78
67
|
"@web/test-runner-commands": "^0.9.0",
|
|
79
|
-
"@web/test-runner-playwright": "^0.11.
|
|
80
|
-
"@whitespace/storybook-addon-html": "^
|
|
68
|
+
"@web/test-runner-playwright": "^0.11.1",
|
|
69
|
+
"@whitespace/storybook-addon-html": "^9.0.0",
|
|
81
70
|
"arg": "^5.0.2",
|
|
82
71
|
"custom-element-jet-brains-integration": "^1.7.0",
|
|
83
72
|
"custom-element-vs-code-integration": "^1.5.0",
|
|
84
73
|
"custom-element-vuejs-integration": "^1.4.0",
|
|
85
|
-
"eslint": "^
|
|
86
|
-
"eslint-config-prettier": "^10.
|
|
87
|
-
"eslint-plugin-storybook": "^
|
|
88
|
-
"glob": "^
|
|
74
|
+
"eslint": "^9.39.4",
|
|
75
|
+
"eslint-config-prettier": "^10.1.8",
|
|
76
|
+
"eslint-plugin-storybook": "^10.2.19",
|
|
77
|
+
"glob": "^13.0.6",
|
|
78
|
+
"globals": "^17.4.0",
|
|
89
79
|
"husky": "^9.1.7",
|
|
90
|
-
"lint-staged": "^
|
|
91
|
-
"nodemon": "^3.1.
|
|
92
|
-
"postcss": "^8.
|
|
93
|
-
"postcss-cli": "^11.0.
|
|
94
|
-
"postcss-import": "^16.1.
|
|
95
|
-
"postcss-lit": "^1.
|
|
96
|
-
"postcss-preset-env": "^
|
|
97
|
-
"prettier": "^3.
|
|
98
|
-
"react-syntax-highlighter": "^15.6.1",
|
|
99
|
-
"rimraf": "^6.0.1",
|
|
100
|
-
"rollup": "^4.34.8",
|
|
101
|
-
"rollup-plugin-dts": "^6.2.1",
|
|
80
|
+
"lint-staged": "^16.3.3",
|
|
81
|
+
"nodemon": "^3.1.14",
|
|
82
|
+
"postcss": "^8.5.8",
|
|
83
|
+
"postcss-cli": "^11.0.1",
|
|
84
|
+
"postcss-import": "^16.1.1",
|
|
85
|
+
"postcss-lit": "^1.4.1",
|
|
86
|
+
"postcss-preset-env": "^11.2.0",
|
|
87
|
+
"prettier": "^3.8.1",
|
|
102
88
|
"rollup-plugin-postcss": "^4.0.2",
|
|
103
|
-
"rollup-plugin-postcss-lit": "^2.
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"stylelint": "^
|
|
108
|
-
"stylelint-config-
|
|
109
|
-
"
|
|
110
|
-
"typescript": "^5.
|
|
89
|
+
"rollup-plugin-postcss-lit": "^2.2.0",
|
|
90
|
+
"sinon": "^21.0.2",
|
|
91
|
+
"storybook": "^10.2.19",
|
|
92
|
+
"stylelint": "^17.4.0",
|
|
93
|
+
"stylelint-config-recommended": "^18.0.0",
|
|
94
|
+
"stylelint-config-standard": "^40.0.0",
|
|
95
|
+
"tsdown": "^0.21.3",
|
|
96
|
+
"typescript": "^5.9.3",
|
|
97
|
+
"typescript-eslint": "^8.57.0"
|
|
111
98
|
},
|
|
112
99
|
"prettier": {
|
|
113
100
|
"semi": false
|
|
@@ -117,19 +104,15 @@
|
|
|
117
104
|
"stylelint --fix"
|
|
118
105
|
],
|
|
119
106
|
"*.{ts,js,mjs,html}": [
|
|
120
|
-
"eslint --fix",
|
|
107
|
+
"eslint --fix --no-warn-ignored",
|
|
121
108
|
"prettier --write"
|
|
122
109
|
],
|
|
123
110
|
"*.{md,json}": "prettier --write"
|
|
124
111
|
},
|
|
125
|
-
"overrides": {
|
|
126
|
-
"estree-walker": "2.0.2"
|
|
127
|
-
},
|
|
128
112
|
"esm.sh": {
|
|
129
113
|
"bundle": false
|
|
130
114
|
},
|
|
131
115
|
"publishConfig": {
|
|
132
|
-
"access": "public"
|
|
133
|
-
"provenance": false
|
|
116
|
+
"access": "public"
|
|
134
117
|
}
|
|
135
118
|
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { html, nothing } from "lit"
|
|
2
2
|
import { classMap } from "lit/directives/class-map.js"
|
|
3
3
|
import { ifDefined } from "lit/directives/if-defined.js"
|
|
4
|
-
import { property } from "lit/decorators.js"
|
|
4
|
+
import { property, query } from "lit/decorators.js"
|
|
5
5
|
|
|
6
6
|
import { LeuIcon } from "../icon/Icon.js"
|
|
7
7
|
import { LeuElement } from "../../lib/LeuElement.js"
|
|
8
8
|
import { HasSlotController } from "../../lib/hasSlotController.js"
|
|
9
9
|
import { ARIA_CHECKED_ROLES, ARIA_SELECTED_ROLES } from "../../lib/a11y.js"
|
|
10
10
|
|
|
11
|
-
import styles from "./button.css"
|
|
11
|
+
import styles from "./button.css?inline"
|
|
12
|
+
import { FormAssociatedMixin } from "../../lib/mixins/FormAssociatedMixin.js"
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* @tagname leu-button
|
|
@@ -17,7 +18,7 @@ import styles from "./button.css"
|
|
|
17
18
|
* @slot - The label of the button or the icon if no label is set
|
|
18
19
|
* @see https://www.figma.com/file/d6Pv21UVUbnBs3AdcZijHmbN/KTZH-Design-System?type=design&node-id=4-1444&mode=design&t=xu5Vii8jXKKCKDez-0
|
|
19
20
|
*/
|
|
20
|
-
export class LeuButton extends LeuElement {
|
|
21
|
+
export class LeuButton extends FormAssociatedMixin(LeuElement) {
|
|
21
22
|
static dependencies = {
|
|
22
23
|
"leu-icon": LeuIcon,
|
|
23
24
|
}
|
|
@@ -109,6 +110,9 @@ export class LeuButton extends LeuElement {
|
|
|
109
110
|
@property({ type: Boolean, reflect: true })
|
|
110
111
|
fluid: boolean = false
|
|
111
112
|
|
|
113
|
+
@query(".button")
|
|
114
|
+
private button!: HTMLButtonElement
|
|
115
|
+
|
|
112
116
|
private renderExpandingIcon() {
|
|
113
117
|
if (typeof this.expanded !== "undefined" && this.variant === "ghost") {
|
|
114
118
|
return html`<div class="icon-expanded">
|
|
@@ -157,6 +161,59 @@ export class LeuButton extends LeuElement {
|
|
|
157
161
|
)
|
|
158
162
|
}
|
|
159
163
|
|
|
164
|
+
// The form value is set at the very moment the button is clicked.
|
|
165
|
+
/* eslint-disable-next-line class-methods-use-this */
|
|
166
|
+
setFormValue() {}
|
|
167
|
+
|
|
168
|
+
protected handleClick(e: PointerEvent) {
|
|
169
|
+
if (this.disabled) {
|
|
170
|
+
e.preventDefault()
|
|
171
|
+
e.stopImmediatePropagation()
|
|
172
|
+
return
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const form = this.internals.form
|
|
176
|
+
|
|
177
|
+
if (this.type === "button" || !form) {
|
|
178
|
+
return
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (this.type === "reset") {
|
|
182
|
+
form.reset()
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Form associated custom elements don't trigger form submission when they have `type="submit"`.
|
|
187
|
+
* They also can't be passed as the submitter to `form.requestSubmit()`.
|
|
188
|
+
* To work around this, we create a temporary hidden button, trigger the submission through it and remove it afterwards.
|
|
189
|
+
* Hopefully we can move away from this workaround in the future.
|
|
190
|
+
*/
|
|
191
|
+
if (this.type === "submit") {
|
|
192
|
+
const proxyButton = document.createElement("button")
|
|
193
|
+
Object.assign(proxyButton, {
|
|
194
|
+
type: "submit",
|
|
195
|
+
name: this.name,
|
|
196
|
+
value: this.getAttribute("value") ?? "",
|
|
197
|
+
})
|
|
198
|
+
|
|
199
|
+
form.appendChild(proxyButton)
|
|
200
|
+
form.requestSubmit(proxyButton)
|
|
201
|
+
form.removeChild(proxyButton)
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
click() {
|
|
206
|
+
this.button.click()
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
focus(options?: FocusOptions) {
|
|
210
|
+
this.button.focus(options)
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
blur() {
|
|
214
|
+
this.button.blur()
|
|
215
|
+
}
|
|
216
|
+
|
|
160
217
|
render() {
|
|
161
218
|
const hasTextContent = this.hasTextContent()
|
|
162
219
|
const hasIconDefault = Boolean(this.querySelector("leu-icon"))
|
|
@@ -165,6 +222,7 @@ export class LeuButton extends LeuElement {
|
|
|
165
222
|
const aria = this.getAriaAttributes()
|
|
166
223
|
|
|
167
224
|
const cssClasses = {
|
|
225
|
+
button: true,
|
|
168
226
|
"icon-only": hasIconDefault && !hasTextContent,
|
|
169
227
|
"icon-before": hasIconBefore,
|
|
170
228
|
"icon-after": hasIconAfter,
|
|
@@ -176,6 +234,7 @@ export class LeuButton extends LeuElement {
|
|
|
176
234
|
}
|
|
177
235
|
return html`
|
|
178
236
|
<button
|
|
237
|
+
@click=${this.handleClick}
|
|
179
238
|
aria-label=${ifDefined(aria.label)}
|
|
180
239
|
aria-selected=${ifDefined(aria.selected)}
|
|
181
240
|
aria-checked=${ifDefined(aria.checked)}
|
|
@@ -2,10 +2,11 @@ import { html } from "lit"
|
|
|
2
2
|
import { fixture, expect, elementUpdated, oneEvent } from "@open-wc/testing"
|
|
3
3
|
|
|
4
4
|
import "../leu-button.js"
|
|
5
|
+
import type { LeuButton } from "../leu-button.js"
|
|
5
6
|
import "../../icon/leu-icon.js"
|
|
6
7
|
|
|
7
8
|
async function defaultFixture() {
|
|
8
|
-
return fixture(html` <leu-button>button</leu-button>`)
|
|
9
|
+
return fixture<LeuButton>(html` <leu-button>button</leu-button>`)
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
describe("LeuButton", () => {
|
|
@@ -51,7 +52,7 @@ describe("LeuButton", () => {
|
|
|
51
52
|
it("renders the icon slots at the correct position", async () => {
|
|
52
53
|
const el = await fixture(
|
|
53
54
|
html` <leu-button
|
|
54
|
-
><leu-icon name="
|
|
55
|
+
><leu-icon name="addNew" slot="before"></leu-icon>Sichern</leu-button
|
|
55
56
|
>`,
|
|
56
57
|
)
|
|
57
58
|
|
|
@@ -64,7 +65,7 @@ describe("LeuButton", () => {
|
|
|
64
65
|
})
|
|
65
66
|
|
|
66
67
|
it("renders the expanded icon only when the variant is ghost", async () => {
|
|
67
|
-
const el = await fixture(
|
|
68
|
+
const el = await fixture<LeuButton>(
|
|
68
69
|
html` <leu-button variant="ghost" expanded="true"
|
|
69
70
|
><leu-icon name="addNew" slot="before"></leu-icon>Sichern</leu-button
|
|
70
71
|
>`,
|
|
@@ -88,7 +89,7 @@ describe("LeuButton", () => {
|
|
|
88
89
|
})
|
|
89
90
|
|
|
90
91
|
it("sets the dissabled attrbiute", async () => {
|
|
91
|
-
const el = await fixture(
|
|
92
|
+
const el = await fixture<LeuButton>(
|
|
92
93
|
html` <leu-button variant="ghost" expanded="true" disabled>
|
|
93
94
|
<leu-icon name="addNew" slot="before"></leu-icon>
|
|
94
95
|
Sichern
|
|
@@ -106,7 +107,7 @@ describe("LeuButton", () => {
|
|
|
106
107
|
})
|
|
107
108
|
|
|
108
109
|
it("reflects the role attribute", async () => {
|
|
109
|
-
const el = await fixture(
|
|
110
|
+
const el = await fixture<LeuButton>(
|
|
110
111
|
html` <leu-button variant="ghost" componentRole="menuitemradio"
|
|
111
112
|
><leu-icon name="addNew" slot="before"></leu-icon>Sichern</leu-button
|
|
112
113
|
>`,
|
|
@@ -118,7 +119,7 @@ describe("LeuButton", () => {
|
|
|
118
119
|
})
|
|
119
120
|
|
|
120
121
|
it("sets the either checked or selected attribute depending on the role", async () => {
|
|
121
|
-
const el = await fixture(
|
|
122
|
+
const el = await fixture<LeuButton>(
|
|
122
123
|
html` <leu-button variant="ghost" componentRole="menuitemradio" active
|
|
123
124
|
><leu-icon name="addNew" slot="before"></leu-icon>Sichern</leu-button
|
|
124
125
|
>`,
|
|
@@ -154,7 +155,7 @@ describe("LeuButton", () => {
|
|
|
154
155
|
})
|
|
155
156
|
|
|
156
157
|
it("dispatches the click event", async () => {
|
|
157
|
-
const el = await fixture(html` <leu-button>Sichern</leu-button>`)
|
|
158
|
+
const el = await fixture<LeuButton>(html` <leu-button>Sichern</leu-button>`)
|
|
158
159
|
const button = el.shadowRoot.querySelector("button")
|
|
159
160
|
|
|
160
161
|
setTimeout(() => button.click())
|
|
@@ -163,4 +164,181 @@ describe("LeuButton", () => {
|
|
|
163
164
|
|
|
164
165
|
expect(event).to.exist
|
|
165
166
|
})
|
|
167
|
+
|
|
168
|
+
describe("form association", () => {
|
|
169
|
+
it("submits the form when type is submit", async () => {
|
|
170
|
+
const form = await fixture<HTMLFormElement>(html`
|
|
171
|
+
<form @submit=${(e: Event) => e.preventDefault()}>
|
|
172
|
+
<leu-button type="submit">Submit</leu-button>
|
|
173
|
+
</form>
|
|
174
|
+
`)
|
|
175
|
+
|
|
176
|
+
const button = form.querySelector<LeuButton>("leu-button")
|
|
177
|
+
|
|
178
|
+
setTimeout(() => button.click())
|
|
179
|
+
const event = await oneEvent(form, "submit")
|
|
180
|
+
|
|
181
|
+
expect(event).to.exist
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
it("submits the form with the button name and value", async () => {
|
|
185
|
+
let submittedData: FormData | null = null
|
|
186
|
+
|
|
187
|
+
const form = await fixture<HTMLFormElement>(html`
|
|
188
|
+
<form
|
|
189
|
+
@submit=${(e: SubmitEvent) => {
|
|
190
|
+
e.preventDefault()
|
|
191
|
+
submittedData = new FormData(form, e.submitter)
|
|
192
|
+
}}
|
|
193
|
+
>
|
|
194
|
+
<input type="text" name="field" value="test" />
|
|
195
|
+
<leu-button type="submit" name="action" value="save">Save</leu-button>
|
|
196
|
+
</form>
|
|
197
|
+
`)
|
|
198
|
+
|
|
199
|
+
const button = form.querySelector<LeuButton>("leu-button")
|
|
200
|
+
|
|
201
|
+
setTimeout(() => button.click())
|
|
202
|
+
await oneEvent(form, "submit")
|
|
203
|
+
|
|
204
|
+
expect(submittedData).to.not.be.null
|
|
205
|
+
expect(submittedData.get("action")).to.equal("save")
|
|
206
|
+
expect(submittedData.get("field")).to.equal("test")
|
|
207
|
+
})
|
|
208
|
+
|
|
209
|
+
it("submits an empty string as value when no value attribute is set", async () => {
|
|
210
|
+
let submittedData: FormData | null = null
|
|
211
|
+
|
|
212
|
+
const form = await fixture<HTMLFormElement>(html`
|
|
213
|
+
<form
|
|
214
|
+
@submit=${(e: SubmitEvent) => {
|
|
215
|
+
e.preventDefault()
|
|
216
|
+
submittedData = new FormData(form, e.submitter)
|
|
217
|
+
}}
|
|
218
|
+
>
|
|
219
|
+
<leu-button type="submit" name="action">Submit</leu-button>
|
|
220
|
+
</form>
|
|
221
|
+
`)
|
|
222
|
+
|
|
223
|
+
const button = form.querySelector<LeuButton>("leu-button")
|
|
224
|
+
|
|
225
|
+
setTimeout(() => button.click())
|
|
226
|
+
await oneEvent(form, "submit")
|
|
227
|
+
|
|
228
|
+
expect(submittedData.get("action")).to.equal("")
|
|
229
|
+
})
|
|
230
|
+
|
|
231
|
+
it("resets the form when type is reset", async () => {
|
|
232
|
+
const form = await fixture<HTMLFormElement>(html`
|
|
233
|
+
<form>
|
|
234
|
+
<input type="text" name="field" value="initial" />
|
|
235
|
+
<leu-button type="reset">Reset</leu-button>
|
|
236
|
+
</form>
|
|
237
|
+
`)
|
|
238
|
+
|
|
239
|
+
const input = form.querySelector<HTMLInputElement>("input")
|
|
240
|
+
input.value = "modified"
|
|
241
|
+
expect(input.value).to.equal("modified")
|
|
242
|
+
|
|
243
|
+
const button = form.querySelector<LeuButton>("leu-button")
|
|
244
|
+
button.click()
|
|
245
|
+
|
|
246
|
+
expect(input.value).to.equal("initial")
|
|
247
|
+
})
|
|
248
|
+
|
|
249
|
+
it("does not submit or reset the form when type is button", async () => {
|
|
250
|
+
let submitted = false
|
|
251
|
+
let reset = false
|
|
252
|
+
|
|
253
|
+
const form = await fixture<HTMLFormElement>(html`
|
|
254
|
+
<form
|
|
255
|
+
@submit=${(e: Event) => {
|
|
256
|
+
e.preventDefault()
|
|
257
|
+
submitted = true
|
|
258
|
+
}}
|
|
259
|
+
@reset=${() => {
|
|
260
|
+
reset = true
|
|
261
|
+
}}
|
|
262
|
+
>
|
|
263
|
+
<leu-button type="button">Click</leu-button>
|
|
264
|
+
</form>
|
|
265
|
+
`)
|
|
266
|
+
|
|
267
|
+
const button = form.querySelector<LeuButton>("leu-button")
|
|
268
|
+
button.click()
|
|
269
|
+
|
|
270
|
+
expect(submitted).to.be.false
|
|
271
|
+
expect(reset).to.be.false
|
|
272
|
+
})
|
|
273
|
+
|
|
274
|
+
it("does not submit or reset when the button is not inside a form", async () => {
|
|
275
|
+
const el = await fixture<LeuButton>(
|
|
276
|
+
html`<leu-button type="submit">Submit</leu-button>`,
|
|
277
|
+
)
|
|
278
|
+
|
|
279
|
+
// Should not throw
|
|
280
|
+
el.click()
|
|
281
|
+
})
|
|
282
|
+
|
|
283
|
+
it("does not submit or reset the form when disabled", async () => {
|
|
284
|
+
let submitted = false
|
|
285
|
+
let reset = false
|
|
286
|
+
|
|
287
|
+
const form = await fixture<HTMLFormElement>(html`
|
|
288
|
+
<form
|
|
289
|
+
@submit=${(e: Event) => {
|
|
290
|
+
e.preventDefault()
|
|
291
|
+
submitted = true
|
|
292
|
+
}}
|
|
293
|
+
@reset=${() => {
|
|
294
|
+
reset = true
|
|
295
|
+
}}
|
|
296
|
+
>
|
|
297
|
+
<leu-button type="submit" disabled>Submit</leu-button>
|
|
298
|
+
<leu-button type="reset" disabled>Reset</leu-button>
|
|
299
|
+
</form>
|
|
300
|
+
`)
|
|
301
|
+
|
|
302
|
+
const submitBtn = form.querySelectorAll<LeuButton>("leu-button")[0]
|
|
303
|
+
const resetBtn = form.querySelectorAll<LeuButton>("leu-button")[1]
|
|
304
|
+
|
|
305
|
+
submitBtn.click()
|
|
306
|
+
resetBtn.click()
|
|
307
|
+
|
|
308
|
+
expect(submitted).to.be.false
|
|
309
|
+
expect(reset).to.be.false
|
|
310
|
+
})
|
|
311
|
+
|
|
312
|
+
it("is form associated", async () => {
|
|
313
|
+
const form = await fixture<HTMLFormElement>(html`
|
|
314
|
+
<form>
|
|
315
|
+
<leu-button type="submit" name="btn">Submit</leu-button>
|
|
316
|
+
</form>
|
|
317
|
+
`)
|
|
318
|
+
|
|
319
|
+
const button = form.querySelector<LeuButton>("leu-button")
|
|
320
|
+
|
|
321
|
+
expect(button.form).to.equal(form)
|
|
322
|
+
})
|
|
323
|
+
|
|
324
|
+
it("responds to formDisabledCallback", async () => {
|
|
325
|
+
const form = await fixture<HTMLFormElement>(html`
|
|
326
|
+
<form>
|
|
327
|
+
<fieldset>
|
|
328
|
+
<leu-button type="submit">Submit</leu-button>
|
|
329
|
+
</fieldset>
|
|
330
|
+
</form>
|
|
331
|
+
`)
|
|
332
|
+
|
|
333
|
+
const fieldset = form.querySelector("fieldset")
|
|
334
|
+
const button = form.querySelector<LeuButton>("leu-button")
|
|
335
|
+
|
|
336
|
+
expect(button.disabled).to.be.false
|
|
337
|
+
|
|
338
|
+
fieldset.disabled = true
|
|
339
|
+
await elementUpdated(button)
|
|
340
|
+
|
|
341
|
+
expect(button.disabled).to.be.true
|
|
342
|
+
})
|
|
343
|
+
})
|
|
166
344
|
})
|
|
@@ -3,7 +3,7 @@ import { html } from "lit"
|
|
|
3
3
|
import { LeuElement } from "../../lib/LeuElement.js"
|
|
4
4
|
import { LeuButton } from "../button/Button.js"
|
|
5
5
|
|
|
6
|
-
import styles from "./button-group.css"
|
|
6
|
+
import styles from "./button-group.css?inline"
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* A radio input-like button group component.
|
|
@@ -34,9 +34,7 @@ export class LeuButtonGroup extends LeuElement {
|
|
|
34
34
|
|
|
35
35
|
set value(newValue) {
|
|
36
36
|
this._items.forEach((item) => {
|
|
37
|
-
/* eslint-disable no-param-reassign */
|
|
38
37
|
item.active = LeuButtonGroup.getButtonValue(item) === newValue
|
|
39
|
-
/* eslint-enable no-param-reassign */
|
|
40
38
|
})
|
|
41
39
|
}
|
|
42
40
|
|
|
@@ -58,7 +56,6 @@ export class LeuButtonGroup extends LeuElement {
|
|
|
58
56
|
let foundActiveButtonBefore = false
|
|
59
57
|
|
|
60
58
|
this._items.forEach((item) => {
|
|
61
|
-
/* eslint-disable no-param-reassign */
|
|
62
59
|
item.addEventListener("click", this._handleButtonClick)
|
|
63
60
|
item.componentRole = "menuitemradio"
|
|
64
61
|
|
|
@@ -71,8 +68,6 @@ export class LeuButtonGroup extends LeuElement {
|
|
|
71
68
|
} else if (item.active) {
|
|
72
69
|
foundActiveButtonBefore = true
|
|
73
70
|
}
|
|
74
|
-
|
|
75
|
-
/* eslint-enable no-param-reassign */
|
|
76
71
|
})
|
|
77
72
|
}
|
|
78
73
|
|
|
@@ -3,7 +3,7 @@ import "../leu-button-group.js"
|
|
|
3
3
|
import "../../button/leu-button.js"
|
|
4
4
|
|
|
5
5
|
// https://stackoverflow.com/questions/72566428/storybook-angular-how-to-dynamically-update-args-from-the-template
|
|
6
|
-
import { UPDATE_STORY_ARGS } from "
|
|
6
|
+
import { UPDATE_STORY_ARGS } from "storybook/internal/core-events"
|
|
7
7
|
function updateStorybookArgss(id, args) {
|
|
8
8
|
const channel = window.__STORYBOOK_ADDONS_CHANNEL__
|
|
9
9
|
channel.emit(UPDATE_STORY_ARGS, {
|
|
@@ -3,7 +3,7 @@ import { property } from "lit/decorators.js"
|
|
|
3
3
|
|
|
4
4
|
import { LeuElement } from "../../lib/LeuElement.js"
|
|
5
5
|
|
|
6
|
-
import styles from "./chart-wrapper.css"
|
|
6
|
+
import styles from "./chart-wrapper.css?inline"
|
|
7
7
|
import { HasSlotController } from "../../lib/hasSlotController.js"
|
|
8
8
|
import { LeuSpinner } from "../spinner/Spinner.js"
|
|
9
9
|
|