@soroush.tech/design-system 2.0.0-rc.2 → 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.
Files changed (267) hide show
  1. package/README.md +14 -10
  2. package/dist/AppBar.d.cts +1 -1
  3. package/dist/AppBar.d.mts +1 -1
  4. package/dist/Avatar.d.cts +1 -1
  5. package/dist/Avatar.d.mts +1 -1
  6. package/dist/Backdrop.d.cts +1 -1
  7. package/dist/Backdrop.d.mts +1 -1
  8. package/dist/Breadcrumbs.cjs +1 -1
  9. package/dist/Breadcrumbs.d.cts +3 -3
  10. package/dist/Breadcrumbs.d.mts +3 -3
  11. package/dist/Breadcrumbs.mjs +1 -1
  12. package/dist/Button.d.cts +1 -1
  13. package/dist/Button.d.mts +1 -1
  14. package/dist/ButtonGroup.d.cts +1 -1
  15. package/dist/ButtonGroup.d.mts +1 -1
  16. package/dist/Card.cjs +1 -1
  17. package/dist/Card.d.cts +4 -4
  18. package/dist/Card.d.mts +4 -4
  19. package/dist/Card.mjs +1 -1
  20. package/dist/Checkbox.d.cts +1 -1
  21. package/dist/Checkbox.d.mts +1 -1
  22. package/dist/CircularProgress.d.cts +2 -2
  23. package/dist/CircularProgress.d.mts +2 -2
  24. package/dist/Drawer.d.cts +3 -3
  25. package/dist/Drawer.d.mts +3 -3
  26. package/dist/Flex.d.cts +1 -1
  27. package/dist/Flex.d.mts +1 -1
  28. package/dist/Form.d.cts +1 -1
  29. package/dist/Form.d.mts +1 -1
  30. package/dist/FormControl.cjs +9 -1
  31. package/dist/FormControl.d.cts +9 -1
  32. package/dist/FormControl.d.mts +9 -1
  33. package/dist/FormControl.mjs +9 -1
  34. package/dist/FormHelperText.d.cts +1 -1
  35. package/dist/FormHelperText.d.mts +1 -1
  36. package/dist/FormLabel.cjs +9 -1
  37. package/dist/FormLabel.d.cts +2 -2
  38. package/dist/FormLabel.d.mts +2 -2
  39. package/dist/FormLabel.mjs +10 -2
  40. package/dist/Grid.d.cts +1 -1
  41. package/dist/Grid.d.mts +1 -1
  42. package/dist/{Icon-DlheCTJb.mjs → Icon-BihOAP4u.mjs} +40 -0
  43. package/dist/{Icon-Cvuhp9ek.cjs → Icon-D-EWsBVg.cjs} +40 -0
  44. package/dist/Icon.cjs +1 -1
  45. package/dist/Icon.d.cts +1 -1
  46. package/dist/Icon.d.mts +1 -1
  47. package/dist/Icon.mjs +1 -1
  48. package/dist/Image.d.cts +1 -1
  49. package/dist/Image.d.mts +1 -1
  50. package/dist/InputRange.cjs +675 -0
  51. package/dist/InputRange.d.cts +79 -0
  52. package/dist/InputRange.d.mts +79 -0
  53. package/dist/InputRange.mjs +673 -0
  54. package/dist/LinearProgress.d.cts +2 -2
  55. package/dist/LinearProgress.d.mts +2 -2
  56. package/dist/Link.d.cts +1 -1
  57. package/dist/Link.d.mts +1 -1
  58. package/dist/Menu/ContextMenu.cjs +1 -1
  59. package/dist/Menu/ContextMenu.d.cts +5 -5
  60. package/dist/Menu/ContextMenu.d.mts +5 -5
  61. package/dist/Menu/ContextMenu.mjs +1 -1
  62. package/dist/Menu/Menu.cjs +1 -1
  63. package/dist/Menu/Menu.d.cts +1 -1
  64. package/dist/Menu/Menu.d.mts +1 -1
  65. package/dist/Menu/Menu.mjs +1 -1
  66. package/dist/Menu/MenuItems.cjs +1 -1
  67. package/dist/Menu/MenuItems.d.cts +1 -1
  68. package/dist/Menu/MenuItems.d.mts +1 -1
  69. package/dist/Menu/MenuItems.mjs +1 -1
  70. package/dist/Menu/MenuList.d.cts +2 -2
  71. package/dist/Menu/MenuList.d.mts +2 -2
  72. package/dist/{Menu-BkKPTOfh.cjs → Menu-Cgg-sX4W.cjs} +3 -2
  73. package/dist/{Menu-tECbAEFj.mjs → Menu-CrzHc_cn.mjs} +2 -1
  74. package/dist/Menu.cjs +1 -1
  75. package/dist/Menu.d.cts +3 -3
  76. package/dist/Menu.d.mts +3 -3
  77. package/dist/Menu.mjs +1 -1
  78. package/dist/{MenuItem-CfdN4axw.cjs → MenuItem-BTP7Ijwi.cjs} +6 -17
  79. package/dist/{MenuItem-BR7ingQx.mjs → MenuItem-DUn4IZKK.mjs} +3 -8
  80. package/dist/MenuItem.cjs +1 -1
  81. package/dist/MenuItem.d.cts +1 -1
  82. package/dist/MenuItem.d.mts +1 -1
  83. package/dist/MenuItem.mjs +1 -1
  84. package/dist/{MenuListContext-Dml16k0X.d.mts → MenuListContext-DKUOhNyw.d.cts} +2 -2
  85. package/dist/{MenuListContext-vujGcRk9.d.cts → MenuListContext-x-7lH4CH.d.mts} +2 -2
  86. package/dist/Modal.d.cts +1 -1
  87. package/dist/Modal.d.mts +1 -1
  88. package/dist/NativeSelect.cjs +8 -7
  89. package/dist/NativeSelect.d.cts +3 -3
  90. package/dist/NativeSelect.d.mts +3 -3
  91. package/dist/NativeSelect.mjs +8 -7
  92. package/dist/NumberField.cjs +476 -0
  93. package/dist/NumberField.d.cts +74 -0
  94. package/dist/NumberField.d.mts +74 -0
  95. package/dist/NumberField.mjs +474 -0
  96. package/dist/Pagination/PaginationItem.cjs +1 -1
  97. package/dist/Pagination/PaginationItem.d.cts +1 -1
  98. package/dist/Pagination/PaginationItem.d.mts +1 -1
  99. package/dist/Pagination/PaginationItem.mjs +1 -1
  100. package/dist/Pagination.d.cts +2 -2
  101. package/dist/Pagination.d.mts +2 -2
  102. package/dist/Paper.d.cts +2 -2
  103. package/dist/Paper.d.mts +2 -2
  104. package/dist/Popover.d.cts +3 -3
  105. package/dist/Popover.d.mts +3 -3
  106. package/dist/Pressable.d.cts +1 -1
  107. package/dist/Pressable.d.mts +1 -1
  108. package/dist/Quote.d.cts +2 -2
  109. package/dist/Quote.d.mts +2 -2
  110. package/dist/Radio.d.cts +1 -1
  111. package/dist/Radio.d.mts +1 -1
  112. package/dist/Rating.cjs +373 -0
  113. package/dist/Rating.d.cts +57 -0
  114. package/dist/Rating.d.mts +57 -0
  115. package/dist/Rating.mjs +371 -0
  116. package/dist/Select.cjs +3 -2
  117. package/dist/Select.d.cts +3 -3
  118. package/dist/Select.d.mts +3 -3
  119. package/dist/Select.mjs +5 -4
  120. package/dist/Sidebar/Sidebar.d.cts +1 -1
  121. package/dist/Sidebar/Sidebar.d.mts +1 -1
  122. package/dist/Sidebar/SidebarItem.cjs +1 -1
  123. package/dist/Sidebar/SidebarItem.d.cts +3 -3
  124. package/dist/Sidebar/SidebarItem.d.mts +3 -3
  125. package/dist/Sidebar/SidebarItem.mjs +3 -3
  126. package/dist/Skeleton.d.cts +1 -1
  127. package/dist/Skeleton.d.mts +1 -1
  128. package/dist/Switch.cjs +22 -15
  129. package/dist/Switch.d.cts +2 -2
  130. package/dist/Switch.d.mts +2 -2
  131. package/dist/Switch.mjs +24 -17
  132. package/dist/Table/Table.d.cts +2 -2
  133. package/dist/Table/Table.d.mts +2 -2
  134. package/dist/Table/TableBody.d.cts +1 -1
  135. package/dist/Table/TableBody.d.mts +1 -1
  136. package/dist/Table/TableCell.d.cts +1 -1
  137. package/dist/Table/TableCell.d.mts +1 -1
  138. package/dist/Table/TableContainer.d.cts +1 -1
  139. package/dist/Table/TableContainer.d.mts +1 -1
  140. package/dist/Table/TableControl.d.cts +1 -1
  141. package/dist/Table/TableControl.d.mts +1 -1
  142. package/dist/Table/TableControl.mjs +2 -2
  143. package/dist/Table/TableFooter.d.cts +1 -1
  144. package/dist/Table/TableFooter.d.mts +1 -1
  145. package/dist/Table/TableHead.d.cts +1 -1
  146. package/dist/Table/TableHead.d.mts +1 -1
  147. package/dist/Table/TablePagination.d.cts +2 -2
  148. package/dist/Table/TablePagination.d.mts +2 -2
  149. package/dist/Table/TablePaginationActions.d.cts +1 -1
  150. package/dist/Table/TablePaginationActions.d.mts +1 -1
  151. package/dist/Table/TableRow.d.cts +1 -1
  152. package/dist/Table/TableRow.d.mts +1 -1
  153. package/dist/Table/TableSortLabel.cjs +1 -1
  154. package/dist/Table/TableSortLabel.d.cts +1 -1
  155. package/dist/Table/TableSortLabel.d.mts +1 -1
  156. package/dist/Table/TableSortLabel.mjs +1 -1
  157. package/dist/Table/hooks.d.cts +1 -1
  158. package/dist/Table/hooks.d.mts +1 -1
  159. package/dist/Table.d.cts +5 -5
  160. package/dist/Table.d.mts +5 -5
  161. package/dist/{TableContext-6PgGpUzM.d.mts → TableContext-DhuRf6Wy.d.mts} +1 -1
  162. package/dist/{TableContext-CBGk-Lh8.d.cts → TableContext-Duj1nVG7.d.cts} +1 -1
  163. package/dist/Tabs/Tab.cjs +1 -1
  164. package/dist/Tabs/Tab.d.cts +2 -2
  165. package/dist/Tabs/Tab.d.mts +2 -2
  166. package/dist/Tabs/Tab.mjs +1 -1
  167. package/dist/Tabs/TabContext.d.cts +1 -1
  168. package/dist/Tabs/TabContext.d.mts +1 -1
  169. package/dist/Tabs/TabList.cjs +1 -1
  170. package/dist/Tabs/TabList.d.cts +1 -1
  171. package/dist/Tabs/TabList.d.mts +1 -1
  172. package/dist/Tabs/TabList.mjs +1 -1
  173. package/dist/Tabs/TabPanel.d.cts +2 -2
  174. package/dist/Tabs/TabPanel.d.mts +2 -2
  175. package/dist/Tabs/TabScrollButton.cjs +1 -1
  176. package/dist/Tabs/TabScrollButton.d.cts +1 -1
  177. package/dist/Tabs/TabScrollButton.d.mts +1 -1
  178. package/dist/Tabs/TabScrollButton.mjs +1 -1
  179. package/dist/Tabs/Tabs.cjs +1 -1
  180. package/dist/Tabs/Tabs.d.cts +2 -2
  181. package/dist/Tabs/Tabs.d.mts +2 -2
  182. package/dist/Tabs/Tabs.mjs +1 -1
  183. package/dist/{Tabs-YfCUbkQV.mjs → Tabs-BTNOJx5v.mjs} +4 -3
  184. package/dist/{Tabs-D_wkX-Jb.cjs → Tabs-D4tWCq78.cjs} +7 -6
  185. package/dist/Tabs.cjs +1 -1
  186. package/dist/Tabs.d.cts +3 -3
  187. package/dist/Tabs.d.mts +3 -3
  188. package/dist/Tabs.mjs +1 -1
  189. package/dist/{TabsContext-C2agsLBN.d.cts → TabsContext-B_XHbjcS.d.cts} +1 -1
  190. package/dist/{TabsContext-DqyxdmGW.d.mts → TabsContext-Dn2kqUwr.d.mts} +1 -1
  191. package/dist/TextInput.cjs +3 -3
  192. package/dist/TextInput.d.cts +2 -2
  193. package/dist/TextInput.d.mts +2 -2
  194. package/dist/TextInput.mjs +3 -3
  195. package/dist/ToggleButton/ToggleButton.d.cts +1 -1
  196. package/dist/ToggleButton/ToggleButton.d.mts +1 -1
  197. package/dist/ToggleButton/ToggleButtonGroup.d.cts +1 -1
  198. package/dist/ToggleButton/ToggleButtonGroup.d.mts +1 -1
  199. package/dist/TransferList.cjs +356 -0
  200. package/dist/TransferList.d.cts +67 -0
  201. package/dist/TransferList.d.mts +67 -0
  202. package/dist/TransferList.mjs +354 -0
  203. package/dist/Typography.d.cts +2 -2
  204. package/dist/Typography.d.mts +2 -2
  205. package/dist/View.d.cts +1 -1
  206. package/dist/View.d.mts +1 -1
  207. package/dist/catalog.cjs +476 -18
  208. package/dist/catalog.d.cts +1 -1
  209. package/dist/catalog.d.mts +1 -1
  210. package/dist/catalog.mjs +476 -18
  211. package/dist/engine.d.cts +1 -1
  212. package/dist/engine.d.mts +1 -1
  213. package/dist/{index-DCmH5f9I.d.cts → index-B1RFybA_.d.mts} +2 -2
  214. package/dist/{index-Cj5Rhh_9.d.mts → index-B4TeaB7b.d.cts} +2 -2
  215. package/dist/{index-DIC7HKpP.d.mts → index-BGbTuHP9.d.mts} +1 -1
  216. package/dist/{index-BiVvxOvj.d.cts → index-BHKgEOZJ.d.cts} +2 -2
  217. package/dist/{index-BbgFYfX_.d.mts → index-BQWjh4rK.d.mts} +2 -2
  218. package/dist/{index-DJCpnTH3.d.mts → index-BelFIizY.d.cts} +3 -3
  219. package/dist/{index-C3KrFPCj.d.mts → index-BkzZxHVj.d.mts} +2 -2
  220. package/dist/{index-B8DNxyEw.d.mts → index-BrgwkY6z.d.mts} +2 -2
  221. package/dist/{index-DqjXDutI.d.mts → index-Bx0-6yeX.d.mts} +1 -1
  222. package/dist/index-BxVTIMnB.d.cts +1 -0
  223. package/dist/{index-Bhdn4KTy.d.cts → index-ByYxVl9O.d.mts} +3 -3
  224. package/dist/{index-gnh-Oe0n.d.cts → index-CE5JG1us.d.mts} +1 -1
  225. package/dist/{index-XxydXX8l.d.cts → index-CG_1uPrD.d.mts} +2 -2
  226. package/dist/{index-CVNJEUwJ.d.mts → index-CJhK7JND.d.mts} +49 -1
  227. package/dist/{index-BjfPEP_5.d.cts → index-CQfJZADG.d.cts} +2 -2
  228. package/dist/{index-DrVYWt-X.d.mts → index-CUz2h5xY.d.mts} +1 -1
  229. package/dist/{index-CrIxI8Na.d.mts → index-CbFaWtjK.d.mts} +2 -2
  230. package/dist/{index-BFruxTHv.d.cts → index-ChXeKJCk.d.cts} +1 -1
  231. package/dist/{index-DQcnJ5H4.d.cts → index-CknoXDLQ.d.cts} +2 -2
  232. package/dist/{index-IdMqR82e.d.cts → index-ClZyaZrR.d.mts} +2 -2
  233. package/dist/{index-Bxd9NOWb.d.mts → index-DAwcmIjN.d.cts} +2 -2
  234. package/dist/{index-CWnbCxgw.d.cts → index-DGnXJwLj.d.mts} +4 -4
  235. package/dist/{index-DmJ7yWWi.d.cts → index-DJ0f69wh.d.cts} +49 -1
  236. package/dist/{index-DckSub2J.d.mts → index-DWjz5ZzG.d.cts} +4 -4
  237. package/dist/{index-DXhMkjQ6.d.cts → index-DYF8sRE-.d.cts} +2 -2
  238. package/dist/index-DaIIo5QU.d.mts +1 -0
  239. package/dist/{index-BVPrG1L0.d.mts → index-DchHf5cF.d.cts} +1 -1
  240. package/dist/{index-BlLH6rlE.d.cts → index-DtYjdBvO.d.cts} +2 -2
  241. package/dist/{index-BqpS_Huq.d.mts → index-Dv_fk1_F.d.cts} +19 -3
  242. package/dist/{index-BSA6SKao.d.mts → index-K5exjvnX.d.cts} +2 -2
  243. package/dist/{index-BjPX49XA.d.mts → index-KnXhlKMr.d.cts} +1 -1
  244. package/dist/{index-B3LIhqHR.d.cts → index-WHFhjfgy.d.cts} +4 -4
  245. package/dist/{index-BCnKYNlZ.d.cts → index-YKrfFC_I.d.cts} +1 -1
  246. package/dist/{index-CoEqjFYn.d.mts → index-bpnLB_4K.d.mts} +4 -4
  247. package/dist/{index-DDJuUfL5.d.cts → index-h4dYtVrp.d.mts} +1 -1
  248. package/dist/{index-qlfNErNd.d.cts → index-ha1WjSZ5.d.mts} +19 -3
  249. package/dist/{index-DuVNRXP4.d.cts → index-nqUA_6J_.d.cts} +1 -1
  250. package/dist/{index-DeDxYlSQ.d.mts → index-pTNq3iQn.d.mts} +2 -2
  251. package/dist/index.d.cts +1 -1
  252. package/dist/index.d.mts +1 -1
  253. package/dist/isRtl-BJDtm86G.mjs +7 -0
  254. package/dist/isRtl-DTkYHRPo.cjs +12 -0
  255. package/dist/precision-B1lhxnnO.mjs +25 -0
  256. package/dist/precision-B58cTPB2.cjs +48 -0
  257. package/dist/style.d.cts +2 -2
  258. package/dist/style.d.mts +2 -2
  259. package/dist/theme.d.cts +3 -3
  260. package/dist/theme.d.mts +3 -3
  261. package/dist/useControlled-C666KpQ0.cjs +18 -0
  262. package/dist/useControlled-CBRLsO-H.mjs +13 -0
  263. package/dist/{useTablePagination-C5VKtqDp.d.cts → useTablePagination-C-u3ru4N.d.cts} +1 -1
  264. package/dist/{useTablePagination-C6LSlt3w.d.mts → useTablePagination-D-39ZmQh.d.mts} +1 -1
  265. package/package.json +42 -2
  266. package/dist/index-DBteSahY.d.cts +0 -1
  267. package/dist/index-_G1osn09.d.mts +0 -1
@@ -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
@@ -2,7 +2,7 @@ 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
4
  const require_theme = require("./theme-BxXuXRgQ.cjs");
5
- const require_Icon = require("./Icon-Cvuhp9ek.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");
@@ -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,5 +1,5 @@
1
- import { V as Theme } from "./index-DmJ7yWWi.cjs";
2
- import { n as IconProps, r as IconName } from "./index-qlfNErNd.cjs";
1
+ import { W as Theme } from "./index-DJ0f69wh.cjs";
2
+ import { n as IconProps, r as IconName } from "./index-Dv_fk1_F.cjs";
3
3
  import { ReactNode } from "react";
4
4
  import { LayoutProps, SpaceProps } from "@soroush.tech/styled-system";
5
5
  //#region src/Select/utils/isOptionSelected.d.ts
@@ -64,6 +64,6 @@ interface SelectProps extends SpaceProps<Theme>, Pick<LayoutProps<Theme>, 'width
64
64
  className?: string;
65
65
  'data-testid'?: string;
66
66
  }
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, '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;
68
68
  //#endregion
69
69
  export { Select, SelectBackgroundToken, SelectColor, SelectProps, SelectSize, SelectTextColor, type SelectValue, SelectVariant };
package/dist/Select.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { V as Theme } from "./index-CVNJEUwJ.mjs";
2
- import { n as IconProps, r as IconName } from "./index-BqpS_Huq.mjs";
1
+ import { W as Theme } from "./index-CJhK7JND.mjs";
2
+ import { n as IconProps, r as IconName } from "./index-ha1WjSZ5.mjs";
3
3
  import { LayoutProps, SpaceProps } from "@soroush.tech/styled-system";
4
4
  import { ReactNode } from "react";
5
5
  //#region src/Select/utils/isOptionSelected.d.ts
@@ -64,6 +64,6 @@ interface SelectProps extends SpaceProps<Theme>, Pick<LayoutProps<Theme>, 'width
64
64
  className?: string;
65
65
  'data-testid'?: string;
66
66
  }
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, '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;
68
68
  //#endregion
69
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
3
  import { r as useTheme } from "./theme-Z9_QludW.mjs";
4
- import { t as Icon } from "./Icon-DlheCTJb.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
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 { Wt as FlexProps } from "../index-DmJ7yWWi.cjs";
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 { Wt as FlexProps } from "../index-CVNJEUwJ.mjs";
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-Cvuhp9ek.cjs");
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,6 +1,6 @@
1
- import { V as Theme } from "../index-DmJ7yWWi.cjs";
2
- import { r as IconName } from "../index-qlfNErNd.cjs";
3
- import { i as PressableProps } from "../index-BCnKYNlZ.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";
4
4
  import { i as SidebarItemVariant } from "../SidebarContext-B1lWrt77.cjs";
5
5
  import { ReactNode } from "react";
6
6
  //#region src/Sidebar/SidebarItem/SidebarItem.d.ts
@@ -1,6 +1,6 @@
1
- import { V as Theme } from "../index-CVNJEUwJ.mjs";
2
- import { r as IconName } from "../index-BqpS_Huq.mjs";
3
- import { i as PressableProps } from "../index-DrVYWt-X.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";
4
4
  import { i as SidebarItemVariant } from "../SidebarContext-B1lWrt77.mjs";
5
5
  import { ReactNode } from "react";
6
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-DlheCTJb.mjs";
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,
@@ -1,4 +1,4 @@
1
- import { V as Theme } from "./index-DmJ7yWWi.cjs";
1
+ import { W as Theme } from "./index-DJ0f69wh.cjs";
2
2
  import { HTMLAttributes } from "react";
3
3
  import { PaddingProps, SpaceProps } from "@soroush.tech/styled-system";
4
4
  //#region src/Skeleton/Skeleton.d.ts
@@ -1,4 +1,4 @@
1
- import { V as Theme } from "./index-CVNJEUwJ.mjs";
1
+ import { W as Theme } from "./index-CJhK7JND.mjs";
2
2
  import { PaddingProps, SpaceProps } from "@soroush.tech/styled-system";
3
3
  import { HTMLAttributes } from "react";
4
4
  //#region src/Skeleton/Skeleton.d.ts
package/dist/Switch.cjs CHANGED
@@ -3,6 +3,7 @@ const require_src = require("./src-DU81aGy9.cjs");
3
3
  const require_themeDefault = require("./themeDefault-Cebi08Cv.cjs");
4
4
  const require_utils = require("./utils.cjs");
5
5
  const require_theme = require("./theme-BxXuXRgQ.cjs");
6
+ const require_FormControl = require("./FormControl.cjs");
6
7
  require("react");
7
8
  let react_jsx_runtime = require("react/jsx-runtime");
8
9
  let _soroush_tech_styled_system_should_forward_prop = require("@soroush.tech/styled-system/should-forward-prop");
@@ -65,10 +66,7 @@ const INSIDE_TRANSLATE = {
65
66
  md: "20px",
66
67
  lg: "24px"
67
68
  };
68
- const knownSize = (size, theme) => {
69
- const resolved = size ?? require_themeDefault.themeDefault(theme, "size", "md");
70
- return resolved === "sm" || resolved === "lg" ? resolved : "md";
71
- };
69
+ const knownSize = (size) => size === "sm" || size === "lg" ? size : "md";
72
70
  const CheckMarkIcon = () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
73
71
  viewBox: "0 0 12 12",
74
72
  width: "0.6em",
@@ -120,15 +118,15 @@ const SwitchTrack = require_src.styled("span", {
120
118
  display: "inline-block",
121
119
  position: "relative",
122
120
  flexShrink: 0,
123
- width: OUTSIDE_TRACK[knownSize(size, theme)].width,
124
- height: OUTSIDE_THUMB[knownSize(size, theme)],
121
+ width: OUTSIDE_TRACK[knownSize(size)].width,
122
+ height: OUTSIDE_THUMB[knownSize(size)],
125
123
  "&::before": {
126
124
  content: "\"\"",
127
125
  position: "absolute",
128
126
  top: "50%",
129
127
  left: 0,
130
128
  right: 0,
131
- height: OUTSIDE_TRACK[knownSize(size, theme)].height,
129
+ height: OUTSIDE_TRACK[knownSize(size)].height,
132
130
  transform: "translateY(-50%)",
133
131
  borderRadius: "999px",
134
132
  backgroundColor: trackBg,
@@ -139,8 +137,8 @@ const SwitchTrack = require_src.styled("span", {
139
137
  display: "inline-block",
140
138
  position: "relative",
141
139
  flexShrink: 0,
142
- width: INSIDE_TRACK[knownSize(size, theme)].width,
143
- height: INSIDE_TRACK[knownSize(size, theme)].height,
140
+ width: INSIDE_TRACK[knownSize(size)].width,
141
+ height: INSIDE_TRACK[knownSize(size)].height,
144
142
  borderRadius: "999px",
145
143
  backgroundColor: trackBg,
146
144
  transition: "background-color 0.3s ease"
@@ -152,8 +150,8 @@ const SwitchThumb = require_src.styled("span", {
152
150
  label: "SwitchThumb",
153
151
  shouldForwardProp: (p) => p !== "size" && p !== "variant"
154
152
  })(({ size, variant = "outside", theme }) => {
155
- const thumbSize = variant === "outside" ? OUTSIDE_THUMB[knownSize(size, theme)] : INSIDE_THUMB[knownSize(size, theme)];
156
- const thumbStart = variant === "outside" ? OUTSIDE_THUMB_START[knownSize(size, theme)] : INSIDE_THUMB_START[knownSize(size, theme)];
153
+ const thumbSize = variant === "outside" ? OUTSIDE_THUMB[knownSize(size)] : INSIDE_THUMB[knownSize(size)];
154
+ const thumbStart = variant === "outside" ? OUTSIDE_THUMB_START[knownSize(size)] : INSIDE_THUMB_START[knownSize(size)];
157
155
  const transitionDuration = variant === "inside" ? "0.3s" : "0.15s";
158
156
  return {
159
157
  position: "absolute",
@@ -185,7 +183,7 @@ const shouldForwardProp = (0, _soroush_tech_styled_system_should_forward_prop.cr
185
183
  ]);
186
184
  const baseStyle = ({ disabled, size, variant = "outside", theme, color = require_themeDefault.themeDefault(theme, "neutralColor", "default") }) => {
187
185
  const focusRing = theme.palette[require_themeDefault.themeDefault(theme, "color", "primary")].main;
188
- const thumbTranslate = variant === "outside" ? OUTSIDE_TRANSLATE[knownSize(size, theme)] : INSIDE_TRANSLATE[knownSize(size, theme)];
186
+ const thumbTranslate = variant === "outside" ? OUTSIDE_TRANSLATE[knownSize(size)] : INSIDE_TRANSLATE[knownSize(size)];
189
187
  const gap = theme?.space?.[1];
190
188
  return {
191
189
  display: "inline-flex",
@@ -251,7 +249,7 @@ const baseStyle = ({ disabled, size, variant = "outside", theme, color = require
251
249
  };
252
250
  };
253
251
  const colorStyle = ({ theme, color = require_themeDefault.themeDefault(theme, "neutralColor", "default") }) => {
254
- return { color: theme.palette[color].main };
252
+ return { color: color === "default" ? theme.text.secondary : theme.palette[color].main };
255
253
  };
256
254
  const edgeStyle = ({ edge }) => {
257
255
  if (!edge) return {};
@@ -266,8 +264,17 @@ const SwitchRoot = require_src.styled("label", {
266
264
  shouldForwardProp,
267
265
  systemProps: [require_src.src_exports.space]
268
266
  })(baseStyle, colorStyle, edgeStyle);
269
- function Switch({ checked, defaultChecked, disabled = false, disableRipple: _disableRipple, color, size, variant: variantProp, marked = false, bg, edge = false, icon, checkedIcon, onChange, id, required, children, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, "data-testid": dataTestid, ...spaceProps }) {
267
+ function Switch({ checked, defaultChecked, disabled: disabledProp, disableRipple: _disableRipple, color: colorProp, size: sizeProp, variant: variantProp, marked = false, bg, edge = false, icon, checkedIcon, onChange, id: idProp, required: requiredProp, children, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, "data-testid": dataTestid, ...spaceProps }) {
270
268
  const theme = require_theme.useTheme();
269
+ const fc = require_FormControl.useFormControl({
270
+ id: idProp,
271
+ disabled: disabledProp,
272
+ required: requiredProp,
273
+ size: sizeProp
274
+ });
275
+ const { id, disabled, required, size } = fc;
276
+ const color = colorProp ?? fc.color;
277
+ const describedBy = ariaDescribedby ?? fc["aria-describedby"];
271
278
  const variant = variantProp ?? require_themeDefault.themeDefault(theme, "switchVariant", "outside");
272
279
  const effectiveIcon = icon ?? (marked && variant === "outside" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(XMarkIcon, {}) : null);
273
280
  const effectiveCheckedIcon = checkedIcon ?? (marked && variant === "outside" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CheckMarkIcon, {}) : null);
@@ -298,7 +305,7 @@ function Switch({ checked, defaultChecked, disabled = false, disableRipple: _dis
298
305
  onKeyDown: handleKeyDown,
299
306
  "aria-label": ariaLabel,
300
307
  "aria-labelledby": ariaLabelledby,
301
- "aria-describedby": ariaDescribedby
308
+ "aria-describedby": describedBy
302
309
  }),
303
310
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(SwitchTrack, {
304
311
  className: "sw-track",