@soroush.tech/design-system 2.0.0-rc.2 → 2.0.0-rc.4
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 +66 -40
- package/dist/Accordion/Accordion.cjs +100 -0
- package/dist/Accordion/Accordion.d.cts +41 -0
- package/dist/Accordion/Accordion.d.mts +41 -0
- package/dist/Accordion/Accordion.mjs +98 -0
- package/dist/Accordion/AccordionActions.cjs +29 -0
- package/dist/Accordion/AccordionActions.d.cts +12 -0
- package/dist/Accordion/AccordionActions.d.mts +12 -0
- package/dist/Accordion/AccordionActions.mjs +27 -0
- package/dist/Accordion/AccordionDetails.cjs +23 -0
- package/dist/Accordion/AccordionDetails.d.cts +12 -0
- package/dist/Accordion/AccordionDetails.d.mts +12 -0
- package/dist/Accordion/AccordionDetails.mjs +21 -0
- package/dist/Accordion/AccordionGroup.cjs +79 -0
- package/dist/Accordion/AccordionGroup.d.cts +24 -0
- package/dist/Accordion/AccordionGroup.d.mts +24 -0
- package/dist/Accordion/AccordionGroup.mjs +77 -0
- package/dist/Accordion/AccordionSummary.cjs +99 -0
- package/dist/Accordion/AccordionSummary.d.cts +21 -0
- package/dist/Accordion/AccordionSummary.d.mts +21 -0
- package/dist/Accordion/AccordionSummary.mjs +97 -0
- package/dist/Accordion.cjs +11 -0
- package/dist/Accordion.d.cts +6 -0
- package/dist/Accordion.d.mts +6 -0
- package/dist/Accordion.mjs +6 -0
- package/dist/AccordionContext-B2TCl9Os.cjs +44 -0
- package/dist/AccordionContext-DDk_i9Dx.mjs +15 -0
- package/dist/Alert/Alert.cjs +154 -0
- package/dist/Alert/Alert.d.cts +37 -0
- package/dist/Alert/Alert.d.mts +37 -0
- package/dist/Alert/Alert.mjs +152 -0
- package/dist/Alert/AlertTitle.cjs +21 -0
- package/dist/Alert/AlertTitle.d.cts +12 -0
- package/dist/Alert/AlertTitle.d.mts +12 -0
- package/dist/Alert/AlertTitle.mjs +20 -0
- package/dist/Alert.cjs +5 -0
- package/dist/Alert.d.cts +3 -0
- package/dist/Alert.d.mts +3 -0
- package/dist/Alert.mjs +3 -0
- package/dist/AppBar.cjs +1 -1
- package/dist/AppBar.d.cts +1 -1
- package/dist/AppBar.d.mts +1 -1
- package/dist/AppBar.mjs +1 -1
- package/dist/Autocomplete.cjs +666 -0
- package/dist/Autocomplete.d.cts +97 -0
- package/dist/Autocomplete.d.mts +97 -0
- package/dist/Autocomplete.mjs +664 -0
- package/dist/Avatar.cjs +2 -2
- package/dist/Avatar.d.cts +1 -1
- package/dist/Avatar.d.mts +1 -1
- package/dist/Avatar.mjs +2 -2
- package/dist/Backdrop.d.cts +1 -1
- package/dist/Backdrop.d.mts +1 -1
- package/dist/Badge.cjs +130 -0
- package/dist/Badge.d.cts +45 -0
- package/dist/Badge.d.mts +45 -0
- package/dist/Badge.mjs +128 -0
- package/dist/Breadcrumbs.cjs +2 -2
- package/dist/Breadcrumbs.d.cts +3 -3
- package/dist/Breadcrumbs.d.mts +3 -3
- package/dist/Breadcrumbs.mjs +2 -2
- package/dist/Button.cjs +6 -3
- package/dist/Button.d.cts +1 -1
- package/dist/Button.d.mts +1 -1
- package/dist/Button.mjs +6 -3
- package/dist/ButtonGroup.cjs +1 -1
- package/dist/ButtonGroup.d.cts +1 -1
- package/dist/ButtonGroup.d.mts +1 -1
- package/dist/ButtonGroup.mjs +1 -1
- package/dist/Card.cjs +2 -2
- package/dist/Card.d.cts +4 -4
- package/dist/Card.d.mts +4 -4
- package/dist/Card.mjs +2 -2
- package/dist/Checkbox.cjs +13 -3
- package/dist/Checkbox.d.cts +4 -2
- package/dist/Checkbox.d.mts +4 -2
- package/dist/Checkbox.mjs +13 -3
- package/dist/Chip.cjs +194 -0
- package/dist/Chip.d.cts +49 -0
- package/dist/Chip.d.mts +49 -0
- package/dist/Chip.mjs +192 -0
- package/dist/CircularProgress.cjs +1 -1
- package/dist/CircularProgress.d.cts +2 -2
- package/dist/CircularProgress.d.mts +2 -2
- package/dist/CircularProgress.mjs +1 -1
- package/dist/Collapse.cjs +126 -0
- package/dist/Collapse.d.cts +2 -0
- package/dist/Collapse.d.mts +2 -0
- package/dist/Collapse.mjs +124 -0
- package/dist/Drawer.d.cts +3 -3
- package/dist/Drawer.d.mts +3 -3
- package/dist/Fab.cjs +114 -0
- package/dist/Fab.d.cts +2 -0
- package/dist/Fab.d.mts +2 -0
- package/dist/Fab.mjs +113 -0
- package/dist/FabMenu/FabMenu.cjs +3 -0
- package/dist/FabMenu/FabMenu.d.cts +53 -0
- package/dist/FabMenu/FabMenu.d.mts +53 -0
- package/dist/FabMenu/FabMenu.mjs +2 -0
- package/dist/FabMenu/FabMenuItem.cjs +28 -0
- package/dist/FabMenu/FabMenuItem.d.cts +19 -0
- package/dist/FabMenu/FabMenuItem.d.mts +19 -0
- package/dist/FabMenu/FabMenuItem.mjs +27 -0
- package/dist/FabMenu-BDfkT_zt.mjs +273 -0
- package/dist/FabMenu-RiVtzrKe.cjs +279 -0
- package/dist/FabMenu.cjs +5 -0
- package/dist/FabMenu.d.cts +3 -0
- package/dist/FabMenu.d.mts +3 -0
- package/dist/FabMenu.mjs +3 -0
- package/dist/FabMenuContext-BZslb0lL.cjs +22 -0
- package/dist/FabMenuContext-D-XlDbLl.mjs +11 -0
- package/dist/Fade.cjs +17 -0
- package/dist/Fade.d.cts +11 -0
- package/dist/Fade.d.mts +11 -0
- package/dist/Fade.mjs +16 -0
- package/dist/Flex.d.cts +1 -1
- package/dist/Flex.d.mts +1 -1
- package/dist/Form.d.cts +1 -1
- package/dist/Form.d.mts +1 -1
- package/dist/FormControl.cjs +14 -4
- package/dist/FormControl.d.cts +9 -1
- package/dist/FormControl.d.mts +9 -1
- package/dist/FormControl.mjs +14 -4
- package/dist/FormHelperText.cjs +1 -1
- package/dist/FormHelperText.d.cts +1 -1
- package/dist/FormHelperText.d.mts +1 -1
- package/dist/FormHelperText.mjs +1 -1
- package/dist/FormLabel.cjs +13 -2
- package/dist/FormLabel.d.cts +2 -2
- package/dist/FormLabel.d.mts +2 -2
- package/dist/FormLabel.mjs +14 -3
- package/dist/Grid.d.cts +1 -1
- package/dist/Grid.d.mts +1 -1
- package/dist/Grow.cjs +21 -0
- package/dist/Grow.d.cts +11 -0
- package/dist/Grow.d.mts +11 -0
- package/dist/Grow.mjs +20 -0
- package/dist/{Icon-DlheCTJb.mjs → Icon-0hPpk-WZ.mjs} +71 -1
- package/dist/{Icon-Cvuhp9ek.cjs → Icon-BE7bRsqR.cjs} +71 -1
- package/dist/Icon.cjs +1 -1
- package/dist/Icon.d.cts +1 -1
- package/dist/Icon.d.mts +1 -1
- package/dist/Icon.mjs +1 -1
- package/dist/Image.d.cts +1 -1
- package/dist/Image.d.mts +1 -1
- package/dist/LinearProgress.cjs +1 -1
- package/dist/LinearProgress.d.cts +2 -2
- package/dist/LinearProgress.d.mts +2 -2
- package/dist/LinearProgress.mjs +1 -1
- package/dist/Link.cjs +3 -3
- package/dist/Link.d.cts +1 -1
- package/dist/Link.d.mts +1 -1
- package/dist/Link.mjs +3 -3
- package/dist/Menu/ContextMenu.cjs +6 -4
- package/dist/Menu/ContextMenu.d.cts +8 -6
- package/dist/Menu/ContextMenu.d.mts +8 -6
- package/dist/Menu/ContextMenu.mjs +6 -4
- package/dist/Menu/Menu.cjs +1 -1
- package/dist/Menu/Menu.d.cts +1 -1
- package/dist/Menu/Menu.d.mts +1 -1
- package/dist/Menu/Menu.mjs +1 -1
- package/dist/Menu/MenuItems.cjs +1 -1
- package/dist/Menu/MenuItems.d.cts +1 -1
- package/dist/Menu/MenuItems.d.mts +1 -1
- package/dist/Menu/MenuItems.mjs +1 -1
- package/dist/Menu/MenuList.cjs +1 -1
- package/dist/Menu/MenuList.d.cts +2 -2
- package/dist/Menu/MenuList.d.mts +2 -2
- package/dist/Menu/MenuList.mjs +1 -1
- package/dist/{Menu-tECbAEFj.mjs → Menu-CnG4ikZd.mjs} +7 -4
- package/dist/{Menu-BkKPTOfh.cjs → Menu-DXLjR9ga.cjs} +8 -5
- package/dist/Menu.cjs +2 -2
- package/dist/Menu.d.cts +3 -3
- package/dist/Menu.d.mts +3 -3
- package/dist/Menu.mjs +2 -2
- package/dist/{MenuItem-BR7ingQx.mjs → MenuItem-C21eR7d6.mjs} +42 -86
- package/dist/{MenuItem-CfdN4axw.cjs → MenuItem-EJ4u73f0.cjs} +42 -92
- package/dist/MenuItem.cjs +1 -1
- package/dist/MenuItem.d.cts +1 -1
- package/dist/MenuItem.d.mts +1 -1
- package/dist/MenuItem.mjs +1 -1
- package/dist/{MenuList-D4imLXAa.cjs → MenuList-BBAYeUvD.cjs} +1 -1
- package/dist/{MenuList-B7msJ1IG.mjs → MenuList-Cz3cupC3.mjs} +1 -1
- package/dist/{MenuListContext-Dml16k0X.d.mts → MenuListContext-BWL5fM_L.d.mts} +2 -2
- package/dist/{MenuListContext-vujGcRk9.d.cts → MenuListContext-BrCKLgKZ.d.cts} +2 -2
- package/dist/{Modal-BcsyrrpH.mjs → Modal-CEHDej-v.mjs} +3 -22
- package/dist/{Modal-CM3osOqj.cjs → Modal-DBw4j0YA.cjs} +3 -22
- package/dist/Modal.cjs +1 -1
- package/dist/Modal.d.cts +1 -1
- package/dist/Modal.d.mts +1 -1
- package/dist/Modal.mjs +1 -1
- package/dist/NativeSelect.cjs +15 -18
- package/dist/NativeSelect.d.cts +3 -3
- package/dist/NativeSelect.d.mts +3 -3
- package/dist/NativeSelect.mjs +15 -18
- package/dist/NumberInput.cjs +502 -0
- package/dist/NumberInput.d.cts +79 -0
- package/dist/NumberInput.d.mts +79 -0
- package/dist/NumberInput.mjs +500 -0
- package/dist/Pagination/PaginationItem.cjs +2 -2
- package/dist/Pagination/PaginationItem.d.cts +1 -1
- package/dist/Pagination/PaginationItem.d.mts +1 -1
- package/dist/Pagination/PaginationItem.mjs +2 -2
- package/dist/Pagination.d.cts +2 -2
- package/dist/Pagination.d.mts +2 -2
- package/dist/Paper.cjs +2 -2
- package/dist/Paper.d.cts +2 -2
- package/dist/Paper.d.mts +2 -2
- package/dist/Paper.mjs +2 -2
- package/dist/{Popover-QjM5Z1CR.mjs → Popover-Neeqs_7l.mjs} +3 -3
- package/dist/{Popover-CiZfgiKE.cjs → Popover-xyJTSjZy.cjs} +3 -3
- package/dist/Popover.cjs +1 -1
- package/dist/Popover.d.cts +3 -3
- package/dist/Popover.d.mts +3 -3
- package/dist/Popover.mjs +1 -1
- package/dist/Portal.d.cts +1 -17
- package/dist/Portal.d.mts +1 -17
- package/dist/Pressable.cjs +17 -13
- package/dist/Pressable.d.cts +1 -1
- package/dist/Pressable.d.mts +1 -1
- package/dist/Pressable.mjs +17 -13
- package/dist/Quote.d.cts +2 -2
- package/dist/Quote.d.mts +2 -2
- package/dist/Radio.cjs +13 -3
- package/dist/Radio.d.cts +4 -2
- package/dist/Radio.d.mts +4 -2
- package/dist/Radio.mjs +13 -3
- package/dist/RangeInput.cjs +677 -0
- package/dist/RangeInput.d.cts +79 -0
- package/dist/RangeInput.d.mts +79 -0
- package/dist/RangeInput.mjs +675 -0
- package/dist/Rating.cjs +373 -0
- package/dist/Rating.d.cts +57 -0
- package/dist/Rating.d.mts +57 -0
- package/dist/Rating.mjs +371 -0
- package/dist/ScrollArea.cjs +268 -0
- package/dist/ScrollArea.d.cts +40 -0
- package/dist/ScrollArea.d.mts +40 -0
- package/dist/ScrollArea.mjs +266 -0
- package/dist/Select.cjs +11 -13
- package/dist/Select.d.cts +3 -3
- package/dist/Select.d.mts +3 -3
- package/dist/Select.mjs +13 -15
- package/dist/Sidebar/Sidebar.d.cts +1 -1
- package/dist/Sidebar/Sidebar.d.mts +1 -1
- package/dist/Sidebar/SidebarItem.cjs +2 -2
- package/dist/Sidebar/SidebarItem.d.cts +3 -3
- package/dist/Sidebar/SidebarItem.d.mts +3 -3
- package/dist/Sidebar/SidebarItem.mjs +4 -4
- package/dist/Skeleton.d.cts +1 -1
- package/dist/Skeleton.d.mts +1 -1
- package/dist/Slide.cjs +51 -0
- package/dist/Slide.d.cts +17 -0
- package/dist/Slide.d.mts +17 -0
- package/dist/Slide.mjs +50 -0
- package/dist/Snackbar.cjs +205 -0
- package/dist/Snackbar.d.cts +62 -0
- package/dist/Snackbar.d.mts +62 -0
- package/dist/Snackbar.mjs +203 -0
- package/dist/Switch.cjs +35 -18
- package/dist/Switch.d.cts +4 -2
- package/dist/Switch.d.mts +4 -2
- package/dist/Switch.mjs +37 -20
- package/dist/Table/Table.d.cts +2 -2
- package/dist/Table/Table.d.mts +2 -2
- package/dist/Table/TableBody.d.cts +1 -1
- package/dist/Table/TableBody.d.mts +1 -1
- package/dist/Table/TableCell.d.cts +1 -1
- package/dist/Table/TableCell.d.mts +1 -1
- package/dist/Table/TableContainer.d.cts +1 -1
- package/dist/Table/TableContainer.d.mts +1 -1
- package/dist/Table/TableControl.d.cts +1 -1
- package/dist/Table/TableControl.d.mts +1 -1
- package/dist/Table/TableControl.mjs +2 -2
- package/dist/Table/TableFooter.d.cts +1 -1
- package/dist/Table/TableFooter.d.mts +1 -1
- package/dist/Table/TableHead.d.cts +1 -1
- package/dist/Table/TableHead.d.mts +1 -1
- package/dist/Table/TablePagination.cjs +1 -0
- package/dist/Table/TablePagination.d.cts +2 -2
- package/dist/Table/TablePagination.d.mts +2 -2
- package/dist/Table/TablePagination.mjs +1 -0
- package/dist/Table/TablePaginationActions.cjs +1 -1
- package/dist/Table/TablePaginationActions.d.cts +1 -1
- package/dist/Table/TablePaginationActions.d.mts +1 -1
- package/dist/Table/TablePaginationActions.mjs +1 -1
- package/dist/Table/TableRow.d.cts +1 -1
- package/dist/Table/TableRow.d.mts +1 -1
- package/dist/Table/TableSortLabel.cjs +1 -1
- package/dist/Table/TableSortLabel.d.cts +1 -1
- package/dist/Table/TableSortLabel.d.mts +1 -1
- package/dist/Table/TableSortLabel.mjs +1 -1
- package/dist/Table/hooks.d.cts +1 -1
- package/dist/Table/hooks.d.mts +1 -1
- package/dist/Table.d.cts +5 -5
- package/dist/Table.d.mts +5 -5
- package/dist/{TableContext-6PgGpUzM.d.mts → TableContext-Be8tluYZ.d.cts} +1 -1
- package/dist/{TableContext-CBGk-Lh8.d.cts → TableContext-DUPqls5k.d.mts} +1 -1
- package/dist/Tabs/Tab.cjs +16 -7
- package/dist/Tabs/Tab.d.cts +2 -2
- package/dist/Tabs/Tab.d.mts +2 -2
- package/dist/Tabs/Tab.mjs +16 -7
- package/dist/Tabs/TabContext.d.cts +1 -1
- package/dist/Tabs/TabContext.d.mts +1 -1
- package/dist/Tabs/TabList.cjs +1 -1
- package/dist/Tabs/TabList.d.cts +1 -1
- package/dist/Tabs/TabList.d.mts +1 -1
- package/dist/Tabs/TabList.mjs +1 -1
- package/dist/Tabs/TabPanel.cjs +1 -1
- package/dist/Tabs/TabPanel.d.cts +2 -2
- package/dist/Tabs/TabPanel.d.mts +2 -2
- package/dist/Tabs/TabPanel.mjs +1 -1
- package/dist/Tabs/TabScrollButton.cjs +2 -2
- package/dist/Tabs/TabScrollButton.d.cts +1 -1
- package/dist/Tabs/TabScrollButton.d.mts +1 -1
- package/dist/Tabs/TabScrollButton.mjs +2 -2
- package/dist/Tabs/Tabs.cjs +1 -1
- package/dist/Tabs/Tabs.d.cts +2 -2
- package/dist/Tabs/Tabs.d.mts +2 -2
- package/dist/Tabs/Tabs.mjs +1 -1
- package/dist/{Tabs-D_wkX-Jb.cjs → Tabs-Croeq9s2.cjs} +15 -10
- package/dist/{Tabs-YfCUbkQV.mjs → Tabs-DMMP5aDj.mjs} +12 -7
- package/dist/Tabs.cjs +1 -1
- package/dist/Tabs.d.cts +3 -3
- package/dist/Tabs.d.mts +3 -3
- package/dist/Tabs.mjs +1 -1
- package/dist/{TabsContext-C2agsLBN.d.cts → TabsContext-BYeGjSZK.d.cts} +1 -1
- package/dist/{TabsContext-DqyxdmGW.d.mts → TabsContext-D4YumTfD.d.mts} +1 -1
- package/dist/TextInput.cjs +14 -14
- package/dist/TextInput.d.cts +2 -2
- package/dist/TextInput.d.mts +2 -2
- package/dist/TextInput.mjs +14 -14
- package/dist/ToggleButton/ToggleButton.cjs +2 -2
- package/dist/ToggleButton/ToggleButton.d.cts +1 -1
- package/dist/ToggleButton/ToggleButton.d.mts +1 -1
- package/dist/ToggleButton/ToggleButton.mjs +2 -2
- package/dist/ToggleButton/ToggleButtonGroup.cjs +1 -1
- package/dist/ToggleButton/ToggleButtonGroup.d.cts +1 -1
- package/dist/ToggleButton/ToggleButtonGroup.d.mts +1 -1
- package/dist/ToggleButton/ToggleButtonGroup.mjs +1 -1
- package/dist/Tooltip.cjs +270 -0
- package/dist/Tooltip.d.cts +78 -0
- package/dist/Tooltip.d.mts +78 -0
- package/dist/Tooltip.mjs +268 -0
- package/dist/TransferList.cjs +363 -0
- package/dist/TransferList.d.cts +69 -0
- package/dist/TransferList.d.mts +69 -0
- package/dist/TransferList.mjs +361 -0
- package/dist/Typography.cjs +1 -1
- package/dist/Typography.d.cts +2 -2
- package/dist/Typography.d.mts +2 -2
- package/dist/Typography.mjs +1 -1
- package/dist/View.d.cts +1 -1
- package/dist/View.d.mts +1 -1
- package/dist/Zoom.cjs +16 -0
- package/dist/Zoom.d.cts +10 -0
- package/dist/Zoom.d.mts +10 -0
- package/dist/Zoom.mjs +15 -0
- package/dist/catalog.cjs +1405 -45
- package/dist/catalog.d.cts +1 -1
- package/dist/catalog.d.mts +1 -1
- package/dist/catalog.mjs +1405 -45
- package/dist/engine.d.cts +2 -2
- package/dist/engine.d.mts +1 -1
- package/dist/getAnchorRel-CySI28HJ.mjs +8 -0
- package/dist/getAnchorRel-_vtAXC-4.cjs +13 -0
- package/dist/getShapeRadius-B9ytqDSk.d.cts +5 -0
- package/dist/getShapeRadius-B9ytqDSk.d.mts +5 -0
- package/dist/getShapeRadius-sY6-AGP4.mjs +12 -0
- package/dist/getShapeRadius-vXmXGV3f.cjs +17 -0
- package/dist/getSurfaceRadius-BTUV1E8H.cjs +11 -0
- package/dist/getSurfaceRadius-DTgqIzll.mjs +6 -0
- package/dist/getTooltipOrigins-B_7XXtQq.cjs +104 -0
- package/dist/getTooltipOrigins-CyyIMCF1.mjs +87 -0
- package/dist/{index-qlfNErNd.d.cts → index-05VGk0y_.d.cts} +30 -2
- package/dist/{index-CrIxI8Na.d.mts → index-2x01drCL.d.mts} +2 -2
- package/dist/{index-Cj5Rhh_9.d.mts → index-46mhlgP6.d.mts} +7 -3
- package/dist/{index-BiVvxOvj.d.cts → index-BCzI2Iqo.d.cts} +2 -2
- package/dist/{index-IdMqR82e.d.cts → index-BDqIc6Gx.d.cts} +1 -1
- package/dist/{index-BSA6SKao.d.mts → index-BPh60KDs.d.mts} +1 -1
- package/dist/{index-Bxd9NOWb.d.mts → index-BQge4W7L.d.cts} +3 -3
- package/dist/{index-DCmH5f9I.d.cts → index-BSGu9rPv.d.cts} +7 -3
- package/dist/{index-Bhdn4KTy.d.cts → index-BThHG5QU.d.mts} +3 -3
- package/dist/{index-DrVYWt-X.d.mts → index-BUeqNHjb.d.cts} +3 -3
- package/dist/{index-DIC7HKpP.d.mts → index-BeqpkGV-.d.mts} +1 -1
- package/dist/{index-DqjXDutI.d.mts → index-Bfyz3MDc.d.mts} +1 -1
- package/dist/{index-BlLH6rlE.d.cts → index-BgLqA52S.d.cts} +2 -2
- package/dist/{index-DDJuUfL5.d.cts → index-BhnLFsBv.d.cts} +1 -1
- package/dist/{index-gnh-Oe0n.d.cts → index-BitQk7Hx.d.cts} +1 -1
- package/dist/index-BvgX5eyV.d.mts +36 -0
- package/dist/index-CERyXFjz.d.cts +32 -0
- package/dist/index-CLvlNnjM.d.mts +32 -0
- package/dist/{index-C3KrFPCj.d.mts → index-CO-XxjiZ.d.cts} +2 -2
- package/dist/{index-DXhMkjQ6.d.cts → index-CR0akDlJ.d.cts} +2 -2
- package/dist/{index-CVNJEUwJ.d.mts → index-CRQ7XLri.d.mts} +234 -6
- package/dist/{index-DQcnJ5H4.d.cts → index-CRn4fWwA.d.mts} +2 -2
- package/dist/{index-BCnKYNlZ.d.cts → index-CWPvdEjP.d.mts} +3 -3
- package/dist/{index-DuVNRXP4.d.cts → index-CrQDxJ1D.d.cts} +1 -1
- package/dist/index-Ctx-DKV3.d.cts +18 -0
- package/dist/index-Ctx-DKV3.d.mts +18 -0
- package/dist/{index-BjPX49XA.d.mts → index-CyLhEXYB.d.mts} +1 -1
- package/dist/{index-DeDxYlSQ.d.mts → index-D05fSuF1.d.mts} +2 -2
- package/dist/{index-XxydXX8l.d.cts → index-DK3zgGPe.d.mts} +3 -3
- package/dist/{index-BqpS_Huq.d.mts → index-DNj5P2NH.d.mts} +30 -2
- package/dist/{index-BFruxTHv.d.cts → index-DOH1xY0L.d.cts} +1 -1
- package/dist/{index-B3LIhqHR.d.cts → index-D_-DAAE7.d.mts} +14 -6
- package/dist/{index-BbgFYfX_.d.mts → index-D_LT3QiH.d.mts} +2 -2
- package/dist/index-Db4L2hwa.d.cts +36 -0
- package/dist/{index-BjfPEP_5.d.cts → index-Dk4KuTPB.d.cts} +2 -2
- package/dist/{index-CoEqjFYn.d.mts → index-Ebjbrbsk.d.cts} +14 -6
- package/dist/{index-B8DNxyEw.d.mts → index-MWUGpG-Y.d.mts} +2 -2
- package/dist/{index-DmJ7yWWi.d.cts → index-XN4-ZqTB.d.cts} +236 -8
- package/dist/index-fPRELf0V.d.mts +1 -0
- package/dist/{index-CWnbCxgw.d.cts → index-fi-W3MOz.d.cts} +7 -5
- package/dist/{index-DJCpnTH3.d.mts → index-iTquH69S.d.cts} +3 -3
- package/dist/{index-DckSub2J.d.mts → index-lGpLM144.d.mts} +7 -5
- package/dist/{index-BVPrG1L0.d.mts → index-vBCN6iAz.d.mts} +1 -1
- package/dist/index-x3WC9ViD.d.cts +1 -0
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/inputVariantStyles-BUK_62Ra.cjs +61 -0
- package/dist/inputVariantStyles-q_cZsCJg.mjs +44 -0
- package/dist/isRtl-BJDtm86G.mjs +7 -0
- package/dist/isRtl-DTkYHRPo.cjs +12 -0
- package/dist/precision-B1lhxnnO.mjs +25 -0
- package/dist/precision-B58cTPB2.cjs +48 -0
- package/dist/style.cjs +1 -1
- package/dist/style.d.cts +2 -2
- package/dist/style.d.mts +2 -2
- package/dist/style.mjs +1 -1
- package/dist/{theme-BxXuXRgQ.cjs → theme-DzfwuzMZ.cjs} +1 -1
- package/dist/{theme-Z9_QludW.mjs → theme-oBfFhJm9.mjs} +1 -1
- package/dist/theme.cjs +3 -2
- package/dist/theme.d.cts +3 -3
- package/dist/theme.d.mts +3 -3
- package/dist/theme.mjs +3 -3
- package/dist/{themes-gd6tcmqS.cjs → themes--4eci3M1.cjs} +25 -2
- package/dist/{themes-L-dE7_ck.mjs → themes-BwEsdVox.mjs} +20 -3
- package/dist/useAnchoredPlacement-B1FyGoZV.cjs +111 -0
- package/dist/useAnchoredPlacement-Pe7sY41E.mjs +106 -0
- package/dist/useControlled-C666KpQ0.cjs +18 -0
- package/dist/useControlled-CBRLsO-H.mjs +13 -0
- package/dist/useMergedRefs-2zTDXgPO.cjs +27 -0
- package/dist/useMergedRefs-BfBckwRY.mjs +22 -0
- package/dist/{useTablePagination-C5VKtqDp.d.cts → useTablePagination-CFb_FYA9.d.cts} +1 -1
- package/dist/{useTablePagination-C6LSlt3w.d.mts → useTablePagination-_-bzuXJO.d.mts} +1 -1
- package/dist/useTransition-C1F7MuHO.d.mts +42 -0
- package/dist/useTransition-DAQd1PX3.cjs +83 -0
- package/dist/useTransition-DP1k0irI.mjs +78 -0
- package/dist/useTransition-l9dv83-Y.d.cts +42 -0
- package/dist/useTransitionChild-CikpU0Yh.cjs +54 -0
- package/dist/useTransitionChild-Dvg9hO-F.mjs +49 -0
- package/package.json +194 -4
- package/dist/index-DBteSahY.d.cts +0 -1
- package/dist/index-_G1osn09.d.mts +0 -1
- package/dist/inputVariantStyles-BBkkYQtE.cjs +0 -32
- package/dist/inputVariantStyles-CcqpGfuP.mjs +0 -28
package/dist/Rating.cjs
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_src = require("./src-DU81aGy9.cjs");
|
|
3
|
+
const require_utils = require("./utils.cjs");
|
|
4
|
+
const require_theme = require("./theme-DzfwuzMZ.cjs");
|
|
5
|
+
const require_useControlled = require("./useControlled-C666KpQ0.cjs");
|
|
6
|
+
const require_Icon = require("./Icon-BE7bRsqR.cjs");
|
|
7
|
+
const require_FormControlContext = require("./FormControlContext-74gvPGFk.cjs");
|
|
8
|
+
const require_FormControl = require("./FormControl.cjs");
|
|
9
|
+
const require_isRtl = require("./isRtl-DTkYHRPo.cjs");
|
|
10
|
+
const require_precision = require("./precision-B58cTPB2.cjs");
|
|
11
|
+
let react = require("react");
|
|
12
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
13
|
+
let _soroush_tech_styled_system_should_forward_prop = require("@soroush.tech/styled-system/should-forward-prop");
|
|
14
|
+
//#region src/Rating/utils/precision.ts
|
|
15
|
+
/** The value under the pointer: along the width, rounded to a step, between one step and `max`. */
|
|
16
|
+
function getHoverValue({ offset, width, max, precision }) {
|
|
17
|
+
const raw = max * (offset / width) + precision / 2;
|
|
18
|
+
return require_utils.clamp(require_precision.roundToPrecision(raw, precision), precision, max);
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/Rating/hooks/useRating.ts
|
|
22
|
+
const NONE = -1;
|
|
23
|
+
const parseRating = (raw) => raw === "" ? null : Number.parseFloat(raw);
|
|
24
|
+
const getDisplayValue = (focus, rounded) => focus === NONE ? rounded : focus;
|
|
25
|
+
/**
|
|
26
|
+
* A rating's state: the rating itself (controlled or not, rounded to its precision), what the
|
|
27
|
+
* pointer and the focus are on, and the handlers that move them. The pointer takes priority over
|
|
28
|
+
* the keys when both change at once, and pressing the chosen item again clears it.
|
|
29
|
+
*/
|
|
30
|
+
function useRating({ value: valueProp, defaultValue, precision, max, rootRef, onChange, onChangeActive }) {
|
|
31
|
+
const [value, setValue] = require_useControlled.useControlled({
|
|
32
|
+
controlled: valueProp,
|
|
33
|
+
default: defaultValue ?? null
|
|
34
|
+
});
|
|
35
|
+
const rounded = require_precision.roundToPrecision(value, precision);
|
|
36
|
+
const [{ hover, focus }, setActive] = (0, react.useState)({
|
|
37
|
+
hover: NONE,
|
|
38
|
+
focus: NONE
|
|
39
|
+
});
|
|
40
|
+
const handleMouseMove = (event) => {
|
|
41
|
+
const { left, right, width } = rootRef.current.getBoundingClientRect();
|
|
42
|
+
if (width === 0) return;
|
|
43
|
+
const next = getHoverValue({
|
|
44
|
+
offset: require_isRtl.isRtl(rootRef.current) ? right - event.clientX : event.clientX - left,
|
|
45
|
+
width,
|
|
46
|
+
max,
|
|
47
|
+
precision
|
|
48
|
+
});
|
|
49
|
+
setActive({
|
|
50
|
+
hover: next,
|
|
51
|
+
focus: next
|
|
52
|
+
});
|
|
53
|
+
if (hover !== next) onChangeActive?.(event, next);
|
|
54
|
+
};
|
|
55
|
+
const handleMouseLeave = (event) => {
|
|
56
|
+
setActive({
|
|
57
|
+
hover: NONE,
|
|
58
|
+
focus: NONE
|
|
59
|
+
});
|
|
60
|
+
if (hover !== NONE) onChangeActive?.(event, NONE);
|
|
61
|
+
};
|
|
62
|
+
const handleChange = (event) => {
|
|
63
|
+
const next = hover === NONE ? parseRating(event.currentTarget.value) : hover;
|
|
64
|
+
setValue(next);
|
|
65
|
+
onChange?.(event, next);
|
|
66
|
+
};
|
|
67
|
+
const handleClear = (event) => {
|
|
68
|
+
if (event.clientX === 0 && event.clientY === 0) return;
|
|
69
|
+
setActive({
|
|
70
|
+
hover: NONE,
|
|
71
|
+
focus: NONE
|
|
72
|
+
});
|
|
73
|
+
setValue(null);
|
|
74
|
+
if (Number.parseFloat(event.currentTarget.value) === rounded) onChange?.(event, null);
|
|
75
|
+
};
|
|
76
|
+
const handleFocus = (event) => {
|
|
77
|
+
const next = Number.parseFloat(event.currentTarget.value);
|
|
78
|
+
setActive((previous) => ({
|
|
79
|
+
hover: previous.hover,
|
|
80
|
+
focus: next
|
|
81
|
+
}));
|
|
82
|
+
};
|
|
83
|
+
const handleBlur = () => {
|
|
84
|
+
if (hover !== NONE) return;
|
|
85
|
+
setActive((previous) => ({
|
|
86
|
+
hover: previous.hover,
|
|
87
|
+
focus: NONE
|
|
88
|
+
}));
|
|
89
|
+
};
|
|
90
|
+
return {
|
|
91
|
+
rounded,
|
|
92
|
+
displayValue: getDisplayValue(focus, rounded),
|
|
93
|
+
isActive: hover !== NONE || focus !== NONE,
|
|
94
|
+
handleMouseMove,
|
|
95
|
+
handleMouseLeave,
|
|
96
|
+
handleChange,
|
|
97
|
+
handleClear,
|
|
98
|
+
handleFocus,
|
|
99
|
+
handleBlur
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region src/Rating/Rating.tsx
|
|
104
|
+
const visuallyHidden = {
|
|
105
|
+
position: "absolute",
|
|
106
|
+
width: 1,
|
|
107
|
+
height: 1,
|
|
108
|
+
margin: -1,
|
|
109
|
+
padding: 0,
|
|
110
|
+
border: 0,
|
|
111
|
+
overflow: "hidden",
|
|
112
|
+
clip: "rect(0 0 0 0)",
|
|
113
|
+
whiteSpace: "nowrap"
|
|
114
|
+
};
|
|
115
|
+
const RatingRoot = require_src.styled("span", {
|
|
116
|
+
name: "Rating",
|
|
117
|
+
label: "Rating",
|
|
118
|
+
shouldForwardProp: (0, _soroush_tech_styled_system_should_forward_prop.createShouldForwardProp)([
|
|
119
|
+
..._soroush_tech_styled_system_should_forward_prop.props,
|
|
120
|
+
"size",
|
|
121
|
+
"color",
|
|
122
|
+
"isDisabled",
|
|
123
|
+
"isReadOnly",
|
|
124
|
+
"isInField"
|
|
125
|
+
]),
|
|
126
|
+
systemProps: [require_src.src_exports.space]
|
|
127
|
+
})(({ theme, size, isDisabled, isReadOnly, isInField }) => ({
|
|
128
|
+
display: isInField ? "flex" : "inline-flex",
|
|
129
|
+
position: "relative",
|
|
130
|
+
width: "min-content",
|
|
131
|
+
fontSize: theme.icon[size],
|
|
132
|
+
lineHeight: 1,
|
|
133
|
+
cursor: isReadOnly ? "default" : "pointer",
|
|
134
|
+
...isDisabled && {
|
|
135
|
+
opacity: .5,
|
|
136
|
+
cursor: "not-allowed"
|
|
137
|
+
},
|
|
138
|
+
...(isDisabled || isReadOnly) && { pointerEvents: "none" }
|
|
139
|
+
}));
|
|
140
|
+
const focusRing = (theme, color) => {
|
|
141
|
+
const main = (0, require_src.src_exports.get)(theme, `palette.${color}.main`);
|
|
142
|
+
return {
|
|
143
|
+
outline: `${theme.borderWidths.base} solid ${main}`,
|
|
144
|
+
outlineOffset: theme.borderWidths.thin
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
const RatingItem = require_src.styled("label", {
|
|
148
|
+
name: "Rating",
|
|
149
|
+
slot: "item",
|
|
150
|
+
label: "RatingItem",
|
|
151
|
+
shouldForwardProp: (0, _soroush_tech_styled_system_should_forward_prop.createShouldForwardProp)(["color"])
|
|
152
|
+
})(({ theme, color }) => ({
|
|
153
|
+
display: "block",
|
|
154
|
+
position: "relative",
|
|
155
|
+
cursor: "inherit",
|
|
156
|
+
"&:has(input:focus-visible)": focusRing(theme, color)
|
|
157
|
+
}));
|
|
158
|
+
const RatingEmptyLabel = require_src.styled("label", {
|
|
159
|
+
name: "Rating",
|
|
160
|
+
slot: "emptyLabel",
|
|
161
|
+
label: "RatingEmptyLabel",
|
|
162
|
+
shouldForwardProp: (0, _soroush_tech_styled_system_should_forward_prop.createShouldForwardProp)(["color"])
|
|
163
|
+
})(({ theme, color }) => ({
|
|
164
|
+
position: "absolute",
|
|
165
|
+
inset: 0,
|
|
166
|
+
pointerEvents: "none",
|
|
167
|
+
"&:has(input:focus-visible)": focusRing(theme, color)
|
|
168
|
+
}));
|
|
169
|
+
const RatingInput = require_src.styled("input", {
|
|
170
|
+
name: "Rating",
|
|
171
|
+
slot: "input",
|
|
172
|
+
label: "RatingInput"
|
|
173
|
+
})(visuallyHidden);
|
|
174
|
+
const RatingText = require_src.styled("span", {
|
|
175
|
+
name: "Rating",
|
|
176
|
+
slot: "text",
|
|
177
|
+
label: "RatingText"
|
|
178
|
+
})(visuallyHidden);
|
|
179
|
+
const getIconColor = (theme, { color, isFilled, isError }) => {
|
|
180
|
+
if (isFilled) return (0, require_src.src_exports.get)(theme, `palette.${color}.main`);
|
|
181
|
+
if (isError) return (0, require_src.src_exports.get)(theme, "palette.error.main");
|
|
182
|
+
return (0, require_src.src_exports.get)(theme, "text.disabled");
|
|
183
|
+
};
|
|
184
|
+
const activeTransform = (isActive) => isActive ? "scale(1.2)" : "none";
|
|
185
|
+
const RatingIcon = require_src.styled("span", {
|
|
186
|
+
name: "Rating",
|
|
187
|
+
slot: "icon",
|
|
188
|
+
label: "RatingIcon",
|
|
189
|
+
shouldForwardProp: (0, _soroush_tech_styled_system_should_forward_prop.createShouldForwardProp)([
|
|
190
|
+
"color",
|
|
191
|
+
"isFilled",
|
|
192
|
+
"isActive",
|
|
193
|
+
"isError"
|
|
194
|
+
])
|
|
195
|
+
})(({ theme, ...style }) => ({
|
|
196
|
+
display: "flex",
|
|
197
|
+
flexShrink: 0,
|
|
198
|
+
width: "max-content",
|
|
199
|
+
pointerEvents: "none",
|
|
200
|
+
color: getIconColor(theme, style),
|
|
201
|
+
transition: "transform 0.2s",
|
|
202
|
+
transform: activeTransform(style.isActive),
|
|
203
|
+
"@media (prefers-reduced-motion: reduce)": { transition: "none" }
|
|
204
|
+
}));
|
|
205
|
+
const RatingDecimal = require_src.styled("span", {
|
|
206
|
+
name: "Rating",
|
|
207
|
+
slot: "decimal",
|
|
208
|
+
label: "RatingDecimal",
|
|
209
|
+
shouldForwardProp: (0, _soroush_tech_styled_system_should_forward_prop.createShouldForwardProp)(["isActive"])
|
|
210
|
+
})(({ isActive }) => ({
|
|
211
|
+
position: "relative",
|
|
212
|
+
display: "flex",
|
|
213
|
+
transition: "transform 0.2s",
|
|
214
|
+
transform: activeTransform(isActive),
|
|
215
|
+
"@media (prefers-reduced-motion: reduce)": { transition: "none" }
|
|
216
|
+
}));
|
|
217
|
+
function Item({ itemValue, isFilled, isActive, isChecked, isInteractive, label, labelStyle, icon, emptyIcon, name, required, disabled, color, isError, state }) {
|
|
218
|
+
const glyph = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RatingIcon, {
|
|
219
|
+
color,
|
|
220
|
+
isFilled,
|
|
221
|
+
isActive,
|
|
222
|
+
isError,
|
|
223
|
+
children: isFilled ? icon : emptyIcon
|
|
224
|
+
});
|
|
225
|
+
if (!isInteractive) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RatingItem, {
|
|
226
|
+
as: "span",
|
|
227
|
+
color,
|
|
228
|
+
style: labelStyle,
|
|
229
|
+
children: glyph
|
|
230
|
+
});
|
|
231
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(RatingItem, {
|
|
232
|
+
color,
|
|
233
|
+
style: labelStyle,
|
|
234
|
+
children: [
|
|
235
|
+
glyph,
|
|
236
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(RatingText, { children: label }),
|
|
237
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(RatingInput, {
|
|
238
|
+
type: "radio",
|
|
239
|
+
name,
|
|
240
|
+
value: itemValue,
|
|
241
|
+
checked: isChecked,
|
|
242
|
+
required,
|
|
243
|
+
disabled,
|
|
244
|
+
onChange: state.handleChange,
|
|
245
|
+
onClick: state.handleClear,
|
|
246
|
+
onFocus: state.handleFocus,
|
|
247
|
+
onBlur: state.handleBlur
|
|
248
|
+
})
|
|
249
|
+
]
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* @description A rating: a row of icons the user sets - or, `readOnly`, shows. A group of visually
|
|
254
|
+
* hidden native radio inputs, so keys (Tab to the rating, the arrows to change it), assistive
|
|
255
|
+
* technology and forms work as the platform's; hovering previews the value, and pressing the
|
|
256
|
+
* chosen item clears it. In a `FormControl` it takes the field's size, color, error and
|
|
257
|
+
* disabled state, and its `FormLabel` names it.
|
|
258
|
+
*/
|
|
259
|
+
function Rating({ value, defaultValue, onChange, onChangeActive, max: maxProp, precision: precisionProp, highlightSelectedOnly: highlightSelectedOnlyProp, icon: iconProp, emptyIcon: emptyIconProp, getLabelText = String, emptyLabelText, readOnly = false, size: sizeProp, color: colorProp, disabled: disabledProp, required: requiredProp, error: errorProp, name: nameProp, id: idProp, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, "data-testid": dataTestid, ...spaceProps }) {
|
|
260
|
+
const dp = require_theme.useDefaultProps("Rating");
|
|
261
|
+
const isInField = (0, react.useContext)(require_FormControlContext.FormControlContext) !== null;
|
|
262
|
+
const fc = require_FormControl.useFormControl({
|
|
263
|
+
id: idProp,
|
|
264
|
+
error: errorProp,
|
|
265
|
+
disabled: disabledProp,
|
|
266
|
+
required: requiredProp,
|
|
267
|
+
size: sizeProp ?? dp.size,
|
|
268
|
+
color: colorProp ?? dp.color
|
|
269
|
+
});
|
|
270
|
+
const color = fc.color ?? "warning";
|
|
271
|
+
const max = maxProp ?? dp.max ?? 5;
|
|
272
|
+
const precision = precisionProp ?? dp.precision ?? 1;
|
|
273
|
+
const highlightSelectedOnly = highlightSelectedOnlyProp ?? dp.highlightSelectedOnly ?? false;
|
|
274
|
+
const icon = iconProp ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
275
|
+
name: "star",
|
|
276
|
+
size: "1em",
|
|
277
|
+
color: "inherit"
|
|
278
|
+
});
|
|
279
|
+
const emptyIcon = emptyIconProp ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
280
|
+
name: "star_border",
|
|
281
|
+
size: "1em",
|
|
282
|
+
color: "inherit"
|
|
283
|
+
});
|
|
284
|
+
const generatedName = (0, react.useId)();
|
|
285
|
+
const name = nameProp ?? generatedName;
|
|
286
|
+
const isInput = !readOnly;
|
|
287
|
+
const rootRef = (0, react.useRef)(null);
|
|
288
|
+
const state = useRating({
|
|
289
|
+
value,
|
|
290
|
+
defaultValue,
|
|
291
|
+
precision,
|
|
292
|
+
max,
|
|
293
|
+
rootRef,
|
|
294
|
+
onChange,
|
|
295
|
+
onChangeActive
|
|
296
|
+
});
|
|
297
|
+
const shown = state.displayValue ?? 0;
|
|
298
|
+
const renderItem = (itemValue, labelStyle, isActive = false) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Item, {
|
|
299
|
+
itemValue,
|
|
300
|
+
isFilled: highlightSelectedOnly ? itemValue === shown : itemValue <= shown,
|
|
301
|
+
isActive,
|
|
302
|
+
isChecked: itemValue === state.rounded,
|
|
303
|
+
isInteractive: isInput,
|
|
304
|
+
label: getLabelText(itemValue),
|
|
305
|
+
labelStyle,
|
|
306
|
+
icon,
|
|
307
|
+
emptyIcon,
|
|
308
|
+
name,
|
|
309
|
+
required: fc.required,
|
|
310
|
+
disabled: fc.disabled,
|
|
311
|
+
color,
|
|
312
|
+
isError: fc.error,
|
|
313
|
+
state
|
|
314
|
+
}, itemValue);
|
|
315
|
+
const items = Array.from({ length: max }, (_, index) => {
|
|
316
|
+
const itemValue = index + 1;
|
|
317
|
+
const isActive = state.isActive && itemValue === Math.ceil(shown);
|
|
318
|
+
if (precision >= 1) return renderItem(itemValue, void 0, isActive);
|
|
319
|
+
const steps = Math.round(1 / precision);
|
|
320
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RatingDecimal, {
|
|
321
|
+
isActive,
|
|
322
|
+
children: Array.from({ length: steps }, (__, step) => {
|
|
323
|
+
const stepValue = require_precision.roundToPrecision(itemValue - 1 + (step + 1) * precision, precision);
|
|
324
|
+
const isLast = step === steps - 1;
|
|
325
|
+
const width = stepValue === state.displayValue ? `${(step + 1) * precision * 100}%` : "0%";
|
|
326
|
+
return renderItem(stepValue, isLast ? void 0 : {
|
|
327
|
+
width,
|
|
328
|
+
overflow: "hidden",
|
|
329
|
+
position: "absolute"
|
|
330
|
+
});
|
|
331
|
+
})
|
|
332
|
+
}, itemValue);
|
|
333
|
+
});
|
|
334
|
+
const displayLabel = isInput ? void 0 : getLabelText(state.rounded ?? 0);
|
|
335
|
+
const groupProps = isInput ? {
|
|
336
|
+
role: "radiogroup",
|
|
337
|
+
"aria-labelledby": ariaLabelledby ?? fc.labelId,
|
|
338
|
+
"aria-describedby": ariaDescribedby ?? fc["aria-describedby"],
|
|
339
|
+
"aria-required": fc.required || void 0,
|
|
340
|
+
"aria-invalid": fc.error || void 0,
|
|
341
|
+
onMouseMove: state.handleMouseMove,
|
|
342
|
+
onMouseLeave: state.handleMouseLeave
|
|
343
|
+
} : {
|
|
344
|
+
role: "img",
|
|
345
|
+
"aria-labelledby": ariaLabelledby
|
|
346
|
+
};
|
|
347
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(RatingRoot, {
|
|
348
|
+
ref: rootRef,
|
|
349
|
+
id: fc.id,
|
|
350
|
+
size: fc.size,
|
|
351
|
+
color,
|
|
352
|
+
isDisabled: fc.disabled,
|
|
353
|
+
isReadOnly: readOnly,
|
|
354
|
+
isInField,
|
|
355
|
+
className,
|
|
356
|
+
"data-testid": dataTestid,
|
|
357
|
+
"aria-label": ariaLabel ?? displayLabel,
|
|
358
|
+
...groupProps,
|
|
359
|
+
...spaceProps,
|
|
360
|
+
children: [items, isInput && !fc.disabled && emptyLabelText !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(RatingEmptyLabel, {
|
|
361
|
+
color,
|
|
362
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(RatingInput, {
|
|
363
|
+
type: "radio",
|
|
364
|
+
name,
|
|
365
|
+
value: "",
|
|
366
|
+
checked: state.rounded === null,
|
|
367
|
+
onChange: state.handleChange
|
|
368
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RatingText, { children: emptyLabelText })]
|
|
369
|
+
})]
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
//#endregion
|
|
373
|
+
exports.Rating = Rating;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { nt as Theme } from "./index-XN4-ZqTB.cjs";
|
|
2
|
+
import { MouseEvent, ReactNode, SyntheticEvent } from "react";
|
|
3
|
+
import { SpaceProps } from "@soroush.tech/styled-system";
|
|
4
|
+
//#region src/Rating/Rating.d.ts
|
|
5
|
+
interface RatingProps extends SpaceProps<Theme> {
|
|
6
|
+
/** The rating - `null` for none. Controlled with `onChange`. */
|
|
7
|
+
value?: number | null;
|
|
8
|
+
/** The rating at first, when uncontrolled. */
|
|
9
|
+
defaultValue?: number | null;
|
|
10
|
+
/** Fired when the rating changes - `null` when it is cleared. */
|
|
11
|
+
onChange?: (event: SyntheticEvent<HTMLInputElement>, value: number | null) => void;
|
|
12
|
+
/** Fired as the hovered value changes - `-1` when the pointer leaves. */
|
|
13
|
+
onChangeActive?: (event: MouseEvent<HTMLElement>, value: number) => void;
|
|
14
|
+
/** How many items. Default: `5`. */
|
|
15
|
+
max?: number;
|
|
16
|
+
/** The least step - `0.5` for halves. Default: `1`. */
|
|
17
|
+
precision?: number;
|
|
18
|
+
/** Only the chosen item is filled, not every one up to it. Default: `false`. */
|
|
19
|
+
highlightSelectedOnly?: boolean;
|
|
20
|
+
/** The filled item. Default: the `star` icon. */
|
|
21
|
+
icon?: ReactNode;
|
|
22
|
+
/** The empty item. Default: the `star_border` icon. */
|
|
23
|
+
emptyIcon?: ReactNode;
|
|
24
|
+
/** The accessible name of an item (and of a read-only rating). Default: its number. */
|
|
25
|
+
getLabelText?: (value: number) => string;
|
|
26
|
+
/** Names the "no rating" radio, which clears the rating from the keys - none is drawn without it. */
|
|
27
|
+
emptyLabelText?: string;
|
|
28
|
+
/** A display: `role="img"` named by `getLabelText`, not focusable. Default: `false`. */
|
|
29
|
+
readOnly?: boolean;
|
|
30
|
+
/** Resolves against `theme.sizes`. Default: its `FormControl`'s, else `'md'`. */
|
|
31
|
+
size?: keyof Theme['sizes'];
|
|
32
|
+
/** The filled items' color - resolves to `theme.palette`. Default: its `FormControl`'s, else `'warning'`. */
|
|
33
|
+
color?: keyof Theme['palette'];
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
required?: boolean;
|
|
36
|
+
/** The empty items take the error color. */
|
|
37
|
+
error?: boolean;
|
|
38
|
+
/** Prefixes the radios' names, and submits the rating in a form. Default: generated. */
|
|
39
|
+
name?: string;
|
|
40
|
+
/** On the rating's group, which a `FormLabel` names it by. Default: its `FormControl`'s. */
|
|
41
|
+
id?: string;
|
|
42
|
+
className?: string;
|
|
43
|
+
'aria-label'?: string;
|
|
44
|
+
'aria-labelledby'?: string;
|
|
45
|
+
'aria-describedby'?: string;
|
|
46
|
+
'data-testid'?: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @description A rating: a row of icons the user sets - or, `readOnly`, shows. A group of visually
|
|
50
|
+
* hidden native radio inputs, so keys (Tab to the rating, the arrows to change it), assistive
|
|
51
|
+
* technology and forms work as the platform's; hovering previews the value, and pressing the
|
|
52
|
+
* chosen item clears it. In a `FormControl` it takes the field's size, color, error and
|
|
53
|
+
* disabled state, and its `FormLabel` names it.
|
|
54
|
+
*/
|
|
55
|
+
declare function Rating({ value, defaultValue, onChange, onChangeActive, max: maxProp, precision: precisionProp, highlightSelectedOnly: highlightSelectedOnlyProp, icon: iconProp, emptyIcon: emptyIconProp, getLabelText, emptyLabelText, readOnly, size: sizeProp, color: colorProp, disabled: disabledProp, required: requiredProp, error: errorProp, name: nameProp, id: idProp, className, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, 'aria-describedby': ariaDescribedby, 'data-testid': dataTestid, ...spaceProps }: Readonly<RatingProps>): import("react").JSX.Element;
|
|
56
|
+
//#endregion
|
|
57
|
+
export { Rating, RatingProps };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { nt as Theme } from "./index-CRQ7XLri.mjs";
|
|
2
|
+
import { SpaceProps } from "@soroush.tech/styled-system";
|
|
3
|
+
import { MouseEvent, ReactNode, SyntheticEvent } from "react";
|
|
4
|
+
//#region src/Rating/Rating.d.ts
|
|
5
|
+
interface RatingProps extends SpaceProps<Theme> {
|
|
6
|
+
/** The rating - `null` for none. Controlled with `onChange`. */
|
|
7
|
+
value?: number | null;
|
|
8
|
+
/** The rating at first, when uncontrolled. */
|
|
9
|
+
defaultValue?: number | null;
|
|
10
|
+
/** Fired when the rating changes - `null` when it is cleared. */
|
|
11
|
+
onChange?: (event: SyntheticEvent<HTMLInputElement>, value: number | null) => void;
|
|
12
|
+
/** Fired as the hovered value changes - `-1` when the pointer leaves. */
|
|
13
|
+
onChangeActive?: (event: MouseEvent<HTMLElement>, value: number) => void;
|
|
14
|
+
/** How many items. Default: `5`. */
|
|
15
|
+
max?: number;
|
|
16
|
+
/** The least step - `0.5` for halves. Default: `1`. */
|
|
17
|
+
precision?: number;
|
|
18
|
+
/** Only the chosen item is filled, not every one up to it. Default: `false`. */
|
|
19
|
+
highlightSelectedOnly?: boolean;
|
|
20
|
+
/** The filled item. Default: the `star` icon. */
|
|
21
|
+
icon?: ReactNode;
|
|
22
|
+
/** The empty item. Default: the `star_border` icon. */
|
|
23
|
+
emptyIcon?: ReactNode;
|
|
24
|
+
/** The accessible name of an item (and of a read-only rating). Default: its number. */
|
|
25
|
+
getLabelText?: (value: number) => string;
|
|
26
|
+
/** Names the "no rating" radio, which clears the rating from the keys - none is drawn without it. */
|
|
27
|
+
emptyLabelText?: string;
|
|
28
|
+
/** A display: `role="img"` named by `getLabelText`, not focusable. Default: `false`. */
|
|
29
|
+
readOnly?: boolean;
|
|
30
|
+
/** Resolves against `theme.sizes`. Default: its `FormControl`'s, else `'md'`. */
|
|
31
|
+
size?: keyof Theme['sizes'];
|
|
32
|
+
/** The filled items' color - resolves to `theme.palette`. Default: its `FormControl`'s, else `'warning'`. */
|
|
33
|
+
color?: keyof Theme['palette'];
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
required?: boolean;
|
|
36
|
+
/** The empty items take the error color. */
|
|
37
|
+
error?: boolean;
|
|
38
|
+
/** Prefixes the radios' names, and submits the rating in a form. Default: generated. */
|
|
39
|
+
name?: string;
|
|
40
|
+
/** On the rating's group, which a `FormLabel` names it by. Default: its `FormControl`'s. */
|
|
41
|
+
id?: string;
|
|
42
|
+
className?: string;
|
|
43
|
+
'aria-label'?: string;
|
|
44
|
+
'aria-labelledby'?: string;
|
|
45
|
+
'aria-describedby'?: string;
|
|
46
|
+
'data-testid'?: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @description A rating: a row of icons the user sets - or, `readOnly`, shows. A group of visually
|
|
50
|
+
* hidden native radio inputs, so keys (Tab to the rating, the arrows to change it), assistive
|
|
51
|
+
* technology and forms work as the platform's; hovering previews the value, and pressing the
|
|
52
|
+
* chosen item clears it. In a `FormControl` it takes the field's size, color, error and
|
|
53
|
+
* disabled state, and its `FormLabel` names it.
|
|
54
|
+
*/
|
|
55
|
+
declare function Rating({ value, defaultValue, onChange, onChangeActive, max: maxProp, precision: precisionProp, highlightSelectedOnly: highlightSelectedOnlyProp, icon: iconProp, emptyIcon: emptyIconProp, getLabelText, emptyLabelText, readOnly, size: sizeProp, color: colorProp, disabled: disabledProp, required: requiredProp, error: errorProp, name: nameProp, id: idProp, className, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, 'aria-describedby': ariaDescribedby, 'data-testid': dataTestid, ...spaceProps }: Readonly<RatingProps>): import("react").JSX.Element;
|
|
56
|
+
//#endregion
|
|
57
|
+
export { Rating, RatingProps };
|