@arolariu/components 1.0.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (451) hide show
  1. package/CHANGELOG.md +89 -0
  2. package/EXAMPLES.md +2510 -0
  3. package/dist/components/ui/accordion.js +3 -3
  4. package/dist/components/ui/accordion.js.map +1 -1
  5. package/dist/components/ui/accordion_module.css.map +1 -1
  6. package/dist/components/ui/alert-dialog.d.ts +4 -16
  7. package/dist/components/ui/alert-dialog.d.ts.map +1 -1
  8. package/dist/components/ui/alert-dialog.js +21 -17
  9. package/dist/components/ui/alert-dialog.js.map +1 -1
  10. package/dist/components/ui/alert-dialog_module.css +1 -1
  11. package/dist/components/ui/alert-dialog_module.css.map +1 -1
  12. package/dist/components/ui/alert.js +4 -4
  13. package/dist/components/ui/alert.js.map +1 -1
  14. package/dist/components/ui/alert_module.css.map +1 -1
  15. package/dist/components/ui/aspect-ratio.js +2 -2
  16. package/dist/components/ui/aspect-ratio.js.map +1 -1
  17. package/dist/components/ui/aspect-ratio_module.css.map +1 -1
  18. package/dist/components/ui/async-boundary.js +2 -2
  19. package/dist/components/ui/async-boundary.js.map +1 -1
  20. package/dist/components/ui/avatar.d.ts +3 -12
  21. package/dist/components/ui/avatar.d.ts.map +1 -1
  22. package/dist/components/ui/avatar.js +18 -15
  23. package/dist/components/ui/avatar.js.map +1 -1
  24. package/dist/components/ui/avatar_module.css.map +1 -1
  25. package/dist/components/ui/background-beams.js +3 -3
  26. package/dist/components/ui/background-beams.js.map +1 -1
  27. package/dist/components/ui/background-beams_module.css.map +1 -1
  28. package/dist/components/ui/badge.js +2 -2
  29. package/dist/components/ui/badge.js.map +1 -1
  30. package/dist/components/ui/badge_module.css.map +1 -1
  31. package/dist/components/ui/breadcrumb.js +10 -10
  32. package/dist/components/ui/breadcrumb.js.map +1 -1
  33. package/dist/components/ui/breadcrumb_module.css.map +1 -1
  34. package/dist/components/ui/bubble-background.js +5 -5
  35. package/dist/components/ui/bubble-background.js.map +1 -1
  36. package/dist/components/ui/bubble-background_module.css.map +1 -1
  37. package/dist/components/ui/button-group.d.ts +1 -1
  38. package/dist/components/ui/button-group.d.ts.map +1 -1
  39. package/dist/components/ui/button-group.js +6 -6
  40. package/dist/components/ui/button-group.js.map +1 -1
  41. package/dist/components/ui/button-group_module.css.map +1 -1
  42. package/dist/components/ui/button.js +4 -4
  43. package/dist/components/ui/button.js.map +1 -1
  44. package/dist/components/ui/button_module.css.map +1 -1
  45. package/dist/components/ui/calendar.d.ts +3 -5
  46. package/dist/components/ui/calendar.d.ts.map +1 -1
  47. package/dist/components/ui/calendar.js +9 -9
  48. package/dist/components/ui/calendar.js.map +1 -1
  49. package/dist/components/ui/calendar_module.css.map +1 -1
  50. package/dist/components/ui/card-skeleton.js +2 -2
  51. package/dist/components/ui/card-skeleton.js.map +1 -1
  52. package/dist/components/ui/card-skeleton_module.css.map +1 -1
  53. package/dist/components/ui/card.js +8 -8
  54. package/dist/components/ui/card.js.map +1 -1
  55. package/dist/components/ui/card_module.css.map +1 -1
  56. package/dist/components/ui/carousel.d.ts.map +1 -1
  57. package/dist/components/ui/carousel.js +16 -16
  58. package/dist/components/ui/carousel.js.map +1 -1
  59. package/dist/components/ui/carousel_module.css +1 -1
  60. package/dist/components/ui/carousel_module.css.map +1 -1
  61. package/dist/components/ui/chart.d.ts +6 -3
  62. package/dist/components/ui/chart.d.ts.map +1 -1
  63. package/dist/components/ui/chart.js +70 -70
  64. package/dist/components/ui/chart.js.map +1 -1
  65. package/dist/components/ui/chart_module.css.map +1 -1
  66. package/dist/components/ui/checkbox-group.d.ts +2 -6
  67. package/dist/components/ui/checkbox-group.d.ts.map +1 -1
  68. package/dist/components/ui/checkbox-group.js +8 -7
  69. package/dist/components/ui/checkbox-group.js.map +1 -1
  70. package/dist/components/ui/checkbox-group_module.css.map +1 -1
  71. package/dist/components/ui/checkbox.d.ts +3 -1
  72. package/dist/components/ui/checkbox.d.ts.map +1 -1
  73. package/dist/components/ui/checkbox.js +6 -3
  74. package/dist/components/ui/checkbox.js.map +1 -1
  75. package/dist/components/ui/checkbox_module.css.map +1 -1
  76. package/dist/components/ui/collapsible.d.ts.map +1 -1
  77. package/dist/components/ui/collapsible.js +4 -4
  78. package/dist/components/ui/collapsible.js.map +1 -1
  79. package/dist/components/ui/collapsible_module.css.map +1 -1
  80. package/dist/components/ui/combobox.d.ts +335 -0
  81. package/dist/components/ui/combobox.d.ts.map +1 -0
  82. package/dist/components/ui/combobox.js +206 -0
  83. package/dist/components/ui/combobox.js.map +1 -0
  84. package/dist/components/ui/combobox.module.js +23 -0
  85. package/dist/components/ui/combobox.module.js.map +1 -0
  86. package/dist/components/ui/combobox_module.css +142 -0
  87. package/dist/components/ui/combobox_module.css.map +1 -0
  88. package/dist/components/ui/command.d.ts.map +1 -1
  89. package/dist/components/ui/command.js +62 -53
  90. package/dist/components/ui/command.js.map +1 -1
  91. package/dist/components/ui/command_module.css +1 -1
  92. package/dist/components/ui/command_module.css.map +1 -1
  93. package/dist/components/ui/context-menu.d.ts.map +1 -1
  94. package/dist/components/ui/context-menu.js +6 -6
  95. package/dist/components/ui/context-menu.js.map +1 -1
  96. package/dist/components/ui/context-menu_module.css.map +1 -1
  97. package/dist/components/ui/copy-button.js +6 -6
  98. package/dist/components/ui/copy-button.js.map +1 -1
  99. package/dist/components/ui/copy-button_module.css.map +1 -1
  100. package/dist/components/ui/counting-number.js +6 -6
  101. package/dist/components/ui/counting-number.js.map +1 -1
  102. package/dist/components/ui/counting-number_module.css.map +1 -1
  103. package/dist/components/ui/dialog.js +6 -6
  104. package/dist/components/ui/dialog.js.map +1 -1
  105. package/dist/components/ui/dialog_module.css +1 -1
  106. package/dist/components/ui/dialog_module.css.map +1 -1
  107. package/dist/components/ui/dot-background_module.css.map +1 -1
  108. package/dist/components/ui/drawer.d.ts.map +1 -1
  109. package/dist/components/ui/drawer.js +5 -5
  110. package/dist/components/ui/drawer.js.map +1 -1
  111. package/dist/components/ui/drawer_module.css.map +1 -1
  112. package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
  113. package/dist/components/ui/dropdown-menu.js +6 -6
  114. package/dist/components/ui/dropdown-menu.js.map +1 -1
  115. package/dist/components/ui/dropdown-menu_module.css.map +1 -1
  116. package/dist/components/ui/dropdrawer.d.ts +10 -16
  117. package/dist/components/ui/dropdrawer.d.ts.map +1 -1
  118. package/dist/components/ui/dropdrawer.js +73 -65
  119. package/dist/components/ui/dropdrawer.js.map +1 -1
  120. package/dist/components/ui/dropdrawer_module.css.map +1 -1
  121. package/dist/components/ui/empty.js +7 -7
  122. package/dist/components/ui/empty.js.map +1 -1
  123. package/dist/components/ui/empty_module.css.map +1 -1
  124. package/dist/components/ui/error-boundary.js +2 -2
  125. package/dist/components/ui/error-boundary.js.map +1 -1
  126. package/dist/components/ui/error-boundary_module.css.map +1 -1
  127. package/dist/components/ui/field.js +12 -12
  128. package/dist/components/ui/field.js.map +1 -1
  129. package/dist/components/ui/field_module.css.map +1 -1
  130. package/dist/components/ui/fireworks-background.js +6 -6
  131. package/dist/components/ui/fireworks-background.js.map +1 -1
  132. package/dist/components/ui/fireworks-background_module.css.map +1 -1
  133. package/dist/components/ui/flip-button.js +5 -5
  134. package/dist/components/ui/flip-button.js.map +1 -1
  135. package/dist/components/ui/flip-button_module.css.map +1 -1
  136. package/dist/components/ui/focus-scope.js +6 -6
  137. package/dist/components/ui/focus-scope.js.map +1 -1
  138. package/dist/components/ui/focus-scope_module.css.map +1 -1
  139. package/dist/components/ui/form-skeleton.js +2 -2
  140. package/dist/components/ui/form-skeleton.js.map +1 -1
  141. package/dist/components/ui/form-skeleton_module.css.map +1 -1
  142. package/dist/components/ui/form.d.ts +3 -3
  143. package/dist/components/ui/form.d.ts.map +1 -1
  144. package/dist/components/ui/form.js +13 -13
  145. package/dist/components/ui/form.js.map +1 -1
  146. package/dist/components/ui/form_module.css.map +1 -1
  147. package/dist/components/ui/gradient-background.js +2 -2
  148. package/dist/components/ui/gradient-background.js.map +1 -1
  149. package/dist/components/ui/gradient-background_module.css.map +1 -1
  150. package/dist/components/ui/gradient-text.js +2 -2
  151. package/dist/components/ui/gradient-text.js.map +1 -1
  152. package/dist/components/ui/gradient-text_module.css.map +1 -1
  153. package/dist/components/ui/highlight-text.js +4 -4
  154. package/dist/components/ui/highlight-text.js.map +1 -1
  155. package/dist/components/ui/highlight-text_module.css.map +1 -1
  156. package/dist/components/ui/hole-background.js +21 -21
  157. package/dist/components/ui/hole-background.js.map +1 -1
  158. package/dist/components/ui/hole-background_module.css.map +1 -1
  159. package/dist/components/ui/hover-card.js +3 -3
  160. package/dist/components/ui/hover-card.js.map +1 -1
  161. package/dist/components/ui/hover-card_module.css.map +1 -1
  162. package/dist/components/ui/input-group.js +7 -7
  163. package/dist/components/ui/input-group.js.map +1 -1
  164. package/dist/components/ui/input-group_module.css.map +1 -1
  165. package/dist/components/ui/input-otp.d.ts +3 -3
  166. package/dist/components/ui/input-otp.d.ts.map +1 -1
  167. package/dist/components/ui/input-otp.js +6 -6
  168. package/dist/components/ui/input-otp.js.map +1 -1
  169. package/dist/components/ui/input-otp_module.css.map +1 -1
  170. package/dist/components/ui/input.js +2 -2
  171. package/dist/components/ui/input.js.map +1 -1
  172. package/dist/components/ui/input_module.css.map +1 -1
  173. package/dist/components/ui/item.d.ts +1 -1
  174. package/dist/components/ui/item.d.ts.map +1 -1
  175. package/dist/components/ui/item.js +13 -13
  176. package/dist/components/ui/item.js.map +1 -1
  177. package/dist/components/ui/item_module.css.map +1 -1
  178. package/dist/components/ui/kbd.js +3 -3
  179. package/dist/components/ui/kbd.js.map +1 -1
  180. package/dist/components/ui/kbd_module.css.map +1 -1
  181. package/dist/components/ui/label.js +2 -2
  182. package/dist/components/ui/label.js.map +1 -1
  183. package/dist/components/ui/label_module.css.map +1 -1
  184. package/dist/components/ui/list-skeleton.js +2 -2
  185. package/dist/components/ui/list-skeleton.js.map +1 -1
  186. package/dist/components/ui/list-skeleton_module.css.map +1 -1
  187. package/dist/components/ui/loading-overlay.js +2 -2
  188. package/dist/components/ui/loading-overlay.js.map +1 -1
  189. package/dist/components/ui/loading-overlay_module.css.map +1 -1
  190. package/dist/components/ui/menubar.d.ts +11 -13
  191. package/dist/components/ui/menubar.d.ts.map +1 -1
  192. package/dist/components/ui/menubar.js +4 -4
  193. package/dist/components/ui/menubar.js.map +1 -1
  194. package/dist/components/ui/menubar_module.css.map +1 -1
  195. package/dist/components/ui/meter.d.ts +8 -24
  196. package/dist/components/ui/meter.d.ts.map +1 -1
  197. package/dist/components/ui/meter.js +23 -19
  198. package/dist/components/ui/meter.js.map +1 -1
  199. package/dist/components/ui/meter_module.css.map +1 -1
  200. package/dist/components/ui/navigation-menu.d.ts +3 -12
  201. package/dist/components/ui/navigation-menu.d.ts.map +1 -1
  202. package/dist/components/ui/navigation-menu.js +15 -12
  203. package/dist/components/ui/navigation-menu.js.map +1 -1
  204. package/dist/components/ui/navigation-menu_module.css +1 -1
  205. package/dist/components/ui/navigation-menu_module.css.map +1 -1
  206. package/dist/components/ui/number-field.d.ts +6 -12
  207. package/dist/components/ui/number-field.d.ts.map +1 -1
  208. package/dist/components/ui/number-field.js +3 -3
  209. package/dist/components/ui/number-field.js.map +1 -1
  210. package/dist/components/ui/number-field_module.css.map +1 -1
  211. package/dist/components/ui/pagination.js +8 -8
  212. package/dist/components/ui/pagination.js.map +1 -1
  213. package/dist/components/ui/pagination_module.css.map +1 -1
  214. package/dist/components/ui/popover.js +5 -5
  215. package/dist/components/ui/popover.js.map +1 -1
  216. package/dist/components/ui/popover_module.css.map +1 -1
  217. package/dist/components/ui/progress.d.ts +1 -4
  218. package/dist/components/ui/progress.d.ts.map +1 -1
  219. package/dist/components/ui/progress.js +10 -9
  220. package/dist/components/ui/progress.js.map +1 -1
  221. package/dist/components/ui/progress_module.css.map +1 -1
  222. package/dist/components/ui/radio-group.d.ts +2 -4
  223. package/dist/components/ui/radio-group.d.ts.map +1 -1
  224. package/dist/components/ui/radio-group.js +3 -3
  225. package/dist/components/ui/radio-group.js.map +1 -1
  226. package/dist/components/ui/radio-group_module.css.map +1 -1
  227. package/dist/components/ui/resizable.d.ts +13 -29
  228. package/dist/components/ui/resizable.d.ts.map +1 -1
  229. package/dist/components/ui/resizable.js +8 -7
  230. package/dist/components/ui/resizable.js.map +1 -1
  231. package/dist/components/ui/resizable_module.css.map +1 -1
  232. package/dist/components/ui/ripple-button.js +9 -9
  233. package/dist/components/ui/ripple-button.js.map +1 -1
  234. package/dist/components/ui/ripple-button_module.css.map +1 -1
  235. package/dist/components/ui/scratcher.d.ts +1 -1
  236. package/dist/components/ui/scratcher.d.ts.map +1 -1
  237. package/dist/components/ui/scratcher.js +5 -4
  238. package/dist/components/ui/scratcher.js.map +1 -1
  239. package/dist/components/ui/scratcher_module.css.map +1 -1
  240. package/dist/components/ui/scroll-area.d.ts +2 -4
  241. package/dist/components/ui/scroll-area.d.ts.map +1 -1
  242. package/dist/components/ui/scroll-area.js +2 -2
  243. package/dist/components/ui/scroll-area.js.map +1 -1
  244. package/dist/components/ui/scroll-area_module.css.map +1 -1
  245. package/dist/components/ui/select.js +4 -4
  246. package/dist/components/ui/select.js.map +1 -1
  247. package/dist/components/ui/select_module.css.map +1 -1
  248. package/dist/components/ui/separator.d.ts +1 -4
  249. package/dist/components/ui/separator.d.ts.map +1 -1
  250. package/dist/components/ui/separator.js +9 -8
  251. package/dist/components/ui/separator.js.map +1 -1
  252. package/dist/components/ui/separator_module.css.map +1 -1
  253. package/dist/components/ui/sheet.d.ts.map +1 -1
  254. package/dist/components/ui/sheet.js +6 -6
  255. package/dist/components/ui/sheet.js.map +1 -1
  256. package/dist/components/ui/sheet_module.css.map +1 -1
  257. package/dist/components/ui/sidebar.d.ts +1 -1
  258. package/dist/components/ui/sidebar.d.ts.map +1 -1
  259. package/dist/components/ui/sidebar.js +36 -36
  260. package/dist/components/ui/sidebar.js.map +1 -1
  261. package/dist/components/ui/sidebar_module.css.map +1 -1
  262. package/dist/components/ui/skeleton.js +2 -2
  263. package/dist/components/ui/skeleton.js.map +1 -1
  264. package/dist/components/ui/skeleton_module.css.map +1 -1
  265. package/dist/components/ui/slider.js +2 -2
  266. package/dist/components/ui/slider.js.map +1 -1
  267. package/dist/components/ui/slider_module.css.map +1 -1
  268. package/dist/components/ui/spinner.js +2 -2
  269. package/dist/components/ui/spinner.js.map +1 -1
  270. package/dist/components/ui/spinner_module.css.map +1 -1
  271. package/dist/components/ui/stepper.js +2 -2
  272. package/dist/components/ui/stepper.js.map +1 -1
  273. package/dist/components/ui/stepper_module.css.map +1 -1
  274. package/dist/components/ui/switch.js +2 -2
  275. package/dist/components/ui/switch.js.map +1 -1
  276. package/dist/components/ui/switch_module.css.map +1 -1
  277. package/dist/components/ui/table-skeleton.js +2 -2
  278. package/dist/components/ui/table-skeleton.js.map +1 -1
  279. package/dist/components/ui/table-skeleton_module.css.map +1 -1
  280. package/dist/components/ui/table.js +9 -9
  281. package/dist/components/ui/table.js.map +1 -1
  282. package/dist/components/ui/table_module.css.map +1 -1
  283. package/dist/components/ui/tabs.js +3 -3
  284. package/dist/components/ui/tabs.js.map +1 -1
  285. package/dist/components/ui/tabs_module.css.map +1 -1
  286. package/dist/components/ui/textarea.js +2 -2
  287. package/dist/components/ui/textarea.js.map +1 -1
  288. package/dist/components/ui/textarea_module.css.map +1 -1
  289. package/dist/components/ui/timeline.js +5 -5
  290. package/dist/components/ui/timeline.js.map +1 -1
  291. package/dist/components/ui/timeline_module.css.map +1 -1
  292. package/dist/components/ui/{sonner.d.ts → toast.d.ts} +15 -6
  293. package/dist/components/ui/toast.d.ts.map +1 -0
  294. package/dist/components/ui/{sonner.js → toast.js} +43 -42
  295. package/dist/components/ui/toast.js.map +1 -0
  296. package/dist/components/ui/toast.module.js +34 -0
  297. package/dist/components/ui/toast.module.js.map +1 -0
  298. package/dist/components/ui/{sonner_module.css → toast_module.css} +35 -35
  299. package/dist/components/ui/toast_module.css.map +1 -0
  300. package/dist/components/ui/toggle-group.d.ts +2 -8
  301. package/dist/components/ui/toggle-group.d.ts.map +1 -1
  302. package/dist/components/ui/toggle-group.js +14 -12
  303. package/dist/components/ui/toggle-group.js.map +1 -1
  304. package/dist/components/ui/toggle-group_module.css.map +1 -1
  305. package/dist/components/ui/toggle.js +2 -2
  306. package/dist/components/ui/toggle.js.map +1 -1
  307. package/dist/components/ui/toggle_module.css.map +1 -1
  308. package/dist/components/ui/toolbar.d.ts +10 -30
  309. package/dist/components/ui/toolbar.d.ts.map +1 -1
  310. package/dist/components/ui/toolbar.js +28 -23
  311. package/dist/components/ui/toolbar.js.map +1 -1
  312. package/dist/components/ui/toolbar_module.css.map +1 -1
  313. package/dist/components/ui/tooltip.js +4 -4
  314. package/dist/components/ui/tooltip.js.map +1 -1
  315. package/dist/components/ui/tooltip_module.css.map +1 -1
  316. package/dist/components/ui/typewriter.js +4 -4
  317. package/dist/components/ui/typewriter.js.map +1 -1
  318. package/dist/components/ui/typewriter_module.css.map +1 -1
  319. package/dist/components/ui/visually-hidden.js +2 -2
  320. package/dist/components/ui/visually-hidden.js.map +1 -1
  321. package/dist/components/ui/visually-hidden_module.css.map +1 -1
  322. package/dist/hooks/useAnnounce.js +5 -5
  323. package/dist/hooks/useAnnounce.js.map +1 -1
  324. package/dist/hooks/useClipboard.d.ts +77 -0
  325. package/dist/hooks/useClipboard.d.ts.map +1 -0
  326. package/dist/hooks/useClipboard.js +42 -0
  327. package/dist/hooks/useClipboard.js.map +1 -0
  328. package/dist/hooks/useControllableState.d.ts +54 -0
  329. package/dist/hooks/useControllableState.d.ts.map +1 -0
  330. package/dist/hooks/useControllableState.js +29 -0
  331. package/dist/hooks/useControllableState.js.map +1 -0
  332. package/dist/hooks/useDebounce.d.ts +33 -0
  333. package/dist/hooks/useDebounce.d.ts.map +1 -0
  334. package/dist/hooks/useDebounce.js +20 -0
  335. package/dist/hooks/useDebounce.js.map +1 -0
  336. package/dist/hooks/useEventCallback.d.ts +34 -0
  337. package/dist/hooks/useEventCallback.d.ts.map +1 -0
  338. package/dist/hooks/useEventCallback.js +12 -0
  339. package/dist/hooks/useEventCallback.js.map +1 -0
  340. package/dist/hooks/useFocusManager.js +6 -6
  341. package/dist/hooks/useFocusManager.js.map +1 -1
  342. package/dist/hooks/useFocusVisible.js +5 -5
  343. package/dist/hooks/useFocusVisible.js.map +1 -1
  344. package/dist/hooks/useId.d.ts +30 -0
  345. package/dist/hooks/useId.d.ts.map +1 -0
  346. package/dist/hooks/useId.js +9 -0
  347. package/dist/hooks/useId.js.map +1 -0
  348. package/dist/hooks/useIntersectionObserver.d.ts +51 -0
  349. package/dist/hooks/useIntersectionObserver.d.ts.map +1 -0
  350. package/dist/hooks/useIntersectionObserver.js +25 -0
  351. package/dist/hooks/useIntersectionObserver.js.map +1 -0
  352. package/dist/hooks/useInterval.d.ts +55 -0
  353. package/dist/hooks/useInterval.d.ts.map +1 -0
  354. package/dist/hooks/useInterval.js +24 -0
  355. package/dist/hooks/useInterval.js.map +1 -0
  356. package/dist/hooks/useLocalStorage.d.ts +43 -0
  357. package/dist/hooks/useLocalStorage.d.ts.map +1 -0
  358. package/dist/hooks/useLocalStorage.js +53 -0
  359. package/dist/hooks/useLocalStorage.js.map +1 -0
  360. package/dist/hooks/useMediaQuery.js +3 -3
  361. package/dist/hooks/useMediaQuery.js.map +1 -1
  362. package/dist/hooks/useMergedRefs.d.ts +27 -0
  363. package/dist/hooks/useMergedRefs.d.ts.map +1 -0
  364. package/dist/hooks/useMergedRefs.js +11 -0
  365. package/dist/hooks/useMergedRefs.js.map +1 -0
  366. package/dist/hooks/useOnClickOutside.d.ts +32 -0
  367. package/dist/hooks/useOnClickOutside.d.ts.map +1 -0
  368. package/dist/hooks/useOnClickOutside.js +23 -0
  369. package/dist/hooks/useOnClickOutside.js.map +1 -0
  370. package/dist/hooks/usePrevious.d.ts +33 -0
  371. package/dist/hooks/usePrevious.d.ts.map +1 -0
  372. package/dist/hooks/usePrevious.js +14 -0
  373. package/dist/hooks/usePrevious.js.map +1 -0
  374. package/dist/hooks/useThrottle.d.ts +37 -0
  375. package/dist/hooks/useThrottle.d.ts.map +1 -0
  376. package/dist/hooks/useThrottle.js +34 -0
  377. package/dist/hooks/useThrottle.js.map +1 -0
  378. package/dist/hooks/useTimeout.d.ts +28 -0
  379. package/dist/hooks/useTimeout.d.ts.map +1 -0
  380. package/dist/hooks/useTimeout.js +24 -0
  381. package/dist/hooks/useTimeout.js.map +1 -0
  382. package/dist/index.css.map +1 -1
  383. package/dist/index.d.ts +17 -3
  384. package/dist/index.d.ts.map +1 -1
  385. package/dist/index.js +15 -1
  386. package/dist/lib/utilities.d.ts +2 -3
  387. package/dist/lib/utilities.d.ts.map +1 -1
  388. package/dist/lib/utilities.js.map +1 -1
  389. package/dist/motion/Collapse.js +2 -2
  390. package/dist/motion/Collapse.js.map +1 -1
  391. package/dist/motion/Collapse_module.css.map +1 -1
  392. package/dist/motion/tokens.js +5 -5
  393. package/dist/motion/tokens.js.map +1 -1
  394. package/package.json +88 -10
  395. package/src/components/ui/alert-dialog.tsx +15 -8
  396. package/src/components/ui/avatar.tsx +9 -6
  397. package/src/components/ui/calendar.tsx +9 -14
  398. package/src/components/ui/carousel.tsx +2 -0
  399. package/src/components/ui/chart.tsx +65 -62
  400. package/src/components/ui/checkbox-group.tsx +4 -5
  401. package/src/components/ui/checkbox.tsx +10 -2
  402. package/src/components/ui/collapsible.tsx +1 -0
  403. package/src/components/ui/combobox.module.css +158 -0
  404. package/src/components/ui/combobox.tsx +569 -0
  405. package/src/components/ui/command.tsx +31 -15
  406. package/src/components/ui/context-menu.tsx +3 -0
  407. package/src/components/ui/drawer.tsx +2 -0
  408. package/src/components/ui/dropdown-menu.tsx +3 -0
  409. package/src/components/ui/dropdrawer.tsx +80 -62
  410. package/src/components/ui/form.tsx +28 -3
  411. package/src/components/ui/input-otp.tsx +3 -3
  412. package/src/components/ui/menubar.tsx +9 -10
  413. package/src/components/ui/meter.tsx +16 -17
  414. package/src/components/ui/navigation-menu.tsx +41 -33
  415. package/src/components/ui/number-field.tsx +6 -13
  416. package/src/components/ui/progress.tsx +3 -2
  417. package/src/components/ui/radio-group.tsx +2 -5
  418. package/src/components/ui/resizable.tsx +15 -18
  419. package/src/components/ui/scratcher.tsx +6 -10
  420. package/src/components/ui/scroll-area.tsx +2 -5
  421. package/src/components/ui/separator.tsx +4 -3
  422. package/src/components/ui/sheet.tsx +3 -0
  423. package/src/components/ui/sidebar.tsx +1 -0
  424. package/src/components/ui/{sonner.module.css → toast.module.css} +1 -1
  425. package/src/components/ui/{sonner.tsx → toast.tsx} +22 -14
  426. package/src/components/ui/toggle-group.tsx +6 -4
  427. package/src/components/ui/toolbar.tsx +20 -21
  428. package/src/hooks/useClipboard.tsx +137 -0
  429. package/src/hooks/useControllableState.tsx +81 -0
  430. package/src/hooks/useDebounce.tsx +50 -0
  431. package/src/hooks/useEventCallback.tsx +47 -0
  432. package/src/hooks/useId.tsx +36 -0
  433. package/src/hooks/useIntersectionObserver.tsx +81 -0
  434. package/src/hooks/useInterval.tsx +80 -0
  435. package/src/hooks/useLocalStorage.tsx +111 -0
  436. package/src/hooks/useMergedRefs.tsx +48 -0
  437. package/src/hooks/useOnClickOutside.tsx +55 -0
  438. package/src/hooks/usePrevious.tsx +44 -0
  439. package/src/hooks/useThrottle.tsx +78 -0
  440. package/src/hooks/useTimeout.tsx +51 -0
  441. package/src/index.ts +27 -4
  442. package/src/lib/utilities.ts +4 -4
  443. package/src/motion/tokens.ts +4 -4
  444. package/src/stories/DesignPrinciples.mdx +48 -0
  445. package/src/stories/GettingStarted.mdx +92 -0
  446. package/src/stories/Welcome.mdx +44 -0
  447. package/dist/components/ui/sonner.d.ts.map +0 -1
  448. package/dist/components/ui/sonner.js.map +0 -1
  449. package/dist/components/ui/sonner.module.js +0 -34
  450. package/dist/components/ui/sonner.module.js.map +0 -1
  451. package/dist/components/ui/sonner_module.css.map +0 -1
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Options for configuring controllable state behavior.
3
+ *
4
+ * @typeParam T - The type of the state value.
5
+ */
6
+ export interface UseControllableStateOptions<T> {
7
+ /**
8
+ * The controlled value from props. When provided, the component operates in controlled mode.
9
+ */
10
+ controlled?: T;
11
+ /**
12
+ * The default value used when the component is uncontrolled.
13
+ */
14
+ defaultValue: T;
15
+ /**
16
+ * Callback fired when the internal state changes in controlled mode.
17
+ *
18
+ * @param value - The new state value.
19
+ */
20
+ onChange?: (value: T) => void;
21
+ }
22
+ /**
23
+ * Manages state that can be either controlled or uncontrolled.
24
+ *
25
+ * @remarks
26
+ * This hook enables components to support both controlled and uncontrolled patterns
27
+ * seamlessly. When a `controlled` value is provided, it takes precedence; otherwise,
28
+ * the hook manages internal state initialized with `defaultValue`.
29
+ *
30
+ * @typeParam T - The type of the state value.
31
+ * @param options - Configuration object for controllable state.
32
+ * @returns A tuple containing the current state value and a setter function.
33
+ *
34
+ * @example
35
+ * ```tsx
36
+ * function CustomInput({value, defaultValue = "", onChange}) {
37
+ * const [internalValue, setValue] = useControllableState({
38
+ * controlled: value,
39
+ * defaultValue,
40
+ * onChange,
41
+ * });
42
+ *
43
+ * return (
44
+ * <input
45
+ * type="text"
46
+ * value={internalValue}
47
+ * onChange={(e) => setValue(e.target.value)}
48
+ * />
49
+ * );
50
+ * }
51
+ * ```
52
+ */
53
+ export declare function useControllableState<T>(options: UseControllableStateOptions<T>): [T, (value: T | ((prev: T) => T)) => void];
54
+ //# sourceMappingURL=useControllableState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useControllableState.d.ts","sourceRoot":"","sources":["../../src/hooks/useControllableState.tsx"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,MAAM,WAAW,2BAA2B,CAAC,CAAC;IAC5C;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,CAAC;IACf;;OAEG;IACH,YAAY,EAAE,CAAC,CAAC;IAChB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,OAAO,EAAE,2BAA2B,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,CAuB3H"}
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ import * as __rspack_external_react from "react";
3
+ function useControllableState(options) {
4
+ const { controlled, defaultValue, onChange } = options;
5
+ const [uncontrolledState, setUncontrolledState] = __rspack_external_react.useState(defaultValue);
6
+ const isControlled = void 0 !== controlled;
7
+ const value = isControlled ? controlled : uncontrolledState;
8
+ const setValue = __rspack_external_react.useCallback((nextValue)=>{
9
+ if (isControlled) {
10
+ const resolvedValue = "function" == typeof nextValue ? nextValue(controlled) : nextValue;
11
+ onChange?.(resolvedValue);
12
+ } else setUncontrolledState((currentValue)=>{
13
+ const resolvedValue = "function" == typeof nextValue ? nextValue(currentValue) : nextValue;
14
+ onChange?.(resolvedValue);
15
+ return resolvedValue;
16
+ });
17
+ }, [
18
+ isControlled,
19
+ onChange,
20
+ controlled
21
+ ]);
22
+ return [
23
+ value,
24
+ setValue
25
+ ];
26
+ }
27
+ export { useControllableState };
28
+
29
+ //# sourceMappingURL=useControllableState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks/useControllableState.js","sources":["../../src/hooks/useControllableState.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\n\r\n/**\r\n * Options for configuring controllable state behavior.\r\n *\r\n * @typeParam T - The type of the state value.\r\n */\r\nexport interface UseControllableStateOptions<T> {\r\n /**\r\n * The controlled value from props. When provided, the component operates in controlled mode.\r\n */\r\n controlled?: T;\r\n /**\r\n * The default value used when the component is uncontrolled.\r\n */\r\n defaultValue: T;\r\n /**\r\n * Callback fired when the internal state changes in controlled mode.\r\n *\r\n * @param value - The new state value.\r\n */\r\n onChange?: (value: T) => void;\r\n}\r\n\r\n/**\r\n * Manages state that can be either controlled or uncontrolled.\r\n *\r\n * @remarks\r\n * This hook enables components to support both controlled and uncontrolled patterns\r\n * seamlessly. When a `controlled` value is provided, it takes precedence; otherwise,\r\n * the hook manages internal state initialized with `defaultValue`.\r\n *\r\n * @typeParam T - The type of the state value.\r\n * @param options - Configuration object for controllable state.\r\n * @returns A tuple containing the current state value and a setter function.\r\n *\r\n * @example\r\n * ```tsx\r\n * function CustomInput({value, defaultValue = \"\", onChange}) {\r\n * const [internalValue, setValue] = useControllableState({\r\n * controlled: value,\r\n * defaultValue,\r\n * onChange,\r\n * });\r\n *\r\n * return (\r\n * <input\r\n * type=\"text\"\r\n * value={internalValue}\r\n * onChange={(e) => setValue(e.target.value)}\r\n * />\r\n * );\r\n * }\r\n * ```\r\n */\r\nexport function useControllableState<T>(options: UseControllableStateOptions<T>): [T, (value: T | ((prev: T) => T)) => void] {\r\n const {controlled, defaultValue, onChange} = options;\r\n const [uncontrolledState, setUncontrolledState] = React.useState<T>(defaultValue);\r\n const isControlled = controlled !== undefined;\r\n const value = isControlled ? controlled : uncontrolledState;\r\n\r\n const setValue = React.useCallback(\r\n (nextValue: T | ((prev: T) => T)) => {\r\n if (!isControlled) {\r\n setUncontrolledState((currentValue) => {\r\n const resolvedValue = typeof nextValue === \"function\" ? (nextValue as (prev: T) => T)(currentValue) : nextValue;\r\n onChange?.(resolvedValue);\r\n return resolvedValue;\r\n });\r\n } else {\r\n const resolvedValue = typeof nextValue === \"function\" ? (nextValue as (prev: T) => T)(controlled as T) : nextValue;\r\n onChange?.(resolvedValue);\r\n }\r\n },\r\n [isControlled, onChange, controlled],\r\n );\r\n\r\n return [value, setValue];\r\n}\r\n"],"names":["useControllableState","options","controlled","defaultValue","onChange","uncontrolledState","setUncontrolledState","React","isControlled","undefined","value","setValue","nextValue","resolvedValue","currentValue"],"mappings":";;AAyDO,SAASA,qBAAwBC,OAAuC;IAC7E,MAAM,EAACC,UAAU,EAAEC,YAAY,EAAEC,QAAQ,EAAC,GAAGH;IAC7C,MAAM,CAACI,mBAAmBC,qBAAqB,GAAGC,wBAAAA,QAAc,CAAIJ;IACpE,MAAMK,eAAeN,AAAeO,WAAfP;IACrB,MAAMQ,QAAQF,eAAeN,aAAaG;IAE1C,MAAMM,WAAWJ,wBAAAA,WAAiB,CAChC,CAACK;QACC,IAAKJ,cAME;YACL,MAAMK,gBAAgB,AAAqB,cAArB,OAAOD,YAA4BA,UAA6BV,cAAmBU;YACzGR,WAAWS;QACb,OAREP,qBAAqB,CAACQ;YACpB,MAAMD,gBAAgB,AAAqB,cAArB,OAAOD,YAA4BA,UAA6BE,gBAAgBF;YACtGR,WAAWS;YACX,OAAOA;QACT;IAKJ,GACA;QAACL;QAAcJ;QAAUF;KAAW;IAGtC,OAAO;QAACQ;QAAOC;KAAS;AAC1B"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Debounces a value, delaying updates until after the specified delay has elapsed.
3
+ *
4
+ * @remarks
5
+ * This hook returns a debounced version of the provided value that only updates
6
+ * after the value has stopped changing for the specified delay. Useful for optimizing
7
+ * performance in scenarios like search inputs, where you want to avoid triggering
8
+ * expensive operations on every keystroke.
9
+ *
10
+ * The debounce timer resets on every value change and cleans up automatically on unmount.
11
+ *
12
+ * @typeParam T - The type of the value being debounced.
13
+ * @param value - The value to debounce.
14
+ * @param delay - The delay in milliseconds before the debounced value updates.
15
+ * @returns The debounced value.
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * function SearchInput() {
20
+ * const [searchTerm, setSearchTerm] = useState("");
21
+ * const debouncedSearchTerm = useDebounce(searchTerm, 500);
22
+ *
23
+ * useEffect(() => {
24
+ * // Expensive search operation
25
+ * performSearch(debouncedSearchTerm);
26
+ * }, [debouncedSearchTerm]);
27
+ *
28
+ * return <input value={searchTerm} onChange={(e) => setSearchTerm(e.target.value)} />;
29
+ * }
30
+ * ```
31
+ */
32
+ export declare function useDebounce<T>(value: T, delay: number): T;
33
+ //# sourceMappingURL=useDebounce.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDebounce.d.ts","sourceRoot":"","sources":["../../src/hooks/useDebounce.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,CAczD"}
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ import * as __rspack_external_react from "react";
3
+ function useDebounce(value, delay) {
4
+ const [debouncedValue, setDebouncedValue] = __rspack_external_react.useState(value);
5
+ __rspack_external_react.useEffect(()=>{
6
+ const timeoutId = globalThis.setTimeout(()=>{
7
+ setDebouncedValue(value);
8
+ }, delay);
9
+ return ()=>{
10
+ globalThis.clearTimeout(timeoutId);
11
+ };
12
+ }, [
13
+ value,
14
+ delay
15
+ ]);
16
+ return debouncedValue;
17
+ }
18
+ export { useDebounce };
19
+
20
+ //# sourceMappingURL=useDebounce.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks/useDebounce.js","sources":["../../src/hooks/useDebounce.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\n\r\n/**\r\n * Debounces a value, delaying updates until after the specified delay has elapsed.\r\n *\r\n * @remarks\r\n * This hook returns a debounced version of the provided value that only updates\r\n * after the value has stopped changing for the specified delay. Useful for optimizing\r\n * performance in scenarios like search inputs, where you want to avoid triggering\r\n * expensive operations on every keystroke.\r\n *\r\n * The debounce timer resets on every value change and cleans up automatically on unmount.\r\n *\r\n * @typeParam T - The type of the value being debounced.\r\n * @param value - The value to debounce.\r\n * @param delay - The delay in milliseconds before the debounced value updates.\r\n * @returns The debounced value.\r\n *\r\n * @example\r\n * ```tsx\r\n * function SearchInput() {\r\n * const [searchTerm, setSearchTerm] = useState(\"\");\r\n * const debouncedSearchTerm = useDebounce(searchTerm, 500);\r\n *\r\n * useEffect(() => {\r\n * // Expensive search operation\r\n * performSearch(debouncedSearchTerm);\r\n * }, [debouncedSearchTerm]);\r\n *\r\n * return <input value={searchTerm} onChange={(e) => setSearchTerm(e.target.value)} />;\r\n * }\r\n * ```\r\n */\r\nexport function useDebounce<T>(value: T, delay: number): T {\r\n const [debouncedValue, setDebouncedValue] = React.useState<T>(value);\r\n\r\n React.useEffect(() => {\r\n const timeoutId = globalThis.setTimeout(() => {\r\n setDebouncedValue(value);\r\n }, delay);\r\n\r\n return () => {\r\n globalThis.clearTimeout(timeoutId);\r\n };\r\n }, [value, delay]);\r\n\r\n return debouncedValue;\r\n}\r\n"],"names":["useDebounce","value","delay","debouncedValue","setDebouncedValue","React","timeoutId","globalThis"],"mappings":";;AAmCO,SAASA,YAAeC,KAAQ,EAAEC,KAAa;IACpD,MAAM,CAACC,gBAAgBC,kBAAkB,GAAGC,wBAAAA,QAAc,CAAIJ;IAE9DI,wBAAAA,SAAe,CAAC;QACd,MAAMC,YAAYC,WAAW,UAAU,CAAC;YACtCH,kBAAkBH;QACpB,GAAGC;QAEH,OAAO;YACLK,WAAW,YAAY,CAACD;QAC1B;IACF,GAAG;QAACL;QAAOC;KAAM;IAEjB,OAAOC;AACT"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Creates a stable callback reference that always calls the latest version of the provided function.
3
+ *
4
+ * @remarks
5
+ * Unlike `useCallback`, this hook returns a stable function reference that never changes,
6
+ * but always invokes the most recent version of the callback. This is useful when you need
7
+ * to pass callbacks to optimized child components or effects without triggering re-renders
8
+ * when dependencies change.
9
+ *
10
+ * The returned function is safe to use in dependency arrays because its identity never changes.
11
+ *
12
+ * @typeParam Args - The tuple type of the callback's arguments.
13
+ * @typeParam Return - The return type of the callback.
14
+ * @param callback - The function to wrap with a stable reference.
15
+ * @returns A stable function reference that invokes the latest callback.
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * function SearchInput({onSearch}) {
20
+ * const [query, setQuery] = useState("");
21
+ * // stableOnSearch never changes identity, but always calls the latest onSearch
22
+ * const stableOnSearch = useEventCallback(onSearch);
23
+ *
24
+ * useEffect(() => {
25
+ * const timer = setTimeout(() => stableOnSearch(query), 500);
26
+ * return () => clearTimeout(timer);
27
+ * }, [query, stableOnSearch]); // Safe to include in deps
28
+ *
29
+ * return <input value={query} onChange={(e) => setQuery(e.target.value)} />;
30
+ * }
31
+ * ```
32
+ */
33
+ export declare function useEventCallback<Args extends unknown[], Return>(callback: (...args: Args) => Return): (...args: Args) => Return;
34
+ //# sourceMappingURL=useEventCallback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useEventCallback.d.ts","sourceRoot":"","sources":["../../src/hooks/useEventCallback.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,MAAM,GAAG,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,MAAM,CAU/H"}
@@ -0,0 +1,12 @@
1
+ "use client";
2
+ import * as __rspack_external_react from "react";
3
+ function useEventCallback(callback) {
4
+ const callbackRef = __rspack_external_react.useRef(callback);
5
+ __rspack_external_react.useLayoutEffect(()=>{
6
+ callbackRef.current = callback;
7
+ });
8
+ return __rspack_external_react.useCallback((...args)=>callbackRef.current(...args), []);
9
+ }
10
+ export { useEventCallback };
11
+
12
+ //# sourceMappingURL=useEventCallback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks/useEventCallback.js","sources":["../../src/hooks/useEventCallback.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\n\r\n/**\r\n * Creates a stable callback reference that always calls the latest version of the provided function.\r\n *\r\n * @remarks\r\n * Unlike `useCallback`, this hook returns a stable function reference that never changes,\r\n * but always invokes the most recent version of the callback. This is useful when you need\r\n * to pass callbacks to optimized child components or effects without triggering re-renders\r\n * when dependencies change.\r\n *\r\n * The returned function is safe to use in dependency arrays because its identity never changes.\r\n *\r\n * @typeParam Args - The tuple type of the callback's arguments.\r\n * @typeParam Return - The return type of the callback.\r\n * @param callback - The function to wrap with a stable reference.\r\n * @returns A stable function reference that invokes the latest callback.\r\n *\r\n * @example\r\n * ```tsx\r\n * function SearchInput({onSearch}) {\r\n * const [query, setQuery] = useState(\"\");\r\n * // stableOnSearch never changes identity, but always calls the latest onSearch\r\n * const stableOnSearch = useEventCallback(onSearch);\r\n *\r\n * useEffect(() => {\r\n * const timer = setTimeout(() => stableOnSearch(query), 500);\r\n * return () => clearTimeout(timer);\r\n * }, [query, stableOnSearch]); // Safe to include in deps\r\n *\r\n * return <input value={query} onChange={(e) => setQuery(e.target.value)} />;\r\n * }\r\n * ```\r\n */\r\nexport function useEventCallback<Args extends unknown[], Return>(callback: (...args: Args) => Return): (...args: Args) => Return {\r\n const callbackRef = React.useRef(callback);\r\n\r\n React.useLayoutEffect(() => {\r\n callbackRef.current = callback;\r\n });\r\n\r\n return React.useCallback((...args: Args) => {\r\n return callbackRef.current(...args);\r\n }, []);\r\n}\r\n"],"names":["useEventCallback","callback","callbackRef","React","args"],"mappings":";;AAoCO,SAASA,iBAAiDC,QAAmC;IAClG,MAAMC,cAAcC,wBAAAA,MAAY,CAACF;IAEjCE,wBAAAA,eAAqB,CAAC;QACpBD,YAAY,OAAO,GAAGD;IACxB;IAEA,OAAOE,wBAAAA,WAAiB,CAAC,CAAC,GAAGC,OACpBF,YAAY,OAAO,IAAIE,OAC7B,EAAE;AACP"}
@@ -1,8 +1,8 @@
1
1
  "use client";
2
- import { useCallback } from "react";
2
+ import * as __rspack_external_react from "react";
3
3
  const FOCUSABLE_SELECTOR = 'a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"]), [contenteditable]';
4
4
  function useFocusManager(containerRef) {
5
- const getFocusable = useCallback(()=>{
5
+ const getFocusable = __rspack_external_react.useCallback(()=>{
6
6
  if (!containerRef.current) return [];
7
7
  return [
8
8
  ...containerRef.current.querySelectorAll(FOCUSABLE_SELECTOR)
@@ -10,18 +10,18 @@ function useFocusManager(containerRef) {
10
10
  }, [
11
11
  containerRef
12
12
  ]);
13
- const focusFirst = useCallback(()=>{
13
+ const focusFirst = __rspack_external_react.useCallback(()=>{
14
14
  getFocusable()[0]?.focus();
15
15
  }, [
16
16
  getFocusable
17
17
  ]);
18
- const focusLast = useCallback(()=>{
18
+ const focusLast = __rspack_external_react.useCallback(()=>{
19
19
  const items = getFocusable();
20
20
  items.at(-1)?.focus();
21
21
  }, [
22
22
  getFocusable
23
23
  ]);
24
- const focusNext = useCallback(()=>{
24
+ const focusNext = __rspack_external_react.useCallback(()=>{
25
25
  const items = getFocusable();
26
26
  const current = document.activeElement;
27
27
  const index = items.indexOf(current);
@@ -30,7 +30,7 @@ function useFocusManager(containerRef) {
30
30
  }, [
31
31
  getFocusable
32
32
  ]);
33
- const focusPrevious = useCallback(()=>{
33
+ const focusPrevious = __rspack_external_react.useCallback(()=>{
34
34
  const items = getFocusable();
35
35
  const current = document.activeElement;
36
36
  const index = items.indexOf(current);
@@ -1 +1 @@
1
- {"version":3,"file":"hooks/useFocusManager.js","sources":["../../src/hooks/useFocusManager.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\n\r\nconst FOCUSABLE_SELECTOR = [\r\n \"a[href]\",\r\n \"button:not(:disabled)\",\r\n \"input:not(:disabled)\",\r\n \"select:not(:disabled)\",\r\n \"textarea:not(:disabled)\",\r\n '[tabindex]:not([tabindex=\"-1\"])',\r\n \"[contenteditable]\",\r\n].join(\", \");\r\n\r\n/**\r\n * Represents the focus movement helpers returned by {@link useFocusManager}.\r\n */\r\ninterface FocusManager {\r\n /**\r\n * Focuses the first focusable element in the container.\r\n */\r\n focusFirst: () => void;\r\n /**\r\n * Focuses the last focusable element in the container.\r\n */\r\n focusLast: () => void;\r\n /**\r\n * Focuses the next focusable element after the currently focused one.\r\n */\r\n focusNext: () => void;\r\n /**\r\n * Focuses the previous focusable element before the currently focused one.\r\n */\r\n focusPrevious: () => void;\r\n}\r\n\r\n/**\r\n * Provides programmatic focus movement helpers for a container element.\r\n *\r\n * @param containerRef - Ref pointing to the container whose focusable descendants should be managed.\r\n * @returns Focus helpers for moving to the first, last, next, or previous focusable descendant.\r\n *\r\n * @example\r\n * ```tsx\r\n * const containerRef = React.useRef<HTMLDivElement>(null);\r\n * const {focusNext, focusPrevious} = useFocusManager(containerRef);\r\n * ```\r\n */\r\nexport function useFocusManager(containerRef: React.RefObject<HTMLElement | null>): FocusManager {\r\n const getFocusable = React.useCallback((): HTMLElement[] => {\r\n if (!containerRef.current) {\r\n return [];\r\n }\r\n\r\n return [...containerRef.current.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)].filter(\r\n (element) => !element.hasAttribute(\"disabled\") && element.tabIndex >= 0,\r\n );\r\n }, [containerRef]);\r\n\r\n const focusFirst = React.useCallback(() => {\r\n getFocusable()[0]?.focus();\r\n }, [getFocusable]);\r\n\r\n const focusLast = React.useCallback(() => {\r\n const items = getFocusable();\r\n\r\n items.at(-1)?.focus();\r\n }, [getFocusable]);\r\n\r\n const focusNext = React.useCallback(() => {\r\n const items = getFocusable();\r\n const current = document.activeElement;\r\n const index = items.indexOf(current as HTMLElement);\r\n const next = items[index + 1] ?? items[0];\r\n\r\n next?.focus();\r\n }, [getFocusable]);\r\n\r\n const focusPrevious = React.useCallback(() => {\r\n const items = getFocusable();\r\n const current = document.activeElement;\r\n const index = items.indexOf(current as HTMLElement);\r\n const previous = items[index - 1] ?? items.at(-1);\r\n\r\n previous?.focus();\r\n }, [getFocusable]);\r\n\r\n return {focusFirst, focusLast, focusNext, focusPrevious};\r\n}\r\n"],"names":["FOCUSABLE_SELECTOR","useFocusManager","containerRef","getFocusable","React","element","focusFirst","focusLast","items","focusNext","current","document","index","next","focusPrevious","previous"],"mappings":";;AAIA,MAAMA,qBAAqB;AA4CpB,SAASC,gBAAgBC,YAAiD;IAC/E,MAAMC,eAAeC,YAAkB;QACrC,IAAI,CAACF,aAAa,OAAO,EACvB,OAAO,EAAE;QAGX,OAAO;eAAIA,aAAa,OAAO,CAAC,gBAAgB,CAAcF;SAAoB,CAAC,MAAM,CACvF,CAACK,UAAY,CAACA,QAAQ,YAAY,CAAC,eAAeA,QAAQ,QAAQ,IAAI;IAE1E,GAAG;QAACH;KAAa;IAEjB,MAAMI,aAAaF,YAAkB;QACnCD,cAAc,CAAC,EAAE,EAAE;IACrB,GAAG;QAACA;KAAa;IAEjB,MAAMI,YAAYH,YAAkB;QAClC,MAAMI,QAAQL;QAEdK,MAAM,EAAE,CAAC,KAAK;IAChB,GAAG;QAACL;KAAa;IAEjB,MAAMM,YAAYL,YAAkB;QAClC,MAAMI,QAAQL;QACd,MAAMO,UAAUC,SAAS,aAAa;QACtC,MAAMC,QAAQJ,MAAM,OAAO,CAACE;QAC5B,MAAMG,OAAOL,KAAK,CAACI,QAAQ,EAAE,IAAIJ,KAAK,CAAC,EAAE;QAEzCK,MAAM;IACR,GAAG;QAACV;KAAa;IAEjB,MAAMW,gBAAgBV,YAAkB;QACtC,MAAMI,QAAQL;QACd,MAAMO,UAAUC,SAAS,aAAa;QACtC,MAAMC,QAAQJ,MAAM,OAAO,CAACE;QAC5B,MAAMK,WAAWP,KAAK,CAACI,QAAQ,EAAE,IAAIJ,MAAM,EAAE,CAAC;QAE9CO,UAAU;IACZ,GAAG;QAACZ;KAAa;IAEjB,OAAO;QAACG;QAAYC;QAAWE;QAAWK;IAAa;AACzD"}
1
+ {"version":3,"file":"hooks/useFocusManager.js","sources":["../../src/hooks/useFocusManager.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\n\r\nconst FOCUSABLE_SELECTOR = [\r\n \"a[href]\",\r\n \"button:not(:disabled)\",\r\n \"input:not(:disabled)\",\r\n \"select:not(:disabled)\",\r\n \"textarea:not(:disabled)\",\r\n '[tabindex]:not([tabindex=\"-1\"])',\r\n \"[contenteditable]\",\r\n].join(\", \");\r\n\r\n/**\r\n * Represents the focus movement helpers returned by {@link useFocusManager}.\r\n */\r\ninterface FocusManager {\r\n /**\r\n * Focuses the first focusable element in the container.\r\n */\r\n focusFirst: () => void;\r\n /**\r\n * Focuses the last focusable element in the container.\r\n */\r\n focusLast: () => void;\r\n /**\r\n * Focuses the next focusable element after the currently focused one.\r\n */\r\n focusNext: () => void;\r\n /**\r\n * Focuses the previous focusable element before the currently focused one.\r\n */\r\n focusPrevious: () => void;\r\n}\r\n\r\n/**\r\n * Provides programmatic focus movement helpers for a container element.\r\n *\r\n * @param containerRef - Ref pointing to the container whose focusable descendants should be managed.\r\n * @returns Focus helpers for moving to the first, last, next, or previous focusable descendant.\r\n *\r\n * @example\r\n * ```tsx\r\n * const containerRef = React.useRef<HTMLDivElement>(null);\r\n * const {focusNext, focusPrevious} = useFocusManager(containerRef);\r\n * ```\r\n */\r\nexport function useFocusManager(containerRef: React.RefObject<HTMLElement | null>): FocusManager {\r\n const getFocusable = React.useCallback((): HTMLElement[] => {\r\n if (!containerRef.current) {\r\n return [];\r\n }\r\n\r\n return [...containerRef.current.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)].filter(\r\n (element) => !element.hasAttribute(\"disabled\") && element.tabIndex >= 0,\r\n );\r\n }, [containerRef]);\r\n\r\n const focusFirst = React.useCallback(() => {\r\n getFocusable()[0]?.focus();\r\n }, [getFocusable]);\r\n\r\n const focusLast = React.useCallback(() => {\r\n const items = getFocusable();\r\n\r\n items.at(-1)?.focus();\r\n }, [getFocusable]);\r\n\r\n const focusNext = React.useCallback(() => {\r\n const items = getFocusable();\r\n const current = document.activeElement;\r\n const index = items.indexOf(current as HTMLElement);\r\n const next = items[index + 1] ?? items[0];\r\n\r\n next?.focus();\r\n }, [getFocusable]);\r\n\r\n const focusPrevious = React.useCallback(() => {\r\n const items = getFocusable();\r\n const current = document.activeElement;\r\n const index = items.indexOf(current as HTMLElement);\r\n const previous = items[index - 1] ?? items.at(-1);\r\n\r\n previous?.focus();\r\n }, [getFocusable]);\r\n\r\n return {focusFirst, focusLast, focusNext, focusPrevious};\r\n}\r\n"],"names":["FOCUSABLE_SELECTOR","useFocusManager","containerRef","getFocusable","React","element","focusFirst","focusLast","items","focusNext","current","document","index","next","focusPrevious","previous"],"mappings":";;AAIA,MAAMA,qBAAqB;AA4CpB,SAASC,gBAAgBC,YAAiD;IAC/E,MAAMC,eAAeC,wBAAAA,WAAiB,CAAC;QACrC,IAAI,CAACF,aAAa,OAAO,EACvB,OAAO,EAAE;QAGX,OAAO;eAAIA,aAAa,OAAO,CAAC,gBAAgB,CAAcF;SAAoB,CAAC,MAAM,CACvF,CAACK,UAAY,CAACA,QAAQ,YAAY,CAAC,eAAeA,QAAQ,QAAQ,IAAI;IAE1E,GAAG;QAACH;KAAa;IAEjB,MAAMI,aAAaF,wBAAAA,WAAiB,CAAC;QACnCD,cAAc,CAAC,EAAE,EAAE;IACrB,GAAG;QAACA;KAAa;IAEjB,MAAMI,YAAYH,wBAAAA,WAAiB,CAAC;QAClC,MAAMI,QAAQL;QAEdK,MAAM,EAAE,CAAC,KAAK;IAChB,GAAG;QAACL;KAAa;IAEjB,MAAMM,YAAYL,wBAAAA,WAAiB,CAAC;QAClC,MAAMI,QAAQL;QACd,MAAMO,UAAUC,SAAS,aAAa;QACtC,MAAMC,QAAQJ,MAAM,OAAO,CAACE;QAC5B,MAAMG,OAAOL,KAAK,CAACI,QAAQ,EAAE,IAAIJ,KAAK,CAAC,EAAE;QAEzCK,MAAM;IACR,GAAG;QAACV;KAAa;IAEjB,MAAMW,gBAAgBV,wBAAAA,WAAiB,CAAC;QACtC,MAAMI,QAAQL;QACd,MAAMO,UAAUC,SAAS,aAAa;QACtC,MAAMC,QAAQJ,MAAM,OAAO,CAACE;QAC5B,MAAMK,WAAWP,KAAK,CAACI,QAAQ,EAAE,IAAIJ,MAAM,EAAE,CAAC;QAE9CO,UAAU;IACZ,GAAG;QAACZ;KAAa;IAEjB,OAAO;QAACG;QAAYC;QAAWE;QAAWK;IAAa;AACzD"}
@@ -1,9 +1,9 @@
1
1
  "use client";
2
- import { useEffect, useMemo, useRef, useState } from "react";
2
+ import * as __rspack_external_react from "react";
3
3
  function useFocusVisible() {
4
- const [isFocusVisible, setIsFocusVisible] = useState(false);
5
- const isKeyboardRef = useRef(false);
6
- useEffect(()=>{
4
+ const [isFocusVisible, setIsFocusVisible] = __rspack_external_react.useState(false);
5
+ const isKeyboardRef = __rspack_external_react.useRef(false);
6
+ __rspack_external_react.useEffect(()=>{
7
7
  const onKeyDown = ()=>{
8
8
  isKeyboardRef.current = true;
9
9
  };
@@ -17,7 +17,7 @@ function useFocusVisible() {
17
17
  globalThis.document.removeEventListener("pointerdown", onPointerDown, true);
18
18
  };
19
19
  }, []);
20
- const focusProps = useMemo(()=>({
20
+ const focusProps = __rspack_external_react.useMemo(()=>({
21
21
  onFocus: (_event)=>{
22
22
  if (isKeyboardRef.current) setIsFocusVisible(true);
23
23
  },
@@ -1 +1 @@
1
- {"version":3,"file":"hooks/useFocusVisible.js","sources":["../../src/hooks/useFocusVisible.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\n\r\n/**\r\n * Represents the focus handlers returned by {@link useFocusVisible}.\r\n *\r\n * @remarks\r\n * Spread these handlers onto the interactive element that should respond to keyboard\r\n * focus visibility. They coordinate transient focus styling without owning rendering.\r\n */\r\ninterface FocusVisibleProps {\r\n /**\r\n * Called when the target receives focus.\r\n */\r\n onFocus: (event: React.FocusEvent) => void;\r\n /**\r\n * Called when the target loses focus.\r\n */\r\n onBlur: () => void;\r\n}\r\n\r\n/**\r\n * Detects whether the current focus originated from keyboard navigation.\r\n *\r\n * @remarks\r\n * Tracks global keyboard and pointer input so consumers can render focus rings only when\r\n * users are tabbing through the interface. This mirrors the intent of `:focus-visible`\r\n * while remaining available to JavaScript-driven components and custom states.\r\n *\r\n * @returns An object containing the current focus-visible state and focus handlers to spread on the target element.\r\n *\r\n * @example\r\n * ```tsx\r\n * const {isFocusVisible, focusProps} = useFocusVisible();\r\n *\r\n * return (\r\n * <button\r\n * type=\"button\"\r\n * {...focusProps}\r\n * className={isFocusVisible ? \"ring\" : undefined}>\r\n * Click\r\n * </button>\r\n * );\r\n * ```\r\n *\r\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible | MDN :focus-visible}\r\n */\r\nexport function useFocusVisible(): {\r\n isFocusVisible: boolean;\r\n focusProps: FocusVisibleProps;\r\n} {\r\n const [isFocusVisible, setIsFocusVisible] = React.useState(false);\r\n const isKeyboardRef = React.useRef(false);\r\n\r\n React.useEffect(() => {\r\n const onKeyDown = () => {\r\n isKeyboardRef.current = true;\r\n };\r\n const onPointerDown = () => {\r\n isKeyboardRef.current = false;\r\n };\r\n\r\n globalThis.document.addEventListener(\"keydown\", onKeyDown, true);\r\n globalThis.document.addEventListener(\"pointerdown\", onPointerDown, true);\r\n\r\n return () => {\r\n globalThis.document.removeEventListener(\"keydown\", onKeyDown, true);\r\n globalThis.document.removeEventListener(\"pointerdown\", onPointerDown, true);\r\n };\r\n }, []);\r\n\r\n const focusProps = React.useMemo<FocusVisibleProps>(\r\n () => ({\r\n onFocus: (_event: React.FocusEvent) => {\r\n if (isKeyboardRef.current) {\r\n setIsFocusVisible(true);\r\n }\r\n },\r\n onBlur: () => {\r\n setIsFocusVisible(false);\r\n },\r\n }),\r\n [],\r\n );\r\n\r\n return {isFocusVisible, focusProps};\r\n}\r\n"],"names":["useFocusVisible","isFocusVisible","setIsFocusVisible","React","isKeyboardRef","onKeyDown","onPointerDown","globalThis","focusProps","_event"],"mappings":";;AAgDO,SAASA;IAId,MAAM,CAACC,gBAAgBC,kBAAkB,GAAGC,SAAe;IAC3D,MAAMC,gBAAgBD,OAAa;IAEnCA,UAAgB;QACd,MAAME,YAAY;YAChBD,cAAc,OAAO,GAAG;QAC1B;QACA,MAAME,gBAAgB;YACpBF,cAAc,OAAO,GAAG;QAC1B;QAEAG,WAAW,QAAQ,CAAC,gBAAgB,CAAC,WAAWF,WAAW;QAC3DE,WAAW,QAAQ,CAAC,gBAAgB,CAAC,eAAeD,eAAe;QAEnE,OAAO;YACLC,WAAW,QAAQ,CAAC,mBAAmB,CAAC,WAAWF,WAAW;YAC9DE,WAAW,QAAQ,CAAC,mBAAmB,CAAC,eAAeD,eAAe;QACxE;IACF,GAAG,EAAE;IAEL,MAAME,aAAaL,QACjB,IAAO;YACL,SAAS,CAACM;gBACR,IAAIL,cAAc,OAAO,EACvBF,kBAAkB;YAEtB;YACA,QAAQ;gBACNA,kBAAkB;YACpB;QACF,IACA,EAAE;IAGJ,OAAO;QAACD;QAAgBO;IAAU;AACpC"}
1
+ {"version":3,"file":"hooks/useFocusVisible.js","sources":["../../src/hooks/useFocusVisible.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\n\r\n/**\r\n * Represents the focus handlers returned by {@link useFocusVisible}.\r\n *\r\n * @remarks\r\n * Spread these handlers onto the interactive element that should respond to keyboard\r\n * focus visibility. They coordinate transient focus styling without owning rendering.\r\n */\r\ninterface FocusVisibleProps {\r\n /**\r\n * Called when the target receives focus.\r\n */\r\n onFocus: (event: React.FocusEvent) => void;\r\n /**\r\n * Called when the target loses focus.\r\n */\r\n onBlur: () => void;\r\n}\r\n\r\n/**\r\n * Detects whether the current focus originated from keyboard navigation.\r\n *\r\n * @remarks\r\n * Tracks global keyboard and pointer input so consumers can render focus rings only when\r\n * users are tabbing through the interface. This mirrors the intent of `:focus-visible`\r\n * while remaining available to JavaScript-driven components and custom states.\r\n *\r\n * @returns An object containing the current focus-visible state and focus handlers to spread on the target element.\r\n *\r\n * @example\r\n * ```tsx\r\n * const {isFocusVisible, focusProps} = useFocusVisible();\r\n *\r\n * return (\r\n * <button\r\n * type=\"button\"\r\n * {...focusProps}\r\n * className={isFocusVisible ? \"ring\" : undefined}>\r\n * Click\r\n * </button>\r\n * );\r\n * ```\r\n *\r\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible | MDN :focus-visible}\r\n */\r\nexport function useFocusVisible(): {\r\n isFocusVisible: boolean;\r\n focusProps: FocusVisibleProps;\r\n} {\r\n const [isFocusVisible, setIsFocusVisible] = React.useState(false);\r\n const isKeyboardRef = React.useRef(false);\r\n\r\n React.useEffect(() => {\r\n const onKeyDown = () => {\r\n isKeyboardRef.current = true;\r\n };\r\n const onPointerDown = () => {\r\n isKeyboardRef.current = false;\r\n };\r\n\r\n globalThis.document.addEventListener(\"keydown\", onKeyDown, true);\r\n globalThis.document.addEventListener(\"pointerdown\", onPointerDown, true);\r\n\r\n return () => {\r\n globalThis.document.removeEventListener(\"keydown\", onKeyDown, true);\r\n globalThis.document.removeEventListener(\"pointerdown\", onPointerDown, true);\r\n };\r\n }, []);\r\n\r\n const focusProps = React.useMemo<FocusVisibleProps>(\r\n () => ({\r\n onFocus: (_event: React.FocusEvent) => {\r\n if (isKeyboardRef.current) {\r\n setIsFocusVisible(true);\r\n }\r\n },\r\n onBlur: () => {\r\n setIsFocusVisible(false);\r\n },\r\n }),\r\n [],\r\n );\r\n\r\n return {isFocusVisible, focusProps};\r\n}\r\n"],"names":["useFocusVisible","isFocusVisible","setIsFocusVisible","React","isKeyboardRef","onKeyDown","onPointerDown","globalThis","focusProps","_event"],"mappings":";;AAgDO,SAASA;IAId,MAAM,CAACC,gBAAgBC,kBAAkB,GAAGC,wBAAAA,QAAc,CAAC;IAC3D,MAAMC,gBAAgBD,wBAAAA,MAAY,CAAC;IAEnCA,wBAAAA,SAAe,CAAC;QACd,MAAME,YAAY;YAChBD,cAAc,OAAO,GAAG;QAC1B;QACA,MAAME,gBAAgB;YACpBF,cAAc,OAAO,GAAG;QAC1B;QAEAG,WAAW,QAAQ,CAAC,gBAAgB,CAAC,WAAWF,WAAW;QAC3DE,WAAW,QAAQ,CAAC,gBAAgB,CAAC,eAAeD,eAAe;QAEnE,OAAO;YACLC,WAAW,QAAQ,CAAC,mBAAmB,CAAC,WAAWF,WAAW;YAC9DE,WAAW,QAAQ,CAAC,mBAAmB,CAAC,eAAeD,eAAe;QACxE;IACF,GAAG,EAAE;IAEL,MAAME,aAAaL,wBAAAA,OAAa,CAC9B,IAAO;YACL,SAAS,CAACM;gBACR,IAAIL,cAAc,OAAO,EACvBF,kBAAkB;YAEtB;YACA,QAAQ;gBACNA,kBAAkB;YACpB;QACF,IACA,EAAE;IAGJ,OAAO;QAACD;QAAgBO;IAAU;AACpC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Generates a unique, stable identifier that is safe for server-side rendering.
3
+ *
4
+ * @remarks
5
+ * This hook wraps React's `useId` and optionally prepends a custom prefix.
6
+ * The generated ID remains stable across re-renders and matches between server
7
+ * and client, making it ideal for associating form labels with inputs or
8
+ * managing accessible ARIA relationships.
9
+ *
10
+ * @param prefix - Optional string to prepend to the generated ID.
11
+ * @returns A unique identifier string.
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * function FormField({label}) {
16
+ * const id = useId("field");
17
+ *
18
+ * return (
19
+ * <div>
20
+ * <label htmlFor={id}>{label}</label>
21
+ * <input id={id} type="text" />
22
+ * </div>
23
+ * );
24
+ * }
25
+ * ```
26
+ *
27
+ * @see {@link https://react.dev/reference/react/useId | React useId}
28
+ */
29
+ export declare function useId(prefix?: string): string;
30
+ //# sourceMappingURL=useId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useId.d.ts","sourceRoot":"","sources":["../../src/hooks/useId.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAG7C"}
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import * as __rspack_external_react from "react";
3
+ function useId(prefix) {
4
+ const reactId = __rspack_external_react.useId();
5
+ return prefix ? `${prefix}-${reactId}` : reactId;
6
+ }
7
+ export { useId };
8
+
9
+ //# sourceMappingURL=useId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks/useId.js","sources":["../../src/hooks/useId.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\n\r\n/**\r\n * Generates a unique, stable identifier that is safe for server-side rendering.\r\n *\r\n * @remarks\r\n * This hook wraps React's `useId` and optionally prepends a custom prefix.\r\n * The generated ID remains stable across re-renders and matches between server\r\n * and client, making it ideal for associating form labels with inputs or\r\n * managing accessible ARIA relationships.\r\n *\r\n * @param prefix - Optional string to prepend to the generated ID.\r\n * @returns A unique identifier string.\r\n *\r\n * @example\r\n * ```tsx\r\n * function FormField({label}) {\r\n * const id = useId(\"field\");\r\n *\r\n * return (\r\n * <div>\r\n * <label htmlFor={id}>{label}</label>\r\n * <input id={id} type=\"text\" />\r\n * </div>\r\n * );\r\n * }\r\n * ```\r\n *\r\n * @see {@link https://react.dev/reference/react/useId | React useId}\r\n */\r\nexport function useId(prefix?: string): string {\r\n const reactId = React.useId();\r\n return prefix ? `${prefix}-${reactId}` : reactId;\r\n}\r\n"],"names":["useId","prefix","reactId","React"],"mappings":";;AAgCO,SAASA,MAAMC,MAAe;IACnC,MAAMC,UAAUC,wBAAAA,KAAW;IAC3B,OAAOF,SAAS,GAAGA,OAAO,CAAC,EAAEC,SAAS,GAAGA;AAC3C"}
@@ -0,0 +1,51 @@
1
+ import * as React from "react";
2
+ /**
3
+ * Observes element visibility using the Intersection Observer API.
4
+ *
5
+ * @remarks
6
+ * This hook creates an IntersectionObserver that watches the provided element
7
+ * reference and returns the latest `IntersectionObserverEntry`. It's useful
8
+ * for implementing lazy loading, infinite scroll, animations on scroll, and
9
+ * tracking element visibility.
10
+ *
11
+ * The observer automatically disconnects when the component unmounts or when
12
+ * the element reference changes. The hook is SSR-safe and returns `null` when
13
+ * running on the server or when the observer is not yet initialized.
14
+ *
15
+ * @param ref - A React ref object pointing to the element to observe.
16
+ * @param options - Optional IntersectionObserver configuration (threshold, root, rootMargin).
17
+ * @returns The latest IntersectionObserverEntry or null if not intersecting yet.
18
+ *
19
+ * @example
20
+ * ```tsx
21
+ * function LazyImage({src, alt}: {src: string; alt: string}) {
22
+ * const imageRef = useRef<HTMLImageElement>(null);
23
+ * const entry = useIntersectionObserver(imageRef, {threshold: 0.1});
24
+ *
25
+ * return (
26
+ * <img
27
+ * ref={imageRef}
28
+ * src={entry?.isIntersecting ? src : undefined}
29
+ * alt={alt}
30
+ * />
31
+ * );
32
+ * }
33
+ * ```
34
+ *
35
+ * @example
36
+ * ```tsx
37
+ * function AnimateOnScroll({children}: {children: React.ReactNode}) {
38
+ * const ref = useRef<HTMLDivElement>(null);
39
+ * const entry = useIntersectionObserver(ref, {threshold: 0.5});
40
+ * const isVisible = entry?.isIntersecting ?? false;
41
+ *
42
+ * return (
43
+ * <div ref={ref} className={isVisible ? "fade-in" : "hidden"}>
44
+ * {children}
45
+ * </div>
46
+ * );
47
+ * }
48
+ * ```
49
+ */
50
+ export declare function useIntersectionObserver(ref: React.RefObject<Element | null>, options?: IntersectionObserverInit): IntersectionObserverEntry | null;
51
+ //# sourceMappingURL=useIntersectionObserver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIntersectionObserver.d.ts","sourceRoot":"","sources":["../../src/hooks/useIntersectionObserver.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC,EACpC,OAAO,CAAC,EAAE,wBAAwB,GACjC,yBAAyB,GAAG,IAAI,CAyBlC"}
@@ -0,0 +1,25 @@
1
+ "use client";
2
+ import * as __rspack_external_react from "react";
3
+ function useIntersectionObserver(ref, options) {
4
+ const [entry, setEntry] = __rspack_external_react.useState(null);
5
+ __rspack_external_react.useEffect(()=>{
6
+ const element = ref.current;
7
+ if (void 0 === globalThis.IntersectionObserver || !element) return;
8
+ const observer = new globalThis.IntersectionObserver(([observerEntry])=>{
9
+ if (observerEntry) setEntry(observerEntry);
10
+ }, options);
11
+ observer.observe(element);
12
+ return ()=>{
13
+ observer.disconnect();
14
+ };
15
+ }, [
16
+ ref,
17
+ options?.threshold,
18
+ options?.root,
19
+ options?.rootMargin
20
+ ]);
21
+ return entry;
22
+ }
23
+ export { useIntersectionObserver };
24
+
25
+ //# sourceMappingURL=useIntersectionObserver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks/useIntersectionObserver.js","sources":["../../src/hooks/useIntersectionObserver.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\n\r\n/**\r\n * Observes element visibility using the Intersection Observer API.\r\n *\r\n * @remarks\r\n * This hook creates an IntersectionObserver that watches the provided element\r\n * reference and returns the latest `IntersectionObserverEntry`. It's useful\r\n * for implementing lazy loading, infinite scroll, animations on scroll, and\r\n * tracking element visibility.\r\n *\r\n * The observer automatically disconnects when the component unmounts or when\r\n * the element reference changes. The hook is SSR-safe and returns `null` when\r\n * running on the server or when the observer is not yet initialized.\r\n *\r\n * @param ref - A React ref object pointing to the element to observe.\r\n * @param options - Optional IntersectionObserver configuration (threshold, root, rootMargin).\r\n * @returns The latest IntersectionObserverEntry or null if not intersecting yet.\r\n *\r\n * @example\r\n * ```tsx\r\n * function LazyImage({src, alt}: {src: string; alt: string}) {\r\n * const imageRef = useRef<HTMLImageElement>(null);\r\n * const entry = useIntersectionObserver(imageRef, {threshold: 0.1});\r\n *\r\n * return (\r\n * <img\r\n * ref={imageRef}\r\n * src={entry?.isIntersecting ? src : undefined}\r\n * alt={alt}\r\n * />\r\n * );\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```tsx\r\n * function AnimateOnScroll({children}: {children: React.ReactNode}) {\r\n * const ref = useRef<HTMLDivElement>(null);\r\n * const entry = useIntersectionObserver(ref, {threshold: 0.5});\r\n * const isVisible = entry?.isIntersecting ?? false;\r\n *\r\n * return (\r\n * <div ref={ref} className={isVisible ? \"fade-in\" : \"hidden\"}>\r\n * {children}\r\n * </div>\r\n * );\r\n * }\r\n * ```\r\n */\r\nexport function useIntersectionObserver(\r\n ref: React.RefObject<Element | null>,\r\n options?: IntersectionObserverInit,\r\n): IntersectionObserverEntry | null {\r\n const [entry, setEntry] = React.useState<IntersectionObserverEntry | null>(null);\r\n\r\n React.useEffect(() => {\r\n const element = ref.current;\r\n\r\n // SSR safety: IntersectionObserver is not available on server\r\n if (typeof globalThis.IntersectionObserver === \"undefined\" || !element) {\r\n return;\r\n }\r\n\r\n const observer = new globalThis.IntersectionObserver(([observerEntry]) => {\r\n if (observerEntry) {\r\n setEntry(observerEntry);\r\n }\r\n }, options);\r\n\r\n observer.observe(element);\r\n\r\n return () => {\r\n observer.disconnect();\r\n };\r\n }, [ref, options?.threshold, options?.root, options?.rootMargin]);\r\n\r\n return entry;\r\n}\r\n"],"names":["useIntersectionObserver","ref","options","entry","setEntry","React","element","globalThis","observer","observerEntry"],"mappings":";;AAoDO,SAASA,wBACdC,GAAoC,EACpCC,OAAkC;IAElC,MAAM,CAACC,OAAOC,SAAS,GAAGC,wBAAAA,QAAc,CAAmC;IAE3EA,wBAAAA,SAAe,CAAC;QACd,MAAMC,UAAUL,IAAI,OAAO;QAG3B,IAAI,AAA2C,WAApCM,WAAW,oBAAoB,IAAoB,CAACD,SAC7D;QAGF,MAAME,WAAW,IAAID,WAAW,oBAAoB,CAAC,CAAC,CAACE,cAAc;YACnE,IAAIA,eACFL,SAASK;QAEb,GAAGP;QAEHM,SAAS,OAAO,CAACF;QAEjB,OAAO;YACLE,SAAS,UAAU;QACrB;IACF,GAAG;QAACP;QAAKC,SAAS;QAAWA,SAAS;QAAMA,SAAS;KAAW;IAEhE,OAAOC;AACT"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Executes a callback function at specified intervals with automatic cleanup.
3
+ *
4
+ * @remarks
5
+ * This hook provides a declarative interface for `setInterval` that automatically
6
+ * handles cleanup on unmount and ensures the latest callback is always invoked
7
+ * (preventing stale closures). Setting the delay to `null` pauses the interval,
8
+ * which is useful for implementing play/pause functionality.
9
+ *
10
+ * Unlike raw `setInterval`, this hook guarantees that the interval is cleared
11
+ * when the component unmounts or when the delay changes, preventing memory leaks
12
+ * and unexpected behavior.
13
+ *
14
+ * @param callback - The function to execute at each interval.
15
+ * @param delay - The interval delay in milliseconds, or `null` to pause the interval.
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * function Timer() {
20
+ * const [count, setCount] = useState(0);
21
+ *
22
+ * useInterval(() => {
23
+ * setCount((c) => c + 1);
24
+ * }, 1000);
25
+ *
26
+ * return <div>Count: {count}</div>;
27
+ * }
28
+ * ```
29
+ *
30
+ * @example
31
+ * ```tsx
32
+ * function PausableTimer() {
33
+ * const [count, setCount] = useState(0);
34
+ * const [isRunning, setIsRunning] = useState(true);
35
+ *
36
+ * useInterval(
37
+ * () => {
38
+ * setCount((c) => c + 1);
39
+ * },
40
+ * isRunning ? 1000 : null,
41
+ * );
42
+ *
43
+ * return (
44
+ * <div>
45
+ * <div>Count: {count}</div>
46
+ * <button onClick={() => setIsRunning(!isRunning)}>
47
+ * {isRunning ? "Pause" : "Resume"}
48
+ * </button>
49
+ * </div>
50
+ * );
51
+ * }
52
+ * ```
53
+ */
54
+ export declare function useInterval(callback: () => void, delay: number | null): void;
55
+ //# sourceMappingURL=useInterval.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useInterval.d.ts","sourceRoot":"","sources":["../../src/hooks/useInterval.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAsB5E"}
@@ -0,0 +1,24 @@
1
+ "use client";
2
+ import * as __rspack_external_react from "react";
3
+ function useInterval(callback, delay) {
4
+ const savedCallback = __rspack_external_react.useRef(callback);
5
+ __rspack_external_react.useEffect(()=>{
6
+ savedCallback.current = callback;
7
+ }, [
8
+ callback
9
+ ]);
10
+ __rspack_external_react.useEffect(()=>{
11
+ if (null === delay) return;
12
+ const intervalId = globalThis.setInterval(()=>{
13
+ savedCallback.current();
14
+ }, delay);
15
+ return ()=>{
16
+ globalThis.clearInterval(intervalId);
17
+ };
18
+ }, [
19
+ delay
20
+ ]);
21
+ }
22
+ export { useInterval };
23
+
24
+ //# sourceMappingURL=useInterval.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks/useInterval.js","sources":["../../src/hooks/useInterval.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\n\r\n/**\r\n * Executes a callback function at specified intervals with automatic cleanup.\r\n *\r\n * @remarks\r\n * This hook provides a declarative interface for `setInterval` that automatically\r\n * handles cleanup on unmount and ensures the latest callback is always invoked\r\n * (preventing stale closures). Setting the delay to `null` pauses the interval,\r\n * which is useful for implementing play/pause functionality.\r\n *\r\n * Unlike raw `setInterval`, this hook guarantees that the interval is cleared\r\n * when the component unmounts or when the delay changes, preventing memory leaks\r\n * and unexpected behavior.\r\n *\r\n * @param callback - The function to execute at each interval.\r\n * @param delay - The interval delay in milliseconds, or `null` to pause the interval.\r\n *\r\n * @example\r\n * ```tsx\r\n * function Timer() {\r\n * const [count, setCount] = useState(0);\r\n *\r\n * useInterval(() => {\r\n * setCount((c) => c + 1);\r\n * }, 1000);\r\n *\r\n * return <div>Count: {count}</div>;\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```tsx\r\n * function PausableTimer() {\r\n * const [count, setCount] = useState(0);\r\n * const [isRunning, setIsRunning] = useState(true);\r\n *\r\n * useInterval(\r\n * () => {\r\n * setCount((c) => c + 1);\r\n * },\r\n * isRunning ? 1000 : null,\r\n * );\r\n *\r\n * return (\r\n * <div>\r\n * <div>Count: {count}</div>\r\n * <button onClick={() => setIsRunning(!isRunning)}>\r\n * {isRunning ? \"Pause\" : \"Resume\"}\r\n * </button>\r\n * </div>\r\n * );\r\n * }\r\n * ```\r\n */\r\nexport function useInterval(callback: () => void, delay: number | null): void {\r\n const savedCallback = React.useRef(callback);\r\n\r\n // Update ref to latest callback on every render to avoid stale closures\r\n React.useEffect(() => {\r\n savedCallback.current = callback;\r\n }, [callback]);\r\n\r\n React.useEffect(() => {\r\n // Don't schedule if delay is null\r\n if (delay === null) {\r\n return;\r\n }\r\n\r\n const intervalId = globalThis.setInterval(() => {\r\n savedCallback.current();\r\n }, delay);\r\n\r\n return () => {\r\n globalThis.clearInterval(intervalId);\r\n };\r\n }, [delay]);\r\n}\r\n"],"names":["useInterval","callback","delay","savedCallback","React","intervalId","globalThis"],"mappings":";;AAyDO,SAASA,YAAYC,QAAoB,EAAEC,KAAoB;IACpE,MAAMC,gBAAgBC,wBAAAA,MAAY,CAACH;IAGnCG,wBAAAA,SAAe,CAAC;QACdD,cAAc,OAAO,GAAGF;IAC1B,GAAG;QAACA;KAAS;IAEbG,wBAAAA,SAAe,CAAC;QAEd,IAAIF,AAAU,SAAVA,OACF;QAGF,MAAMG,aAAaC,WAAW,WAAW,CAAC;YACxCH,cAAc,OAAO;QACvB,GAAGD;QAEH,OAAO;YACLI,WAAW,aAAa,CAACD;QAC3B;IACF,GAAG;QAACH;KAAM;AACZ"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Persists state to localStorage with SSR safety and JSON serialization.
3
+ *
4
+ * @remarks
5
+ * This hook synchronizes state with localStorage, allowing data to persist
6
+ * across page refreshes and browser sessions. It is SSR-safe and returns the
7
+ * initial value on the server until hydration completes. The hook also syncs
8
+ * state across tabs/windows via the `storage` event and handles JSON parse
9
+ * errors gracefully by falling back to the initial value.
10
+ *
11
+ * @typeParam T - The type of the value being stored.
12
+ * @param key - The localStorage key to store the value under.
13
+ * @param initialValue - The default value to use if no value is found in localStorage.
14
+ * @returns A tuple containing the current value and a setter function.
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * function UserSettings() {
19
+ * const [theme, setTheme] = useLocalStorage("theme", "light");
20
+ *
21
+ * return (
22
+ * <button onClick={() => setTheme(theme === "light" ? "dark" : "light")}>
23
+ * Toggle theme (current: {theme})
24
+ * </button>
25
+ * );
26
+ * }
27
+ * ```
28
+ *
29
+ * @example
30
+ * ```tsx
31
+ * function ShoppingCart() {
32
+ * const [cart, setCart] = useLocalStorage<Product[]>("cart", []);
33
+ *
34
+ * return (
35
+ * <button onClick={() => setCart((prev) => [...prev, newProduct])}>
36
+ * Add to cart ({cart.length} items)
37
+ * </button>
38
+ * );
39
+ * }
40
+ * ```
41
+ */
42
+ export declare function useLocalStorage<T>(key: string, initialValue: T): [T, (value: T | ((prev: T) => T)) => void];
43
+ //# sourceMappingURL=useLocalStorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLocalStorage.d.ts","sourceRoot":"","sources":["../../src/hooks/useLocalStorage.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,CAiE3G"}