@appica/ui-react 1.0.0 → 1.2.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 (511) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/README.md +47 -5
  3. package/agent-rules.md +41 -0
  4. package/appica.css +7 -0
  5. package/dist/components/accordion/accordion.d.ts +24 -0
  6. package/dist/components/accordion/accordion.d.ts.map +1 -1
  7. package/dist/components/accordion/accordion.js +2 -1
  8. package/dist/components/accordion/accordion.js.map +1 -1
  9. package/dist/components/alert/alert.d.ts +30 -2
  10. package/dist/components/alert/alert.d.ts.map +1 -1
  11. package/dist/components/alert/alert.js +2 -1
  12. package/dist/components/alert/alert.js.map +1 -1
  13. package/dist/components/alert-dialog/alert-dialog.d.ts +12 -2
  14. package/dist/components/alert-dialog/alert-dialog.d.ts.map +1 -1
  15. package/dist/components/alert-dialog/alert-dialog.js +10 -5
  16. package/dist/components/alert-dialog/alert-dialog.js.map +1 -1
  17. package/dist/components/autocomplete/autocomplete.d.ts +21 -1
  18. package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
  19. package/dist/components/autocomplete/autocomplete.js +3 -2
  20. package/dist/components/autocomplete/autocomplete.js.map +1 -1
  21. package/dist/components/avatar/avatar.d.ts +17 -1
  22. package/dist/components/avatar/avatar.d.ts.map +1 -1
  23. package/dist/components/avatar/avatar.js +2 -1
  24. package/dist/components/avatar/avatar.js.map +1 -1
  25. package/dist/components/background-pattern/background-pattern-interactive.d.ts +2 -1
  26. package/dist/components/background-pattern/background-pattern-interactive.d.ts.map +1 -1
  27. package/dist/components/background-pattern/background-pattern-interactive.js +4 -2
  28. package/dist/components/background-pattern/background-pattern-interactive.js.map +1 -1
  29. package/dist/components/background-pattern/background-pattern-shared.d.ts +3 -2
  30. package/dist/components/background-pattern/background-pattern-shared.d.ts.map +1 -1
  31. package/dist/components/background-pattern/background-pattern-shared.js +48 -16
  32. package/dist/components/background-pattern/background-pattern-shared.js.map +1 -1
  33. package/dist/components/background-pattern/background-pattern.d.ts +13 -5
  34. package/dist/components/background-pattern/background-pattern.d.ts.map +1 -1
  35. package/dist/components/background-pattern/background-pattern.js +13 -4
  36. package/dist/components/background-pattern/background-pattern.js.map +1 -1
  37. package/dist/components/background-pattern/index.js +1 -0
  38. package/dist/components/background-pattern/index.js.map +1 -1
  39. package/dist/components/badge/badge.d.ts +13 -3
  40. package/dist/components/badge/badge.d.ts.map +1 -1
  41. package/dist/components/badge/badge.js +2 -1
  42. package/dist/components/badge/badge.js.map +1 -1
  43. package/dist/components/border-beam/border-beam.d.ts +52 -0
  44. package/dist/components/border-beam/border-beam.d.ts.map +1 -0
  45. package/dist/components/border-beam/border-beam.js +68 -0
  46. package/dist/components/border-beam/border-beam.js.map +1 -0
  47. package/dist/components/breadcrumb/breadcrumb.d.ts +8 -0
  48. package/dist/components/breadcrumb/breadcrumb.d.ts.map +1 -1
  49. package/dist/components/breadcrumb/breadcrumb.js +2 -1
  50. package/dist/components/breadcrumb/breadcrumb.js.map +1 -1
  51. package/dist/components/button/button-variants.d.ts +2 -2
  52. package/dist/components/button/button-variants.js +2 -1
  53. package/dist/components/button/button-variants.js.map +1 -1
  54. package/dist/components/button/button.d.ts +11 -1
  55. package/dist/components/button/button.d.ts.map +1 -1
  56. package/dist/components/button/button.js +2 -1
  57. package/dist/components/button/button.js.map +1 -1
  58. package/dist/components/button/index.js +1 -0
  59. package/dist/components/button/index.js.map +1 -1
  60. package/dist/components/button-group/button-group-context.js +1 -0
  61. package/dist/components/button-group/button-group-context.js.map +1 -1
  62. package/dist/components/button-group/button-group.d.ts +10 -0
  63. package/dist/components/button-group/button-group.d.ts.map +1 -1
  64. package/dist/components/button-group/button-group.js +2 -1
  65. package/dist/components/button-group/button-group.js.map +1 -1
  66. package/dist/components/calendar/calendar.d.ts +5 -0
  67. package/dist/components/calendar/calendar.d.ts.map +1 -1
  68. package/dist/components/calendar/calendar.js +2 -1
  69. package/dist/components/calendar/calendar.js.map +1 -1
  70. package/dist/components/card/card.d.ts +43 -0
  71. package/dist/components/card/card.d.ts.map +1 -0
  72. package/dist/components/card/card.js +104 -0
  73. package/dist/components/card/card.js.map +1 -0
  74. package/dist/components/carousel/carousel.d.ts +106 -6
  75. package/dist/components/carousel/carousel.d.ts.map +1 -1
  76. package/dist/components/carousel/carousel.js +180 -5
  77. package/dist/components/carousel/carousel.js.map +1 -1
  78. package/dist/components/checkbox/checkbox.js +2 -1
  79. package/dist/components/checkbox/checkbox.js.map +1 -1
  80. package/dist/components/checkbox-group/checkbox-group.d.ts +4 -0
  81. package/dist/components/checkbox-group/checkbox-group.d.ts.map +1 -1
  82. package/dist/components/checkbox-group/checkbox-group.js +2 -1
  83. package/dist/components/checkbox-group/checkbox-group.js.map +1 -1
  84. package/dist/components/chip/chip.d.ts +33 -1
  85. package/dist/components/chip/chip.d.ts.map +1 -1
  86. package/dist/components/chip/chip.js +2 -1
  87. package/dist/components/chip/chip.js.map +1 -1
  88. package/dist/components/collapsible/collapsible.js +2 -1
  89. package/dist/components/collapsible/collapsible.js.map +1 -1
  90. package/dist/components/color-area/color-area.d.ts +53 -0
  91. package/dist/components/color-area/color-area.d.ts.map +1 -0
  92. package/dist/components/color-area/color-area.js +246 -0
  93. package/dist/components/color-area/color-area.js.map +1 -0
  94. package/dist/components/color-picker/color-picker.d.ts +152 -0
  95. package/dist/components/color-picker/color-picker.d.ts.map +1 -0
  96. package/dist/components/color-picker/color-picker.js +328 -0
  97. package/dist/components/color-picker/color-picker.js.map +1 -0
  98. package/dist/components/color-slider/color-slider.d.ts +48 -0
  99. package/dist/components/color-slider/color-slider.d.ts.map +1 -0
  100. package/dist/components/color-slider/color-slider.js +217 -0
  101. package/dist/components/color-slider/color-slider.js.map +1 -0
  102. package/dist/components/color-swatch/color-swatch.d.ts +47 -0
  103. package/dist/components/color-swatch/color-swatch.d.ts.map +1 -0
  104. package/dist/components/color-swatch/color-swatch.js +67 -0
  105. package/dist/components/color-swatch/color-swatch.js.map +1 -0
  106. package/dist/components/color-swatch-picker/color-swatch-picker.d.ts +62 -0
  107. package/dist/components/color-swatch-picker/color-swatch-picker.d.ts.map +1 -0
  108. package/dist/components/color-swatch-picker/color-swatch-picker.js +203 -0
  109. package/dist/components/color-swatch-picker/color-swatch-picker.js.map +1 -0
  110. package/dist/components/combobox/combobox.d.ts +25 -1
  111. package/dist/components/combobox/combobox.d.ts.map +1 -1
  112. package/dist/components/combobox/combobox.js +3 -2
  113. package/dist/components/combobox/combobox.js.map +1 -1
  114. package/dist/components/context-menu/context-menu.d.ts +7 -1
  115. package/dist/components/context-menu/context-menu.d.ts.map +1 -1
  116. package/dist/components/context-menu/context-menu.js +11 -5
  117. package/dist/components/context-menu/context-menu.js.map +1 -1
  118. package/dist/components/copy-button/copy-button.d.ts +18 -1
  119. package/dist/components/copy-button/copy-button.d.ts.map +1 -1
  120. package/dist/components/copy-button/copy-button.js +6 -5
  121. package/dist/components/copy-button/copy-button.js.map +1 -1
  122. package/dist/components/countdown/countdown.d.ts +14 -0
  123. package/dist/components/countdown/countdown.d.ts.map +1 -1
  124. package/dist/components/countdown/countdown.js +2 -1
  125. package/dist/components/countdown/countdown.js.map +1 -1
  126. package/dist/components/date-field/date-field.d.ts +35 -0
  127. package/dist/components/date-field/date-field.d.ts.map +1 -1
  128. package/dist/components/date-field/date-field.js +2 -1
  129. package/dist/components/date-field/date-field.js.map +1 -1
  130. package/dist/components/date-picker/date-picker.d.ts +94 -0
  131. package/dist/components/date-picker/date-picker.d.ts.map +1 -1
  132. package/dist/components/date-picker/date-picker.js +2 -1
  133. package/dist/components/date-picker/date-picker.js.map +1 -1
  134. package/dist/components/dialog/dialog.d.ts +20 -2
  135. package/dist/components/dialog/dialog.d.ts.map +1 -1
  136. package/dist/components/dialog/dialog.js +9 -4
  137. package/dist/components/dialog/dialog.js.map +1 -1
  138. package/dist/components/drawer/drawer.d.ts +22 -2
  139. package/dist/components/drawer/drawer.d.ts.map +1 -1
  140. package/dist/components/drawer/drawer.js +14 -7
  141. package/dist/components/drawer/drawer.js.map +1 -1
  142. package/dist/components/dropdown-menu/dropdown-menu.d.ts +7 -1
  143. package/dist/components/dropdown-menu/dropdown-menu.d.ts.map +1 -1
  144. package/dist/components/dropdown-menu/dropdown-menu.js +11 -5
  145. package/dist/components/dropdown-menu/dropdown-menu.js.map +1 -1
  146. package/dist/components/field/field.js +2 -1
  147. package/dist/components/field/field.js.map +1 -1
  148. package/dist/components/fieldset/fieldset.js +2 -1
  149. package/dist/components/fieldset/fieldset.js.map +1 -1
  150. package/dist/components/form/form.js +1 -0
  151. package/dist/components/form/form.js.map +1 -1
  152. package/dist/components/gradient-glow/gradient-glow.d.ts +51 -1
  153. package/dist/components/gradient-glow/gradient-glow.d.ts.map +1 -1
  154. package/dist/components/gradient-glow/gradient-glow.js +5 -3
  155. package/dist/components/gradient-glow/gradient-glow.js.map +1 -1
  156. package/dist/components/input/index.js +1 -0
  157. package/dist/components/input/index.js.map +1 -1
  158. package/dist/components/input/input-variants.d.ts +1 -1
  159. package/dist/components/input/input-variants.js +2 -1
  160. package/dist/components/input/input-variants.js.map +1 -1
  161. package/dist/components/input/input.d.ts +21 -1
  162. package/dist/components/input/input.d.ts.map +1 -1
  163. package/dist/components/input/input.js +4 -3
  164. package/dist/components/input/input.js.map +1 -1
  165. package/dist/components/kbd/kbd.d.ts +8 -0
  166. package/dist/components/kbd/kbd.d.ts.map +1 -1
  167. package/dist/components/kbd/kbd.js +2 -1
  168. package/dist/components/kbd/kbd.js.map +1 -1
  169. package/dist/components/loader/loader.d.ts +8 -0
  170. package/dist/components/loader/loader.d.ts.map +1 -1
  171. package/dist/components/loader/loader.js +2 -1
  172. package/dist/components/loader/loader.js.map +1 -1
  173. package/dist/components/menubar/menubar.d.ts +8 -0
  174. package/dist/components/menubar/menubar.d.ts.map +1 -1
  175. package/dist/components/menubar/menubar.js +2 -1
  176. package/dist/components/menubar/menubar.js.map +1 -1
  177. package/dist/components/meter/meter.d.ts +4 -0
  178. package/dist/components/meter/meter.d.ts.map +1 -1
  179. package/dist/components/meter/meter.js +2 -1
  180. package/dist/components/meter/meter.js.map +1 -1
  181. package/dist/components/navigation/index.js +1 -0
  182. package/dist/components/navigation/index.js.map +1 -1
  183. package/dist/components/navigation/navigation-context.js +1 -0
  184. package/dist/components/navigation/navigation-context.js.map +1 -1
  185. package/dist/components/navigation/navigation-link-variants.d.ts +2 -2
  186. package/dist/components/navigation/navigation-link-variants.js +2 -1
  187. package/dist/components/navigation/navigation-link-variants.js.map +1 -1
  188. package/dist/components/navigation/navigation-link.d.ts +22 -0
  189. package/dist/components/navigation/navigation-link.d.ts.map +1 -1
  190. package/dist/components/navigation/navigation-link.js +2 -1
  191. package/dist/components/navigation/navigation-link.js.map +1 -1
  192. package/dist/components/navigation/navigation.d.ts +12 -0
  193. package/dist/components/navigation/navigation.d.ts.map +1 -1
  194. package/dist/components/navigation/navigation.js +2 -1
  195. package/dist/components/navigation/navigation.js.map +1 -1
  196. package/dist/components/navigation-menu/navigation-menu.d.ts +33 -0
  197. package/dist/components/navigation-menu/navigation-menu.d.ts.map +1 -1
  198. package/dist/components/navigation-menu/navigation-menu.js +2 -1
  199. package/dist/components/navigation-menu/navigation-menu.js.map +1 -1
  200. package/dist/components/number-field/number-field.d.ts +14 -0
  201. package/dist/components/number-field/number-field.d.ts.map +1 -1
  202. package/dist/components/number-field/number-field.js +2 -1
  203. package/dist/components/number-field/number-field.js.map +1 -1
  204. package/dist/components/otp-field/otp-field.d.ts +9 -0
  205. package/dist/components/otp-field/otp-field.d.ts.map +1 -1
  206. package/dist/components/otp-field/otp-field.js +2 -1
  207. package/dist/components/otp-field/otp-field.js.map +1 -1
  208. package/dist/components/pagination/pagination.d.ts +16 -0
  209. package/dist/components/pagination/pagination.d.ts.map +1 -1
  210. package/dist/components/pagination/pagination.js +2 -1
  211. package/dist/components/pagination/pagination.js.map +1 -1
  212. package/dist/components/popover/popover.d.ts +5 -1
  213. package/dist/components/popover/popover.d.ts.map +1 -1
  214. package/dist/components/popover/popover.js +3 -2
  215. package/dist/components/popover/popover.js.map +1 -1
  216. package/dist/components/preview-card/preview-card.d.ts +5 -1
  217. package/dist/components/preview-card/preview-card.d.ts.map +1 -1
  218. package/dist/components/preview-card/preview-card.js +3 -2
  219. package/dist/components/preview-card/preview-card.js.map +1 -1
  220. package/dist/components/progress/progress.d.ts +17 -0
  221. package/dist/components/progress/progress.d.ts.map +1 -1
  222. package/dist/components/progress/progress.js +2 -1
  223. package/dist/components/progress/progress.js.map +1 -1
  224. package/dist/components/radio/radio.js +2 -1
  225. package/dist/components/radio/radio.js.map +1 -1
  226. package/dist/components/radio-group/radio-group.d.ts +4 -0
  227. package/dist/components/radio-group/radio-group.d.ts.map +1 -1
  228. package/dist/components/radio-group/radio-group.js +2 -1
  229. package/dist/components/radio-group/radio-group.js.map +1 -1
  230. package/dist/components/rating/rating.d.ts +79 -0
  231. package/dist/components/rating/rating.d.ts.map +1 -0
  232. package/dist/components/rating/rating.js +302 -0
  233. package/dist/components/rating/rating.js.map +1 -0
  234. package/dist/components/scroll-area/scroll-area.d.ts +13 -0
  235. package/dist/components/scroll-area/scroll-area.d.ts.map +1 -1
  236. package/dist/components/scroll-area/scroll-area.js +2 -1
  237. package/dist/components/scroll-area/scroll-area.js.map +1 -1
  238. package/dist/components/select/select.d.ts +20 -1
  239. package/dist/components/select/select.d.ts.map +1 -1
  240. package/dist/components/select/select.js +3 -2
  241. package/dist/components/select/select.js.map +1 -1
  242. package/dist/components/separator/separator.d.ts +4 -0
  243. package/dist/components/separator/separator.d.ts.map +1 -1
  244. package/dist/components/separator/separator.js +2 -1
  245. package/dist/components/separator/separator.js.map +1 -1
  246. package/dist/components/skeleton/skeleton.d.ts +4 -0
  247. package/dist/components/skeleton/skeleton.d.ts.map +1 -1
  248. package/dist/components/skeleton/skeleton.js +2 -1
  249. package/dist/components/skeleton/skeleton.js.map +1 -1
  250. package/dist/components/slider/slider.d.ts +5 -0
  251. package/dist/components/slider/slider.d.ts.map +1 -1
  252. package/dist/components/slider/slider.js +2 -1
  253. package/dist/components/slider/slider.js.map +1 -1
  254. package/dist/components/sparkline/sparkline.d.ts +44 -0
  255. package/dist/components/sparkline/sparkline.d.ts.map +1 -1
  256. package/dist/components/sparkline/sparkline.js +2 -1
  257. package/dist/components/sparkline/sparkline.js.map +1 -1
  258. package/dist/components/spinner/spinner.d.ts +8 -0
  259. package/dist/components/spinner/spinner.d.ts.map +1 -1
  260. package/dist/components/spinner/spinner.js +2 -1
  261. package/dist/components/spinner/spinner.js.map +1 -1
  262. package/dist/components/switch/switch.d.ts +19 -15
  263. package/dist/components/switch/switch.d.ts.map +1 -1
  264. package/dist/components/switch/switch.js +2 -1
  265. package/dist/components/switch/switch.js.map +1 -1
  266. package/dist/components/table/table.d.ts +28 -0
  267. package/dist/components/table/table.d.ts.map +1 -1
  268. package/dist/components/table/table.js +2 -1
  269. package/dist/components/table/table.js.map +1 -1
  270. package/dist/components/tabs/tabs.d.ts +32 -2
  271. package/dist/components/tabs/tabs.d.ts.map +1 -1
  272. package/dist/components/tabs/tabs.js +2 -1
  273. package/dist/components/tabs/tabs.js.map +1 -1
  274. package/dist/components/text-animate/text-animate.d.ts +31 -0
  275. package/dist/components/text-animate/text-animate.d.ts.map +1 -1
  276. package/dist/components/text-animate/text-animate.js +27 -9
  277. package/dist/components/text-animate/text-animate.js.map +1 -1
  278. package/dist/components/textarea/textarea.d.ts +15 -0
  279. package/dist/components/textarea/textarea.d.ts.map +1 -1
  280. package/dist/components/textarea/textarea.js +2 -1
  281. package/dist/components/textarea/textarea.js.map +1 -1
  282. package/dist/components/thumbnail/thumbnail.d.ts +22 -2
  283. package/dist/components/thumbnail/thumbnail.d.ts.map +1 -1
  284. package/dist/components/thumbnail/thumbnail.js +2 -1
  285. package/dist/components/thumbnail/thumbnail.js.map +1 -1
  286. package/dist/components/time-field/time-field.d.ts +35 -0
  287. package/dist/components/time-field/time-field.d.ts.map +1 -1
  288. package/dist/components/time-field/time-field.js +2 -1
  289. package/dist/components/time-field/time-field.js.map +1 -1
  290. package/dist/components/toast/toast.d.ts +18 -0
  291. package/dist/components/toast/toast.d.ts.map +1 -1
  292. package/dist/components/toast/toast.js +2 -1
  293. package/dist/components/toast/toast.js.map +1 -1
  294. package/dist/components/toc/toc.d.ts +10 -0
  295. package/dist/components/toc/toc.d.ts.map +1 -1
  296. package/dist/components/toc/toc.js +2 -1
  297. package/dist/components/toc/toc.js.map +1 -1
  298. package/dist/components/toggle/toggle.js +1 -0
  299. package/dist/components/toggle/toggle.js.map +1 -1
  300. package/dist/components/toggle-group/toggle-group.js +2 -1
  301. package/dist/components/toggle-group/toggle-group.js.map +1 -1
  302. package/dist/components/toolbar/toolbar.js +2 -1
  303. package/dist/components/toolbar/toolbar.js.map +1 -1
  304. package/dist/components/tooltip/tooltip.d.ts +5 -1
  305. package/dist/components/tooltip/tooltip.d.ts.map +1 -1
  306. package/dist/components/tooltip/tooltip.js +3 -2
  307. package/dist/components/tooltip/tooltip.js.map +1 -1
  308. package/dist/hooks/use-direction.js +1 -0
  309. package/dist/hooks/use-direction.js.map +1 -1
  310. package/dist/hooks/use-dismissible.d.ts +4 -0
  311. package/dist/hooks/use-dismissible.d.ts.map +1 -1
  312. package/dist/hooks/use-dismissible.js +1 -0
  313. package/dist/hooks/use-dismissible.js.map +1 -1
  314. package/dist/hooks/use-local-storage.js +1 -0
  315. package/dist/hooks/use-local-storage.js.map +1 -1
  316. package/dist/hooks/use-media-query.js +1 -0
  317. package/dist/hooks/use-media-query.js.map +1 -1
  318. package/dist/hooks/use-reduced-motion.d.ts +1 -1
  319. package/dist/hooks/use-reduced-motion.js +1 -0
  320. package/dist/hooks/use-reduced-motion.js.map +1 -1
  321. package/dist/hooks/use-theme.d.ts +1 -1
  322. package/dist/hooks/use-theme.js +1 -0
  323. package/dist/hooks/use-theme.js.map +1 -1
  324. package/dist/index.d.ts +9 -0
  325. package/dist/index.d.ts.map +1 -1
  326. package/dist/index.js +11 -1
  327. package/dist/index.js.map +1 -1
  328. package/dist/internal/color-control.d.ts +75 -0
  329. package/dist/internal/color-control.d.ts.map +1 -0
  330. package/dist/internal/color-control.js +79 -0
  331. package/dist/internal/color-control.js.map +1 -0
  332. package/dist/internal/color-math.d.ts +9 -0
  333. package/dist/internal/color-math.d.ts.map +1 -0
  334. package/dist/internal/color-math.js +35 -0
  335. package/dist/internal/color-math.js.map +1 -0
  336. package/dist/internal/color-picker-context.d.ts +34 -0
  337. package/dist/internal/color-picker-context.d.ts.map +1 -0
  338. package/dist/internal/color-picker-context.js +42 -0
  339. package/dist/internal/color-picker-context.js.map +1 -0
  340. package/dist/{floating.d.ts → internal/floating.d.ts} +3 -3
  341. package/dist/internal/floating.d.ts.map +1 -0
  342. package/dist/{floating.js → internal/floating.js} +1 -0
  343. package/dist/internal/floating.js.map +1 -0
  344. package/dist/{modal.d.ts → internal/modal.d.ts} +2 -2
  345. package/dist/internal/modal.d.ts.map +1 -0
  346. package/dist/{modal.js → internal/modal.js} +1 -0
  347. package/dist/internal/modal.js.map +1 -0
  348. package/dist/{utils.d.ts → internal/utils.d.ts} +2 -2
  349. package/dist/internal/utils.d.ts.map +1 -0
  350. package/dist/{utils.js → internal/utils.js} +1 -0
  351. package/dist/internal/utils.js.map +1 -0
  352. package/dist/lib/color.d.ts +95 -0
  353. package/dist/lib/color.d.ts.map +1 -0
  354. package/dist/lib/color.js +329 -0
  355. package/dist/lib/color.js.map +1 -0
  356. package/dist/providers/direction-provider.d.ts +4 -4
  357. package/dist/providers/direction-provider.d.ts.map +1 -1
  358. package/dist/providers/direction-provider.js +1 -0
  359. package/dist/providers/direction-provider.js.map +1 -1
  360. package/dist/providers/reduced-motion-provider.d.ts +4 -8
  361. package/dist/providers/reduced-motion-provider.d.ts.map +1 -1
  362. package/dist/providers/reduced-motion-provider.js +1 -0
  363. package/dist/providers/reduced-motion-provider.js.map +1 -1
  364. package/dist/providers/theme-provider/index.js +1 -0
  365. package/dist/providers/theme-provider/index.js.map +1 -1
  366. package/dist/providers/theme-provider/theme-provider.d.ts +28 -12
  367. package/dist/providers/theme-provider/theme-provider.d.ts.map +1 -1
  368. package/dist/providers/theme-provider/theme-provider.js +1 -0
  369. package/dist/providers/theme-provider/theme-provider.js.map +1 -1
  370. package/dist/providers/theme-provider/theme-script.js +1 -0
  371. package/dist/providers/theme-provider/theme-script.js.map +1 -1
  372. package/package.json +91 -31
  373. package/src/components/accordion/accordion.tsx +25 -1
  374. package/src/components/alert/alert.tsx +30 -2
  375. package/src/components/alert-dialog/alert-dialog.test.tsx +34 -2
  376. package/src/components/alert-dialog/alert-dialog.tsx +21 -5
  377. package/src/components/autocomplete/autocomplete.test.tsx +1 -1
  378. package/src/components/autocomplete/autocomplete.tsx +22 -2
  379. package/src/components/avatar/avatar.test.tsx +2 -2
  380. package/src/components/avatar/avatar.tsx +17 -1
  381. package/src/components/background-pattern/background-pattern-interactive.tsx +4 -2
  382. package/src/components/background-pattern/background-pattern-shared.tsx +56 -19
  383. package/src/components/background-pattern/background-pattern.test.tsx +36 -1
  384. package/src/components/background-pattern/background-pattern.tsx +24 -9
  385. package/src/components/badge/badge.tsx +14 -2
  386. package/src/components/border-beam/border-beam.test.tsx +91 -0
  387. package/src/components/border-beam/border-beam.tsx +131 -0
  388. package/src/components/breadcrumb/breadcrumb.tsx +9 -1
  389. package/src/components/button/button-variants.ts +1 -1
  390. package/src/components/button/button.tsx +13 -2
  391. package/src/components/button-group/button-group.tsx +11 -1
  392. package/src/components/calendar/calendar.tsx +6 -1
  393. package/src/components/card/card.test.tsx +98 -0
  394. package/src/components/card/card.tsx +154 -0
  395. package/src/components/carousel/carousel.test.tsx +179 -0
  396. package/src/components/carousel/carousel.tsx +329 -6
  397. package/src/components/checkbox/checkbox.test.tsx +2 -2
  398. package/src/components/checkbox/checkbox.tsx +1 -1
  399. package/src/components/checkbox-group/checkbox-group.tsx +5 -1
  400. package/src/components/chip/chip.tsx +33 -1
  401. package/src/components/collapsible/collapsible.tsx +1 -1
  402. package/src/components/color-area/color-area.test.tsx +242 -0
  403. package/src/components/color-area/color-area.tsx +356 -0
  404. package/src/components/color-picker/color-picker.test.tsx +286 -0
  405. package/src/components/color-picker/color-picker.tsx +546 -0
  406. package/src/components/color-slider/color-slider.test.tsx +222 -0
  407. package/src/components/color-slider/color-slider.tsx +330 -0
  408. package/src/components/color-swatch/color-swatch.test.tsx +117 -0
  409. package/src/components/color-swatch/color-swatch.tsx +119 -0
  410. package/src/components/color-swatch-picker/color-swatch-picker.test.tsx +287 -0
  411. package/src/components/color-swatch-picker/color-swatch-picker.tsx +327 -0
  412. package/src/components/combobox/combobox.test.tsx +1 -1
  413. package/src/components/combobox/combobox.tsx +26 -2
  414. package/src/components/context-menu/context-menu.test.tsx +28 -0
  415. package/src/components/context-menu/context-menu.tsx +16 -5
  416. package/src/components/copy-button/copy-button.test.tsx +14 -1
  417. package/src/components/copy-button/copy-button.tsx +27 -6
  418. package/src/components/countdown/countdown.tsx +15 -1
  419. package/src/components/date-field/date-field.tsx +36 -1
  420. package/src/components/date-picker/date-picker.test.tsx +1 -1
  421. package/src/components/date-picker/date-picker.tsx +95 -1
  422. package/src/components/dialog/dialog.test.tsx +30 -1
  423. package/src/components/dialog/dialog.tsx +28 -6
  424. package/src/components/drawer/drawer.test.tsx +32 -1
  425. package/src/components/drawer/drawer.tsx +37 -7
  426. package/src/components/dropdown-menu/dropdown-menu.test.tsx +28 -0
  427. package/src/components/dropdown-menu/dropdown-menu.tsx +16 -5
  428. package/src/components/field/field.tsx +1 -1
  429. package/src/components/fieldset/fieldset.tsx +1 -1
  430. package/src/components/gradient-glow/gradient-glow.test.tsx +7 -1
  431. package/src/components/gradient-glow/gradient-glow.tsx +64 -11
  432. package/src/components/input/input-variants.ts +1 -1
  433. package/src/components/input/input.tsx +24 -4
  434. package/src/components/kbd/kbd.tsx +9 -1
  435. package/src/components/loader/loader.tsx +9 -1
  436. package/src/components/menubar/menubar.tsx +9 -1
  437. package/src/components/meter/meter.tsx +5 -1
  438. package/src/components/navigation/navigation-link-variants.ts +1 -1
  439. package/src/components/navigation/navigation-link.tsx +23 -1
  440. package/src/components/navigation/navigation.tsx +23 -3
  441. package/src/components/navigation-menu/navigation-menu.tsx +34 -1
  442. package/src/components/number-field/number-field.tsx +15 -1
  443. package/src/components/otp-field/otp-field.tsx +10 -1
  444. package/src/components/pagination/pagination.tsx +17 -1
  445. package/src/components/popover/popover.test.tsx +1 -1
  446. package/src/components/popover/popover.tsx +6 -2
  447. package/src/components/preview-card/preview-card.tsx +6 -2
  448. package/src/components/progress/progress.tsx +18 -1
  449. package/src/components/radio/radio.test.tsx +1 -1
  450. package/src/components/radio/radio.tsx +1 -1
  451. package/src/components/radio-group/radio-group.test.tsx +1 -1
  452. package/src/components/radio-group/radio-group.tsx +5 -1
  453. package/src/components/rating/rating.test.tsx +246 -0
  454. package/src/components/rating/rating.tsx +457 -0
  455. package/src/components/scroll-area/scroll-area.test.tsx +1 -1
  456. package/src/components/scroll-area/scroll-area.tsx +14 -1
  457. package/src/components/select/select.tsx +21 -2
  458. package/src/components/separator/separator.tsx +5 -1
  459. package/src/components/skeleton/skeleton.tsx +5 -1
  460. package/src/components/slider/slider.test.tsx +1 -1
  461. package/src/components/slider/slider.tsx +6 -1
  462. package/src/components/sparkline/sparkline.test.tsx +1 -1
  463. package/src/components/sparkline/sparkline.tsx +45 -1
  464. package/src/components/spinner/spinner.tsx +9 -1
  465. package/src/components/switch/switch.test.tsx +1 -1
  466. package/src/components/switch/switch.tsx +5 -1
  467. package/src/components/table/table.tsx +29 -1
  468. package/src/components/tabs/tabs.test.tsx +1 -1
  469. package/src/components/tabs/tabs.tsx +33 -2
  470. package/src/components/text-animate/text-animate.test.tsx +62 -0
  471. package/src/components/text-animate/text-animate.tsx +77 -9
  472. package/src/components/textarea/textarea.tsx +16 -1
  473. package/src/components/thumbnail/thumbnail.test.tsx +1 -1
  474. package/src/components/thumbnail/thumbnail.tsx +21 -1
  475. package/src/components/time-field/time-field.tsx +36 -1
  476. package/src/components/toast/toast.test.tsx +1 -1
  477. package/src/components/toast/toast.tsx +19 -1
  478. package/src/components/toc/toc.tsx +11 -1
  479. package/src/components/toggle/toggle.test.tsx +1 -1
  480. package/src/components/toggle-group/toggle-group.tsx +1 -1
  481. package/src/components/toolbar/toolbar.tsx +1 -1
  482. package/src/components/tooltip/tooltip.test.tsx +1 -1
  483. package/src/components/tooltip/tooltip.tsx +6 -2
  484. package/src/hooks/use-dismissible.ts +4 -0
  485. package/src/hooks/use-local-storage.ts +3 -3
  486. package/src/hooks/use-reduced-motion.ts +1 -1
  487. package/src/hooks/use-theme.ts +1 -1
  488. package/src/index.ts +11 -2
  489. package/src/internal/color-control.ts +178 -0
  490. package/src/internal/color-math.ts +44 -0
  491. package/src/internal/color-picker-context.ts +80 -0
  492. package/src/{floating.ts → internal/floating.ts} +3 -3
  493. package/src/{modal.ts → internal/modal.ts} +3 -3
  494. package/src/lib/color.test.ts +178 -0
  495. package/src/lib/color.ts +471 -0
  496. package/src/providers/direction-provider.tsx +4 -4
  497. package/src/providers/reduced-motion-provider.tsx +4 -8
  498. package/src/providers/theme-provider/theme-provider.tsx +28 -12
  499. package/src/providers/theme-provider/theme-script.tsx +2 -2
  500. package/src/test/setup.ts +1 -1
  501. package/styles.css +28 -4
  502. package/dist/floating.d.ts.map +0 -1
  503. package/dist/floating.js.map +0 -1
  504. package/dist/modal.d.ts.map +0 -1
  505. package/dist/modal.js.map +0 -1
  506. package/dist/utils.d.ts.map +0 -1
  507. package/dist/utils.js.map +0 -1
  508. /package/src/{floating.test.ts → internal/floating.test.ts} +0 -0
  509. /package/src/{modal.test.ts → internal/modal.test.ts} +0 -0
  510. /package/src/{utils.test.tsx → internal/utils.test.tsx} +0 -0
  511. /package/src/{utils.ts → internal/utils.ts} +0 -0
@@ -3,7 +3,7 @@
3
3
  import * as React from 'react'
4
4
  import { Toast as BaseToast } from '@base-ui/react/toast'
5
5
  import { type VariantProps } from 'class-variance-authority'
6
- import { cn } from '../../utils'
6
+ import { cn } from '../../internal/utils'
7
7
  import { useDirection } from '../../hooks/use-direction'
8
8
  import { buttonVariants } from '../button/button-variants'
9
9
 
@@ -83,10 +83,28 @@ function ToastProvider(props: ToastProviderProps) {
83
83
  }
84
84
 
85
85
  interface ToasterProps extends Omit<BaseToast.Viewport.Props, 'children'> {
86
+ /**
87
+ * Where the stack is anchored; also sets the default swipe-to-dismiss directions.
88
+ * @default 'bottom-right'
89
+ */
86
90
  position?: ToastPosition
91
+ /**
92
+ * Opt in to a countdown progress bar on auto-dismissing toasts.
93
+ * @default false
94
+ */
87
95
  progress?: boolean
96
+ /**
97
+ * Provider default (ms) used to size the progress bar for toasts that don't set their own `timeout`. Match your
98
+ * `ToastProvider`'s `timeout`.
99
+ * @default 5000
100
+ */
88
101
  timeout?: number
102
+ /**
103
+ * Portal target - scope the toasts to a specific element.
104
+ * @default document.body
105
+ */
89
106
  container?: React.ComponentProps<typeof BaseToast.Portal>['container']
107
+ /** Escape hatch forwarded to the underlying `Toast.Portal`. */
90
108
  portalProps?: Omit<React.ComponentProps<typeof BaseToast.Portal>, 'children'>
91
109
  }
92
110
 
@@ -3,7 +3,7 @@
3
3
  import * as React from 'react'
4
4
  import { mergeProps } from '@base-ui/react/merge-props'
5
5
  import { useRender } from '@base-ui/react/use-render'
6
- import { cn } from '../../utils'
6
+ import { cn } from '../../internal/utils'
7
7
 
8
8
  type TocContextValue = {
9
9
  activeIds: readonly string[]
@@ -41,6 +41,11 @@ function closestHeadingId(ids: readonly string[], rootBounds: DOMRectReadOnly |
41
41
  }
42
42
 
43
43
  interface TocProps extends React.ComponentPropsWithoutRef<'nav'> {
44
+ /**
45
+ * `IntersectionObserver` `rootMargin` (`top right bottom left`) - offset the active boundary, e.g. for a sticky
46
+ * header.
47
+ * @default '0px'
48
+ */
44
49
  rootMargin?: string
45
50
  }
46
51
 
@@ -187,7 +192,12 @@ const DEPTH_INDENT: Record<number, string> = {
187
192
  }
188
193
 
189
194
  interface TocLinkProps extends useRender.ComponentProps<'a', TocLinkState> {
195
+ /** **Required.** The target heading, as a hash (`#id`). The `id` after `#` is the heading observed. */
190
196
  href: string
197
+ /**
198
+ * Heading level (2-6); controls the indentation. Higher = deeper indent.
199
+ * @default 2
200
+ */
191
201
  depth?: number
192
202
  }
193
203
 
@@ -78,7 +78,7 @@ describe('Toggle', () => {
78
78
  expect(onPressedChange).not.toHaveBeenCalled()
79
79
  })
80
80
 
81
- it('honours controlled pressed prop', async () => {
81
+ it('honors controlled pressed prop', async () => {
82
82
  const user = userEvent.setup()
83
83
  const onPressedChange = vi.fn()
84
84
  render(
@@ -1,5 +1,5 @@
1
1
  import { ToggleGroup as BaseToggleGroup } from '@base-ui/react/toggle-group'
2
- import { cn } from '../../utils'
2
+ import { cn } from '../../internal/utils'
3
3
 
4
4
  interface ToggleGroupProps extends BaseToggleGroup.Props {}
5
5
 
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react'
2
2
  import { Toolbar as BaseToolbar } from '@base-ui/react/toolbar'
3
- import { cn } from '../../utils'
3
+ import { cn } from '../../internal/utils'
4
4
 
5
5
  interface ToolbarProps extends React.ComponentProps<typeof BaseToolbar.Root> {}
6
6
 
@@ -59,7 +59,7 @@ describe('Tooltip', () => {
59
59
  await user.hover(screen.getByRole('button', { name: 'Hover' }))
60
60
 
61
61
  await screen.findByText('Add to library')
62
- // Popup is portaled — query at document level.
62
+ // Popup is portaled - query at document level.
63
63
  const arrow = document.querySelector('[data-slot="tooltip-arrow"]') as HTMLElement | null
64
64
  expect(arrow).not.toBeNull()
65
65
  expect(arrow!.className).toContain('size-2.5')
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react'
2
2
  import { Tooltip as BaseTooltip } from '@base-ui/react/tooltip'
3
- import { cn } from '../../utils'
4
- import { type FloatingContentProps, splitFloatingProps } from '../../floating'
3
+ import { cn } from '../../internal/utils'
4
+ import { type FloatingContentProps, splitFloatingProps } from '../../internal/floating'
5
5
 
6
6
  type TooltipProviderProps = React.ComponentProps<typeof BaseTooltip.Provider>
7
7
 
@@ -26,6 +26,10 @@ type TooltipContentProps = React.ComponentProps<typeof BaseTooltip.Popup> &
26
26
  React.ComponentProps<typeof BaseTooltip.Positioner>,
27
27
  React.ComponentProps<typeof BaseTooltip.Portal>
28
28
  > & {
29
+ /**
30
+ * Render the pointer.
31
+ * @default true
32
+ */
29
33
  arrow?: boolean
30
34
  }
31
35
 
@@ -4,12 +4,16 @@ import { useCallback, useMemo } from 'react'
4
4
  import { useStorage, type StorageBackend } from './use-local-storage'
5
5
 
6
6
  export interface UseDismissibleOptions {
7
+ /** Which Web Storage area the dismissal is persisted to. */
7
8
  storage?: StorageBackend
8
9
  }
9
10
 
10
11
  export interface UseDismissibleReturn {
12
+ /** Whether the surface should show (`true` until dismissed) */
11
13
  open: boolean
14
+ /** Mark it dismissed and persist that */
12
15
  dismiss: () => void
16
+ /** Clear the dismissal so it shows again */
13
17
  reset: () => void
14
18
  }
15
19
 
@@ -43,8 +43,8 @@ function getStore(backend: StorageBackend): Storage | null {
43
43
  }
44
44
  }
45
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.
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
48
  let globalListenerCount = 0
49
49
 
50
50
  function handleGlobalStorage(e: StorageEvent) {
@@ -105,7 +105,7 @@ export function useStorage<T>(
105
105
  deserializeRef.current = options.deserializer
106
106
 
107
107
  const read = useCallback((): T => {
108
- // An empty key means "no persistence" — behave like storage is unavailable
108
+ // An empty key means "no persistence" - behave like storage is unavailable
109
109
  // instead of touching `getItem('')` and registering a listener.
110
110
  if (!key) return defaultRef.current
111
111
  const store = getStore(backend)
@@ -6,7 +6,7 @@ import { useReducedMotionContext } from '../providers/reduced-motion-provider'
6
6
  const QUERY = '(prefers-reduced-motion: reduce)'
7
7
 
8
8
  /**
9
- * Returns `true` when animations should be skipped — either because the OS
9
+ * Returns `true` when animations should be skipped - either because the OS
10
10
  * exposes `prefers-reduced-motion: reduce` or because a parent
11
11
  * `<ReducedMotionProvider disableAnimations>` opted out globally.
12
12
  */
@@ -8,7 +8,7 @@ export type UseThemeReturn = ThemeContextValue
8
8
  * Read and control the active theme. Returns the stored `theme`, the
9
9
  * `resolvedTheme` (`'system'` resolved to `'light'`/`'dark'`), `systemTheme`,
10
10
  * the available `themes`, any `forcedTheme`, a `setTheme` setter, and
11
- * `mounted` — guard theme-dependent UI (e.g. a sun/moon icon) with `mounted`
11
+ * `mounted` - guard theme-dependent UI (e.g. a sun/moon icon) with `mounted`
12
12
  * to avoid hydration mismatches. Returns inert values with no `<ThemeProvider>`.
13
13
  */
14
14
  export function useTheme(): UseThemeReturn {
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
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.
1
+ // Auto-generated by scripts/sync-exports.mjs from src/{components,lib,hooks,providers}/*.
2
+ // Do not edit by hand - your changes will be overwritten on the next build.
3
3
 
4
4
  export * from './components/accordion/accordion'
5
5
  export * from './components/alert/alert'
@@ -8,15 +8,22 @@ export * from './components/autocomplete/autocomplete'
8
8
  export * from './components/avatar/avatar'
9
9
  export * from './components/background-pattern/index'
10
10
  export * from './components/badge/badge'
11
+ export * from './components/border-beam/border-beam'
11
12
  export * from './components/breadcrumb/breadcrumb'
12
13
  export * from './components/button/index'
13
14
  export * from './components/button-group/button-group'
14
15
  export * from './components/calendar/calendar'
16
+ export * from './components/card/card'
15
17
  export * from './components/carousel/carousel'
16
18
  export * from './components/checkbox/checkbox'
17
19
  export * from './components/checkbox-group/checkbox-group'
18
20
  export * from './components/chip/chip'
19
21
  export * from './components/collapsible/collapsible'
22
+ export * from './components/color-area/color-area'
23
+ export * from './components/color-picker/color-picker'
24
+ export * from './components/color-slider/color-slider'
25
+ export * from './components/color-swatch/color-swatch'
26
+ export * from './components/color-swatch-picker/color-swatch-picker'
20
27
  export * from './components/combobox/combobox'
21
28
  export * from './components/context-menu/context-menu'
22
29
  export * from './components/copy-button/copy-button'
@@ -45,6 +52,7 @@ export * from './components/preview-card/preview-card'
45
52
  export * from './components/progress/progress'
46
53
  export * from './components/radio/radio'
47
54
  export * from './components/radio-group/radio-group'
55
+ export * from './components/rating/rating'
48
56
  export * from './components/scroll-area/scroll-area'
49
57
  export * from './components/select/select'
50
58
  export * from './components/separator/separator'
@@ -65,6 +73,7 @@ export * from './components/toggle/toggle'
65
73
  export * from './components/toggle-group/toggle-group'
66
74
  export * from './components/toolbar/toolbar'
67
75
  export * from './components/tooltip/tooltip'
76
+ export * from './lib/color'
68
77
  export * from './hooks/use-direction'
69
78
  export * from './hooks/use-dismissible'
70
79
  export * from './hooks/use-local-storage'
@@ -0,0 +1,178 @@
1
+ // Shared plumbing for the color components (ColorArea, ColorSlider, ColorSwatch,
2
+ // ColorSwatchPicker, ColorPicker). Keeping the border, the disabled treatment, the thumb, the
3
+ // size ladder and the snapping here is what stops them from drifting apart visually.
4
+ // Internal: nothing here is re-exported from the package.
5
+
6
+ import {
7
+ type Color,
8
+ type ColorChannel,
9
+ type ColorSpace,
10
+ convertColor,
11
+ getColorChannels,
12
+ parseColor,
13
+ } from '../lib/color'
14
+
15
+ /** Group name both control roots carry, so the shared thumb can react to either. */
16
+ export const COLOR_CONTROL_GROUP = 'group/color-control'
17
+
18
+ /**
19
+ * Inert, dimmed and flat-filled: the disabled treatment every color component shares.
20
+ * The flat fill only shows because the components withhold their inline background
21
+ * when disabled, leaving this class to paint.
22
+ */
23
+ export const colorControlDisabledClasses =
24
+ 'data-disabled:pointer-events-none data-disabled:opacity-disabled data-disabled:bg-background-muted'
25
+
26
+ /**
27
+ * That treatment plus the focus ring and gesture guards, for the two controls a
28
+ * pointer drags. A swatch takes the disabled classes alone: `touch-none` there would
29
+ * cost a palette its touch scrolling.
30
+ */
31
+ export const colorControlRootClasses = `outline-ring relative isolate touch-none select-none forced-color-adjust-none outline-offset-2 has-focus-visible:outline-3 ${colorControlDisabledClasses}`
32
+
33
+ /**
34
+ * Hairline over the color, so a pale one still reads as a bounded surface, and
35
+ * the dashed outline that replaces it when disabled. Both live on this overlay rather
36
+ * than the root: a border on the root would shrink the padding box the thumb is
37
+ * positioned against, nudging it a pixel the moment the control is disabled. The
38
+ * border color is inert without a width, so only the width and style are scoped.
39
+ */
40
+ export const colorControlSurfaceClasses =
41
+ 'ring-border border-border-strong pointer-events-none absolute inset-0 rounded-[inherit] ring-1 ring-inset group-data-disabled/color-control:border group-data-disabled/color-control:border-dashed group-data-disabled/color-control:ring-0'
42
+
43
+ /**
44
+ * The thumb, minus positioning. Its own position is deliberately not transitioned -
45
+ * easing it toward the pointer reads as lag. Only the press scale animates, and
46
+ * `translate` and `scale` are separate properties, so centering the thumb and scaling
47
+ * it never contend for `transform`.
48
+ *
49
+ * The white rim carries a faint dark ring on each side, so it stays legible over any
50
+ * point of the gradient in either theme, including a white one.
51
+ */
52
+ export const colorControlThumbClasses =
53
+ 'absolute z-10 size-4.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-3 border-white ring-1 ring-black/20 inset-ring-1 inset-ring-black/20 rtl:translate-x-1/2 motion-safe:transition-[scale] motion-safe:duration-150 motion-safe:ease-out group-active/color-control:scale-125 group-data-dragging/color-control:scale-125 data-disabled:bg-background-muted'
54
+
55
+ // Backdrop for anything translucent - an alpha track, a swatch below full opacity -
56
+ // so the transparency shows rather than being implied. Image and tile size stay
57
+ // separate: `background-image` rejects the `0 0 / size` shorthand outright, taking
58
+ // the whole declaration with it.
59
+ export const colorControlCheckerboard =
60
+ 'repeating-conic-gradient(var(--background-strong) 0% 25%, var(--background) 0% 50%)'
61
+
62
+ export const colorControlCheckerboardSize = '0.75rem 0.75rem'
63
+
64
+ /**
65
+ * The swatch ladder: Avatar's, shifted one step down. A swatch is read beside a
66
+ * value rather than looked at, so it needs 16px more than it needs 80px. Every name
67
+ * the two scales share keeps its pixel size. Driven through `font-size` so a `1em`
68
+ * box, its corner and anything nested scale from one declaration.
69
+ */
70
+ export const COLOR_SWATCH_SIZES = {
71
+ '3xs': 'text-[1rem]',
72
+ '2xs': 'text-[1.25rem]',
73
+ xs: 'text-[1.5rem]',
74
+ sm: 'text-[2rem]',
75
+ md: 'text-[2.5rem]',
76
+ lg: 'text-[3rem]',
77
+ xl: 'text-[4rem]',
78
+ } as const
79
+
80
+ /** Corner of a swatch and of anything drawn around one, as a share of the box. */
81
+ export const COLOR_SWATCH_SHAPES = {
82
+ rounded: 'rounded-[calc(tan(atan2(var(--radius-md),2.5rem))*100%)]',
83
+ circle: 'rounded-full',
84
+ } as const
85
+
86
+ const HUE_NAMES: [number, string][] = [
87
+ [15, 'red'],
88
+ [45, 'orange'],
89
+ [70, 'yellow'],
90
+ [100, 'lime'],
91
+ [150, 'green'],
92
+ [175, 'teal'],
93
+ [200, 'cyan'],
94
+ [240, 'blue'],
95
+ [270, 'indigo'],
96
+ [300, 'purple'],
97
+ [330, 'magenta'],
98
+ [345, 'pink'],
99
+ ]
100
+
101
+ /**
102
+ * An English description of a color, for a swatch's accessible name. A hex string is
103
+ * announced digit by digit, which tells a screen reader user nothing about the color;
104
+ * "dark vivid blue" does.
105
+ */
106
+ export function describeColor(color: Color): string {
107
+ const { hue, saturation, lightness, alpha } = convertColor(color, 'hsl')
108
+ if (alpha === 0) return 'transparent'
109
+ const opacity = alpha < 1 ? `, ${Math.round(alpha * 100)}% opacity` : ''
110
+
111
+ if (lightness < 4) return `black${opacity}`
112
+ if (lightness > 96) return `white${opacity}`
113
+ if (saturation < 10) {
114
+ return `${lightness < 35 ? 'dark gray' : lightness > 70 ? 'light gray' : 'gray'}${opacity}`
115
+ }
116
+
117
+ const name = HUE_NAMES.find(([max]) => hue < max)?.[1] ?? 'red'
118
+ const tone =
119
+ lightness < 25
120
+ ? 'very dark '
121
+ : lightness < 42
122
+ ? 'dark '
123
+ : lightness > 82
124
+ ? 'very light '
125
+ : lightness > 65
126
+ ? 'light '
127
+ : ''
128
+ const vividness = saturation < 30 ? 'muted ' : saturation > 85 ? 'vivid ' : ''
129
+ return `${tone}${vividness}${name}${opacity}`
130
+ }
131
+
132
+ /** Spaces a control can plot. Every point of these is a distinct color. */
133
+ export type ColorControlSpace = Extract<ColorSpace, 'rgb' | 'hsl' | 'hsb'>
134
+
135
+ export const COLOR_CONTROL_SPACES: ColorControlSpace[] = ['rgb', 'hsl', 'hsb']
136
+
137
+ /** Rounds to the nearest step, clamped, without the float dust `%` would leave. */
138
+ export function snapToStep(value: number, min: number, max: number, step: number): number {
139
+ const snapped = min + Math.round((value - min) / step) * step
140
+ const decimals = (String(step).split('.')[1] ?? '').length
141
+ return Math.min(Math.max(Number(snapped.toFixed(decimals)), min), max)
142
+ }
143
+
144
+ /** Parses a string value, or passes a `Color` through untouched. */
145
+ export function normalizeColor(value: Color | string): Color {
146
+ return typeof value === 'string' ? parseColor(value) : value
147
+ }
148
+
149
+ // Space a channel belongs to when the value's own can't carry it. Hue and saturation
150
+ // exist in both HSL and HSB; HSB is the pairing a picker is usually built from.
151
+ const CHANNEL_SPACE: Partial<Record<ColorChannel, ColorControlSpace>> = {
152
+ red: 'rgb',
153
+ green: 'rgb',
154
+ blue: 'rgb',
155
+ hue: 'hsb',
156
+ saturation: 'hsb',
157
+ brightness: 'hsb',
158
+ lightness: 'hsl',
159
+ }
160
+
161
+ /**
162
+ * Picks the space a control works in: the value's own whenever it carries the
163
+ * channel, otherwise the channel's home space. Preferring the value's space is what
164
+ * lets an area and a slider share one color without converting it back and forth.
165
+ */
166
+ export function resolveControlSpace(
167
+ valueSpace: ColorSpace,
168
+ channel: ColorChannel | undefined,
169
+ requested?: ColorControlSpace,
170
+ ): ColorControlSpace {
171
+ if (requested) return requested
172
+ // Alpha rides along with every space, so it never forces a conversion.
173
+ const carries = (space: ColorControlSpace) =>
174
+ channel == null || channel === 'alpha' || getColorChannels(space).includes(channel)
175
+ const own = COLOR_CONTROL_SPACES.find((space) => space === valueSpace)
176
+ if (own && carries(own)) return own
177
+ return (channel && CHANNEL_SPACE[channel]) ?? 'rgb'
178
+ }
@@ -0,0 +1,44 @@
1
+ // Matrix conversions behind lib/color.ts, kept apart from its object API and
2
+ // clamping rules. Internal - nothing here is re-exported from the package.
3
+ // Units are native: sRGB and linear components 0-1, OKLab L 0-1, hue in degrees.
4
+
5
+ /** Applies the sRGB transfer function in reverse, giving linear light. */
6
+ export function srgbToLinear(c: number): number {
7
+ return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4
8
+ }
9
+
10
+ /** Applies the sRGB transfer function, giving an encoded component. */
11
+ export function linearToSrgb(c: number): number {
12
+ return c <= 0.0031308 ? c * 12.92 : 1.055 * c ** (1 / 2.4) - 0.055
13
+ }
14
+
15
+ // Matrices are Björn Ottosson's reference values, https://bottosson.github.io/posts/oklab/.
16
+
17
+ export function linearRgbToOklab(r: number, g: number, b: number): [number, number, number] {
18
+ const l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b)
19
+ const m = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b)
20
+ const s = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b)
21
+ return [
22
+ 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s,
23
+ 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s,
24
+ 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s,
25
+ ]
26
+ }
27
+
28
+ export function oklabToLinearRgb(L: number, a: number, b: number): [number, number, number] {
29
+ const l = (L + 0.3963377774 * a + 0.2158037573 * b) ** 3
30
+ const m = (L - 0.1055613458 * a - 0.0638541728 * b) ** 3
31
+ const s = (L - 0.0894841775 * a - 1.291485548 * b) ** 3
32
+ return [
33
+ 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,
34
+ -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,
35
+ -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s,
36
+ ]
37
+ }
38
+
39
+ /** Converts OKLCh to encoded sRGB components, without clamping. */
40
+ export function oklchToSrgb(L: number, chroma: number, hue: number): [number, number, number] {
41
+ const radians = (hue * Math.PI) / 180
42
+ const linear = oklabToLinearRgb(L, chroma * Math.cos(radians), chroma * Math.sin(radians))
43
+ return [linearToSrgb(linear[0]), linearToSrgb(linear[1]), linearToSrgb(linear[2])]
44
+ }
@@ -0,0 +1,80 @@
1
+ 'use client'
2
+
3
+ // The channel ColorPicker uses to drive the controls composed inside it. A control
4
+ // with no `value` of its own reads the picker's color and writes back to it, which is
5
+ // what lets an area, a slider and a palette share one value without any prop wiring.
6
+ // Internal: nothing here is re-exported from the package.
7
+
8
+ import * as React from 'react'
9
+ import { normalizeColor } from './color-control'
10
+ import type { Color, ColorFormat } from '../lib/color'
11
+
12
+ export interface ColorPickerContextValue {
13
+ value: Color
14
+ setValue: (color: Color) => void
15
+ commitValue: (color: Color) => void
16
+ format: ColorFormat
17
+ disabled: boolean
18
+ }
19
+
20
+ export const ColorPickerContext = React.createContext<ColorPickerContextValue | null>(null)
21
+
22
+ /** The enclosing picker, or `null` when the control stands on its own. */
23
+ export function useColorPickerContext(): ColorPickerContextValue | null {
24
+ return React.useContext(ColorPickerContext)
25
+ }
26
+
27
+ /** The enclosing picker, for the parts that only exist inside one. */
28
+ export function useRequiredColorPickerContext(part: string): ColorPickerContextValue {
29
+ const context = React.useContext(ColorPickerContext)
30
+ if (!context) throw new Error(`Appica UI: <${part}> must be used within <ColorPicker>.`)
31
+ return context
32
+ }
33
+
34
+ export interface ColorControlOptions {
35
+ value?: Color | string
36
+ defaultValue: Color | string
37
+ onValueChange?: (value: Color) => void
38
+ onValueCommitted?: (value: Color) => void
39
+ disabled?: boolean
40
+ }
41
+
42
+ export interface ColorControl {
43
+ color: Color
44
+ disabled: boolean
45
+ setColor: (color: Color) => void
46
+ commitColor: (color: Color) => void
47
+ }
48
+
49
+ /**
50
+ * Resolves a control's color from, in order: its own `value`, the enclosing picker,
51
+ * its own state. Writes go to the picker and to the callbacks either way, so a
52
+ * control stays reportable even when the picker owns the value.
53
+ */
54
+ export function useColorControl({
55
+ value,
56
+ defaultValue,
57
+ onValueChange,
58
+ onValueCommitted,
59
+ disabled = false,
60
+ }: ColorControlOptions): ColorControl {
61
+ const picker = useColorPickerContext()
62
+ const [uncontrolled, setUncontrolled] = React.useState<Color>(() => normalizeColor(defaultValue))
63
+
64
+ const controlled = value !== undefined
65
+ const color = controlled ? normalizeColor(value) : (picker?.value ?? uncontrolled)
66
+
67
+ return {
68
+ color,
69
+ disabled: disabled || (picker?.disabled ?? false),
70
+ setColor: (next) => {
71
+ if (!controlled && !picker) setUncontrolled(next)
72
+ picker?.setValue(next)
73
+ onValueChange?.(next)
74
+ },
75
+ commitColor: (next) => {
76
+ picker?.commitValue(next)
77
+ onValueCommitted?.(next)
78
+ },
79
+ }
80
+ }
@@ -1,4 +1,4 @@
1
- // Shared plumbing for floating *Content components — the ones that wrap a Base UI
1
+ // Shared plumbing for floating *Content components - the ones that wrap a Base UI
2
2
  // Portal → Positioner → Popup trio (Popover, Tooltip, PreviewCard, Menu, Select,
3
3
  // Combobox, Autocomplete, …).
4
4
  //
@@ -7,7 +7,7 @@
7
7
  // must map the Base UI surface itself. This module keeps that mapping consistent:
8
8
  //
9
9
  // 1. The common Positioner positioning props (+ the two Portal props) are
10
- // promoted to flat props on *Content — Radix/shadcn ergonomics.
10
+ // promoted to flat props on *Content - Radix/shadcn ergonomics.
11
11
  // 2. `positionerProps` / `portalProps` escape hatches forward the long tail
12
12
  // (e.g. `style`, `render`) without each component re-enumerating it.
13
13
  //
@@ -76,7 +76,7 @@ export interface SplitFloatingProps {
76
76
  * - Anything left that isn't a known Positioner/Portal prop is treated as a Popup prop.
77
77
  *
78
78
  * Destructure `className`/`children` (and any component-specific props) out of the
79
- * props object before calling this — they should not reach the generic Popup spread.
79
+ * props object before calling this - they should not reach the generic Popup spread.
80
80
  */
81
81
  export function splitFloatingProps(props: Record<string, unknown>): SplitFloatingProps {
82
82
  const { positionerProps, portalProps, ...rest } = props as {
@@ -1,4 +1,4 @@
1
- // Shared plumbing for modal/overlay *Content components — the ones that wrap a
1
+ // Shared plumbing for modal/overlay *Content components - the ones that wrap a
2
2
  // Base UI Portal → Backdrop → Viewport → Popup structure (Dialog, AlertDialog,
3
3
  // Drawer). Sibling to src/floating.ts (which handles the Positioner-based trio).
4
4
  //
@@ -12,7 +12,7 @@
12
12
  // re-enumerating it.
13
13
  //
14
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
15
+ // stay bound to it (via the regular spread) - reach the other elements through
16
16
  // the escape hatches.
17
17
 
18
18
  /** Portal props promoted to flat props on every modal *Content. */
@@ -56,7 +56,7 @@ export interface SplitModalProps {
56
56
  *
57
57
  * Destructure `className`/`children`, the `backdropProps`/`viewportProps` escape
58
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
59
+ * the props object before calling this - everything left that isn't a known
60
60
  * Portal prop is treated as a Popup prop.
61
61
  */
62
62
  export function splitModalProps(props: Record<string, unknown>): SplitModalProps {