@mozaic-ds/web-components 1.2.0 → 1.3.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/dist/Cross20.js +1 -1
- package/dist/Cross24.js +1 -1
- package/dist/CrossCircleFilled24.js +1 -1
- package/dist/Less24.js +2 -0
- package/dist/Less24.js.map +1 -0
- package/dist/attributes.js +1 -1
- package/dist/attributes.js.map +1 -1
- package/dist/bundle.d.ts +3 -0
- package/dist/bundle.d.ts.map +1 -1
- package/dist/bundle.js +3 -0
- package/dist/components/avatar/Avatar.js +2 -2
- package/dist/components/avatar/Avatar.js.map +1 -1
- package/dist/components/avatar/Avatar.stories.d.ts +2 -1
- package/dist/components/avatar/Avatar.stories.d.ts.map +1 -1
- package/dist/components/avatar/Avatar.stories.js +2 -1
- package/dist/components/avatar/Avatar.svelte +2 -2
- package/dist/components/breadcrumb/Breadcrumb.js +2 -2
- package/dist/components/breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/components/breadcrumb/Breadcrumb.stories.d.ts +1 -0
- package/dist/components/breadcrumb/Breadcrumb.stories.d.ts.map +1 -1
- package/dist/components/breadcrumb/Breadcrumb.stories.js +1 -0
- package/dist/components/breadcrumb/Breadcrumb.svelte +2 -2
- package/dist/components/button/Button.js +2 -2
- package/dist/components/button/Button.js.map +1 -1
- package/dist/components/button/Button.stories.d.ts +2 -0
- package/dist/components/button/Button.stories.d.ts.map +1 -1
- package/dist/components/button/Button.stories.js +2 -0
- package/dist/components/button/Button.svelte +0 -1
- package/dist/components/button/Button.svelte.d.ts +0 -1
- package/dist/components/button/Button.svelte.d.ts.map +1 -1
- package/dist/components/callout/Callout.js +2 -2
- package/dist/components/callout/Callout.js.map +1 -1
- package/dist/components/callout/Callout.stories.d.ts +5 -2
- package/dist/components/callout/Callout.stories.d.ts.map +1 -1
- package/dist/components/callout/Callout.stories.js +5 -2
- package/dist/components/callout/Callout.svelte +2 -2
- package/dist/components/carousel/Carousel.js +4 -0
- package/dist/components/carousel/Carousel.js.map +1 -0
- package/dist/components/carousel/Carousel.spec.js +49 -0
- package/dist/components/carousel/Carousel.stories.d.ts +9 -0
- package/dist/components/carousel/Carousel.stories.d.ts.map +1 -0
- package/dist/components/carousel/Carousel.stories.js +72 -0
- package/dist/components/carousel/Carousel.svelte +187 -0
- package/dist/components/carousel/Carousel.svelte.d.ts +46 -0
- package/dist/components/carousel/Carousel.svelte.d.ts.map +1 -0
- package/dist/components/carousel/README.md +18 -0
- package/dist/components/checkbox/Checkbox.js +3 -3
- package/dist/components/checkbox/Checkbox.js.map +1 -1
- package/dist/components/checkbox/Checkbox.stories.d.ts +1 -0
- package/dist/components/checkbox/Checkbox.stories.d.ts.map +1 -1
- package/dist/components/checkbox/Checkbox.stories.js +1 -0
- package/dist/components/checkbox/Checkbox.svelte +2 -0
- package/dist/components/checkbox/Checkbox.svelte.d.ts.map +1 -1
- package/dist/components/checkboxgroup/CheckboxGroup.js +4 -4
- package/dist/components/checkboxgroup/CheckboxGroup.js.map +1 -1
- package/dist/components/checkboxgroup/CheckboxGroup.stories.d.ts +1 -0
- package/dist/components/checkboxgroup/CheckboxGroup.stories.d.ts.map +1 -1
- package/dist/components/checkboxgroup/CheckboxGroup.stories.js +1 -0
- package/dist/components/checkboxgroup/CheckboxGroup.svelte +2 -2
- package/dist/components/circularprogressbar/CircularProgressbar.js +2 -2
- package/dist/components/circularprogressbar/CircularProgressbar.js.map +1 -1
- package/dist/components/circularprogressbar/CircularProgressbar.stories.d.ts +1 -0
- package/dist/components/circularprogressbar/CircularProgressbar.stories.d.ts.map +1 -1
- package/dist/components/circularprogressbar/CircularProgressbar.stories.js +1 -0
- package/dist/components/circularprogressbar/CircularProgressbar.svelte +0 -1
- package/dist/components/circularprogressbar/CircularProgressbar.svelte.d.ts +0 -1
- package/dist/components/circularprogressbar/CircularProgressbar.svelte.d.ts.map +1 -1
- package/dist/components/container/Container.js +2 -2
- package/dist/components/container/Container.stories.d.ts +1 -0
- package/dist/components/container/Container.stories.d.ts.map +1 -1
- package/dist/components/container/Container.stories.js +1 -0
- package/dist/components/datepicker/Datepicker.js +3 -3
- package/dist/components/datepicker/Datepicker.js.map +1 -1
- package/dist/components/datepicker/Datepicker.stories.d.ts +1 -0
- package/dist/components/datepicker/Datepicker.stories.d.ts.map +1 -1
- package/dist/components/datepicker/Datepicker.stories.js +1 -0
- package/dist/components/datepicker/Datepicker.svelte +2 -0
- package/dist/components/datepicker/Datepicker.svelte.d.ts.map +1 -1
- package/dist/components/divider/Divider.js +1 -1
- package/dist/components/divider/Divider.stories.d.ts +1 -0
- package/dist/components/divider/Divider.stories.d.ts.map +1 -1
- package/dist/components/divider/Divider.stories.js +1 -0
- package/dist/components/drawer/Drawer.js +2 -2
- package/dist/components/drawer/Drawer.js.map +1 -1
- package/dist/components/drawer/Drawer.stories.d.ts +2 -0
- package/dist/components/drawer/Drawer.stories.d.ts.map +1 -1
- package/dist/components/drawer/Drawer.stories.js +2 -0
- package/dist/components/drawer/Drawer.svelte +12 -2
- package/dist/components/drawer/Drawer.svelte.d.ts.map +1 -1
- package/dist/components/field/Field.js +2 -2
- package/dist/components/field/Field.stories.d.ts +2 -0
- package/dist/components/field/Field.stories.d.ts.map +1 -1
- package/dist/components/field/Field.stories.js +2 -0
- package/dist/components/flag/Flag.js +2 -2
- package/dist/components/flag/Flag.js.map +1 -1
- package/dist/components/flag/Flag.stories.d.ts +1 -0
- package/dist/components/flag/Flag.stories.d.ts.map +1 -1
- package/dist/components/flag/Flag.stories.js +1 -0
- package/dist/components/flag/Flag.svelte +2 -2
- package/dist/components/iconbutton/IconButton.js +2 -2
- package/dist/components/iconbutton/IconButton.js.map +1 -1
- package/dist/components/iconbutton/IconButton.stories.d.ts +4 -2
- package/dist/components/iconbutton/IconButton.stories.d.ts.map +1 -1
- package/dist/components/iconbutton/IconButton.stories.js +4 -2
- package/dist/components/iconbutton/IconButton.svelte +0 -1
- package/dist/components/iconbutton/IconButton.svelte.d.ts +0 -1
- package/dist/components/iconbutton/IconButton.svelte.d.ts.map +1 -1
- package/dist/components/kpiitem/KpiItem.js +2 -2
- package/dist/components/kpiitem/KpiItem.js.map +1 -1
- package/dist/components/kpiitem/KpiItem.stories.d.ts +1 -0
- package/dist/components/kpiitem/KpiItem.stories.d.ts.map +1 -1
- package/dist/components/kpiitem/KpiItem.stories.js +1 -0
- package/dist/components/kpiitem/KpiItem.svelte +2 -2
- package/dist/components/linearprogressbarbuffer/LinearProgressbarBuffer.js +2 -2
- package/dist/components/linearprogressbarbuffer/LinearProgressbarBuffer.js.map +1 -1
- package/dist/components/linearprogressbarbuffer/LinearProgressbarBuffer.stories.d.ts +1 -0
- package/dist/components/linearprogressbarbuffer/LinearProgressbarBuffer.stories.d.ts.map +1 -1
- package/dist/components/linearprogressbarbuffer/LinearProgressbarBuffer.stories.js +1 -0
- package/dist/components/linearprogressbarbuffer/LinearProgressbarBuffer.svelte +2 -1
- package/dist/components/linearprogressbarpercentage/LinearProgressbarPercentage.js +2 -2
- package/dist/components/linearprogressbarpercentage/LinearProgressbarPercentage.js.map +1 -1
- package/dist/components/linearprogressbarpercentage/LinearProgressbarPercentage.stories.d.ts +1 -0
- package/dist/components/linearprogressbarpercentage/LinearProgressbarPercentage.stories.d.ts.map +1 -1
- package/dist/components/linearprogressbarpercentage/LinearProgressbarPercentage.stories.js +1 -0
- package/dist/components/linearprogressbarpercentage/LinearProgressbarPercentage.svelte +2 -1
- package/dist/components/link/Link.js +2 -2
- package/dist/components/link/Link.js.map +1 -1
- package/dist/components/link/Link.stories.d.ts +3 -0
- package/dist/components/link/Link.stories.d.ts.map +1 -1
- package/dist/components/link/Link.stories.js +3 -0
- package/dist/components/link/Link.svelte +2 -0
- package/dist/components/link/Link.svelte.d.ts.map +1 -1
- package/dist/components/loader/Loader.js +2 -2
- package/dist/components/loader/Loader.js.map +1 -1
- package/dist/components/loader/Loader.stories.d.ts +1 -0
- package/dist/components/loader/Loader.stories.d.ts.map +1 -1
- package/dist/components/loader/Loader.stories.js +1 -0
- package/dist/components/loader/Loader.svelte +2 -1
- package/dist/components/loadingoverlay/LoadingOverlay.js +2 -2
- package/dist/components/loadingoverlay/LoadingOverlay.js.map +1 -1
- package/dist/components/loadingoverlay/LoadingOverlay.stories.d.ts +1 -0
- package/dist/components/loadingoverlay/LoadingOverlay.stories.d.ts.map +1 -1
- package/dist/components/loadingoverlay/LoadingOverlay.stories.js +1 -0
- package/dist/components/loadingoverlay/LoadingOverlay.svelte +2 -2
- package/dist/components/modal/Modal.js +2 -2
- package/dist/components/modal/Modal.js.map +1 -1
- package/dist/components/modal/Modal.stories.d.ts +5 -2
- package/dist/components/modal/Modal.stories.d.ts.map +1 -1
- package/dist/components/modal/Modal.stories.js +5 -2
- package/dist/components/modal/Modal.svelte +2 -1
- package/dist/components/numberbadge/NumberBadge.js +2 -2
- package/dist/components/numberbadge/NumberBadge.js.map +1 -1
- package/dist/components/numberbadge/NumberBadge.stories.d.ts +1 -0
- package/dist/components/numberbadge/NumberBadge.stories.d.ts.map +1 -1
- package/dist/components/numberbadge/NumberBadge.stories.js +1 -0
- package/dist/components/numberbadge/NumberBadge.svelte +5 -2
- package/dist/components/overlay/Overlay.js +2 -2
- package/dist/components/overlay/Overlay.stories.d.ts +1 -0
- package/dist/components/overlay/Overlay.stories.d.ts.map +1 -1
- package/dist/components/overlay/Overlay.stories.js +1 -0
- package/dist/components/pagination/Pagination.js +3 -3
- package/dist/components/pagination/Pagination.js.map +1 -1
- package/dist/components/pagination/Pagination.stories.d.ts +1 -0
- package/dist/components/pagination/Pagination.stories.d.ts.map +1 -1
- package/dist/components/pagination/Pagination.stories.js +1 -0
- package/dist/components/passwordinput/PasswordInput.js +4 -3
- package/dist/components/passwordinput/PasswordInput.js.map +1 -1
- package/dist/components/passwordinput/PasswordInput.stories.d.ts +1 -0
- package/dist/components/passwordinput/PasswordInput.stories.d.ts.map +1 -1
- package/dist/components/passwordinput/PasswordInput.stories.js +1 -0
- package/dist/components/passwordinput/PasswordInput.svelte +2 -0
- package/dist/components/passwordinput/PasswordInput.svelte.d.ts.map +1 -1
- package/dist/components/phonenumber/PhoneNumber.js +22 -0
- package/dist/components/phonenumber/PhoneNumber.js.map +1 -0
- package/dist/components/phonenumber/PhoneNumber.spec.js +103 -0
- package/dist/components/phonenumber/PhoneNumber.stories.d.ts +14 -0
- package/dist/components/phonenumber/PhoneNumber.stories.d.ts.map +1 -0
- package/dist/components/phonenumber/PhoneNumber.stories.js +116 -0
- package/dist/components/phonenumber/PhoneNumber.svelte +896 -0
- package/dist/components/phonenumber/PhoneNumber.svelte.d.ts +60 -0
- package/dist/components/phonenumber/PhoneNumber.svelte.d.ts.map +1 -0
- package/dist/components/phonenumber/README.md +27 -0
- package/dist/components/pincode/Pincode.js +2 -2
- package/dist/components/pincode/Pincode.stories.d.ts +1 -0
- package/dist/components/pincode/Pincode.stories.d.ts.map +1 -1
- package/dist/components/pincode/Pincode.stories.js +1 -0
- package/dist/components/quantityselector/QuantitySelector.js +2 -2
- package/dist/components/quantityselector/QuantitySelector.js.map +1 -1
- package/dist/components/quantityselector/QuantitySelector.stories.d.ts +1 -0
- package/dist/components/quantityselector/QuantitySelector.stories.d.ts.map +1 -1
- package/dist/components/quantityselector/QuantitySelector.stories.js +1 -0
- package/dist/components/quantityselector/QuantitySelector.svelte +6 -2
- package/dist/components/quantityselector/QuantitySelector.svelte.d.ts.map +1 -1
- package/dist/components/radio/Radio.js +2 -2
- package/dist/components/radio/Radio.js.map +1 -1
- package/dist/components/radio/Radio.stories.d.ts +1 -0
- package/dist/components/radio/Radio.stories.d.ts.map +1 -1
- package/dist/components/radio/Radio.stories.js +1 -0
- package/dist/components/radio/Radio.svelte +10 -1
- package/dist/components/radio/Radio.svelte.d.ts.map +1 -1
- package/dist/components/radiogroup/RadioGroup.js +1 -1
- package/dist/components/radiogroup/RadioGroup.stories.d.ts +1 -0
- package/dist/components/radiogroup/RadioGroup.stories.d.ts.map +1 -1
- package/dist/components/radiogroup/RadioGroup.stories.js +1 -0
- package/dist/components/segmentedcontrol/SegmentedControl.js +2 -2
- package/dist/components/segmentedcontrol/SegmentedControl.stories.d.ts +1 -0
- package/dist/components/segmentedcontrol/SegmentedControl.stories.d.ts.map +1 -1
- package/dist/components/segmentedcontrol/SegmentedControl.stories.js +1 -0
- package/dist/components/select/Select.js +2 -2
- package/dist/components/select/Select.js.map +1 -1
- package/dist/components/select/Select.stories.d.ts +1 -0
- package/dist/components/select/Select.stories.d.ts.map +1 -1
- package/dist/components/select/Select.stories.js +1 -0
- package/dist/components/select/Select.svelte +2 -0
- package/dist/components/select/Select.svelte.d.ts.map +1 -1
- package/dist/components/starrating/README.md +22 -0
- package/dist/components/starrating/StarRating.js +4 -0
- package/dist/components/starrating/StarRating.js.map +1 -0
- package/dist/components/starrating/StarRating.spec.js +108 -0
- package/dist/components/starrating/StarRating.stories.d.ts +13 -0
- package/dist/components/starrating/StarRating.stories.d.ts.map +1 -0
- package/dist/components/starrating/StarRating.stories.js +82 -0
- package/dist/components/starrating/StarRating.svelte +227 -0
- package/dist/components/starrating/StarRating.svelte.d.ts +46 -0
- package/dist/components/starrating/StarRating.svelte.d.ts.map +1 -0
- package/dist/components/statusbadge/StatusBadge.js +2 -2
- package/dist/components/statusbadge/StatusBadge.js.map +1 -1
- package/dist/components/statusbadge/StatusBadge.stories.d.ts +1 -0
- package/dist/components/statusbadge/StatusBadge.stories.d.ts.map +1 -1
- package/dist/components/statusbadge/StatusBadge.stories.js +1 -0
- package/dist/components/statusbadge/StatusBadge.svelte +2 -2
- package/dist/components/statusdot/StatusDot.js +2 -2
- package/dist/components/statusdot/StatusDot.js.map +1 -1
- package/dist/components/statusdot/StatusDot.stories.d.ts +1 -0
- package/dist/components/statusdot/StatusDot.stories.d.ts.map +1 -1
- package/dist/components/statusdot/StatusDot.stories.js +1 -0
- package/dist/components/statusdot/StatusDot.svelte +5 -2
- package/dist/components/statusmessage/StatusMessage.js +2 -2
- package/dist/components/statusmessage/StatusMessage.js.map +1 -1
- package/dist/components/statusmessage/StatusMessage.stories.d.ts +1 -0
- package/dist/components/statusmessage/StatusMessage.stories.d.ts.map +1 -1
- package/dist/components/statusmessage/StatusMessage.stories.js +1 -0
- package/dist/components/statusmessage/StatusMessage.svelte +2 -2
- package/dist/components/statusnotification/StatusNotification.js +2 -2
- package/dist/components/statusnotification/StatusNotification.js.map +1 -1
- package/dist/components/statusnotification/StatusNotification.stories.d.ts +4 -0
- package/dist/components/statusnotification/StatusNotification.stories.d.ts.map +1 -1
- package/dist/components/statusnotification/StatusNotification.stories.js +4 -0
- package/dist/components/statusnotification/StatusNotification.svelte +2 -1
- package/dist/components/steppercompact/StepperCompact.js +2 -2
- package/dist/components/steppercompact/StepperCompact.stories.d.ts +1 -0
- package/dist/components/steppercompact/StepperCompact.stories.d.ts.map +1 -1
- package/dist/components/steppercompact/StepperCompact.stories.js +1 -0
- package/dist/components/tab/Tab.js +1 -1
- package/dist/components/tab/Tab.js.map +1 -1
- package/dist/components/tab/Tab.svelte +0 -1
- package/dist/components/tab/Tab.svelte.d.ts +0 -1
- package/dist/components/tab/Tab.svelte.d.ts.map +1 -1
- package/dist/components/tabs/Tabs.js +2 -2
- package/dist/components/tabs/Tabs.stories.d.ts +3 -0
- package/dist/components/tabs/Tabs.stories.d.ts.map +1 -1
- package/dist/components/tabs/Tabs.stories.js +3 -0
- package/dist/components/tag/Tag.js +2 -2
- package/dist/components/tag/Tag.js.map +1 -1
- package/dist/components/tag/Tag.stories.d.ts +1 -0
- package/dist/components/tag/Tag.stories.d.ts.map +1 -1
- package/dist/components/tag/Tag.stories.js +1 -0
- package/dist/components/tag/Tag.svelte +15 -4
- package/dist/components/tag/Tag.svelte.d.ts.map +1 -1
- package/dist/components/textarea/Textarea.js +2 -2
- package/dist/components/textarea/Textarea.js.map +1 -1
- package/dist/components/textarea/Textarea.stories.d.ts +1 -0
- package/dist/components/textarea/Textarea.stories.d.ts.map +1 -1
- package/dist/components/textarea/Textarea.stories.js +1 -0
- package/dist/components/textarea/Textarea.svelte +2 -0
- package/dist/components/textarea/Textarea.svelte.d.ts.map +1 -1
- package/dist/components/textinput/Textinput.js +2 -2
- package/dist/components/textinput/Textinput.js.map +1 -1
- package/dist/components/textinput/Textinput.stories.d.ts +1 -0
- package/dist/components/textinput/Textinput.stories.d.ts.map +1 -1
- package/dist/components/textinput/Textinput.stories.js +1 -0
- package/dist/components/textinput/Textinput.svelte +2 -0
- package/dist/components/textinput/Textinput.svelte.d.ts.map +1 -1
- package/dist/components/toaster/Toaster.js +2 -2
- package/dist/components/toaster/Toaster.js.map +1 -1
- package/dist/components/toaster/Toaster.stories.d.ts +3 -0
- package/dist/components/toaster/Toaster.stories.d.ts.map +1 -1
- package/dist/components/toaster/Toaster.stories.js +3 -0
- package/dist/components/toaster/Toaster.svelte +2 -0
- package/dist/components/toaster/Toaster.svelte.d.ts.map +1 -1
- package/dist/components/toggle/Toggle.js +2 -2
- package/dist/components/toggle/Toggle.js.map +1 -1
- package/dist/components/toggle/Toggle.stories.d.ts +1 -0
- package/dist/components/toggle/Toggle.stories.d.ts.map +1 -1
- package/dist/components/toggle/Toggle.stories.js +1 -0
- package/dist/components/toggle/Toggle.svelte +18 -2
- package/dist/components/toggle/Toggle.svelte.d.ts.map +1 -1
- package/dist/components/togglegroup/ToggleGroup.js +2 -2
- package/dist/components/togglegroup/ToggleGroup.stories.d.ts +1 -0
- package/dist/components/togglegroup/ToggleGroup.stories.d.ts.map +1 -1
- package/dist/components/togglegroup/ToggleGroup.stories.js +1 -0
- package/dist/components/tooltip/Tooltip.js +2 -2
- package/dist/components/tooltip/Tooltip.js.map +1 -1
- package/dist/components/tooltip/Tooltip.stories.d.ts +1 -0
- package/dist/components/tooltip/Tooltip.stories.d.ts.map +1 -1
- package/dist/components/tooltip/Tooltip.stories.js +1 -0
- package/dist/components/tooltip/Tooltip.svelte +2 -1
- package/dist/custom-element.js +3 -3
- package/dist/custom-element.js.map +1 -1
- 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/main.d.ts +4 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +4 -1
- package/dist/slot.js +1 -1
- package/dist/svelte-component.js +1 -1
- package/dist/this.js +1 -1
- package/dist/this.js.map +1 -1
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/select/Select.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,OAAO,EAAE,KAAK,CAAC;QACb,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;QACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB,CAAC,CAAC;IACH;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC;IACjB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;
|
|
1
|
+
{"version":3,"file":"Select.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/select/Select.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,OAAO,EAAE,KAAK,CAAC;QACb,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;QACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB,CAAC,CAAC;IACH;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC;IACjB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAkDH,QAAA,MAAM,MAAM,gDAAwC,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# `m-star-rating`
|
|
2
|
+
|
|
3
|
+
A Star rating visually represents a score or evaluation and can be used to display a rating or allow users to rate an item, such as a product or service. It serves two main purposes: collecting user feedback by enabling individuals to express their experience and providing social proof by displaying ratings from other users to assist decision-making. Rating Stars are commonly found in e-commerce, review systems, and feedback interfaces, offering a quick and intuitive way to assess quality or satisfaction.
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
| Name | Description | Type | Default |
|
|
8
|
+
|------|-------------|------|---------|
|
|
9
|
+
| `rating*` | The current rating value of the component. | `number` | `$bindable()` |
|
|
10
|
+
| `readonly` | Determines whether the rating is interactive or read-only.
|
|
11
|
+
When true, all user interactions (click, hover, keyboard) are disabled.
|
|
12
|
+
Automatically set to true when `compact`, `href`, or `information` are provided. | `boolean` | |
|
|
13
|
+
| `size` | Defines the visual size of the star icons and the accompanying text. | `'s'` `'m'` `'l'` | `m` |
|
|
14
|
+
| `compact` | Enables a compact display mode that shows only one star instead of five.
|
|
15
|
+
Typically used for summaries or quick visual cues.
|
|
16
|
+
When enabled, the component automatically becomes read-only. | `boolean` | |
|
|
17
|
+
| `appearance` | Specifies the color scheme of the stars. | `'standard'` `'accent'` | `standard` |
|
|
18
|
+
| `text` | Optional text displayed next to the star rating.
|
|
19
|
+
If provided, the component automatically becomes read-only. | `string` | |
|
|
20
|
+
| `href` | URL for the link. | `string` | |
|
|
21
|
+
| `target` | Where to open the link. | `'_self'` `'_blank'` `'_parent'` `'_top'` | |
|
|
22
|
+
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{E as de,F as me,N as ge,G as ue,H as he,I as _e,J as pe,K as F,L as we,M as u,O as Q,P as ye,Q as xe,R as q,S as V,c as A,p as L,b as n,A as O,t as B,h as x,i as C,j as i,l as P,m as j,a as ze,B as Ne,C as U,n as v,D as y,f as G,e as D,s as Ee,d as W,g as be,x as Se,y as X}from"../../custom-element.js";import{B as ke,i as Me}from"../../if.js";import{e as Ae}from"../../each.js";import{c as Le}from"../../svelte-component.js";import{s as z,b as K,a as H}from"../../attributes.js";import{c as Be}from"../../custom-element-forward-events.js";import"../../legacy.js";function Ce(g,t,l,o,c,f){let d=u;u&&Q();var s=null;u&&F.nodeType===ye&&(s=F,Q());var a=u?F:g,e=new ke(a,!1);de(()=>{const m=t()||null;var E=m==="svg"?ge:null;if(m===null){e.ensure(null,null);return}return e.ensure(m,h=>{if(m){if(s=u?s:E?document.createElementNS(E,m):document.createElement(m),ue(s,s),o){u&&xe(m)&&s.append(document.createComment(""));var N=u?we(s):s.appendChild(he());u&&(N===null?q(!1):V(N)),o(s,N)}_e.nodes_end=s,h.before(s)}u&&V(h)}),()=>{}},me),pe(()=>{}),d&&(q(!0),V(a))}var Re=O('<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24px" height="24px"><path fill-rule="evenodd" d="M12 3a1 1 0 0 1 .916.598l2.178 4.969 5.055.76a1 1 0 0 1 .504 1.747l-3.923 3.378 1.435 5.286a1 1 0 0 1-1.509 1.101L12 17.823 7.344 20.84a1 1 0 0 1-1.509-1.101l1.435-5.286-3.923-3.379a1 1 0 0 1 .504-1.746l5.055-.76 2.178-4.969A1 1 0 0 1 12 3m0 3.49-1.484 3.385-.222.505-.545.083-3.445.518 2.749 2.366.477.412-.165.608-.915 3.373 3.006-1.948.544-.352.544.352 3.006 1.948-.915-3.373-.165-.608.477-.412 2.749-2.367-3.445-.517-.545-.083-.222-.505z"></path></svg>');function Y(g,t){L(t,!1);let l=n(t,"id",12,void 0),o=n(t,"style",12,void 0),c=n(t,"className",12,void 0),f=n(t,"fill",12,void 0),d=n(t,"size",12,"1.5rem");var s={get id(){return l()},set id(e){l(e),i()},get style(){return o()},set style(e){o(e),i()},get className(){return c()},set className(e){c(e),i()},get fill(){return f()},set fill(e){f(e),i()},get size(){return d()},set size(e){d(e),i()}},a=Re();return B(()=>{z(a,"id",l()),K(a,o()),P(a,0,j(c())),z(a,"fill",f())}),x(g,a),C(s)}customElements.define("star-24",A(Y,{id:{},style:{},className:{},fill:{},size:{}},[],[],!1));var Te=O('<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24px" height="24px"><path fill-rule="evenodd" d="M12.916 3.598a1 1 0 0 0-1.832 0L8.906 8.567l-5.055.76a1 1 0 0 0-.504 1.747l3.923 3.378-1.435 5.286a1 1 0 0 0 1.509 1.101L12 17.823l4.656 3.016a1 1 0 0 0 1.51-1.101l-1.436-5.286 3.923-3.379a1 1 0 0 0-.504-1.746l-5.055-.76z"></path></svg>');function Z(g,t){L(t,!1);let l=n(t,"id",12,void 0),o=n(t,"style",12,void 0),c=n(t,"className",12,void 0),f=n(t,"fill",12,void 0),d=n(t,"size",12,"1.5rem");var s={get id(){return l()},set id(e){l(e),i()},get style(){return o()},set style(e){o(e),i()},get className(){return c()},set className(e){c(e),i()},get fill(){return f()},set fill(e){f(e),i()},get size(){return d()},set size(e){d(e),i()}},a=Te();return B(()=>{z(a,"id",l()),K(a,o()),P(a,0,j(c())),z(a,"fill",f())}),x(g,a),C(s)}customElements.define("star-filled-24",A(Z,{id:{},style:{},className:{},fill:{},size:{}},[],[],!1));var Fe=O('<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24px" height="24px"><path fill-rule="evenodd" d="M12.916 3.598a1 1 0 0 0-1.832 0L8.906 8.567l-5.055.76a1 1 0 0 0-.504 1.747l3.923 3.378-1.435 5.286a1 1 0 0 0 1.509 1.101L12 17.823l4.656 3.016a1 1 0 0 0 1.51-1.101l-1.436-5.286 3.923-3.379a1 1 0 0 0-.504-1.746l-5.055-.76zM12 6.49v8.95l.544.352 3.006 1.948-.915-3.373-.165-.608.477-.411 2.749-2.367-3.445-.518-.545-.082-.222-.506z"></path></svg>');function $(g,t){L(t,!1);let l=n(t,"id",12,void 0),o=n(t,"style",12,void 0),c=n(t,"className",12,void 0),f=n(t,"fill",12,void 0),d=n(t,"size",12,"1.5rem");var s={get id(){return l()},set id(e){l(e),i()},get style(){return o()},set style(e){o(e),i()},get className(){return c()},set className(e){c(e),i()},get fill(){return f()},set fill(e){f(e),i()},get size(){return d()},set size(e){d(e),i()}},a=Fe();return B(()=>{z(a,"id",l()),K(a,o()),P(a,0,j(c())),z(a,"fill",f())}),x(g,a),C(s)}customElements.define("star-half-24",A($,{id:{},style:{},className:{},fill:{},size:{}},[],[],!1));var Ve=G("<span><!></span>"),De=G('<span class="mc-star-rating__info svelte-17npafv"> </span>'),He=G("<div></div> <!>",1);const Oe={hash:"svelte-17npafv",code:`/**
|
|
2
|
+
* Do not edit directly, this file was auto-generated.
|
|
3
|
+
*/.mc-star-rating.svelte-17npafv {display:inline-flex;align-items:center;gap:0.5rem;}.mc-star-rating--standard.svelte-17npafv .mc-star-rating__icon:where(.svelte-17npafv) {fill:var(--star-rating-color-icon-standard, #000000);}.mc-star-rating--accent.svelte-17npafv .mc-star-rating__icon:where(.svelte-17npafv) {fill:var(--star-rating-color-icon-accent, #ea7315);}.mc-star-rating--slider.svelte-17npafv {cursor:pointer;}.mc-star-rating--link.svelte-17npafv {text-decoration:none;cursor:pointer;}.mc-star-rating--link.svelte-17npafv:not(:hover) .mc-star-rating__info:where(.svelte-17npafv) {text-decoration:underline;}.mc-star-rating--s.svelte-17npafv .mc-star-rating__icon:where(.svelte-17npafv) {width:1.25rem;height:1.25rem;}.mc-star-rating--s.svelte-17npafv .mc-star-rating__info:where(.svelte-17npafv) {font-size:var(--font-size-100, 0.875rem);}.mc-star-rating--m.svelte-17npafv .mc-star-rating__icon:where(.svelte-17npafv) {width:1.5rem;height:1.5rem;}.mc-star-rating--m.svelte-17npafv .mc-star-rating__info:where(.svelte-17npafv) {font-size:var(--font-size-150, 1rem);}.mc-star-rating--l.svelte-17npafv .mc-star-rating__icon:where(.svelte-17npafv) {width:2rem;height:2rem;}.mc-star-rating--l.svelte-17npafv .mc-star-rating__info:where(.svelte-17npafv) {font-size:var(--font-size-200, 1.125rem);}.mc-star-rating__wrapper.svelte-17npafv {display:flex;align-items:center;}.mc-star-rating__info.svelte-17npafv {font-weight:var(--font-weight-medium, 600);line-height:var(--line-height-s, 1.3);color:var(--star-rating-color-text, #000000);}.mc-star-rating__icon.svelte-17npafv svg {height:100%;width:100%;}`};function Pe(g,t){L(t,!0),ze(g,Oe);let l=n(t,"rating",15),o=n(t,"readonly",7),c=n(t,"size",7,"m"),f=n(t,"compact",7),d=n(t,"appearance",7,"standard"),s=n(t,"text",7),a=n(t,"href",7),e=n(t,"target",7),m=Se(null);const E=y(()=>a()?"a":"div"),h=y(()=>[o(),f(),a(),s()].some(Boolean)),N=y(()=>({"mc-star-rating":!0,"mc-star-rating--link":a(),"mc-star-rating--slider":!v(h),[`mc-star-rating--${c()}`]:c(),[`mc-star-rating--${d()}`]:d()})),R=y(()=>v(m)??l()),b=y(()=>f()?1:5);function ee(r){return f()||v(R)>=r+1?Z:v(h)&&v(R)>=r+.5?$:Y}function te(r){X(m,r+1)}function I(){X(m,null)}function ae(r){l(r+1)}function re(r){const S=r.key;let _=Math.floor(l());if(S==="ArrowRight")_=Math.min(v(b),_+1);else if(S==="ArrowLeft")_=Math.max(1,_-1);else return;l(_),r.preventDefault()}const se=y(()=>v(h)?{tabindex:-1}:{onkeydown:re,onmouseleave:I,onblur:I,tabindex:0,"aria-valuemin":0,"aria-valuemax":v(b),"aria-valuenow":l(),"aria-readonly":!1});var ne={get rating(){return l()},set rating(r){l(r),i()},get readonly(){return o()},set readonly(r){o(r),i()},get size(){return c()},set size(r="m"){c(r),i()},get compact(){return f()},set compact(r){f(r),i()},get appearance(){return d()},set appearance(r="standard"){d(r),i()},get text(){return s()},set text(r){s(r),i()},get href(){return a()},set href(r){a(r),i()},get target(){return e()},set target(r){e(r),i()}},J=Ne(),ie=U(J);return Ce(ie,()=>v(E),!1,(r,S)=>{H(r,()=>({href:a(),target:e(),class:v(N)}),void 0,void 0,void 0,"svelte-17npafv");var _=He(),k=U(_);H(k,()=>({class:"mc-star-rating__wrapper",role:v(h)?"img":"slider","aria-label":`Note ${v(R)} sur ${v(b)}`,...v(se)}),void 0,void 0,void 0,"svelte-17npafv"),Ae(k,20,()=>Array.from({length:v(b)}).keys(),p=>p,(p,w)=>{const T=y(()=>ee(w));var M=Ve();H(M,()=>({class:"mc-star-rating__icon",...v(h)?{}:{onmousemove:()=>te(w),onclick:()=>ae(w)}}),void 0,void 0,void 0,"svelte-17npafv");var fe=W(M);Le(fe,()=>v(T),(ce,ve)=>{ve(ce,{})}),D(M),x(p,M)}),D(k);var le=Ee(k,2);{var oe=p=>{var w=De(),T=W(w,!0);D(w),B(()=>be(T,s()||a())),x(p,w)};Me(le,p=>{(s()||a())&&p(oe)})}x(S,_)}),x(g,J),C(ne)}customElements.define("m-star-rating",A(Pe,{rating:{},readonly:{},size:{},compact:{},appearance:{},text:{},href:{},target:{}},[],[],!0,Be));
|
|
4
|
+
//# sourceMappingURL=StarRating.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StarRating.js","sources":["../../../node_modules/svelte/src/internal/client/dom/blocks/svelte-element.js","../../../node_modules/@mozaic-ds/icons-svelte/dist/components/Star24/Star24.svelte","../../../node_modules/@mozaic-ds/icons-svelte/dist/components/StarFilled24/StarFilled24.svelte","../../../node_modules/@mozaic-ds/icons-svelte/dist/components/StarHalf24/StarHalf24.svelte","../../../src/components/starrating/StarRating.svelte"],"sourcesContent":["/** @import { Effect, TemplateNode } from '#client' */\nimport { FILENAME, NAMESPACE_SVG } from '../../../../constants.js';\nimport {\n\thydrate_next,\n\thydrate_node,\n\thydrating,\n\tset_hydrate_node,\n\tset_hydrating\n} from '../hydration.js';\nimport { create_text, get_first_child } from '../operations.js';\nimport { block, teardown } from '../../reactivity/effects.js';\nimport { set_should_intro } from '../../render.js';\nimport { current_each_item, set_current_each_item } from './each.js';\nimport { active_effect } from '../../runtime.js';\nimport { component_context, dev_stack } from '../../context.js';\nimport { DEV } from 'esm-env';\nimport { EFFECT_TRANSPARENT, ELEMENT_NODE } from '#client/constants';\nimport { assign_nodes } from '../template.js';\nimport { is_raw_text_element } from '../../../../utils.js';\nimport { BranchManager } from './branches.js';\n\n/**\n * @param {Comment | Element} node\n * @param {() => string} get_tag\n * @param {boolean} is_svg\n * @param {undefined | ((element: Element, anchor: Node | null) => void)} render_fn,\n * @param {undefined | (() => string)} get_namespace\n * @param {undefined | [number, number]} location\n * @returns {void}\n */\nexport function element(node, get_tag, is_svg, render_fn, get_namespace, location) {\n\tlet was_hydrating = hydrating;\n\n\tif (hydrating) {\n\t\thydrate_next();\n\t}\n\n\tvar filename = DEV && location && component_context?.function[FILENAME];\n\n\t/** @type {null | Element} */\n\tvar element = null;\n\n\tif (hydrating && hydrate_node.nodeType === ELEMENT_NODE) {\n\t\telement = /** @type {Element} */ (hydrate_node);\n\t\thydrate_next();\n\t}\n\n\tvar anchor = /** @type {TemplateNode} */ (hydrating ? hydrate_node : node);\n\n\t/**\n\t * The keyed `{#each ...}` item block, if any, that this element is inside.\n\t * We track this so we can set it when changing the element, allowing any\n\t * `animate:` directive to bind itself to the correct block\n\t */\n\tvar each_item_block = current_each_item;\n\n\tvar branches = new BranchManager(anchor, false);\n\n\tblock(() => {\n\t\tconst next_tag = get_tag() || null;\n\t\tvar ns = get_namespace ? get_namespace() : is_svg || next_tag === 'svg' ? NAMESPACE_SVG : null;\n\n\t\tif (next_tag === null) {\n\t\t\tbranches.ensure(null, null);\n\t\t\tset_should_intro(true);\n\t\t\treturn;\n\t\t}\n\n\t\tbranches.ensure(next_tag, (anchor) => {\n\t\t\t// See explanation of `each_item_block` above\n\t\t\tvar previous_each_item = current_each_item;\n\t\t\tset_current_each_item(each_item_block);\n\n\t\t\tif (next_tag) {\n\t\t\t\telement = hydrating\n\t\t\t\t\t? /** @type {Element} */ (element)\n\t\t\t\t\t: ns\n\t\t\t\t\t\t? document.createElementNS(ns, next_tag)\n\t\t\t\t\t\t: document.createElement(next_tag);\n\n\t\t\t\tif (DEV && location) {\n\t\t\t\t\t// @ts-expect-error\n\t\t\t\t\telement.__svelte_meta = {\n\t\t\t\t\t\tparent: dev_stack,\n\t\t\t\t\t\tloc: {\n\t\t\t\t\t\t\tfile: filename,\n\t\t\t\t\t\t\tline: location[0],\n\t\t\t\t\t\t\tcolumn: location[1]\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tassign_nodes(element, element);\n\n\t\t\t\tif (render_fn) {\n\t\t\t\t\tif (hydrating && is_raw_text_element(next_tag)) {\n\t\t\t\t\t\t// prevent hydration glitches\n\t\t\t\t\t\telement.append(document.createComment(''));\n\t\t\t\t\t}\n\n\t\t\t\t\t// If hydrating, use the existing ssr comment as the anchor so that the\n\t\t\t\t\t// inner open and close methods can pick up the existing nodes correctly\n\t\t\t\t\tvar child_anchor = /** @type {TemplateNode} */ (\n\t\t\t\t\t\thydrating ? get_first_child(element) : element.appendChild(create_text())\n\t\t\t\t\t);\n\n\t\t\t\t\tif (hydrating) {\n\t\t\t\t\t\tif (child_anchor === null) {\n\t\t\t\t\t\t\tset_hydrating(false);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tset_hydrate_node(child_anchor);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// `child_anchor` is undefined if this is a void element, but we still\n\t\t\t\t\t// need to call `render_fn` in order to run actions etc. If the element\n\t\t\t\t\t// contains children, it's a user error (which is warned on elsewhere)\n\t\t\t\t\t// and the DOM will be silently discarded\n\t\t\t\t\trender_fn(element, child_anchor);\n\t\t\t\t}\n\n\t\t\t\t// we do this after calling `render_fn` so that child effects don't override `nodes.end`\n\t\t\t\t/** @type {Effect} */ (active_effect).nodes_end = element;\n\n\t\t\t\tanchor.before(element);\n\t\t\t}\n\n\t\t\tset_current_each_item(previous_each_item);\n\n\t\t\tif (hydrating) {\n\t\t\t\tset_hydrate_node(anchor);\n\t\t\t}\n\t\t});\n\n\t\t// revert to the default state after the effect has been created\n\t\tset_should_intro(true);\n\n\t\treturn () => {\n\t\t\tif (next_tag) {\n\t\t\t\t// if we're in this callback because we're re-running the effect,\n\t\t\t\t// disable intros (unless no element is currently displayed)\n\t\t\t\tset_should_intro(false);\n\t\t\t}\n\t\t};\n\t}, EFFECT_TRANSPARENT);\n\n\tteardown(() => {\n\t\tset_should_intro(true);\n\t});\n\n\tif (was_hydrating) {\n\t\tset_hydrating(true);\n\t\tset_hydrate_node(anchor);\n\t}\n}\n","<svelte:options customElement={{ tag: 'star-24', shadow: 'none' }} />\n<script>\n export let id = undefined;\n export let style = undefined;\n export let className = undefined;\n export let fill = undefined;\n export let size = \"1.5rem\";\n</script>\n\n<svg aria-hidden=\"true\" id={id} style={style} class={className} fill={fill} xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"24px\" height=\"24px\"><path fill-rule=\"evenodd\" d=\"M12 3a1 1 0 0 1 .916.598l2.178 4.969 5.055.76a1 1 0 0 1 .504 1.747l-3.923 3.378 1.435 5.286a1 1 0 0 1-1.509 1.101L12 17.823 7.344 20.84a1 1 0 0 1-1.509-1.101l1.435-5.286-3.923-3.379a1 1 0 0 1 .504-1.746l5.055-.76 2.178-4.969A1 1 0 0 1 12 3m0 3.49-1.484 3.385-.222.505-.545.083-3.445.518 2.749 2.366.477.412-.165.608-.915 3.373 3.006-1.948.544-.352.544.352 3.006 1.948-.915-3.373-.165-.608.477-.412 2.749-2.367-3.445-.517-.545-.083-.222-.505z\"/></svg>","<svelte:options customElement={{ tag: 'star-filled-24', shadow: 'none' }} />\n<script>\n export let id = undefined;\n export let style = undefined;\n export let className = undefined;\n export let fill = undefined;\n export let size = \"1.5rem\";\n</script>\n\n<svg aria-hidden=\"true\" id={id} style={style} class={className} fill={fill} xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"24px\" height=\"24px\"><path fill-rule=\"evenodd\" d=\"M12.916 3.598a1 1 0 0 0-1.832 0L8.906 8.567l-5.055.76a1 1 0 0 0-.504 1.747l3.923 3.378-1.435 5.286a1 1 0 0 0 1.509 1.101L12 17.823l4.656 3.016a1 1 0 0 0 1.51-1.101l-1.436-5.286 3.923-3.379a1 1 0 0 0-.504-1.746l-5.055-.76z\"/></svg>","<svelte:options customElement={{ tag: 'star-half-24', shadow: 'none' }} />\n<script>\n export let id = undefined;\n export let style = undefined;\n export let className = undefined;\n export let fill = undefined;\n export let size = \"1.5rem\";\n</script>\n\n<svg aria-hidden=\"true\" id={id} style={style} class={className} fill={fill} xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"24px\" height=\"24px\"><path fill-rule=\"evenodd\" d=\"M12.916 3.598a1 1 0 0 0-1.832 0L8.906 8.567l-5.055.76a1 1 0 0 0-.504 1.747l3.923 3.378-1.435 5.286a1 1 0 0 0 1.509 1.101L12 17.823l4.656 3.016a1 1 0 0 0 1.51-1.101l-1.436-5.286 3.923-3.379a1 1 0 0 0-.504-1.746l-5.055-.76zM12 6.49v8.95l.544.352 3.006 1.948-.915-3.373-.165-.608.477-.411 2.749-2.367-3.445-.518-.545-.082-.222-.506z\"/></svg>","<svelte:options\n customElement={{\n tag: 'm-star-rating',\n extend: customElementForwardEvents,\n }}\n/>\n\n<script lang=\"ts\">\n import { customElementForwardEvents } from '../../utils';\n import Star24 from '@mozaic-ds/icons-svelte/svelte/Star24/Star24.svelte';\n import StarFilled24 from '@mozaic-ds/icons-svelte/svelte/StarFilled24/StarFilled24.svelte';\n import StarHalf24 from '@mozaic-ds/icons-svelte/svelte/StarHalf24/StarHalf24.svelte';\n /**\n * A Star rating visually represents a score or evaluation and can be used to display a rating or allow users to rate an item, such as a product or service. It serves two main purposes: collecting user feedback by enabling individuals to express their experience and providing social proof by displaying ratings from other users to assist decision-making. Rating Stars are commonly found in e-commerce, review systems, and feedback interfaces, offering a quick and intuitive way to assess quality or satisfaction.\n */\n interface Props {\n /**\n * The current rating value of the component.\n */\n rating: number;\n /**\n * Determines whether the rating is interactive or read-only.\n * When true, all user interactions (click, hover, keyboard) are disabled.\n * Automatically set to true when `compact`, `href`, or `information` are provided.\n */\n readonly?: boolean;\n /**\n * Defines the visual size of the star icons and the accompanying text.\n */\n size?: 's' | 'm' | 'l';\n /**\n * Enables a compact display mode that shows only one star instead of five.\n * Typically used for summaries or quick visual cues.\n * When enabled, the component automatically becomes read-only.\n */\n compact?: boolean;\n /**\n * Specifies the color scheme of the stars.\n */\n appearance?: 'standard' | 'accent';\n /**\n * Optional text displayed next to the star rating.\n * If provided, the component automatically becomes read-only.\n */\n text?: string;\n /**\n * URL for the link.\n */\n href?: string;\n /**\n * Where to open the link.\n */\n target?: '_self' | '_blank' | '_parent' | '_top';\n }\n\n let {\n rating = $bindable(),\n readonly,\n size = 'm',\n compact,\n appearance = 'standard',\n text,\n href,\n target,\n }: Props = $props();\n\n let hoverValue: number | null = $state(null);\n const rootTag = $derived(href ? 'a' : 'div');\n\n const isReadonly = $derived([readonly, compact, href, text].some(Boolean));\n\n const classObject = $derived({\n 'mc-star-rating': true,\n 'mc-star-rating--link': href,\n 'mc-star-rating--slider': !isReadonly,\n [`mc-star-rating--${size}`]: size,\n [`mc-star-rating--${appearance}`]: appearance,\n });\n\n const displayValue = $derived(hoverValue ?? rating);\n const maxValue = $derived(compact ? 1 : 5);\n\n function getStarComponent(index: number) {\n if (compact || displayValue >= index + 1) {\n return StarFilled24;\n } else if (isReadonly && displayValue >= index + 0.5) {\n return StarHalf24;\n } else {\n return Star24;\n }\n }\n\n function onHover(index: number) {\n hoverValue = index + 1;\n }\n\n function clearHover() {\n hoverValue = null;\n }\n\n function onClick(index: number) {\n rating = index + 1;\n }\n\n function onKeydown(e: KeyboardEvent) {\n const key = e.key;\n let newValue = Math.floor(rating);\n\n if (key === 'ArrowRight') {\n newValue = Math.min(maxValue, newValue + 1);\n } else if (key === 'ArrowLeft') {\n newValue = Math.max(1, newValue - 1);\n } else return;\n\n rating = newValue;\n\n e.preventDefault();\n }\n\n const wrapperAttrs = $derived(\n isReadonly\n ? {\n tabindex: -1,\n }\n : {\n onkeydown: onKeydown,\n onmouseleave: clearHover,\n onblur: clearHover,\n tabindex: 0,\n 'aria-valuemin': 0,\n 'aria-valuemax': maxValue,\n 'aria-valuenow': rating,\n 'aria-readonly': false,\n },\n );\n</script>\n\n<svelte:element this={rootTag} {href} {target} class={classObject}>\n <div\n class=\"mc-star-rating__wrapper\"\n role={isReadonly ? 'img' : 'slider'}\n aria-label={`Note ${displayValue} sur ${maxValue}`}\n {...wrapperAttrs}\n >\n {#each Array.from({ length: maxValue }).keys() as index (index)}\n {@const Star = getStarComponent(index)}\n\n <span\n class=\"mc-star-rating__icon\"\n {...!isReadonly\n ? {\n onmousemove: () => onHover(index),\n onclick: () => onClick(index),\n }\n : {}}\n >\n <Star />\n </span>\n {/each}\n </div>\n\n {#if text || href}\n <span class=\"mc-star-rating__info\">\n {text || href}\n </span>\n {/if}\n</svelte:element>\n\n<style lang=\"scss\">\n @use '@mozaic-ds/styles/components/star-rating';\n\n .mc-star-rating__icon {\n :global(svg) {\n height: 100%;\n width: 100%;\n }\n }\n</style>\n"],"names":["element","node","get_tag","is_svg","render_fn","get_namespace","location","was_hydrating","hydrating","hydrate_next","hydrate_node","ELEMENT_NODE","anchor","branches","BranchManager","block","next_tag","ns","NAMESPACE_SVG","assign_nodes","is_raw_text_element","child_anchor","get_first_child","create_text","set_hydrating","set_hydrate_node","active_effect","EFFECT_TRANSPARENT","teardown","id","style","className","fill","size","rating","$.prop","$$props","readonly","compact","appearance","text","href","target","hoverValue","rootTag","$.derived","isReadonly","classObject","displayValue","$.get","maxValue","getStarComponent","index","StarFilled24","StarHalf24","Star24","onHover","clearHover","$.set","onClick","onKeydown","e","key","newValue","wrapperAttrs","$$element","$$anchor","$.each","div","Star","$.template_effect","$.set_text","text_1","$$render","consequent","customElementForwardEvents"],"mappings":"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","x_google_ignoreList":[0,1,2,3]}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { render, fireEvent } from '@testing-library/svelte';
|
|
2
|
+
import { describe, it, expect } from 'vitest';
|
|
3
|
+
import StarRating from './StarRating.svelte';
|
|
4
|
+
function getStars(container) {
|
|
5
|
+
return Array.from(container.querySelectorAll('.mc-star-rating__icon'));
|
|
6
|
+
}
|
|
7
|
+
function getValue(container) {
|
|
8
|
+
const wrapper = container.querySelector('.mc-star-rating__wrapper');
|
|
9
|
+
const value = wrapper?.getAttribute('aria-valuenow');
|
|
10
|
+
return Number(value);
|
|
11
|
+
}
|
|
12
|
+
describe('StarRating', () => {
|
|
13
|
+
it('renders 5 stars by default', () => {
|
|
14
|
+
const { container } = render(StarRating, { rating: 0 });
|
|
15
|
+
expect(getStars(container).length).toBe(5);
|
|
16
|
+
});
|
|
17
|
+
it('renders 1 star when compact mode is enabled', () => {
|
|
18
|
+
const { container } = render(StarRating, { rating: 0, compact: true });
|
|
19
|
+
expect(getStars(container).length).toBe(1);
|
|
20
|
+
});
|
|
21
|
+
it('does not allow x.5 value on input mode', async () => {
|
|
22
|
+
const { container } = render(StarRating, { rating: 3, readonly: false });
|
|
23
|
+
const wrapper = container.querySelector('.mc-star-rating__wrapper');
|
|
24
|
+
await fireEvent.keyDown(wrapper, { key: 'ArrowRight' });
|
|
25
|
+
const value = getValue(container);
|
|
26
|
+
expect(value).toBe(4);
|
|
27
|
+
});
|
|
28
|
+
it('allows x.5 values on readonly mode', () => {
|
|
29
|
+
const { container } = render(StarRating, { rating: 1.5, readonly: true });
|
|
30
|
+
const wrapper = container.querySelector('.mc-star-rating__wrapper');
|
|
31
|
+
const label = wrapper?.getAttribute('aria-label');
|
|
32
|
+
expect(label).toBe('Note 1.5 sur 5');
|
|
33
|
+
});
|
|
34
|
+
it('updates rating when clicking a star', async () => {
|
|
35
|
+
const { container } = render(StarRating, { rating: 2, readonly: false });
|
|
36
|
+
const stars = container.querySelectorAll('.mc-star-rating__icon');
|
|
37
|
+
await fireEvent.click(stars[0]);
|
|
38
|
+
const value = getValue(container);
|
|
39
|
+
expect(value).toBe(1);
|
|
40
|
+
});
|
|
41
|
+
it('updates rating when pressing ArrowRight', async () => {
|
|
42
|
+
const { container } = render(StarRating, { rating: 2, readonly: false });
|
|
43
|
+
const wrapper = container.querySelector('.mc-star-rating__wrapper');
|
|
44
|
+
await fireEvent.keyDown(wrapper, { key: 'ArrowRight' });
|
|
45
|
+
const value = getValue(container);
|
|
46
|
+
expect(value).toBe(3);
|
|
47
|
+
});
|
|
48
|
+
it('updates rating when pressing ArrowLeft', async () => {
|
|
49
|
+
const { container } = render(StarRating, { rating: 2, readonly: false });
|
|
50
|
+
const wrapper = container.querySelector('.mc-star-rating__wrapper');
|
|
51
|
+
await fireEvent.keyDown(wrapper, { key: 'ArrowLeft' });
|
|
52
|
+
const value = getValue(container);
|
|
53
|
+
expect(value).toBe(1);
|
|
54
|
+
});
|
|
55
|
+
it('does not update rating when other keys pressed', async () => {
|
|
56
|
+
const { container } = render(StarRating, { rating: 2, readonly: false });
|
|
57
|
+
const wrapper = container.querySelector('.mc-star-rating__wrapper');
|
|
58
|
+
await fireEvent.keyDown(wrapper, { key: 'ArrowUp' });
|
|
59
|
+
const value = getValue(container);
|
|
60
|
+
expect(value).toBe(2);
|
|
61
|
+
});
|
|
62
|
+
it('clears hover on mouseleave', async () => {
|
|
63
|
+
const { container } = render(StarRating, { rating: 2, readonly: false });
|
|
64
|
+
const wrapper = container.querySelector('.mc-star-rating__wrapper');
|
|
65
|
+
const stars = getStars(container);
|
|
66
|
+
await fireEvent.mouseMove(stars[0]);
|
|
67
|
+
expect(wrapper.getAttribute('aria-label')).toContain('1');
|
|
68
|
+
await fireEvent.mouseLeave(wrapper);
|
|
69
|
+
expect(wrapper.getAttribute('aria-label')).toContain('2');
|
|
70
|
+
});
|
|
71
|
+
it('clears hover on blur', async () => {
|
|
72
|
+
const { container } = render(StarRating, { rating: 3, readonly: false });
|
|
73
|
+
const wrapper = container.querySelector('.mc-star-rating__wrapper');
|
|
74
|
+
const stars = getStars(container);
|
|
75
|
+
await fireEvent.focus(wrapper);
|
|
76
|
+
await fireEvent.mouseMove(stars[1]);
|
|
77
|
+
expect(wrapper.getAttribute('aria-label')).toContain('2');
|
|
78
|
+
await fireEvent.blur(wrapper);
|
|
79
|
+
expect(wrapper.getAttribute('aria-label')).toContain('3');
|
|
80
|
+
});
|
|
81
|
+
it('renders info text when text is provided', () => {
|
|
82
|
+
const { container } = render(StarRating, {
|
|
83
|
+
rating: 3,
|
|
84
|
+
text: 'Note publique',
|
|
85
|
+
});
|
|
86
|
+
const info = container.querySelector('.mc-star-rating__info');
|
|
87
|
+
expect(info).not.toBeNull();
|
|
88
|
+
expect(info?.textContent).toBe('Note publique');
|
|
89
|
+
});
|
|
90
|
+
it('renders href text when provided and no text', () => {
|
|
91
|
+
const { container } = render(StarRating, { rating: 2, href: '/voir' });
|
|
92
|
+
const info = container.querySelector('.mc-star-rating__info');
|
|
93
|
+
expect(info).not.toBeNull();
|
|
94
|
+
expect(info?.textContent).toBe('/voir');
|
|
95
|
+
});
|
|
96
|
+
it('does not render info span when neither text nor href provided', () => {
|
|
97
|
+
const { container } = render(StarRating, { rating: 1 });
|
|
98
|
+
expect(container.querySelector('.mc-star-rating__info')).toBeNull();
|
|
99
|
+
});
|
|
100
|
+
it('renders <a> when href provided', () => {
|
|
101
|
+
const { container } = render(StarRating, { rating: 1, href: '#' });
|
|
102
|
+
expect(container.querySelector('a')).toBeTruthy();
|
|
103
|
+
});
|
|
104
|
+
it('renders <div> when no href provided', () => {
|
|
105
|
+
const { container } = render(StarRating, { rating: 1 });
|
|
106
|
+
expect(container.querySelector('div.mc-star-rating')).toBeTruthy();
|
|
107
|
+
});
|
|
108
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
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 AsInput: Story;
|
|
7
|
+
export declare const SizeM: Story;
|
|
8
|
+
export declare const SizeL: Story;
|
|
9
|
+
export declare const StandardAppearance: Story;
|
|
10
|
+
export declare const WithText: Story;
|
|
11
|
+
export declare const WithLink: Story;
|
|
12
|
+
export declare const CompactModeWithText: Story;
|
|
13
|
+
//# sourceMappingURL=StarRating.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StarRating.stories.d.ts","sourceRoot":"","sources":["../../../src/components/starrating/StarRating.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAIrE,QAAA,MAAM,IAAI,EAAE,IAoCX,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,KAAK,EAAE,KAInB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAInB,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,KAIhC,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAKtB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAMtB,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,KAMjC,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { ifDefined } from 'lit-html/directives/if-defined.js';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Indicators/Star Rating',
|
|
5
|
+
component: 'm-star-rating',
|
|
6
|
+
argTypes: {
|
|
7
|
+
appearance: {
|
|
8
|
+
control: 'inline-radio',
|
|
9
|
+
options: ['standard', 'accent'],
|
|
10
|
+
},
|
|
11
|
+
size: {
|
|
12
|
+
control: 'inline-radio',
|
|
13
|
+
options: ['s', 'm', 'l'],
|
|
14
|
+
},
|
|
15
|
+
target: {
|
|
16
|
+
control: 'radio',
|
|
17
|
+
options: ['_self', '_blank', '_parent', '_top'],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
args: {
|
|
21
|
+
rating: 3.5,
|
|
22
|
+
appearance: 'accent',
|
|
23
|
+
readonly: true,
|
|
24
|
+
},
|
|
25
|
+
render: (args) => {
|
|
26
|
+
return html `
|
|
27
|
+
<m-star-rating
|
|
28
|
+
rating=${args.rating}
|
|
29
|
+
.readonly=${ifDefined(args.readonly)}
|
|
30
|
+
size=${ifDefined(args.size)}
|
|
31
|
+
.compact=${ifDefined(args.compact)}
|
|
32
|
+
appearance=${ifDefined(args.appearance)}
|
|
33
|
+
text=${ifDefined(args.text)}
|
|
34
|
+
href=${ifDefined(args.href)}
|
|
35
|
+
target=${ifDefined(args.target)}
|
|
36
|
+
></m-star-rating>
|
|
37
|
+
`;
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
export default meta;
|
|
41
|
+
export const Default = {};
|
|
42
|
+
export const AsInput = {
|
|
43
|
+
args: {
|
|
44
|
+
readonly: false,
|
|
45
|
+
rating: 0,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
export const SizeM = {
|
|
49
|
+
args: {
|
|
50
|
+
size: 'm',
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
export const SizeL = {
|
|
54
|
+
args: {
|
|
55
|
+
size: 'l',
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
export const StandardAppearance = {
|
|
59
|
+
args: {
|
|
60
|
+
appearance: 'standard',
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
export const WithText = {
|
|
64
|
+
args: {
|
|
65
|
+
appearance: 'accent',
|
|
66
|
+
text: 'Additional text',
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
export const WithLink = {
|
|
70
|
+
args: {
|
|
71
|
+
appearance: 'accent',
|
|
72
|
+
text: 'Additional text',
|
|
73
|
+
href: '#',
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
export const CompactModeWithText = {
|
|
77
|
+
args: {
|
|
78
|
+
compact: true,
|
|
79
|
+
appearance: 'accent',
|
|
80
|
+
text: '(35)',
|
|
81
|
+
},
|
|
82
|
+
};
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
<svelte:options
|
|
2
|
+
customElement={{
|
|
3
|
+
tag: 'm-star-rating',
|
|
4
|
+
extend: customElementForwardEvents,
|
|
5
|
+
}}
|
|
6
|
+
/>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { customElementForwardEvents } from '../../utils';
|
|
10
|
+
import Star24 from '@mozaic-ds/icons-svelte/svelte/Star24/Star24.svelte';
|
|
11
|
+
import StarFilled24 from '@mozaic-ds/icons-svelte/svelte/StarFilled24/StarFilled24.svelte';
|
|
12
|
+
import StarHalf24 from '@mozaic-ds/icons-svelte/svelte/StarHalf24/StarHalf24.svelte';
|
|
13
|
+
/**
|
|
14
|
+
* A Star rating visually represents a score or evaluation and can be used to display a rating or allow users to rate an item, such as a product or service. It serves two main purposes: collecting user feedback by enabling individuals to express their experience and providing social proof by displaying ratings from other users to assist decision-making. Rating Stars are commonly found in e-commerce, review systems, and feedback interfaces, offering a quick and intuitive way to assess quality or satisfaction.
|
|
15
|
+
*/
|
|
16
|
+
interface Props {
|
|
17
|
+
/**
|
|
18
|
+
* The current rating value of the component.
|
|
19
|
+
*/
|
|
20
|
+
rating: number;
|
|
21
|
+
/**
|
|
22
|
+
* Determines whether the rating is interactive or read-only.
|
|
23
|
+
* When true, all user interactions (click, hover, keyboard) are disabled.
|
|
24
|
+
* Automatically set to true when `compact`, `href`, or `information` are provided.
|
|
25
|
+
*/
|
|
26
|
+
readonly?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Defines the visual size of the star icons and the accompanying text.
|
|
29
|
+
*/
|
|
30
|
+
size?: 's' | 'm' | 'l';
|
|
31
|
+
/**
|
|
32
|
+
* Enables a compact display mode that shows only one star instead of five.
|
|
33
|
+
* Typically used for summaries or quick visual cues.
|
|
34
|
+
* When enabled, the component automatically becomes read-only.
|
|
35
|
+
*/
|
|
36
|
+
compact?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Specifies the color scheme of the stars.
|
|
39
|
+
*/
|
|
40
|
+
appearance?: 'standard' | 'accent';
|
|
41
|
+
/**
|
|
42
|
+
* Optional text displayed next to the star rating.
|
|
43
|
+
* If provided, the component automatically becomes read-only.
|
|
44
|
+
*/
|
|
45
|
+
text?: string;
|
|
46
|
+
/**
|
|
47
|
+
* URL for the link.
|
|
48
|
+
*/
|
|
49
|
+
href?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Where to open the link.
|
|
52
|
+
*/
|
|
53
|
+
target?: '_self' | '_blank' | '_parent' | '_top';
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
let {
|
|
57
|
+
rating = $bindable(),
|
|
58
|
+
readonly,
|
|
59
|
+
size = 'm',
|
|
60
|
+
compact,
|
|
61
|
+
appearance = 'standard',
|
|
62
|
+
text,
|
|
63
|
+
href,
|
|
64
|
+
target,
|
|
65
|
+
}: Props = $props();
|
|
66
|
+
|
|
67
|
+
let hoverValue: number | null = $state(null);
|
|
68
|
+
const rootTag = $derived(href ? 'a' : 'div');
|
|
69
|
+
|
|
70
|
+
const isReadonly = $derived([readonly, compact, href, text].some(Boolean));
|
|
71
|
+
|
|
72
|
+
const classObject = $derived({
|
|
73
|
+
'mc-star-rating': true,
|
|
74
|
+
'mc-star-rating--link': href,
|
|
75
|
+
'mc-star-rating--slider': !isReadonly,
|
|
76
|
+
[`mc-star-rating--${size}`]: size,
|
|
77
|
+
[`mc-star-rating--${appearance}`]: appearance,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const displayValue = $derived(hoverValue ?? rating);
|
|
81
|
+
const maxValue = $derived(compact ? 1 : 5);
|
|
82
|
+
|
|
83
|
+
function getStarComponent(index: number) {
|
|
84
|
+
if (compact || displayValue >= index + 1) {
|
|
85
|
+
return StarFilled24;
|
|
86
|
+
} else if (isReadonly && displayValue >= index + 0.5) {
|
|
87
|
+
return StarHalf24;
|
|
88
|
+
} else {
|
|
89
|
+
return Star24;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function onHover(index: number) {
|
|
94
|
+
hoverValue = index + 1;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function clearHover() {
|
|
98
|
+
hoverValue = null;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function onClick(index: number) {
|
|
102
|
+
rating = index + 1;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function onKeydown(e: KeyboardEvent) {
|
|
106
|
+
const key = e.key;
|
|
107
|
+
let newValue = Math.floor(rating);
|
|
108
|
+
|
|
109
|
+
if (key === 'ArrowRight') {
|
|
110
|
+
newValue = Math.min(maxValue, newValue + 1);
|
|
111
|
+
} else if (key === 'ArrowLeft') {
|
|
112
|
+
newValue = Math.max(1, newValue - 1);
|
|
113
|
+
} else return;
|
|
114
|
+
|
|
115
|
+
rating = newValue;
|
|
116
|
+
|
|
117
|
+
e.preventDefault();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const wrapperAttrs = $derived(
|
|
121
|
+
isReadonly
|
|
122
|
+
? {
|
|
123
|
+
tabindex: -1,
|
|
124
|
+
}
|
|
125
|
+
: {
|
|
126
|
+
onkeydown: onKeydown,
|
|
127
|
+
onmouseleave: clearHover,
|
|
128
|
+
onblur: clearHover,
|
|
129
|
+
tabindex: 0,
|
|
130
|
+
'aria-valuemin': 0,
|
|
131
|
+
'aria-valuemax': maxValue,
|
|
132
|
+
'aria-valuenow': rating,
|
|
133
|
+
'aria-readonly': false,
|
|
134
|
+
},
|
|
135
|
+
);
|
|
136
|
+
</script>
|
|
137
|
+
|
|
138
|
+
<svelte:element this={rootTag} {href} {target} class={classObject}>
|
|
139
|
+
<div
|
|
140
|
+
class="mc-star-rating__wrapper"
|
|
141
|
+
role={isReadonly ? 'img' : 'slider'}
|
|
142
|
+
aria-label={`Note ${displayValue} sur ${maxValue}`}
|
|
143
|
+
{...wrapperAttrs}
|
|
144
|
+
>
|
|
145
|
+
{#each Array.from({ length: maxValue }).keys() as index (index)}
|
|
146
|
+
{@const Star = getStarComponent(index)}
|
|
147
|
+
|
|
148
|
+
<span
|
|
149
|
+
class="mc-star-rating__icon"
|
|
150
|
+
{...!isReadonly
|
|
151
|
+
? {
|
|
152
|
+
onmousemove: () => onHover(index),
|
|
153
|
+
onclick: () => onClick(index),
|
|
154
|
+
}
|
|
155
|
+
: {}}
|
|
156
|
+
>
|
|
157
|
+
<Star />
|
|
158
|
+
</span>
|
|
159
|
+
{/each}
|
|
160
|
+
</div>
|
|
161
|
+
|
|
162
|
+
{#if text || href}
|
|
163
|
+
<span class="mc-star-rating__info">
|
|
164
|
+
{text || href}
|
|
165
|
+
</span>
|
|
166
|
+
{/if}
|
|
167
|
+
</svelte:element>
|
|
168
|
+
|
|
169
|
+
<style>/**
|
|
170
|
+
* Do not edit directly, this file was auto-generated.
|
|
171
|
+
*/
|
|
172
|
+
.mc-star-rating {
|
|
173
|
+
display: inline-flex;
|
|
174
|
+
align-items: center;
|
|
175
|
+
gap: 0.5rem;
|
|
176
|
+
}
|
|
177
|
+
.mc-star-rating--standard .mc-star-rating__icon {
|
|
178
|
+
fill: var(--star-rating-color-icon-standard, #000000);
|
|
179
|
+
}
|
|
180
|
+
.mc-star-rating--accent .mc-star-rating__icon {
|
|
181
|
+
fill: var(--star-rating-color-icon-accent, #ea7315);
|
|
182
|
+
}
|
|
183
|
+
.mc-star-rating--slider {
|
|
184
|
+
cursor: pointer;
|
|
185
|
+
}
|
|
186
|
+
.mc-star-rating--link {
|
|
187
|
+
text-decoration: none;
|
|
188
|
+
cursor: pointer;
|
|
189
|
+
}
|
|
190
|
+
.mc-star-rating--link:not(:hover) .mc-star-rating__info {
|
|
191
|
+
text-decoration: underline;
|
|
192
|
+
}
|
|
193
|
+
.mc-star-rating--s .mc-star-rating__icon {
|
|
194
|
+
width: 1.25rem;
|
|
195
|
+
height: 1.25rem;
|
|
196
|
+
}
|
|
197
|
+
.mc-star-rating--s .mc-star-rating__info {
|
|
198
|
+
font-size: var(--font-size-100, 0.875rem);
|
|
199
|
+
}
|
|
200
|
+
.mc-star-rating--m .mc-star-rating__icon {
|
|
201
|
+
width: 1.5rem;
|
|
202
|
+
height: 1.5rem;
|
|
203
|
+
}
|
|
204
|
+
.mc-star-rating--m .mc-star-rating__info {
|
|
205
|
+
font-size: var(--font-size-150, 1rem);
|
|
206
|
+
}
|
|
207
|
+
.mc-star-rating--l .mc-star-rating__icon {
|
|
208
|
+
width: 2rem;
|
|
209
|
+
height: 2rem;
|
|
210
|
+
}
|
|
211
|
+
.mc-star-rating--l .mc-star-rating__info {
|
|
212
|
+
font-size: var(--font-size-200, 1.125rem);
|
|
213
|
+
}
|
|
214
|
+
.mc-star-rating__wrapper {
|
|
215
|
+
display: flex;
|
|
216
|
+
align-items: center;
|
|
217
|
+
}
|
|
218
|
+
.mc-star-rating__info {
|
|
219
|
+
font-weight: var(--font-weight-medium, 600);
|
|
220
|
+
line-height: var(--line-height-s, 1.3);
|
|
221
|
+
color: var(--star-rating-color-text, #000000);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.mc-star-rating__icon :global(svg) {
|
|
225
|
+
height: 100%;
|
|
226
|
+
width: 100%;
|
|
227
|
+
}</style>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Star rating visually represents a score or evaluation and can be used to display a rating or allow users to rate an item, such as a product or service. It serves two main purposes: collecting user feedback by enabling individuals to express their experience and providing social proof by displaying ratings from other users to assist decision-making. Rating Stars are commonly found in e-commerce, review systems, and feedback interfaces, offering a quick and intuitive way to assess quality or satisfaction.
|
|
3
|
+
*/
|
|
4
|
+
interface Props {
|
|
5
|
+
/**
|
|
6
|
+
* The current rating value of the component.
|
|
7
|
+
*/
|
|
8
|
+
rating: number;
|
|
9
|
+
/**
|
|
10
|
+
* Determines whether the rating is interactive or read-only.
|
|
11
|
+
* When true, all user interactions (click, hover, keyboard) are disabled.
|
|
12
|
+
* Automatically set to true when `compact`, `href`, or `information` are provided.
|
|
13
|
+
*/
|
|
14
|
+
readonly?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Defines the visual size of the star icons and the accompanying text.
|
|
17
|
+
*/
|
|
18
|
+
size?: 's' | 'm' | 'l';
|
|
19
|
+
/**
|
|
20
|
+
* Enables a compact display mode that shows only one star instead of five.
|
|
21
|
+
* Typically used for summaries or quick visual cues.
|
|
22
|
+
* When enabled, the component automatically becomes read-only.
|
|
23
|
+
*/
|
|
24
|
+
compact?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Specifies the color scheme of the stars.
|
|
27
|
+
*/
|
|
28
|
+
appearance?: 'standard' | 'accent';
|
|
29
|
+
/**
|
|
30
|
+
* Optional text displayed next to the star rating.
|
|
31
|
+
* If provided, the component automatically becomes read-only.
|
|
32
|
+
*/
|
|
33
|
+
text?: string;
|
|
34
|
+
/**
|
|
35
|
+
* URL for the link.
|
|
36
|
+
*/
|
|
37
|
+
href?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Where to open the link.
|
|
40
|
+
*/
|
|
41
|
+
target?: '_self' | '_blank' | '_parent' | '_top';
|
|
42
|
+
}
|
|
43
|
+
declare const StarRating: import("svelte").Component<Props, {}, "rating">;
|
|
44
|
+
type StarRating = ReturnType<typeof StarRating>;
|
|
45
|
+
export default StarRating;
|
|
46
|
+
//# sourceMappingURL=StarRating.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StarRating.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/starrating/StarRating.svelte.ts"],"names":[],"mappings":"AAQE;;GAEG;AACH,UAAU,KAAK;IACb;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IACvB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAC;IACnC;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;CAClD;AA0HH,QAAA,MAAM,UAAU,iDAAwC,CAAC;AACzD,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAChD,eAAe,UAAU,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as
|
|
1
|
+
import{c as v,p as m,a as h,b as l,f as p,r as y,d as u,s as k,t as w,h as _,i as x,j as b,e as n,g as $}from"../../custom-element.js";import{a as S}from"../../attributes.js";import{S as z}from"../statusdot/StatusDot.js";var D=p('<div><!> <span class="mc-status-badge__label svelte-1oceydf"> </span></div>');const j={hash:"svelte-1oceydf",code:`/**
|
|
2
2
|
* Do not edit directly, this file was auto-generated.
|
|
3
|
-
*/.mc-status-badge.svelte-1oceydf {background-color:var(--status-badge-color-background-info, #e1f3f9);border:var(--border-width-s, 0.0625rem) solid var(--status-badge-color-border-info, #a7d9ed);font-weight:var(--font-weight-regular, 400);font-size:var(--font-size-100, 0.875rem);display:inline-flex;align-items:center;gap:0.25rem;border-radius:var(--border-radius-s, 0.25rem);padding-right:0.5rem;padding-left:0.5rem;text-transform:lowercase;white-space:nowrap;min-height:1.5rem;}.mc-status-badge__label.svelte-1oceydf {color:var(--status-badge-color-label, #000000);}.mc-status-badge__label.svelte-1oceydf::first-letter {text-transform:uppercase;}.mc-status-badge--success.svelte-1oceydf {background-color:var(--status-badge-color-background-success, #ebf5de);border:var(--border-width-s, 0.0625rem) solid var(--status-badge-color-border-success, #c5e39e);}.mc-status-badge--error.svelte-1oceydf {background-color:var(--status-badge-color-background-error, #fdeaea);border:var(--border-width-s, 0.0625rem) solid var(--status-badge-color-border-error, #f8bcbb);}.mc-status-badge--warning.svelte-1oceydf {background-color:var(--status-badge-color-background-warning, #fdf1e8);border:var(--border-width-s, 0.0625rem) solid var(--status-badge-color-border-warning, #f8d2b3);}.mc-status-badge--neutral.svelte-1oceydf {background-color:var(--status-badge-color-background-neutral, #f2f2f2);border:var(--border-width-s, 0.0625rem) solid var(--status-badge-color-border-neutral, #cccccc);}.mc-status-dot.svelte-1oceydf {background-color:var(--status-dot-color-background-info, #0b96cc);height:0.5rem;width:0.5rem;border-radius:var(--border-radius-full, 100%);display:inline-block;}.mc-status-dot--s.svelte-1oceydf {height:0.25rem;width:0.25rem;}.mc-status-dot--l.svelte-1oceydf {height:1rem;width:1rem;}.mc-status-dot--success.svelte-1oceydf {background-color:var(--status-dot-color-background-success, #3f9e10);}.mc-status-dot--error.svelte-1oceydf {background-color:var(--status-dot-color-background-error, #ea302d);}.mc-status-dot--warning.svelte-1oceydf {background-color:var(--status-dot-color-background-warning, #ea7315);}.mc-status-dot--neutral.svelte-1oceydf {background-color:var(--status-dot-color-background-neutral, #808080);}`};function B(o,
|
|
3
|
+
*/.mc-status-badge.svelte-1oceydf {background-color:var(--status-badge-color-background-info, #e1f3f9);border:var(--border-width-s, 0.0625rem) solid var(--status-badge-color-border-info, #a7d9ed);font-weight:var(--font-weight-regular, 400);font-size:var(--font-size-100, 0.875rem);display:inline-flex;align-items:center;gap:0.25rem;border-radius:var(--border-radius-s, 0.25rem);padding-right:0.5rem;padding-left:0.5rem;text-transform:lowercase;white-space:nowrap;min-height:1.5rem;}.mc-status-badge__label.svelte-1oceydf {color:var(--status-badge-color-label, #000000);}.mc-status-badge__label.svelte-1oceydf::first-letter {text-transform:uppercase;}.mc-status-badge--success.svelte-1oceydf {background-color:var(--status-badge-color-background-success, #ebf5de);border:var(--border-width-s, 0.0625rem) solid var(--status-badge-color-border-success, #c5e39e);}.mc-status-badge--error.svelte-1oceydf {background-color:var(--status-badge-color-background-error, #fdeaea);border:var(--border-width-s, 0.0625rem) solid var(--status-badge-color-border-error, #f8bcbb);}.mc-status-badge--warning.svelte-1oceydf {background-color:var(--status-badge-color-background-warning, #fdf1e8);border:var(--border-width-s, 0.0625rem) solid var(--status-badge-color-border-warning, #f8d2b3);}.mc-status-badge--neutral.svelte-1oceydf {background-color:var(--status-badge-color-background-neutral, #f2f2f2);border:var(--border-width-s, 0.0625rem) solid var(--status-badge-color-border-neutral, #cccccc);}.mc-status-dot.svelte-1oceydf {background-color:var(--status-dot-color-background-info, #0b96cc);height:0.5rem;width:0.5rem;border-radius:var(--border-radius-full, 100%);display:inline-block;}.mc-status-dot--s.svelte-1oceydf {height:0.25rem;width:0.25rem;}.mc-status-dot--l.svelte-1oceydf {height:1rem;width:1rem;}.mc-status-dot--success.svelte-1oceydf {background-color:var(--status-dot-color-background-success, #3f9e10);}.mc-status-dot--error.svelte-1oceydf {background-color:var(--status-dot-color-background-error, #ea302d);}.mc-status-dot--warning.svelte-1oceydf {background-color:var(--status-dot-color-background-warning, #ea7315);}.mc-status-dot--neutral.svelte-1oceydf {background-color:var(--status-dot-color-background-neutral, #808080);}`};function B(o,e){m(e,!0),h(o,j);let t=l(e,"status",7,"info"),a=l(e,"label",7),i=y(e,["$$slots","$$events","$$legacy","$$host","status","label"]);var g={get status(){return t()},set status(s="info"){t(s),b()},get label(){return a()},set label(s){a(s),b()}},r=D();S(r,()=>({class:["mc-status-badge",`mc-status-badge--${t()}`],...i}),void 0,void 0,void 0,"svelte-1oceydf");var d=u(r);z(d,{get status(){return t()},size:"m"});var c=k(d,2),f=u(c,!0);return n(c),n(r),w(()=>$(f,a())),_(o,r),x(g)}customElements.define("m-status-badge",v(B,{status:{},label:{}},[],[],!0));
|
|
4
4
|
//# sourceMappingURL=StatusBadge.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusBadge.js","sources":["../../../src/components/statusbadge/StatusBadge.svelte"],"sourcesContent":["<svelte:options customElement={{ tag: 'm-status-badge' }} />\n\n<script lang=\"ts\">\n import StatusDot from '../statusdot/StatusDot.svelte';\n /**\n * A Status Badge is used to indicate the current status of an element, providing a clear and concise visual cue. The status can change dynamically based on updates, events, or conditions within the system. Status Badges help users quickly identify the state of an item, such as an order status, system health, or process completion. They are often color-coded to enhance readability and recognition.\n */\n interface Props {\n /**\n * Content of the status badge.\n */\n label: string;\n /**\n * Allows to define the status badge type.\n */\n status?: 'info' | 'success' | 'warning' | 'error' | 'neutral';\n }\n\n let { status = 'info', label }: Props = $props();\n</script>\n\n<div class={['mc-status-badge', `mc-status-badge--${status}`]}>\n <StatusDot {status} size=\"m\" />\n <span class=\"mc-status-badge__label\">{label}</span>\n</div>\n\n<style lang=\"scss\">\n @use '@mozaic-ds/styles/components/status-badge';\n @use '@mozaic-ds/styles/components/status-dot';\n</style>\n"],"names":["status","label","$.prop","$$props","
|
|
1
|
+
{"version":3,"file":"StatusBadge.js","sources":["../../../src/components/statusbadge/StatusBadge.svelte"],"sourcesContent":["<svelte:options customElement={{ tag: 'm-status-badge' }} />\n\n<script lang=\"ts\">\n import StatusDot from '../statusdot/StatusDot.svelte';\n /**\n * A Status Badge is used to indicate the current status of an element, providing a clear and concise visual cue. The status can change dynamically based on updates, events, or conditions within the system. Status Badges help users quickly identify the state of an item, such as an order status, system health, or process completion. They are often color-coded to enhance readability and recognition.\n */\n interface Props {\n /**\n * Content of the status badge.\n */\n label: string;\n /**\n * Allows to define the status badge type.\n */\n status?: 'info' | 'success' | 'warning' | 'error' | 'neutral';\n }\n\n let { status = 'info', label, ...attrs }: Props = $props();\n</script>\n\n<div class={['mc-status-badge', `mc-status-badge--${status}`]} {...attrs}>\n <StatusDot {status} size=\"m\" />\n <span class=\"mc-status-badge__label\">{label}</span>\n</div>\n\n<style lang=\"scss\">\n @use '@mozaic-ds/styles/components/status-badge';\n @use '@mozaic-ds/styles/components/status-dot';\n</style>\n"],"names":["status","label","$.prop","$$props","attrs","$.rest_props"],"mappings":";;6sEAAA,gBAkBQ,IAAAA,iBAAS,MAAM,EAAEC,EAAKC,EAAAC,EAAA,QAAA,CAAA,EAAKC,EAAKC,EAAAF,EAAA,0GAAvB,OAAM,2EAGV,MAAA,CAAA,sCAAuCH,EAAM,CAAA,EAAA,KAASI,iJAE3BH,EAAK,CAAA,CAAA,aAJ7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusBadge.stories.d.ts","sourceRoot":"","sources":["../../../src/components/statusbadge/StatusBadge.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"StatusBadge.stories.d.ts","sourceRoot":"","sources":["../../../src/components/statusbadge/StatusBadge.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAGrE,OAAO,sBAAsB,CAAC;AAE9B,QAAA,MAAM,IAAI,EAAE,IAeX,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC;AAEtB,eAAO,MAAM,IAAI,EAAE,KAAU,CAAC;AAE9B,eAAO,MAAM,OAAO,EAAE,KAErB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAErB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAEnB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAErB,CAAC"}
|