@justanarthur/modo-ui 0.6.0 → 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 (582) hide show
  1. package/README.md +200 -548
  2. package/blocks/sidebar-app/examples.mdx +33 -0
  3. package/blocks/sidebar-app/index.tsx +231 -0
  4. package/blocks/sidebar-app/inset-topbar.tsx +20 -0
  5. package/blocks/sidebar-app/menu-grid.ts +16 -0
  6. package/blocks/sidebar-app/nav-data.ts +36 -0
  7. package/blocks/sidebar-app/search-field.tsx +41 -0
  8. package/blocks/sidebar-app/thread-page.tsx +58 -0
  9. package/blocks/sidebar-app/user-footer.tsx +60 -0
  10. package/blocks/sidebar-app/workspace-header.tsx +110 -0
  11. package/components/AI/input-message/examples.mdx +134 -0
  12. package/components/AI/input-message/file-preview-tile.tsx +59 -0
  13. package/components/AI/input-message/file-thumbnail.tsx +146 -0
  14. package/components/AI/input-message/index.tsx +625 -0
  15. package/components/AI/input-message/input-message.css +25 -0
  16. package/components/AI/input-message/queued-row.tsx +102 -0
  17. package/components/AI/input-message/shared.ts +38 -0
  18. package/components/AI/input-message/suggestion-row.tsx +64 -0
  19. package/components/AI/input-message/use-composer-files.ts +142 -0
  20. package/components/AI/input-message/use-history-nav.ts +60 -0
  21. package/components/AI/input-message/use-message-queue.ts +108 -0
  22. package/components/AI/input-message/use-region-height.ts +34 -0
  23. package/components/AI/thinking-indicator/examples.mdx +27 -0
  24. package/components/AI/thinking-indicator/index.tsx +188 -0
  25. package/components/accordion/accordion-content.tsx +217 -0
  26. package/components/accordion/accordion-context.tsx +118 -0
  27. package/components/accordion/accordion-group.tsx +215 -0
  28. package/components/accordion/examples.mdx +165 -0
  29. package/components/accordion/index.tsx +307 -0
  30. package/components/avatar/examples.mdx +95 -0
  31. package/components/avatar/index.tsx +135 -0
  32. package/components/badge/change-demo.tsx +31 -0
  33. package/components/badge/examples.mdx +106 -0
  34. package/components/badge/index.tsx +187 -0
  35. package/components/badge/variants.ts +48 -0
  36. package/components/button/examples.mdx +153 -0
  37. package/components/button/index.tsx +333 -0
  38. package/components/button/loading-demo.tsx +27 -0
  39. package/components/button/variants.ts +63 -0
  40. package/components/card/card-group.tsx +184 -0
  41. package/components/card/card-media.tsx +207 -0
  42. package/components/card/card-parts.tsx +179 -0
  43. package/components/card/examples.mdx +199 -0
  44. package/components/card/index.tsx +379 -0
  45. package/components/copy/examples.mdx +87 -0
  46. package/components/copy/index.tsx +435 -0
  47. package/components/inputs/checkbox/examples.mdx +70 -0
  48. package/components/inputs/checkbox/index.tsx +459 -0
  49. package/components/inputs/checkbox/select-all-demo.tsx +50 -0
  50. package/components/inputs/color-picker/channel-sliders.tsx +70 -0
  51. package/components/inputs/color-picker/color-input.tsx +387 -0
  52. package/components/inputs/color-picker/color-math.ts +366 -0
  53. package/components/inputs/color-picker/context.ts +11 -0
  54. package/components/inputs/color-picker/examples.mdx +72 -0
  55. package/components/inputs/color-picker/format-menu.tsx +212 -0
  56. package/components/inputs/color-picker/index.tsx +395 -0
  57. package/components/inputs/color-picker/inputs-row.tsx +196 -0
  58. package/components/inputs/color-picker/popover.tsx +161 -0
  59. package/components/inputs/color-picker/saturation-square.tsx +167 -0
  60. package/components/inputs/color-picker/swatches.tsx +178 -0
  61. package/components/inputs/combobox/context.ts +90 -0
  62. package/components/inputs/combobox/examples.mdx +263 -0
  63. package/components/inputs/combobox/fields.tsx +328 -0
  64. package/components/inputs/combobox/index.tsx +372 -0
  65. package/components/inputs/combobox/list.tsx +415 -0
  66. package/components/inputs/combobox/remote-demo.tsx +101 -0
  67. package/components/inputs/date-time/calendar/examples.mdx +34 -0
  68. package/components/inputs/date-time/calendar/index.tsx +343 -0
  69. package/components/inputs/date-time/calendar/use-month-window.ts +176 -0
  70. package/components/inputs/date-time/date-picker/examples.mdx +147 -0
  71. package/components/inputs/date-time/date-picker/index.tsx +292 -0
  72. package/components/inputs/date-time/date-picker/masked-date-input.tsx +206 -0
  73. package/components/inputs/date-time/date-range-picker/examples.mdx +37 -0
  74. package/components/inputs/date-time/date-range-picker/index.tsx +226 -0
  75. package/components/inputs/date-time/date-value.ts +37 -0
  76. package/components/inputs/date-time/day-rules.ts +22 -0
  77. package/components/inputs/date-time/duration-picker/examples.mdx +16 -0
  78. package/components/inputs/date-time/duration-picker/index.tsx +163 -0
  79. package/components/inputs/date-time/month-picker/examples.mdx +16 -0
  80. package/components/inputs/date-time/month-picker/index.tsx +170 -0
  81. package/components/inputs/date-time/picker-shell.tsx +460 -0
  82. package/components/inputs/date-time/time-columns.tsx +90 -0
  83. package/components/inputs/date-time/time-picker/examples.mdx +26 -0
  84. package/components/inputs/date-time/time-picker/index.tsx +146 -0
  85. package/components/inputs/field/examples.mdx +159 -0
  86. package/components/inputs/field/index.tsx +278 -0
  87. package/components/inputs/file-dropzone/examples.mdx +82 -0
  88. package/components/inputs/file-dropzone/file-row.tsx +200 -0
  89. package/components/inputs/file-dropzone/index.tsx +317 -0
  90. package/components/inputs/file-dropzone/upload-demo.tsx +71 -0
  91. package/components/inputs/file-dropzone/variants.ts +96 -0
  92. package/components/inputs/input/examples.mdx +111 -0
  93. package/components/inputs/input/index.tsx +431 -0
  94. package/components/inputs/input/password-demo.tsx +30 -0
  95. package/components/inputs/label/examples.mdx +60 -0
  96. package/components/inputs/label/index.tsx +72 -0
  97. package/components/inputs/number-input/examples.mdx +96 -0
  98. package/components/inputs/number-input/index.tsx +226 -0
  99. package/components/inputs/radio/examples.mdx +62 -0
  100. package/components/inputs/radio/index.tsx +433 -0
  101. package/components/inputs/search/examples.mdx +74 -0
  102. package/components/inputs/search/index.tsx +340 -0
  103. package/components/inputs/select/examples.mdx +205 -0
  104. package/components/inputs/select/index.tsx +520 -0
  105. package/components/inputs/slider/comfortable.tsx +524 -0
  106. package/components/inputs/slider/compact.tsx +690 -0
  107. package/components/inputs/slider/examples.mdx +127 -0
  108. package/components/inputs/slider/geometry.ts +88 -0
  109. package/components/inputs/slider/index.tsx +136 -0
  110. package/components/inputs/slider/value-display.tsx +184 -0
  111. package/components/inputs/switch/examples.mdx +94 -0
  112. package/components/inputs/switch/index.tsx +452 -0
  113. package/components/inputs/textarea/examples.mdx +88 -0
  114. package/components/inputs/textarea/index.tsx +129 -0
  115. package/components/navigation/navigation-menu/content.tsx +76 -0
  116. package/components/navigation/navigation-menu/context.ts +34 -0
  117. package/components/navigation/navigation-menu/examples.mdx +73 -0
  118. package/components/navigation/navigation-menu/index.tsx +204 -0
  119. package/components/navigation/navigation-menu/item.tsx +47 -0
  120. package/components/navigation/navigation-menu/link.tsx +104 -0
  121. package/components/navigation/navigation-menu/list.tsx +86 -0
  122. package/components/navigation/navigation-menu/trigger.tsx +78 -0
  123. package/components/navigation/navigation-menu/use-dom-rows.ts +56 -0
  124. package/components/navigation/pagination/examples.mdx +65 -0
  125. package/components/navigation/pagination/index.tsx +323 -0
  126. package/components/navigation/sidebar/examples.mdx +319 -0
  127. package/components/navigation/sidebar/index.tsx +393 -0
  128. package/components/navigation/sidebar/menu-scope.tsx +439 -0
  129. package/components/navigation/sidebar/row-label.tsx +61 -0
  130. package/components/navigation/sidebar/sidebar-context.tsx +71 -0
  131. package/components/navigation/sidebar/sidebar-group.tsx +299 -0
  132. package/components/navigation/sidebar/sidebar-menu-actions.tsx +209 -0
  133. package/components/navigation/sidebar/sidebar-menu-button.tsx +214 -0
  134. package/components/navigation/sidebar/sidebar-menu-item.tsx +207 -0
  135. package/components/navigation/sidebar/sidebar-menu-sub.tsx +180 -0
  136. package/components/navigation/sidebar/sidebar-parts.tsx +94 -0
  137. package/components/navigation/sidebar/sidebar-provider.tsx +248 -0
  138. package/components/navigation/sidebar/sidebar-rail.tsx +206 -0
  139. package/components/navigation/sidebar/sidebar-shell.tsx +180 -0
  140. package/components/navigation/sidebar/sidebar-shortcut.tsx +101 -0
  141. package/components/navigation/sidebar/sidebar.css +70 -0
  142. package/components/navigation/sidebar/use-measured-collapse.ts +62 -0
  143. package/components/navigation/tabs/context.ts +45 -0
  144. package/components/navigation/tabs/examples.mdx +135 -0
  145. package/components/navigation/tabs/index.tsx +142 -0
  146. package/components/navigation/tabs/item.tsx +161 -0
  147. package/components/navigation/tabs/list.tsx +143 -0
  148. package/components/overlays/alert-dialog/examples.mdx +89 -0
  149. package/components/overlays/alert-dialog/index.tsx +262 -0
  150. package/components/overlays/alert-dialog/pending-demo.tsx +38 -0
  151. package/components/overlays/command/examples.mdx +113 -0
  152. package/components/overlays/command/index.tsx +394 -0
  153. package/components/overlays/context-menu/examples.mdx +110 -0
  154. package/components/overlays/context-menu/index.tsx +135 -0
  155. package/components/overlays/dialog/examples.mdx +142 -0
  156. package/components/overlays/dialog/index.tsx +271 -0
  157. package/components/overlays/dropdown/dropdown-search.tsx +330 -0
  158. package/components/overlays/dropdown/examples.mdx +158 -0
  159. package/components/overlays/dropdown/index.tsx +345 -0
  160. package/components/overlays/dropdown/menu-item.tsx +226 -0
  161. package/components/overlays/dropdown/menu-popup.tsx +294 -0
  162. package/components/overlays/dropdown/panel-state.ts +176 -0
  163. package/components/overlays/dropdown/submenu.tsx +170 -0
  164. package/components/overlays/popover/anchored-demo.tsx +68 -0
  165. package/components/overlays/popover/examples.mdx +154 -0
  166. package/components/overlays/popover/index.tsx +273 -0
  167. package/components/overlays/preview-card/examples.mdx +61 -0
  168. package/components/overlays/preview-card/index.tsx +149 -0
  169. package/components/overlays/sheet/examples.mdx +89 -0
  170. package/components/overlays/sheet/index.tsx +222 -0
  171. package/components/overlays/toast/examples.mdx +93 -0
  172. package/components/overlays/toast/index.tsx +397 -0
  173. package/components/overlays/toast/manager.ts +137 -0
  174. package/components/overlays/tooltip/examples.mdx +100 -0
  175. package/components/overlays/tooltip/index.tsx +399 -0
  176. package/components/progress/examples.mdx +59 -0
  177. package/components/progress/index.tsx +168 -0
  178. package/components/progress/progress.css +27 -0
  179. package/components/progress/step-demo.tsx +29 -0
  180. package/components/table/context.ts +49 -0
  181. package/components/table/examples.mdx +156 -0
  182. package/components/table/head.tsx +105 -0
  183. package/components/table/index.tsx +150 -0
  184. package/components/table/parts.tsx +188 -0
  185. package/components/table/sort-demo.tsx +52 -0
  186. package/dist/base.css +175 -19
  187. package/dist/blocks/sidebar-app/index.d.ts +10 -2
  188. package/dist/blocks/sidebar-app/index.js +49 -26
  189. package/dist/components/AI/input-message/index.d.ts +22 -19
  190. package/dist/components/AI/input-message/index.js +30 -16
  191. package/dist/components/AI/thinking-indicator/index.d.ts +2 -0
  192. package/dist/components/AI/thinking-indicator/index.js +10 -6
  193. package/dist/components/accordion/index.d.ts +54 -59
  194. package/dist/components/accordion/index.js +25 -14
  195. package/dist/components/avatar/index.d.ts +46 -0
  196. package/dist/components/avatar/index.js +20 -0
  197. package/dist/components/badge/index.d.ts +14 -14
  198. package/dist/components/badge/index.js +12 -7
  199. package/dist/components/badge/variants.d.ts +26 -0
  200. package/dist/components/badge/variants.js +8 -0
  201. package/dist/components/button/index.d.ts +34 -22
  202. package/dist/components/button/index.js +14 -6
  203. package/dist/components/button/variants.d.ts +8 -0
  204. package/dist/components/button/variants.js +6 -0
  205. package/dist/components/card/index.d.ts +161 -83
  206. package/dist/components/card/index.js +31 -16
  207. package/dist/components/copy/index.d.ts +2 -0
  208. package/dist/components/copy/index.js +18 -9
  209. package/dist/components/inputs/checkbox/index.d.ts +25 -6
  210. package/dist/components/inputs/checkbox/index.js +22 -13
  211. package/dist/components/inputs/color-picker/index.d.ts +74 -54
  212. package/dist/components/inputs/color-picker/index.js +33 -19
  213. package/dist/components/inputs/combobox/index.d.ts +161 -101
  214. package/dist/components/inputs/combobox/index.js +31 -20
  215. package/dist/components/inputs/date-time/calendar/index.js +17 -11
  216. package/dist/components/inputs/date-time/date-picker/index.d.ts +61 -16
  217. package/dist/components/inputs/date-time/date-picker/index.js +42 -25
  218. package/dist/components/inputs/date-time/date-range-picker/index.d.ts +50 -16
  219. package/dist/components/inputs/date-time/date-range-picker/index.js +40 -24
  220. package/dist/components/inputs/date-time/duration-picker/index.d.ts +11 -4
  221. package/dist/components/inputs/date-time/duration-picker/index.js +39 -24
  222. package/dist/components/inputs/date-time/month-picker/index.d.ts +11 -4
  223. package/dist/components/inputs/date-time/month-picker/index.js +38 -23
  224. package/dist/components/inputs/date-time/time-picker/index.d.ts +11 -4
  225. package/dist/components/inputs/date-time/time-picker/index.js +39 -24
  226. package/dist/components/inputs/field/index.d.ts +112 -0
  227. package/dist/components/inputs/field/index.js +28 -0
  228. package/dist/components/inputs/file-dropzone/index.d.ts +174 -0
  229. package/dist/components/inputs/file-dropzone/index.js +36 -0
  230. package/dist/components/inputs/file-dropzone/variants.d.ts +35 -0
  231. package/dist/components/inputs/file-dropzone/variants.js +12 -0
  232. package/dist/components/inputs/input/index.d.ts +100 -20
  233. package/dist/components/inputs/input/index.js +20 -9
  234. package/dist/components/inputs/label/index.d.ts +34 -0
  235. package/dist/components/inputs/label/index.js +12 -0
  236. package/dist/components/inputs/number-input/index.d.ts +95 -0
  237. package/dist/components/inputs/number-input/index.js +23 -0
  238. package/dist/components/inputs/radio/index.d.ts +25 -6
  239. package/dist/components/inputs/radio/index.js +20 -12
  240. package/dist/components/inputs/search/index.d.ts +10 -3
  241. package/dist/components/inputs/search/index.js +33 -18
  242. package/dist/components/inputs/select/index.d.ts +103 -38
  243. package/dist/components/inputs/select/index.js +34 -16
  244. package/dist/components/inputs/slider/index.d.ts +26 -39
  245. package/dist/components/inputs/slider/index.js +9 -7
  246. package/dist/components/inputs/switch/index.d.ts +14 -2
  247. package/dist/components/inputs/switch/index.js +17 -12
  248. package/dist/components/inputs/textarea/index.d.ts +13 -4
  249. package/dist/components/inputs/textarea/index.js +12 -6
  250. package/dist/components/navigation/navigation-menu/index.d.ts +155 -0
  251. package/dist/components/navigation/navigation-menu/index.js +45 -0
  252. package/dist/components/navigation/pagination/index.d.ts +62 -0
  253. package/dist/components/navigation/pagination/index.js +34 -0
  254. package/dist/components/navigation/sidebar/index.d.ts +233 -204
  255. package/dist/components/navigation/sidebar/index.js +51 -36
  256. package/dist/components/navigation/tabs/index.d.ts +62 -39
  257. package/dist/components/navigation/tabs/index.js +23 -12
  258. package/dist/components/overlays/alert-dialog/index.d.ts +128 -44
  259. package/dist/components/overlays/alert-dialog/index.js +28 -13
  260. package/dist/components/overlays/command/index.d.ts +30 -16
  261. package/dist/components/overlays/command/index.js +31 -17
  262. package/dist/components/overlays/context-menu/index.d.ts +70 -62
  263. package/dist/components/overlays/context-menu/index.js +35 -20
  264. package/dist/components/overlays/dialog/index.d.ts +81 -71
  265. package/dist/components/overlays/dialog/index.js +23 -12
  266. package/dist/components/overlays/dropdown/index.d.ts +215 -111
  267. package/dist/components/overlays/dropdown/index.js +41 -20
  268. package/dist/components/overlays/popover/index.d.ts +94 -39
  269. package/dist/components/overlays/popover/index.js +17 -9
  270. package/dist/components/overlays/preview-card/index.d.ts +52 -26
  271. package/dist/components/overlays/preview-card/index.js +16 -8
  272. package/dist/components/overlays/sheet/index.d.ts +36 -23
  273. package/dist/components/overlays/sheet/index.js +24 -13
  274. package/dist/components/overlays/toast/index.d.ts +73 -24
  275. package/dist/components/overlays/toast/index.js +22 -10
  276. package/dist/components/overlays/tooltip/index.d.ts +102 -38
  277. package/dist/components/overlays/tooltip/index.js +18 -6
  278. package/dist/components/progress/index.d.ts +55 -0
  279. package/dist/components/progress/index.js +16 -0
  280. package/dist/components/table/index.d.ts +79 -23
  281. package/dist/components/table/index.js +24 -11
  282. package/dist/index.d.ts +2929 -1552
  283. package/dist/index.js +274 -141
  284. package/dist/lib/date-locale.d.ts +19 -0
  285. package/dist/lib/date-locale.js +18 -0
  286. package/dist/lib/date-mask.d.ts +41 -0
  287. package/dist/lib/date-mask.js +20 -0
  288. package/dist/lib/field-box.d.ts +114 -0
  289. package/dist/lib/field-box.js +18 -0
  290. package/dist/lib/field-classes.d.ts +45 -0
  291. package/dist/lib/field-classes.js +24 -0
  292. package/dist/lib/fluid-hover-highlight.d.ts +90 -0
  293. package/dist/lib/fluid-hover-highlight.js +12 -0
  294. package/dist/lib/focus-ring.d.ts +24 -0
  295. package/dist/lib/focus-ring.js +11 -0
  296. package/dist/lib/goo-indicator.d.ts +46 -0
  297. package/dist/lib/goo-indicator.js +15 -0
  298. package/dist/lib/icon-context.d.ts +24 -0
  299. package/dist/lib/icon-context.js +8 -0
  300. package/dist/lib/merge-refs.d.ts +10 -0
  301. package/dist/lib/merge-refs.js +8 -0
  302. package/dist/lib/morph-layers.d.ts +99 -0
  303. package/dist/lib/morph-layers.js +14 -0
  304. package/dist/lib/morph-part.d.ts +21 -0
  305. package/dist/lib/morph-part.js +12 -0
  306. package/dist/lib/overlay.d.ts +113 -0
  307. package/dist/lib/overlay.js +21 -0
  308. package/dist/lib/popup-rows.d.ts +101 -0
  309. package/dist/lib/popup-rows.js +25 -0
  310. package/dist/lib/popup-surface.d.ts +92 -0
  311. package/dist/lib/popup-surface.js +17 -0
  312. package/dist/lib/popup.d.ts +36 -0
  313. package/dist/lib/popup.js +15 -0
  314. package/dist/lib/rect.d.ts +16 -0
  315. package/dist/lib/rect.js +12 -0
  316. package/dist/lib/reduced-motion.d.ts +9 -0
  317. package/dist/lib/reduced-motion.js +6 -0
  318. package/dist/lib/row-group.d.ts +100 -0
  319. package/dist/lib/row-group.js +12 -0
  320. package/dist/lib/row-index.d.ts +15 -0
  321. package/dist/lib/row-index.js +10 -0
  322. package/dist/lib/scroll-column.d.ts +27 -0
  323. package/dist/lib/scroll-column.js +20 -0
  324. package/dist/lib/shape-classes.d.ts +16 -0
  325. package/dist/lib/shape-classes.js +6 -0
  326. package/dist/lib/shape-context.d.ts +23 -0
  327. package/dist/lib/shape-context.js +9 -0
  328. package/dist/lib/size-context.d.ts +93 -0
  329. package/dist/lib/size-context.js +15 -0
  330. package/dist/lib/size-scale.d.ts +79 -0
  331. package/dist/lib/size-scale.js +8 -0
  332. package/dist/lib/slot.d.ts +44 -0
  333. package/dist/lib/slot.js +14 -0
  334. package/dist/lib/spinner-glyph.d.ts +7 -0
  335. package/dist/lib/spinner-glyph.js +7 -0
  336. package/dist/lib/springs.d.ts +48 -0
  337. package/dist/lib/springs.js +10 -0
  338. package/dist/lib/surface-classes.d.ts +19 -0
  339. package/dist/lib/surface-classes.js +10 -0
  340. package/dist/lib/surface-context.d.ts +11 -0
  341. package/dist/lib/surface-context.js +10 -0
  342. package/dist/lib/use-autosize-textarea.d.ts +16 -0
  343. package/dist/lib/use-autosize-textarea.js +7 -0
  344. package/dist/lib/use-controllable-state.d.ts +16 -0
  345. package/dist/lib/use-controllable-state.js +6 -0
  346. package/dist/lib/use-fluid-hover.d.ts +90 -0
  347. package/dist/lib/use-fluid-hover.js +8 -0
  348. package/dist/lib/use-is-mobile.d.ts +2 -0
  349. package/dist/lib/use-is-mobile.js +6 -0
  350. package/dist/lib/use-iso-layout-effect.d.ts +7 -0
  351. package/dist/lib/use-iso-layout-effect.js +6 -0
  352. package/dist/lib/use-keyboard-nav-gate.d.ts +20 -0
  353. package/dist/lib/use-keyboard-nav-gate.js +8 -0
  354. package/dist/lib/use-merge-split.d.ts +47 -0
  355. package/dist/lib/use-merge-split.js +16 -0
  356. package/dist/lib/use-morph.d.ts +107 -0
  357. package/dist/lib/use-morph.js +21 -0
  358. package/dist/lib/use-touch-primary.d.ts +2 -0
  359. package/dist/lib/use-touch-primary.js +6 -0
  360. package/dist/lib/utils.d.ts +3 -0
  361. package/dist/lib/utils.js +6 -0
  362. package/dist/lib/weight-label.d.ts +26 -0
  363. package/dist/lib/weight-label.js +7 -0
  364. package/dist/preset.d.ts +18 -0
  365. package/dist/preset.js +25 -3
  366. package/dist/primitives/code/index.js +8 -5
  367. package/dist/primitives/craft/index.d.ts +1 -1
  368. package/dist/primitives/craft/index.js +13 -8
  369. package/dist/primitives/fluid-hover/index.d.ts +13 -14
  370. package/dist/primitives/fluid-hover/index.js +13 -8
  371. package/dist/primitives/morph/index.d.ts +1 -1
  372. package/dist/primitives/morph/index.js +20 -10
  373. package/dist/primitives/motion/index.d.ts +2 -0
  374. package/dist/primitives/motion/index.js +14 -8
  375. package/dist/primitives/scroll-area/index.d.ts +5 -4
  376. package/dist/primitives/scroll-area/index.js +5 -3
  377. package/dist/primitives/separator/index.d.ts +26 -0
  378. package/dist/primitives/separator/index.js +9 -0
  379. package/dist/primitives/sizes/index.d.ts +17 -4
  380. package/dist/primitives/sizes/index.js +10 -5
  381. package/dist/primitives/skeleton/index.d.ts +35 -0
  382. package/dist/primitives/skeleton/index.js +14 -0
  383. package/dist/primitives/surface/index.d.ts +12 -25
  384. package/dist/primitives/surface/index.js +8 -4
  385. package/dist/shared/{components-y9y0g8er.js → components-07g2gbjy.js} +32 -53
  386. package/dist/shared/components-099sdasz.js +552 -0
  387. package/dist/shared/components-0h3f5jae.js +177 -0
  388. package/dist/shared/components-0mrhj88d.js +35 -0
  389. package/dist/shared/{components-gz8zf3ec.js → components-0p2na0cp.js} +16 -43
  390. package/dist/shared/components-1a7cr7vh.js +40 -0
  391. package/dist/shared/components-1axxc3tk.js +334 -0
  392. package/dist/shared/components-1hc3xv0y.js +381 -0
  393. package/dist/shared/components-1jxw899c.js +338 -0
  394. package/dist/shared/{components-zrkzcayz.js → components-1nv9q3s8.js} +32 -4
  395. package/dist/shared/{components-sn1rxx1d.js → components-1p3k62x2.js} +43 -49
  396. package/dist/shared/{components-5xc2j8jz.js → components-2xmke84n.js} +27 -18
  397. package/dist/shared/{components-0q0sqfh4.js → components-346ged8v.js} +48 -49
  398. package/dist/shared/{components-39jq9va1.js → components-34brwmgp.js} +32 -26
  399. package/dist/shared/components-38wa9nx5.js +19 -0
  400. package/dist/shared/components-3hgk57s0.js +27 -0
  401. package/dist/shared/{components-q5xj5c16.js → components-3js2vgds.js} +16 -8
  402. package/dist/shared/{components-b0eac83j.js → components-3m4rqrqm.js} +16 -30
  403. package/dist/shared/{components-1v7rxytx.js → components-45r18egt.js} +11 -1
  404. package/dist/shared/components-50rh4ggz.js +54 -0
  405. package/dist/shared/{components-6p8tfcd6.js → components-5atrr490.js} +31 -54
  406. package/dist/shared/components-5f3tq4qb.js +70 -0
  407. package/dist/shared/{components-kvr7f9hy.js → components-5vyaexsj.js} +20 -12
  408. package/dist/shared/{components-chacnk61.js → components-5ynncdpn.js} +20 -19
  409. package/dist/shared/{components-n42c79bz.js → components-62mg6pab.js} +247 -107
  410. package/dist/shared/components-6f5pyzb2.js +33 -0
  411. package/dist/shared/components-6xfhc5qm.js +334 -0
  412. package/dist/shared/{components-59efxjd9.js → components-7c4a0egq.js} +9 -0
  413. package/dist/shared/components-7fqnqbh0.js +79 -0
  414. package/dist/shared/components-7fsy0jxg.js +443 -0
  415. package/dist/shared/components-7t3pz7v7.js +832 -0
  416. package/dist/shared/components-85epgxwf.js +620 -0
  417. package/dist/shared/components-86vvx0c8.js +252 -0
  418. package/dist/shared/{components-4700p9kz.js → components-88ktjdg0.js} +37 -32
  419. package/dist/shared/{components-vfbhxf5r.js → components-88r046aa.js} +9 -8
  420. package/dist/shared/{components-w90endve.js → components-8hfrd2fk.js} +1480 -1483
  421. package/dist/shared/components-8sazy704.js +146 -0
  422. package/dist/shared/{components-c6s6b43g.js → components-8wp8d8q1.js} +11 -2
  423. package/dist/shared/components-9ybenn5v.js +64 -0
  424. package/dist/shared/components-amsc86fb.js +293 -0
  425. package/dist/shared/{components-vc7vq5nz.js → components-az04rmng.js} +15 -6
  426. package/dist/shared/components-bdkm2jzy.js +34 -0
  427. package/dist/shared/components-be3wggg1.js +113 -0
  428. package/dist/shared/components-bkwjvvkh.js +18 -0
  429. package/dist/shared/{components-zx6b6yby.js → components-ceyn28cf.js} +11 -18
  430. package/dist/shared/components-cy5z8zxy.js +22 -0
  431. package/dist/shared/components-dm86y7b3.js +105 -0
  432. package/dist/shared/components-ejn6tvbw.js +46 -0
  433. package/dist/shared/components-ew4wq7mj.js +42 -0
  434. package/dist/shared/{components-8snj490h.js → components-f75y4gn8.js} +101 -72
  435. package/dist/shared/components-f9adtfq8.js +34 -0
  436. package/dist/shared/{components-rr7a6ja9.js → components-gbsdhmrv.js} +43 -46
  437. package/dist/shared/{components-b2wyq2cq.js → components-gc5zky2w.js} +62 -85
  438. package/dist/shared/{components-27nnvrwe.js → components-gkdx1787.js} +21 -14
  439. package/dist/shared/components-grxgqa75.js +49 -0
  440. package/dist/shared/components-gw0wd7gd.js +986 -0
  441. package/dist/shared/components-j4z3rtw2.js +179 -0
  442. package/dist/shared/{components-wvp1m52g.js → components-j8tcbm8y.js} +919 -898
  443. package/dist/shared/components-jm91mjm1.js +297 -0
  444. package/dist/shared/components-jtfptckj.js +148 -0
  445. package/dist/shared/components-jx9qb4z8.js +63 -0
  446. package/dist/shared/components-k785rge6.js +336 -0
  447. package/dist/shared/components-k81x1aea.js +23 -0
  448. package/dist/shared/{components-mjthm1kf.js → components-kn5c7652.js} +16 -14
  449. package/dist/shared/components-mse06t0x.js +31 -0
  450. package/dist/shared/{components-fzrq6tr3.js → components-n7e31ct4.js} +87 -62
  451. package/dist/shared/components-nskr4hwg.js +1008 -0
  452. package/dist/shared/components-nv5m3gcv.js +37 -0
  453. package/dist/shared/components-nwa2a9tq.js +27 -0
  454. package/dist/shared/components-p0x8ren6.js +61 -0
  455. package/dist/shared/components-p0z99d5b.js +229 -0
  456. package/dist/shared/components-pa43g2r2.js +39 -0
  457. package/dist/shared/{components-hqeq3w9q.js → components-pedbt2dc.js} +51 -50
  458. package/dist/shared/components-pva1wj1r.js +27 -0
  459. package/dist/shared/components-q4wyd06h.js +382 -0
  460. package/dist/shared/{components-cv16mryv.js → components-qrpdtvxa.js} +18 -32
  461. package/dist/shared/components-r33dxr5j.js +91 -0
  462. package/dist/shared/{components-s083f38z.js → components-re8p99fj.js} +52 -48
  463. package/dist/shared/components-s217vq1n.js +35 -0
  464. package/dist/shared/{components-11da9ajg.js → components-sesrjvcc.js} +11 -7
  465. package/dist/shared/{components-2dxkv6zm.js → components-skn189mp.js} +33 -39
  466. package/dist/shared/components-tcyz2tdn.js +31 -0
  467. package/dist/shared/components-tjxy84s9.js +53 -0
  468. package/dist/shared/{components-5vgpnxgy.js → components-tnj6mkhg.js} +25 -48
  469. package/dist/shared/{components-men63rwj.js → components-tz0axc0f.js} +4 -2
  470. package/dist/shared/components-v2j3jx89.js +7 -0
  471. package/dist/shared/components-vcte8p75.js +71 -0
  472. package/dist/shared/{components-1z6tdadk.js → components-vgzerqt0.js} +39 -36
  473. package/dist/shared/components-vp6vzsee.js +30 -0
  474. package/dist/shared/components-vpkh6j83.js +42 -0
  475. package/dist/shared/{components-7r3etddy.js → components-wgd1nebp.js} +29 -57
  476. package/dist/shared/components-wrbw67f6.js +45 -0
  477. package/dist/shared/{components-n7mjr357.js → components-wwd093xg.js} +4 -2
  478. package/dist/shared/components-wyfmhtw9.js +61 -0
  479. package/dist/shared/components-xpw8dzb0.js +88 -0
  480. package/dist/shared/components-xzcgr3gy.js +257 -0
  481. package/dist/shared/{components-ezxhrmer.js → components-ycx2kxeq.js} +9 -1
  482. package/dist/shared/{components-jthe1pwb.js → components-zbzx62pg.js} +935 -923
  483. package/dist/shared/{components-jwst3vtj.js → components-zf0nnvvg.js} +143 -75
  484. package/dist/shared/components-znspksk0.js +41 -0
  485. package/dist/shared/components-zpatc9x3.js +78 -0
  486. package/dist/styles.css +339 -68
  487. package/dist/tailwind.css +28 -0
  488. package/dist/tokens.css +55 -3
  489. package/index.ts +74 -0
  490. package/lib/date-locale.ts +58 -0
  491. package/lib/date-mask.ts +146 -0
  492. package/lib/field-box.ts +117 -0
  493. package/lib/field-classes.ts +106 -0
  494. package/lib/fluid-hover-highlight.tsx +94 -0
  495. package/lib/focus-ring.tsx +49 -0
  496. package/lib/goo-indicator.tsx +263 -0
  497. package/lib/icon-context.tsx +258 -0
  498. package/lib/merge-refs.ts +29 -0
  499. package/lib/morph-layers.tsx +104 -0
  500. package/lib/morph-part.tsx +51 -0
  501. package/lib/overlay.tsx +118 -0
  502. package/lib/popup-rows.tsx +149 -0
  503. package/lib/popup-surface.tsx +52 -0
  504. package/lib/popup.ts +53 -0
  505. package/lib/rect.ts +48 -0
  506. package/lib/reduced-motion.ts +21 -0
  507. package/lib/row-group.tsx +113 -0
  508. package/lib/row-index.tsx +46 -0
  509. package/lib/scroll-column.tsx +246 -0
  510. package/lib/shape-classes.ts +56 -0
  511. package/lib/shape-context.tsx +69 -0
  512. package/lib/size-context.tsx +53 -0
  513. package/lib/size-scale.ts +109 -0
  514. package/lib/slot.tsx +124 -0
  515. package/lib/spinner-glyph.tsx +27 -0
  516. package/lib/springs.ts +61 -0
  517. package/lib/surface-classes.ts +53 -0
  518. package/lib/surface-context.tsx +26 -0
  519. package/lib/use-autosize-textarea.ts +64 -0
  520. package/lib/use-controllable-state.ts +59 -0
  521. package/lib/use-fluid-hover.ts +539 -0
  522. package/lib/use-is-mobile.ts +25 -0
  523. package/lib/use-iso-layout-effect.ts +14 -0
  524. package/lib/use-keyboard-nav-gate.ts +44 -0
  525. package/lib/use-merge-split.tsx +199 -0
  526. package/lib/use-morph.ts +533 -0
  527. package/lib/use-touch-primary.tsx +43 -0
  528. package/lib/utils.ts +30 -0
  529. package/lib/weight-label.tsx +69 -0
  530. package/package.json +92 -6
  531. package/primitives/code/examples.mdx +27 -0
  532. package/primitives/code/index.tsx +82 -0
  533. package/primitives/craft/demos.tsx +175 -0
  534. package/primitives/craft/examples.mdx +140 -0
  535. package/primitives/craft/index.tsx +79 -0
  536. package/primitives/fluid-hover/examples.mdx +84 -0
  537. package/primitives/fluid-hover/index.tsx +281 -0
  538. package/primitives/morph/examples.mdx +136 -0
  539. package/primitives/morph/index.tsx +194 -0
  540. package/primitives/motion/examples.mdx +100 -0
  541. package/primitives/motion/index.tsx +144 -0
  542. package/primitives/scroll-area/examples.mdx +58 -0
  543. package/primitives/scroll-area/index.tsx +179 -0
  544. package/primitives/separator/examples.mdx +30 -0
  545. package/primitives/separator/index.tsx +54 -0
  546. package/primitives/sizes/examples.mdx +167 -0
  547. package/primitives/sizes/index.tsx +75 -0
  548. package/primitives/skeleton/examples.mdx +51 -0
  549. package/primitives/skeleton/index.tsx +86 -0
  550. package/primitives/skeleton/skeleton.css +20 -0
  551. package/primitives/surface/examples.mdx +173 -0
  552. package/primitives/surface/index.tsx +84 -0
  553. package/primitives/surface/surface.css +176 -0
  554. package/dist/components/navigation/tabs-subtle/index.d.ts +0 -73
  555. package/dist/components/navigation/tabs-subtle/index.js +0 -21
  556. package/dist/shared/components-0sn7ypjw.js +0 -61
  557. package/dist/shared/components-1434p1mh.js +0 -123
  558. package/dist/shared/components-2ecg8svx.js +0 -496
  559. package/dist/shared/components-2ph6t61s.js +0 -215
  560. package/dist/shared/components-3ky44908.js +0 -9
  561. package/dist/shared/components-3mkepka5.js +0 -111
  562. package/dist/shared/components-b3c5et5b.js +0 -667
  563. package/dist/shared/components-d6xtjht3.js +0 -981
  564. package/dist/shared/components-dk0gjr5a.js +0 -304
  565. package/dist/shared/components-gc5vtq2f.js +0 -149
  566. package/dist/shared/components-gf5s6ap9.js +0 -42
  567. package/dist/shared/components-h2ajmhwn.js +0 -183
  568. package/dist/shared/components-hw9yk32z.js +0 -288
  569. package/dist/shared/components-hyq23phv.js +0 -310
  570. package/dist/shared/components-jbbmdr74.js +0 -484
  571. package/dist/shared/components-jjw69c4c.js +0 -28
  572. package/dist/shared/components-kwa6mrf9.js +0 -89
  573. package/dist/shared/components-ng72k97e.js +0 -128
  574. package/dist/shared/components-pbmqctfa.js +0 -300
  575. package/dist/shared/components-raknhppb.js +0 -64
  576. package/dist/shared/components-s5ngg32c.js +0 -267
  577. package/dist/shared/components-ta7shw28.js +0 -19
  578. package/dist/shared/components-vynjtrk6.js +0 -19
  579. package/dist/shared/components-w1r67ag9.js +0 -717
  580. package/dist/shared/components-wy9jpqny.js +0 -146
  581. package/dist/shared/components-ypp01w3p.js +0 -986
  582. package/dist/shared/components-zfnmn5d4.js +0 -220
@@ -1,76 +1,148 @@
1
+ "use client";
2
+
3
+ import {
4
+ useShape2
5
+ } from "./components-qrpdtvxa.js";
6
+ import {
7
+ surfaceClasses2
8
+ } from "./components-ceyn28cf.js";
9
+ import {
10
+ useSurface2,
11
+ SurfaceProvider2
12
+ } from "./components-nwa2a9tq.js";
1
13
  import {
2
- opensInPlace,
3
- inPlaceOffset,
4
- useMorphOrigin,
5
- useMorph
6
- } from "./components-hqeq3w9q.js";
14
+ useControllableState2
15
+ } from "./components-wwd093xg.js";
7
16
  import {
8
17
  cn2
9
- } from "./components-ezxhrmer.js";
18
+ } from "./components-ycx2kxeq.js";
19
+ import {
20
+ useSize2
21
+ } from "./components-znspksk0.js";
22
+ import {
23
+ SizeScope2
24
+ } from "./components-1a7cr7vh.js";
25
+ import {
26
+ mergeRefs2
27
+ } from "./components-bkwjvvkh.js";
28
+ import {
29
+ spring2
30
+ } from "./components-45r18egt.js";
31
+ import {
32
+ Slider2
33
+ } from "./components-j8tcbm8y.js";
34
+ import {
35
+ useMorph2
36
+ } from "./components-pedbt2dc.js";
10
37
  import {
11
38
  FluidHoverHighlight2
12
- } from "./components-kvr7f9hy.js";
39
+ } from "./components-5vyaexsj.js";
13
40
  import {
14
- useIcon
15
- } from "./components-zrkzcayz.js";
41
+ FocusRing2
42
+ } from "./components-0mrhj88d.js";
16
43
  import {
17
- MorphSurface
18
- } from "./components-0q0sqfh4.js";
44
+ useIcon2
45
+ } from "./components-1nv9q3s8.js";
19
46
  import {
20
- shapeMap,
21
- useShape
22
- } from "./components-cv16mryv.js";
47
+ OverlayContext2,
48
+ useOverlayRoot2,
49
+ useOverlay2,
50
+ positionerProps2,
51
+ PortalContainer2,
52
+ usePortalContainer2
53
+ } from "./components-tjxy84s9.js";
23
54
  import {
24
- useSize2
25
- } from "./components-0sn7ypjw.js";
55
+ POPUP_SHAPE2
56
+ } from "./components-mse06t0x.js";
26
57
  import {
27
- SURFACE_BG,
28
- SURFACE_SHADOW,
29
- surfaceClasses2,
30
- useSurface2,
31
- SurfaceProvider2
32
- } from "./components-zx6b6yby.js";
58
+ PopupSurface2
59
+ } from "./components-nv5m3gcv.js";
60
+ import {
61
+ useRowFocus2
62
+ } from "./components-vcte8p75.js";
33
63
  import {
34
64
  useFluidHover2,
35
65
  useRegisterFluidHoverItem2
36
- } from "./components-59efxjd9.js";
66
+ } from "./components-7c4a0egq.js";
37
67
  import {
38
- SizeProvider2
39
- } from "./components-jjw69c4c.js";
68
+ WeightLabel2
69
+ } from "./components-vp6vzsee.js";
40
70
  import {
41
71
  Tooltip2
42
- } from "./components-ng72k97e.js";
43
- import {
44
- Slider2
45
- } from "./components-wvp1m52g.js";
72
+ } from "./components-p0z99d5b.js";
46
73
  import {
47
- spring2
48
- } from "./components-1v7rxytx.js";
74
+ useFieldBox2
75
+ } from "./components-wyfmhtw9.js";
49
76
 
50
77
  // components/inputs/color-picker/index.tsx
51
- import { Menu } from "@base-ui/react/menu";
52
- import { NumberField } from "@base-ui/react/number-field";
53
- import { Popover } from "@base-ui/react/popover";
54
- import { AnimatePresence, motion } from "motion/react";
55
78
  import {
56
- createContext,
57
- forwardRef,
58
- useCallback,
59
- useContext,
60
- useEffect,
61
- useMemo,
62
- useRef,
63
- useState
79
+ forwardRef as forwardRef4,
80
+ useCallback as useCallback4,
81
+ useContext as useContext2,
82
+ useEffect as useEffect4,
83
+ useMemo as useMemo5,
84
+ useRef as useRef5,
85
+ useState as useState4
64
86
  } from "react";
65
- import { jsx, jsxs } from "react/jsx-runtime";
66
- var ColorPickerPortalContainerContext = createContext(null);
67
- function ColorPickerPortalContainer2({ value, children }) {
68
- return /* @__PURE__ */ jsx(ColorPickerPortalContainerContext.Provider, {
69
- value,
70
- children
87
+
88
+ // components/inputs/color-picker/channel-sliders.tsx
89
+ import { jsx } from "react/jsx-runtime";
90
+ /*!
91
+ * Part of the ColorPicker port (Fluid Functionalism `registry/default/color-picker.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b,
92
+ * MIT License © 2026 Micka Touillaud). Local changes: see PORTING.md.
93
+ */
94
+ function HueSlider({ h, onChange }) {
95
+ const hueColor = `hsl(${h}, 100%, 50%)`;
96
+ return /* @__PURE__ */ jsx(Slider2, {
97
+ value: h,
98
+ onValueChange: (v) => onChange(typeof v === "number" ? v : v[0] ?? 0),
99
+ min: 0,
100
+ max: 360,
101
+ step: 1,
102
+ showValue: false,
103
+ hideFill: true,
104
+ thumbColor: hueColor,
105
+ thumbBorderColor: "var(--picker-thumb-border)",
106
+ trackStyle: {
107
+ background: "linear-gradient(to right, hsl(0,100%,50%), hsl(60,100%,50%), hsl(120,100%,50%), hsl(180,100%,50%), hsl(240,100%,50%), hsl(300,100%,50%), hsl(360,100%,50%))",
108
+ borderColor: "transparent"
109
+ },
110
+ "aria-label": "Hue"
71
111
  });
72
112
  }
73
- var PanelSurfaceContext = createContext(true);
113
+ function AlphaSlider({
114
+ a,
115
+ solidColor,
116
+ solidR,
117
+ solidG,
118
+ solidB,
119
+ onChange
120
+ }) {
121
+ const transparentColor = `rgba(${solidR}, ${solidG}, ${solidB}, 0)`;
122
+ return /* @__PURE__ */ jsx(Slider2, {
123
+ value: Math.round(a * 100),
124
+ onValueChange: (v) => onChange((typeof v === "number" ? v : v[0] ?? 0) / 100),
125
+ min: 0,
126
+ max: 100,
127
+ step: 1,
128
+ showValue: false,
129
+ hideFill: true,
130
+ thumbColor: solidColor,
131
+ thumbBorderColor: "var(--picker-thumb-border)",
132
+ trackStyle: {
133
+ backgroundImage: `linear-gradient(to right, ${transparentColor} 0%, ${solidColor} 98%), conic-gradient(var(--checker-a) 0 25%, var(--checker-b) 0 50%, var(--checker-a) 0 75%, var(--checker-b) 0)`,
134
+ backgroundSize: "100% 100%, 8px 8px",
135
+ borderWidth: 0
136
+ },
137
+ "aria-label": "Alpha"
138
+ });
139
+ }
140
+
141
+ // components/inputs/color-picker/color-math.ts
142
+ /*!
143
+ * Part of the ColorPicker port (Fluid Functionalism `registry/default/color-picker.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b,
144
+ * MIT License © 2026 Micka Touillaud). Local changes: see PORTING.md.
145
+ */
74
146
  function clamp01(n) {
75
147
  return Math.max(0, Math.min(1, n));
76
148
  }
@@ -391,181 +463,20 @@ function formatValueByFormat(parsed, fmt) {
391
463
  return parsed.oklch;
392
464
  }
393
465
  }
394
- var PANEL_WIDTH = 280;
395
- var SQUARE_HEIGHT = 156;
396
- var CHECKER_BG = {
397
- backgroundImage: "conic-gradient(var(--checker-a) 0 25%, var(--checker-b) 0 50%, var(--checker-a) 0 75%, var(--checker-b) 0)",
398
- backgroundSize: "8px 8px"
399
- };
400
- function SaturationSquare({ h, s, v, onChange }) {
401
- const ref = useRef(null);
402
- const [dragging, setDragging] = useState(false);
403
- const hasMoved = useRef(false);
404
- const [focused, setFocused] = useState(false);
405
- const [hovered, setHovered] = useState(false);
406
- const [cursorPos, setCursorPos] = useState(null);
407
- const shape = useShape();
408
- const updateFromPointer = useCallback((clientX, clientY) => {
409
- const rect = ref.current?.getBoundingClientRect();
410
- if (!rect)
411
- return;
412
- const x = clamp01((clientX - rect.left) / rect.width);
413
- const y = clamp01((clientY - rect.top) / rect.height);
414
- onChange(x, 1 - y);
415
- }, [onChange]);
416
- const updateCursorPos = useCallback((clientX, clientY) => {
417
- const rect = ref.current?.getBoundingClientRect();
418
- if (!rect)
419
- return;
420
- setCursorPos({
421
- x: clamp01((clientX - rect.left) / rect.width) * 100,
422
- y: clamp01((clientY - rect.top) / rect.height) * 100
423
- });
424
- }, []);
425
- const onPointerDown = useCallback((e) => {
426
- if (e.pointerType === "mouse" && e.button !== 0)
427
- return;
428
- e.preventDefault();
429
- setDragging(true);
430
- hasMoved.current = false;
431
- e.currentTarget.setPointerCapture(e.pointerId);
432
- updateFromPointer(e.clientX, e.clientY);
433
- }, [updateFromPointer]);
434
- const onPointerMove = useCallback((e) => {
435
- updateCursorPos(e.clientX, e.clientY);
436
- if (!dragging)
437
- return;
438
- hasMoved.current = true;
439
- updateFromPointer(e.clientX, e.clientY);
440
- }, [dragging, updateFromPointer, updateCursorPos]);
441
- const onPointerUp = useCallback(() => {
442
- setDragging(false);
443
- hasMoved.current = false;
444
- }, []);
445
- const onKeyDown = useCallback((e) => {
446
- const step = e.shiftKey ? 0.1 : 0.01;
447
- let nextS = s, nextV = v, handled = true;
448
- if (e.key === "ArrowLeft")
449
- nextS = clamp01(s - step);
450
- else if (e.key === "ArrowRight")
451
- nextS = clamp01(s + step);
452
- else if (e.key === "ArrowUp")
453
- nextV = clamp01(v + step);
454
- else if (e.key === "ArrowDown")
455
- nextV = clamp01(v - step);
456
- else
457
- handled = false;
458
- if (handled) {
459
- e.preventDefault();
460
- onChange(nextS, nextV);
461
- }
462
- }, [onChange, s, v]);
463
- const { r, g, b } = hsvToRgb(h, s, v);
464
- const thumbColor = `rgb(${Math.round(r)}, ${Math.round(g)}, ${Math.round(b)})`;
465
- return /* @__PURE__ */ jsxs("div", {
466
- ref,
467
- role: "application",
468
- "aria-label": "Saturation and brightness",
469
- tabIndex: 0,
470
- onFocus: (e) => {
471
- if (e.currentTarget.matches(":focus-visible"))
472
- setFocused(true);
473
- },
474
- onBlur: () => setFocused(false),
475
- onPointerEnter: () => setHovered(true),
476
- onPointerLeave: () => {
477
- setHovered(false);
478
- setCursorPos(null);
479
- },
480
- onPointerDown,
481
- onPointerMove,
482
- onPointerUp,
483
- onKeyDown,
484
- className: cn2("relative w-full select-none touch-none cursor-none outline-none", focused && "ring-2 ring-focus-ring", shape.bg),
485
- style: {
486
- height: SQUARE_HEIGHT
487
- },
488
- children: [
489
- /* @__PURE__ */ jsx("div", {
490
- className: cn2("absolute inset-0 overflow-hidden", shape.bg === "rounded-[20px]" ? "rounded-2xl" : shape.bg),
491
- style: {
492
- background: `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${h}, 100%, 50%))`
493
- }
494
- }),
495
- /* @__PURE__ */ jsx(motion.div, {
496
- className: "absolute pointer-events-none rounded-full border border-thumb shadow-picker-thumb",
497
- initial: false,
498
- animate: {
499
- left: `${s * 100}%`,
500
- top: `${(1 - v) * 100}%`,
501
- width: 18,
502
- height: 18
503
- },
504
- transition: { duration: 0 },
505
- style: {
506
- transform: "translate(-50%, -50%)",
507
- backgroundColor: thumbColor
508
- }
509
- }),
510
- hovered && !dragging && cursorPos && /* @__PURE__ */ jsx("div", {
511
- className: "absolute pointer-events-none rounded-full border-2 border-picker-ring shadow-picker-cursor",
512
- style: {
513
- left: `${cursorPos.x}%`,
514
- top: `${cursorPos.y}%`,
515
- width: 18,
516
- height: 18,
517
- transform: "translate(-50%, -50%)"
518
- }
519
- })
520
- ]
521
- });
522
- }
523
- function HueSlider({ h, onChange }) {
524
- const hueColor = `hsl(${h}, 100%, 50%)`;
525
- return /* @__PURE__ */ jsx(Slider2, {
526
- value: h,
527
- onChange: (v) => onChange(typeof v === "number" ? v : v[0] ?? 0),
528
- min: 0,
529
- max: 360,
530
- step: 1,
531
- showValue: false,
532
- hideFill: true,
533
- thumbColor: hueColor,
534
- thumbBorderColor: "var(--picker-thumb-border)",
535
- trackStyle: {
536
- background: "linear-gradient(to right, hsl(0,100%,50%), hsl(60,100%,50%), hsl(120,100%,50%), hsl(180,100%,50%), hsl(240,100%,50%), hsl(300,100%,50%), hsl(360,100%,50%))",
537
- borderColor: "transparent"
538
- },
539
- "aria-label": "Hue"
540
- });
541
- }
542
- function AlphaSlider({
543
- a,
544
- solidColor,
545
- solidR,
546
- solidG,
547
- solidB,
548
- onChange
549
- }) {
550
- const transparentColor = `rgba(${solidR}, ${solidG}, ${solidB}, 0)`;
551
- return /* @__PURE__ */ jsx(Slider2, {
552
- value: Math.round(a * 100),
553
- onChange: (v) => onChange((typeof v === "number" ? v : v[0] ?? 0) / 100),
554
- min: 0,
555
- max: 100,
556
- step: 1,
557
- showValue: false,
558
- hideFill: true,
559
- thumbColor: solidColor,
560
- thumbBorderColor: "var(--picker-thumb-border)",
561
- trackStyle: {
562
- backgroundImage: `linear-gradient(to right, ${transparentColor} 0%, ${solidColor} 98%), conic-gradient(var(--checker-a) 0 25%, var(--checker-b) 0 50%, var(--checker-a) 0 75%, var(--checker-b) 0)`,
563
- backgroundSize: "100% 100%, 8px 8px",
564
- borderWidth: 0
565
- },
566
- "aria-label": "Alpha"
567
- });
568
- }
466
+
467
+ // components/inputs/color-picker/context.ts
468
+ import { createContext } from "react";
469
+ var PanelSurfaceContext = createContext(true);
470
+
471
+ // components/inputs/color-picker/format-menu.tsx
472
+ import { Menu } from "@base-ui/react/menu";
473
+ import { AnimatePresence, motion } from "motion/react";
474
+ import { createContext as createContext2, useContext, useEffect, useMemo, useRef } from "react";
475
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
476
+ /*!
477
+ * Part of the ColorPicker port (Fluid Functionalism `registry/default/color-picker.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b,
478
+ * MIT License © 2026 Micka Touillaud). Local changes: see PORTING.md.
479
+ */
569
480
  var FORMAT_LABELS = {
570
481
  hex: "HEX",
571
482
  rgb: "RGB",
@@ -573,8 +484,7 @@ var FORMAT_LABELS = {
573
484
  oklch: "OKLCH"
574
485
  };
575
486
  var FORMATS = ["hex", "rgb", "hsl", "oklch"];
576
- var menuShape = shapeMap.rounded;
577
- var FormatMenuContext = createContext(null);
487
+ var FormatMenuContext = createContext2(null);
578
488
  function FormatItem({
579
489
  index,
580
490
  value,
@@ -583,56 +493,67 @@ function FormatItem({
583
493
  }) {
584
494
  const ref = useRef(null);
585
495
  const menuCtx = useContext(FormatMenuContext);
586
- const shape = useShape();
496
+ const shape = useShape2();
587
497
  const sizeClasses = useSize2();
588
498
  const compact = sizeClasses.variant === "compact";
589
499
  useRegisterFluidHoverItem2(menuCtx?.registerItem, index, ref);
590
500
  const isActive = menuCtx?.activeIndex === index;
591
- return /* @__PURE__ */ jsx(Menu.RadioItem, {
501
+ return /* @__PURE__ */ jsx2(Menu.RadioItem, {
592
502
  value,
593
503
  label,
594
504
  closeOnClick: true,
595
- render: /* @__PURE__ */ jsx("div", {
505
+ render: /* @__PURE__ */ jsx2("div", {
596
506
  ref,
597
507
  "data-fluid-hover-index": index,
598
508
  className: cn2("relative z-10 flex items-center cursor-pointer outline-none", compact ? "px-2.5 py-1.5" : "px-3 py-2", sizeClasses.text, shape.item)
599
509
  }),
600
- children: /* @__PURE__ */ jsxs("span", {
601
- className: "inline-grid",
510
+ children: /* @__PURE__ */ jsx2(WeightLabel2, {
511
+ emphasized: checked,
512
+ lit: isActive || checked,
513
+ children: label
514
+ })
515
+ });
516
+ }
517
+ function FormatMenu({ value, onValueChange, open, defaultOpen, onOpenChange }) {
518
+ const root = useOverlayRoot2({ open, defaultOpen, onOpenChange });
519
+ const shape = useShape2();
520
+ const sizeClasses = useSize2();
521
+ const ChevronDownIcon = useIcon2("chevron-down");
522
+ return /* @__PURE__ */ jsx2(OverlayContext2.Provider, {
523
+ value: root.state,
524
+ children: /* @__PURE__ */ jsxs(Menu.Root, {
525
+ open: root.open,
526
+ onOpenChange: root.onOpenChange,
527
+ modal: false,
602
528
  children: [
603
- /* @__PURE__ */ jsx("span", {
604
- className: "col-start-1 row-start-1 invisible weight-semibold",
605
- "aria-hidden": "true",
606
- children: label
529
+ /* @__PURE__ */ jsxs(Menu.Trigger, {
530
+ className: cn2("flex items-center justify-between bg-transparent hover:bg-hover hover:text-foreground transition-colors duration-fast outline-none focus-visible:ring-1 focus-visible:ring-focus-ring cursor-pointer", sizeClasses.gap, sizeClasses.control, sizeClasses.px, sizeClasses.text, root.open ? "bg-active text-foreground" : "text-muted-foreground active:bg-active", shape.input, "weight-medium"),
531
+ children: [
532
+ /* @__PURE__ */ jsx2("span", {
533
+ children: FORMAT_LABELS[value]
534
+ }),
535
+ /* @__PURE__ */ jsx2(ChevronDownIcon, {
536
+ size: 14,
537
+ strokeWidth: 1.5,
538
+ className: cn2("text-muted-foreground transition-transform duration-150", root.open && "rotate-180")
539
+ })
540
+ ]
607
541
  }),
608
- /* @__PURE__ */ jsx("span", {
609
- className: cn2("col-start-1 row-start-1 transition-[color,font-variation-settings] duration-fast", isActive || checked ? "text-foreground" : "text-muted-foreground", checked ? "weight-semibold" : "weight-normal"),
610
- children: label
542
+ /* @__PURE__ */ jsx2(FormatPopup, {
543
+ value,
544
+ onValueChange
611
545
  })
612
546
  ]
613
547
  })
614
548
  });
615
549
  }
616
- function FormatDropdown({
617
- value,
618
- onChange,
619
- open: openProp,
620
- defaultOpen = false
621
- }) {
622
- const [internalOpen, setInternalOpen] = useState(defaultOpen);
623
- const isControlled = openProp !== undefined;
624
- const open = isControlled ? openProp : internalOpen;
625
- const { origin, capture } = useMorphOrigin();
626
- const morph = useMorph(open, origin, { tier: "moderate" });
627
- const level = Math.min(useSurface2() + 2, 8);
628
- const shape = useShape();
629
- const sizeClasses = useSize2();
630
- const portalContainer = useContext(ColorPickerPortalContainerContext);
550
+ function FormatPopup({ value, onValueChange }) {
551
+ const { open, origin } = useOverlay2("FormatMenu");
552
+ const morph = useMorph2(open, origin, { tier: "moderate" });
631
553
  const containerRef = useRef(null);
632
- const ChevronDownIcon = useIcon("chevron-down");
633
554
  const hover = useFluidHover2(containerRef);
634
- const { activeIndex, setActiveIndex, itemRects, handlers, registerItem, remeasure } = hover;
635
- const [focusedIndex, setFocusedIndex] = useState(null);
555
+ const { activeIndex, itemRects, handlers, registerItem, remeasure } = hover;
556
+ const rowFocus = useRowFocus2(hover);
636
557
  useEffect(() => {
637
558
  if (!open)
638
559
  return;
@@ -640,138 +561,90 @@ function FormatDropdown({
640
561
  }, [open, remeasure]);
641
562
  const checkedIndex = FORMATS.indexOf(value);
642
563
  const checkedRect = checkedIndex !== -1 ? itemRects[checkedIndex] ?? null : null;
643
- const focusRect = focusedIndex !== null ? itemRects[focusedIndex] ?? null : null;
644
- const menuCtx = useMemo(() => ({ registerItem, activeIndex, checkedIndex }), [registerItem, activeIndex, checkedIndex]);
645
- return /* @__PURE__ */ jsxs(Menu.Root, {
646
- open,
647
- onOpenChange: (next, details) => {
648
- if (next)
649
- capture(details);
650
- if (!isControlled)
651
- setInternalOpen(next);
652
- },
653
- modal: false,
654
- children: [
655
- /* @__PURE__ */ jsxs(Menu.Trigger, {
656
- className: cn2("flex items-center justify-between bg-transparent hover:bg-hover hover:text-foreground transition-colors duration-fast outline-none focus-visible:ring-1 focus-visible:ring-focus-ring cursor-pointer", sizeClasses.gap, sizeClasses.control, sizeClasses.px, sizeClasses.text, open ? "bg-active text-foreground" : "text-muted-foreground active:bg-active", shape.input, "weight-medium"),
657
- children: [
658
- /* @__PURE__ */ jsx("span", {
659
- children: FORMAT_LABELS[value]
660
- }),
661
- /* @__PURE__ */ jsx(ChevronDownIcon, {
662
- size: 14,
663
- strokeWidth: 1.5,
664
- className: cn2("text-muted-foreground transition-transform duration-150", open && "rotate-180")
665
- })
666
- ]
667
- }),
668
- /* @__PURE__ */ jsx(Menu.Portal, {
669
- container: portalContainer ?? undefined,
670
- children: /* @__PURE__ */ jsx(Menu.Positioner, {
671
- side: "bottom",
672
- align: "start",
673
- sideOffset: 6,
674
- className: "z-[60] outline-none",
675
- children: /* @__PURE__ */ jsx(FormatMenuContext.Provider, {
676
- value: menuCtx,
677
- children: /* @__PURE__ */ jsx(Menu.Popup, {
678
- ref: morph.popupRef,
679
- onMouseEnter: () => {
680
- handlers.onMouseEnter();
681
- setFocusedIndex(null);
682
- },
683
- onMouseMove: handlers.onMouseMove,
684
- onMouseLeave: handlers.onMouseLeave,
685
- onClick: handlers.onClick,
686
- onFocus: (e) => {
687
- const indexAttr = e.target.closest("[data-fluid-hover-index]")?.getAttribute("data-fluid-hover-index");
688
- if (indexAttr != null) {
689
- const idx = Number(indexAttr);
690
- setActiveIndex(idx);
691
- setFocusedIndex(e.target.matches(":focus-visible") ? idx : null);
692
- }
693
- },
694
- onBlur: (e) => {
695
- if (e.currentTarget.contains(e.relatedTarget))
696
- return;
697
- setFocusedIndex(null);
698
- setActiveIndex(null);
699
- },
700
- className: "relative select-none outline-none",
701
- children: /* @__PURE__ */ jsx(SurfaceProvider2, {
702
- value: level,
703
- children: /* @__PURE__ */ jsx(MorphSurface, {
704
- morph,
705
- bg: SURFACE_BG[level],
706
- shadow: SURFACE_SHADOW[3],
707
- radius: menuShape.container,
708
- className: "min-w-[var(--anchor-width)]",
709
- children: /* @__PURE__ */ jsxs("div", {
710
- ref: containerRef,
711
- className: "relative flex flex-col p-1",
712
- children: [
713
- /* @__PURE__ */ jsx(AnimatePresence, {
714
- children: checkedRect && /* @__PURE__ */ jsx(motion.div, {
715
- className: `absolute ${menuShape.bg} bg-active pointer-events-none`,
716
- initial: false,
717
- animate: {
718
- top: checkedRect.top,
719
- left: checkedRect.left,
720
- width: checkedRect.width,
721
- height: checkedRect.height,
722
- opacity: 1
723
- },
724
- exit: { opacity: 0, transition: spring2.moderate.exit },
725
- transition: {
726
- ...spring2.moderate,
727
- opacity: { duration: spring2.fast.duration }
728
- }
729
- })
730
- }),
731
- /* @__PURE__ */ jsx(FluidHoverHighlight2, {
732
- hover,
733
- from: checkedRect,
734
- className: menuShape.bg
735
- }),
736
- /* @__PURE__ */ jsx(AnimatePresence, {
737
- children: focusRect && /* @__PURE__ */ jsx(motion.div, {
738
- className: `absolute ${menuShape.focusRing} pointer-events-none z-20 border border-focus-ring`,
739
- initial: false,
740
- animate: {
741
- left: focusRect.left - 2,
742
- top: focusRect.top - 2,
743
- width: focusRect.width + 4,
744
- height: focusRect.height + 4
745
- },
746
- exit: { opacity: 0, transition: spring2.fast.exit },
747
- transition: {
748
- ...spring2.fast,
749
- opacity: { duration: spring2.fast.duration }
750
- }
751
- })
752
- }),
753
- /* @__PURE__ */ jsx(Menu.RadioGroup, {
754
- value,
755
- onValueChange: (next) => onChange(next),
756
- className: "contents",
757
- children: FORMATS.map((fmt, i) => /* @__PURE__ */ jsx(FormatItem, {
758
- index: i,
759
- value: fmt,
760
- label: FORMAT_LABELS[fmt],
761
- checked: value === fmt
762
- }, fmt))
763
- })
764
- ]
564
+ const menuCtx = useMemo(() => ({ registerItem, activeIndex }), [registerItem, activeIndex]);
565
+ return /* @__PURE__ */ jsx2(Menu.Portal, {
566
+ container: usePortalContainer2(),
567
+ children: /* @__PURE__ */ jsx2(Menu.Positioner, {
568
+ side: "bottom",
569
+ align: "start",
570
+ sideOffset: 6,
571
+ className: "z-[60] outline-none",
572
+ children: /* @__PURE__ */ jsx2(FormatMenuContext.Provider, {
573
+ value: menuCtx,
574
+ children: /* @__PURE__ */ jsx2(Menu.Popup, {
575
+ ref: morph.popupRef,
576
+ onMouseEnter: () => {
577
+ handlers.onMouseEnter();
578
+ rowFocus.setFocusedIndex(null);
579
+ },
580
+ onMouseMove: handlers.onMouseMove,
581
+ onMouseLeave: handlers.onMouseLeave,
582
+ onClick: handlers.onClick,
583
+ ...rowFocus.handlers,
584
+ className: "relative select-none outline-none",
585
+ children: /* @__PURE__ */ jsx2(PopupSurface2, {
586
+ morph,
587
+ radius: POPUP_SHAPE2.container,
588
+ className: "min-w-[var(--anchor-width)]",
589
+ children: /* @__PURE__ */ jsxs("div", {
590
+ ref: containerRef,
591
+ className: "relative flex flex-col p-1",
592
+ children: [
593
+ /* @__PURE__ */ jsx2(AnimatePresence, {
594
+ children: checkedRect && /* @__PURE__ */ jsx2(motion.div, {
595
+ className: `absolute ${POPUP_SHAPE2.bg} bg-active pointer-events-none`,
596
+ initial: false,
597
+ animate: {
598
+ top: checkedRect.top,
599
+ left: checkedRect.left,
600
+ width: checkedRect.width,
601
+ height: checkedRect.height,
602
+ opacity: 1
603
+ },
604
+ exit: { opacity: 0, transition: spring2.moderate.exit },
605
+ transition: {
606
+ ...spring2.moderate,
607
+ opacity: { duration: spring2.fast.duration }
608
+ }
765
609
  })
610
+ }),
611
+ /* @__PURE__ */ jsx2(FluidHoverHighlight2, {
612
+ hover,
613
+ from: checkedRect,
614
+ className: POPUP_SHAPE2.bg
615
+ }),
616
+ /* @__PURE__ */ jsx2(FocusRing2, {
617
+ rect: rowFocus.focusRect,
618
+ className: POPUP_SHAPE2.focusRing
619
+ }),
620
+ /* @__PURE__ */ jsx2(Menu.RadioGroup, {
621
+ value,
622
+ onValueChange: (next) => onValueChange(next),
623
+ className: "contents",
624
+ children: FORMATS.map((fmt, i) => /* @__PURE__ */ jsx2(FormatItem, {
625
+ index: i,
626
+ value: fmt,
627
+ label: FORMAT_LABELS[fmt],
628
+ checked: value === fmt
629
+ }, fmt))
766
630
  })
767
- })
631
+ ]
768
632
  })
769
633
  })
770
634
  })
771
635
  })
772
- ]
636
+ })
773
637
  });
774
638
  }
639
+
640
+ // components/inputs/color-picker/color-input.tsx
641
+ import { NumberField } from "@base-ui/react/number-field";
642
+ import { forwardRef, useCallback, useEffect as useEffect2, useMemo as useMemo2, useRef as useRef2, useState } from "react";
643
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
644
+ /*!
645
+ * Part of the ColorPicker port (Fluid Functionalism `registry/default/color-picker.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b,
646
+ * MIT License © 2026 Micka Touillaud). Local changes: see PORTING.md.
647
+ */
775
648
  var TextColorInput = forwardRef(({
776
649
  value,
777
650
  onCommit,
@@ -791,11 +664,11 @@ var TextColorInput = forwardRef(({
791
664
  wrap = false
792
665
  }, ref) => {
793
666
  const [draft, setDraft] = useState(value);
794
- const interactingRef = useRef(false);
795
- const shape = useShape();
667
+ const interactingRef = useRef2(false);
668
+ const shape = useShape2();
796
669
  const sizeClasses = useSize2();
797
670
  const compact = sizeClasses.variant === "compact";
798
- useEffect(() => {
671
+ useEffect2(() => {
799
672
  if (!interactingRef.current)
800
673
  setDraft(value);
801
674
  }, [value]);
@@ -823,15 +696,15 @@ var TextColorInput = forwardRef(({
823
696
  return;
824
697
  commitNumber(cur + direction * baseStep);
825
698
  };
826
- return /* @__PURE__ */ jsxs("div", {
699
+ return /* @__PURE__ */ jsxs2("div", {
827
700
  className: cn2("flex items-center px-2 bg-transparent hover:bg-hover active:bg-active transition-colors duration-fast focus-within:ring-1 focus-within:ring-focus-ring select-none", sizeClasses.control, shape.input, className),
828
701
  style: { width },
829
702
  children: [
830
- prefix && /* @__PURE__ */ jsx("span", {
703
+ prefix && /* @__PURE__ */ jsx3("span", {
831
704
  className: cn2("text-muted-foreground mr-1 select-none", compact ? "text-caption-compact" : "text-caption"),
832
705
  children: prefix
833
706
  }),
834
- /* @__PURE__ */ jsx("input", {
707
+ /* @__PURE__ */ jsx3("input", {
835
708
  ref,
836
709
  value: draft,
837
710
  onChange: (e) => setDraft(e.target.value),
@@ -888,15 +761,15 @@ var ScrubColorInput = forwardRef(({
888
761
  max,
889
762
  wrap = false
890
763
  }, ref) => {
891
- const shape = useShape();
764
+ const shape = useShape2();
892
765
  const sizeClasses = useSize2();
893
766
  const compact = sizeClasses.variant === "compact";
894
- const inputRef = useRef(null);
767
+ const inputRef = useRef2(null);
895
768
  const [editing, setEditing] = useState(false);
896
- const pointerDownRef = useRef(false);
769
+ const pointerDownRef = useRef2(false);
897
770
  const numeric = parseFloat(String(value).replace("%", ""));
898
771
  const fieldValue = Number.isNaN(numeric) ? null : numeric;
899
- const format = useMemo(() => {
772
+ const format = useMemo2(() => {
900
773
  const f = { useGrouping: false };
901
774
  if (decimals != null) {
902
775
  f.minimumFractionDigits = decimals;
@@ -910,13 +783,6 @@ var ScrubColorInput = forwardRef(({
910
783
  }
911
784
  return f;
912
785
  }, [decimals, hasPercent]);
913
- const setInputRef = useCallback((node) => {
914
- inputRef.current = node;
915
- if (typeof ref === "function")
916
- ref(node);
917
- else if (ref)
918
- ref.current = node;
919
- }, [ref]);
920
786
  const commit = useCallback((n) => {
921
787
  let bounded = n;
922
788
  if (wrap && min != null && max != null) {
@@ -933,7 +799,7 @@ var ScrubColorInput = forwardRef(({
933
799
  const formatted = decimals != null ? bounded.toFixed(decimals) : String(Math.round(bounded));
934
800
  onCommit(hasPercent ? `${formatted}%` : formatted);
935
801
  }, [wrap, min, max, decimals, hasPercent, onCommit]);
936
- return /* @__PURE__ */ jsx(NumberField.Root, {
802
+ return /* @__PURE__ */ jsx3(NumberField.Root, {
937
803
  value: fieldValue,
938
804
  onValueChange: (next, eventDetails) => {
939
805
  if (next == null)
@@ -957,7 +823,7 @@ var ScrubColorInput = forwardRef(({
957
823
  format,
958
824
  className: cn2("flex items-center bg-transparent hover:bg-hover active:bg-active transition-colors duration-fast focus-within:ring-1 focus-within:ring-focus-ring select-none", sizeClasses.control, shape.input, className),
959
825
  style: { width },
960
- children: /* @__PURE__ */ jsxs(NumberField.ScrubArea, {
826
+ children: /* @__PURE__ */ jsxs2(NumberField.ScrubArea, {
961
827
  direction: "horizontal",
962
828
  pixelSensitivity: 1,
963
829
  onPointerDownCapture: () => {
@@ -971,26 +837,26 @@ var ScrubColorInput = forwardRef(({
971
837
  },
972
838
  className: cn2("flex flex-1 min-w-0 items-center self-stretch px-2", !editing && "cursor-ew-resize"),
973
839
  children: [
974
- /* @__PURE__ */ jsx(NumberField.ScrubAreaCursor, {
840
+ /* @__PURE__ */ jsx3(NumberField.ScrubAreaCursor, {
975
841
  className: "drop-shadow-picker-cursor",
976
- children: /* @__PURE__ */ jsx("svg", {
842
+ children: /* @__PURE__ */ jsx3("svg", {
977
843
  width: 24,
978
844
  height: 14,
979
845
  viewBox: "0 0 24 14",
980
846
  className: "fill-picker-edge stroke-thumb",
981
847
  strokeWidth: 1,
982
848
  "aria-hidden": "true",
983
- children: /* @__PURE__ */ jsx("path", {
849
+ children: /* @__PURE__ */ jsx3("path", {
984
850
  d: "M0.5 7l5-5v3.5h13V2l5 5-5 5V8.5h-13V12l-5-5z"
985
851
  })
986
852
  })
987
853
  }),
988
- prefix && /* @__PURE__ */ jsx("span", {
854
+ prefix && /* @__PURE__ */ jsx3("span", {
989
855
  className: cn2("text-muted-foreground mr-1 select-none", compact ? "text-caption-compact" : "text-caption"),
990
856
  children: prefix
991
857
  }),
992
- /* @__PURE__ */ jsx(NumberField.Input, {
993
- ref: setInputRef,
858
+ /* @__PURE__ */ jsx3(NumberField.Input, {
859
+ ref: mergeRefs2(inputRef, ref),
994
860
  "aria-label": ariaLabel,
995
861
  inputMode,
996
862
  onPointerDown: (e) => {
@@ -1027,362 +893,53 @@ var ScrubColorInput = forwardRef(({
1027
893
  });
1028
894
  });
1029
895
  ScrubColorInput.displayName = "ScrubColorInput";
1030
- var ColorInput = forwardRef(({ scrubbable = false, ...props }, ref) => scrubbable ? /* @__PURE__ */ jsx(ScrubColorInput, {
896
+ var ColorInput = forwardRef(({ scrubbable = false, ...props }, ref) => scrubbable ? /* @__PURE__ */ jsx3(ScrubColorInput, {
1031
897
  ref,
1032
898
  ...props
1033
- }) : /* @__PURE__ */ jsx(TextColorInput, {
899
+ }) : /* @__PURE__ */ jsx3(TextColorInput, {
1034
900
  ref,
1035
901
  ...props
1036
902
  }));
1037
903
  ColorInput.displayName = "ColorInput";
1038
- function EyeDropperButton({ onPick }) {
1039
- const [supported, setSupported] = useState(false);
1040
- const shape = useShape();
1041
- const sizeClasses = useSize2();
1042
- const PipetteIcon = useIcon("pipette");
1043
- useEffect(() => {
1044
- setSupported(typeof window !== "undefined" && "EyeDropper" in window);
1045
- }, []);
1046
- if (!supported)
1047
- return null;
1048
- const handleClick = async () => {
1049
- try {
1050
- const Ctor = window.EyeDropper;
1051
- const eye = new Ctor;
1052
- const result = await eye.open();
1053
- onPick(result.sRGBHex);
1054
- } catch {}
1055
- };
1056
- return /* @__PURE__ */ jsx("button", {
1057
- type: "button",
1058
- onClick: handleClick,
1059
- "aria-label": "Pick color from screen",
1060
- className: cn2("flex items-center justify-center text-muted-foreground bg-transparent hover:bg-hover hover:text-foreground active:bg-active transition-colors duration-fast outline-none focus-visible:ring-1 focus-visible:ring-focus-ring cursor-pointer", sizeClasses.control, sizeClasses.px, shape.input),
1061
- children: /* @__PURE__ */ jsx(PipetteIcon, {
1062
- size: sizeClasses.icon,
1063
- strokeWidth: 1.5
1064
- })
1065
- });
1066
- }
1067
- function ColorTile2({ color, size = 24, className, style }) {
1068
- const shape = useShape();
1069
- return /* @__PURE__ */ jsx("span", {
1070
- className: cn2("inline-block relative shrink-0 overflow-hidden shadow-swatch", shape.bg, className),
1071
- style: {
1072
- width: size,
1073
- height: size,
1074
- ...CHECKER_BG,
1075
- ...style
1076
- },
1077
- children: /* @__PURE__ */ jsx("span", {
1078
- className: "absolute inset-0",
1079
- style: { backgroundColor: color }
904
+ function ChannelTooltip({ label, children }) {
905
+ return /* @__PURE__ */ jsx3(Tooltip2, {
906
+ content: label,
907
+ delayDuration: 300,
908
+ children: /* @__PURE__ */ jsx3("div", {
909
+ children
1080
910
  })
1081
911
  });
1082
912
  }
1083
- var ColorSwatch2 = forwardRef(({ color, size = 28, selected, className, onMouseEnter, onMouseLeave, ...props }, ref) => {
1084
- const shape = useShape();
1085
- const [hovered, setHovered] = useState(false);
1086
- const ring = selected ? "shadow-swatch-selected" : hovered ? "shadow-swatch-hover" : "shadow-swatch";
1087
- return /* @__PURE__ */ jsx("button", {
1088
- ref,
1089
- type: "button",
1090
- "aria-label": `Select color ${color}`,
1091
- className: cn2("relative shrink-0 overflow-hidden cursor-pointer outline-none transition-shadow duration-100", shape.bg, ring, className),
1092
- style: {
1093
- width: size,
1094
- height: size,
1095
- ...CHECKER_BG
1096
- },
1097
- onMouseEnter: (e) => {
1098
- setHovered(true);
1099
- onMouseEnter?.(e);
1100
- },
1101
- onMouseLeave: (e) => {
1102
- setHovered(false);
1103
- onMouseLeave?.(e);
1104
- },
1105
- ...props,
1106
- children: /* @__PURE__ */ jsx("span", {
1107
- className: "absolute inset-0",
1108
- style: { backgroundColor: color }
1109
- })
1110
- });
1111
- });
1112
- ColorSwatch2.displayName = "ColorSwatch";
1113
- function SwatchStrip({
1114
- swatches,
1115
- current,
1116
- onPick
1117
- }) {
1118
- const normalizedCurrent = useMemo(() => {
1119
- const p = parseColor2(current);
1120
- return p ? rgbToHexStr(p.r, p.g, p.b, p.a).toLowerCase() : "";
1121
- }, [current]);
1122
- const [resolvedSwatches, setResolvedSwatches] = useState({});
1123
- useEffect(() => {
1124
- const next = {};
1125
- for (const sw of swatches) {
1126
- if (!parseColor2(sw)) {
1127
- const p = resolveCssColor(sw);
1128
- if (p)
1129
- next[sw] = rgbToHexStr(p.r, p.g, p.b, p.a).toLowerCase();
1130
- }
1131
- }
1132
- setResolvedSwatches(next);
1133
- }, [swatches]);
1134
- return /* @__PURE__ */ jsx("div", {
1135
- className: "flex flex-wrap gap-2",
1136
- children: swatches.map((sw, i) => {
1137
- const parsed = parseColor2(sw);
1138
- const normalized = parsed ? rgbToHexStr(parsed.r, parsed.g, parsed.b, parsed.a).toLowerCase() : resolvedSwatches[sw] ?? sw.toLowerCase();
1139
- const isSelected = normalized === normalizedCurrent;
1140
- return /* @__PURE__ */ jsx(ColorSwatch2, {
1141
- color: sw,
1142
- size: 28,
1143
- selected: isSelected,
1144
- onClick: () => onPick(sw)
1145
- }, `${sw}-${i}`);
913
+ function AlphaInput({ value, onCommit }) {
914
+ return /* @__PURE__ */ jsx3(ChannelTooltip, {
915
+ label: "Alpha",
916
+ children: /* @__PURE__ */ jsx3(ColorInput, {
917
+ value: `${value}%`,
918
+ onCommit: (input) => {
919
+ const n = parseFloat(input.replace("%", ""));
920
+ if (Number.isNaN(n))
921
+ return;
922
+ onCommit(Math.max(0, Math.min(100, Math.round(n))));
923
+ },
924
+ ariaLabel: "Alpha",
925
+ align: "center",
926
+ inputMode: "numeric",
927
+ nudgeStep: 1,
928
+ nudgeShiftStep: 10,
929
+ hasPercent: true,
930
+ scrubbable: true,
931
+ min: 0,
932
+ max: 100
1146
933
  })
1147
934
  });
1148
935
  }
1149
- var ColorPicker2 = forwardRef(({
1150
- value,
1151
- defaultValue = "#6B97FF",
1152
- onValueChange,
1153
- format,
1154
- defaultFormat = "hex",
1155
- onFormatChange,
1156
- swatches,
1157
- hideEyedropper,
1158
- formatOpen,
1159
- defaultFormatOpen,
1160
- size,
1161
- className,
1162
- ...props
1163
- }, ref) => {
1164
- const isControlled = value !== undefined;
1165
- const [internalValue, setInternalValue] = useState(value ?? defaultValue);
1166
- const currentRawValue = isControlled ? value : internalValue;
1167
- const isFormatControlled = format !== undefined;
1168
- const [internalFormat, setInternalFormat] = useState(defaultFormat);
1169
- const currentFormat = isFormatControlled ? format : internalFormat;
1170
- const initialParsed = useMemo(() => {
1171
- const p = parseColor2(currentRawValue);
1172
- if (!p)
1173
- return { h: 0, s: 1, v: 1, a: 1 };
1174
- const hsv = rgbToHsv(p.r, p.g, p.b);
1175
- return { h: hsv.s === 0 ? 0 : hsv.h, s: hsv.s, v: hsv.v, a: p.a };
1176
- }, []);
1177
- const [hsv, setHsv] = useState(initialParsed);
1178
- const oklchHueRef = useRef(null);
1179
- const lastEmittedRef = useRef("");
1180
- useEffect(() => {
1181
- if (!isControlled)
1182
- return;
1183
- const emitted = lastEmittedRef.current;
1184
- const cur = value;
1185
- if (cur === emitted)
1186
- return;
1187
- const p = parseColor2(cur);
1188
- if (!p)
1189
- return;
1190
- oklchHueRef.current = null;
1191
- const newHsv = rgbToHsv(p.r, p.g, p.b);
1192
- setHsv((prev) => ({
1193
- h: newHsv.s === 0 ? prev.h : newHsv.h,
1194
- s: newHsv.s,
1195
- v: newHsv.v,
1196
- a: p.a
1197
- }));
1198
- }, [value, isControlled]);
1199
- const parsed = useMemo(() => buildParsed2(hsv.h, hsv.s, hsv.v, hsv.a), [hsv]);
1200
- const updateHsv = useCallback((next) => {
1201
- const merged = { ...hsv, ...next };
1202
- setHsv(merged);
1203
- const p = buildParsed2(merged.h, merged.s, merged.v, merged.a);
1204
- const formatted = formatValueByFormat(p, currentFormat);
1205
- lastEmittedRef.current = formatted;
1206
- if (!isControlled)
1207
- setInternalValue(formatted);
1208
- onValueChange?.(formatted, p);
1209
- }, [hsv, currentFormat, isControlled, onValueChange]);
1210
- const handleFormatChange = useCallback((f) => {
1211
- if (!isFormatControlled)
1212
- setInternalFormat(f);
1213
- onFormatChange?.(f);
1214
- const formatted = formatValueByFormat(parsed, f);
1215
- lastEmittedRef.current = formatted;
1216
- if (!isControlled)
1217
- setInternalValue(formatted);
1218
- onValueChange?.(formatted, parsed);
1219
- }, [isFormatControlled, isControlled, onFormatChange, onValueChange, parsed]);
1220
- const handleHexCommit = useCallback((input) => {
1221
- const p = resolveCssColor(input);
1222
- if (!p)
1223
- return;
1224
- oklchHueRef.current = null;
1225
- const newHsv = rgbToHsv(p.r, p.g, p.b);
1226
- const merged = {
1227
- h: newHsv.s === 0 ? hsv.h : newHsv.h,
1228
- s: newHsv.s,
1229
- v: newHsv.v,
1230
- a: p.a
1231
- };
1232
- setHsv(merged);
1233
- const next = buildParsed2(merged.h, merged.s, merged.v, merged.a);
1234
- const formatted = formatValueByFormat(next, currentFormat);
1235
- lastEmittedRef.current = formatted;
1236
- if (!isControlled)
1237
- setInternalValue(formatted);
1238
- onValueChange?.(formatted, next);
1239
- }, [hsv.h, currentFormat, isControlled, onValueChange]);
1240
- const handleSwatchPick = useCallback((sw) => {
1241
- handleHexCommit(sw);
1242
- }, [handleHexCommit]);
1243
- const handleEyedrop = useCallback((hex) => {
1244
- handleHexCommit(hex);
1245
- }, [handleHexCommit]);
1246
- const solidHueRgb = useMemo(() => hsvToRgb(hsv.h, hsv.s, hsv.v), [hsv.h, hsv.s, hsv.v]);
1247
- const solidR = Math.round(solidHueRgb.r);
1248
- const solidG = Math.round(solidHueRgb.g);
1249
- const solidB = Math.round(solidHueRgb.b);
1250
- const solidColorString = `rgb(${solidR}, ${solidG}, ${solidB})`;
1251
- const shape = useShape();
1252
- const substrate = useSurface2();
1253
- const pickerLevel = Math.max(substrate, 3);
1254
- const paintsSurface = useContext(PanelSurfaceContext);
1255
- const root = /* @__PURE__ */ jsx(SurfaceProvider2, {
1256
- value: pickerLevel,
1257
- children: /* @__PURE__ */ jsxs("div", {
1258
- ref,
1259
- className: cn2("flex flex-col gap-2 p-3", paintsSurface && surfaceClasses2(pickerLevel, 1), shape.container, className),
1260
- style: { width: PANEL_WIDTH },
1261
- ...props,
1262
- children: [
1263
- /* @__PURE__ */ jsx(SaturationSquare, {
1264
- h: hsv.h,
1265
- s: hsv.s,
1266
- v: hsv.v,
1267
- onChange: (s, v) => updateHsv({ s, v })
1268
- }),
1269
- /* @__PURE__ */ jsxs("div", {
1270
- className: "flex flex-col [&>*]:mb-0 [&>*+*]:-mt-px",
1271
- children: [
1272
- /* @__PURE__ */ jsx(HueSlider, {
1273
- h: hsv.h,
1274
- onChange: (h) => {
1275
- oklchHueRef.current = null;
1276
- updateHsv({ h });
1277
- }
1278
- }),
1279
- /* @__PURE__ */ jsx(AlphaSlider, {
1280
- a: hsv.a,
1281
- solidColor: solidColorString,
1282
- solidR,
1283
- solidG,
1284
- solidB,
1285
- onChange: (a) => updateHsv({ a })
1286
- })
1287
- ]
1288
- }),
1289
- /* @__PURE__ */ jsxs("div", {
1290
- className: "grid grid-cols-2 gap-2",
1291
- children: [
1292
- /* @__PURE__ */ jsx(FormatDropdown, {
1293
- value: currentFormat,
1294
- onChange: handleFormatChange,
1295
- open: formatOpen,
1296
- defaultOpen: defaultFormatOpen
1297
- }),
1298
- !hideEyedropper && /* @__PURE__ */ jsx(EyeDropperButton, {
1299
- onPick: handleEyedrop
1300
- })
1301
- ]
1302
- }),
1303
- /* @__PURE__ */ jsx(ColorInputsRow, {
1304
- parsed,
1305
- format: currentFormat,
1306
- oklchHue: oklchHueRef.current,
1307
- onChannelChange: (channel, value) => {
1308
- const p = { ...parsed };
1309
- switch (channel) {
1310
- case "hex":
1311
- handleHexCommit(value);
1312
- return;
1313
- case "r":
1314
- case "g":
1315
- case "b": {
1316
- oklchHueRef.current = null;
1317
- const r = channel === "r" ? Number(value) : p.r;
1318
- const g = channel === "g" ? Number(value) : p.g;
1319
- const b = channel === "b" ? Number(value) : p.b;
1320
- const hsvVal = rgbToHsv(r, g, b);
1321
- updateHsv({
1322
- h: hsvVal.s === 0 ? hsv.h : hsvVal.h,
1323
- s: hsvVal.s,
1324
- v: hsvVal.v
1325
- });
1326
- return;
1327
- }
1328
- case "hSL":
1329
- case "sSL":
1330
- case "lSL": {
1331
- if (channel === "hSL")
1332
- oklchHueRef.current = null;
1333
- const hsl = rgbToHsl(p.r, p.g, p.b);
1334
- const h2 = channel === "hSL" ? Number(value) : hsl.h;
1335
- const s2 = channel === "sSL" ? Number(value) / 100 : hsl.s;
1336
- const l2 = channel === "lSL" ? Number(value) / 100 : hsl.l;
1337
- const rgb = hslToRgb(h2, clamp01(s2), clamp01(l2));
1338
- const hsvVal = rgbToHsv(rgb.r, rgb.g, rgb.b);
1339
- updateHsv({
1340
- h: hsvVal.s === 0 ? h2 : hsvVal.h,
1341
- s: hsvVal.s,
1342
- v: hsvVal.v
1343
- });
1344
- return;
1345
- }
1346
- case "L":
1347
- case "C":
1348
- case "H": {
1349
- const cur = rgbToOklch(p.r, p.g, p.b);
1350
- const baseH = oklchHueRef.current ?? cur.H;
1351
- const L = channel === "L" ? Number(value) / 100 : cur.L;
1352
- const C = channel === "C" ? Number(value) : cur.C;
1353
- const H = channel === "H" ? Number(value) : baseH;
1354
- oklchHueRef.current = H;
1355
- const rgb = oklchToRgb(clamp01(L), Math.max(0, C), H);
1356
- const hsvVal = rgbToHsv(rgb.r, rgb.g, rgb.b);
1357
- updateHsv({
1358
- h: hsvVal.s === 0 ? hsv.h : hsvVal.h,
1359
- s: hsvVal.s,
1360
- v: hsvVal.v
1361
- });
1362
- return;
1363
- }
1364
- case "alphaPercent": {
1365
- const a = clamp01(Number(value) / 100);
1366
- updateHsv({ a });
1367
- return;
1368
- }
1369
- }
1370
- }
1371
- }),
1372
- swatches && swatches.length > 0 && /* @__PURE__ */ jsx(SwatchStrip, {
1373
- swatches,
1374
- current: parsed.hex,
1375
- onPick: handleSwatchPick
1376
- })
1377
- ]
1378
- })
1379
- });
1380
- return size ? /* @__PURE__ */ jsx(SizeProvider2, {
1381
- size,
1382
- children: root
1383
- }) : root;
1384
- });
1385
- ColorPicker2.displayName = "ColorPicker";
936
+
937
+ // components/inputs/color-picker/inputs-row.tsx
938
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
939
+ /*!
940
+ * Part of the ColorPicker port (Fluid Functionalism `registry/default/color-picker.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b,
941
+ * MIT License © 2026 Micka Touillaud). Local changes: see PORTING.md.
942
+ */
1386
943
  function ColorInputsRow({
1387
944
  parsed,
1388
945
  format,
@@ -1392,19 +949,19 @@ function ColorInputsRow({
1392
949
  const alphaPct = Math.round(parsed.a * 100);
1393
950
  if (format === "hex") {
1394
951
  const hexNoHash = parsed.hex.replace(/^#/, "").toUpperCase();
1395
- return /* @__PURE__ */ jsxs("div", {
952
+ return /* @__PURE__ */ jsxs3("div", {
1396
953
  className: "grid grid-cols-2 gap-2",
1397
954
  children: [
1398
- /* @__PURE__ */ jsx(ChannelTooltip, {
955
+ /* @__PURE__ */ jsx4(ChannelTooltip, {
1399
956
  label: "Hex",
1400
- children: /* @__PURE__ */ jsx(ColorInput, {
957
+ children: /* @__PURE__ */ jsx4(ColorInput, {
1401
958
  value: hexNoHash,
1402
959
  onCommit: (next) => onChannelChange("hex", next.startsWith("#") ? next : `#${next}`),
1403
960
  ariaLabel: "Hex value",
1404
961
  prefix: "#"
1405
962
  })
1406
963
  }),
1407
- /* @__PURE__ */ jsx(AlphaInput, {
964
+ /* @__PURE__ */ jsx4(AlphaInput, {
1408
965
  value: alphaPct,
1409
966
  onCommit: (n) => onChannelChange("alphaPercent", String(n))
1410
967
  })
@@ -1412,12 +969,12 @@ function ColorInputsRow({
1412
969
  });
1413
970
  }
1414
971
  if (format === "rgb") {
1415
- return /* @__PURE__ */ jsxs("div", {
972
+ return /* @__PURE__ */ jsxs3("div", {
1416
973
  className: "grid grid-cols-4 gap-1",
1417
974
  children: [
1418
- /* @__PURE__ */ jsx(ChannelTooltip, {
975
+ /* @__PURE__ */ jsx4(ChannelTooltip, {
1419
976
  label: "Red",
1420
- children: /* @__PURE__ */ jsx(ColorInput, {
977
+ children: /* @__PURE__ */ jsx4(ColorInput, {
1421
978
  value: String(parsed.r),
1422
979
  onCommit: (n) => onChannelChange("r", n),
1423
980
  ariaLabel: "Red",
@@ -1430,9 +987,9 @@ function ColorInputsRow({
1430
987
  max: 255
1431
988
  })
1432
989
  }),
1433
- /* @__PURE__ */ jsx(ChannelTooltip, {
990
+ /* @__PURE__ */ jsx4(ChannelTooltip, {
1434
991
  label: "Green",
1435
- children: /* @__PURE__ */ jsx(ColorInput, {
992
+ children: /* @__PURE__ */ jsx4(ColorInput, {
1436
993
  value: String(parsed.g),
1437
994
  onCommit: (n) => onChannelChange("g", n),
1438
995
  ariaLabel: "Green",
@@ -1445,9 +1002,9 @@ function ColorInputsRow({
1445
1002
  max: 255
1446
1003
  })
1447
1004
  }),
1448
- /* @__PURE__ */ jsx(ChannelTooltip, {
1005
+ /* @__PURE__ */ jsx4(ChannelTooltip, {
1449
1006
  label: "Blue",
1450
- children: /* @__PURE__ */ jsx(ColorInput, {
1007
+ children: /* @__PURE__ */ jsx4(ColorInput, {
1451
1008
  value: String(parsed.b),
1452
1009
  onCommit: (n) => onChannelChange("b", n),
1453
1010
  ariaLabel: "Blue",
@@ -1460,7 +1017,7 @@ function ColorInputsRow({
1460
1017
  max: 255
1461
1018
  })
1462
1019
  }),
1463
- /* @__PURE__ */ jsx(AlphaInput, {
1020
+ /* @__PURE__ */ jsx4(AlphaInput, {
1464
1021
  value: alphaPct,
1465
1022
  onCommit: (n) => onChannelChange("alphaPercent", String(n))
1466
1023
  })
@@ -1469,12 +1026,12 @@ function ColorInputsRow({
1469
1026
  }
1470
1027
  if (format === "hsl") {
1471
1028
  const hsl = rgbToHsl(parsed.r, parsed.g, parsed.b);
1472
- return /* @__PURE__ */ jsxs("div", {
1029
+ return /* @__PURE__ */ jsxs3("div", {
1473
1030
  className: "grid grid-cols-4 gap-1",
1474
1031
  children: [
1475
- /* @__PURE__ */ jsx(ChannelTooltip, {
1032
+ /* @__PURE__ */ jsx4(ChannelTooltip, {
1476
1033
  label: "Hue",
1477
- children: /* @__PURE__ */ jsx(ColorInput, {
1034
+ children: /* @__PURE__ */ jsx4(ColorInput, {
1478
1035
  value: String(Math.round(hsl.h)),
1479
1036
  onCommit: (n) => onChannelChange("hSL", n),
1480
1037
  ariaLabel: "Hue",
@@ -1488,9 +1045,9 @@ function ColorInputsRow({
1488
1045
  wrap: true
1489
1046
  })
1490
1047
  }),
1491
- /* @__PURE__ */ jsx(ChannelTooltip, {
1048
+ /* @__PURE__ */ jsx4(ChannelTooltip, {
1492
1049
  label: "Saturation",
1493
- children: /* @__PURE__ */ jsx(ColorInput, {
1050
+ children: /* @__PURE__ */ jsx4(ColorInput, {
1494
1051
  value: String(Math.round(hsl.s * 100)),
1495
1052
  onCommit: (n) => onChannelChange("sSL", n),
1496
1053
  ariaLabel: "Saturation",
@@ -1503,9 +1060,9 @@ function ColorInputsRow({
1503
1060
  max: 100
1504
1061
  })
1505
1062
  }),
1506
- /* @__PURE__ */ jsx(ChannelTooltip, {
1063
+ /* @__PURE__ */ jsx4(ChannelTooltip, {
1507
1064
  label: "Lightness",
1508
- children: /* @__PURE__ */ jsx(ColorInput, {
1065
+ children: /* @__PURE__ */ jsx4(ColorInput, {
1509
1066
  value: String(Math.round(hsl.l * 100)),
1510
1067
  onCommit: (n) => onChannelChange("lSL", n),
1511
1068
  ariaLabel: "Lightness",
@@ -1518,7 +1075,7 @@ function ColorInputsRow({
1518
1075
  max: 100
1519
1076
  })
1520
1077
  }),
1521
- /* @__PURE__ */ jsx(AlphaInput, {
1078
+ /* @__PURE__ */ jsx4(AlphaInput, {
1522
1079
  value: alphaPct,
1523
1080
  onCommit: (n) => onChannelChange("alphaPercent", String(n))
1524
1081
  })
@@ -1527,12 +1084,12 @@ function ColorInputsRow({
1527
1084
  }
1528
1085
  const oklch = rgbToOklch(parsed.r, parsed.g, parsed.b);
1529
1086
  const displayH = oklchHue ?? oklch.H;
1530
- return /* @__PURE__ */ jsxs("div", {
1087
+ return /* @__PURE__ */ jsxs3("div", {
1531
1088
  className: "grid grid-cols-4 gap-1",
1532
1089
  children: [
1533
- /* @__PURE__ */ jsx(ChannelTooltip, {
1090
+ /* @__PURE__ */ jsx4(ChannelTooltip, {
1534
1091
  label: "Lightness",
1535
- children: /* @__PURE__ */ jsx(ColorInput, {
1092
+ children: /* @__PURE__ */ jsx4(ColorInput, {
1536
1093
  value: (oklch.L * 100).toFixed(0),
1537
1094
  onCommit: (n) => onChannelChange("L", n),
1538
1095
  ariaLabel: "Lightness",
@@ -1545,9 +1102,9 @@ function ColorInputsRow({
1545
1102
  max: 100
1546
1103
  })
1547
1104
  }),
1548
- /* @__PURE__ */ jsx(ChannelTooltip, {
1105
+ /* @__PURE__ */ jsx4(ChannelTooltip, {
1549
1106
  label: "Chroma",
1550
- children: /* @__PURE__ */ jsx(ColorInput, {
1107
+ children: /* @__PURE__ */ jsx4(ColorInput, {
1551
1108
  value: oklch.C.toFixed(2),
1552
1109
  onCommit: (n) => onChannelChange("C", n),
1553
1110
  ariaLabel: "Chroma",
@@ -1561,9 +1118,9 @@ function ColorInputsRow({
1561
1118
  max: 0.4
1562
1119
  })
1563
1120
  }),
1564
- /* @__PURE__ */ jsx(ChannelTooltip, {
1121
+ /* @__PURE__ */ jsx4(ChannelTooltip, {
1565
1122
  label: "Hue",
1566
- children: /* @__PURE__ */ jsx(ColorInput, {
1123
+ children: /* @__PURE__ */ jsx4(ColorInput, {
1567
1124
  value: displayH.toFixed(0),
1568
1125
  onCommit: (n) => onChannelChange("H", n),
1569
1126
  ariaLabel: "Hue",
@@ -1577,183 +1134,638 @@ function ColorInputsRow({
1577
1134
  wrap: true
1578
1135
  })
1579
1136
  }),
1580
- /* @__PURE__ */ jsx(AlphaInput, {
1137
+ /* @__PURE__ */ jsx4(AlphaInput, {
1581
1138
  value: alphaPct,
1582
1139
  onCommit: (n) => onChannelChange("alphaPercent", String(n))
1583
1140
  })
1584
1141
  ]
1585
1142
  });
1586
1143
  }
1587
- function ChannelTooltip({ label, children }) {
1588
- return /* @__PURE__ */ jsx(Tooltip2, {
1589
- content: label,
1590
- delayDuration: 300,
1591
- children: /* @__PURE__ */ jsx("div", {
1592
- children
1593
- })
1594
- });
1595
- }
1596
- function AlphaInput({ value, onCommit }) {
1597
- return /* @__PURE__ */ jsx(ChannelTooltip, {
1598
- label: "Alpha",
1599
- children: /* @__PURE__ */ jsx(ColorInput, {
1600
- value: `${value}%`,
1601
- onCommit: (input) => {
1602
- const n = parseFloat(input.replace("%", ""));
1603
- if (Number.isNaN(n))
1604
- return;
1605
- onCommit(Math.max(0, Math.min(100, Math.round(n))));
1606
- },
1607
- ariaLabel: "Alpha",
1608
- align: "center",
1609
- inputMode: "numeric",
1610
- nudgeStep: 1,
1611
- nudgeShiftStep: 10,
1612
- hasPercent: true,
1613
- scrubbable: true,
1614
- min: 0,
1615
- max: 100
1144
+
1145
+ // components/inputs/color-picker/popover.tsx
1146
+ import { Popover } from "@base-ui/react/popover";
1147
+ import { forwardRef as forwardRef3, useCallback as useCallback2, useMemo as useMemo4, useRef as useRef3 } from "react";
1148
+
1149
+ // components/inputs/color-picker/swatches.tsx
1150
+ import { forwardRef as forwardRef2, useEffect as useEffect3, useMemo as useMemo3, useState as useState2 } from "react";
1151
+ import { jsx as jsx5 } from "react/jsx-runtime";
1152
+ /*!
1153
+ * Part of the ColorPicker port (Fluid Functionalism `registry/default/color-picker.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b,
1154
+ * MIT License © 2026 Micka Touillaud). Local changes: see PORTING.md.
1155
+ */
1156
+ var CHECKER_BG = {
1157
+ backgroundImage: "conic-gradient(var(--checker-a) 0 25%, var(--checker-b) 0 50%, var(--checker-a) 0 75%, var(--checker-b) 0)",
1158
+ backgroundSize: "8px 8px"
1159
+ };
1160
+ function EyeDropperButton({ onPick }) {
1161
+ const [supported, setSupported] = useState2(false);
1162
+ const shape = useShape2();
1163
+ const sizeClasses = useSize2();
1164
+ const PipetteIcon = useIcon2("pipette");
1165
+ useEffect3(() => {
1166
+ setSupported(typeof window !== "undefined" && "EyeDropper" in window);
1167
+ }, []);
1168
+ if (!supported)
1169
+ return null;
1170
+ const handleClick = async () => {
1171
+ try {
1172
+ const Ctor = window.EyeDropper;
1173
+ const eye = new Ctor;
1174
+ const result = await eye.open();
1175
+ onPick(result.sRGBHex);
1176
+ } catch {}
1177
+ };
1178
+ return /* @__PURE__ */ jsx5("button", {
1179
+ type: "button",
1180
+ onClick: handleClick,
1181
+ "aria-label": "Pick color from screen",
1182
+ className: cn2("flex items-center justify-center text-muted-foreground bg-transparent hover:bg-hover hover:text-foreground active:bg-active transition-colors duration-fast outline-none focus-visible:ring-1 focus-visible:ring-focus-ring cursor-pointer", sizeClasses.control, sizeClasses.px, shape.input),
1183
+ children: /* @__PURE__ */ jsx5(PipetteIcon, {
1184
+ size: sizeClasses.icon,
1185
+ strokeWidth: 1.5
1616
1186
  })
1617
1187
  });
1618
1188
  }
1619
- var ColorPickerPopover2 = forwardRef(({
1620
- triggerLabel,
1621
- triggerLabelPosition = "left",
1189
+ function ColorTile2({ color, size = 24, className, style }) {
1190
+ const shape = useShape2();
1191
+ return /* @__PURE__ */ jsx5("span", {
1192
+ className: cn2("inline-block relative shrink-0 overflow-hidden shadow-swatch", shape.bg, className),
1193
+ style: {
1194
+ width: size,
1195
+ height: size,
1196
+ ...CHECKER_BG,
1197
+ ...style
1198
+ },
1199
+ children: /* @__PURE__ */ jsx5("span", {
1200
+ className: "absolute inset-0",
1201
+ style: { backgroundColor: color }
1202
+ })
1203
+ });
1204
+ }
1205
+ var ColorSwatch2 = forwardRef2(({ color, size = 28, selected, className, onMouseEnter, onMouseLeave, ...props }, ref) => {
1206
+ const shape = useShape2();
1207
+ const [hovered, setHovered] = useState2(false);
1208
+ const ring = selected ? "shadow-swatch-selected" : hovered ? "shadow-swatch-hover" : "shadow-swatch";
1209
+ return /* @__PURE__ */ jsx5("button", {
1210
+ ref,
1211
+ type: "button",
1212
+ "aria-label": `Select color ${color}`,
1213
+ className: cn2("relative shrink-0 overflow-hidden cursor-pointer outline-none transition-shadow duration-100", shape.bg, ring, className),
1214
+ style: {
1215
+ width: size,
1216
+ height: size,
1217
+ ...CHECKER_BG
1218
+ },
1219
+ onMouseEnter: (e) => {
1220
+ setHovered(true);
1221
+ onMouseEnter?.(e);
1222
+ },
1223
+ onMouseLeave: (e) => {
1224
+ setHovered(false);
1225
+ onMouseLeave?.(e);
1226
+ },
1227
+ ...props,
1228
+ children: /* @__PURE__ */ jsx5("span", {
1229
+ className: "absolute inset-0",
1230
+ style: { backgroundColor: color }
1231
+ })
1232
+ });
1233
+ });
1234
+ ColorSwatch2.displayName = "ColorSwatch";
1235
+ function SwatchStrip({
1236
+ swatches,
1237
+ current,
1238
+ onPick
1239
+ }) {
1240
+ const normalizedCurrent = useMemo3(() => {
1241
+ const p = parseColor2(current);
1242
+ return p ? rgbToHexStr(p.r, p.g, p.b, p.a).toLowerCase() : "";
1243
+ }, [current]);
1244
+ const [resolvedSwatches, setResolvedSwatches] = useState2({});
1245
+ useEffect3(() => {
1246
+ const next = {};
1247
+ for (const sw of swatches) {
1248
+ if (!parseColor2(sw)) {
1249
+ const p = resolveCssColor(sw);
1250
+ if (p)
1251
+ next[sw] = rgbToHexStr(p.r, p.g, p.b, p.a).toLowerCase();
1252
+ }
1253
+ }
1254
+ setResolvedSwatches(next);
1255
+ }, [swatches]);
1256
+ return /* @__PURE__ */ jsx5("div", {
1257
+ className: "flex flex-wrap gap-2",
1258
+ children: swatches.map((sw, i) => {
1259
+ const parsed = parseColor2(sw);
1260
+ const normalized = parsed ? rgbToHexStr(parsed.r, parsed.g, parsed.b, parsed.a).toLowerCase() : resolvedSwatches[sw] ?? sw.toLowerCase();
1261
+ const isSelected = normalized === normalizedCurrent;
1262
+ return /* @__PURE__ */ jsx5(ColorSwatch2, {
1263
+ color: sw,
1264
+ size: 28,
1265
+ selected: isSelected,
1266
+ onClick: () => onPick(sw)
1267
+ }, `${sw}-${i}`);
1268
+ })
1269
+ });
1270
+ }
1271
+
1272
+ // components/inputs/color-picker/popover.tsx
1273
+ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
1274
+ /*!
1275
+ * Part of the ColorPicker port (Fluid Functionalism `registry/default/color-picker.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b,
1276
+ * MIT License © 2026 Micka Touillaud). Local changes: see PORTING.md.
1277
+ */
1278
+ var ColorPickerPopover2 = forwardRef3(({
1279
+ triggerLabel,
1280
+ triggerLabelPosition = "left",
1622
1281
  triggerShowValue = true,
1623
1282
  triggerShowRemove = false,
1624
1283
  onTriggerRemove,
1625
1284
  triggerClassName,
1626
- open: openProp,
1627
- defaultOpen = false,
1285
+ open,
1286
+ defaultOpen,
1628
1287
  onOpenChange,
1629
1288
  size,
1630
1289
  from,
1631
1290
  effect,
1632
1291
  hideSource,
1633
1292
  tier,
1293
+ value: valueProp,
1294
+ defaultValue = "#6B97FF",
1295
+ onValueChange,
1296
+ name,
1634
1297
  ...pickerProps
1635
1298
  }, ref) => {
1636
- const isOpenControlled = openProp !== undefined;
1637
- const [internalOpen, setInternalOpen] = useState(defaultOpen);
1638
- const open = isOpenControlled ? openProp : internalOpen;
1639
- const { origin, capture } = useMorphOrigin();
1640
- const morph = useMorph(open, origin, { from, effect, hideSource, tier });
1641
- const shape = useShape();
1642
- const sizeClasses = useSize2(size);
1299
+ const root = useOverlayRoot2({ open, defaultOpen, onOpenChange });
1300
+ const [value, setValue] = useControllableState2(valueProp, defaultValue);
1301
+ const handleValueChange = useCallback2((next, parsed) => {
1302
+ setValue(next);
1303
+ onValueChange?.(next, parsed);
1304
+ }, [setValue, onValueChange]);
1305
+ const box = useFieldBox2({ variant: "bordered", size });
1306
+ const sizeClasses = box.size;
1643
1307
  const compact = sizeClasses.variant === "compact";
1644
- const substrate = useSurface2();
1645
- const level = Math.min(substrate + 2, 8);
1646
- const handleOpenChange = useCallback((next, details) => {
1647
- if (next)
1648
- capture(details);
1649
- if (!isOpenControlled)
1650
- setInternalOpen(next);
1651
- onOpenChange?.(next);
1652
- }, [isOpenControlled, onOpenChange, capture]);
1653
- const isControlled = pickerProps.value !== undefined;
1654
- const [internalValue, setInternalValue] = useState(pickerProps.value ?? pickerProps.defaultValue ?? "#6B97FF");
1655
- const currentValue = isControlled ? pickerProps.value : internalValue;
1656
- const handleValueChange = useCallback((v, parsed) => {
1657
- if (!isControlled)
1658
- setInternalValue(v);
1659
- pickerProps.onValueChange?.(v, parsed);
1660
- }, [isControlled, pickerProps]);
1661
- const XIcon = useIcon("x");
1662
- const parsed = useMemo(() => parseColor2(currentValue), [currentValue]);
1663
- const swatchColor = parsed ? rgbToHexStr(parsed.r, parsed.g, parsed.b, parsed.a) : currentValue;
1664
- const valueLabel = parsed ? rgbToHexStr(parsed.r, parsed.g, parsed.b, 1).replace(/^#/, "").toUpperCase() : currentValue;
1665
- const root = /* @__PURE__ */ jsx(Popover.Root, {
1666
- open,
1667
- onOpenChange: handleOpenChange,
1668
- modal: false,
1669
- children: /* @__PURE__ */ jsxs("div", {
1670
- ref,
1671
- className: "inline-flex",
1672
- children: [
1673
- /* @__PURE__ */ jsxs(Popover.Trigger, {
1674
- className: cn2("flex items-center border border-border bg-transparent hover:bg-hover transition-colors duration-fast outline-none focus-visible:ring-1 focus-visible:ring-focus-ring cursor-pointer", sizeClasses.gap, sizeClasses.control, compact ? "px-1.5" : "px-2", shape.input, "weight-medium", triggerClassName),
1675
- children: [
1676
- triggerLabel && triggerLabelPosition === "left" && /* @__PURE__ */ jsx("span", {
1677
- className: cn2("text-muted-foreground px-1 select-none", sizeClasses.text),
1678
- children: triggerLabel
1679
- }),
1680
- /* @__PURE__ */ jsx(ColorTile2, {
1681
- color: swatchColor,
1682
- size: compact ? 16 : 20
1683
- }),
1684
- triggerShowValue && /* @__PURE__ */ jsx("span", {
1685
- className: cn2("text-foreground tabular-nums", sizeClasses.text),
1686
- children: valueLabel
1687
- }),
1688
- triggerLabel && triggerLabelPosition === "right" && /* @__PURE__ */ jsx("span", {
1689
- className: cn2("text-muted-foreground px-1 select-none", sizeClasses.text),
1690
- children: triggerLabel
1691
- }),
1692
- triggerShowRemove && /* @__PURE__ */ jsx("span", {
1693
- role: "button",
1694
- "aria-label": "Remove color",
1695
- tabIndex: 0,
1696
- onClick: (e) => {
1697
- e.stopPropagation();
1698
- onTriggerRemove?.();
1699
- },
1700
- onKeyDown: (e) => {
1701
- if (e.key === "Enter" || e.key === " ") {
1702
- e.stopPropagation();
1703
- e.preventDefault();
1704
- onTriggerRemove?.();
1705
- }
1706
- },
1707
- className: "ml-1 text-muted-foreground hover:text-foreground cursor-pointer flex items-center",
1708
- children: /* @__PURE__ */ jsx(XIcon, {
1709
- size: 14,
1710
- strokeWidth: 1.5
1711
- })
1712
- })
1713
- ]
1714
- }),
1715
- /* @__PURE__ */ jsx(Popover.Portal, {
1716
- children: /* @__PURE__ */ jsx(Popover.Positioner, {
1717
- side: "bottom",
1718
- align: "start",
1719
- sideOffset: opensInPlace({ effect, hideSource }) ? inPlaceOffset : 6,
1720
- className: "z-50 outline-none",
1721
- children: /* @__PURE__ */ jsx(Popover.Popup, {
1722
- ref: morph.popupRef,
1723
- className: "relative outline-none",
1724
- children: /* @__PURE__ */ jsx(ColorPickerPortalContainer2, {
1725
- value: morph.popup,
1726
- children: /* @__PURE__ */ jsx(SurfaceProvider2, {
1727
- value: level,
1728
- children: /* @__PURE__ */ jsx(MorphSurface, {
1729
- morph,
1730
- bg: SURFACE_BG[level],
1731
- shadow: SURFACE_SHADOW[3],
1732
- radius: shape.container,
1733
- children: /* @__PURE__ */ jsx(PanelSurfaceContext.Provider, {
1734
- value: false,
1735
- children: /* @__PURE__ */ jsx(ColorPicker2, {
1736
- ...pickerProps,
1737
- value: currentValue,
1738
- onValueChange: handleValueChange
1739
- })
1740
- })
1741
- })
1308
+ const frameRef = useRef3(null);
1309
+ const XIcon = useIcon2("x");
1310
+ const parsed = useMemo4(() => parseColor2(value), [value]);
1311
+ const swatchColor = parsed ? rgbToHexStr(parsed.r, parsed.g, parsed.b, parsed.a) : value;
1312
+ const valueLabel = parsed ? rgbToHexStr(parsed.r, parsed.g, parsed.b, 1).replace(/^#/, "").toUpperCase() : value;
1313
+ const label = /* @__PURE__ */ jsx6("span", {
1314
+ className: cn2("text-muted-foreground px-1 select-none", sizeClasses.text),
1315
+ children: triggerLabel
1316
+ });
1317
+ return /* @__PURE__ */ jsx6(SizeScope2, {
1318
+ size,
1319
+ children: /* @__PURE__ */ jsx6(OverlayContext2.Provider, {
1320
+ value: root.state,
1321
+ children: /* @__PURE__ */ jsxs4(Popover.Root, {
1322
+ open: root.open,
1323
+ onOpenChange: root.onOpenChange,
1324
+ modal: false,
1325
+ children: [
1326
+ /* @__PURE__ */ jsxs4("div", {
1327
+ ref: mergeRefs2(frameRef, ref),
1328
+ ...box.props,
1329
+ className: cn2(box.props.className, "inline-flex items-center cursor-pointer [&:has(:focus-visible)]:!ring-focus-ring", sizeClasses.control, triggerClassName),
1330
+ children: [
1331
+ /* @__PURE__ */ jsxs4(Popover.Trigger, {
1332
+ className: cn2("flex items-center self-stretch bg-transparent outline-none cursor-pointer weight-medium", sizeClasses.gap),
1333
+ children: [
1334
+ triggerLabel && triggerLabelPosition === "left" && label,
1335
+ /* @__PURE__ */ jsx6(ColorTile2, {
1336
+ color: swatchColor,
1337
+ size: compact ? 16 : 20
1338
+ }),
1339
+ triggerShowValue && /* @__PURE__ */ jsx6("span", {
1340
+ className: cn2("text-foreground tabular-nums", sizeClasses.text),
1341
+ children: valueLabel
1342
+ }),
1343
+ triggerLabel && triggerLabelPosition === "right" && label
1344
+ ]
1345
+ }),
1346
+ triggerShowRemove && /* @__PURE__ */ jsx6("button", {
1347
+ type: "button",
1348
+ "aria-label": "Remove color",
1349
+ onClick: onTriggerRemove,
1350
+ className: "ml-1 flex items-center bg-transparent text-muted-foreground hover:text-foreground outline-none cursor-pointer",
1351
+ children: /* @__PURE__ */ jsx6(XIcon, {
1352
+ size: 14,
1353
+ strokeWidth: 1.5
1742
1354
  })
1355
+ }),
1356
+ name && /* @__PURE__ */ jsx6("input", {
1357
+ type: "hidden",
1358
+ name,
1359
+ value
1360
+ })
1361
+ ]
1362
+ }),
1363
+ /* @__PURE__ */ jsx6(ColorPickerPanel, {
1364
+ anchor: frameRef,
1365
+ morphProps: { from, effect, hideSource, tier },
1366
+ pickerProps: { ...pickerProps, value, onValueChange: handleValueChange }
1367
+ })
1368
+ ]
1369
+ })
1370
+ })
1371
+ });
1372
+ });
1373
+ ColorPickerPopover2.displayName = "ColorPickerPopover";
1374
+ function ColorPickerPanel({
1375
+ anchor,
1376
+ morphProps,
1377
+ pickerProps
1378
+ }) {
1379
+ const { open, origin } = useOverlay2("ColorPicker.Popover");
1380
+ const morph = useMorph2(open, origin, morphProps);
1381
+ return /* @__PURE__ */ jsx6(Popover.Portal, {
1382
+ children: /* @__PURE__ */ jsx6(Popover.Positioner, {
1383
+ anchor,
1384
+ ...positionerProps2(morphProps, { side: "bottom", align: "start", sideOffset: 6 }),
1385
+ children: /* @__PURE__ */ jsx6(Popover.Popup, {
1386
+ ref: morph.popupRef,
1387
+ className: "relative outline-none",
1388
+ children: /* @__PURE__ */ jsx6(PortalContainer2, {
1389
+ value: morph.popup,
1390
+ children: /* @__PURE__ */ jsx6(PopupSurface2, {
1391
+ morph,
1392
+ children: /* @__PURE__ */ jsx6(PanelSurfaceContext.Provider, {
1393
+ value: false,
1394
+ children: /* @__PURE__ */ jsx6(ColorPicker2, {
1395
+ ...pickerProps
1743
1396
  })
1744
1397
  })
1745
1398
  })
1746
1399
  })
1747
- ]
1400
+ })
1748
1401
  })
1749
1402
  });
1750
- return size ? /* @__PURE__ */ jsx(SizeProvider2, {
1403
+ }
1404
+
1405
+ // components/inputs/color-picker/saturation-square.tsx
1406
+ import { motion as motion2 } from "motion/react";
1407
+ import { useCallback as useCallback3, useRef as useRef4, useState as useState3 } from "react";
1408
+ import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
1409
+ /*!
1410
+ * Part of the ColorPicker port (Fluid Functionalism `registry/default/color-picker.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b,
1411
+ * MIT License © 2026 Micka Touillaud). Local changes: see PORTING.md.
1412
+ */
1413
+ var SQUARE_HEIGHT = 156;
1414
+ function SaturationSquare({ h, s, v, onChange }) {
1415
+ const ref = useRef4(null);
1416
+ const [dragging, setDragging] = useState3(false);
1417
+ const hasMoved = useRef4(false);
1418
+ const [focused, setFocused] = useState3(false);
1419
+ const [hovered, setHovered] = useState3(false);
1420
+ const [cursorPos, setCursorPos] = useState3(null);
1421
+ const shape = useShape2();
1422
+ const updateFromPointer = useCallback3((clientX, clientY) => {
1423
+ const rect = ref.current?.getBoundingClientRect();
1424
+ if (!rect)
1425
+ return;
1426
+ const x = clamp01((clientX - rect.left) / rect.width);
1427
+ const y = clamp01((clientY - rect.top) / rect.height);
1428
+ onChange(x, 1 - y);
1429
+ }, [onChange]);
1430
+ const updateCursorPos = useCallback3((clientX, clientY) => {
1431
+ const rect = ref.current?.getBoundingClientRect();
1432
+ if (!rect)
1433
+ return;
1434
+ setCursorPos({
1435
+ x: clamp01((clientX - rect.left) / rect.width) * 100,
1436
+ y: clamp01((clientY - rect.top) / rect.height) * 100
1437
+ });
1438
+ }, []);
1439
+ const onPointerDown = useCallback3((e) => {
1440
+ if (e.pointerType === "mouse" && e.button !== 0)
1441
+ return;
1442
+ e.preventDefault();
1443
+ setDragging(true);
1444
+ hasMoved.current = false;
1445
+ e.currentTarget.setPointerCapture(e.pointerId);
1446
+ updateFromPointer(e.clientX, e.clientY);
1447
+ }, [updateFromPointer]);
1448
+ const onPointerMove = useCallback3((e) => {
1449
+ updateCursorPos(e.clientX, e.clientY);
1450
+ if (!dragging)
1451
+ return;
1452
+ hasMoved.current = true;
1453
+ updateFromPointer(e.clientX, e.clientY);
1454
+ }, [dragging, updateFromPointer, updateCursorPos]);
1455
+ const onPointerUp = useCallback3(() => {
1456
+ setDragging(false);
1457
+ hasMoved.current = false;
1458
+ }, []);
1459
+ const onKeyDown = useCallback3((e) => {
1460
+ const step = e.shiftKey ? 0.1 : 0.01;
1461
+ let nextS = s, nextV = v, handled = true;
1462
+ if (e.key === "ArrowLeft")
1463
+ nextS = clamp01(s - step);
1464
+ else if (e.key === "ArrowRight")
1465
+ nextS = clamp01(s + step);
1466
+ else if (e.key === "ArrowUp")
1467
+ nextV = clamp01(v + step);
1468
+ else if (e.key === "ArrowDown")
1469
+ nextV = clamp01(v - step);
1470
+ else
1471
+ handled = false;
1472
+ if (handled) {
1473
+ e.preventDefault();
1474
+ onChange(nextS, nextV);
1475
+ }
1476
+ }, [onChange, s, v]);
1477
+ const { r, g, b } = hsvToRgb(h, s, v);
1478
+ const thumbColor = `rgb(${Math.round(r)}, ${Math.round(g)}, ${Math.round(b)})`;
1479
+ return /* @__PURE__ */ jsxs5("div", {
1480
+ ref,
1481
+ role: "application",
1482
+ "aria-label": "Saturation and brightness",
1483
+ tabIndex: 0,
1484
+ onFocus: (e) => {
1485
+ if (e.currentTarget.matches(":focus-visible"))
1486
+ setFocused(true);
1487
+ },
1488
+ onBlur: () => setFocused(false),
1489
+ onPointerEnter: () => setHovered(true),
1490
+ onPointerLeave: () => {
1491
+ setHovered(false);
1492
+ setCursorPos(null);
1493
+ },
1494
+ onPointerDown,
1495
+ onPointerMove,
1496
+ onPointerUp,
1497
+ onKeyDown,
1498
+ className: cn2("relative w-full select-none touch-none cursor-none outline-none", focused && "ring-2 ring-focus-ring", shape.bg),
1499
+ style: {
1500
+ height: SQUARE_HEIGHT
1501
+ },
1502
+ children: [
1503
+ /* @__PURE__ */ jsx7("div", {
1504
+ className: cn2("absolute inset-0 overflow-hidden", shape.bg === "rounded-[20px]" ? "rounded-2xl" : shape.bg),
1505
+ style: {
1506
+ background: `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${h}, 100%, 50%))`
1507
+ }
1508
+ }),
1509
+ /* @__PURE__ */ jsx7(motion2.div, {
1510
+ className: "absolute pointer-events-none rounded-full border border-thumb shadow-picker-thumb",
1511
+ initial: false,
1512
+ animate: {
1513
+ left: `${s * 100}%`,
1514
+ top: `${(1 - v) * 100}%`,
1515
+ width: 18,
1516
+ height: 18
1517
+ },
1518
+ transition: { duration: 0 },
1519
+ style: {
1520
+ transform: "translate(-50%, -50%)",
1521
+ backgroundColor: thumbColor
1522
+ }
1523
+ }),
1524
+ hovered && !dragging && cursorPos && /* @__PURE__ */ jsx7("div", {
1525
+ className: "absolute pointer-events-none rounded-full border-2 border-picker-ring shadow-picker-cursor",
1526
+ style: {
1527
+ left: `${cursorPos.x}%`,
1528
+ top: `${cursorPos.y}%`,
1529
+ width: 18,
1530
+ height: 18,
1531
+ transform: "translate(-50%, -50%)"
1532
+ }
1533
+ })
1534
+ ]
1535
+ });
1536
+ }
1537
+
1538
+ // components/inputs/color-picker/index.tsx
1539
+ import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
1540
+ /*!
1541
+ * Ported from Fluid Functionalism — github.com/mickadesign/fluid-functionalism
1542
+ * `registry/default/color-picker.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b
1543
+ * MIT License © 2026 Micka Touillaud — fluidfunctionalism.com (notice: LICENSE.fluid-functionalism)
1544
+ * Local changes: see PORTING.md.
1545
+ */
1546
+ var PANEL_WIDTH = 280;
1547
+ var ColorPicker2 = forwardRef4(({
1548
+ value,
1549
+ defaultValue = "#6B97FF",
1550
+ onValueChange,
1551
+ format,
1552
+ defaultFormat = "hex",
1553
+ onFormatChange,
1554
+ swatches,
1555
+ hideEyedropper,
1556
+ formatOpen,
1557
+ defaultFormatOpen,
1558
+ onFormatOpenChange,
1559
+ size,
1560
+ name,
1561
+ className,
1562
+ ...props
1563
+ }, ref) => {
1564
+ const [currentRawValue, setRawValue] = useControllableState2(value, defaultValue);
1565
+ const [currentFormat, setFormat] = useControllableState2(format, defaultFormat, onFormatChange);
1566
+ const initialParsed = useMemo5(() => {
1567
+ const p = parseColor2(currentRawValue);
1568
+ if (!p)
1569
+ return { h: 0, s: 1, v: 1, a: 1 };
1570
+ const hsv = rgbToHsv(p.r, p.g, p.b);
1571
+ return { h: hsv.s === 0 ? 0 : hsv.h, s: hsv.s, v: hsv.v, a: p.a };
1572
+ }, []);
1573
+ const [hsv, setHsv] = useState4(initialParsed);
1574
+ const oklchHueRef = useRef5(null);
1575
+ const lastEmittedRef = useRef5(currentRawValue);
1576
+ useEffect4(() => {
1577
+ if (currentRawValue === lastEmittedRef.current)
1578
+ return;
1579
+ lastEmittedRef.current = currentRawValue;
1580
+ const p = parseColor2(currentRawValue);
1581
+ if (!p)
1582
+ return;
1583
+ oklchHueRef.current = null;
1584
+ const newHsv = rgbToHsv(p.r, p.g, p.b);
1585
+ setHsv((prev) => ({
1586
+ h: newHsv.s === 0 ? prev.h : newHsv.h,
1587
+ s: newHsv.s,
1588
+ v: newHsv.v,
1589
+ a: p.a
1590
+ }));
1591
+ }, [currentRawValue]);
1592
+ const parsed = useMemo5(() => buildParsed2(hsv.h, hsv.s, hsv.v, hsv.a), [hsv]);
1593
+ const emit = useCallback4((p, fmt) => {
1594
+ const formatted = formatValueByFormat(p, fmt);
1595
+ lastEmittedRef.current = formatted;
1596
+ setRawValue(formatted);
1597
+ onValueChange?.(formatted, p);
1598
+ }, [setRawValue, onValueChange]);
1599
+ const updateHsv = useCallback4((next) => {
1600
+ const merged = { ...hsv, ...next };
1601
+ setHsv(merged);
1602
+ emit(buildParsed2(merged.h, merged.s, merged.v, merged.a), currentFormat);
1603
+ }, [hsv, currentFormat, emit]);
1604
+ const handleFormatChange = useCallback4((f) => {
1605
+ setFormat(f);
1606
+ emit(parsed, f);
1607
+ }, [setFormat, emit, parsed]);
1608
+ const handleHexCommit = useCallback4((input) => {
1609
+ const p = resolveCssColor(input);
1610
+ if (!p)
1611
+ return;
1612
+ oklchHueRef.current = null;
1613
+ const newHsv = rgbToHsv(p.r, p.g, p.b);
1614
+ const merged = {
1615
+ h: newHsv.s === 0 ? hsv.h : newHsv.h,
1616
+ s: newHsv.s,
1617
+ v: newHsv.v,
1618
+ a: p.a
1619
+ };
1620
+ setHsv(merged);
1621
+ emit(buildParsed2(merged.h, merged.s, merged.v, merged.a), currentFormat);
1622
+ }, [hsv.h, currentFormat, emit]);
1623
+ const solidHueRgb = useMemo5(() => hsvToRgb(hsv.h, hsv.s, hsv.v), [hsv.h, hsv.s, hsv.v]);
1624
+ const solidR = Math.round(solidHueRgb.r);
1625
+ const solidG = Math.round(solidHueRgb.g);
1626
+ const solidB = Math.round(solidHueRgb.b);
1627
+ const solidColorString = `rgb(${solidR}, ${solidG}, ${solidB})`;
1628
+ const shape = useShape2();
1629
+ const substrate = useSurface2();
1630
+ const pickerLevel = Math.max(substrate, 3);
1631
+ const paintsSurface = useContext2(PanelSurfaceContext);
1632
+ return /* @__PURE__ */ jsx8(SizeScope2, {
1751
1633
  size,
1752
- children: root
1753
- }) : root;
1634
+ children: /* @__PURE__ */ jsx8(SurfaceProvider2, {
1635
+ value: pickerLevel,
1636
+ children: /* @__PURE__ */ jsxs6("div", {
1637
+ ref,
1638
+ className: cn2("flex flex-col gap-2 p-3", paintsSurface && surfaceClasses2(pickerLevel, 1), shape.container, className),
1639
+ style: { width: PANEL_WIDTH },
1640
+ ...props,
1641
+ children: [
1642
+ /* @__PURE__ */ jsx8(SaturationSquare, {
1643
+ h: hsv.h,
1644
+ s: hsv.s,
1645
+ v: hsv.v,
1646
+ onChange: (s, v) => updateHsv({ s, v })
1647
+ }),
1648
+ /* @__PURE__ */ jsxs6("div", {
1649
+ className: "flex flex-col [&>*]:mb-0 [&>*+*]:-mt-px",
1650
+ children: [
1651
+ /* @__PURE__ */ jsx8(HueSlider, {
1652
+ h: hsv.h,
1653
+ onChange: (h) => {
1654
+ oklchHueRef.current = null;
1655
+ updateHsv({ h });
1656
+ }
1657
+ }),
1658
+ /* @__PURE__ */ jsx8(AlphaSlider, {
1659
+ a: hsv.a,
1660
+ solidColor: solidColorString,
1661
+ solidR,
1662
+ solidG,
1663
+ solidB,
1664
+ onChange: (a) => updateHsv({ a })
1665
+ })
1666
+ ]
1667
+ }),
1668
+ /* @__PURE__ */ jsxs6("div", {
1669
+ className: "grid grid-cols-2 gap-2",
1670
+ children: [
1671
+ /* @__PURE__ */ jsx8(FormatMenu, {
1672
+ value: currentFormat,
1673
+ onValueChange: handleFormatChange,
1674
+ open: formatOpen,
1675
+ defaultOpen: defaultFormatOpen,
1676
+ onOpenChange: onFormatOpenChange
1677
+ }),
1678
+ !hideEyedropper && /* @__PURE__ */ jsx8(EyeDropperButton, {
1679
+ onPick: handleHexCommit
1680
+ })
1681
+ ]
1682
+ }),
1683
+ /* @__PURE__ */ jsx8(ColorInputsRow, {
1684
+ parsed,
1685
+ format: currentFormat,
1686
+ oklchHue: oklchHueRef.current,
1687
+ onChannelChange: (channel, value) => {
1688
+ const p = { ...parsed };
1689
+ switch (channel) {
1690
+ case "hex":
1691
+ handleHexCommit(value);
1692
+ return;
1693
+ case "r":
1694
+ case "g":
1695
+ case "b": {
1696
+ oklchHueRef.current = null;
1697
+ const r = channel === "r" ? Number(value) : p.r;
1698
+ const g = channel === "g" ? Number(value) : p.g;
1699
+ const b = channel === "b" ? Number(value) : p.b;
1700
+ const hsvVal = rgbToHsv(r, g, b);
1701
+ updateHsv({
1702
+ h: hsvVal.s === 0 ? hsv.h : hsvVal.h,
1703
+ s: hsvVal.s,
1704
+ v: hsvVal.v
1705
+ });
1706
+ return;
1707
+ }
1708
+ case "hSL":
1709
+ case "sSL":
1710
+ case "lSL": {
1711
+ if (channel === "hSL")
1712
+ oklchHueRef.current = null;
1713
+ const hsl = rgbToHsl(p.r, p.g, p.b);
1714
+ const h2 = channel === "hSL" ? Number(value) : hsl.h;
1715
+ const s2 = channel === "sSL" ? Number(value) / 100 : hsl.s;
1716
+ const l2 = channel === "lSL" ? Number(value) / 100 : hsl.l;
1717
+ const rgb = hslToRgb(h2, clamp01(s2), clamp01(l2));
1718
+ const hsvVal = rgbToHsv(rgb.r, rgb.g, rgb.b);
1719
+ updateHsv({
1720
+ h: hsvVal.s === 0 ? h2 : hsvVal.h,
1721
+ s: hsvVal.s,
1722
+ v: hsvVal.v
1723
+ });
1724
+ return;
1725
+ }
1726
+ case "L":
1727
+ case "C":
1728
+ case "H": {
1729
+ const cur = rgbToOklch(p.r, p.g, p.b);
1730
+ const baseH = oklchHueRef.current ?? cur.H;
1731
+ const L = channel === "L" ? Number(value) / 100 : cur.L;
1732
+ const C = channel === "C" ? Number(value) : cur.C;
1733
+ const H = channel === "H" ? Number(value) : baseH;
1734
+ oklchHueRef.current = H;
1735
+ const rgb = oklchToRgb(clamp01(L), Math.max(0, C), H);
1736
+ const hsvVal = rgbToHsv(rgb.r, rgb.g, rgb.b);
1737
+ updateHsv({
1738
+ h: hsvVal.s === 0 ? hsv.h : hsvVal.h,
1739
+ s: hsvVal.s,
1740
+ v: hsvVal.v
1741
+ });
1742
+ return;
1743
+ }
1744
+ case "alphaPercent": {
1745
+ const a = clamp01(Number(value) / 100);
1746
+ updateHsv({ a });
1747
+ return;
1748
+ }
1749
+ }
1750
+ }
1751
+ }),
1752
+ swatches && swatches.length > 0 && /* @__PURE__ */ jsx8(SwatchStrip, {
1753
+ swatches,
1754
+ current: parsed.hex,
1755
+ onPick: handleHexCommit
1756
+ }),
1757
+ name && /* @__PURE__ */ jsx8("input", {
1758
+ type: "hidden",
1759
+ name,
1760
+ value: currentRawValue
1761
+ })
1762
+ ]
1763
+ })
1764
+ })
1765
+ });
1754
1766
  });
1755
- ColorPickerPopover2.displayName = "ColorPickerPopover";
1767
+ ColorPicker2.displayName = "ColorPicker";
1756
1768
  Object.assign(ColorPicker2, { Popover: ColorPickerPopover2 });
1757
1769
  var color_picker_default = ColorPicker2;
1758
1770
 
1759
- export { ColorPickerPortalContainer2, parseColor2, buildParsed2, ColorTile2, ColorSwatch2, ColorPicker2, ColorPickerPopover2, color_picker_default };
1771
+ export { parseColor2, buildParsed2, ColorTile2, ColorSwatch2, ColorPickerPopover2, ColorPicker2, color_picker_default };