@appica/ui-react 1.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 (534) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +91 -0
  3. package/dist/components/accordion/accordion.d.ts +29 -0
  4. package/dist/components/accordion/accordion.d.ts.map +1 -0
  5. package/dist/components/accordion/accordion.js +210 -0
  6. package/dist/components/accordion/accordion.js.map +1 -0
  7. package/dist/components/alert/alert.d.ts +32 -0
  8. package/dist/components/alert/alert.d.ts.map +1 -0
  9. package/dist/components/alert/alert.js +203 -0
  10. package/dist/components/alert/alert.js.map +1 -0
  11. package/dist/components/alert-dialog/alert-dialog.d.ts +28 -0
  12. package/dist/components/alert-dialog/alert-dialog.d.ts.map +1 -0
  13. package/dist/components/alert-dialog/alert-dialog.js +127 -0
  14. package/dist/components/alert-dialog/alert-dialog.js.map +1 -0
  15. package/dist/components/autocomplete/autocomplete.d.ts +48 -0
  16. package/dist/components/autocomplete/autocomplete.d.ts.map +1 -0
  17. package/dist/components/autocomplete/autocomplete.js +299 -0
  18. package/dist/components/autocomplete/autocomplete.js.map +1 -0
  19. package/dist/components/avatar/avatar.d.ts +29 -0
  20. package/dist/components/avatar/avatar.d.ts.map +1 -0
  21. package/dist/components/avatar/avatar.js +115 -0
  22. package/dist/components/avatar/avatar.js.map +1 -0
  23. package/dist/components/background-pattern/background-pattern-interactive.d.ts +10 -0
  24. package/dist/components/background-pattern/background-pattern-interactive.d.ts.map +1 -0
  25. package/dist/components/background-pattern/background-pattern-interactive.js +72 -0
  26. package/dist/components/background-pattern/background-pattern-interactive.js.map +1 -0
  27. package/dist/components/background-pattern/background-pattern-shared.d.ts +12 -0
  28. package/dist/components/background-pattern/background-pattern-shared.d.ts.map +1 -0
  29. package/dist/components/background-pattern/background-pattern-shared.js +73 -0
  30. package/dist/components/background-pattern/background-pattern-shared.js.map +1 -0
  31. package/dist/components/background-pattern/background-pattern.d.ts +23 -0
  32. package/dist/components/background-pattern/background-pattern.d.ts.map +1 -0
  33. package/dist/components/background-pattern/background-pattern.js +49 -0
  34. package/dist/components/background-pattern/background-pattern.js.map +1 -0
  35. package/dist/components/background-pattern/index.d.ts +4 -0
  36. package/dist/components/background-pattern/index.d.ts.map +1 -0
  37. package/dist/components/background-pattern/index.js +3 -0
  38. package/dist/components/background-pattern/index.js.map +1 -0
  39. package/dist/components/badge/badge.d.ts +17 -0
  40. package/dist/components/badge/badge.d.ts.map +1 -0
  41. package/dist/components/badge/badge.js +134 -0
  42. package/dist/components/badge/badge.js.map +1 -0
  43. package/dist/components/breadcrumb/breadcrumb.d.ts +24 -0
  44. package/dist/components/breadcrumb/breadcrumb.d.ts.map +1 -0
  45. package/dist/components/breadcrumb/breadcrumb.js +106 -0
  46. package/dist/components/breadcrumb/breadcrumb.js.map +1 -0
  47. package/dist/components/button/button-variants.d.ts +6 -0
  48. package/dist/components/button/button-variants.d.ts.map +1 -0
  49. package/dist/components/button/button-variants.js +69 -0
  50. package/dist/components/button/button-variants.js.map +1 -0
  51. package/dist/components/button/button.d.ts +10 -0
  52. package/dist/components/button/button.d.ts.map +1 -0
  53. package/dist/components/button/button.js +26 -0
  54. package/dist/components/button/button.js.map +1 -0
  55. package/dist/components/button/index.d.ts +3 -0
  56. package/dist/components/button/index.d.ts.map +1 -0
  57. package/dist/components/button/index.js +3 -0
  58. package/dist/components/button/index.js.map +1 -0
  59. package/dist/components/button-group/button-group-context.d.ts +13 -0
  60. package/dist/components/button-group/button-group-context.d.ts.map +1 -0
  61. package/dist/components/button-group/button-group-context.js +7 -0
  62. package/dist/components/button-group/button-group-context.js.map +1 -0
  63. package/dist/components/button-group/button-group.d.ts +12 -0
  64. package/dist/components/button-group/button-group.d.ts.map +1 -0
  65. package/dist/components/button-group/button-group.js +45 -0
  66. package/dist/components/button-group/button-group.js.map +1 -0
  67. package/dist/components/calendar/calendar.d.ts +14 -0
  68. package/dist/components/calendar/calendar.d.ts.map +1 -0
  69. package/dist/components/calendar/calendar.js +228 -0
  70. package/dist/components/calendar/calendar.js.map +1 -0
  71. package/dist/components/carousel/carousel.d.ts +128 -0
  72. package/dist/components/carousel/carousel.d.ts.map +1 -0
  73. package/dist/components/carousel/carousel.js +795 -0
  74. package/dist/components/carousel/carousel.js.map +1 -0
  75. package/dist/components/checkbox/checkbox.d.ts +7 -0
  76. package/dist/components/checkbox/checkbox.d.ts.map +1 -0
  77. package/dist/components/checkbox/checkbox.js +128 -0
  78. package/dist/components/checkbox/checkbox.js.map +1 -0
  79. package/dist/components/checkbox-group/checkbox-group.d.ts +9 -0
  80. package/dist/components/checkbox-group/checkbox-group.d.ts.map +1 -0
  81. package/dist/components/checkbox-group/checkbox-group.js +18 -0
  82. package/dist/components/checkbox-group/checkbox-group.js.map +1 -0
  83. package/dist/components/chip/chip.d.ts +36 -0
  84. package/dist/components/chip/chip.d.ts.map +1 -0
  85. package/dist/components/chip/chip.js +159 -0
  86. package/dist/components/chip/chip.js.map +1 -0
  87. package/dist/components/collapsible/collapsible.d.ts +11 -0
  88. package/dist/components/collapsible/collapsible.d.ts.map +1 -0
  89. package/dist/components/collapsible/collapsible.js +41 -0
  90. package/dist/components/collapsible/collapsible.js.map +1 -0
  91. package/dist/components/combobox/combobox.d.ts +57 -0
  92. package/dist/components/combobox/combobox.d.ts.map +1 -0
  93. package/dist/components/combobox/combobox.js +456 -0
  94. package/dist/components/combobox/combobox.js.map +1 -0
  95. package/dist/components/context-menu/context-menu.d.ts +43 -0
  96. package/dist/components/context-menu/context-menu.d.ts.map +1 -0
  97. package/dist/components/context-menu/context-menu.js +243 -0
  98. package/dist/components/context-menu/context-menu.js.map +1 -0
  99. package/dist/components/copy-button/copy-button.d.ts +15 -0
  100. package/dist/components/copy-button/copy-button.d.ts.map +1 -0
  101. package/dist/components/copy-button/copy-button.js +126 -0
  102. package/dist/components/copy-button/copy-button.js.map +1 -0
  103. package/dist/components/countdown/countdown.d.ts +26 -0
  104. package/dist/components/countdown/countdown.d.ts.map +1 -0
  105. package/dist/components/countdown/countdown.js +111 -0
  106. package/dist/components/countdown/countdown.js.map +1 -0
  107. package/dist/components/date-field/date-field.d.ts +25 -0
  108. package/dist/components/date-field/date-field.d.ts.map +1 -0
  109. package/dist/components/date-field/date-field.js +403 -0
  110. package/dist/components/date-field/date-field.js.map +1 -0
  111. package/dist/components/date-picker/date-picker.d.ts +58 -0
  112. package/dist/components/date-picker/date-picker.d.ts.map +1 -0
  113. package/dist/components/date-picker/date-picker.js +449 -0
  114. package/dist/components/date-picker/date-picker.js.map +1 -0
  115. package/dist/components/dialog/dialog.d.ts +30 -0
  116. package/dist/components/dialog/dialog.d.ts.map +1 -0
  117. package/dist/components/dialog/dialog.js +138 -0
  118. package/dist/components/dialog/dialog.js.map +1 -0
  119. package/dist/components/drawer/drawer.d.ts +39 -0
  120. package/dist/components/drawer/drawer.d.ts.map +1 -0
  121. package/dist/components/drawer/drawer.js +270 -0
  122. package/dist/components/drawer/drawer.js.map +1 -0
  123. package/dist/components/dropdown-menu/dropdown-menu.d.ts +43 -0
  124. package/dist/components/dropdown-menu/dropdown-menu.d.ts.map +1 -0
  125. package/dist/components/dropdown-menu/dropdown-menu.js +235 -0
  126. package/dist/components/dropdown-menu/dropdown-menu.js.map +1 -0
  127. package/dist/components/field/field.d.ts +15 -0
  128. package/dist/components/field/field.d.ts.map +1 -0
  129. package/dist/components/field/field.js +62 -0
  130. package/dist/components/field/field.js.map +1 -0
  131. package/dist/components/fieldset/fieldset.d.ts +9 -0
  132. package/dist/components/fieldset/fieldset.d.ts.map +1 -0
  133. package/dist/components/fieldset/fieldset.js +20 -0
  134. package/dist/components/fieldset/fieldset.js.map +1 -0
  135. package/dist/components/form/form.d.ts +7 -0
  136. package/dist/components/form/form.d.ts.map +1 -0
  137. package/dist/components/form/form.js +9 -0
  138. package/dist/components/form/form.js.map +1 -0
  139. package/dist/components/gradient-glow/gradient-glow.d.ts +21 -0
  140. package/dist/components/gradient-glow/gradient-glow.d.ts.map +1 -0
  141. package/dist/components/gradient-glow/gradient-glow.js +99 -0
  142. package/dist/components/gradient-glow/gradient-glow.js.map +1 -0
  143. package/dist/components/input/index.d.ts +3 -0
  144. package/dist/components/input/index.d.ts.map +1 -0
  145. package/dist/components/input/index.js +3 -0
  146. package/dist/components/input/index.js.map +1 -0
  147. package/dist/components/input/input-variants.d.ts +7 -0
  148. package/dist/components/input/input-variants.d.ts.map +1 -0
  149. package/dist/components/input/input-variants.js +52 -0
  150. package/dist/components/input/input-variants.js.map +1 -0
  151. package/dist/components/input/input.d.ts +19 -0
  152. package/dist/components/input/input.d.ts.map +1 -0
  153. package/dist/components/input/input.js +96 -0
  154. package/dist/components/input/input.js.map +1 -0
  155. package/dist/components/kbd/kbd.d.ts +13 -0
  156. package/dist/components/kbd/kbd.d.ts.map +1 -0
  157. package/dist/components/kbd/kbd.js +34 -0
  158. package/dist/components/kbd/kbd.js.map +1 -0
  159. package/dist/components/loader/loader.d.ts +10 -0
  160. package/dist/components/loader/loader.d.ts.map +1 -0
  161. package/dist/components/loader/loader.js +137 -0
  162. package/dist/components/loader/loader.js.map +1 -0
  163. package/dist/components/menubar/menubar.d.ts +44 -0
  164. package/dist/components/menubar/menubar.d.ts.map +1 -0
  165. package/dist/components/menubar/menubar.js +114 -0
  166. package/dist/components/menubar/menubar.js.map +1 -0
  167. package/dist/components/meter/meter.d.ts +24 -0
  168. package/dist/components/meter/meter.d.ts.map +1 -0
  169. package/dist/components/meter/meter.js +105 -0
  170. package/dist/components/meter/meter.js.map +1 -0
  171. package/dist/components/navigation/index.d.ts +4 -0
  172. package/dist/components/navigation/index.d.ts.map +1 -0
  173. package/dist/components/navigation/index.js +4 -0
  174. package/dist/components/navigation/index.js.map +1 -0
  175. package/dist/components/navigation/navigation-context.d.ts +16 -0
  176. package/dist/components/navigation/navigation-context.d.ts.map +1 -0
  177. package/dist/components/navigation/navigation-context.js +10 -0
  178. package/dist/components/navigation/navigation-context.js.map +1 -0
  179. package/dist/components/navigation/navigation-link-variants.d.ts +9 -0
  180. package/dist/components/navigation/navigation-link-variants.d.ts.map +1 -0
  181. package/dist/components/navigation/navigation-link-variants.js +189 -0
  182. package/dist/components/navigation/navigation-link-variants.js.map +1 -0
  183. package/dist/components/navigation/navigation-link.d.ts +20 -0
  184. package/dist/components/navigation/navigation-link.d.ts.map +1 -0
  185. package/dist/components/navigation/navigation-link.js +54 -0
  186. package/dist/components/navigation/navigation-link.js.map +1 -0
  187. package/dist/components/navigation/navigation.d.ts +21 -0
  188. package/dist/components/navigation/navigation.d.ts.map +1 -0
  189. package/dist/components/navigation/navigation.js +41 -0
  190. package/dist/components/navigation/navigation.js.map +1 -0
  191. package/dist/components/navigation-menu/navigation-menu.d.ts +41 -0
  192. package/dist/components/navigation-menu/navigation-menu.d.ts.map +1 -0
  193. package/dist/components/navigation-menu/navigation-menu.js +329 -0
  194. package/dist/components/navigation-menu/navigation-menu.js.map +1 -0
  195. package/dist/components/number-field/number-field.d.ts +17 -0
  196. package/dist/components/number-field/number-field.d.ts.map +1 -0
  197. package/dist/components/number-field/number-field.js +270 -0
  198. package/dist/components/number-field/number-field.js.map +1 -0
  199. package/dist/components/otp-field/otp-field.d.ts +19 -0
  200. package/dist/components/otp-field/otp-field.d.ts.map +1 -0
  201. package/dist/components/otp-field/otp-field.js +66 -0
  202. package/dist/components/otp-field/otp-field.js.map +1 -0
  203. package/dist/components/pagination/pagination.d.ts +29 -0
  204. package/dist/components/pagination/pagination.d.ts.map +1 -0
  205. package/dist/components/pagination/pagination.js +92 -0
  206. package/dist/components/pagination/pagination.js.map +1 -0
  207. package/dist/components/popover/popover.d.ts +22 -0
  208. package/dist/components/popover/popover.d.ts.map +1 -0
  209. package/dist/components/popover/popover.js +108 -0
  210. package/dist/components/popover/popover.js.map +1 -0
  211. package/dist/components/preview-card/preview-card.d.ts +16 -0
  212. package/dist/components/preview-card/preview-card.d.ts.map +1 -0
  213. package/dist/components/preview-card/preview-card.js +92 -0
  214. package/dist/components/preview-card/preview-card.js.map +1 -0
  215. package/dist/components/progress/progress.d.ts +18 -0
  216. package/dist/components/progress/progress.d.ts.map +1 -0
  217. package/dist/components/progress/progress.js +134 -0
  218. package/dist/components/progress/progress.js.map +1 -0
  219. package/dist/components/radio/radio.d.ts +7 -0
  220. package/dist/components/radio/radio.d.ts.map +1 -0
  221. package/dist/components/radio/radio.js +73 -0
  222. package/dist/components/radio/radio.js.map +1 -0
  223. package/dist/components/radio-group/radio-group.d.ts +9 -0
  224. package/dist/components/radio-group/radio-group.d.ts.map +1 -0
  225. package/dist/components/radio-group/radio-group.js +19 -0
  226. package/dist/components/radio-group/radio-group.js.map +1 -0
  227. package/dist/components/scroll-area/scroll-area.d.ts +14 -0
  228. package/dist/components/scroll-area/scroll-area.d.ts.map +1 -0
  229. package/dist/components/scroll-area/scroll-area.js +87 -0
  230. package/dist/components/scroll-area/scroll-area.js.map +1 -0
  231. package/dist/components/select/select.d.ts +36 -0
  232. package/dist/components/select/select.d.ts.map +1 -0
  233. package/dist/components/select/select.js +345 -0
  234. package/dist/components/select/select.js.map +1 -0
  235. package/dist/components/separator/separator.d.ts +10 -0
  236. package/dist/components/separator/separator.d.ts.map +1 -0
  237. package/dist/components/separator/separator.js +81 -0
  238. package/dist/components/separator/separator.js.map +1 -0
  239. package/dist/components/skeleton/skeleton.d.ts +9 -0
  240. package/dist/components/skeleton/skeleton.d.ts.map +1 -0
  241. package/dist/components/skeleton/skeleton.js +27 -0
  242. package/dist/components/skeleton/skeleton.js.map +1 -0
  243. package/dist/components/slider/slider.d.ts +11 -0
  244. package/dist/components/slider/slider.d.ts.map +1 -0
  245. package/dist/components/slider/slider.js +187 -0
  246. package/dist/components/slider/slider.js.map +1 -0
  247. package/dist/components/sparkline/sparkline.d.ts +39 -0
  248. package/dist/components/sparkline/sparkline.d.ts.map +1 -0
  249. package/dist/components/sparkline/sparkline.js +356 -0
  250. package/dist/components/sparkline/sparkline.js.map +1 -0
  251. package/dist/components/spinner/spinner.d.ts +10 -0
  252. package/dist/components/spinner/spinner.d.ts.map +1 -0
  253. package/dist/components/spinner/spinner.js +179 -0
  254. package/dist/components/spinner/spinner.js.map +1 -0
  255. package/dist/components/switch/switch.d.ts +33 -0
  256. package/dist/components/switch/switch.d.ts.map +1 -0
  257. package/dist/components/switch/switch.js +137 -0
  258. package/dist/components/switch/switch.js.map +1 -0
  259. package/dist/components/table/table.d.ts +34 -0
  260. package/dist/components/table/table.d.ts.map +1 -0
  261. package/dist/components/table/table.js +108 -0
  262. package/dist/components/table/table.js.map +1 -0
  263. package/dist/components/tabs/tabs.d.ts +35 -0
  264. package/dist/components/tabs/tabs.d.ts.map +1 -0
  265. package/dist/components/tabs/tabs.js +192 -0
  266. package/dist/components/tabs/tabs.js.map +1 -0
  267. package/dist/components/text-animate/text-animate.d.ts +31 -0
  268. package/dist/components/text-animate/text-animate.d.ts.map +1 -0
  269. package/dist/components/text-animate/text-animate.js +230 -0
  270. package/dist/components/text-animate/text-animate.js.map +1 -0
  271. package/dist/components/textarea/textarea.d.ts +17 -0
  272. package/dist/components/textarea/textarea.d.ts.map +1 -0
  273. package/dist/components/textarea/textarea.js +117 -0
  274. package/dist/components/textarea/textarea.js.map +1 -0
  275. package/dist/components/thumbnail/thumbnail.d.ts +26 -0
  276. package/dist/components/thumbnail/thumbnail.d.ts.map +1 -0
  277. package/dist/components/thumbnail/thumbnail.js +116 -0
  278. package/dist/components/thumbnail/thumbnail.js.map +1 -0
  279. package/dist/components/time-field/time-field.d.ts +25 -0
  280. package/dist/components/time-field/time-field.d.ts.map +1 -0
  281. package/dist/components/time-field/time-field.js +488 -0
  282. package/dist/components/time-field/time-field.js.map +1 -0
  283. package/dist/components/toast/toast.d.ts +59 -0
  284. package/dist/components/toast/toast.d.ts.map +1 -0
  285. package/dist/components/toast/toast.js +239 -0
  286. package/dist/components/toast/toast.js.map +1 -0
  287. package/dist/components/toc/toc.d.ts +21 -0
  288. package/dist/components/toc/toc.d.ts.map +1 -0
  289. package/dist/components/toc/toc.js +185 -0
  290. package/dist/components/toc/toc.js.map +1 -0
  291. package/dist/components/toggle/toggle.d.ts +7 -0
  292. package/dist/components/toggle/toggle.d.ts.map +1 -0
  293. package/dist/components/toggle/toggle.js +9 -0
  294. package/dist/components/toggle/toggle.js.map +1 -0
  295. package/dist/components/toggle-group/toggle-group.d.ts +7 -0
  296. package/dist/components/toggle-group/toggle-group.d.ts.map +1 -0
  297. package/dist/components/toggle-group/toggle-group.js +21 -0
  298. package/dist/components/toggle-group/toggle-group.js.map +1 -0
  299. package/dist/components/toolbar/toolbar.d.ts +23 -0
  300. package/dist/components/toolbar/toolbar.d.ts.map +1 -0
  301. package/dist/components/toolbar/toolbar.js +56 -0
  302. package/dist/components/toolbar/toolbar.js.map +1 -0
  303. package/dist/components/tooltip/tooltip.d.ts +16 -0
  304. package/dist/components/tooltip/tooltip.d.ts.map +1 -0
  305. package/dist/components/tooltip/tooltip.js +64 -0
  306. package/dist/components/tooltip/tooltip.js.map +1 -0
  307. package/dist/floating.d.ts +47 -0
  308. package/dist/floating.d.ts.map +1 -0
  309. package/dist/floating.js +35 -0
  310. package/dist/floating.js.map +1 -0
  311. package/dist/hooks/use-direction.d.ts +2 -0
  312. package/dist/hooks/use-direction.d.ts.map +1 -0
  313. package/dist/hooks/use-direction.js +3 -0
  314. package/dist/hooks/use-direction.js.map +1 -0
  315. package/dist/hooks/use-dismissible.d.ts +16 -0
  316. package/dist/hooks/use-dismissible.d.ts.map +1 -0
  317. package/dist/hooks/use-dismissible.js +17 -0
  318. package/dist/hooks/use-dismissible.js.map +1 -0
  319. package/dist/hooks/use-local-storage.d.ts +24 -0
  320. package/dist/hooks/use-local-storage.d.ts.map +1 -0
  321. package/dist/hooks/use-local-storage.js +127 -0
  322. package/dist/hooks/use-local-storage.js.map +1 -0
  323. package/dist/hooks/use-media-query.d.ts +20 -0
  324. package/dist/hooks/use-media-query.d.ts.map +1 -0
  325. package/dist/hooks/use-media-query.js +19 -0
  326. package/dist/hooks/use-media-query.js.map +1 -0
  327. package/dist/hooks/use-reduced-motion.d.ts +7 -0
  328. package/dist/hooks/use-reduced-motion.d.ts.map +1 -0
  329. package/dist/hooks/use-reduced-motion.js +13 -0
  330. package/dist/hooks/use-reduced-motion.js.map +1 -0
  331. package/dist/hooks/use-theme.d.ts +11 -0
  332. package/dist/hooks/use-theme.d.ts.map +1 -0
  333. package/dist/hooks/use-theme.js +9 -0
  334. package/dist/hooks/use-theme.js.map +1 -0
  335. package/dist/index.d.ts +74 -0
  336. package/dist/index.d.ts.map +1 -0
  337. package/dist/index.js +80 -0
  338. package/dist/index.js.map +1 -0
  339. package/dist/modal.d.ts +42 -0
  340. package/dist/modal.d.ts.map +1 -0
  341. package/dist/modal.js +18 -0
  342. package/dist/modal.js.map +1 -0
  343. package/dist/providers/direction-provider.d.ts +21 -0
  344. package/dist/providers/direction-provider.d.ts.map +1 -0
  345. package/dist/providers/direction-provider.js +9 -0
  346. package/dist/providers/direction-provider.js.map +1 -0
  347. package/dist/providers/reduced-motion-provider.d.ts +30 -0
  348. package/dist/providers/reduced-motion-provider.d.ts.map +1 -0
  349. package/dist/providers/reduced-motion-provider.js +27 -0
  350. package/dist/providers/reduced-motion-provider.js.map +1 -0
  351. package/dist/providers/theme-provider/index.d.ts +5 -0
  352. package/dist/providers/theme-provider/index.d.ts.map +1 -0
  353. package/dist/providers/theme-provider/index.js +3 -0
  354. package/dist/providers/theme-provider/index.js.map +1 -0
  355. package/dist/providers/theme-provider/theme-provider.d.ts +39 -0
  356. package/dist/providers/theme-provider/theme-provider.d.ts.map +1 -0
  357. package/dist/providers/theme-provider/theme-provider.js +118 -0
  358. package/dist/providers/theme-provider/theme-provider.js.map +1 -0
  359. package/dist/providers/theme-provider/theme-script.d.ts +28 -0
  360. package/dist/providers/theme-provider/theme-script.d.ts.map +1 -0
  361. package/dist/providers/theme-provider/theme-script.js +59 -0
  362. package/dist/providers/theme-provider/theme-script.js.map +1 -0
  363. package/dist/utils.d.ts +17 -0
  364. package/dist/utils.d.ts.map +1 -0
  365. package/dist/utils.js +51 -0
  366. package/dist/utils.js.map +1 -0
  367. package/package.json +479 -0
  368. package/src/components/accordion/accordion.test.tsx +220 -0
  369. package/src/components/accordion/accordion.tsx +269 -0
  370. package/src/components/alert/alert.test.tsx +188 -0
  371. package/src/components/alert/alert.tsx +243 -0
  372. package/src/components/alert-dialog/alert-dialog.test.tsx +141 -0
  373. package/src/components/alert-dialog/alert-dialog.tsx +179 -0
  374. package/src/components/autocomplete/autocomplete.test.tsx +384 -0
  375. package/src/components/autocomplete/autocomplete.tsx +442 -0
  376. package/src/components/avatar/avatar.test.tsx +368 -0
  377. package/src/components/avatar/avatar.tsx +142 -0
  378. package/src/components/background-pattern/background-pattern-interactive.tsx +93 -0
  379. package/src/components/background-pattern/background-pattern-shared.tsx +96 -0
  380. package/src/components/background-pattern/background-pattern.test.tsx +97 -0
  381. package/src/components/background-pattern/background-pattern.tsx +67 -0
  382. package/src/components/background-pattern/index.ts +3 -0
  383. package/src/components/badge/badge.test.tsx +58 -0
  384. package/src/components/badge/badge.tsx +149 -0
  385. package/src/components/breadcrumb/breadcrumb.test.tsx +174 -0
  386. package/src/components/breadcrumb/breadcrumb.tsx +146 -0
  387. package/src/components/button/button-variants.ts +69 -0
  388. package/src/components/button/button.test.tsx +79 -0
  389. package/src/components/button/button.tsx +28 -0
  390. package/src/components/button/index.ts +2 -0
  391. package/src/components/button-group/button-group-context.ts +18 -0
  392. package/src/components/button-group/button-group.test.tsx +223 -0
  393. package/src/components/button-group/button-group.tsx +59 -0
  394. package/src/components/calendar/calendar.test.tsx +69 -0
  395. package/src/components/calendar/calendar.tsx +295 -0
  396. package/src/components/carousel/carousel.test.tsx +493 -0
  397. package/src/components/carousel/carousel.tsx +1003 -0
  398. package/src/components/checkbox/checkbox.test.tsx +100 -0
  399. package/src/components/checkbox/checkbox.tsx +154 -0
  400. package/src/components/checkbox-group/checkbox-group.test.tsx +86 -0
  401. package/src/components/checkbox-group/checkbox-group.tsx +21 -0
  402. package/src/components/chip/chip.test.tsx +242 -0
  403. package/src/components/chip/chip.tsx +234 -0
  404. package/src/components/collapsible/collapsible.test.tsx +126 -0
  405. package/src/components/collapsible/collapsible.tsx +47 -0
  406. package/src/components/combobox/combobox.test.tsx +410 -0
  407. package/src/components/combobox/combobox.tsx +598 -0
  408. package/src/components/context-menu/context-menu.test.tsx +226 -0
  409. package/src/components/context-menu/context-menu.tsx +345 -0
  410. package/src/components/copy-button/copy-button.test.tsx +147 -0
  411. package/src/components/copy-button/copy-button.tsx +141 -0
  412. package/src/components/countdown/countdown.test.tsx +130 -0
  413. package/src/components/countdown/countdown.tsx +170 -0
  414. package/src/components/date-field/date-field.test.tsx +373 -0
  415. package/src/components/date-field/date-field.tsx +512 -0
  416. package/src/components/date-picker/date-picker.test.tsx +291 -0
  417. package/src/components/date-picker/date-picker.tsx +572 -0
  418. package/src/components/dialog/dialog.test.tsx +173 -0
  419. package/src/components/dialog/dialog.tsx +190 -0
  420. package/src/components/drawer/drawer.test.tsx +191 -0
  421. package/src/components/drawer/drawer.tsx +365 -0
  422. package/src/components/dropdown-menu/dropdown-menu.test.tsx +227 -0
  423. package/src/components/dropdown-menu/dropdown-menu.tsx +341 -0
  424. package/src/components/field/field.test.tsx +84 -0
  425. package/src/components/field/field.tsx +71 -0
  426. package/src/components/fieldset/fieldset.test.tsx +62 -0
  427. package/src/components/fieldset/fieldset.tsx +24 -0
  428. package/src/components/form/form.test.tsx +61 -0
  429. package/src/components/form/form.tsx +11 -0
  430. package/src/components/gradient-glow/gradient-glow.test.tsx +110 -0
  431. package/src/components/gradient-glow/gradient-glow.tsx +132 -0
  432. package/src/components/input/index.ts +2 -0
  433. package/src/components/input/input-variants.ts +52 -0
  434. package/src/components/input/input.test.tsx +118 -0
  435. package/src/components/input/input.tsx +120 -0
  436. package/src/components/kbd/kbd.test.tsx +119 -0
  437. package/src/components/kbd/kbd.tsx +48 -0
  438. package/src/components/loader/loader.test.tsx +57 -0
  439. package/src/components/loader/loader.tsx +163 -0
  440. package/src/components/menubar/menubar.test.tsx +162 -0
  441. package/src/components/menubar/menubar.tsx +226 -0
  442. package/src/components/meter/meter.test.tsx +172 -0
  443. package/src/components/meter/meter.tsx +144 -0
  444. package/src/components/navigation/index.ts +3 -0
  445. package/src/components/navigation/navigation-context.ts +24 -0
  446. package/src/components/navigation/navigation-link-variants.ts +197 -0
  447. package/src/components/navigation/navigation-link.tsx +90 -0
  448. package/src/components/navigation/navigation.test.tsx +253 -0
  449. package/src/components/navigation/navigation.tsx +74 -0
  450. package/src/components/navigation-menu/navigation-menu.test.tsx +258 -0
  451. package/src/components/navigation-menu/navigation-menu.tsx +410 -0
  452. package/src/components/number-field/number-field.test.tsx +224 -0
  453. package/src/components/number-field/number-field.tsx +310 -0
  454. package/src/components/otp-field/otp-field.test.tsx +113 -0
  455. package/src/components/otp-field/otp-field.tsx +105 -0
  456. package/src/components/pagination/pagination.test.tsx +147 -0
  457. package/src/components/pagination/pagination.tsx +139 -0
  458. package/src/components/popover/popover.test.tsx +135 -0
  459. package/src/components/popover/popover.tsx +134 -0
  460. package/src/components/preview-card/preview-card.test.tsx +99 -0
  461. package/src/components/preview-card/preview-card.tsx +103 -0
  462. package/src/components/progress/progress.test.tsx +109 -0
  463. package/src/components/progress/progress.tsx +151 -0
  464. package/src/components/radio/radio.test.tsx +141 -0
  465. package/src/components/radio/radio.tsx +94 -0
  466. package/src/components/radio-group/radio-group.test.tsx +80 -0
  467. package/src/components/radio-group/radio-group.tsx +22 -0
  468. package/src/components/scroll-area/scroll-area.test.tsx +133 -0
  469. package/src/components/scroll-area/scroll-area.tsx +101 -0
  470. package/src/components/select/select.test.tsx +251 -0
  471. package/src/components/select/select.tsx +446 -0
  472. package/src/components/separator/separator.test.tsx +46 -0
  473. package/src/components/separator/separator.tsx +95 -0
  474. package/src/components/skeleton/skeleton.test.tsx +55 -0
  475. package/src/components/skeleton/skeleton.tsx +33 -0
  476. package/src/components/slider/slider.test.tsx +123 -0
  477. package/src/components/slider/slider.tsx +262 -0
  478. package/src/components/sparkline/sparkline.test.tsx +249 -0
  479. package/src/components/sparkline/sparkline.tsx +446 -0
  480. package/src/components/spinner/spinner.test.tsx +57 -0
  481. package/src/components/spinner/spinner.tsx +219 -0
  482. package/src/components/switch/switch.test.tsx +100 -0
  483. package/src/components/switch/switch.tsx +166 -0
  484. package/src/components/table/table.test.tsx +175 -0
  485. package/src/components/table/table.tsx +157 -0
  486. package/src/components/tabs/tabs.test.tsx +165 -0
  487. package/src/components/tabs/tabs.tsx +246 -0
  488. package/src/components/text-animate/text-animate.test.tsx +125 -0
  489. package/src/components/text-animate/text-animate.tsx +354 -0
  490. package/src/components/textarea/textarea.test.tsx +188 -0
  491. package/src/components/textarea/textarea.tsx +144 -0
  492. package/src/components/thumbnail/thumbnail.test.tsx +217 -0
  493. package/src/components/thumbnail/thumbnail.tsx +139 -0
  494. package/src/components/time-field/time-field.test.tsx +376 -0
  495. package/src/components/time-field/time-field.tsx +625 -0
  496. package/src/components/toast/toast.test.tsx +277 -0
  497. package/src/components/toast/toast.tsx +377 -0
  498. package/src/components/toc/toc.test.tsx +197 -0
  499. package/src/components/toc/toc.tsx +233 -0
  500. package/src/components/toggle/toggle.test.tsx +109 -0
  501. package/src/components/toggle/toggle.tsx +10 -0
  502. package/src/components/toggle-group/toggle-group.test.tsx +95 -0
  503. package/src/components/toggle-group/toggle-group.tsx +21 -0
  504. package/src/components/toolbar/toolbar.test.tsx +78 -0
  505. package/src/components/toolbar/toolbar.tsx +77 -0
  506. package/src/components/tooltip/tooltip.test.tsx +100 -0
  507. package/src/components/tooltip/tooltip.tsx +78 -0
  508. package/src/floating.test.ts +40 -0
  509. package/src/floating.ts +103 -0
  510. package/src/globals.d.ts +34 -0
  511. package/src/hooks/use-direction.ts +3 -0
  512. package/src/hooks/use-dismissible.ts +33 -0
  513. package/src/hooks/use-local-storage.test.tsx +63 -0
  514. package/src/hooks/use-local-storage.ts +190 -0
  515. package/src/hooks/use-media-query.test.tsx +65 -0
  516. package/src/hooks/use-media-query.ts +38 -0
  517. package/src/hooks/use-reduced-motion.ts +17 -0
  518. package/src/hooks/use-theme.ts +16 -0
  519. package/src/index.ts +76 -0
  520. package/src/modal.test.ts +34 -0
  521. package/src/modal.ts +80 -0
  522. package/src/providers/direction-provider.test.tsx +20 -0
  523. package/src/providers/direction-provider.tsx +26 -0
  524. package/src/providers/reduced-motion-provider.test.tsx +42 -0
  525. package/src/providers/reduced-motion-provider.tsx +58 -0
  526. package/src/providers/theme-provider/index.ts +4 -0
  527. package/src/providers/theme-provider/theme-provider.test.tsx +97 -0
  528. package/src/providers/theme-provider/theme-provider.tsx +169 -0
  529. package/src/providers/theme-provider/theme-script.tsx +108 -0
  530. package/src/test/setup.ts +27 -0
  531. package/src/test/vitest-axe.d.ts +7 -0
  532. package/src/utils.test.tsx +63 -0
  533. package/src/utils.ts +57 -0
  534. package/styles.css +523 -0
@@ -0,0 +1,190 @@
1
+ 'use client'
2
+
3
+ import { useCallback, useRef, useSyncExternalStore } from 'react'
4
+
5
+ export type StorageBackend = 'local' | 'session'
6
+
7
+ export interface UseStorageOptions<T> {
8
+ /** Serialize a value to its stored string form. Defaults to `JSON.stringify`. */
9
+ serializer?: (value: T) => string
10
+ /** Parse the stored string back into a value. Defaults to `JSON.parse`. */
11
+ deserializer?: (raw: string) => T
12
+ }
13
+
14
+ export type UseStorageReturn<T> = readonly [T, (value: T | ((prev: T) => T)) => void, () => void]
15
+
16
+ // Same-tab fan-out: the `storage` event only fires in *other* tabs, so we keep a
17
+ // per-backend, per-key registry to sync components within the current tab.
18
+ const registries: Record<StorageBackend, Map<string, Set<() => void>>> = {
19
+ local: new Map(),
20
+ session: new Map(),
21
+ }
22
+
23
+ function subscribers(backend: StorageBackend, key: string) {
24
+ const reg = registries[backend]
25
+ let set = reg.get(key)
26
+ if (!set) {
27
+ set = new Set()
28
+ reg.set(key, set)
29
+ }
30
+ return set
31
+ }
32
+
33
+ function notify(backend: StorageBackend, key: string) {
34
+ registries[backend].get(key)?.forEach((cb) => cb())
35
+ }
36
+
37
+ function getStore(backend: StorageBackend): Storage | null {
38
+ try {
39
+ return backend === 'session' ? window.sessionStorage : window.localStorage
40
+ } catch {
41
+ // SSR, privacy mode, or disabled storage.
42
+ return null
43
+ }
44
+ }
45
+
46
+ // A single `storage` listener shared by every hook instance — installed at the
47
+ // first subscriber, removed at zero — dispatching through the registries above.
48
+ let globalListenerCount = 0
49
+
50
+ function handleGlobalStorage(e: StorageEvent) {
51
+ for (const backend of ['local', 'session'] as StorageBackend[]) {
52
+ const store = getStore(backend)
53
+ if (e.storageArea && store && e.storageArea !== store) continue
54
+ if (e.key === null) {
55
+ // storage.clear() invalidates every key in this backend.
56
+ registries[backend].forEach((set) => set.forEach((cb) => cb()))
57
+ } else {
58
+ registries[backend].get(e.key)?.forEach((cb) => cb())
59
+ }
60
+ }
61
+ }
62
+
63
+ function addGlobalStorageListener() {
64
+ if (globalListenerCount === 0 && typeof window !== 'undefined') {
65
+ window.addEventListener('storage', handleGlobalStorage)
66
+ }
67
+ globalListenerCount++
68
+ }
69
+
70
+ function removeGlobalStorageListener() {
71
+ globalListenerCount--
72
+ if (globalListenerCount === 0 && typeof window !== 'undefined') {
73
+ window.removeEventListener('storage', handleGlobalStorage)
74
+ }
75
+ }
76
+
77
+ // Cache parsed values keyed by `backend:key`, invalidated by the raw string.
78
+ // Without this, `JSON.parse` in the snapshot would return a fresh object every
79
+ // render and drive `useSyncExternalStore` into an infinite loop.
80
+ const parseCache = new Map<string, { raw: string; value: unknown }>()
81
+
82
+ /**
83
+ * SSR-safe `localStorage`/`sessionStorage` hook. Reads via `useSyncExternalStore`
84
+ * (server and first client render return `defaultValue`), syncs across tabs via
85
+ * the `storage` event, and syncs other components in the same tab via an internal
86
+ * registry. Returns `[value, setValue, remove]`.
87
+ *
88
+ * Values are JSON-serialized by default; pass a `serializer`/`deserializer` to
89
+ * store raw strings (e.g. a theme name the no-flash script reads directly).
90
+ *
91
+ * Prefer the `useLocalStorage` / `useSessionStorage` wrappers unless the backend
92
+ * is chosen at runtime.
93
+ */
94
+ export function useStorage<T>(
95
+ backend: StorageBackend,
96
+ key: string,
97
+ defaultValue: T,
98
+ options: UseStorageOptions<T> = {},
99
+ ): UseStorageReturn<T> {
100
+ // Stabilize so subscribe/snapshot identities depend only on backend+key.
101
+ const defaultRef = useRef(defaultValue)
102
+ const serializeRef = useRef(options.serializer)
103
+ const deserializeRef = useRef(options.deserializer)
104
+ serializeRef.current = options.serializer
105
+ deserializeRef.current = options.deserializer
106
+
107
+ const read = useCallback((): T => {
108
+ // An empty key means "no persistence" — behave like storage is unavailable
109
+ // instead of touching `getItem('')` and registering a listener.
110
+ if (!key) return defaultRef.current
111
+ const store = getStore(backend)
112
+ let raw: string | null = null
113
+ try {
114
+ raw = store?.getItem(key) ?? null
115
+ } catch {
116
+ raw = null
117
+ }
118
+ if (raw === null) return defaultRef.current
119
+
120
+ const id = backend + ':' + key
121
+ const cached = parseCache.get(id)
122
+ if (cached && cached.raw === raw) return cached.value as T
123
+
124
+ let value: T
125
+ try {
126
+ value = deserializeRef.current ? deserializeRef.current(raw) : (JSON.parse(raw) as T)
127
+ } catch {
128
+ value = defaultRef.current
129
+ }
130
+ parseCache.set(id, { raw, value })
131
+ return value
132
+ }, [backend, key])
133
+
134
+ const subscribe = useCallback(
135
+ (onChange: () => void) => {
136
+ if (!key) return () => {}
137
+ const set = subscribers(backend, key)
138
+ set.add(onChange)
139
+ addGlobalStorageListener()
140
+ return () => {
141
+ set.delete(onChange)
142
+ removeGlobalStorageListener()
143
+ }
144
+ },
145
+ [backend, key],
146
+ )
147
+
148
+ const getServerSnapshot = useCallback(() => defaultRef.current, [])
149
+
150
+ const value = useSyncExternalStore(subscribe, read, getServerSnapshot)
151
+
152
+ const setValue = useCallback(
153
+ (update: T | ((prev: T) => T)) => {
154
+ if (!key) return
155
+ const next = typeof update === 'function' ? (update as (prev: T) => T)(read()) : update
156
+ try {
157
+ const raw = serializeRef.current ? serializeRef.current(next) : JSON.stringify(next)
158
+ getStore(backend)?.setItem(key, raw)
159
+ } catch {
160
+ // ignore write failures (quota, privacy mode, SSR)
161
+ }
162
+ notify(backend, key)
163
+ },
164
+ [backend, key, read],
165
+ )
166
+
167
+ const remove = useCallback(() => {
168
+ if (!key) return
169
+ try {
170
+ getStore(backend)?.removeItem(key)
171
+ } catch {
172
+ // ignore
173
+ }
174
+ notify(backend, key)
175
+ }, [backend, key])
176
+
177
+ return [value, setValue, remove] as const
178
+ }
179
+
180
+ export function useLocalStorage<T>(key: string, defaultValue: T, options?: UseStorageOptions<T>): UseStorageReturn<T> {
181
+ return useStorage('local', key, defaultValue, options)
182
+ }
183
+
184
+ export function useSessionStorage<T>(
185
+ key: string,
186
+ defaultValue: T,
187
+ options?: UseStorageOptions<T>,
188
+ ): UseStorageReturn<T> {
189
+ return useStorage('session', key, defaultValue, options)
190
+ }
@@ -0,0 +1,65 @@
1
+ import { act, renderHook } from '@testing-library/react'
2
+ import { afterEach, describe, expect, it, vi } from 'vitest'
3
+ import { useMediaQuery } from './use-media-query'
4
+
5
+ type Listener = (e: MediaQueryListEvent) => void
6
+
7
+ function createMatchMediaMock(initial: Record<string, boolean> = {}) {
8
+ const entries = new Map<string, { matches: boolean; listeners: Set<Listener> }>()
9
+ const entry = (query: string) => {
10
+ let e = entries.get(query)
11
+ if (!e) {
12
+ e = { matches: initial[query] ?? false, listeners: new Set() }
13
+ entries.set(query, e)
14
+ }
15
+ return e
16
+ }
17
+
18
+ const matchMedia = (query: string): MediaQueryList => {
19
+ const e = entry(query)
20
+ return {
21
+ get matches() {
22
+ return e.matches
23
+ },
24
+ media: query,
25
+ onchange: null,
26
+ addEventListener: (_: string, cb: Listener) => e.listeners.add(cb),
27
+ removeEventListener: (_: string, cb: Listener) => e.listeners.delete(cb),
28
+ addListener: () => {},
29
+ removeListener: () => {},
30
+ dispatchEvent: () => false,
31
+ } as unknown as MediaQueryList
32
+ }
33
+
34
+ const set = (query: string, matches: boolean) => {
35
+ const e = entry(query)
36
+ e.matches = matches
37
+ e.listeners.forEach((cb) => cb({ matches } as MediaQueryListEvent))
38
+ }
39
+
40
+ return { matchMedia, set }
41
+ }
42
+
43
+ describe('useMediaQuery', () => {
44
+ const original = window.matchMedia
45
+ afterEach(() => {
46
+ window.matchMedia = original
47
+ })
48
+
49
+ it('returns the current match state for the query', () => {
50
+ const { matchMedia } = createMatchMediaMock({ '(min-width: 768px)': true })
51
+ window.matchMedia = vi.fn(matchMedia)
52
+ const { result } = renderHook(() => useMediaQuery('(min-width: 768px)'))
53
+ expect(result.current).toBe(true)
54
+ })
55
+
56
+ it('re-renders when the query match changes', () => {
57
+ const { matchMedia, set } = createMatchMediaMock({ '(min-width: 768px)': false })
58
+ window.matchMedia = vi.fn(matchMedia)
59
+ const { result } = renderHook(() => useMediaQuery('(min-width: 768px)'))
60
+ expect(result.current).toBe(false)
61
+
62
+ act(() => set('(min-width: 768px)', true))
63
+ expect(result.current).toBe(true)
64
+ })
65
+ })
@@ -0,0 +1,38 @@
1
+ 'use client'
2
+
3
+ import { useCallback, useSyncExternalStore } from 'react'
4
+
5
+ export interface UseMediaQueryOptions {
6
+ /**
7
+ * Value returned on the server and during the first client render before
8
+ * hydration, when `window.matchMedia` is unavailable. Defaults to `false`.
9
+ */
10
+ defaultValue?: boolean
11
+ }
12
+
13
+ /**
14
+ * SSR-safe `matchMedia` hook. Returns whether `query` currently matches and
15
+ * re-renders when it changes. Works in any React environment (Vite, CRA,
16
+ * Next.js, Remix, Astro): on the server and the first client render it returns
17
+ * `defaultValue`, then the real value resolves on hydration via
18
+ * `useSyncExternalStore`.
19
+ *
20
+ * @example
21
+ * const isDesktop = useMediaQuery('(min-width: 768px)')
22
+ * return isDesktop ? <Dialog … /> : <Drawer … />
23
+ */
24
+ export function useMediaQuery(query: string, { defaultValue = false }: UseMediaQueryOptions = {}): boolean {
25
+ const subscribe = useCallback(
26
+ (onChange: () => void) => {
27
+ const mq = window.matchMedia(query)
28
+ mq.addEventListener('change', onChange)
29
+ return () => mq.removeEventListener('change', onChange)
30
+ },
31
+ [query],
32
+ )
33
+
34
+ const getSnapshot = useCallback(() => window.matchMedia(query).matches, [query])
35
+ const getServerSnapshot = useCallback(() => defaultValue, [defaultValue])
36
+
37
+ return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot)
38
+ }
@@ -0,0 +1,17 @@
1
+ 'use client'
2
+
3
+ import { useMediaQuery } from './use-media-query'
4
+ import { useReducedMotionContext } from '../providers/reduced-motion-provider'
5
+
6
+ const QUERY = '(prefers-reduced-motion: reduce)'
7
+
8
+ /**
9
+ * Returns `true` when animations should be skipped — either because the OS
10
+ * exposes `prefers-reduced-motion: reduce` or because a parent
11
+ * `<ReducedMotionProvider disableAnimations>` opted out globally.
12
+ */
13
+ export function useReducedMotion(): boolean {
14
+ const osPrefersReduced = useMediaQuery(QUERY)
15
+ const { disableAnimations } = useReducedMotionContext()
16
+ return disableAnimations || osPrefersReduced
17
+ }
@@ -0,0 +1,16 @@
1
+ 'use client'
2
+
3
+ import { useThemeContext, type ThemeContextValue } from '../providers/theme-provider/theme-provider'
4
+
5
+ export type UseThemeReturn = ThemeContextValue
6
+
7
+ /**
8
+ * Read and control the active theme. Returns the stored `theme`, the
9
+ * `resolvedTheme` (`'system'` resolved to `'light'`/`'dark'`), `systemTheme`,
10
+ * the available `themes`, any `forcedTheme`, a `setTheme` setter, and
11
+ * `mounted` — guard theme-dependent UI (e.g. a sun/moon icon) with `mounted`
12
+ * to avoid hydration mismatches. Returns inert values with no `<ThemeProvider>`.
13
+ */
14
+ export function useTheme(): UseThemeReturn {
15
+ return useThemeContext()
16
+ }
package/src/index.ts ADDED
@@ -0,0 +1,76 @@
1
+ // Auto-generated by scripts/sync-exports.mjs from src/{components,hooks,providers}/*.
2
+ // Do not edit by hand — your changes will be overwritten on the next build.
3
+
4
+ export * from './components/accordion/accordion'
5
+ export * from './components/alert/alert'
6
+ export * from './components/alert-dialog/alert-dialog'
7
+ export * from './components/autocomplete/autocomplete'
8
+ export * from './components/avatar/avatar'
9
+ export * from './components/background-pattern/index'
10
+ export * from './components/badge/badge'
11
+ export * from './components/breadcrumb/breadcrumb'
12
+ export * from './components/button/index'
13
+ export * from './components/button-group/button-group'
14
+ export * from './components/calendar/calendar'
15
+ export * from './components/carousel/carousel'
16
+ export * from './components/checkbox/checkbox'
17
+ export * from './components/checkbox-group/checkbox-group'
18
+ export * from './components/chip/chip'
19
+ export * from './components/collapsible/collapsible'
20
+ export * from './components/combobox/combobox'
21
+ export * from './components/context-menu/context-menu'
22
+ export * from './components/copy-button/copy-button'
23
+ export * from './components/countdown/countdown'
24
+ export * from './components/date-field/date-field'
25
+ export * from './components/date-picker/date-picker'
26
+ export * from './components/dialog/dialog'
27
+ export * from './components/drawer/drawer'
28
+ export * from './components/dropdown-menu/dropdown-menu'
29
+ export * from './components/field/field'
30
+ export * from './components/fieldset/fieldset'
31
+ export * from './components/form/form'
32
+ export * from './components/gradient-glow/gradient-glow'
33
+ export * from './components/input/index'
34
+ export * from './components/kbd/kbd'
35
+ export * from './components/loader/loader'
36
+ export * from './components/menubar/menubar'
37
+ export * from './components/meter/meter'
38
+ export * from './components/navigation/index'
39
+ export * from './components/navigation-menu/navigation-menu'
40
+ export * from './components/number-field/number-field'
41
+ export * from './components/otp-field/otp-field'
42
+ export * from './components/pagination/pagination'
43
+ export * from './components/popover/popover'
44
+ export * from './components/preview-card/preview-card'
45
+ export * from './components/progress/progress'
46
+ export * from './components/radio/radio'
47
+ export * from './components/radio-group/radio-group'
48
+ export * from './components/scroll-area/scroll-area'
49
+ export * from './components/select/select'
50
+ export * from './components/separator/separator'
51
+ export * from './components/skeleton/skeleton'
52
+ export * from './components/slider/slider'
53
+ export * from './components/sparkline/sparkline'
54
+ export * from './components/spinner/spinner'
55
+ export * from './components/switch/switch'
56
+ export * from './components/table/table'
57
+ export * from './components/tabs/tabs'
58
+ export * from './components/text-animate/text-animate'
59
+ export * from './components/textarea/textarea'
60
+ export * from './components/thumbnail/thumbnail'
61
+ export * from './components/time-field/time-field'
62
+ export * from './components/toast/toast'
63
+ export * from './components/toc/toc'
64
+ export * from './components/toggle/toggle'
65
+ export * from './components/toggle-group/toggle-group'
66
+ export * from './components/toolbar/toolbar'
67
+ export * from './components/tooltip/tooltip'
68
+ export * from './hooks/use-direction'
69
+ export * from './hooks/use-dismissible'
70
+ export * from './hooks/use-local-storage'
71
+ export * from './hooks/use-media-query'
72
+ export * from './hooks/use-reduced-motion'
73
+ export * from './hooks/use-theme'
74
+ export * from './providers/direction-provider'
75
+ export * from './providers/reduced-motion-provider'
76
+ export * from './providers/theme-provider/index'
@@ -0,0 +1,34 @@
1
+ import { describe, expect, it } from 'vitest'
2
+ import { splitModalProps } from './modal'
3
+
4
+ describe('splitModalProps', () => {
5
+ it('routes portal props to portal and everything else to popup', () => {
6
+ const { portal, popup } = splitModalProps({
7
+ container: 'node',
8
+ keepMounted: true,
9
+ id: 'dialog-1',
10
+ role: 'dialog',
11
+ initialFocus: 'ref',
12
+ })
13
+
14
+ expect(portal).toEqual({ container: 'node', keepMounted: true })
15
+ expect(popup).toEqual({ id: 'dialog-1', role: 'dialog', initialFocus: 'ref' })
16
+ })
17
+
18
+ it('merges portalProps, with flat portal props winning over it', () => {
19
+ const { portal } = splitModalProps({
20
+ container: 'flat-node',
21
+ portalProps: { container: 'object-node', keepMounted: false },
22
+ })
23
+
24
+ expect(portal).toEqual({ container: 'flat-node', keepMounted: false })
25
+ })
26
+
27
+ it('drops undefined flat portal props', () => {
28
+ const { portal, popup } = splitModalProps({ container: undefined, keepMounted: true, id: 'x' })
29
+
30
+ expect('container' in portal).toBe(false)
31
+ expect(portal).toEqual({ keepMounted: true })
32
+ expect(popup).toEqual({ id: 'x' })
33
+ })
34
+ })
package/src/modal.ts ADDED
@@ -0,0 +1,80 @@
1
+ // Shared plumbing for modal/overlay *Content components — the ones that wrap a
2
+ // Base UI Portal → Backdrop → Viewport → Popup structure (Dialog, AlertDialog,
3
+ // Drawer). Sibling to src/floating.ts (which handles the Positioner-based trio).
4
+ //
5
+ // As with floating, consumers don't get direct access to the inner Portal,
6
+ // Backdrop, or Viewport elements, so *Content must map them itself:
7
+ //
8
+ // 1. The two Portal props (`container`, `keepMounted`) are promoted to flat
9
+ // props on *Content.
10
+ // 2. `portalProps` / `backdropProps` / `viewportProps` escape hatches forward
11
+ // the rest (e.g. `className`, `style`, `render`) without each component
12
+ // re-enumerating it.
13
+ //
14
+ // The Popup is what *Content represents, so its `className`/`style`/`render`
15
+ // stay bound to it (via the regular spread) — reach the other elements through
16
+ // the escape hatches.
17
+
18
+ /** Portal props promoted to flat props on every modal *Content. */
19
+ export const MODAL_PORTAL_KEYS = ['container', 'keepMounted'] as const
20
+
21
+ type ModalPortalKey = (typeof MODAL_PORTAL_KEYS)[number]
22
+
23
+ /**
24
+ * Flat Portal props + typed escape hatches for the Backdrop/Viewport/Portal,
25
+ * derived from a component's own Base UI types so each *Content stays in
26
+ * lockstep with Base UI. Intersect with the Popup props to build a *Content
27
+ * prop type:
28
+ *
29
+ * ```ts
30
+ * type DialogContentProps = ModalContentProps<
31
+ * React.ComponentProps<typeof BaseDialog.Popup>,
32
+ * React.ComponentProps<typeof BaseDialog.Portal>,
33
+ * React.ComponentProps<typeof BaseDialog.Backdrop>,
34
+ * React.ComponentProps<typeof BaseDialog.Viewport>
35
+ * > & { closeButton?: boolean }
36
+ * ```
37
+ */
38
+ export type ModalContentProps<Popup, Portal, Backdrop, Viewport> = Popup &
39
+ Pick<Portal, Extract<keyof Portal, ModalPortalKey>> & {
40
+ /** Escape hatch: extra props forwarded to the Base UI Portal. */
41
+ portalProps?: Omit<Portal, ModalPortalKey | 'children'>
42
+ /** Escape hatch: props forwarded to the Base UI Backdrop (e.g. `className`, `style`, `render`). */
43
+ backdropProps?: Omit<Backdrop, 'children'>
44
+ /** Escape hatch: props forwarded to the Base UI Viewport (e.g. `className`, `style`, `render`). */
45
+ viewportProps?: Omit<Viewport, 'children'>
46
+ }
47
+
48
+ export interface SplitModalProps {
49
+ portal: Record<string, unknown>
50
+ popup: Record<string, unknown>
51
+ }
52
+
53
+ /**
54
+ * Partition a modal *Content component's spread props into the Portal and Popup
55
+ * targets. Flat portal props win over the same keys inside `portalProps`.
56
+ *
57
+ * Destructure `className`/`children`, the `backdropProps`/`viewportProps` escape
58
+ * hatches, and any component-specific props (`backdrop`, `closeButton`, …) out of
59
+ * the props object before calling this — everything left that isn't a known
60
+ * Portal prop is treated as a Popup prop.
61
+ */
62
+ export function splitModalProps(props: Record<string, unknown>): SplitModalProps {
63
+ const { portalProps, ...rest } = props as {
64
+ portalProps?: Record<string, unknown>
65
+ } & Record<string, unknown>
66
+
67
+ const portal: Record<string, unknown> = { ...portalProps }
68
+ const popup: Record<string, unknown> = {}
69
+
70
+ for (const key of Object.keys(rest)) {
71
+ const value = rest[key]
72
+ if ((MODAL_PORTAL_KEYS as readonly string[]).includes(key)) {
73
+ if (value !== undefined) portal[key] = value
74
+ } else {
75
+ popup[key] = value
76
+ }
77
+ }
78
+
79
+ return { portal, popup }
80
+ }
@@ -0,0 +1,20 @@
1
+ import { renderHook } from '@testing-library/react'
2
+ import { type ReactNode } from 'react'
3
+ import { describe, expect, it } from 'vitest'
4
+ import { DirectionProvider } from './direction-provider'
5
+ import { useDirection } from '../hooks/use-direction'
6
+
7
+ describe('DirectionProvider', () => {
8
+ it('defaults to ltr with no provider', () => {
9
+ const { result } = renderHook(() => useDirection())
10
+ expect(result.current).toBe('ltr')
11
+ })
12
+
13
+ it('provides the configured direction to descendants', () => {
14
+ const wrapper = ({ children }: { children: ReactNode }) => (
15
+ <DirectionProvider dir="rtl">{children}</DirectionProvider>
16
+ )
17
+ const { result } = renderHook(() => useDirection(), { wrapper })
18
+ expect(result.current).toBe('rtl')
19
+ })
20
+ })
@@ -0,0 +1,26 @@
1
+ import type { ReactNode } from 'react'
2
+ import { DirectionProvider as BaseDirectionProvider } from '@base-ui/react/direction-provider'
3
+
4
+ export type Direction = 'ltr' | 'rtl'
5
+
6
+ export interface DirectionProviderProps {
7
+ children: ReactNode
8
+ /**
9
+ * Reading direction for components with bidirectional layout (Switch, Slider,
10
+ * Carousel, etc.). Matches the HTML `dir` attribute; descendants read it via
11
+ * our `useDirection()` hook. Defaults to `ltr`.
12
+ */
13
+ dir?: Direction
14
+ }
15
+
16
+ /**
17
+ * Sets the reading direction for descendant components. Thin wrapper over Base
18
+ * UI's direction provider so consumers depend on `@appica/ui-react` rather than
19
+ * the underlying primitive.
20
+ *
21
+ * Optional — components default to `ltr` with no provider, so reach for this
22
+ * only when supporting RTL.
23
+ */
24
+ export function DirectionProvider({ children, dir = 'ltr' }: DirectionProviderProps) {
25
+ return <BaseDirectionProvider direction={dir}>{children}</BaseDirectionProvider>
26
+ }
@@ -0,0 +1,42 @@
1
+ import { render, renderHook } from '@testing-library/react'
2
+ import { type ReactNode } from 'react'
3
+ import { describe, expect, it } from 'vitest'
4
+ import { ReducedMotionProvider } from './reduced-motion-provider'
5
+ import { useReducedMotion } from '../hooks/use-reduced-motion'
6
+
7
+ const ATTR = 'data-disable-animations'
8
+
9
+ describe('ReducedMotionProvider', () => {
10
+ it('useReducedMotion is false with no provider (test env reports motion allowed)', () => {
11
+ const { result } = renderHook(() => useReducedMotion())
12
+ expect(result.current).toBe(false)
13
+ })
14
+
15
+ it('forces reduced motion for descendants when disableAnimations is set', () => {
16
+ const wrapper = ({ children }: { children: ReactNode }) => (
17
+ <ReducedMotionProvider disableAnimations>{children}</ReducedMotionProvider>
18
+ )
19
+ const { result } = renderHook(() => useReducedMotion(), { wrapper })
20
+ expect(result.current).toBe(true)
21
+ })
22
+
23
+ it('writes the data-disable-animations attribute on <html> and removes it on unmount', () => {
24
+ const { unmount } = render(
25
+ <ReducedMotionProvider disableAnimations>
26
+ <span />
27
+ </ReducedMotionProvider>,
28
+ )
29
+ expect(document.documentElement.hasAttribute(ATTR)).toBe(true)
30
+ unmount()
31
+ expect(document.documentElement.hasAttribute(ATTR)).toBe(false)
32
+ })
33
+
34
+ it('does not set the attribute when disableAnimations is false', () => {
35
+ render(
36
+ <ReducedMotionProvider>
37
+ <span />
38
+ </ReducedMotionProvider>,
39
+ )
40
+ expect(document.documentElement.hasAttribute(ATTR)).toBe(false)
41
+ })
42
+ })
@@ -0,0 +1,58 @@
1
+ 'use client'
2
+
3
+ import { createContext, use, useEffect, useMemo, type ReactNode } from 'react'
4
+
5
+ export interface ReducedMotionContextValue {
6
+ disableAnimations: boolean
7
+ }
8
+
9
+ const DEFAULT_CONTEXT: ReducedMotionContextValue = {
10
+ disableAnimations: false,
11
+ }
12
+
13
+ const ReducedMotionContext = createContext<ReducedMotionContextValue>(DEFAULT_CONTEXT)
14
+
15
+ export interface ReducedMotionProviderProps {
16
+ children: ReactNode
17
+ /**
18
+ * Force-disable all component animations regardless of OS `prefers-reduced-motion`.
19
+ * Components also respect the OS preference automatically — this is the global override.
20
+ *
21
+ * The attribute is set on `<html>` (not on a wrapper div) so it reaches Base UI's portaled
22
+ * popups, which render under `document.body` and therefore escape the React subtree. The
23
+ * `motion-reduce:` / `motion-safe:` custom variants in styles.css already target
24
+ * `[data-disable-animations] *`.
25
+ */
26
+ disableAnimations?: boolean
27
+ }
28
+
29
+ const ATTR = 'data-disable-animations'
30
+
31
+ /**
32
+ * Opts a subtree out of animation. The JS channel (`useReducedMotion()`) is
33
+ * scoped to this provider's React subtree; the CSS channel (the
34
+ * `motion-reduce:` variant) is driven by a `data-disable-animations` attribute
35
+ * written to `<html>`, so it applies page-wide while mounted and covers
36
+ * portaled popups.
37
+ *
38
+ * Optional — components already respect the OS `prefers-reduced-motion`
39
+ * preference with no provider. Reach for this only to force-disable animations.
40
+ */
41
+ export function ReducedMotionProvider({ children, disableAnimations = false }: ReducedMotionProviderProps) {
42
+ useEffect(() => {
43
+ if (!disableAnimations) return
44
+ const html = document.documentElement
45
+ html.setAttribute(ATTR, '')
46
+ return () => {
47
+ html.removeAttribute(ATTR)
48
+ }
49
+ }, [disableAnimations])
50
+
51
+ const value = useMemo<ReducedMotionContextValue>(() => ({ disableAnimations }), [disableAnimations])
52
+
53
+ return <ReducedMotionContext value={value}>{children}</ReducedMotionContext>
54
+ }
55
+
56
+ export function useReducedMotionContext(): ReducedMotionContextValue {
57
+ return use(ReducedMotionContext)
58
+ }
@@ -0,0 +1,4 @@
1
+ export { ThemeProvider } from './theme-provider'
2
+ export type { ThemeProviderProps, ThemeContextValue } from './theme-provider'
3
+ export { ThemeScript, getThemeScript } from './theme-script'
4
+ export type { ThemeScriptOptions, ThemeScriptProps } from './theme-script'