@mozaic-ds/web-components 1.0.0-beta.6 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -68
- package/dist/Cross20.js +1 -1
- package/dist/Cross20.js.map +1 -1
- package/dist/Cross24.js +1 -1
- package/dist/Cross24.js.map +1 -1
- package/dist/CrossCircleFilled24.js +1 -1
- package/dist/CrossCircleFilled24.js.map +1 -1
- package/dist/attributes.js +1 -1
- package/dist/attributes.js.map +1 -1
- package/dist/bundle.d.ts +24 -23
- package/dist/bundle.d.ts.map +1 -1
- package/dist/bundle.js +24 -23
- package/dist/components/avatar/Avatar.js +2 -5
- package/dist/components/avatar/Avatar.js.map +1 -1
- package/dist/components/avatar/Avatar.spec.js +17 -0
- package/dist/components/avatar/Avatar.stories.d.ts.map +1 -1
- package/dist/components/avatar/Avatar.stories.js +3 -29
- package/dist/components/avatar/Avatar.svelte +9 -10
- package/dist/components/avatar/Avatar.svelte.d.ts +2 -0
- package/dist/components/avatar/Avatar.svelte.d.ts.map +1 -1
- package/dist/components/avatar/README.md +16 -0
- package/dist/components/breadcrumb/Breadcrumb.js +6 -9
- package/dist/components/breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/components/breadcrumb/Breadcrumb.spec.js +42 -0
- package/dist/components/breadcrumb/Breadcrumb.stories.d.ts.map +1 -1
- package/dist/components/breadcrumb/Breadcrumb.stories.js +6 -35
- package/dist/components/breadcrumb/Breadcrumb.svelte +26 -34
- package/dist/components/breadcrumb/Breadcrumb.svelte.d.ts.map +1 -1
- package/dist/components/breadcrumb/README.md +11 -0
- package/dist/components/button/Button.js +3 -6
- package/dist/components/button/Button.js.map +1 -1
- package/dist/components/button/Button.spec.js +74 -0
- package/dist/components/button/Button.stories.d.ts +9 -13
- package/dist/components/button/Button.stories.d.ts.map +1 -1
- package/dist/components/button/Button.stories.js +46 -146
- package/dist/components/button/Button.svelte +186 -168
- package/dist/components/button/Button.svelte.d.ts +36 -8
- package/dist/components/button/Button.svelte.d.ts.map +1 -1
- package/dist/components/button/README.md +26 -0
- package/dist/components/callout/Callout.js +2 -5
- package/dist/components/callout/Callout.js.map +1 -1
- package/dist/components/callout/Callout.spec.js +33 -0
- package/dist/components/callout/Callout.stories.d.ts.map +1 -1
- package/dist/components/callout/Callout.stories.js +2 -55
- package/dist/components/callout/Callout.svelte +15 -14
- package/dist/components/callout/Callout.svelte.d.ts +4 -0
- package/dist/components/callout/Callout.svelte.d.ts.map +1 -1
- package/dist/components/callout/README.md +20 -0
- package/dist/components/checkbox/Checkbox.js +3 -6
- package/dist/components/checkbox/Checkbox.js.map +1 -1
- package/dist/components/checkbox/Checkbox.spec.js +70 -0
- package/dist/components/checkbox/Checkbox.stories.d.ts +11 -16
- package/dist/components/checkbox/Checkbox.stories.d.ts.map +1 -1
- package/dist/components/checkbox/Checkbox.stories.js +67 -124
- package/dist/components/checkbox/Checkbox.svelte +75 -58
- package/dist/components/checkbox/Checkbox.svelte.d.ts +31 -6
- package/dist/components/checkbox/Checkbox.svelte.d.ts.map +1 -1
- package/dist/components/checkbox/README.md +17 -0
- package/dist/components/checkboxgroup/CheckboxGroup.js +4 -7
- package/dist/components/checkboxgroup/CheckboxGroup.js.map +1 -1
- package/dist/components/checkboxgroup/CheckboxGroup.spec.js +113 -0
- package/dist/components/checkboxgroup/CheckboxGroup.stories.d.ts +5 -13
- package/dist/components/checkboxgroup/CheckboxGroup.stories.d.ts.map +1 -1
- package/dist/components/checkboxgroup/CheckboxGroup.stories.js +56 -140
- package/dist/components/checkboxgroup/CheckboxGroup.svelte +89 -81
- package/dist/components/checkboxgroup/CheckboxGroup.svelte.d.ts +30 -6
- package/dist/components/checkboxgroup/CheckboxGroup.svelte.d.ts.map +1 -1
- package/dist/components/checkboxgroup/README.md +14 -0
- package/dist/components/circularprogressbar/CircularProgressbar.js +4 -7
- package/dist/components/circularprogressbar/CircularProgressbar.js.map +1 -1
- package/dist/components/circularprogressbar/CircularProgressbar.spec.js +74 -0
- package/dist/components/circularprogressbar/CircularProgressbar.stories.d.ts +6 -6
- package/dist/components/circularprogressbar/CircularProgressbar.stories.d.ts.map +1 -1
- package/dist/components/circularprogressbar/CircularProgressbar.stories.js +29 -68
- package/dist/components/circularprogressbar/CircularProgressbar.svelte +46 -30
- package/dist/components/circularprogressbar/CircularProgressbar.svelte.d.ts +18 -0
- package/dist/components/circularprogressbar/CircularProgressbar.svelte.d.ts.map +1 -1
- package/dist/components/circularprogressbar/README.md +14 -0
- package/dist/components/datepicker/Datepicker.js +3 -6
- package/dist/components/datepicker/Datepicker.js.map +1 -1
- package/dist/components/datepicker/Datepicker.spec.js +95 -0
- package/dist/components/datepicker/Datepicker.stories.d.ts +7 -6
- package/dist/components/datepicker/Datepicker.stories.d.ts.map +1 -1
- package/dist/components/datepicker/Datepicker.stories.js +58 -75
- package/dist/components/datepicker/Datepicker.svelte +103 -79
- package/dist/components/datepicker/Datepicker.svelte.d.ts +30 -1
- package/dist/components/datepicker/Datepicker.svelte.d.ts.map +1 -1
- package/dist/components/datepicker/README.md +18 -0
- package/dist/components/drawer/Drawer.js +12 -15
- package/dist/components/drawer/Drawer.js.map +1 -1
- package/dist/components/drawer/Drawer.spec.js +101 -0
- package/dist/components/drawer/Drawer.stories.d.ts +29 -8
- package/dist/components/drawer/Drawer.stories.d.ts.map +1 -1
- package/dist/components/drawer/Drawer.stories.js +86 -87
- package/dist/components/drawer/Drawer.svelte +185 -161
- package/dist/components/drawer/Drawer.svelte.d.ts +26 -3
- package/dist/components/drawer/Drawer.svelte.d.ts.map +1 -1
- package/dist/components/drawer/README.md +29 -0
- package/dist/components/field/Field.js +3 -6
- package/dist/components/field/Field.js.map +1 -1
- package/dist/components/field/Field.spec.js +51 -0
- package/dist/components/field/Field.stories.d.ts +9 -15
- package/dist/components/field/Field.stories.d.ts.map +1 -1
- package/dist/components/field/Field.stories.js +86 -142
- package/dist/components/field/Field.svelte +63 -30
- package/dist/components/field/Field.svelte.d.ts +38 -7
- package/dist/components/field/Field.svelte.d.ts.map +1 -1
- package/dist/components/field/README.md +24 -0
- package/dist/components/flag/Flag.js +2 -5
- package/dist/components/flag/Flag.js.map +1 -1
- package/dist/components/flag/Flag.spec.js +30 -0
- package/dist/components/flag/Flag.stories.d.ts +8 -18
- package/dist/components/flag/Flag.stories.d.ts.map +1 -1
- package/dist/components/flag/Flag.stories.js +28 -106
- package/dist/components/flag/Flag.svelte +23 -24
- package/dist/components/flag/Flag.svelte.d.ts +10 -28
- package/dist/components/flag/Flag.svelte.d.ts.map +1 -1
- package/dist/components/flag/README.md +11 -0
- package/dist/components/iconbutton/IconButton.js +2 -5
- package/dist/components/iconbutton/IconButton.js.map +1 -1
- package/dist/components/iconbutton/IconButton.stories.d.ts +11 -11
- package/dist/components/iconbutton/IconButton.stories.d.ts.map +1 -1
- package/dist/components/iconbutton/IconButton.stories.js +51 -67
- package/dist/components/iconbutton/IconButton.svelte +157 -152
- package/dist/components/iconbutton/IconButton.svelte.d.ts +28 -7
- package/dist/components/iconbutton/IconButton.svelte.d.ts.map +1 -1
- package/dist/components/iconbutton/README.md +21 -0
- package/dist/components/linearprogressbarbuffer/LinearProgressbarBuffer.js +2 -5
- package/dist/components/linearprogressbarbuffer/LinearProgressbarBuffer.js.map +1 -1
- package/dist/components/linearprogressbarbuffer/LinearProgressbarBuffer.spec.js +28 -0
- package/dist/components/linearprogressbarbuffer/LinearProgressbarBuffer.stories.d.ts +5 -7
- package/dist/components/linearprogressbarbuffer/LinearProgressbarBuffer.stories.d.ts.map +1 -1
- package/dist/components/linearprogressbarbuffer/LinearProgressbarBuffer.stories.js +18 -49
- package/dist/components/linearprogressbarbuffer/LinearProgressbarBuffer.svelte +19 -12
- package/dist/components/linearprogressbarbuffer/LinearProgressbarBuffer.svelte.d.ts +10 -1
- package/dist/components/linearprogressbarbuffer/LinearProgressbarBuffer.svelte.d.ts.map +1 -1
- package/dist/components/linearprogressbarbuffer/README.md +11 -0
- package/dist/components/linearprogressbarpercentage/LinearProgressbarPercentage.js +2 -5
- package/dist/components/linearprogressbarpercentage/LinearProgressbarPercentage.js.map +1 -1
- package/dist/components/linearprogressbarpercentage/LinearProgressbarPercentage.spec.js +26 -0
- package/dist/components/linearprogressbarpercentage/LinearProgressbarPercentage.stories.d.ts +4 -5
- package/dist/components/linearprogressbarpercentage/LinearProgressbarPercentage.stories.d.ts.map +1 -1
- package/dist/components/linearprogressbarpercentage/LinearProgressbarPercentage.stories.js +15 -33
- package/dist/components/linearprogressbarpercentage/LinearProgressbarPercentage.svelte +19 -16
- package/dist/components/linearprogressbarpercentage/LinearProgressbarPercentage.svelte.d.ts +6 -0
- package/dist/components/linearprogressbarpercentage/LinearProgressbarPercentage.svelte.d.ts.map +1 -1
- package/dist/components/linearprogressbarpercentage/README.md +10 -0
- package/dist/components/link/Link.js +2 -5
- package/dist/components/link/Link.js.map +1 -1
- package/dist/components/link/Link.spec.js +51 -0
- package/dist/components/link/Link.stories.d.ts +12 -12
- package/dist/components/link/Link.stories.d.ts.map +1 -1
- package/dist/components/link/Link.stories.js +61 -74
- package/dist/components/link/Link.svelte +54 -52
- package/dist/components/link/Link.svelte.d.ts +29 -8
- package/dist/components/link/Link.svelte.d.ts.map +1 -1
- package/dist/components/link/README.md +23 -0
- package/dist/components/loader/Loader.js +7 -10
- package/dist/components/loader/Loader.js.map +1 -1
- package/dist/components/loader/Loader.spec.js +54 -0
- package/dist/components/loader/Loader.stories.d.ts +8 -10
- package/dist/components/loader/Loader.stories.d.ts.map +1 -1
- package/dist/components/loader/Loader.stories.js +27 -43
- package/dist/components/loader/Loader.svelte +42 -43
- package/dist/components/loader/Loader.svelte.d.ts +14 -3
- package/dist/components/loader/Loader.svelte.d.ts.map +1 -1
- package/dist/components/loader/README.md +12 -0
- package/dist/components/loadingoverlay/LoadingOverlay.js +4 -0
- package/dist/components/loadingoverlay/LoadingOverlay.js.map +1 -0
- package/dist/components/loadingoverlay/LoadingOverlay.spec.js +38 -0
- package/dist/components/loadingoverlay/LoadingOverlay.stories.d.ts +7 -0
- package/dist/components/loadingoverlay/LoadingOverlay.stories.d.ts.map +1 -0
- package/dist/components/loadingoverlay/LoadingOverlay.stories.js +39 -0
- package/dist/components/loadingoverlay/LoadingOverlay.svelte +50 -0
- package/dist/components/loadingoverlay/LoadingOverlay.svelte.d.ts +17 -0
- package/dist/components/loadingoverlay/LoadingOverlay.svelte.d.ts.map +1 -0
- package/dist/components/loadingoverlay/README.md +11 -0
- package/dist/components/modal/Modal.js +14 -17
- package/dist/components/modal/Modal.js.map +1 -1
- package/dist/components/modal/Modal.spec.js +50 -0
- package/dist/components/modal/Modal.stories.d.ts +36 -9
- package/dist/components/modal/Modal.stories.d.ts.map +1 -1
- package/dist/components/modal/Modal.stories.js +54 -83
- package/dist/components/modal/Modal.svelte +167 -166
- package/dist/components/modal/Modal.svelte.d.ts +22 -5
- package/dist/components/modal/Modal.svelte.d.ts.map +1 -1
- package/dist/components/modal/README.md +28 -0
- package/dist/components/numberbadge/NumberBadge.js +2 -5
- package/dist/components/numberbadge/NumberBadge.js.map +1 -1
- package/dist/components/numberbadge/NumberBadge.spec.js +28 -0
- package/dist/components/numberbadge/NumberBadge.stories.d.ts +9 -13
- package/dist/components/numberbadge/NumberBadge.stories.d.ts.map +1 -1
- package/dist/components/numberbadge/NumberBadge.stories.js +28 -56
- package/dist/components/numberbadge/NumberBadge.svelte +36 -35
- package/dist/components/numberbadge/NumberBadge.svelte.d.ts +15 -4
- package/dist/components/numberbadge/NumberBadge.svelte.d.ts.map +1 -1
- package/dist/components/numberbadge/README.md +12 -0
- package/dist/components/overlay/Overlay.js +2 -5
- package/dist/components/overlay/Overlay.js.map +1 -1
- package/dist/components/overlay/Overlay.spec.js +29 -0
- package/dist/components/overlay/Overlay.stories.d.ts +5 -7
- package/dist/components/overlay/Overlay.stories.d.ts.map +1 -1
- package/dist/components/overlay/Overlay.stories.js +32 -40
- package/dist/components/overlay/Overlay.svelte +21 -12
- package/dist/components/overlay/Overlay.svelte.d.ts +11 -0
- package/dist/components/overlay/Overlay.svelte.d.ts.map +1 -1
- package/dist/components/overlay/README.md +17 -0
- package/dist/components/pagination/Pagination.js +8 -11
- package/dist/components/pagination/Pagination.js.map +1 -1
- package/dist/components/pagination/Pagination.spec.js +65 -0
- package/dist/components/pagination/Pagination.stories.d.ts +8 -11
- package/dist/components/pagination/Pagination.stories.d.ts.map +1 -1
- package/dist/components/pagination/Pagination.stories.js +37 -91
- package/dist/components/pagination/Pagination.svelte +53 -35
- package/dist/components/pagination/Pagination.svelte.d.ts +27 -4
- package/dist/components/pagination/Pagination.svelte.d.ts.map +1 -1
- package/dist/components/pagination/README.md +16 -0
- package/dist/components/passwordinput/PasswordInput.js +4 -9
- package/dist/components/passwordinput/PasswordInput.js.map +1 -1
- package/dist/components/passwordinput/PasswordInput.spec.js +84 -0
- package/dist/components/passwordinput/PasswordInput.stories.d.ts +10 -13
- package/dist/components/passwordinput/PasswordInput.stories.d.ts.map +1 -1
- package/dist/components/passwordinput/PasswordInput.stories.js +67 -124
- package/dist/components/passwordinput/PasswordInput.svelte +424 -60
- package/dist/components/passwordinput/PasswordInput.svelte.d.ts +34 -2
- package/dist/components/passwordinput/PasswordInput.svelte.d.ts.map +1 -1
- package/dist/components/passwordinput/README.md +19 -0
- package/dist/components/pincode/Pincode.js +4 -7
- package/dist/components/pincode/Pincode.js.map +1 -1
- package/dist/components/pincode/Pincode.spec.js +99 -0
- package/dist/components/pincode/Pincode.stories.d.ts +9 -13
- package/dist/components/pincode/Pincode.stories.d.ts.map +1 -1
- package/dist/components/pincode/Pincode.stories.js +62 -127
- package/dist/components/pincode/Pincode.svelte +72 -60
- package/dist/components/pincode/Pincode.svelte.d.ts +30 -24
- package/dist/components/pincode/Pincode.svelte.d.ts.map +1 -1
- package/dist/components/pincode/README.md +22 -0
- package/dist/components/quantityselector/QuantitySelector.js +3 -7
- package/dist/components/quantityselector/QuantitySelector.js.map +1 -1
- package/dist/components/quantityselector/QuantitySelector.spec.js +104 -0
- package/dist/components/quantityselector/QuantitySelector.stories.d.ts +11 -15
- package/dist/components/quantityselector/QuantitySelector.stories.d.ts.map +1 -1
- package/dist/components/quantityselector/QuantitySelector.stories.js +77 -145
- package/dist/components/quantityselector/QuantitySelector.svelte +136 -112
- package/dist/components/quantityselector/QuantitySelector.svelte.d.ts +49 -17
- package/dist/components/quantityselector/QuantitySelector.svelte.d.ts.map +1 -1
- package/dist/components/quantityselector/README.md +21 -0
- package/dist/components/radio/README.md +15 -0
- package/dist/components/radio/Radio.js +2 -5
- package/dist/components/radio/Radio.js.map +1 -1
- package/dist/components/radio/Radio.spec.js +60 -0
- package/dist/components/radio/Radio.stories.d.ts +9 -13
- package/dist/components/radio/Radio.stories.d.ts.map +1 -1
- package/dist/components/radio/Radio.stories.js +54 -70
- package/dist/components/radio/Radio.svelte +58 -39
- package/dist/components/radio/Radio.svelte.d.ts +27 -5
- package/dist/components/radio/Radio.svelte.d.ts.map +1 -1
- package/dist/components/radiogroup/README.md +14 -0
- package/dist/components/radiogroup/RadioGroup.js +4 -7
- package/dist/components/radiogroup/RadioGroup.js.map +1 -1
- package/dist/components/radiogroup/RadioGroup.spec.js +65 -0
- package/dist/components/radiogroup/RadioGroup.stories.d.ts +5 -12
- package/dist/components/radiogroup/RadioGroup.stories.d.ts.map +1 -1
- package/dist/components/radiogroup/RadioGroup.stories.js +56 -151
- package/dist/components/radiogroup/RadioGroup.svelte +81 -77
- package/dist/components/radiogroup/RadioGroup.svelte.d.ts +28 -9
- package/dist/components/radiogroup/RadioGroup.svelte.d.ts.map +1 -1
- package/dist/components/select/README.md +18 -0
- package/dist/components/select/Select.js +3 -6
- package/dist/components/select/Select.js.map +1 -1
- package/dist/components/select/Select.spec.js +76 -0
- package/dist/components/select/Select.stories.d.ts +10 -14
- package/dist/components/select/Select.stories.d.ts.map +1 -1
- package/dist/components/select/Select.stories.js +87 -92
- package/dist/components/select/Select.svelte +77 -67
- package/dist/components/select/Select.svelte.d.ts +41 -10
- package/dist/components/select/Select.svelte.d.ts.map +1 -1
- package/dist/components/statusbadge/README.md +11 -0
- package/dist/components/statusbadge/StatusBadge.js +2 -5
- package/dist/components/statusbadge/StatusBadge.js.map +1 -1
- package/dist/components/statusbadge/StatusBadge.spec.js +31 -0
- package/dist/components/statusbadge/StatusBadge.stories.d.ts +9 -12
- package/dist/components/statusbadge/StatusBadge.stories.d.ts.map +1 -1
- package/dist/components/statusbadge/StatusBadge.stories.js +21 -44
- package/dist/components/statusbadge/StatusBadge.svelte +34 -29
- package/dist/components/statusbadge/StatusBadge.svelte.d.ts +13 -28
- package/dist/components/statusbadge/StatusBadge.svelte.d.ts.map +1 -1
- package/dist/components/statusdot/README.md +11 -0
- package/dist/components/statusdot/StatusDot.js +2 -5
- package/dist/components/statusdot/StatusDot.js.map +1 -1
- package/dist/components/statusdot/StatusDot.spec.js +42 -0
- package/dist/components/statusdot/StatusDot.stories.d.ts.map +1 -1
- package/dist/components/statusdot/StatusDot.stories.js +9 -37
- package/dist/components/statusdot/StatusDot.svelte +15 -16
- package/dist/components/statusdot/StatusDot.svelte.d.ts +2 -2
- package/dist/components/statusdot/StatusDot.svelte.d.ts.map +1 -1
- package/dist/components/statusnotification/README.md +25 -0
- package/dist/components/statusnotification/StatusNotification.js +3 -6
- package/dist/components/statusnotification/StatusNotification.js.map +1 -1
- package/dist/components/statusnotification/StatusNotification.spec.js +54 -0
- package/dist/components/statusnotification/StatusNotification.stories.d.ts +16 -14
- package/dist/components/statusnotification/StatusNotification.stories.d.ts.map +1 -1
- package/dist/components/statusnotification/StatusNotification.stories.js +53 -86
- package/dist/components/statusnotification/StatusNotification.svelte +186 -187
- package/dist/components/statusnotification/StatusNotification.svelte.d.ts +21 -18
- package/dist/components/statusnotification/StatusNotification.svelte.d.ts.map +1 -1
- package/dist/components/tab/README.md +20 -0
- package/dist/components/tab/Tab.js +4 -0
- package/dist/components/tab/Tab.js.map +1 -0
- package/dist/components/tab/Tab.spec.js +58 -0
- package/dist/components/tab/Tab.svelte +154 -0
- package/dist/components/{tabs → tab}/Tab.svelte.d.ts +20 -3
- package/dist/components/tab/Tab.svelte.d.ts.map +1 -0
- package/dist/components/tabs/README.md +18 -0
- package/dist/components/tabs/Tabs.js +2 -5
- package/dist/components/tabs/Tabs.js.map +1 -1
- package/dist/components/tabs/Tabs.spec.js +51 -0
- package/dist/components/tabs/Tabs.stories.d.ts +9 -6
- package/dist/components/tabs/Tabs.stories.d.ts.map +1 -1
- package/dist/components/tabs/Tabs.stories.js +59 -115
- package/dist/components/tabs/Tabs.svelte +46 -29
- package/dist/components/tabs/Tabs.svelte.d.ts +21 -7
- package/dist/components/tabs/Tabs.svelte.d.ts.map +1 -1
- package/dist/components/tags/README.md +9 -0
- package/dist/components/tags/Tag.js +2 -5
- package/dist/components/tags/Tag.js.map +1 -1
- package/dist/components/tags/Tag.svelte +35 -38
- package/dist/components/tags/TagContextualised.js +2 -5
- package/dist/components/tags/TagContextualised.js.map +1 -1
- package/dist/components/tags/TagContextualised.svelte +35 -38
- package/dist/components/tags/TagInteractive.js +2 -5
- package/dist/components/tags/TagInteractive.js.map +1 -1
- package/dist/components/tags/TagInteractive.svelte +35 -38
- package/dist/components/tags/TagRemovable.js +2 -5
- package/dist/components/tags/TagRemovable.js.map +1 -1
- package/dist/components/tags/TagRemovable.svelte +35 -38
- package/dist/components/tags/TagSelectable.js +2 -5
- package/dist/components/tags/TagSelectable.js.map +1 -1
- package/dist/components/tags/TagSelectable.svelte +35 -38
- package/dist/components/tags/Tags.stories.d.ts.map +1 -1
- package/dist/components/tags/Tags.stories.js +7 -1
- package/dist/components/tags/TagsContextualised.stories.d.ts.map +1 -1
- package/dist/components/tags/TagsContextualised.stories.js +7 -1
- package/dist/components/tags/TagsInteractive.stories.d.ts.map +1 -1
- package/dist/components/tags/TagsInteractive.stories.js +7 -1
- package/dist/components/tags/TagsRemovable.stories.d.ts.map +1 -1
- package/dist/components/tags/TagsRemovable.stories.js +7 -1
- package/dist/components/tags/TagsSelectable.stories.d.ts.map +1 -1
- package/dist/components/tags/TagsSelectable.stories.js +7 -1
- package/dist/components/textarea/README.md +19 -0
- package/dist/components/textarea/Textarea.js +2 -8
- package/dist/components/textarea/Textarea.js.map +1 -1
- package/dist/components/textarea/Textarea.spec.js +67 -0
- package/dist/components/textarea/Textarea.stories.d.ts +9 -13
- package/dist/components/textarea/Textarea.stories.d.ts.map +1 -1
- package/dist/components/textarea/Textarea.stories.js +61 -92
- package/dist/components/textarea/Textarea.svelte +70 -117
- package/dist/components/textarea/Textarea.svelte.d.ts +43 -13
- package/dist/components/textarea/Textarea.svelte.d.ts.map +1 -1
- package/dist/components/textinput/README.md +26 -0
- package/dist/components/textinput/Textinput.js +5 -9
- package/dist/components/textinput/Textinput.js.map +1 -1
- package/dist/components/textinput/Textinput.spec.js +89 -0
- package/dist/components/textinput/Textinput.stories.d.ts +11 -12
- package/dist/components/textinput/Textinput.stories.d.ts.map +1 -1
- package/dist/components/textinput/Textinput.stories.js +78 -137
- package/dist/components/textinput/Textinput.svelte +107 -148
- package/dist/components/textinput/Textinput.svelte.d.ts +46 -22
- package/dist/components/textinput/Textinput.svelte.d.ts.map +1 -1
- package/dist/components/toaster/README.md +28 -0
- package/dist/components/toaster/Toaster.js +5 -8
- package/dist/components/toaster/Toaster.js.map +1 -1
- package/dist/components/toaster/Toaster.spec.js +100 -0
- package/dist/components/toaster/Toaster.stories.d.ts.map +1 -1
- package/dist/components/toaster/Toaster.stories.js +5 -73
- package/dist/components/toaster/Toaster.svelte +157 -146
- package/dist/components/toaster/Toaster.svelte.d.ts +3 -0
- package/dist/components/toaster/Toaster.svelte.d.ts.map +1 -1
- package/dist/components/toggle/README.md +15 -0
- package/dist/components/toggle/Toggle.js +2 -5
- package/dist/components/toggle/Toggle.js.map +1 -1
- package/dist/components/toggle/Toggle.spec.js +69 -0
- package/dist/components/toggle/Toggle.stories.d.ts +9 -14
- package/dist/components/toggle/Toggle.stories.d.ts.map +1 -1
- package/dist/components/toggle/Toggle.stories.js +55 -64
- package/dist/components/toggle/Toggle.svelte +59 -48
- package/dist/components/toggle/Toggle.svelte.d.ts +26 -7
- package/dist/components/toggle/Toggle.svelte.d.ts.map +1 -1
- package/dist/components/togglegroup/README.md +13 -0
- package/dist/components/togglegroup/ToggleGroup.js +3 -6
- package/dist/components/togglegroup/ToggleGroup.js.map +1 -1
- package/dist/components/togglegroup/ToggleGroup.spec.js +50 -0
- package/dist/components/togglegroup/ToggleGroup.stories.d.ts +5 -13
- package/dist/components/togglegroup/ToggleGroup.stories.d.ts.map +1 -1
- package/dist/components/togglegroup/ToggleGroup.stories.js +56 -104
- package/dist/components/togglegroup/ToggleGroup.svelte +91 -97
- package/dist/components/togglegroup/ToggleGroup.svelte.d.ts +25 -14
- package/dist/components/togglegroup/ToggleGroup.svelte.d.ts.map +1 -1
- package/dist/components/tooltip/README.md +19 -0
- package/dist/components/tooltip/Tooltip.js +4 -7
- package/dist/components/tooltip/Tooltip.js.map +1 -1
- package/dist/components/tooltip/Tooltip.spec.js +38 -0
- package/dist/components/tooltip/Tooltip.stories.d.ts +6 -7
- package/dist/components/tooltip/Tooltip.stories.d.ts.map +1 -1
- package/dist/components/tooltip/Tooltip.stories.js +45 -59
- package/dist/components/tooltip/Tooltip.svelte +31 -25
- package/dist/components/tooltip/Tooltip.svelte.d.ts +17 -0
- package/dist/components/tooltip/Tooltip.svelte.d.ts.map +1 -1
- package/dist/custom-element-forward-events.js.map +1 -1
- package/dist/custom-element.js +3 -3
- package/dist/custom-element.js.map +1 -1
- package/dist/documentation/Contributing.mdx +1 -1
- package/dist/documentation/Introduction.mdx +45 -11
- package/dist/documentation/SupportAndOnboarding.mdx +2 -2
- package/dist/each.js +1 -1
- package/dist/each.js.map +1 -1
- package/dist/if.js +1 -1
- package/dist/if.js.map +1 -1
- package/dist/input.js +1 -1
- package/dist/input.js.map +1 -1
- package/dist/legacy.js +1 -1
- package/dist/legacy.js.map +1 -1
- package/dist/main.d.ts +24 -23
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +24 -23
- package/dist/slot.js +1 -1
- package/dist/slot.js.map +1 -1
- package/dist/this.js +2 -0
- package/dist/this.js.map +1 -0
- package/package.json +12 -4
- package/dist/components/button/button.types.d.ts +0 -13
- package/dist/components/button/button.types.d.ts.map +0 -1
- package/dist/components/button/button.types.js +0 -1
- package/dist/components/checkboxgroup/checkboxgroup.types.d.ts +0 -9
- package/dist/components/checkboxgroup/checkboxgroup.types.d.ts.map +0 -1
- package/dist/components/checkboxgroup/checkboxgroup.types.js +0 -1
- package/dist/components/link/link.types.d.ts +0 -4
- package/dist/components/link/link.types.d.ts.map +0 -1
- package/dist/components/link/link.types.js +0 -1
- package/dist/components/loader/loader.types.d.ts +0 -3
- package/dist/components/loader/loader.types.d.ts.map +0 -1
- package/dist/components/loader/loader.types.js +0 -1
- package/dist/components/numberbadge/NumberBadge.types.d.ts +0 -3
- package/dist/components/numberbadge/NumberBadge.types.d.ts.map +0 -1
- package/dist/components/numberbadge/NumberBadge.types.js +0 -1
- package/dist/components/overlayloader/OverlayLoader.js +0 -30
- package/dist/components/overlayloader/OverlayLoader.js.map +0 -1
- package/dist/components/overlayloader/OverlayLoader.stories.d.ts +0 -8
- package/dist/components/overlayloader/OverlayLoader.stories.d.ts.map +0 -1
- package/dist/components/overlayloader/OverlayLoader.stories.js +0 -50
- package/dist/components/overlayloader/OverlayLoader.svelte +0 -159
- package/dist/components/overlayloader/OverlayLoader.svelte.d.ts +0 -9
- package/dist/components/overlayloader/OverlayLoader.svelte.d.ts.map +0 -1
- package/dist/components/quantityselector/quantitySelector.types.d.ts +0 -2
- package/dist/components/quantityselector/quantitySelector.types.d.ts.map +0 -1
- package/dist/components/quantityselector/quantitySelector.types.js +0 -1
- package/dist/components/radiogroup/radioGroup.types.d.ts +0 -9
- package/dist/components/radiogroup/radioGroup.types.d.ts.map +0 -1
- package/dist/components/radiogroup/radioGroup.types.js +0 -1
- package/dist/components/select/select.types.d.ts +0 -9
- package/dist/components/select/select.types.d.ts.map +0 -1
- package/dist/components/select/select.types.js +0 -1
- package/dist/components/statusbadge/StatusBadge.types.d.ts +0 -2
- package/dist/components/statusbadge/StatusBadge.types.d.ts.map +0 -1
- package/dist/components/statusbadge/StatusBadge.types.js +0 -1
- package/dist/components/statusdot/StatusDot.types.d.ts +0 -3
- package/dist/components/statusdot/StatusDot.types.d.ts.map +0 -1
- package/dist/components/statusdot/StatusDot.types.js +0 -1
- package/dist/components/tabs/Tab.js +0 -7
- package/dist/components/tabs/Tab.js.map +0 -1
- package/dist/components/tabs/Tab.svelte +0 -137
- package/dist/components/tabs/Tab.svelte.d.ts.map +0 -1
- package/dist/components/textinput/textinput.types.d.ts +0 -3
- package/dist/components/textinput/textinput.types.d.ts.map +0 -1
- package/dist/components/textinput/textinput.types.js +0 -1
- package/dist/components/toggle/toggle.types.d.ts +0 -2
- package/dist/components/toggle/toggle.types.d.ts.map +0 -1
- package/dist/components/toggle/toggle.types.js +0 -1
- package/dist/index-client.js +0 -2
- package/dist/index-client.js.map +0 -1
- package/dist/snippet.js +0 -2
- package/dist/snippet.js.map +0 -1
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{c as z,p as L,a as M,b as l,f as C,t as p,i as E,j as P,d as f,k as r,s as B,r as v,e as H,g as y,h as j}from"../../custom-element.js";import{i as D}from"../../if.js";import{r as F,s as w}from"../../attributes.js";import{a as S}from"../../input.js";import{c as T}from"../../custom-element-forward-events.js";var Y=C('<span class="mc-toggle__label svelte-26wadt"> </span>'),q=C('<div><label class="mc-toggle__container svelte-26wadt"><input type="checkbox" class="mc-toggle__input svelte-26wadt"/> <!></label></div>');const A={hash:"svelte-26wadt",code:`/**
|
|
2
2
|
* Do not edit directly, this file was auto-generated.
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Do not edit directly, this file was auto-generated.
|
|
6
|
-
*/.mc-toggle.svelte-10phbx3 {width:fit-content;}.mc-toggle__container.svelte-10phbx3 {display:flex;align-items:center;cursor:pointer;gap:0.5rem;position:relative;padding:0.25rem;}.mc-toggle__container.svelte-10phbx3::before, .mc-toggle__container.svelte-10phbx3::after {content:"";}.mc-toggle__container.svelte-10phbx3::before {transition:box-shadow 200ms ease;height:1.5rem;width:2.5rem;background-color:#666666;border-radius:1rem;flex-shrink:0;}.mc-toggle__container.svelte-10phbx3::after {height:1.25rem;width:1.25rem;background-color:#ffffff;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.25rem' width='1.25rem' fill='%23666666' viewBox='0 0 20 20'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M14.697 6.364a.75.75 0 1 0-1.06-1.061L10 8.939 6.364 5.303a.75.75 0 0 0-1.06 1.06L8.94 10l-3.637 3.636a.75.75 0 1 0 1.06 1.06L10 11.062l3.636 3.636a.75.75 0 0 0 1.061-1.06L11.061 10z'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h20v20H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");border-radius:100%;background-position:center;left:0.375rem;position:absolute;top:50%;transform:translateY(-50%);}.mc-toggle__input.svelte-10phbx3 {clip-path:inset(100%);clip:rect(1px, 1px, 1px, 1px);height:1px;overflow:hidden;position:absolute;white-space:nowrap;padding:0;width:1px;}.mc-toggle__label.svelte-10phbx3 {color:#000000;font-size:1rem;font-weight:400;line-height:1.5;}.mc-toggle.svelte-10phbx3:has(:where(.svelte-10phbx3):checked) .mc-toggle__container:where(.svelte-10phbx3)::before {background-color:#117f03;}.mc-toggle.svelte-10phbx3:has(:where(.svelte-10phbx3):checked) .mc-toggle__container:where(.svelte-10phbx3)::after {background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.25rem' width='1.25rem' fill='%23117f03' viewBox='0 0 20 20'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M14.697 6.553a.75.75 0 0 1 0 1.06l-5.833 5.834a.75.75 0 0 1-1.06 0l-2.5-2.5a.75.75 0 0 1 1.06-1.06l1.97 1.97 5.303-5.304a.75.75 0 0 1 1.06 0'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h20v20H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");transform:translate(1rem, -50%);}.mc-toggle.svelte-10phbx3:has(:where(.svelte-10phbx3):disabled) .mc-toggle__container:where(.svelte-10phbx3) {cursor:not-allowed;}.mc-toggle.svelte-10phbx3:has(:where(.svelte-10phbx3):disabled) .mc-toggle__container:where(.svelte-10phbx3)::before {background-color:#d9d9d9;}.mc-toggle.svelte-10phbx3:has(:where(.svelte-10phbx3):disabled) .mc-toggle__container:where(.svelte-10phbx3)::after {background-color:#737373;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.25rem' width='1.25rem' fill='%23d9d9d9' viewBox='0 0 20 20'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M14.697 6.364a.75.75 0 1 0-1.06-1.061L10 8.939 6.364 5.303a.75.75 0 0 0-1.06 1.06L8.94 10l-3.637 3.636a.75.75 0 1 0 1.06 1.06L10 11.062l3.636 3.636a.75.75 0 0 0 1.061-1.06L11.061 10z'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h20v20H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");}.mc-toggle.svelte-10phbx3:has(:where(.svelte-10phbx3):disabled) .mc-toggle__label:where(.svelte-10phbx3) {color:#737373;}.mc-toggle.svelte-10phbx3:has(:where(.svelte-10phbx3):disabled:checked) .mc-toggle__container:where(.svelte-10phbx3)::after {background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.25rem' width='1.25rem' fill='%23d9d9d9' viewBox='0 0 20 20'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M14.697 6.553a.75.75 0 0 1 0 1.06l-5.833 5.834a.75.75 0 0 1-1.06 0l-2.5-2.5a.75.75 0 0 1 1.06-1.06l1.97 1.97 5.303-5.304a.75.75 0 0 1 1.06 0'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h20v20H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");}.mc-toggle.svelte-10phbx3:has(:where(.svelte-10phbx3):focus-visible) .mc-toggle__container:where(.svelte-10phbx3)::before {box-shadow:0 0 0 0.125rem var(--focus-color-mid, #ffffff), 0 0 0 0.25rem var(--focus-color-outer, #000000);outline:0.125rem solid transparent;outline-offset:0.125rem;}.mc-toggle--m.svelte-10phbx3 .mc-toggle__container:where(.svelte-10phbx3)::before {height:2rem;width:3.5rem;}.mc-toggle--m.svelte-10phbx3 .mc-toggle__container:where(.svelte-10phbx3)::after {height:1.5rem;width:1.5rem;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.5rem' width='1.5rem' fill='%23666666' viewBox='0 0 24 24'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M17.707 7.707a1 1 0 0 0-1.414-1.414L12 10.586 7.707 6.293a1 1 0 0 0-1.414 1.414L10.586 12l-4.293 4.293a1 1 0 1 0 1.414 1.414L12 13.414l4.293 4.293a1 1 0 0 0 1.414-1.414L13.414 12z'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h24v24H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");left:0.5rem;}.mc-toggle--m.svelte-10phbx3:has(:where(.svelte-10phbx3):checked) .mc-toggle__container:where(.svelte-10phbx3)::after {background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.5rem' width='1.5rem' fill='%23117f03' viewBox='0 0 24 24'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M17.707 7.793a1 1 0 0 1 0 1.414l-7 7a1 1 0 0 1-1.414 0l-3-3a1 1 0 1 1 1.414-1.414L10 14.086l6.293-6.293a1 1 0 0 1 1.414 0'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h24v24H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");transform:translate(1.5rem, -50%);}.mc-toggle--m.svelte-10phbx3:has(:where(.svelte-10phbx3):disabled) .mc-toggle__container:where(.svelte-10phbx3)::after {background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.5rem' width='1.5rem' fill='%23d9d9d9' viewBox='0 0 24 24'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M17.707 7.707a1 1 0 0 0-1.414-1.414L12 10.586 7.707 6.293a1 1 0 0 0-1.414 1.414L10.586 12l-4.293 4.293a1 1 0 1 0 1.414 1.414L12 13.414l4.293 4.293a1 1 0 0 0 1.414-1.414L13.414 12z'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h24v24H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");}.mc-toggle--m.svelte-10phbx3:has(:where(.svelte-10phbx3):disabled:checked) .mc-toggle__container:where(.svelte-10phbx3)::after {background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.5rem' width='1.5rem' fill='%23d9d9d9' viewBox='0 0 24 24'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M17.707 7.793a1 1 0 0 1 0 1.414l-7 7a1 1 0 0 1-1.414 0l-3-3a1 1 0 1 1 1.414-1.414L10 14.086l6.293-6.293a1 1 0 0 1 1.414 0'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h24v24H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");}.mc-toggle--hide-label.svelte-10phbx3 .mc-toggle__label:where(.svelte-10phbx3) {clip-path:inset(100%);clip:rect(1px, 1px, 1px, 1px);height:1px;overflow:hidden;position:absolute;white-space:nowrap;padding:0;width:1px;}`};function J(v,l){P(l,!0),y(v,I);let h=r(l,"name",7),o=r(l,"checked",15),d=r(l,"disabled",7,!1),n=r(l,"size",7,"m"),s=r(l,"label",7),c=r(l,"onchange",7),p=r(l,"onblur",7);var g=G();let b;var x=m(g),a=m(x);T(a),a.__change=function(...e){var t;(t=c())==null||t.apply(this,e)};var _=j(a,2);{var k=e=>{var t=A(),z=m(t,!0);f(t),u(()=>F(z,s())),w(e,t)};S(_,e=>{s()&&e(k)})}return f(x),f(g),u(e=>{b=B(g,1,"mc-toggle svelte-10phbx3",null,b,e),E(a,"id",h()),E(a,"name",h()),a.disabled=d()},[()=>({"mc-toggle--hide-label":!s(),"mc-toggle--m":n()==="m"})]),H("blur",a,function(...e){var t;(t=p())==null||t.apply(this,e)}),Y(a,o),w(v,g),D({get name(){return h()},set name(e){h(e),i()},get checked(){return o()},set checked(e){o(e),i()},get disabled(){return d()},set disabled(e=!1){d(e),i()},get size(){return n()},set size(e="m"){n(e),i()},get label(){return s()},set label(e){s(e),i()},get onchange(){return c()},set onchange(e){c(e),i()},get onblur(){return p()},set onblur(e){p(e),i()}})}L(["change"]);customElements.define("m-toggle",M(J,{name:{},checked:{},disabled:{},size:{},label:{},onchange:{},onblur:{}},[],[],!0,q));
|
|
3
|
+
*/.mc-toggle.svelte-26wadt {width:fit-content;}.mc-toggle__container.svelte-26wadt {display:flex;align-items:center;cursor:pointer;gap:0.5rem;position:relative;padding:0.25rem;}.mc-toggle__container.svelte-26wadt::before, .mc-toggle__container.svelte-26wadt::after {content:"";}.mc-toggle__container.svelte-26wadt::before {transition:box-shadow 200ms ease;height:1.5rem;width:2.5rem;background-color:var(--forms-color-background-unchecked, #666666);border-radius:var(--radius-l, 1rem);flex-shrink:0;}.mc-toggle__container.svelte-26wadt::after {height:1.25rem;width:1.25rem;background-color:var(--forms-color-icon-inverse, #ffffff);background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.25rem' width='1.25rem' fill='var(--forms-color-background-unchecked, %23666666)' viewBox='0 0 20 20'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M14.697 6.364a.75.75 0 1 0-1.06-1.061L10 8.939 6.364 5.303a.75.75 0 0 0-1.06 1.06L8.94 10l-3.637 3.636a.75.75 0 1 0 1.06 1.06L10 11.062l3.636 3.636a.75.75 0 0 0 1.061-1.06L11.061 10z'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h20v20H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");border-radius:var(--radius-full, 100%);background-position:center;left:0.375rem;position:absolute;top:50%;transform:translateY(-50%);}.mc-toggle__input.svelte-26wadt {clip-path:inset(100%);clip:rect(1px, 1px, 1px, 1px);height:1px;overflow:hidden;position:absolute;white-space:nowrap;padding:0;width:1px;}.mc-toggle__label.svelte-26wadt {color:var(--forms-color-text-default, #000000);font-size:var(--font-size-150, 1rem);font-weight:var(--font-weight-regular, 400);line-height:var(--line-height-m, 1.5);}.mc-toggle.svelte-26wadt:has(:where(.svelte-26wadt):checked) .mc-toggle__container:where(.svelte-26wadt)::before {background-color:var(--forms-color-background-checked, #117f03);}.mc-toggle.svelte-26wadt:has(:where(.svelte-26wadt):checked) .mc-toggle__container:where(.svelte-26wadt)::after {background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.25rem' width='1.25rem' fill='var(--forms-color-background-checked, %23117f03)' viewBox='0 0 20 20'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M14.697 6.553a.75.75 0 0 1 0 1.06l-5.833 5.834a.75.75 0 0 1-1.06 0l-2.5-2.5a.75.75 0 0 1 1.06-1.06l1.97 1.97 5.303-5.304a.75.75 0 0 1 1.06 0'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h20v20H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");transform:translate(1rem, -50%);}.mc-toggle.svelte-26wadt:has(:where(.svelte-26wadt):disabled) .mc-toggle__container:where(.svelte-26wadt) {cursor:not-allowed;}.mc-toggle.svelte-26wadt:has(:where(.svelte-26wadt):disabled) .mc-toggle__container:where(.svelte-26wadt)::before {background-color:var(--forms-color-background-disabled, #d9d9d9);}.mc-toggle.svelte-26wadt:has(:where(.svelte-26wadt):disabled) .mc-toggle__container:where(.svelte-26wadt)::after {background-color:var(--forms-color-icon-disabled, #737373);background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.25rem' width='1.25rem' fill='var(--forms-color-background-disabled, %23d9d9d9)' viewBox='0 0 20 20'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M14.697 6.364a.75.75 0 1 0-1.06-1.061L10 8.939 6.364 5.303a.75.75 0 0 0-1.06 1.06L8.94 10l-3.637 3.636a.75.75 0 1 0 1.06 1.06L10 11.062l3.636 3.636a.75.75 0 0 0 1.061-1.06L11.061 10z'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h20v20H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");}.mc-toggle.svelte-26wadt:has(:where(.svelte-26wadt):disabled) .mc-toggle__label:where(.svelte-26wadt) {color:var(--forms-color-text-disabled, #737373);}.mc-toggle.svelte-26wadt:has(:where(.svelte-26wadt):disabled:checked) .mc-toggle__container:where(.svelte-26wadt)::after {background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.25rem' width='1.25rem' fill='var(--forms-color-background-disabled, %23d9d9d9)' viewBox='0 0 20 20'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M14.697 6.553a.75.75 0 0 1 0 1.06l-5.833 5.834a.75.75 0 0 1-1.06 0l-2.5-2.5a.75.75 0 0 1 1.06-1.06l1.97 1.97 5.303-5.304a.75.75 0 0 1 1.06 0'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h20v20H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");}.mc-toggle.svelte-26wadt:has(:where(.svelte-26wadt):focus-visible) .mc-toggle__container:where(.svelte-26wadt)::before {box-shadow:0 0 0 0.125rem var(--focus-color-mid, var(--focus-color-outline-mid, #ffffff)), 0 0 0 0.25rem var(--focus-color-outer, var(--focus-color-outline-outer, #000000));outline:0.125rem solid transparent;outline-offset:0.125rem;}.mc-toggle--m.svelte-26wadt .mc-toggle__container:where(.svelte-26wadt)::before {height:2rem;width:3.5rem;}.mc-toggle--m.svelte-26wadt .mc-toggle__container:where(.svelte-26wadt)::after {height:1.5rem;width:1.5rem;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.5rem' width='1.5rem' fill='var(--forms-color-background-unchecked, %23666666)' viewBox='0 0 24 24'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M17.707 7.707a1 1 0 0 0-1.414-1.414L12 10.586 7.707 6.293a1 1 0 0 0-1.414 1.414L10.586 12l-4.293 4.293a1 1 0 1 0 1.414 1.414L12 13.414l4.293 4.293a1 1 0 0 0 1.414-1.414L13.414 12z'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h24v24H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");left:0.5rem;}.mc-toggle--m.svelte-26wadt:has(:where(.svelte-26wadt):checked) .mc-toggle__container:where(.svelte-26wadt)::after {background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.5rem' width='1.5rem' fill='var(--forms-color-background-checked, %23117f03)' viewBox='0 0 24 24'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M17.707 7.793a1 1 0 0 1 0 1.414l-7 7a1 1 0 0 1-1.414 0l-3-3a1 1 0 1 1 1.414-1.414L10 14.086l6.293-6.293a1 1 0 0 1 1.414 0'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h24v24H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");transform:translate(1.5rem, -50%);}.mc-toggle--m.svelte-26wadt:has(:where(.svelte-26wadt):disabled) .mc-toggle__container:where(.svelte-26wadt)::after {background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.5rem' width='1.5rem' fill='var(--forms-color-background-disabled, %23d9d9d9)' viewBox='0 0 24 24'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M17.707 7.707a1 1 0 0 0-1.414-1.414L12 10.586 7.707 6.293a1 1 0 0 0-1.414 1.414L10.586 12l-4.293 4.293a1 1 0 1 0 1.414 1.414L12 13.414l4.293 4.293a1 1 0 0 0 1.414-1.414L13.414 12z'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h24v24H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");}.mc-toggle--m.svelte-26wadt:has(:where(.svelte-26wadt):disabled:checked) .mc-toggle__container:where(.svelte-26wadt)::after {background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.5rem' width='1.5rem' fill='var(--forms-color-background-disabled, %23d9d9d9)' viewBox='0 0 24 24'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M17.707 7.793a1 1 0 0 1 0 1.414l-7 7a1 1 0 0 1-1.414 0l-3-3a1 1 0 1 1 1.414-1.414L10 14.086l6.293-6.293a1 1 0 0 1 1.414 0'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h24v24H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");}.mc-toggle--hide-label.svelte-26wadt .mc-toggle__label:where(.svelte-26wadt) {clip-path:inset(100%);clip:rect(1px, 1px, 1px, 1px);height:1px;overflow:hidden;position:absolute;white-space:nowrap;padding:0;width:1px;}`};function G(u,t){L(t,!0),M(u,A);let d=l(t,"id",7),i=l(t,"name",7),o=l(t,"label",7),g=l(t,"checked",15,!1),c=l(t,"disabled",7),h=l(t,"size",7,"s");var b={get id(){return d()},set id(e){d(e),r()},get name(){return i()},set name(e){i(e),r()},get label(){return o()},set label(e){o(e),r()},get checked(){return g()},set checked(e=!1){g(e),r()},get disabled(){return c()},set disabled(e){c(e),r()},get size(){return h()},set size(e="s"){h(e),r()}},s=q(),n=f(s),a=f(n);F(a);var _=B(a,2);{var k=e=>{var m=Y(),x=f(m,!0);v(m),p(()=>j(x,o())),E(e,m)};D(_,e=>{o()&&e(k)})}return v(n),v(s),p(()=>{H(s,1,y(["mc-toggle",`mc-toggle--${h()}`]),"svelte-26wadt"),w(n,"for",d()),w(a,"id",d()),w(a,"name",i()),a.disabled=c()}),S(a,g),E(u,s),P(b)}customElements.define("m-toggle",z(G,{checked:{attribute:"checked",reflect:!0,type:"Boolean"},id:{},name:{},label:{},disabled:{},size:{}},[],[],!0,T));
|
|
7
4
|
//# sourceMappingURL=Toggle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toggle.js","sources":["../../../src/components/toggle/Toggle.svelte"],"sourcesContent":["<svelte:options\n customElement={{\n tag: 'm-toggle',\n extend: customElementForwardEvents,\n }}\n/>\n\n<script lang=\"ts\">\n import
|
|
1
|
+
{"version":3,"file":"Toggle.js","sources":["../../../src/components/toggle/Toggle.svelte"],"sourcesContent":["<svelte:options\n customElement={{\n tag: 'm-toggle',\n props: {\n checked: { reflect: true, type: 'Boolean', attribute: 'checked' },\n },\n extend: customElementForwardEvents,\n }}\n/>\n\n<script lang=\"ts\">\n import { customElementForwardEvents } from '../../utils';\n /**\n * A toggle is a switch component that allows users to enable or disable a setting, representing a binary state such as on/off or active/inactive. It provides a quick and intuitive way to control preferences or system settings. Toggles are commonly used in settings menus, dark mode switches, and feature activations, offering an alternative to checkboxes for immediate visual feedback.\n */\n interface Props {\n /**\n * A unique identifier for the toggle, used to associate the label with the form element.\n */\n id: string;\n /**\n * The name attribute for the toggle element, typically used for form submission.\n */\n name?: string;\n /**\n * The text label displayed next to the toggle.\n */\n label?: string;\n /**\n * The toggle's checked state.\n */\n checked?: boolean;\n /**\n * Determines the size of the toggle.\n */\n size?: 's' | 'm';\n /**\n * If `true`, disables the toggle, making it non-interactive.\n */\n disabled?: boolean;\n }\n\n let {\n id,\n name,\n label,\n checked = $bindable(false),\n disabled,\n size = 's',\n }: Props = $props();\n</script>\n\n<div class={['mc-toggle', `mc-toggle--${size}`]}>\n <label class=\"mc-toggle__container\" for={id}>\n <input\n {id}\n type=\"checkbox\"\n class=\"mc-toggle__input\"\n {name}\n {disabled}\n bind:checked\n />\n {#if label}\n <span class=\"mc-toggle__label\">{label}</span>\n {/if}\n </label>\n</div>\n\n<style lang=\"scss\">\n @use '@mozaic-ds/styles/components/toggle';\n</style>\n"],"names":["id","$.prop","$$props","name","label","checked","disabled","size","$$render","consequent","$.set_class","div","$.clsx","customElementForwardEvents"],"mappings":";;srPAAA,oBA2CIA,EAAEC,EAAAC,EAAA,KAAA,CAAA,EACFC,EAAIF,EAAAC,EAAA,OAAA,CAAA,EACJE,EAAKH,EAAAC,EAAA,QAAA,CAAA,EACLG,mBAAoB,EAAK,EACzBC,EAAQL,EAAAC,EAAA,WAAA,CAAA,EACRK,eAAO,GAAG,sLAFU,GAAK,kGAElB,IAAG,gGAewBH,EAAK,CAAA,CAAA,kBADlCA,EAAK,GAAAI,EAAAC,CAAA,4BAVDC,EAAAC,EAAA,EAAAC,EAAA,CAAA,0BAA2BL,EAAI,CAAA,EAAA,CAAA,EAAA,eAAA,YACDP,GAAE,mEAH7C,oJA5CYa"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import { render, fireEvent } from '@testing-library/svelte';
|
|
3
|
+
import Toggle from './Toggle.svelte';
|
|
4
|
+
describe('m-toggle component', () => {
|
|
5
|
+
it('renders with label and proper classes', () => {
|
|
6
|
+
const { container, getByLabelText } = render(Toggle, {
|
|
7
|
+
props: {
|
|
8
|
+
id: 'toggle-id',
|
|
9
|
+
label: 'Enable feature',
|
|
10
|
+
size: 'm',
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
const toggleContainer = container.querySelector('.mc-toggle');
|
|
14
|
+
expect(toggleContainer).toBeTruthy();
|
|
15
|
+
expect(toggleContainer.classList.contains('mc-toggle--m')).toBe(true);
|
|
16
|
+
const input = getByLabelText('Enable feature');
|
|
17
|
+
expect(input.type).toBe('checkbox');
|
|
18
|
+
expect(input.checked).toBe(false);
|
|
19
|
+
});
|
|
20
|
+
it('sets initial checked state correctly', () => {
|
|
21
|
+
const { getByLabelText } = render(Toggle, {
|
|
22
|
+
props: {
|
|
23
|
+
id: 'toggle-id',
|
|
24
|
+
label: 'Enable setting',
|
|
25
|
+
checked: true,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
const input = getByLabelText('Enable setting');
|
|
29
|
+
expect(input.checked).toBe(true);
|
|
30
|
+
});
|
|
31
|
+
it('toggles checked state when clicked', async () => {
|
|
32
|
+
const { getByLabelText } = render(Toggle, {
|
|
33
|
+
props: {
|
|
34
|
+
id: 'toggle-id',
|
|
35
|
+
label: 'Toggle me',
|
|
36
|
+
checked: false,
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
const input = getByLabelText('Toggle me');
|
|
40
|
+
expect(input.checked).toBe(false);
|
|
41
|
+
await fireEvent.click(input);
|
|
42
|
+
expect(input.checked).toBe(true);
|
|
43
|
+
});
|
|
44
|
+
it('emits DOM "change" event when toggled', async () => {
|
|
45
|
+
const { getByLabelText } = render(Toggle, {
|
|
46
|
+
props: {
|
|
47
|
+
id: 'toggle-id',
|
|
48
|
+
label: 'Notify me',
|
|
49
|
+
checked: false,
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
const input = getByLabelText('Notify me');
|
|
53
|
+
const changeHandler = vi.fn();
|
|
54
|
+
input.addEventListener('change', changeHandler);
|
|
55
|
+
await fireEvent.click(input);
|
|
56
|
+
expect(changeHandler).toHaveBeenCalledTimes(1);
|
|
57
|
+
});
|
|
58
|
+
it('is disabled when disabled prop is true', () => {
|
|
59
|
+
const { getByLabelText } = render(Toggle, {
|
|
60
|
+
props: {
|
|
61
|
+
id: 'toggle-id',
|
|
62
|
+
label: 'Disabled toggle',
|
|
63
|
+
disabled: true,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
const input = getByLabelText('Disabled toggle');
|
|
67
|
+
expect(input.disabled).toBe(true);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import type { Meta } from '@storybook/
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
declare const
|
|
10
|
-
export default _default;
|
|
11
|
-
export declare const Default: any;
|
|
12
|
-
export declare const Checked: any;
|
|
13
|
-
export declare const Disabled: any;
|
|
14
|
-
export declare const Small: any;
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/web-components-vite';
|
|
2
|
+
declare const meta: Meta;
|
|
3
|
+
export default meta;
|
|
4
|
+
type Story = StoryObj;
|
|
5
|
+
export declare const Default: Story;
|
|
6
|
+
export declare const Checked: Story;
|
|
7
|
+
export declare const Disabled: Story;
|
|
8
|
+
export declare const Size: Story;
|
|
9
|
+
export declare const HideLabel: Story;
|
|
15
10
|
//# sourceMappingURL=Toggle.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toggle.stories.d.ts","sourceRoot":"","sources":["../../../src/components/toggle/Toggle.stories.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Toggle.stories.d.ts","sourceRoot":"","sources":["../../../src/components/toggle/Toggle.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAKrE,QAAA,MAAM,IAAI,EAAE,IAsCX,CAAC;AACF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC;AAEtB,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAEjC,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAKtB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,KAKlB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAKvB,CAAC"}
|
|
@@ -1,76 +1,67 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { ifDefined } from 'lit-html/directives/if-defined.js';
|
|
1
3
|
import { action } from 'storybook/actions';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A toggle is used to choose between two possibilities and when the user needs instant feedback.
|
|
5
|
-
* It is commonly used to show or hide content and act as an "on/off" switch.
|
|
6
|
-
*
|
|
7
|
-
* The `MToggle` component is the **Svelte / WebComponent** implementation of the **Toggle** component of Mozaic Design System.
|
|
8
|
-
* The full specification of this component is available in [the associated documentation](https://mozaic.adeo.cloud/components/form/toggle/).
|
|
9
|
-
*/
|
|
10
|
-
export default {
|
|
4
|
+
const meta = {
|
|
11
5
|
title: 'Form Elements/Toggle',
|
|
6
|
+
component: 'm-toggle',
|
|
12
7
|
argTypes: {
|
|
13
|
-
name: {
|
|
14
|
-
description: 'Specify the input name for the toggle',
|
|
15
|
-
control: 'text',
|
|
16
|
-
},
|
|
17
|
-
label: {
|
|
18
|
-
description: 'Specify the input label for the toggle',
|
|
19
|
-
control: 'text',
|
|
20
|
-
},
|
|
21
8
|
size: {
|
|
22
|
-
|
|
23
|
-
control: { type: 'radio' },
|
|
9
|
+
control: 'radio',
|
|
24
10
|
options: ['s', 'm'],
|
|
25
11
|
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
12
|
+
},
|
|
13
|
+
args: {
|
|
14
|
+
id: 'ToggleId',
|
|
15
|
+
label: 'Toggle Label',
|
|
16
|
+
},
|
|
17
|
+
render: (args) => {
|
|
18
|
+
const onChange = action('change');
|
|
19
|
+
const onFocus = action('focus');
|
|
20
|
+
const onBlur = action('blur');
|
|
21
|
+
return html `
|
|
22
|
+
<m-toggle
|
|
23
|
+
id=${ifDefined(args.id)}
|
|
24
|
+
name=${ifDefined(args.name)}
|
|
25
|
+
label=${ifDefined(args.label)}
|
|
26
|
+
checked=${ifDefined(args.checked)}
|
|
27
|
+
disabled=${ifDefined(args.disabled)}
|
|
28
|
+
size=${ifDefined(args.size)}
|
|
29
|
+
@change=${(event) => {
|
|
30
|
+
onChange(event);
|
|
31
|
+
}}
|
|
32
|
+
@focus=${(event) => {
|
|
33
|
+
onFocus(event);
|
|
34
|
+
}}
|
|
35
|
+
@blur=${(event) => {
|
|
36
|
+
onBlur(event);
|
|
37
|
+
}}
|
|
38
|
+
></m-toggle>
|
|
39
|
+
`;
|
|
34
40
|
},
|
|
35
41
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
MToggle.setAttribute('disabled', 'true');
|
|
44
|
-
if (args.checked)
|
|
45
|
-
MToggle.setAttribute('checked', 'true');
|
|
46
|
-
MToggle.addEventListener('change', action('change'));
|
|
47
|
-
return MToggle;
|
|
48
|
-
};
|
|
49
|
-
export const Default = Template.bind({});
|
|
50
|
-
Default.args = {};
|
|
51
|
-
Default.play = async ({ canvasElement }) => {
|
|
52
|
-
const toggle = canvasElement.querySelector('m-toggle');
|
|
53
|
-
const input = toggle?.shadowRoot.querySelector('input');
|
|
54
|
-
expect(toggle).not.toBeNull();
|
|
55
|
-
await userEvent.click(input);
|
|
56
|
-
expect(input).toBeChecked();
|
|
42
|
+
export default meta;
|
|
43
|
+
export const Default = {};
|
|
44
|
+
export const Checked = {
|
|
45
|
+
args: {
|
|
46
|
+
checked: true,
|
|
47
|
+
id: 'checkedId',
|
|
48
|
+
},
|
|
57
49
|
};
|
|
58
|
-
export const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
expect(input).toBeChecked();
|
|
50
|
+
export const Disabled = {
|
|
51
|
+
args: {
|
|
52
|
+
disabled: true,
|
|
53
|
+
id: 'disabledId',
|
|
54
|
+
},
|
|
64
55
|
};
|
|
65
|
-
export const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
56
|
+
export const Size = {
|
|
57
|
+
args: {
|
|
58
|
+
id: 'sizeId',
|
|
59
|
+
size: 'm',
|
|
60
|
+
},
|
|
70
61
|
};
|
|
71
|
-
export const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
62
|
+
export const HideLabel = {
|
|
63
|
+
args: {
|
|
64
|
+
id: 'hideLabelId',
|
|
65
|
+
label: undefined,
|
|
66
|
+
},
|
|
76
67
|
};
|
|
@@ -1,50 +1,64 @@
|
|
|
1
1
|
<svelte:options
|
|
2
2
|
customElement={{
|
|
3
3
|
tag: 'm-toggle',
|
|
4
|
+
props: {
|
|
5
|
+
checked: { reflect: true, type: 'Boolean', attribute: 'checked' },
|
|
6
|
+
},
|
|
4
7
|
extend: customElementForwardEvents,
|
|
5
8
|
}}
|
|
6
9
|
/>
|
|
7
10
|
|
|
8
11
|
<script lang="ts">
|
|
9
|
-
import type { ToggleSize } from './toggle.types';
|
|
10
12
|
import { customElementForwardEvents } from '../../utils';
|
|
11
|
-
|
|
13
|
+
/**
|
|
14
|
+
* A toggle is a switch component that allows users to enable or disable a setting, representing a binary state such as on/off or active/inactive. It provides a quick and intuitive way to control preferences or system settings. Toggles are commonly used in settings menus, dark mode switches, and feature activations, offering an alternative to checkboxes for immediate visual feedback.
|
|
15
|
+
*/
|
|
12
16
|
interface Props {
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
/**
|
|
18
|
+
* A unique identifier for the toggle, used to associate the label with the form element.
|
|
19
|
+
*/
|
|
20
|
+
id: string;
|
|
21
|
+
/**
|
|
22
|
+
* The name attribute for the toggle element, typically used for form submission.
|
|
23
|
+
*/
|
|
24
|
+
name?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The text label displayed next to the toggle.
|
|
27
|
+
*/
|
|
28
|
+
label?: string;
|
|
29
|
+
/**
|
|
30
|
+
* The toggle's checked state.
|
|
31
|
+
*/
|
|
32
|
+
checked?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Determines the size of the toggle.
|
|
35
|
+
*/
|
|
36
|
+
size?: 's' | 'm';
|
|
37
|
+
/**
|
|
38
|
+
* If `true`, disables the toggle, making it non-interactive.
|
|
39
|
+
*/
|
|
15
40
|
disabled?: boolean;
|
|
16
|
-
size?: ToggleSize;
|
|
17
|
-
label: string;
|
|
18
|
-
onchange?: (event: Event) => void;
|
|
19
|
-
onblur?: (event: FocusEvent) => void;
|
|
20
41
|
}
|
|
21
42
|
|
|
22
43
|
let {
|
|
44
|
+
id,
|
|
23
45
|
name,
|
|
24
|
-
checked = $bindable(),
|
|
25
|
-
disabled = false,
|
|
26
|
-
size = 'm',
|
|
27
46
|
label,
|
|
28
|
-
|
|
29
|
-
|
|
47
|
+
checked = $bindable(false),
|
|
48
|
+
disabled,
|
|
49
|
+
size = 's',
|
|
30
50
|
}: Props = $props();
|
|
31
51
|
</script>
|
|
32
52
|
|
|
33
|
-
<div
|
|
34
|
-
class="mc-
|
|
35
|
-
class:mc-toggle--hide-label={!label}
|
|
36
|
-
class:mc-toggle--m={size === 'm'}
|
|
37
|
-
>
|
|
38
|
-
<label class="mc-toggle__container">
|
|
53
|
+
<div class={['mc-toggle', `mc-toggle--${size}`]}>
|
|
54
|
+
<label class="mc-toggle__container" for={id}>
|
|
39
55
|
<input
|
|
56
|
+
{id}
|
|
57
|
+
type="checkbox"
|
|
40
58
|
class="mc-toggle__input"
|
|
41
|
-
id={name}
|
|
42
59
|
{name}
|
|
43
|
-
type="checkbox"
|
|
44
|
-
bind:checked
|
|
45
60
|
{disabled}
|
|
46
|
-
|
|
47
|
-
{onblur}
|
|
61
|
+
bind:checked
|
|
48
62
|
/>
|
|
49
63
|
{#if label}
|
|
50
64
|
<span class="mc-toggle__label">{label}</span>
|
|
@@ -55,9 +69,6 @@
|
|
|
55
69
|
<style>/**
|
|
56
70
|
* Do not edit directly, this file was auto-generated.
|
|
57
71
|
*/
|
|
58
|
-
/**
|
|
59
|
-
* Do not edit directly, this file was auto-generated.
|
|
60
|
-
*/
|
|
61
72
|
.mc-toggle {
|
|
62
73
|
width: fit-content;
|
|
63
74
|
}
|
|
@@ -76,16 +87,16 @@
|
|
|
76
87
|
transition: box-shadow 200ms ease;
|
|
77
88
|
height: 1.5rem;
|
|
78
89
|
width: 2.5rem;
|
|
79
|
-
background-color: #666666;
|
|
80
|
-
border-radius: 1rem;
|
|
90
|
+
background-color: var(--forms-color-background-unchecked, #666666);
|
|
91
|
+
border-radius: var(--radius-l, 1rem);
|
|
81
92
|
flex-shrink: 0;
|
|
82
93
|
}
|
|
83
94
|
.mc-toggle__container::after {
|
|
84
95
|
height: 1.25rem;
|
|
85
96
|
width: 1.25rem;
|
|
86
|
-
background-color: #ffffff;
|
|
87
|
-
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.25rem' width='1.25rem' fill='%23666666' viewBox='0 0 20 20'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M14.697 6.364a.75.75 0 1 0-1.06-1.061L10 8.939 6.364 5.303a.75.75 0 0 0-1.06 1.06L8.94 10l-3.637 3.636a.75.75 0 1 0 1.06 1.06L10 11.062l3.636 3.636a.75.75 0 0 0 1.061-1.06L11.061 10z'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h20v20H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");
|
|
88
|
-
border-radius: 100
|
|
97
|
+
background-color: var(--forms-color-icon-inverse, #ffffff);
|
|
98
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.25rem' width='1.25rem' fill='var(--forms-color-background-unchecked, %23666666)' viewBox='0 0 20 20'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M14.697 6.364a.75.75 0 1 0-1.06-1.061L10 8.939 6.364 5.303a.75.75 0 0 0-1.06 1.06L8.94 10l-3.637 3.636a.75.75 0 1 0 1.06 1.06L10 11.062l3.636 3.636a.75.75 0 0 0 1.061-1.06L11.061 10z'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h20v20H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");
|
|
99
|
+
border-radius: var(--radius-full, 100%);
|
|
89
100
|
background-position: center;
|
|
90
101
|
left: 0.375rem;
|
|
91
102
|
position: absolute;
|
|
@@ -103,36 +114,36 @@
|
|
|
103
114
|
width: 1px;
|
|
104
115
|
}
|
|
105
116
|
.mc-toggle__label {
|
|
106
|
-
color: #000000;
|
|
107
|
-
font-size: 1rem;
|
|
108
|
-
font-weight: 400;
|
|
109
|
-
line-height: 1.5;
|
|
117
|
+
color: var(--forms-color-text-default, #000000);
|
|
118
|
+
font-size: var(--font-size-150, 1rem);
|
|
119
|
+
font-weight: var(--font-weight-regular, 400);
|
|
120
|
+
line-height: var(--line-height-m, 1.5);
|
|
110
121
|
}
|
|
111
122
|
.mc-toggle:has(:checked) .mc-toggle__container::before {
|
|
112
|
-
background-color: #117f03;
|
|
123
|
+
background-color: var(--forms-color-background-checked, #117f03);
|
|
113
124
|
}
|
|
114
125
|
.mc-toggle:has(:checked) .mc-toggle__container::after {
|
|
115
|
-
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.25rem' width='1.25rem' fill='%23117f03' viewBox='0 0 20 20'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M14.697 6.553a.75.75 0 0 1 0 1.06l-5.833 5.834a.75.75 0 0 1-1.06 0l-2.5-2.5a.75.75 0 0 1 1.06-1.06l1.97 1.97 5.303-5.304a.75.75 0 0 1 1.06 0'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h20v20H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");
|
|
126
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.25rem' width='1.25rem' fill='var(--forms-color-background-checked, %23117f03)' viewBox='0 0 20 20'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M14.697 6.553a.75.75 0 0 1 0 1.06l-5.833 5.834a.75.75 0 0 1-1.06 0l-2.5-2.5a.75.75 0 0 1 1.06-1.06l1.97 1.97 5.303-5.304a.75.75 0 0 1 1.06 0'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h20v20H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");
|
|
116
127
|
transform: translate(1rem, -50%);
|
|
117
128
|
}
|
|
118
129
|
.mc-toggle:has(:disabled) .mc-toggle__container {
|
|
119
130
|
cursor: not-allowed;
|
|
120
131
|
}
|
|
121
132
|
.mc-toggle:has(:disabled) .mc-toggle__container::before {
|
|
122
|
-
background-color: #d9d9d9;
|
|
133
|
+
background-color: var(--forms-color-background-disabled, #d9d9d9);
|
|
123
134
|
}
|
|
124
135
|
.mc-toggle:has(:disabled) .mc-toggle__container::after {
|
|
125
|
-
background-color: #737373;
|
|
126
|
-
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.25rem' width='1.25rem' fill='%23d9d9d9' viewBox='0 0 20 20'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M14.697 6.364a.75.75 0 1 0-1.06-1.061L10 8.939 6.364 5.303a.75.75 0 0 0-1.06 1.06L8.94 10l-3.637 3.636a.75.75 0 1 0 1.06 1.06L10 11.062l3.636 3.636a.75.75 0 0 0 1.061-1.06L11.061 10z'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h20v20H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");
|
|
136
|
+
background-color: var(--forms-color-icon-disabled, #737373);
|
|
137
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.25rem' width='1.25rem' fill='var(--forms-color-background-disabled, %23d9d9d9)' viewBox='0 0 20 20'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M14.697 6.364a.75.75 0 1 0-1.06-1.061L10 8.939 6.364 5.303a.75.75 0 0 0-1.06 1.06L8.94 10l-3.637 3.636a.75.75 0 1 0 1.06 1.06L10 11.062l3.636 3.636a.75.75 0 0 0 1.061-1.06L11.061 10z'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h20v20H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");
|
|
127
138
|
}
|
|
128
139
|
.mc-toggle:has(:disabled) .mc-toggle__label {
|
|
129
|
-
color: #737373;
|
|
140
|
+
color: var(--forms-color-text-disabled, #737373);
|
|
130
141
|
}
|
|
131
142
|
.mc-toggle:has(:disabled:checked) .mc-toggle__container::after {
|
|
132
|
-
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.25rem' width='1.25rem' fill='%23d9d9d9' viewBox='0 0 20 20'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M14.697 6.553a.75.75 0 0 1 0 1.06l-5.833 5.834a.75.75 0 0 1-1.06 0l-2.5-2.5a.75.75 0 0 1 1.06-1.06l1.97 1.97 5.303-5.304a.75.75 0 0 1 1.06 0'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h20v20H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");
|
|
143
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.25rem' width='1.25rem' fill='var(--forms-color-background-disabled, %23d9d9d9)' viewBox='0 0 20 20'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M14.697 6.553a.75.75 0 0 1 0 1.06l-5.833 5.834a.75.75 0 0 1-1.06 0l-2.5-2.5a.75.75 0 0 1 1.06-1.06l1.97 1.97 5.303-5.304a.75.75 0 0 1 1.06 0'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h20v20H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");
|
|
133
144
|
}
|
|
134
145
|
.mc-toggle:has(:focus-visible) .mc-toggle__container::before {
|
|
135
|
-
box-shadow: 0 0 0 0.125rem var(--focus-color-mid, #ffffff), 0 0 0 0.25rem var(--focus-color-outer, #000000);
|
|
146
|
+
box-shadow: 0 0 0 0.125rem var(--focus-color-mid, var(--focus-color-outline-mid, #ffffff)), 0 0 0 0.25rem var(--focus-color-outer, var(--focus-color-outline-outer, #000000));
|
|
136
147
|
outline: 0.125rem solid transparent;
|
|
137
148
|
outline-offset: 0.125rem;
|
|
138
149
|
}
|
|
@@ -143,18 +154,18 @@
|
|
|
143
154
|
.mc-toggle--m .mc-toggle__container::after {
|
|
144
155
|
height: 1.5rem;
|
|
145
156
|
width: 1.5rem;
|
|
146
|
-
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.5rem' width='1.5rem' fill='%23666666' viewBox='0 0 24 24'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M17.707 7.707a1 1 0 0 0-1.414-1.414L12 10.586 7.707 6.293a1 1 0 0 0-1.414 1.414L10.586 12l-4.293 4.293a1 1 0 1 0 1.414 1.414L12 13.414l4.293 4.293a1 1 0 0 0 1.414-1.414L13.414 12z'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h24v24H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");
|
|
157
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.5rem' width='1.5rem' fill='var(--forms-color-background-unchecked, %23666666)' viewBox='0 0 24 24'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M17.707 7.707a1 1 0 0 0-1.414-1.414L12 10.586 7.707 6.293a1 1 0 0 0-1.414 1.414L10.586 12l-4.293 4.293a1 1 0 1 0 1.414 1.414L12 13.414l4.293 4.293a1 1 0 0 0 1.414-1.414L13.414 12z'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h24v24H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");
|
|
147
158
|
left: 0.5rem;
|
|
148
159
|
}
|
|
149
160
|
.mc-toggle--m:has(:checked) .mc-toggle__container::after {
|
|
150
|
-
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.5rem' width='1.5rem' fill='%23117f03' viewBox='0 0 24 24'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M17.707 7.793a1 1 0 0 1 0 1.414l-7 7a1 1 0 0 1-1.414 0l-3-3a1 1 0 1 1 1.414-1.414L10 14.086l6.293-6.293a1 1 0 0 1 1.414 0'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h24v24H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");
|
|
161
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.5rem' width='1.5rem' fill='var(--forms-color-background-checked, %23117f03)' viewBox='0 0 24 24'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M17.707 7.793a1 1 0 0 1 0 1.414l-7 7a1 1 0 0 1-1.414 0l-3-3a1 1 0 1 1 1.414-1.414L10 14.086l6.293-6.293a1 1 0 0 1 1.414 0'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h24v24H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");
|
|
151
162
|
transform: translate(1.5rem, -50%);
|
|
152
163
|
}
|
|
153
164
|
.mc-toggle--m:has(:disabled) .mc-toggle__container::after {
|
|
154
|
-
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.5rem' width='1.5rem' fill='%23d9d9d9' viewBox='0 0 24 24'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M17.707 7.707a1 1 0 0 0-1.414-1.414L12 10.586 7.707 6.293a1 1 0 0 0-1.414 1.414L10.586 12l-4.293 4.293a1 1 0 1 0 1.414 1.414L12 13.414l4.293 4.293a1 1 0 0 0 1.414-1.414L13.414 12z'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h24v24H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");
|
|
165
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.5rem' width='1.5rem' fill='var(--forms-color-background-disabled, %23d9d9d9)' viewBox='0 0 24 24'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M17.707 7.707a1 1 0 0 0-1.414-1.414L12 10.586 7.707 6.293a1 1 0 0 0-1.414 1.414L10.586 12l-4.293 4.293a1 1 0 1 0 1.414 1.414L12 13.414l4.293 4.293a1 1 0 0 0 1.414-1.414L13.414 12z'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h24v24H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");
|
|
155
166
|
}
|
|
156
167
|
.mc-toggle--m:has(:disabled:checked) .mc-toggle__container::after {
|
|
157
|
-
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.5rem' width='1.5rem' fill='%23d9d9d9' viewBox='0 0 24 24'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M17.707 7.793a1 1 0 0 1 0 1.414l-7 7a1 1 0 0 1-1.414 0l-3-3a1 1 0 1 1 1.414-1.414L10 14.086l6.293-6.293a1 1 0 0 1 1.414 0'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h24v24H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");
|
|
168
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1.5rem' width='1.5rem' fill='var(--forms-color-background-disabled, %23d9d9d9)' viewBox='0 0 24 24'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill-rule='evenodd' d='M17.707 7.793a1 1 0 0 1 0 1.414l-7 7a1 1 0 0 1-1.414 0l-3-3a1 1 0 1 1 1.414-1.414L10 14.086l6.293-6.293a1 1 0 0 1 1.414 0'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h24v24H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");
|
|
158
169
|
}
|
|
159
170
|
.mc-toggle--hide-label .mc-toggle__label {
|
|
160
171
|
clip-path: inset(100%);
|
|
@@ -1,12 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* A toggle is a switch component that allows users to enable or disable a setting, representing a binary state such as on/off or active/inactive. It provides a quick and intuitive way to control preferences or system settings. Toggles are commonly used in settings menus, dark mode switches, and feature activations, offering an alternative to checkboxes for immediate visual feedback.
|
|
3
|
+
*/
|
|
2
4
|
interface Props {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
/**
|
|
6
|
+
* A unique identifier for the toggle, used to associate the label with the form element.
|
|
7
|
+
*/
|
|
8
|
+
id: string;
|
|
9
|
+
/**
|
|
10
|
+
* The name attribute for the toggle element, typically used for form submission.
|
|
11
|
+
*/
|
|
12
|
+
name?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The text label displayed next to the toggle.
|
|
15
|
+
*/
|
|
16
|
+
label?: string;
|
|
17
|
+
/**
|
|
18
|
+
* The toggle's checked state.
|
|
19
|
+
*/
|
|
20
|
+
checked?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Determines the size of the toggle.
|
|
23
|
+
*/
|
|
24
|
+
size?: 's' | 'm';
|
|
25
|
+
/**
|
|
26
|
+
* If `true`, disables the toggle, making it non-interactive.
|
|
27
|
+
*/
|
|
5
28
|
disabled?: boolean;
|
|
6
|
-
size?: ToggleSize;
|
|
7
|
-
label: string;
|
|
8
|
-
onchange?: (event: Event) => void;
|
|
9
|
-
onblur?: (event: FocusEvent) => void;
|
|
10
29
|
}
|
|
11
30
|
declare const Toggle: import("svelte").Component<Props, {}, "checked">;
|
|
12
31
|
type Toggle = ReturnType<typeof Toggle>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toggle.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/toggle/Toggle.svelte.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Toggle.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/toggle/Toggle.svelte.ts"],"names":[],"mappings":"AAKE;;GAEG;AACH,UAAU,KAAK;IACb;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,IAAI,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC;IACjB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAoCH,QAAA,MAAM,MAAM,kDAAwC,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# `m-toggle-group`
|
|
2
|
+
|
|
3
|
+
A toggle is a switch component that allows users to enable or disable a setting, representing a binary state such as on/off or active/inactive. It provides a quick and intuitive way to control preferences or system settings. Toggles are commonly used in settings menus, dark mode switches, and feature activations, offering an alternative to checkboxes for immediate visual feedback.
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
| Name | Description | Type | Default |
|
|
8
|
+
|------|-------------|------|---------|
|
|
9
|
+
| `name*` | The name attribute for the toggle element, typically used for form submission. | `string` | |
|
|
10
|
+
| `value` | The current value of the toggle group. | `Array<string>` | `$bindable([])` |
|
|
11
|
+
| `options*` | List of properties of each toggle of the toggle group. | `Array<{ id: string; label: string; value: string; disabled?: boolean; size?: 's'` `'m'; }>` | |
|
|
12
|
+
| `inline` | If `true`, make the form element of the group inline. | `boolean` | |
|
|
13
|
+
|