@soroush.tech/design-system 2.0.0-rc.1 → 2.0.0-rc.3
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 +30 -10
- package/dist/AppBar.d.cts +1 -3
- package/dist/AppBar.d.mts +1 -3
- package/dist/Avatar.cjs +1 -1
- package/dist/Avatar.d.cts +1 -3
- package/dist/Avatar.d.mts +1 -3
- package/dist/Avatar.mjs +1 -1
- package/dist/Backdrop.d.cts +1 -1
- package/dist/Backdrop.d.mts +1 -1
- package/dist/Breadcrumbs.cjs +132 -0
- package/dist/Breadcrumbs.d.cts +40 -0
- package/dist/Breadcrumbs.d.mts +40 -0
- package/dist/Breadcrumbs.mjs +131 -0
- package/dist/Button.cjs +1 -1
- package/dist/Button.d.cts +1 -1
- package/dist/Button.d.mts +1 -1
- package/dist/Button.mjs +1 -1
- package/dist/ButtonGroup.d.cts +1 -1
- package/dist/ButtonGroup.d.mts +1 -1
- package/dist/Card.cjs +3 -3
- package/dist/Card.d.cts +4 -3
- package/dist/Card.d.mts +4 -3
- package/dist/Card.mjs +3 -3
- package/dist/Checkbox.d.cts +1 -2
- package/dist/Checkbox.d.mts +1 -2
- package/dist/CircularProgress.d.cts +2 -3
- package/dist/CircularProgress.d.mts +2 -3
- package/dist/Drawer.d.cts +3 -2
- package/dist/Drawer.d.mts +3 -2
- 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 +10 -2
- package/dist/FormControl.d.cts +9 -2
- package/dist/FormControl.d.mts +9 -2
- package/dist/FormControl.mjs +10 -2
- package/dist/FormHelperText.d.cts +1 -1
- package/dist/FormHelperText.d.mts +1 -1
- package/dist/FormLabel.cjs +9 -1
- package/dist/FormLabel.d.cts +2 -2
- package/dist/FormLabel.d.mts +2 -2
- package/dist/FormLabel.mjs +10 -2
- package/dist/Grid.d.cts +1 -3
- package/dist/Grid.d.mts +1 -3
- package/dist/{Icon-CH3asUJu.mjs → Icon-BihOAP4u.mjs} +52 -2
- package/dist/{Icon-CI6q2Eyi.cjs → Icon-D-EWsBVg.cjs} +52 -2
- 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 -2
- package/dist/Image.d.mts +1 -2
- package/dist/InputRange.cjs +675 -0
- package/dist/InputRange.d.cts +79 -0
- package/dist/InputRange.d.mts +79 -0
- package/dist/InputRange.mjs +673 -0
- package/dist/LinearProgress.d.cts +2 -3
- package/dist/LinearProgress.d.mts +2 -3
- package/dist/Link.cjs +1 -1
- package/dist/Link.d.cts +1 -1
- package/dist/Link.d.mts +1 -1
- package/dist/Link.mjs +1 -1
- package/dist/Menu/ContextMenu.cjs +146 -0
- package/dist/Menu/ContextMenu.d.cts +52 -0
- package/dist/Menu/ContextMenu.d.mts +52 -0
- package/dist/Menu/ContextMenu.mjs +145 -0
- package/dist/Menu/Menu.cjs +3 -0
- package/dist/Menu/Menu.d.cts +2 -0
- package/dist/Menu/Menu.d.mts +2 -0
- package/dist/Menu/Menu.mjs +2 -0
- package/dist/Menu/MenuDivider.cjs +29 -0
- package/dist/Menu/MenuDivider.d.cts +12 -0
- package/dist/Menu/MenuDivider.d.mts +12 -0
- package/dist/Menu/MenuDivider.mjs +28 -0
- package/dist/Menu/MenuItems.cjs +29 -0
- package/dist/Menu/MenuItems.d.cts +2 -0
- package/dist/Menu/MenuItems.d.mts +2 -0
- package/dist/Menu/MenuItems.mjs +28 -0
- package/dist/Menu/MenuList.cjs +3 -0
- package/dist/Menu/MenuList.d.cts +38 -0
- package/dist/Menu/MenuList.d.mts +38 -0
- package/dist/Menu/MenuList.mjs +2 -0
- package/dist/Menu-Cgg-sX4W.cjs +173 -0
- package/dist/Menu-CrzHc_cn.mjs +168 -0
- package/dist/Menu.cjs +13 -0
- package/dist/Menu.d.cts +7 -0
- package/dist/Menu.d.mts +7 -0
- package/dist/Menu.mjs +6 -0
- package/dist/MenuItem-BTP7Ijwi.cjs +673 -0
- package/dist/MenuItem-DUn4IZKK.mjs +649 -0
- package/dist/MenuItem.cjs +2 -148
- package/dist/MenuItem.d.cts +2 -52
- package/dist/MenuItem.d.mts +2 -52
- package/dist/MenuItem.mjs +1 -147
- package/dist/MenuList-B7msJ1IG.mjs +187 -0
- package/dist/MenuList-D4imLXAa.cjs +223 -0
- package/dist/MenuListContext-DKUOhNyw.d.cts +21 -0
- package/dist/MenuListContext-x-7lH4CH.d.mts +21 -0
- package/dist/Modal.d.cts +1 -1
- package/dist/Modal.d.mts +1 -1
- package/dist/NativeSelect.cjs +9 -8
- package/dist/NativeSelect.d.cts +3 -4
- package/dist/NativeSelect.d.mts +3 -4
- package/dist/NativeSelect.mjs +9 -8
- package/dist/NumberField.cjs +476 -0
- package/dist/NumberField.d.cts +74 -0
- package/dist/NumberField.d.mts +74 -0
- package/dist/NumberField.mjs +474 -0
- package/dist/Pagination/PaginationItem.cjs +1 -1
- package/dist/Pagination/PaginationItem.d.cts +1 -1
- package/dist/Pagination/PaginationItem.d.mts +1 -1
- package/dist/Pagination/PaginationItem.mjs +1 -1
- package/dist/Pagination.d.cts +2 -2
- package/dist/Pagination.d.mts +2 -2
- package/dist/Paper.cjs +1 -1
- package/dist/Paper.d.cts +2 -1
- package/dist/Paper.d.mts +2 -1
- package/dist/Paper.mjs +1 -1
- package/dist/{Popover-TpwRSORC.cjs → Popover-CiZfgiKE.cjs} +5 -125
- package/dist/Popover-QjM5Z1CR.mjs +133 -0
- package/dist/Popover.cjs +1 -1
- package/dist/Popover.d.cts +6 -7
- package/dist/Popover.d.mts +6 -7
- package/dist/Popover.mjs +1 -1
- package/dist/Pressable.cjs +1 -1
- package/dist/Pressable.d.cts +1 -1
- package/dist/Pressable.d.mts +1 -1
- package/dist/Pressable.mjs +1 -1
- package/dist/Quote.d.cts +2 -3
- package/dist/Quote.d.mts +2 -3
- package/dist/Radio.d.cts +1 -2
- package/dist/Radio.d.mts +1 -2
- 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/Select.cjs +5 -4
- package/dist/Select.d.cts +3 -4
- package/dist/Select.d.mts +3 -4
- package/dist/Select.mjs +7 -6
- package/dist/Sidebar/Sidebar.d.cts +1 -1
- package/dist/Sidebar/Sidebar.d.mts +1 -1
- package/dist/Sidebar/SidebarItem.cjs +1 -1
- package/dist/Sidebar/SidebarItem.d.cts +3 -4
- package/dist/Sidebar/SidebarItem.d.mts +3 -4
- package/dist/Sidebar/SidebarItem.mjs +3 -3
- package/dist/Skeleton.d.cts +1 -2
- package/dist/Skeleton.d.mts +1 -2
- package/dist/Switch.cjs +23 -16
- package/dist/Switch.d.cts +2 -3
- package/dist/Switch.d.mts +2 -3
- package/dist/Switch.mjs +25 -18
- package/dist/Table/Table.d.cts +2 -3
- package/dist/Table/Table.d.mts +2 -3
- package/dist/Table/TableBody.d.cts +1 -2
- package/dist/Table/TableBody.d.mts +1 -2
- package/dist/Table/TableCell.d.cts +1 -1
- package/dist/Table/TableCell.d.mts +1 -1
- package/dist/Table/TableContainer.d.cts +1 -3
- package/dist/Table/TableContainer.d.mts +1 -3
- 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 -2
- package/dist/Table/TableFooter.d.mts +1 -2
- package/dist/Table/TableHead.d.cts +1 -2
- package/dist/Table/TableHead.d.mts +1 -2
- package/dist/Table/TablePagination.d.cts +2 -2
- package/dist/Table/TablePagination.d.mts +2 -2
- 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 -2
- package/dist/Table/TableRow.d.mts +1 -2
- 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-BeCxbtHH.d.cts → TableContext-DhuRf6Wy.d.mts} +1 -1
- package/dist/{TableContext-BiRiYkVZ.d.mts → TableContext-Duj1nVG7.d.cts} +1 -1
- package/dist/Tabs/Tab.cjs +306 -0
- package/dist/Tabs/Tab.d.cts +62 -0
- package/dist/Tabs/Tab.d.mts +62 -0
- package/dist/Tabs/Tab.mjs +305 -0
- package/dist/Tabs/TabContext.cjs +34 -0
- package/dist/Tabs/TabContext.d.cts +20 -0
- package/dist/Tabs/TabContext.d.mts +20 -0
- package/dist/Tabs/TabContext.mjs +33 -0
- package/dist/Tabs/TabList.cjs +31 -0
- package/dist/Tabs/TabList.d.cts +11 -0
- package/dist/Tabs/TabList.d.mts +11 -0
- package/dist/Tabs/TabList.mjs +30 -0
- package/dist/Tabs/TabPanel.cjs +40 -0
- package/dist/Tabs/TabPanel.d.cts +27 -0
- package/dist/Tabs/TabPanel.d.mts +27 -0
- package/dist/Tabs/TabPanel.mjs +38 -0
- package/dist/Tabs/TabScrollButton.cjs +93 -0
- package/dist/Tabs/TabScrollButton.d.cts +2 -0
- package/dist/Tabs/TabScrollButton.d.mts +2 -0
- package/dist/Tabs/TabScrollButton.mjs +91 -0
- package/dist/Tabs/Tabs.cjs +3 -0
- package/dist/Tabs/Tabs.d.cts +3 -0
- package/dist/Tabs/Tabs.d.mts +3 -0
- package/dist/Tabs/Tabs.mjs +2 -0
- package/dist/Tabs-BTNOJx5v.mjs +634 -0
- package/dist/Tabs-D4tWCq78.cjs +646 -0
- package/dist/Tabs.cjs +13 -0
- package/dist/Tabs.d.cts +8 -0
- package/dist/Tabs.d.mts +8 -0
- package/dist/Tabs.mjs +7 -0
- package/dist/TabsContext-B_XHbjcS.d.cts +6 -0
- package/dist/TabsContext-Dn2kqUwr.d.mts +6 -0
- package/dist/TabsValueContext-D40zGCpE.cjs +19 -0
- package/dist/TabsValueContext-DvL3inf7.mjs +8 -0
- package/dist/TextInput.cjs +4 -4
- package/dist/TextInput.d.cts +2 -3
- package/dist/TextInput.d.mts +2 -3
- package/dist/TextInput.mjs +4 -4
- package/dist/ToggleButton/ToggleButton.cjs +1 -1
- package/dist/ToggleButton/ToggleButton.d.cts +1 -1
- package/dist/ToggleButton/ToggleButton.d.mts +1 -1
- package/dist/ToggleButton/ToggleButton.mjs +1 -1
- 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/TransferList.cjs +356 -0
- package/dist/TransferList.d.cts +67 -0
- package/dist/TransferList.d.mts +67 -0
- package/dist/TransferList.mjs +354 -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/catalog.cjs +4568 -0
- package/dist/catalog.d.cts +90 -0
- package/dist/catalog.d.mts +90 -0
- package/dist/catalog.mjs +4567 -0
- package/dist/computePopoverPosition-BIprs_xo.mjs +123 -0
- package/dist/computePopoverPosition-DiyEOHnU.cjs +128 -0
- package/dist/dividerLine-BNljcGlv.cjs +66 -0
- package/dist/dividerLine-FahY-M6_.mjs +31 -0
- package/dist/engine.d.cts +1 -1
- package/dist/engine.d.mts +1 -1
- package/dist/index-B1RFybA_.d.mts +72 -0
- package/dist/index-B4TeaB7b.d.cts +72 -0
- package/dist/{index-BUoVTCqX.d.mts → index-BGbTuHP9.d.mts} +1 -2
- package/dist/{index-Celm-8iN.d.cts → index-BHKgEOZJ.d.cts} +2 -3
- package/dist/{index-Chg6pSrr.d.mts → index-BQWjh4rK.d.mts} +2 -3
- package/dist/{index-B78VkB0-.d.cts → index-BelFIizY.d.cts} +2 -3
- package/dist/index-BkzZxHVj.d.mts +35 -0
- package/dist/{index-DbEnSf2m.d.cts → index-BrgwkY6z.d.mts} +3 -4
- package/dist/{index-Wnv6jCR3.d.mts → index-Bx0-6yeX.d.mts} +1 -2
- package/dist/index-BxVTIMnB.d.cts +1 -0
- package/dist/{index-BfZuh9c2.d.mts → index-ByYxVl9O.d.mts} +2 -3
- package/dist/index-CE5JG1us.d.mts +34 -0
- package/dist/{index-BhibLnZ0.d.cts → index-CG_1uPrD.d.mts} +2 -3
- package/dist/{themes-RX2UX5gD.d.mts → index-CJhK7JND.d.mts} +265 -8
- package/dist/{index-BB-dLv5V.d.mts → index-CQfJZADG.d.cts} +3 -4
- package/dist/{index-CxUsrlg1.d.cts → index-CUz2h5xY.d.mts} +2 -3
- package/dist/{index-Bid71KeF.d.cts → index-CbFaWtjK.d.mts} +2 -2
- package/dist/{index-DdqdSOct.d.cts → index-ChXeKJCk.d.cts} +1 -2
- package/dist/index-CknoXDLQ.d.cts +35 -0
- package/dist/{index-BSqet8aO.d.cts → index-ClZyaZrR.d.mts} +2 -3
- package/dist/{index-DXvQ-JVZ.d.mts → index-DAwcmIjN.d.cts} +2 -3
- package/dist/index-DGnXJwLj.d.mts +72 -0
- package/dist/{themes-Kbk9h5cN.d.cts → index-DJ0f69wh.d.cts} +262 -5
- package/dist/index-DWjz5ZzG.d.cts +72 -0
- package/dist/{index-DNwF3DUX.d.cts → index-DYF8sRE-.d.cts} +2 -3
- package/dist/index-DaIIo5QU.d.mts +1 -0
- package/dist/{index-CrN4MSUF.d.cts → index-DchHf5cF.d.cts} +1 -1
- package/dist/{index-S-ClM6WM.d.mts → index-DtYjdBvO.d.cts} +2 -2
- package/dist/{index-Ctqajtac.d.cts → index-Dv_fk1_F.d.cts} +27 -3
- package/dist/{index-smqjMLAZ.d.mts → index-K5exjvnX.d.cts} +2 -3
- package/dist/index-KnXhlKMr.d.cts +34 -0
- package/dist/index-WHFhjfgy.d.cts +98 -0
- package/dist/{index-GpnmW6vu.d.mts → index-YKrfFC_I.d.cts} +2 -3
- package/dist/index-bpnLB_4K.d.mts +98 -0
- package/dist/{index-VOsBSWEu.d.mts → index-h4dYtVrp.d.mts} +1 -1
- package/dist/{index-DO9J-Fla.d.mts → index-ha1WjSZ5.d.mts} +27 -3
- package/dist/{index-Belxmt1X.d.cts → index-nqUA_6J_.d.cts} +1 -2
- package/dist/{index-nc4Sxiy9.d.mts → index-pTNq3iQn.d.mts} +2 -3
- package/dist/index.d.cts +1 -2
- package/dist/index.d.mts +1 -2
- 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/surfaceSystem-BGQBoXv_.cjs +38 -0
- package/dist/surfaceSystem-D8TbmKy3.mjs +21 -0
- package/dist/theme-BxXuXRgQ.cjs +137 -0
- package/dist/theme-Z9_QludW.mjs +102 -0
- package/dist/theme.cjs +25 -24
- package/dist/theme.d.cts +3 -3
- package/dist/theme.d.mts +3 -3
- package/dist/theme.mjs +2 -1
- package/dist/{theme-CDVxig_g.mjs → themes-L-dE7_ck.mjs} +10 -110
- package/dist/{theme-BXlAP3xf.cjs → themes-gd6tcmqS.cjs} +0 -136
- package/dist/useControlled-C666KpQ0.cjs +18 -0
- package/dist/useControlled-CBRLsO-H.mjs +13 -0
- package/dist/{useTablePagination-COTiNH_8.d.mts → useTablePagination-C-u3ru4N.d.cts} +1 -1
- package/dist/{useTablePagination-WFkaUZu8.d.cts → useTablePagination-D-39ZmQh.d.mts} +1 -1
- package/package.json +83 -2
- package/dist/Popover-DwnSLpp1.mjs +0 -253
- package/dist/index-B_dKjEDR.d.mts +0 -23
- package/dist/index-C1WqEDtQ.d.mts +0 -69
- package/dist/index-CA7HnbtH.d.cts +0 -21
- package/dist/index-CKZaErxJ.d.mts +0 -21
- package/dist/index-DBUwu65Z.d.cts +0 -69
- package/dist/index-DzQJSYIh.d.cts +0 -23
- package/dist/index-cuv3o-L7.d.mts +0 -34
- package/dist/index-nB94D7UM.d.cts +0 -34
package/dist/Rating.mjs
ADDED
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
import { a as src_exports, i as props, o as styled, t as createShouldForwardProp } from "./src-DLGYOJMh.mjs";
|
|
2
|
+
import { clamp } from "./utils.mjs";
|
|
3
|
+
import { n as useDefaultProps } from "./theme-Z9_QludW.mjs";
|
|
4
|
+
import { t as Icon } from "./Icon-BihOAP4u.mjs";
|
|
5
|
+
import { t as FormControlContext } from "./FormControlContext-CC2kToms.mjs";
|
|
6
|
+
import { useFormControl } from "./FormControl.mjs";
|
|
7
|
+
import { t as isRtl } from "./isRtl-BJDtm86G.mjs";
|
|
8
|
+
import { t as useControlled } from "./useControlled-CBRLsO-H.mjs";
|
|
9
|
+
import { r as roundToPrecision } from "./precision-B1lhxnnO.mjs";
|
|
10
|
+
import { useContext, useId, useRef, useState } from "react";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
//#region src/Rating/utils/precision.ts
|
|
13
|
+
/** The value under the pointer: along the width, rounded to a step, between one step and `max`. */
|
|
14
|
+
function getHoverValue({ offset, width, max, precision }) {
|
|
15
|
+
const raw = max * (offset / width) + precision / 2;
|
|
16
|
+
return clamp(roundToPrecision(raw, precision), precision, max);
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/Rating/hooks/useRating.ts
|
|
20
|
+
const NONE = -1;
|
|
21
|
+
const parseRating = (raw) => raw === "" ? null : Number.parseFloat(raw);
|
|
22
|
+
const getDisplayValue = (focus, rounded) => focus === NONE ? rounded : focus;
|
|
23
|
+
/**
|
|
24
|
+
* A rating's state: the rating itself (controlled or not, rounded to its precision), what the
|
|
25
|
+
* pointer and the focus are on, and the handlers that move them. The pointer takes priority over
|
|
26
|
+
* the keys when both change at once, and pressing the chosen item again clears it.
|
|
27
|
+
*/
|
|
28
|
+
function useRating({ value: valueProp, defaultValue, precision, max, rootRef, onChange, onChangeActive }) {
|
|
29
|
+
const [value, setValue] = useControlled({
|
|
30
|
+
controlled: valueProp,
|
|
31
|
+
default: defaultValue ?? null
|
|
32
|
+
});
|
|
33
|
+
const rounded = roundToPrecision(value, precision);
|
|
34
|
+
const [{ hover, focus }, setActive] = useState({
|
|
35
|
+
hover: NONE,
|
|
36
|
+
focus: NONE
|
|
37
|
+
});
|
|
38
|
+
const handleMouseMove = (event) => {
|
|
39
|
+
const { left, right, width } = rootRef.current.getBoundingClientRect();
|
|
40
|
+
if (width === 0) return;
|
|
41
|
+
const next = getHoverValue({
|
|
42
|
+
offset: isRtl(rootRef.current) ? right - event.clientX : event.clientX - left,
|
|
43
|
+
width,
|
|
44
|
+
max,
|
|
45
|
+
precision
|
|
46
|
+
});
|
|
47
|
+
setActive({
|
|
48
|
+
hover: next,
|
|
49
|
+
focus: next
|
|
50
|
+
});
|
|
51
|
+
if (hover !== next) onChangeActive?.(event, next);
|
|
52
|
+
};
|
|
53
|
+
const handleMouseLeave = (event) => {
|
|
54
|
+
setActive({
|
|
55
|
+
hover: NONE,
|
|
56
|
+
focus: NONE
|
|
57
|
+
});
|
|
58
|
+
if (hover !== NONE) onChangeActive?.(event, NONE);
|
|
59
|
+
};
|
|
60
|
+
const handleChange = (event) => {
|
|
61
|
+
const next = hover === NONE ? parseRating(event.currentTarget.value) : hover;
|
|
62
|
+
setValue(next);
|
|
63
|
+
onChange?.(event, next);
|
|
64
|
+
};
|
|
65
|
+
const handleClear = (event) => {
|
|
66
|
+
if (event.clientX === 0 && event.clientY === 0) return;
|
|
67
|
+
setActive({
|
|
68
|
+
hover: NONE,
|
|
69
|
+
focus: NONE
|
|
70
|
+
});
|
|
71
|
+
setValue(null);
|
|
72
|
+
if (Number.parseFloat(event.currentTarget.value) === rounded) onChange?.(event, null);
|
|
73
|
+
};
|
|
74
|
+
const handleFocus = (event) => {
|
|
75
|
+
const next = Number.parseFloat(event.currentTarget.value);
|
|
76
|
+
setActive((previous) => ({
|
|
77
|
+
hover: previous.hover,
|
|
78
|
+
focus: next
|
|
79
|
+
}));
|
|
80
|
+
};
|
|
81
|
+
const handleBlur = () => {
|
|
82
|
+
if (hover !== NONE) return;
|
|
83
|
+
setActive((previous) => ({
|
|
84
|
+
hover: previous.hover,
|
|
85
|
+
focus: NONE
|
|
86
|
+
}));
|
|
87
|
+
};
|
|
88
|
+
return {
|
|
89
|
+
rounded,
|
|
90
|
+
displayValue: getDisplayValue(focus, rounded),
|
|
91
|
+
isActive: hover !== NONE || focus !== NONE,
|
|
92
|
+
handleMouseMove,
|
|
93
|
+
handleMouseLeave,
|
|
94
|
+
handleChange,
|
|
95
|
+
handleClear,
|
|
96
|
+
handleFocus,
|
|
97
|
+
handleBlur
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region src/Rating/Rating.tsx
|
|
102
|
+
const visuallyHidden = {
|
|
103
|
+
position: "absolute",
|
|
104
|
+
width: 1,
|
|
105
|
+
height: 1,
|
|
106
|
+
margin: -1,
|
|
107
|
+
padding: 0,
|
|
108
|
+
border: 0,
|
|
109
|
+
overflow: "hidden",
|
|
110
|
+
clip: "rect(0 0 0 0)",
|
|
111
|
+
whiteSpace: "nowrap"
|
|
112
|
+
};
|
|
113
|
+
const RatingRoot = styled("span", {
|
|
114
|
+
name: "Rating",
|
|
115
|
+
label: "Rating",
|
|
116
|
+
shouldForwardProp: createShouldForwardProp([
|
|
117
|
+
...props,
|
|
118
|
+
"size",
|
|
119
|
+
"color",
|
|
120
|
+
"isDisabled",
|
|
121
|
+
"isReadOnly",
|
|
122
|
+
"isInField"
|
|
123
|
+
]),
|
|
124
|
+
systemProps: [src_exports.space]
|
|
125
|
+
})(({ theme, size, isDisabled, isReadOnly, isInField }) => ({
|
|
126
|
+
display: isInField ? "flex" : "inline-flex",
|
|
127
|
+
position: "relative",
|
|
128
|
+
width: "min-content",
|
|
129
|
+
fontSize: theme.icon[size],
|
|
130
|
+
lineHeight: 1,
|
|
131
|
+
cursor: isReadOnly ? "default" : "pointer",
|
|
132
|
+
...isDisabled && {
|
|
133
|
+
opacity: .5,
|
|
134
|
+
cursor: "not-allowed"
|
|
135
|
+
},
|
|
136
|
+
...(isDisabled || isReadOnly) && { pointerEvents: "none" }
|
|
137
|
+
}));
|
|
138
|
+
const focusRing = (theme, color) => {
|
|
139
|
+
const main = (0, src_exports.get)(theme, `palette.${color}.main`);
|
|
140
|
+
return {
|
|
141
|
+
outline: `${theme.borderWidths.base} solid ${main}`,
|
|
142
|
+
outlineOffset: theme.borderWidths.thin
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
const RatingItem = styled("label", {
|
|
146
|
+
name: "Rating",
|
|
147
|
+
slot: "item",
|
|
148
|
+
label: "RatingItem",
|
|
149
|
+
shouldForwardProp: createShouldForwardProp(["color"])
|
|
150
|
+
})(({ theme, color }) => ({
|
|
151
|
+
display: "block",
|
|
152
|
+
position: "relative",
|
|
153
|
+
cursor: "inherit",
|
|
154
|
+
"&:has(input:focus-visible)": focusRing(theme, color)
|
|
155
|
+
}));
|
|
156
|
+
const RatingEmptyLabel = styled("label", {
|
|
157
|
+
name: "Rating",
|
|
158
|
+
slot: "emptyLabel",
|
|
159
|
+
label: "RatingEmptyLabel",
|
|
160
|
+
shouldForwardProp: createShouldForwardProp(["color"])
|
|
161
|
+
})(({ theme, color }) => ({
|
|
162
|
+
position: "absolute",
|
|
163
|
+
inset: 0,
|
|
164
|
+
pointerEvents: "none",
|
|
165
|
+
"&:has(input:focus-visible)": focusRing(theme, color)
|
|
166
|
+
}));
|
|
167
|
+
const RatingInput = styled("input", {
|
|
168
|
+
name: "Rating",
|
|
169
|
+
slot: "input",
|
|
170
|
+
label: "RatingInput"
|
|
171
|
+
})(visuallyHidden);
|
|
172
|
+
const RatingText = styled("span", {
|
|
173
|
+
name: "Rating",
|
|
174
|
+
slot: "text",
|
|
175
|
+
label: "RatingText"
|
|
176
|
+
})(visuallyHidden);
|
|
177
|
+
const getIconColor = (theme, { color, isFilled, isError }) => {
|
|
178
|
+
if (isFilled) return (0, src_exports.get)(theme, `palette.${color}.main`);
|
|
179
|
+
if (isError) return (0, src_exports.get)(theme, "palette.error.main");
|
|
180
|
+
return (0, src_exports.get)(theme, "text.disabled");
|
|
181
|
+
};
|
|
182
|
+
const activeTransform = (isActive) => isActive ? "scale(1.2)" : "none";
|
|
183
|
+
const RatingIcon = styled("span", {
|
|
184
|
+
name: "Rating",
|
|
185
|
+
slot: "icon",
|
|
186
|
+
label: "RatingIcon",
|
|
187
|
+
shouldForwardProp: createShouldForwardProp([
|
|
188
|
+
"color",
|
|
189
|
+
"isFilled",
|
|
190
|
+
"isActive",
|
|
191
|
+
"isError"
|
|
192
|
+
])
|
|
193
|
+
})(({ theme, ...style }) => ({
|
|
194
|
+
display: "flex",
|
|
195
|
+
flexShrink: 0,
|
|
196
|
+
width: "max-content",
|
|
197
|
+
pointerEvents: "none",
|
|
198
|
+
color: getIconColor(theme, style),
|
|
199
|
+
transition: "transform 0.2s",
|
|
200
|
+
transform: activeTransform(style.isActive),
|
|
201
|
+
"@media (prefers-reduced-motion: reduce)": { transition: "none" }
|
|
202
|
+
}));
|
|
203
|
+
const RatingDecimal = styled("span", {
|
|
204
|
+
name: "Rating",
|
|
205
|
+
slot: "decimal",
|
|
206
|
+
label: "RatingDecimal",
|
|
207
|
+
shouldForwardProp: createShouldForwardProp(["isActive"])
|
|
208
|
+
})(({ isActive }) => ({
|
|
209
|
+
position: "relative",
|
|
210
|
+
display: "flex",
|
|
211
|
+
transition: "transform 0.2s",
|
|
212
|
+
transform: activeTransform(isActive),
|
|
213
|
+
"@media (prefers-reduced-motion: reduce)": { transition: "none" }
|
|
214
|
+
}));
|
|
215
|
+
function Item({ itemValue, isFilled, isActive, isChecked, isInteractive, label, labelStyle, icon, emptyIcon, name, required, disabled, color, isError, state }) {
|
|
216
|
+
const glyph = /* @__PURE__ */ jsx(RatingIcon, {
|
|
217
|
+
color,
|
|
218
|
+
isFilled,
|
|
219
|
+
isActive,
|
|
220
|
+
isError,
|
|
221
|
+
children: isFilled ? icon : emptyIcon
|
|
222
|
+
});
|
|
223
|
+
if (!isInteractive) return /* @__PURE__ */ jsx(RatingItem, {
|
|
224
|
+
as: "span",
|
|
225
|
+
color,
|
|
226
|
+
style: labelStyle,
|
|
227
|
+
children: glyph
|
|
228
|
+
});
|
|
229
|
+
return /* @__PURE__ */ jsxs(RatingItem, {
|
|
230
|
+
color,
|
|
231
|
+
style: labelStyle,
|
|
232
|
+
children: [
|
|
233
|
+
glyph,
|
|
234
|
+
/* @__PURE__ */ jsx(RatingText, { children: label }),
|
|
235
|
+
/* @__PURE__ */ jsx(RatingInput, {
|
|
236
|
+
type: "radio",
|
|
237
|
+
name,
|
|
238
|
+
value: itemValue,
|
|
239
|
+
checked: isChecked,
|
|
240
|
+
required,
|
|
241
|
+
disabled,
|
|
242
|
+
onChange: state.handleChange,
|
|
243
|
+
onClick: state.handleClear,
|
|
244
|
+
onFocus: state.handleFocus,
|
|
245
|
+
onBlur: state.handleBlur
|
|
246
|
+
})
|
|
247
|
+
]
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* @description A rating: a row of icons the user sets - or, `readOnly`, shows. A group of visually
|
|
252
|
+
* hidden native radio inputs, so keys (Tab to the rating, the arrows to change it), assistive
|
|
253
|
+
* technology and forms work as the platform's; hovering previews the value, and pressing the
|
|
254
|
+
* chosen item clears it. In a `FormControl` it takes the field's size, color, error and
|
|
255
|
+
* disabled state, and its `FormLabel` names it.
|
|
256
|
+
*/
|
|
257
|
+
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 }) {
|
|
258
|
+
const dp = useDefaultProps("Rating");
|
|
259
|
+
const isInField = useContext(FormControlContext) !== null;
|
|
260
|
+
const fc = useFormControl({
|
|
261
|
+
id: idProp,
|
|
262
|
+
error: errorProp,
|
|
263
|
+
disabled: disabledProp,
|
|
264
|
+
required: requiredProp,
|
|
265
|
+
size: sizeProp ?? dp.size,
|
|
266
|
+
color: colorProp ?? dp.color
|
|
267
|
+
});
|
|
268
|
+
const color = fc.color ?? "warning";
|
|
269
|
+
const max = maxProp ?? dp.max ?? 5;
|
|
270
|
+
const precision = precisionProp ?? dp.precision ?? 1;
|
|
271
|
+
const highlightSelectedOnly = highlightSelectedOnlyProp ?? dp.highlightSelectedOnly ?? false;
|
|
272
|
+
const icon = iconProp ?? /* @__PURE__ */ jsx(Icon, {
|
|
273
|
+
name: "star",
|
|
274
|
+
size: "1em",
|
|
275
|
+
color: "inherit"
|
|
276
|
+
});
|
|
277
|
+
const emptyIcon = emptyIconProp ?? /* @__PURE__ */ jsx(Icon, {
|
|
278
|
+
name: "star_border",
|
|
279
|
+
size: "1em",
|
|
280
|
+
color: "inherit"
|
|
281
|
+
});
|
|
282
|
+
const generatedName = useId();
|
|
283
|
+
const name = nameProp ?? generatedName;
|
|
284
|
+
const isInput = !readOnly;
|
|
285
|
+
const rootRef = useRef(null);
|
|
286
|
+
const state = useRating({
|
|
287
|
+
value,
|
|
288
|
+
defaultValue,
|
|
289
|
+
precision,
|
|
290
|
+
max,
|
|
291
|
+
rootRef,
|
|
292
|
+
onChange,
|
|
293
|
+
onChangeActive
|
|
294
|
+
});
|
|
295
|
+
const shown = state.displayValue ?? 0;
|
|
296
|
+
const renderItem = (itemValue, labelStyle, isActive = false) => /* @__PURE__ */ jsx(Item, {
|
|
297
|
+
itemValue,
|
|
298
|
+
isFilled: highlightSelectedOnly ? itemValue === shown : itemValue <= shown,
|
|
299
|
+
isActive,
|
|
300
|
+
isChecked: itemValue === state.rounded,
|
|
301
|
+
isInteractive: isInput,
|
|
302
|
+
label: getLabelText(itemValue),
|
|
303
|
+
labelStyle,
|
|
304
|
+
icon,
|
|
305
|
+
emptyIcon,
|
|
306
|
+
name,
|
|
307
|
+
required: fc.required,
|
|
308
|
+
disabled: fc.disabled,
|
|
309
|
+
color,
|
|
310
|
+
isError: fc.error,
|
|
311
|
+
state
|
|
312
|
+
}, itemValue);
|
|
313
|
+
const items = Array.from({ length: max }, (_, index) => {
|
|
314
|
+
const itemValue = index + 1;
|
|
315
|
+
const isActive = state.isActive && itemValue === Math.ceil(shown);
|
|
316
|
+
if (precision >= 1) return renderItem(itemValue, void 0, isActive);
|
|
317
|
+
const steps = Math.round(1 / precision);
|
|
318
|
+
return /* @__PURE__ */ jsx(RatingDecimal, {
|
|
319
|
+
isActive,
|
|
320
|
+
children: Array.from({ length: steps }, (__, step) => {
|
|
321
|
+
const stepValue = roundToPrecision(itemValue - 1 + (step + 1) * precision, precision);
|
|
322
|
+
const isLast = step === steps - 1;
|
|
323
|
+
const width = stepValue === state.displayValue ? `${(step + 1) * precision * 100}%` : "0%";
|
|
324
|
+
return renderItem(stepValue, isLast ? void 0 : {
|
|
325
|
+
width,
|
|
326
|
+
overflow: "hidden",
|
|
327
|
+
position: "absolute"
|
|
328
|
+
});
|
|
329
|
+
})
|
|
330
|
+
}, itemValue);
|
|
331
|
+
});
|
|
332
|
+
const displayLabel = isInput ? void 0 : getLabelText(state.rounded ?? 0);
|
|
333
|
+
const groupProps = isInput ? {
|
|
334
|
+
role: "radiogroup",
|
|
335
|
+
"aria-labelledby": ariaLabelledby ?? fc.labelId,
|
|
336
|
+
"aria-describedby": ariaDescribedby ?? fc["aria-describedby"],
|
|
337
|
+
"aria-required": fc.required || void 0,
|
|
338
|
+
"aria-invalid": fc.error || void 0,
|
|
339
|
+
onMouseMove: state.handleMouseMove,
|
|
340
|
+
onMouseLeave: state.handleMouseLeave
|
|
341
|
+
} : {
|
|
342
|
+
role: "img",
|
|
343
|
+
"aria-labelledby": ariaLabelledby
|
|
344
|
+
};
|
|
345
|
+
return /* @__PURE__ */ jsxs(RatingRoot, {
|
|
346
|
+
ref: rootRef,
|
|
347
|
+
id: fc.id,
|
|
348
|
+
size: fc.size,
|
|
349
|
+
color,
|
|
350
|
+
isDisabled: fc.disabled,
|
|
351
|
+
isReadOnly: readOnly,
|
|
352
|
+
isInField,
|
|
353
|
+
className,
|
|
354
|
+
"data-testid": dataTestid,
|
|
355
|
+
"aria-label": ariaLabel ?? displayLabel,
|
|
356
|
+
...groupProps,
|
|
357
|
+
...spaceProps,
|
|
358
|
+
children: [items, isInput && !fc.disabled && emptyLabelText !== void 0 && /* @__PURE__ */ jsxs(RatingEmptyLabel, {
|
|
359
|
+
color,
|
|
360
|
+
children: [/* @__PURE__ */ jsx(RatingInput, {
|
|
361
|
+
type: "radio",
|
|
362
|
+
name,
|
|
363
|
+
value: "",
|
|
364
|
+
checked: state.rounded === null,
|
|
365
|
+
onChange: state.handleChange
|
|
366
|
+
}), /* @__PURE__ */ jsx(RatingText, { children: emptyLabelText })]
|
|
367
|
+
})]
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
//#endregion
|
|
371
|
+
export { Rating };
|
package/dist/Select.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_src = require("./src-DU81aGy9.cjs");
|
|
3
3
|
const require_themeDefault = require("./themeDefault-Cebi08Cv.cjs");
|
|
4
|
-
const require_theme = require("./theme-
|
|
5
|
-
const require_Icon = require("./Icon-
|
|
4
|
+
const require_theme = require("./theme-BxXuXRgQ.cjs");
|
|
5
|
+
const require_Icon = require("./Icon-D-EWsBVg.cjs");
|
|
6
6
|
const require_FormControl = require("./FormControl.cjs");
|
|
7
7
|
const require_inputVariantStyles = require("./inputVariantStyles-BBkkYQtE.cjs");
|
|
8
8
|
const require_NativeSelect = require("./NativeSelect.cjs");
|
|
9
|
-
const require_Popover = require("./Popover-
|
|
9
|
+
const require_Popover = require("./Popover-CiZfgiKE.cjs");
|
|
10
10
|
let react = require("react");
|
|
11
11
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
12
12
|
let _soroush_tech_styled_system_should_forward_prop = require("@soroush.tech/styled-system/should-forward-prop");
|
|
@@ -230,7 +230,7 @@ const ListBox = require_src.styled("ul", {
|
|
|
230
230
|
overflowY: "auto",
|
|
231
231
|
listStyle: "none"
|
|
232
232
|
}));
|
|
233
|
-
function Select({ children, native = false, multiple = false, autoWidth = false, value: valueProp, defaultValue, onChange, open: openProp, defaultOpen, onOpen, onClose, placeholder, renderValue, borderRadius, color: colorProp, textColor: textColorProp, bg: bgProp, disabled: disabledProp, error: errorProp, fullWidth: fullWidthProp, required: requiredProp, size: sizeProp, variant: variantProp, iconName, iconProps, id: idProp, name, labelId, "aria-label": ariaLabel, className, "data-testid": dataTestid, ...spaceProps }) {
|
|
233
|
+
function Select({ children, native = false, multiple = false, autoWidth = false, value: valueProp, defaultValue, onChange, open: openProp, defaultOpen, onOpen, onClose, placeholder, renderValue, borderRadius, color: colorProp, textColor: textColorProp, bg: bgProp, disabled: disabledProp, error: errorProp, fullWidth: fullWidthProp, required: requiredProp, size: sizeProp, variant: variantProp, iconName, iconProps, id: idProp, name, labelId: labelIdProp, "aria-label": ariaLabel, className, "data-testid": dataTestid, ...spaceProps }) {
|
|
234
234
|
const fc = require_FormControl.useFormControl({
|
|
235
235
|
id: idProp,
|
|
236
236
|
error: errorProp,
|
|
@@ -242,6 +242,7 @@ function Select({ children, native = false, multiple = false, autoWidth = false,
|
|
|
242
242
|
textColor: textColorProp
|
|
243
243
|
});
|
|
244
244
|
const { id, error, disabled, required, size, fullWidth } = fc;
|
|
245
|
+
const labelId = labelIdProp ?? fc.labelId;
|
|
245
246
|
const theme = require_theme.useTheme();
|
|
246
247
|
const color = fc.color ?? require_themeDefault.themeDefault(theme, "color", "primary");
|
|
247
248
|
const bg = bgProp ?? require_themeDefault.themeDefault(theme, "inputBg", "terminal");
|
package/dist/Select.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./index-
|
|
3
|
-
import { n as IconProps, r as IconName } from "./index-Ctqajtac.cjs";
|
|
1
|
+
import { W as Theme } from "./index-DJ0f69wh.cjs";
|
|
2
|
+
import { n as IconProps, r as IconName } from "./index-Dv_fk1_F.cjs";
|
|
4
3
|
import { ReactNode } from "react";
|
|
5
4
|
import { LayoutProps, SpaceProps } from "@soroush.tech/styled-system";
|
|
6
5
|
//#region src/Select/utils/isOptionSelected.d.ts
|
|
@@ -65,6 +64,6 @@ interface SelectProps extends SpaceProps<Theme>, Pick<LayoutProps<Theme>, 'width
|
|
|
65
64
|
className?: string;
|
|
66
65
|
'data-testid'?: string;
|
|
67
66
|
}
|
|
68
|
-
declare function Select({ children, native, multiple, autoWidth, value: valueProp, defaultValue, onChange, open: openProp, defaultOpen, onOpen, onClose, placeholder, renderValue, borderRadius, color: colorProp, textColor: textColorProp, bg: bgProp, disabled: disabledProp, error: errorProp, fullWidth: fullWidthProp, required: requiredProp, size: sizeProp, variant: variantProp, iconName, iconProps, id: idProp, name, labelId, 'aria-label': ariaLabel, className, 'data-testid': dataTestid, ...spaceProps }: Readonly<SelectProps>): import("react").JSX.Element;
|
|
67
|
+
declare function Select({ children, native, multiple, autoWidth, value: valueProp, defaultValue, onChange, open: openProp, defaultOpen, onOpen, onClose, placeholder, renderValue, borderRadius, color: colorProp, textColor: textColorProp, bg: bgProp, disabled: disabledProp, error: errorProp, fullWidth: fullWidthProp, required: requiredProp, size: sizeProp, variant: variantProp, iconName, iconProps, id: idProp, name, labelId: labelIdProp, 'aria-label': ariaLabel, className, 'data-testid': dataTestid, ...spaceProps }: Readonly<SelectProps>): import("react").JSX.Element;
|
|
69
68
|
//#endregion
|
|
70
69
|
export { Select, SelectBackgroundToken, SelectColor, SelectProps, SelectSize, SelectTextColor, type SelectValue, SelectVariant };
|
package/dist/Select.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./index-
|
|
3
|
-
import { n as IconProps, r as IconName } from "./index-DO9J-Fla.mjs";
|
|
1
|
+
import { W as Theme } from "./index-CJhK7JND.mjs";
|
|
2
|
+
import { n as IconProps, r as IconName } from "./index-ha1WjSZ5.mjs";
|
|
4
3
|
import { LayoutProps, SpaceProps } from "@soroush.tech/styled-system";
|
|
5
4
|
import { ReactNode } from "react";
|
|
6
5
|
//#region src/Select/utils/isOptionSelected.d.ts
|
|
@@ -65,6 +64,6 @@ interface SelectProps extends SpaceProps<Theme>, Pick<LayoutProps<Theme>, 'width
|
|
|
65
64
|
className?: string;
|
|
66
65
|
'data-testid'?: string;
|
|
67
66
|
}
|
|
68
|
-
declare function Select({ children, native, multiple, autoWidth, value: valueProp, defaultValue, onChange, open: openProp, defaultOpen, onOpen, onClose, placeholder, renderValue, borderRadius, color: colorProp, textColor: textColorProp, bg: bgProp, disabled: disabledProp, error: errorProp, fullWidth: fullWidthProp, required: requiredProp, size: sizeProp, variant: variantProp, iconName, iconProps, id: idProp, name, labelId, 'aria-label': ariaLabel, className, 'data-testid': dataTestid, ...spaceProps }: Readonly<SelectProps>): import("react").JSX.Element;
|
|
67
|
+
declare function Select({ children, native, multiple, autoWidth, value: valueProp, defaultValue, onChange, open: openProp, defaultOpen, onOpen, onClose, placeholder, renderValue, borderRadius, color: colorProp, textColor: textColorProp, bg: bgProp, disabled: disabledProp, error: errorProp, fullWidth: fullWidthProp, required: requiredProp, size: sizeProp, variant: variantProp, iconName, iconProps, id: idProp, name, labelId: labelIdProp, 'aria-label': ariaLabel, className, 'data-testid': dataTestid, ...spaceProps }: Readonly<SelectProps>): import("react").JSX.Element;
|
|
69
68
|
//#endregion
|
|
70
69
|
export { Select, SelectBackgroundToken, SelectColor, SelectProps, SelectSize, SelectTextColor, type SelectValue, SelectVariant };
|
package/dist/Select.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { a as src_exports, i as props, o as styled, t as createShouldForwardProp } from "./src-DLGYOJMh.mjs";
|
|
2
2
|
import { t as themeDefault } from "./themeDefault-Z3KmyIbm.mjs";
|
|
3
|
-
import { r as useTheme } from "./theme-
|
|
4
|
-
import { t as Icon } from "./Icon-
|
|
3
|
+
import { r as useTheme } from "./theme-Z9_QludW.mjs";
|
|
4
|
+
import { t as Icon } from "./Icon-BihOAP4u.mjs";
|
|
5
5
|
import { useFormControl } from "./FormControl.mjs";
|
|
6
6
|
import { t as inputVariantStyles } from "./inputVariantStyles-CcqpGfuP.mjs";
|
|
7
7
|
import { NativeSelect } from "./NativeSelect.mjs";
|
|
8
|
-
import { t as Popover } from "./Popover-
|
|
8
|
+
import { t as Popover } from "./Popover-QjM5Z1CR.mjs";
|
|
9
9
|
import { Children, cloneElement, isValidElement, useCallback, useId, useState } from "react";
|
|
10
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
//#region src/Select/hooks/useSelectPopover.ts
|
|
12
12
|
/**
|
|
13
13
|
* Owns `Select`'s open state (controlled or uncontrolled) and fires the open/close
|
|
@@ -228,7 +228,7 @@ const ListBox = styled("ul", {
|
|
|
228
228
|
overflowY: "auto",
|
|
229
229
|
listStyle: "none"
|
|
230
230
|
}));
|
|
231
|
-
function Select({ children, native = false, multiple = false, autoWidth = false, value: valueProp, defaultValue, onChange, open: openProp, defaultOpen, onOpen, onClose, placeholder, renderValue, borderRadius, color: colorProp, textColor: textColorProp, bg: bgProp, disabled: disabledProp, error: errorProp, fullWidth: fullWidthProp, required: requiredProp, size: sizeProp, variant: variantProp, iconName, iconProps, id: idProp, name, labelId, "aria-label": ariaLabel, className, "data-testid": dataTestid, ...spaceProps }) {
|
|
231
|
+
function Select({ children, native = false, multiple = false, autoWidth = false, value: valueProp, defaultValue, onChange, open: openProp, defaultOpen, onOpen, onClose, placeholder, renderValue, borderRadius, color: colorProp, textColor: textColorProp, bg: bgProp, disabled: disabledProp, error: errorProp, fullWidth: fullWidthProp, required: requiredProp, size: sizeProp, variant: variantProp, iconName, iconProps, id: idProp, name, labelId: labelIdProp, "aria-label": ariaLabel, className, "data-testid": dataTestid, ...spaceProps }) {
|
|
232
232
|
const fc = useFormControl({
|
|
233
233
|
id: idProp,
|
|
234
234
|
error: errorProp,
|
|
@@ -240,6 +240,7 @@ function Select({ children, native = false, multiple = false, autoWidth = false,
|
|
|
240
240
|
textColor: textColorProp
|
|
241
241
|
});
|
|
242
242
|
const { id, error, disabled, required, size, fullWidth } = fc;
|
|
243
|
+
const labelId = labelIdProp ?? fc.labelId;
|
|
243
244
|
const theme = useTheme();
|
|
244
245
|
const color = fc.color ?? themeDefault(theme, "color", "primary");
|
|
245
246
|
const bg = bgProp ?? themeDefault(theme, "inputBg", "terminal");
|
|
@@ -420,7 +421,7 @@ function NonNativeSelect({ children, options, value, autoWidth, onChangeValue, m
|
|
|
420
421
|
onSelect: selectValue
|
|
421
422
|
});
|
|
422
423
|
});
|
|
423
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
424
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
424
425
|
/* @__PURE__ */ jsxs(Trigger, {
|
|
425
426
|
ref: setAnchorEl,
|
|
426
427
|
role: "combobox",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Jt as FlexProps } from "../index-DJ0f69wh.cjs";
|
|
2
2
|
import { i as SidebarItemVariant, t as SidebarAnchor } from "../SidebarContext-B1lWrt77.cjs";
|
|
3
3
|
import { ElementType, ReactNode } from "react";
|
|
4
4
|
//#region src/Sidebar/Sidebar/Sidebar.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Jt as FlexProps } from "../index-CJhK7JND.mjs";
|
|
2
2
|
import { i as SidebarItemVariant, t as SidebarAnchor } from "../SidebarContext-B1lWrt77.mjs";
|
|
3
3
|
import { ElementType, ReactNode } from "react";
|
|
4
4
|
//#region src/Sidebar/Sidebar/Sidebar.d.ts
|
|
@@ -3,7 +3,7 @@ const require_src = require("../src-DU81aGy9.cjs");
|
|
|
3
3
|
const require_Flex = require("../Flex.cjs");
|
|
4
4
|
const require_utils = require("../utils.cjs");
|
|
5
5
|
const require_Typography = require("../Typography.cjs");
|
|
6
|
-
const require_Icon = require("../Icon-
|
|
6
|
+
const require_Icon = require("../Icon-D-EWsBVg.cjs");
|
|
7
7
|
const require_Portal = require("../Portal.cjs");
|
|
8
8
|
const require_Pressable = require("../Pressable.cjs");
|
|
9
9
|
const require_SidebarContext = require("../SidebarContext-jG6OioC-.cjs");
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../index-
|
|
3
|
-
import {
|
|
4
|
-
import { i as PressableProps } from "../index-CxUsrlg1.cjs";
|
|
1
|
+
import { W as Theme } from "../index-DJ0f69wh.cjs";
|
|
2
|
+
import { r as IconName } from "../index-Dv_fk1_F.cjs";
|
|
3
|
+
import { i as PressableProps } from "../index-YKrfFC_I.cjs";
|
|
5
4
|
import { i as SidebarItemVariant } from "../SidebarContext-B1lWrt77.cjs";
|
|
6
5
|
import { ReactNode } from "react";
|
|
7
6
|
//#region src/Sidebar/SidebarItem/SidebarItem.d.ts
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../index-
|
|
3
|
-
import {
|
|
4
|
-
import { i as PressableProps } from "../index-GpnmW6vu.mjs";
|
|
1
|
+
import { W as Theme } from "../index-CJhK7JND.mjs";
|
|
2
|
+
import { r as IconName } from "../index-ha1WjSZ5.mjs";
|
|
3
|
+
import { i as PressableProps } from "../index-CUz2h5xY.mjs";
|
|
5
4
|
import { i as SidebarItemVariant } from "../SidebarContext-B1lWrt77.mjs";
|
|
6
5
|
import { ReactNode } from "react";
|
|
7
6
|
//#region src/Sidebar/SidebarItem/SidebarItem.d.ts
|
|
@@ -2,12 +2,12 @@ import { a as src_exports, o as styled } from "../src-DLGYOJMh.mjs";
|
|
|
2
2
|
import { Flex } from "../Flex.mjs";
|
|
3
3
|
import { alpha } from "../utils.mjs";
|
|
4
4
|
import { Typography } from "../Typography.mjs";
|
|
5
|
-
import { t as Icon } from "../Icon-
|
|
5
|
+
import { t as Icon } from "../Icon-BihOAP4u.mjs";
|
|
6
6
|
import { Portal } from "../Portal.mjs";
|
|
7
7
|
import { Pressable } from "../Pressable.mjs";
|
|
8
8
|
import { t as SidebarContext } from "../SidebarContext-DgSLwjur.mjs";
|
|
9
9
|
import { useContext, useEffect } from "react";
|
|
10
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
//#region src/Sidebar/SidebarItem/SidebarItem.tsx
|
|
12
12
|
const densityStyles = ({ theme, size }) => {
|
|
13
13
|
const s = theme.sizes[size];
|
|
@@ -83,7 +83,7 @@ function SidebarItem({ icon, label, variant, size = "sm", color = "primary", chi
|
|
|
83
83
|
onClick?.(event);
|
|
84
84
|
onSelect?.();
|
|
85
85
|
};
|
|
86
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SidebarItemRoot, {
|
|
86
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(SidebarItemRoot, {
|
|
87
87
|
feedback: resolvedVariant === "plain" ? "none" : "highlight",
|
|
88
88
|
color,
|
|
89
89
|
size,
|
package/dist/Skeleton.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./index-DBUwu65Z.cjs";
|
|
1
|
+
import { W as Theme } from "./index-DJ0f69wh.cjs";
|
|
3
2
|
import { HTMLAttributes } from "react";
|
|
4
3
|
import { PaddingProps, SpaceProps } from "@soroush.tech/styled-system";
|
|
5
4
|
//#region src/Skeleton/Skeleton.d.ts
|
package/dist/Skeleton.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./index-C1WqEDtQ.mjs";
|
|
1
|
+
import { W as Theme } from "./index-CJhK7JND.mjs";
|
|
3
2
|
import { PaddingProps, SpaceProps } from "@soroush.tech/styled-system";
|
|
4
3
|
import { HTMLAttributes } from "react";
|
|
5
4
|
//#region src/Skeleton/Skeleton.d.ts
|