@byldpartners/ui 0.0.1

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 (413) hide show
  1. package/README.md +284 -0
  2. package/dist/chunk-464G63BO.cjs +224 -0
  3. package/dist/chunk-464G63BO.cjs.map +1 -0
  4. package/dist/chunk-JFJY6DZZ.js +224 -0
  5. package/dist/chunk-JFJY6DZZ.js.map +1 -0
  6. package/dist/index.cjs +3894 -0
  7. package/dist/index.cjs.map +1 -0
  8. package/dist/index.d.cts +1543 -0
  9. package/dist/index.d.ts +1543 -0
  10. package/dist/index.js +3894 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/theme/web.cjs +16 -0
  13. package/dist/theme/web.cjs.map +1 -0
  14. package/dist/theme/web.d.cts +81 -0
  15. package/dist/theme/web.d.ts +81 -0
  16. package/dist/theme/web.js +16 -0
  17. package/dist/theme/web.js.map +1 -0
  18. package/package.json +117 -0
  19. package/src/components/Accordion/Accordion.native.tsx +195 -0
  20. package/src/components/Accordion/Accordion.stories.tsx +49 -0
  21. package/src/components/Accordion/Accordion.types.ts +28 -0
  22. package/src/components/Accordion/Accordion.web.tsx +61 -0
  23. package/src/components/Accordion/index.native.ts +12 -0
  24. package/src/components/Accordion/index.ts +12 -0
  25. package/src/components/Accordion/useAccordion.test.ts +114 -0
  26. package/src/components/Accordion/useAccordion.ts +65 -0
  27. package/src/components/Alert/Alert.native.tsx +86 -0
  28. package/src/components/Alert/Alert.stories.tsx +43 -0
  29. package/src/components/Alert/Alert.types.ts +17 -0
  30. package/src/components/Alert/Alert.web.test.tsx +49 -0
  31. package/src/components/Alert/Alert.web.tsx +59 -0
  32. package/src/components/Alert/index.native.ts +2 -0
  33. package/src/components/Alert/index.ts +2 -0
  34. package/src/components/Alert/useAlert.test.ts +19 -0
  35. package/src/components/Alert/useAlert.ts +10 -0
  36. package/src/components/AlertDialog/AlertDialog.native.tsx +281 -0
  37. package/src/components/AlertDialog/AlertDialog.stories.tsx +49 -0
  38. package/src/components/AlertDialog/AlertDialog.types.ts +49 -0
  39. package/src/components/AlertDialog/AlertDialog.web.tsx +138 -0
  40. package/src/components/AlertDialog/index.native.ts +22 -0
  41. package/src/components/AlertDialog/index.ts +24 -0
  42. package/src/components/AlertDialog/useAlertDialog.test.ts +40 -0
  43. package/src/components/AlertDialog/useAlertDialog.ts +36 -0
  44. package/src/components/AspectRatio/AspectRatio.native.tsx +37 -0
  45. package/src/components/AspectRatio/AspectRatio.stories.tsx +44 -0
  46. package/src/components/AspectRatio/AspectRatio.types.ts +5 -0
  47. package/src/components/AspectRatio/AspectRatio.web.tsx +5 -0
  48. package/src/components/AspectRatio/index.native.ts +2 -0
  49. package/src/components/AspectRatio/index.ts +2 -0
  50. package/src/components/AspectRatio/useAspectRatio.test.ts +40 -0
  51. package/src/components/AspectRatio/useAspectRatio.ts +12 -0
  52. package/src/components/Avatar/Avatar.native.tsx +95 -0
  53. package/src/components/Avatar/Avatar.stories.tsx +31 -0
  54. package/src/components/Avatar/Avatar.types.ts +17 -0
  55. package/src/components/Avatar/Avatar.web.tsx +47 -0
  56. package/src/components/Avatar/index.native.ts +2 -0
  57. package/src/components/Avatar/index.ts +2 -0
  58. package/src/components/Avatar/useAvatarImage.test.ts +66 -0
  59. package/src/components/Avatar/useAvatarImage.ts +31 -0
  60. package/src/components/Badge/Badge.native.tsx +64 -0
  61. package/src/components/Badge/Badge.stories.tsx +42 -0
  62. package/src/components/Badge/Badge.types.ts +7 -0
  63. package/src/components/Badge/Badge.web.test.tsx +40 -0
  64. package/src/components/Badge/Badge.web.tsx +41 -0
  65. package/src/components/Badge/index.native.ts +2 -0
  66. package/src/components/Badge/index.ts +2 -0
  67. package/src/components/Breadcrumb/Breadcrumb.native.tsx +158 -0
  68. package/src/components/Breadcrumb/Breadcrumb.stories.tsx +41 -0
  69. package/src/components/Breadcrumb/Breadcrumb.types.ts +37 -0
  70. package/src/components/Breadcrumb/Breadcrumb.web.tsx +125 -0
  71. package/src/components/Breadcrumb/index.native.ts +18 -0
  72. package/src/components/Breadcrumb/index.ts +18 -0
  73. package/src/components/Button/Button.native.tsx +118 -0
  74. package/src/components/Button/Button.stories.tsx +97 -0
  75. package/src/components/Button/Button.types.ts +19 -0
  76. package/src/components/Button/Button.web.test.tsx +69 -0
  77. package/src/components/Button/Button.web.tsx +55 -0
  78. package/src/components/Button/index.native.ts +2 -0
  79. package/src/components/Button/index.ts +2 -0
  80. package/src/components/Calendar/Calendar.native.tsx +108 -0
  81. package/src/components/Calendar/Calendar.stories.tsx +18 -0
  82. package/src/components/Calendar/Calendar.types.ts +8 -0
  83. package/src/components/Calendar/Calendar.web.tsx +143 -0
  84. package/src/components/Calendar/index.native.ts +2 -0
  85. package/src/components/Calendar/index.ts +2 -0
  86. package/src/components/Calendar/useCalendar.test.ts +145 -0
  87. package/src/components/Calendar/useCalendar.ts +94 -0
  88. package/src/components/Card/Card.native.tsx +42 -0
  89. package/src/components/Card/Card.stories.tsx +41 -0
  90. package/src/components/Card/Card.types.ts +4 -0
  91. package/src/components/Card/Card.web.test.tsx +29 -0
  92. package/src/components/Card/Card.web.tsx +23 -0
  93. package/src/components/Card/index.native.ts +2 -0
  94. package/src/components/Card/index.ts +2 -0
  95. package/src/components/Carousel/Carousel.native.tsx +193 -0
  96. package/src/components/Carousel/Carousel.stories.tsx +51 -0
  97. package/src/components/Carousel/Carousel.types.ts +29 -0
  98. package/src/components/Carousel/Carousel.web.tsx +272 -0
  99. package/src/components/Carousel/index.native.ts +2 -0
  100. package/src/components/Carousel/index.ts +2 -0
  101. package/src/components/Carousel/useCarousel.test.ts +111 -0
  102. package/src/components/Carousel/useCarousel.ts +48 -0
  103. package/src/components/Chart/Chart.native.tsx +7 -0
  104. package/src/components/Chart/Chart.stories.tsx +57 -0
  105. package/src/components/Chart/Chart.types.ts +13 -0
  106. package/src/components/Chart/Chart.web.tsx +36 -0
  107. package/src/components/Chart/index.native.ts +2 -0
  108. package/src/components/Chart/index.ts +3 -0
  109. package/src/components/Checkbox/Checkbox.native.tsx +47 -0
  110. package/src/components/Checkbox/Checkbox.stories.tsx +30 -0
  111. package/src/components/Checkbox/Checkbox.types.ts +12 -0
  112. package/src/components/Checkbox/Checkbox.web.tsx +37 -0
  113. package/src/components/Checkbox/index.native.ts +2 -0
  114. package/src/components/Checkbox/index.ts +2 -0
  115. package/src/components/Checkbox/useCheckbox.test.ts +66 -0
  116. package/src/components/Checkbox/useCheckbox.ts +37 -0
  117. package/src/components/Collapsible/Collapsible.native.tsx +111 -0
  118. package/src/components/Collapsible/Collapsible.stories.tsx +35 -0
  119. package/src/components/Collapsible/Collapsible.types.ts +19 -0
  120. package/src/components/Collapsible/Collapsible.web.tsx +9 -0
  121. package/src/components/Collapsible/index.native.ts +2 -0
  122. package/src/components/Collapsible/index.ts +2 -0
  123. package/src/components/Collapsible/useCollapsible.test.ts +53 -0
  124. package/src/components/Collapsible/useCollapsible.ts +38 -0
  125. package/src/components/Combobox/Combobox.native.tsx +146 -0
  126. package/src/components/Combobox/Combobox.stories.tsx +43 -0
  127. package/src/components/Combobox/Combobox.types.ts +15 -0
  128. package/src/components/Combobox/Combobox.web.tsx +145 -0
  129. package/src/components/Combobox/index.native.ts +2 -0
  130. package/src/components/Combobox/index.ts +2 -0
  131. package/src/components/Combobox/useCombobox.test.ts +59 -0
  132. package/src/components/Combobox/useCombobox.ts +42 -0
  133. package/src/components/Command/Command.native.tsx +7 -0
  134. package/src/components/Command/Command.stories.tsx +37 -0
  135. package/src/components/Command/Command.types.ts +43 -0
  136. package/src/components/Command/Command.web.tsx +134 -0
  137. package/src/components/Command/index.native.ts +2 -0
  138. package/src/components/Command/index.ts +18 -0
  139. package/src/components/ContextMenu/ContextMenu.native.tsx +241 -0
  140. package/src/components/ContextMenu/ContextMenu.stories.tsx +43 -0
  141. package/src/components/ContextMenu/ContextMenu.types.ts +69 -0
  142. package/src/components/ContextMenu/ContextMenu.web.tsx +220 -0
  143. package/src/components/ContextMenu/index.native.ts +28 -0
  144. package/src/components/ContextMenu/index.ts +2 -0
  145. package/src/components/ContextMenu/useContextMenu.test.ts +44 -0
  146. package/src/components/ContextMenu/useContextMenu.ts +36 -0
  147. package/src/components/DataTable/DataTable.native.tsx +85 -0
  148. package/src/components/DataTable/DataTable.stories.tsx +72 -0
  149. package/src/components/DataTable/DataTable.types.ts +16 -0
  150. package/src/components/DataTable/DataTable.web.tsx +135 -0
  151. package/src/components/DataTable/index.native.ts +2 -0
  152. package/src/components/DataTable/index.ts +3 -0
  153. package/src/components/DataTable/useDataTable.test.ts +98 -0
  154. package/src/components/DataTable/useDataTable.ts +68 -0
  155. package/src/components/DatePicker/DatePicker.native.tsx +82 -0
  156. package/src/components/DatePicker/DatePicker.stories.tsx +68 -0
  157. package/src/components/DatePicker/DatePicker.types.ts +7 -0
  158. package/src/components/DatePicker/DatePicker.web.tsx +85 -0
  159. package/src/components/DatePicker/index.native.ts +2 -0
  160. package/src/components/DatePicker/index.ts +2 -0
  161. package/src/components/DatePicker/useDatePicker.test.ts +62 -0
  162. package/src/components/DatePicker/useDatePicker.ts +54 -0
  163. package/src/components/Dialog/Dialog.native.tsx +188 -0
  164. package/src/components/Dialog/Dialog.stories.tsx +42 -0
  165. package/src/components/Dialog/Dialog.types.ts +45 -0
  166. package/src/components/Dialog/Dialog.web.tsx +126 -0
  167. package/src/components/Dialog/index.native.ts +2 -0
  168. package/src/components/Dialog/index.ts +2 -0
  169. package/src/components/Dialog/useDialog.test.ts +44 -0
  170. package/src/components/Dialog/useDialog.ts +36 -0
  171. package/src/components/Drawer/Drawer.native.tsx +244 -0
  172. package/src/components/Drawer/Drawer.stories.tsx +39 -0
  173. package/src/components/Drawer/Drawer.types.ts +44 -0
  174. package/src/components/Drawer/Drawer.web.tsx +133 -0
  175. package/src/components/Drawer/index.native.ts +2 -0
  176. package/src/components/Drawer/index.ts +2 -0
  177. package/src/components/Drawer/useDrawer.test.ts +33 -0
  178. package/src/components/Drawer/useDrawer.ts +19 -0
  179. package/src/components/DropdownMenu/DropdownMenu.native.tsx +272 -0
  180. package/src/components/DropdownMenu/DropdownMenu.stories.tsx +36 -0
  181. package/src/components/DropdownMenu/DropdownMenu.types.ts +73 -0
  182. package/src/components/DropdownMenu/DropdownMenu.web.tsx +225 -0
  183. package/src/components/DropdownMenu/index.native.ts +2 -0
  184. package/src/components/DropdownMenu/index.ts +2 -0
  185. package/src/components/DropdownMenu/useDropdownMenu.test.ts +44 -0
  186. package/src/components/DropdownMenu/useDropdownMenu.ts +36 -0
  187. package/src/components/Form/Form.native.tsx +98 -0
  188. package/src/components/Form/Form.stories.tsx +83 -0
  189. package/src/components/Form/Form.types.ts +35 -0
  190. package/src/components/Form/Form.web.test.tsx +73 -0
  191. package/src/components/Form/Form.web.tsx +111 -0
  192. package/src/components/Form/index.native.ts +18 -0
  193. package/src/components/Form/index.ts +18 -0
  194. package/src/components/Form/useFormField.test.ts +25 -0
  195. package/src/components/Form/useFormField.ts +22 -0
  196. package/src/components/HoverCard/HoverCard.native.tsx +15 -0
  197. package/src/components/HoverCard/HoverCard.stories.tsx +34 -0
  198. package/src/components/HoverCard/HoverCard.types.ts +18 -0
  199. package/src/components/HoverCard/HoverCard.web.test.tsx +35 -0
  200. package/src/components/HoverCard/HoverCard.web.tsx +26 -0
  201. package/src/components/HoverCard/index.native.ts +2 -0
  202. package/src/components/HoverCard/index.ts +2 -0
  203. package/src/components/Icon/Icon.native.tsx +27 -0
  204. package/src/components/Icon/index.native.ts +2 -0
  205. package/src/components/Input/Input.native.tsx +32 -0
  206. package/src/components/Input/Input.stories.tsx +42 -0
  207. package/src/components/Input/Input.types.ts +10 -0
  208. package/src/components/Input/Input.web.test.tsx +39 -0
  209. package/src/components/Input/Input.web.tsx +21 -0
  210. package/src/components/Input/index.native.ts +2 -0
  211. package/src/components/Input/index.ts +2 -0
  212. package/src/components/InputOTP/InputOTP.native.tsx +93 -0
  213. package/src/components/InputOTP/InputOTP.stories.tsx +56 -0
  214. package/src/components/InputOTP/InputOTP.types.ts +14 -0
  215. package/src/components/InputOTP/InputOTP.web.tsx +128 -0
  216. package/src/components/InputOTP/index.native.ts +2 -0
  217. package/src/components/InputOTP/index.ts +2 -0
  218. package/src/components/InputOTP/useInputOTP.test.ts +97 -0
  219. package/src/components/InputOTP/useInputOTP.ts +69 -0
  220. package/src/components/Label/Label.native.tsx +25 -0
  221. package/src/components/Label/Label.stories.tsx +20 -0
  222. package/src/components/Label/Label.types.ts +6 -0
  223. package/src/components/Label/Label.web.test.tsx +27 -0
  224. package/src/components/Label/Label.web.tsx +23 -0
  225. package/src/components/Label/index.native.ts +2 -0
  226. package/src/components/Label/index.ts +2 -0
  227. package/src/components/Menubar/Menubar.native.tsx +287 -0
  228. package/src/components/Menubar/Menubar.stories.tsx +46 -0
  229. package/src/components/Menubar/Menubar.types.ts +70 -0
  230. package/src/components/Menubar/Menubar.web.tsx +256 -0
  231. package/src/components/Menubar/index.native.ts +28 -0
  232. package/src/components/Menubar/index.ts +2 -0
  233. package/src/components/Menubar/useMenubar.test.ts +35 -0
  234. package/src/components/Menubar/useMenubar.ts +19 -0
  235. package/src/components/NavigationMenu/NavigationMenu.native.tsx +128 -0
  236. package/src/components/NavigationMenu/NavigationMenu.stories.tsx +35 -0
  237. package/src/components/NavigationMenu/NavigationMenu.types.ts +35 -0
  238. package/src/components/NavigationMenu/NavigationMenu.web.test.tsx +56 -0
  239. package/src/components/NavigationMenu/NavigationMenu.web.tsx +134 -0
  240. package/src/components/NavigationMenu/index.native.ts +16 -0
  241. package/src/components/NavigationMenu/index.ts +2 -0
  242. package/src/components/Pagination/Pagination.native.tsx +192 -0
  243. package/src/components/Pagination/Pagination.stories.tsx +49 -0
  244. package/src/components/Pagination/Pagination.types.ts +41 -0
  245. package/src/components/Pagination/Pagination.web.test.tsx +101 -0
  246. package/src/components/Pagination/Pagination.web.tsx +185 -0
  247. package/src/components/Pagination/index.native.ts +19 -0
  248. package/src/components/Pagination/index.ts +2 -0
  249. package/src/components/Popover/Popover.native.tsx +97 -0
  250. package/src/components/Popover/Popover.stories.tsx +25 -0
  251. package/src/components/Popover/Popover.types.ts +20 -0
  252. package/src/components/Popover/Popover.web.tsx +30 -0
  253. package/src/components/Popover/index.native.ts +2 -0
  254. package/src/components/Popover/index.ts +2 -0
  255. package/src/components/Popover/usePopover.test.ts +40 -0
  256. package/src/components/Popover/usePopover.ts +36 -0
  257. package/src/components/Progress/Progress.native.tsx +65 -0
  258. package/src/components/Progress/Progress.stories.tsx +36 -0
  259. package/src/components/Progress/Progress.types.ts +6 -0
  260. package/src/components/Progress/Progress.web.test.tsx +27 -0
  261. package/src/components/Progress/Progress.web.tsx +30 -0
  262. package/src/components/Progress/index.native.ts +2 -0
  263. package/src/components/Progress/index.ts +2 -0
  264. package/src/components/Progress/useProgress.test.ts +44 -0
  265. package/src/components/Progress/useProgress.ts +11 -0
  266. package/src/components/RadioGroup/RadioGroup.native.tsx +96 -0
  267. package/src/components/RadioGroup/RadioGroup.stories.tsx +31 -0
  268. package/src/components/RadioGroup/RadioGroup.types.ts +16 -0
  269. package/src/components/RadioGroup/RadioGroup.web.tsx +47 -0
  270. package/src/components/RadioGroup/index.native.ts +2 -0
  271. package/src/components/RadioGroup/index.ts +2 -0
  272. package/src/components/RadioGroup/useRadioGroup.test.ts +50 -0
  273. package/src/components/RadioGroup/useRadioGroup.ts +40 -0
  274. package/src/components/ResizablePanel/ResizablePanel.native.tsx +75 -0
  275. package/src/components/ResizablePanel/ResizablePanel.stories.tsx +84 -0
  276. package/src/components/ResizablePanel/ResizablePanel.types.ts +20 -0
  277. package/src/components/ResizablePanel/ResizablePanel.web.test.tsx +52 -0
  278. package/src/components/ResizablePanel/ResizablePanel.web.tsx +77 -0
  279. package/src/components/ResizablePanel/index.native.ts +2 -0
  280. package/src/components/ResizablePanel/index.ts +2 -0
  281. package/src/components/ScrollArea/ScrollArea.native.tsx +43 -0
  282. package/src/components/ScrollArea/ScrollArea.stories.tsx +46 -0
  283. package/src/components/ScrollArea/ScrollArea.types.ts +11 -0
  284. package/src/components/ScrollArea/ScrollArea.web.test.tsx +19 -0
  285. package/src/components/ScrollArea/ScrollArea.web.tsx +45 -0
  286. package/src/components/ScrollArea/index.native.ts +2 -0
  287. package/src/components/ScrollArea/index.ts +2 -0
  288. package/src/components/Select/Select.native.tsx +203 -0
  289. package/src/components/Select/Select.stories.tsx +33 -0
  290. package/src/components/Select/Select.types.ts +14 -0
  291. package/src/components/Select/Select.web.tsx +204 -0
  292. package/src/components/Select/index.native.ts +11 -0
  293. package/src/components/Select/index.ts +2 -0
  294. package/src/components/Select/useSelect.test.ts +38 -0
  295. package/src/components/Select/useSelect.ts +33 -0
  296. package/src/components/Separator/Separator.native.tsx +38 -0
  297. package/src/components/Separator/Separator.stories.tsx +34 -0
  298. package/src/components/Separator/Separator.types.ts +7 -0
  299. package/src/components/Separator/Separator.web.test.tsx +32 -0
  300. package/src/components/Separator/Separator.web.tsx +38 -0
  301. package/src/components/Separator/index.native.ts +2 -0
  302. package/src/components/Separator/index.ts +2 -0
  303. package/src/components/Sheet/Sheet.native.tsx +246 -0
  304. package/src/components/Sheet/Sheet.stories.tsx +43 -0
  305. package/src/components/Sheet/Sheet.types.ts +47 -0
  306. package/src/components/Sheet/Sheet.web.tsx +144 -0
  307. package/src/components/Sheet/index.native.ts +2 -0
  308. package/src/components/Sheet/index.ts +2 -0
  309. package/src/components/Sheet/useSheet.test.ts +40 -0
  310. package/src/components/Sheet/useSheet.ts +19 -0
  311. package/src/components/Sidebar/Sidebar.native.tsx +7 -0
  312. package/src/components/Sidebar/Sidebar.stories.tsx +100 -0
  313. package/src/components/Sidebar/Sidebar.types.ts +30 -0
  314. package/src/components/Sidebar/Sidebar.web.test.tsx +74 -0
  315. package/src/components/Sidebar/Sidebar.web.tsx +200 -0
  316. package/src/components/Sidebar/index.native.ts +2 -0
  317. package/src/components/Sidebar/index.ts +2 -0
  318. package/src/components/Sidebar/useSidebar.test.ts +51 -0
  319. package/src/components/Sidebar/useSidebar.ts +26 -0
  320. package/src/components/Skeleton/Skeleton.native.tsx +45 -0
  321. package/src/components/Skeleton/Skeleton.stories.tsx +32 -0
  322. package/src/components/Skeleton/Skeleton.types.ts +6 -0
  323. package/src/components/Skeleton/Skeleton.web.test.tsx +35 -0
  324. package/src/components/Skeleton/Skeleton.web.tsx +18 -0
  325. package/src/components/Skeleton/index.native.ts +2 -0
  326. package/src/components/Skeleton/index.ts +2 -0
  327. package/src/components/Slider/Slider.native.tsx +98 -0
  328. package/src/components/Slider/Slider.stories.tsx +23 -0
  329. package/src/components/Slider/Slider.types.ts +10 -0
  330. package/src/components/Slider/Slider.web.tsx +25 -0
  331. package/src/components/Slider/index.native.ts +2 -0
  332. package/src/components/Slider/index.ts +2 -0
  333. package/src/components/Slider/useSlider.test.ts +68 -0
  334. package/src/components/Slider/useSlider.ts +55 -0
  335. package/src/components/Switch/Switch.native.tsx +36 -0
  336. package/src/components/Switch/Switch.stories.tsx +28 -0
  337. package/src/components/Switch/Switch.types.ts +7 -0
  338. package/src/components/Switch/Switch.web.test.tsx +44 -0
  339. package/src/components/Switch/Switch.web.tsx +26 -0
  340. package/src/components/Switch/index.native.ts +2 -0
  341. package/src/components/Switch/index.ts +2 -0
  342. package/src/components/Table/Table.native.tsx +165 -0
  343. package/src/components/Table/Table.stories.tsx +54 -0
  344. package/src/components/Table/Table.types.ts +41 -0
  345. package/src/components/Table/Table.web.test.tsx +77 -0
  346. package/src/components/Table/Table.web.tsx +119 -0
  347. package/src/components/Table/index.native.ts +2 -0
  348. package/src/components/Table/index.ts +2 -0
  349. package/src/components/Tabs/Tabs.native.tsx +136 -0
  350. package/src/components/Tabs/Tabs.stories.tsx +35 -0
  351. package/src/components/Tabs/Tabs.types.ts +25 -0
  352. package/src/components/Tabs/Tabs.web.tsx +52 -0
  353. package/src/components/Tabs/index.native.ts +2 -0
  354. package/src/components/Tabs/index.ts +2 -0
  355. package/src/components/Tabs/useTabs.test.ts +40 -0
  356. package/src/components/Tabs/useTabs.ts +20 -0
  357. package/src/components/Textarea/Textarea.native.tsx +33 -0
  358. package/src/components/Textarea/Textarea.stories.tsx +27 -0
  359. package/src/components/Textarea/Textarea.types.ts +10 -0
  360. package/src/components/Textarea/Textarea.web.test.tsx +33 -0
  361. package/src/components/Textarea/Textarea.web.tsx +21 -0
  362. package/src/components/Textarea/index.native.ts +2 -0
  363. package/src/components/Textarea/index.ts +2 -0
  364. package/src/components/Toast/Toast.native.tsx +267 -0
  365. package/src/components/Toast/Toast.stories.tsx +34 -0
  366. package/src/components/Toast/Toast.types.ts +50 -0
  367. package/src/components/Toast/Toast.web.tsx +282 -0
  368. package/src/components/Toast/index.native.ts +17 -0
  369. package/src/components/Toast/index.ts +11 -0
  370. package/src/components/Toast/useToast.test.ts +122 -0
  371. package/src/components/Toast/useToast.ts +64 -0
  372. package/src/components/Toggle/Toggle.native.tsx +70 -0
  373. package/src/components/Toggle/Toggle.stories.tsx +34 -0
  374. package/src/components/Toggle/Toggle.types.ts +13 -0
  375. package/src/components/Toggle/Toggle.web.tsx +42 -0
  376. package/src/components/Toggle/index.native.ts +2 -0
  377. package/src/components/Toggle/index.ts +2 -0
  378. package/src/components/Toggle/useToggle.test.ts +48 -0
  379. package/src/components/Toggle/useToggle.ts +37 -0
  380. package/src/components/ToggleGroup/ToggleGroup.native.tsx +103 -0
  381. package/src/components/ToggleGroup/ToggleGroup.stories.tsx +24 -0
  382. package/src/components/ToggleGroup/ToggleGroup.types.ts +22 -0
  383. package/src/components/ToggleGroup/ToggleGroup.web.tsx +56 -0
  384. package/src/components/ToggleGroup/index.native.ts +2 -0
  385. package/src/components/ToggleGroup/index.ts +2 -0
  386. package/src/components/ToggleGroup/useToggleGroup.test.ts +79 -0
  387. package/src/components/ToggleGroup/useToggleGroup.ts +63 -0
  388. package/src/components/Tooltip/Tooltip.native.tsx +7 -0
  389. package/src/components/Tooltip/Tooltip.stories.tsx +32 -0
  390. package/src/components/Tooltip/Tooltip.types.ts +27 -0
  391. package/src/components/Tooltip/Tooltip.web.test.tsx +42 -0
  392. package/src/components/Tooltip/Tooltip.web.tsx +29 -0
  393. package/src/components/Tooltip/index.native.ts +2 -0
  394. package/src/components/Tooltip/index.ts +2 -0
  395. package/src/components/index.native.ts +50 -0
  396. package/src/components/index.ts +49 -0
  397. package/src/hooks/useControllableState.test.ts +89 -0
  398. package/src/hooks/useControllableState.ts +37 -0
  399. package/src/index.native.ts +20 -0
  400. package/src/index.ts +12 -0
  401. package/src/theme/native.ts +211 -0
  402. package/src/theme/presets/aurora.ts +56 -0
  403. package/src/theme/presets/dark.ts +30 -0
  404. package/src/theme/presets/default.ts +30 -0
  405. package/src/theme/theme.types.ts +64 -0
  406. package/src/theme/tokens.ts +31 -0
  407. package/src/theme/web.ts +123 -0
  408. package/src/uniwind.d.ts +38 -0
  409. package/src/utils/cn.native.ts +10 -0
  410. package/src/utils/cn.test.ts +28 -0
  411. package/src/utils/cn.ts +6 -0
  412. package/src/utils/glass.native.ts +22 -0
  413. package/src/utils/withGlass.native.tsx +59 -0
@@ -0,0 +1,185 @@
1
+ import { forwardRef } from "react";
2
+ import { cva } from "class-variance-authority";
3
+ import { cn } from "../../utils/cn";
4
+ import type {
5
+ PaginationProps,
6
+ PaginationContentProps,
7
+ PaginationItemProps,
8
+ PaginationLinkProps,
9
+ PaginationPreviousProps,
10
+ PaginationNextProps,
11
+ PaginationEllipsisProps,
12
+ } from "./Pagination.types";
13
+
14
+ const Pagination = forwardRef<
15
+ HTMLElement,
16
+ PaginationProps & React.ComponentProps<"nav">
17
+ >(({ className, ...props }, ref) => (
18
+ <nav
19
+ ref={ref}
20
+ role="navigation"
21
+ aria-label="pagination"
22
+ className={cn("mx-auto flex w-full justify-center", className)}
23
+ {...props}
24
+ />
25
+ ));
26
+ Pagination.displayName = "Pagination";
27
+
28
+ const PaginationContent = forwardRef<
29
+ HTMLUListElement,
30
+ PaginationContentProps & React.ComponentProps<"ul">
31
+ >(({ className, ...props }, ref) => (
32
+ <ul
33
+ ref={ref}
34
+ className={cn("flex flex-row items-center gap-1", className)}
35
+ {...props}
36
+ />
37
+ ));
38
+ PaginationContent.displayName = "PaginationContent";
39
+
40
+ const PaginationItem = forwardRef<
41
+ HTMLLIElement,
42
+ PaginationItemProps & React.ComponentProps<"li">
43
+ >(({ className, ...props }, ref) => (
44
+ <li ref={ref} className={cn("", className)} {...props} />
45
+ ));
46
+ PaginationItem.displayName = "PaginationItem";
47
+
48
+ const paginationLinkVariants = cva(
49
+ "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
50
+ {
51
+ variants: {
52
+ size: {
53
+ default: "h-9 px-4 py-2",
54
+ icon: "h-9 w-9",
55
+ },
56
+ },
57
+ defaultVariants: {
58
+ size: "icon",
59
+ },
60
+ },
61
+ );
62
+
63
+ interface PaginationLinkWebProps
64
+ extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
65
+ isActive?: boolean;
66
+ size?: "default" | "icon";
67
+ className?: string;
68
+ }
69
+
70
+ const PaginationLink = forwardRef<HTMLAnchorElement, PaginationLinkWebProps>(
71
+ ({ className, isActive, size = "icon", ...props }, ref) => (
72
+ <a
73
+ ref={ref}
74
+ aria-current={isActive ? "page" : undefined}
75
+ className={cn(
76
+ paginationLinkVariants({ size }),
77
+ isActive
78
+ ? "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground"
79
+ : "hover:bg-accent hover:text-accent-foreground",
80
+ className,
81
+ )}
82
+ {...props}
83
+ />
84
+ ),
85
+ );
86
+ PaginationLink.displayName = "PaginationLink";
87
+
88
+ const PaginationPrevious = forwardRef<
89
+ HTMLAnchorElement,
90
+ PaginationLinkWebProps
91
+ >(({ className, ...props }, ref) => (
92
+ <PaginationLink
93
+ ref={ref}
94
+ aria-label="Go to previous page"
95
+ size="default"
96
+ className={cn("gap-1 pl-2.5", className)}
97
+ {...props}
98
+ >
99
+ <svg
100
+ xmlns="http://www.w3.org/2000/svg"
101
+ width="16"
102
+ height="16"
103
+ viewBox="0 0 24 24"
104
+ fill="none"
105
+ stroke="currentColor"
106
+ strokeWidth="2"
107
+ strokeLinecap="round"
108
+ strokeLinejoin="round"
109
+ >
110
+ <path d="m15 18-6-6 6-6" />
111
+ </svg>
112
+ <span>Previous</span>
113
+ </PaginationLink>
114
+ ));
115
+ PaginationPrevious.displayName = "PaginationPrevious";
116
+
117
+ const PaginationNext = forwardRef<HTMLAnchorElement, PaginationLinkWebProps>(
118
+ ({ className, ...props }, ref) => (
119
+ <PaginationLink
120
+ ref={ref}
121
+ aria-label="Go to next page"
122
+ size="default"
123
+ className={cn("gap-1 pr-2.5", className)}
124
+ {...props}
125
+ >
126
+ <span>Next</span>
127
+ <svg
128
+ xmlns="http://www.w3.org/2000/svg"
129
+ width="16"
130
+ height="16"
131
+ viewBox="0 0 24 24"
132
+ fill="none"
133
+ stroke="currentColor"
134
+ strokeWidth="2"
135
+ strokeLinecap="round"
136
+ strokeLinejoin="round"
137
+ >
138
+ <path d="m9 18 6-6-6-6" />
139
+ </svg>
140
+ </PaginationLink>
141
+ ),
142
+ );
143
+ PaginationNext.displayName = "PaginationNext";
144
+
145
+ const PaginationEllipsis = forwardRef<
146
+ HTMLSpanElement,
147
+ PaginationEllipsisProps & React.ComponentProps<"span">
148
+ >(({ className, ...props }, ref) => (
149
+ <span
150
+ ref={ref}
151
+ aria-hidden
152
+ className={cn("flex h-9 w-9 items-center justify-center", className)}
153
+ {...props}
154
+ >
155
+ <svg
156
+ xmlns="http://www.w3.org/2000/svg"
157
+ width="16"
158
+ height="16"
159
+ viewBox="0 0 24 24"
160
+ fill="none"
161
+ stroke="currentColor"
162
+ strokeWidth="2"
163
+ strokeLinecap="round"
164
+ strokeLinejoin="round"
165
+ >
166
+ <circle cx="12" cy="12" r="1" />
167
+ <circle cx="19" cy="12" r="1" />
168
+ <circle cx="5" cy="12" r="1" />
169
+ </svg>
170
+ <span className="sr-only">More pages</span>
171
+ </span>
172
+ ));
173
+ PaginationEllipsis.displayName = "PaginationEllipsis";
174
+
175
+ export {
176
+ Pagination,
177
+ PaginationContent,
178
+ PaginationItem,
179
+ PaginationLink,
180
+ PaginationPrevious,
181
+ PaginationNext,
182
+ PaginationEllipsis,
183
+ paginationLinkVariants,
184
+ };
185
+ export type { PaginationLinkWebProps };
@@ -0,0 +1,19 @@
1
+ export {
2
+ Pagination,
3
+ PaginationContent,
4
+ PaginationItem,
5
+ PaginationLink,
6
+ PaginationPrevious,
7
+ PaginationNext,
8
+ PaginationEllipsis,
9
+ paginationLinkVariants,
10
+ } from "./Pagination.native";
11
+ export type {
12
+ PaginationProps,
13
+ PaginationContentProps,
14
+ PaginationItemProps,
15
+ PaginationLinkProps,
16
+ PaginationPreviousProps,
17
+ PaginationNextProps,
18
+ PaginationEllipsisProps,
19
+ } from "./Pagination.types";
@@ -0,0 +1,2 @@
1
+ export * from "./Pagination.web";
2
+ export type * from "./Pagination.types";
@@ -0,0 +1,97 @@
1
+ import {
2
+ createContext,
3
+ useContext,
4
+ } from "react";
5
+ import {
6
+ Modal,
7
+ Pressable,
8
+ type ViewProps,
9
+ } from "react-native";
10
+ import type {
11
+ PopoverProps,
12
+ PopoverTriggerProps,
13
+ PopoverContentProps,
14
+ } from "./Popover.types";
15
+ import { usePopover } from "./usePopover";
16
+
17
+ interface PopoverContextValue {
18
+ open: boolean;
19
+ onOpenChange: (open: boolean) => void;
20
+ }
21
+
22
+ const PopoverContext = createContext<PopoverContextValue>({
23
+ open: false,
24
+ onOpenChange: () => {},
25
+ });
26
+
27
+ function Popover({
28
+ children,
29
+ open: controlledOpen,
30
+ onOpenChange: controlledOnOpenChange,
31
+ }: PopoverProps) {
32
+ const { open, onOpenChange } = usePopover({
33
+ open: controlledOpen,
34
+ onOpenChange: controlledOnOpenChange,
35
+ });
36
+
37
+ return (
38
+ <PopoverContext.Provider value={{ open, onOpenChange }}>
39
+ {children}
40
+ </PopoverContext.Provider>
41
+ );
42
+ }
43
+ Popover.displayName = "Popover";
44
+
45
+ interface PopoverTriggerNativeProps extends PopoverTriggerProps {
46
+ onPress?: () => void;
47
+ }
48
+
49
+ function PopoverTrigger({ children, onPress }: PopoverTriggerNativeProps) {
50
+ const { onOpenChange } = useContext(PopoverContext);
51
+ return (
52
+ <Pressable
53
+ onPress={() => {
54
+ onOpenChange(true);
55
+ onPress?.();
56
+ }}
57
+ >
58
+ {children}
59
+ </Pressable>
60
+ );
61
+ }
62
+ PopoverTrigger.displayName = "PopoverTrigger";
63
+
64
+ interface PopoverContentNativeProps extends PopoverContentProps {
65
+ style?: ViewProps["style"];
66
+ }
67
+
68
+ function PopoverContent({ children, style }: PopoverContentNativeProps) {
69
+ const { open, onOpenChange } = useContext(PopoverContext);
70
+
71
+ if (!open) return null;
72
+
73
+ return (
74
+ <Modal
75
+ visible={open}
76
+ transparent
77
+ animationType="fade"
78
+ onRequestClose={() => onOpenChange(false)}
79
+ >
80
+ <Pressable
81
+ className="flex-1 bg-black/30 justify-center items-center"
82
+ onPress={() => onOpenChange(false)}
83
+ >
84
+ <Pressable
85
+ className="bg-background rounded-lg p-4 w-[85%] max-w-[320px] shadow-md elevation-5"
86
+ style={style}
87
+ onPress={(e) => e.stopPropagation()}
88
+ >
89
+ {children}
90
+ </Pressable>
91
+ </Pressable>
92
+ </Modal>
93
+ );
94
+ }
95
+ PopoverContent.displayName = "PopoverContent";
96
+
97
+ export { Popover, PopoverTrigger, PopoverContent };
@@ -0,0 +1,25 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import { Popover, PopoverTrigger, PopoverContent } from "./Popover.web";
3
+
4
+ const meta: Meta<typeof Popover> = {
5
+ title: "Components/Popover",
6
+ component: Popover,
7
+ tags: ["autodocs"],
8
+ parameters: { layout: "centered" },
9
+ };
10
+
11
+ export default meta;
12
+ type Story = StoryObj<typeof Popover>;
13
+
14
+ export const Default: Story = {
15
+ render: () => (
16
+ <Popover>
17
+ <PopoverTrigger asChild>
18
+ <button>Open Popover</button>
19
+ </PopoverTrigger>
20
+ <PopoverContent>
21
+ <p>This is the popover content. You can place any elements here.</p>
22
+ </PopoverContent>
23
+ </Popover>
24
+ ),
25
+ };
@@ -0,0 +1,20 @@
1
+ import type { ReactNode } from "react";
2
+
3
+ export interface PopoverProps {
4
+ children?: ReactNode;
5
+ open?: boolean;
6
+ onOpenChange?: (open: boolean) => void;
7
+ }
8
+
9
+ export interface PopoverTriggerProps {
10
+ children?: ReactNode;
11
+ className?: string;
12
+ asChild?: boolean;
13
+ }
14
+
15
+ export interface PopoverContentProps {
16
+ children?: ReactNode;
17
+ className?: string;
18
+ align?: "start" | "center" | "end";
19
+ sideOffset?: number;
20
+ }
@@ -0,0 +1,30 @@
1
+ import { forwardRef } from "react";
2
+ import * as PopoverPrimitive from "@radix-ui/react-popover";
3
+ import { cn } from "../../utils/cn";
4
+
5
+ const Popover = PopoverPrimitive.Root;
6
+
7
+ const PopoverTrigger = PopoverPrimitive.Trigger;
8
+
9
+ const PopoverAnchor = PopoverPrimitive.Anchor;
10
+
11
+ const PopoverContent = forwardRef<
12
+ React.ComponentRef<typeof PopoverPrimitive.Content>,
13
+ React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
14
+ >(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
15
+ <PopoverPrimitive.Portal>
16
+ <PopoverPrimitive.Content
17
+ ref={ref}
18
+ align={align}
19
+ sideOffset={sideOffset}
20
+ className={cn(
21
+ "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
22
+ className,
23
+ )}
24
+ {...props}
25
+ />
26
+ </PopoverPrimitive.Portal>
27
+ ));
28
+ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
29
+
30
+ export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };
@@ -0,0 +1,2 @@
1
+ export { Popover, PopoverTrigger, PopoverContent } from "./Popover.native";
2
+ export type { PopoverProps } from "./Popover.types";
@@ -0,0 +1,2 @@
1
+ export * from "./Popover.web";
2
+ export type * from "./Popover.types";
@@ -0,0 +1,40 @@
1
+ import { describe, it, expect, vi } from "vitest";
2
+ import { renderHook, act } from "@testing-library/react";
3
+ import { usePopover } from "./usePopover";
4
+
5
+ describe("usePopover", () => {
6
+ it("defaults to closed", () => {
7
+ const { result } = renderHook(() => usePopover());
8
+ expect(result.current.open).toBe(false);
9
+ });
10
+
11
+ it("uses defaultOpen", () => {
12
+ const { result } = renderHook(() => usePopover({ defaultOpen: true }));
13
+ expect(result.current.open).toBe(true);
14
+ });
15
+
16
+ it("opens and closes", () => {
17
+ const { result } = renderHook(() => usePopover());
18
+ act(() => result.current.onOpenChange(true));
19
+ expect(result.current.open).toBe(true);
20
+ act(() => result.current.onOpenChange(false));
21
+ expect(result.current.open).toBe(false);
22
+ });
23
+
24
+ it("calls external onOpenChange callback", () => {
25
+ const onChange = vi.fn();
26
+ const { result } = renderHook(() => usePopover({ onOpenChange: onChange }));
27
+ act(() => result.current.onOpenChange(true));
28
+ expect(onChange).toHaveBeenCalledWith(true);
29
+ });
30
+
31
+ it("works in controlled mode", () => {
32
+ const onChange = vi.fn();
33
+ const { result } = renderHook(() =>
34
+ usePopover({ open: false, onOpenChange: onChange }),
35
+ );
36
+ act(() => result.current.onOpenChange(true));
37
+ expect(result.current.open).toBe(false);
38
+ expect(onChange).toHaveBeenCalledWith(true);
39
+ });
40
+ });
@@ -0,0 +1,36 @@
1
+ import { useCallback } from "react";
2
+ import { useControllableState } from "../../hooks/useControllableState";
3
+
4
+ interface UsePopoverProps {
5
+ open?: boolean;
6
+ defaultOpen?: boolean;
7
+ onOpenChange?: (open: boolean) => void;
8
+ }
9
+
10
+ interface UsePopoverReturn {
11
+ open: boolean;
12
+ onOpenChange: (open: boolean) => void;
13
+ }
14
+
15
+ export function usePopover({
16
+ open: controlledOpen,
17
+ defaultOpen = false,
18
+ onOpenChange,
19
+ }: UsePopoverProps = {}): UsePopoverReturn {
20
+ const [open, setOpen] = useControllableState({
21
+ value: controlledOpen,
22
+ defaultValue: defaultOpen,
23
+ onChange: onOpenChange,
24
+ });
25
+
26
+ const handleOpenChange = useCallback(
27
+ (nextOpen: boolean) => {
28
+ setOpen(nextOpen);
29
+ },
30
+ [setOpen],
31
+ );
32
+
33
+ return { open, onOpenChange: handleOpenChange };
34
+ }
35
+
36
+ export type { UsePopoverProps, UsePopoverReturn };
@@ -0,0 +1,65 @@
1
+ import { useEffect, useRef, useState } from "react";
2
+ import {
3
+ View,
4
+ Animated,
5
+ type ViewProps,
6
+ type LayoutChangeEvent,
7
+ } from "react-native";
8
+ import type { ProgressProps } from "./Progress.types";
9
+ import { useProgress } from "./useProgress";
10
+
11
+ interface ProgressNativeProps extends ProgressProps, ViewProps {}
12
+
13
+ function Progress({
14
+ value = 0,
15
+ max = 100,
16
+ style,
17
+ ...props
18
+ }: ProgressNativeProps) {
19
+ const animatedValue = useRef(new Animated.Value(0)).current;
20
+ const [trackWidth, setTrackWidth] = useState(0);
21
+
22
+ const { clampedValue, percentage } = useProgress({ value, max });
23
+
24
+ useEffect(() => {
25
+ Animated.timing(animatedValue, {
26
+ toValue: percentage,
27
+ duration: 300,
28
+ useNativeDriver: false,
29
+ }).start();
30
+ }, [percentage, animatedValue]);
31
+
32
+ const handleLayout = (event: LayoutChangeEvent) => {
33
+ setTrackWidth(event.nativeEvent.layout.width);
34
+ };
35
+
36
+ return (
37
+ <View
38
+ className="h-2 w-full overflow-hidden rounded-full bg-primary/20"
39
+ style={style}
40
+ onLayout={handleLayout}
41
+ accessibilityRole="progressbar"
42
+ accessibilityValue={{
43
+ min: 0,
44
+ max,
45
+ now: clampedValue,
46
+ }}
47
+ {...props}
48
+ >
49
+ <Animated.View
50
+ className="h-full bg-primary rounded-full"
51
+ style={{
52
+ width: animatedValue.interpolate({
53
+ inputRange: [0, 1],
54
+ outputRange: [0, trackWidth],
55
+ }),
56
+ }}
57
+ />
58
+ </View>
59
+ );
60
+ }
61
+
62
+ Progress.displayName = "Progress";
63
+
64
+ export { Progress };
65
+ export type { ProgressNativeProps };
@@ -0,0 +1,36 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import { Progress } from "./Progress.web";
3
+
4
+ const meta: Meta<typeof Progress> = {
5
+ title: "Components/Progress",
6
+ component: Progress,
7
+ tags: ["autodocs"],
8
+ parameters: { layout: "centered" },
9
+ };
10
+
11
+ export default meta;
12
+ type Story = StoryObj<typeof Progress>;
13
+
14
+ export const Default: Story = {
15
+ render: () => (
16
+ <div style={{ width: 300 }}>
17
+ <Progress value={60} />
18
+ </div>
19
+ ),
20
+ };
21
+
22
+ export const Empty: Story = {
23
+ render: () => (
24
+ <div style={{ width: 300 }}>
25
+ <Progress value={0} />
26
+ </div>
27
+ ),
28
+ };
29
+
30
+ export const Full: Story = {
31
+ render: () => (
32
+ <div style={{ width: 300 }}>
33
+ <Progress value={100} />
34
+ </div>
35
+ ),
36
+ };
@@ -0,0 +1,6 @@
1
+ export interface ProgressProps {
2
+ value?: number;
3
+ max?: number;
4
+ children?: React.ReactNode;
5
+ className?: string;
6
+ }
@@ -0,0 +1,27 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { render, screen } from "@testing-library/react";
3
+ import { Progress } from "./Progress.web";
4
+
5
+ describe("Progress rendering", () => {
6
+ it("renders with progressbar role", () => {
7
+ render(<Progress value={50} />);
8
+ expect(screen.getByRole("progressbar")).toBeDefined();
9
+ });
10
+
11
+ it("applies transform on indicator based on value", () => {
12
+ render(<Progress value={75} />);
13
+ const indicator = screen.getByRole("progressbar").firstChild as HTMLElement;
14
+ expect(indicator.style.transform).toBe("translateX(-25%)");
15
+ });
16
+
17
+ it("shows 0% when value is 0", () => {
18
+ render(<Progress value={0} />);
19
+ const indicator = screen.getByRole("progressbar").firstChild as HTMLElement;
20
+ expect(indicator.style.transform).toBe("translateX(-100%)");
21
+ });
22
+
23
+ it("merges custom className", () => {
24
+ render(<Progress className="my-progress" value={0} />);
25
+ expect(screen.getByRole("progressbar").className).toContain("my-progress");
26
+ });
27
+ });
@@ -0,0 +1,30 @@
1
+ import { forwardRef } from "react";
2
+ import * as ProgressPrimitive from "@radix-ui/react-progress";
3
+ import { cn } from "../../utils/cn";
4
+ import { useProgress } from "./useProgress";
5
+
6
+ const Progress = forwardRef<
7
+ React.ComponentRef<typeof ProgressPrimitive.Root>,
8
+ React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>
9
+ >(({ className, value, ...props }, ref) => {
10
+ const { percentage } = useProgress({ value: value ?? 0 });
11
+
12
+ return (
13
+ <ProgressPrimitive.Root
14
+ ref={ref}
15
+ className={cn(
16
+ "relative h-2 w-full overflow-hidden rounded-full bg-primary/20",
17
+ className,
18
+ )}
19
+ {...props}
20
+ >
21
+ <ProgressPrimitive.Indicator
22
+ className="h-full w-full flex-1 bg-primary transition-all"
23
+ style={{ transform: `translateX(-${100 - percentage * 100}%)` }}
24
+ />
25
+ </ProgressPrimitive.Root>
26
+ );
27
+ });
28
+ Progress.displayName = ProgressPrimitive.Root.displayName;
29
+
30
+ export { Progress };
@@ -0,0 +1,2 @@
1
+ export { Progress } from "./Progress.native";
2
+ export type { ProgressProps } from "./Progress.types";
@@ -0,0 +1,2 @@
1
+ export * from "./Progress.web";
2
+ export type * from "./Progress.types";
@@ -0,0 +1,44 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { useProgress } from "./useProgress";
3
+
4
+ describe("useProgress", () => {
5
+ it("defaults to 0% when no args", () => {
6
+ const result = useProgress();
7
+ expect(result.clampedValue).toBe(0);
8
+ expect(result.percentage).toBe(0);
9
+ expect(result.max).toBe(100);
10
+ });
11
+
12
+ it("computes percentage correctly", () => {
13
+ const result = useProgress({ value: 50, max: 100 });
14
+ expect(result.percentage).toBe(0.5);
15
+ });
16
+
17
+ it("clamps value to min 0", () => {
18
+ const result = useProgress({ value: -10, max: 100 });
19
+ expect(result.clampedValue).toBe(0);
20
+ expect(result.percentage).toBe(0);
21
+ });
22
+
23
+ it("clamps value to max", () => {
24
+ const result = useProgress({ value: 150, max: 100 });
25
+ expect(result.clampedValue).toBe(100);
26
+ expect(result.percentage).toBe(1);
27
+ });
28
+
29
+ it("handles custom max", () => {
30
+ const result = useProgress({ value: 25, max: 50 });
31
+ expect(result.clampedValue).toBe(25);
32
+ expect(result.percentage).toBe(0.5);
33
+ });
34
+
35
+ it("handles max=0 without division by zero", () => {
36
+ const result = useProgress({ value: 10, max: 0 });
37
+ expect(result.percentage).toBe(0);
38
+ });
39
+
40
+ it("returns 100% when value equals max", () => {
41
+ const result = useProgress({ value: 100, max: 100 });
42
+ expect(result.percentage).toBe(1);
43
+ });
44
+ });