@shavin/ui 0.0.0-stage → 0.1.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 (471) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/LICENSE +21 -0
  3. package/README.md +81 -2
  4. package/components.json +15771 -0
  5. package/dist/authoring/types.js +0 -0
  6. package/dist/icons.d.ts +20 -0
  7. package/dist/icons.js +6 -0
  8. package/dist/index.d.ts +3325 -0
  9. package/dist/index.js +531 -0
  10. package/dist/inspector/FindingPopover.js +252 -0
  11. package/dist/inspector/Highlight.js +76 -0
  12. package/dist/inspector/Inspector.js +420 -0
  13. package/dist/inspector/InspectorRoot.js +75 -0
  14. package/dist/inspector/IssuesLayer.js +134 -0
  15. package/dist/inspector/IssuesList.js +174 -0
  16. package/dist/inspector/SettingsPanel.js +89 -0
  17. package/dist/inspector/ShavinMark.js +22 -0
  18. package/dist/inspector/Toolbar.js +202 -0
  19. package/dist/inspector/barPlacement.js +117 -0
  20. package/dist/inspector/env.js +59 -0
  21. package/dist/inspector/geometry.js +44 -0
  22. package/dist/inspector/ignored.js +52 -0
  23. package/dist/inspector/index.js +7 -0
  24. package/dist/inspector/journalClient.js +57 -0
  25. package/dist/inspector/journalState.js +36 -0
  26. package/dist/inspector/pin.js +43 -0
  27. package/dist/inspector/placement.js +96 -0
  28. package/dist/inspector/prompt.js +63 -0
  29. package/dist/inspector/scheme.js +56 -0
  30. package/dist/inspector/settings.js +54 -0
  31. package/dist/inspector/strings.js +67 -0
  32. package/dist/inspector/targets.js +31 -0
  33. package/dist/inspector/theme/ThemeControls.js +351 -0
  34. package/dist/inspector/theme/ThemePanel.js +32 -0
  35. package/dist/inspector/theme/useThemeController.js +560 -0
  36. package/dist/inspector/usePhone.js +32 -0
  37. package/dist/inspector/useSelectTool.js +82 -0
  38. package/dist/inspector/useTimeouts.js +22 -0
  39. package/dist/inspector/useTrackedRect.js +39 -0
  40. package/dist/lib/announce.js +47 -0
  41. package/dist/lib/bridge.js +43 -0
  42. package/dist/lib/buttonState.js +81 -0
  43. package/dist/lib/chart-kit.js +226 -0
  44. package/dist/lib/cn.js +8 -0
  45. package/dist/lib/color-space.js +315 -0
  46. package/dist/lib/concentric.js +85 -0
  47. package/dist/lib/hit-area.js +25 -0
  48. package/dist/lib/inspector/collect.js +299 -0
  49. package/dist/lib/inspector/color.js +58 -0
  50. package/dist/lib/inspector/console-capture.js +96 -0
  51. package/dist/lib/inspector/index.js +8 -0
  52. package/dist/lib/inspector/rules.js +232 -0
  53. package/dist/lib/inspector/run.js +35 -0
  54. package/dist/lib/inspector/schema.js +110 -0
  55. package/dist/lib/inspector/selector.js +103 -0
  56. package/dist/lib/inspector/tokens.js +34 -0
  57. package/dist/lib/media-overlay-presets.js +284 -0
  58. package/dist/lib/media-overlays.js +381 -0
  59. package/dist/lib/meta.js +70 -0
  60. package/dist/lib/motion-gsap.js +25 -0
  61. package/dist/lib/motion-runtime.js +283 -0
  62. package/dist/lib/neutral-tint.js +108 -0
  63. package/dist/lib/portal-container.js +12 -0
  64. package/dist/lib/scroll-edges.js +41 -0
  65. package/dist/lib/surface.js +6 -0
  66. package/dist/lib/syntax.js +115 -0
  67. package/dist/lib/theme-presets.d.ts +1 -0
  68. package/dist/lib/theme-presets.js +759 -0
  69. package/dist/lib/useClientLocale.js +11 -0
  70. package/dist/lib/useFieldErrorAnnouncement.js +15 -0
  71. package/dist/lib/useReducedMotion.js +17 -0
  72. package/dist/lib/useResizable.js +313 -0
  73. package/dist/lib/useReturnFocus.js +24 -0
  74. package/dist/lib/useSlidingIndicator.js +56 -0
  75. package/dist/panels.d.ts +37 -0
  76. package/dist/panels.js +19 -0
  77. package/dist/primitives/Accordion/Accordion.doc.js +37 -0
  78. package/dist/primitives/Accordion/Accordion.js +87 -0
  79. package/dist/primitives/Accordion/index.js +2 -0
  80. package/dist/primitives/ActionBar/ActionBar.doc.js +37 -0
  81. package/dist/primitives/ActionBar/ActionBar.js +126 -0
  82. package/dist/primitives/ActionBar/index.js +2 -0
  83. package/dist/primitives/AlertDialog/AlertDialog.doc.js +54 -0
  84. package/dist/primitives/AlertDialog/AlertDialog.js +113 -0
  85. package/dist/primitives/AlertDialog/index.js +2 -0
  86. package/dist/primitives/AppShell/AppShell.doc.js +81 -0
  87. package/dist/primitives/AppShell/AppShell.js +178 -0
  88. package/dist/primitives/AppShell/frame-context.js +10 -0
  89. package/dist/primitives/AppShell/index.js +2 -0
  90. package/dist/primitives/AspectRatio/AspectRatio.doc.js +34 -0
  91. package/dist/primitives/AspectRatio/AspectRatio.js +5 -0
  92. package/dist/primitives/AspectRatio/index.js +2 -0
  93. package/dist/primitives/Avatar/Avatar.doc.js +40 -0
  94. package/dist/primitives/Avatar/Avatar.js +62 -0
  95. package/dist/primitives/Avatar/index.js +2 -0
  96. package/dist/primitives/Backdrop/Backdrop.doc.js +24 -0
  97. package/dist/primitives/Backdrop/Backdrop.js +42 -0
  98. package/dist/primitives/Backdrop/index.js +2 -0
  99. package/dist/primitives/Badge/Badge.doc.js +35 -0
  100. package/dist/primitives/Badge/Badge.js +95 -0
  101. package/dist/primitives/Badge/index.js +2 -0
  102. package/dist/primitives/BarChart/BarChart.doc.js +59 -0
  103. package/dist/primitives/BarChart/BarChart.js +154 -0
  104. package/dist/primitives/BarChart/index.js +2 -0
  105. package/dist/primitives/BlockPreview/BlockPreview.doc.js +51 -0
  106. package/dist/primitives/BlockPreview/BlockPreview.js +485 -0
  107. package/dist/primitives/BlockPreview/index.js +8 -0
  108. package/dist/primitives/Blockquote/Blockquote.doc.js +25 -0
  109. package/dist/primitives/Blockquote/Blockquote.js +19 -0
  110. package/dist/primitives/Blockquote/index.js +2 -0
  111. package/dist/primitives/BottomNav/BottomNav.doc.js +37 -0
  112. package/dist/primitives/BottomNav/BottomNav.js +54 -0
  113. package/dist/primitives/BottomNav/index.js +2 -0
  114. package/dist/primitives/Box/Box.doc.js +45 -0
  115. package/dist/primitives/Box/Box.js +51 -0
  116. package/dist/primitives/Box/index.js +2 -0
  117. package/dist/primitives/Breadcrumbs/Breadcrumbs.doc.js +35 -0
  118. package/dist/primitives/Breadcrumbs/Breadcrumbs.js +40 -0
  119. package/dist/primitives/Breadcrumbs/index.js +2 -0
  120. package/dist/primitives/Button/Button.doc.js +80 -0
  121. package/dist/primitives/Button/Button.js +132 -0
  122. package/dist/primitives/Button/index.js +2 -0
  123. package/dist/primitives/Calendar/Calendar.doc.js +36 -0
  124. package/dist/primitives/Calendar/Calendar.js +502 -0
  125. package/dist/primitives/Calendar/index.js +2 -0
  126. package/dist/primitives/Callout/Callout.doc.js +34 -0
  127. package/dist/primitives/Callout/Callout.js +63 -0
  128. package/dist/primitives/Callout/index.js +2 -0
  129. package/dist/primitives/Card/Card.doc.js +46 -0
  130. package/dist/primitives/Card/Card.js +159 -0
  131. package/dist/primitives/Card/index.js +2 -0
  132. package/dist/primitives/Carousel/Carousel.doc.js +61 -0
  133. package/dist/primitives/Carousel/Carousel.js +369 -0
  134. package/dist/primitives/Carousel/index.js +1 -0
  135. package/dist/primitives/ChatBubble/ChatBubble.doc.js +37 -0
  136. package/dist/primitives/ChatBubble/ChatBubble.js +120 -0
  137. package/dist/primitives/ChatBubble/index.js +2 -0
  138. package/dist/primitives/Checkbox/Checkbox.doc.js +36 -0
  139. package/dist/primitives/Checkbox/Checkbox.js +57 -0
  140. package/dist/primitives/Checkbox/index.js +2 -0
  141. package/dist/primitives/CheckboxCards/CheckboxCards.doc.js +35 -0
  142. package/dist/primitives/CheckboxCards/CheckboxCards.js +47 -0
  143. package/dist/primitives/CheckboxCards/index.js +2 -0
  144. package/dist/primitives/CheckboxGroup/CheckboxGroup.doc.js +35 -0
  145. package/dist/primitives/CheckboxGroup/CheckboxGroup.js +40 -0
  146. package/dist/primitives/CheckboxGroup/index.js +2 -0
  147. package/dist/primitives/Code/Code.doc.js +22 -0
  148. package/dist/primitives/Code/Code.js +17 -0
  149. package/dist/primitives/Code/index.js +2 -0
  150. package/dist/primitives/CodeBlock/CodeBlock.doc.js +36 -0
  151. package/dist/primitives/CodeBlock/CodeBlock.js +205 -0
  152. package/dist/primitives/CodeBlock/index.js +2 -0
  153. package/dist/primitives/CodeEditor/CodeEditor.doc.js +53 -0
  154. package/dist/primitives/CodeEditor/CodeEditor.js +204 -0
  155. package/dist/primitives/CodeEditor/index.js +4 -0
  156. package/dist/primitives/ColorPicker/ColorPicker.doc.js +37 -0
  157. package/dist/primitives/ColorPicker/ColorPicker.js +776 -0
  158. package/dist/primitives/ColorPicker/index.js +2 -0
  159. package/dist/primitives/Combobox/Combobox.doc.js +36 -0
  160. package/dist/primitives/Combobox/Combobox.js +199 -0
  161. package/dist/primitives/Combobox/index.js +2 -0
  162. package/dist/primitives/Container/Container.doc.js +46 -0
  163. package/dist/primitives/Container/Container.js +54 -0
  164. package/dist/primitives/Container/index.js +2 -0
  165. package/dist/primitives/ContextMenu/ContextMenu.doc.js +36 -0
  166. package/dist/primitives/ContextMenu/ContextMenu.js +59 -0
  167. package/dist/primitives/ContextMenu/index.js +2 -0
  168. package/dist/primitives/DataList/DataList.doc.js +34 -0
  169. package/dist/primitives/DataList/DataList.js +35 -0
  170. package/dist/primitives/DataList/index.js +2 -0
  171. package/dist/primitives/DatePicker/DatePicker.doc.js +36 -0
  172. package/dist/primitives/DatePicker/DatePicker.js +398 -0
  173. package/dist/primitives/DatePicker/index.js +2 -0
  174. package/dist/primitives/Dialog/Dialog.doc.js +107 -0
  175. package/dist/primitives/Dialog/Dialog.js +143 -0
  176. package/dist/primitives/Dialog/index.js +2 -0
  177. package/dist/primitives/DonutChart/DonutChart.doc.js +26 -0
  178. package/dist/primitives/DonutChart/DonutChart.js +71 -0
  179. package/dist/primitives/DonutChart/index.js +2 -0
  180. package/dist/primitives/Drawer/Drawer.doc.js +44 -0
  181. package/dist/primitives/Drawer/Drawer.js +158 -0
  182. package/dist/primitives/Drawer/index.js +2 -0
  183. package/dist/primitives/Dropdown/Dropdown.doc.js +40 -0
  184. package/dist/primitives/Dropdown/Dropdown.js +146 -0
  185. package/dist/primitives/Dropdown/index.js +2 -0
  186. package/dist/primitives/Emphasis/Emphasis.doc.js +28 -0
  187. package/dist/primitives/Emphasis/Emphasis.js +25 -0
  188. package/dist/primitives/Emphasis/index.js +2 -0
  189. package/dist/primitives/EmptyState/EmptyState.doc.js +76 -0
  190. package/dist/primitives/EmptyState/EmptyState.js +118 -0
  191. package/dist/primitives/EmptyState/index.js +2 -0
  192. package/dist/primitives/FileOutput/FileOutput.doc.js +26 -0
  193. package/dist/primitives/FileOutput/FileOutput.js +55 -0
  194. package/dist/primitives/FileOutput/index.js +2 -0
  195. package/dist/primitives/Flex/Flex.doc.js +58 -0
  196. package/dist/primitives/Flex/Flex.js +98 -0
  197. package/dist/primitives/Flex/index.js +2 -0
  198. package/dist/primitives/FormErrorSummary/FormErrorSummary.doc.js +39 -0
  199. package/dist/primitives/FormErrorSummary/FormErrorSummary.js +61 -0
  200. package/dist/primitives/FormErrorSummary/index.js +2 -0
  201. package/dist/primitives/FormField/FormField.doc.js +68 -0
  202. package/dist/primitives/FormField/FormField.js +149 -0
  203. package/dist/primitives/FormField/index.js +2 -0
  204. package/dist/primitives/FunnelChart/FunnelChart.doc.js +45 -0
  205. package/dist/primitives/FunnelChart/FunnelChart.js +54 -0
  206. package/dist/primitives/FunnelChart/index.js +2 -0
  207. package/dist/primitives/Grid/Grid.doc.js +57 -0
  208. package/dist/primitives/Grid/Grid.js +122 -0
  209. package/dist/primitives/Grid/index.js +2 -0
  210. package/dist/primitives/Heading/Heading.doc.js +46 -0
  211. package/dist/primitives/Heading/Heading.js +80 -0
  212. package/dist/primitives/Heading/index.js +2 -0
  213. package/dist/primitives/Heatmap/Heatmap.doc.js +49 -0
  214. package/dist/primitives/Heatmap/Heatmap.js +42 -0
  215. package/dist/primitives/Heatmap/index.js +2 -0
  216. package/dist/primitives/HoverCard/HoverCard.doc.js +36 -0
  217. package/dist/primitives/HoverCard/HoverCard.js +39 -0
  218. package/dist/primitives/HoverCard/index.js +2 -0
  219. package/dist/primitives/Icon/Icon.doc.js +49 -0
  220. package/dist/primitives/Icon/Icon.js +214 -0
  221. package/dist/primitives/Icon/buckets/lucide-a.js +214 -0
  222. package/dist/primitives/Icon/buckets/lucide-b.js +298 -0
  223. package/dist/primitives/Icon/buckets/lucide-c.js +524 -0
  224. package/dist/primitives/Icon/buckets/lucide-d.js +110 -0
  225. package/dist/primitives/Icon/buckets/lucide-e.js +50 -0
  226. package/dist/primitives/Icon/buckets/lucide-f.js +264 -0
  227. package/dist/primitives/Icon/buckets/lucide-g.js +108 -0
  228. package/dist/primitives/Icon/buckets/lucide-h.js +112 -0
  229. package/dist/primitives/Icon/buckets/lucide-i.js +46 -0
  230. package/dist/primitives/Icon/buckets/lucide-j.js +6 -0
  231. package/dist/primitives/Icon/buckets/lucide-k.js +18 -0
  232. package/dist/primitives/Icon/buckets/lucide-l.js +162 -0
  233. package/dist/primitives/Icon/buckets/lucide-m.js +266 -0
  234. package/dist/primitives/Icon/buckets/lucide-n.js +34 -0
  235. package/dist/primitives/Icon/buckets/lucide-o.js +20 -0
  236. package/dist/primitives/Icon/buckets/lucide-p.js +216 -0
  237. package/dist/primitives/Icon/buckets/lucide-q.js +6 -0
  238. package/dist/primitives/Icon/buckets/lucide-r.js +140 -0
  239. package/dist/primitives/Icon/buckets/lucide-s.js +490 -0
  240. package/dist/primitives/Icon/buckets/lucide-t.js +204 -0
  241. package/dist/primitives/Icon/buckets/lucide-u.js +84 -0
  242. package/dist/primitives/Icon/buckets/lucide-v.js +46 -0
  243. package/dist/primitives/Icon/buckets/lucide-w.js +82 -0
  244. package/dist/primitives/Icon/buckets/lucide-x.js +6 -0
  245. package/dist/primitives/Icon/buckets/lucide-z.js +36 -0
  246. package/dist/primitives/Icon/buckets/phosphor-a.js +250 -0
  247. package/dist/primitives/Icon/buckets/phosphor-b.js +158 -0
  248. package/dist/primitives/Icon/buckets/phosphor-c.js +320 -0
  249. package/dist/primitives/Icon/buckets/phosphor-d.js +90 -0
  250. package/dist/primitives/Icon/buckets/phosphor-e.js +52 -0
  251. package/dist/primitives/Icon/buckets/phosphor-f.js +162 -0
  252. package/dist/primitives/Icon/buckets/phosphor-g.js +92 -0
  253. package/dist/primitives/Icon/buckets/phosphor-h.js +88 -0
  254. package/dist/primitives/Icon/buckets/phosphor-i.js +26 -0
  255. package/dist/primitives/Icon/buckets/phosphor-j.js +8 -0
  256. package/dist/primitives/Icon/buckets/phosphor-k.js +8 -0
  257. package/dist/primitives/Icon/buckets/phosphor-l.js +84 -0
  258. package/dist/primitives/Icon/buckets/phosphor-m.js +110 -0
  259. package/dist/primitives/Icon/buckets/phosphor-n.js +100 -0
  260. package/dist/primitives/Icon/buckets/phosphor-o.js +14 -0
  261. package/dist/primitives/Icon/buckets/phosphor-p.js +166 -0
  262. package/dist/primitives/Icon/buckets/phosphor-q.js +10 -0
  263. package/dist/primitives/Icon/buckets/phosphor-r.js +46 -0
  264. package/dist/primitives/Icon/buckets/phosphor-s.js +254 -0
  265. package/dist/primitives/Icon/buckets/phosphor-t.js +152 -0
  266. package/dist/primitives/Icon/buckets/phosphor-u.js +38 -0
  267. package/dist/primitives/Icon/buckets/phosphor-v.js +22 -0
  268. package/dist/primitives/Icon/buckets/phosphor-w.js +48 -0
  269. package/dist/primitives/Icon/buckets/phosphor-x.js +4 -0
  270. package/dist/primitives/Icon/buckets/phosphor-y.js +8 -0
  271. package/dist/primitives/Icon/icon-display-names.generated.js +4 -0
  272. package/dist/primitives/Icon/icon-loaders.generated.js +70 -0
  273. package/dist/primitives/Icon/icon-names-material.generated.js +4 -0
  274. package/dist/primitives/Icon/icon-names.js +11 -0
  275. package/dist/primitives/Icon/index.js +7 -0
  276. package/dist/primitives/IconButton/IconButton.doc.js +43 -0
  277. package/dist/primitives/IconButton/IconButton.js +98 -0
  278. package/dist/primitives/IconButton/index.js +2 -0
  279. package/dist/primitives/IconPicker/IconPicker.doc.js +52 -0
  280. package/dist/primitives/IconPicker/IconPicker.js +193 -0
  281. package/dist/primitives/IconPicker/index.js +2 -0
  282. package/dist/primitives/IconPicker/registry.js +98 -0
  283. package/dist/primitives/Image/Image.doc.js +40 -0
  284. package/dist/primitives/Image/Image.js +76 -0
  285. package/dist/primitives/Image/index.js +2 -0
  286. package/dist/primitives/Inset/Inset.doc.js +34 -0
  287. package/dist/primitives/Inset/Inset.js +51 -0
  288. package/dist/primitives/Inset/index.js +2 -0
  289. package/dist/primitives/Kbd/Kbd.doc.js +22 -0
  290. package/dist/primitives/Kbd/Kbd.js +17 -0
  291. package/dist/primitives/Kbd/index.js +2 -0
  292. package/dist/primitives/LineChart/LineChart.doc.js +61 -0
  293. package/dist/primitives/LineChart/LineChart.js +146 -0
  294. package/dist/primitives/LineChart/index.js +2 -0
  295. package/dist/primitives/Link/Link.doc.js +45 -0
  296. package/dist/primitives/Link/Link.js +37 -0
  297. package/dist/primitives/Link/index.js +2 -0
  298. package/dist/primitives/List/List.doc.js +35 -0
  299. package/dist/primitives/List/List.js +35 -0
  300. package/dist/primitives/List/index.js +2 -0
  301. package/dist/primitives/Menu/Menu.doc.js +37 -0
  302. package/dist/primitives/Menu/Menu.js +117 -0
  303. package/dist/primitives/Menu/index.js +2 -0
  304. package/dist/primitives/Murmur/Murmur.doc.js +32 -0
  305. package/dist/primitives/Murmur/Murmur.js +85 -0
  306. package/dist/primitives/Murmur/engine.js +163 -0
  307. package/dist/primitives/Murmur/index.js +12 -0
  308. package/dist/primitives/Pagination/Pagination.doc.js +37 -0
  309. package/dist/primitives/Pagination/Pagination.js +183 -0
  310. package/dist/primitives/Pagination/index.js +2 -0
  311. package/dist/primitives/PanelGroup/PanelGroup.doc.js +41 -0
  312. package/dist/primitives/PanelGroup/PanelGroup.js +142 -0
  313. package/dist/primitives/PanelGroup/index.js +2 -0
  314. package/dist/primitives/Popover/Popover.doc.js +36 -0
  315. package/dist/primitives/Popover/Popover.js +41 -0
  316. package/dist/primitives/Popover/index.js +2 -0
  317. package/dist/primitives/Progress/Progress.doc.js +35 -0
  318. package/dist/primitives/Progress/Progress.js +77 -0
  319. package/dist/primitives/Progress/index.js +2 -0
  320. package/dist/primitives/RadioGroup/RadioGroup.doc.js +36 -0
  321. package/dist/primitives/RadioGroup/RadioGroup.js +132 -0
  322. package/dist/primitives/RadioGroup/index.js +2 -0
  323. package/dist/primitives/Rating/NpsScale.js +102 -0
  324. package/dist/primitives/Rating/Rating.doc.js +35 -0
  325. package/dist/primitives/Rating/Rating.js +116 -0
  326. package/dist/primitives/Rating/RatingSummary.js +50 -0
  327. package/dist/primitives/Rating/SentimentRating.js +81 -0
  328. package/dist/primitives/Rating/index.js +5 -0
  329. package/dist/primitives/Reasoning/Reasoning.doc.js +28 -0
  330. package/dist/primitives/Reasoning/Reasoning.js +73 -0
  331. package/dist/primitives/Reasoning/index.js +2 -0
  332. package/dist/primitives/Resizable/Resizable.doc.js +50 -0
  333. package/dist/primitives/Resizable/ResizeHandle.js +185 -0
  334. package/dist/primitives/Resizable/index.js +2 -0
  335. package/dist/primitives/Row/Row.doc.js +36 -0
  336. package/dist/primitives/Row/Row.js +53 -0
  337. package/dist/primitives/Row/index.js +2 -0
  338. package/dist/primitives/ScrollArea/ScrollArea.doc.js +35 -0
  339. package/dist/primitives/ScrollArea/ScrollArea.js +50 -0
  340. package/dist/primitives/ScrollArea/index.js +2 -0
  341. package/dist/primitives/Section/Section.doc.js +64 -0
  342. package/dist/primitives/Section/Section.js +76 -0
  343. package/dist/primitives/Section/index.js +2 -0
  344. package/dist/primitives/SegmentedControl/SegmentedControl.doc.js +75 -0
  345. package/dist/primitives/SegmentedControl/SegmentedControl.js +160 -0
  346. package/dist/primitives/SegmentedControl/index.js +2 -0
  347. package/dist/primitives/Select/Select.doc.js +42 -0
  348. package/dist/primitives/Select/Select.js +180 -0
  349. package/dist/primitives/Select/index.js +2 -0
  350. package/dist/primitives/Separator/Separator.doc.js +34 -0
  351. package/dist/primitives/Separator/Separator.js +84 -0
  352. package/dist/primitives/Separator/index.js +2 -0
  353. package/dist/primitives/ShavinDevTools/DevToolsPanel.js +2050 -0
  354. package/dist/primitives/ShavinDevTools/ShavinDevTools.doc.js +44 -0
  355. package/dist/primitives/ShavinDevTools/ShavinDevTools.js +15 -0
  356. package/dist/primitives/ShavinDevTools/index.js +8 -0
  357. package/dist/primitives/ShavinDevTools/types.js +0 -0
  358. package/dist/primitives/Sidebar/Sidebar.doc.js +39 -0
  359. package/dist/primitives/Sidebar/Sidebar.js +295 -0
  360. package/dist/primitives/Sidebar/index.js +2 -0
  361. package/dist/primitives/Skeleton/Skeleton.doc.js +38 -0
  362. package/dist/primitives/Skeleton/Skeleton.js +36 -0
  363. package/dist/primitives/Skeleton/index.js +2 -0
  364. package/dist/primitives/Slider/Slider.doc.js +45 -0
  365. package/dist/primitives/Slider/Slider.js +406 -0
  366. package/dist/primitives/Slider/index.js +2 -0
  367. package/dist/primitives/Sortable/Sortable.doc.js +35 -0
  368. package/dist/primitives/Sortable/Sortable.js +179 -0
  369. package/dist/primitives/Sortable/index.js +2 -0
  370. package/dist/primitives/Sparkline/Sparkline.doc.js +25 -0
  371. package/dist/primitives/Sparkline/Sparkline.js +46 -0
  372. package/dist/primitives/Sparkline/index.js +2 -0
  373. package/dist/primitives/Spinner/Spinner.doc.js +35 -0
  374. package/dist/primitives/Spinner/Spinner.js +162 -0
  375. package/dist/primitives/Spinner/index.js +2 -0
  376. package/dist/primitives/Spotlight/Spotlight.doc.js +36 -0
  377. package/dist/primitives/Spotlight/Spotlight.js +139 -0
  378. package/dist/primitives/Spotlight/index.js +2 -0
  379. package/dist/primitives/Stepper/Stepper.doc.js +46 -0
  380. package/dist/primitives/Stepper/Stepper.js +235 -0
  381. package/dist/primitives/Stepper/index.js +2 -0
  382. package/dist/primitives/Switch/Switch.doc.js +36 -0
  383. package/dist/primitives/Switch/Switch.js +54 -0
  384. package/dist/primitives/Switch/index.js +2 -0
  385. package/dist/primitives/Table/Table.doc.js +47 -0
  386. package/dist/primitives/Table/Table.js +63 -0
  387. package/dist/primitives/Table/index.js +2 -0
  388. package/dist/primitives/Tabs/Tabs.doc.js +53 -0
  389. package/dist/primitives/Tabs/Tabs.js +275 -0
  390. package/dist/primitives/Tabs/index.js +2 -0
  391. package/dist/primitives/Text/Text.doc.js +35 -0
  392. package/dist/primitives/Text/Text.js +67 -0
  393. package/dist/primitives/Text/index.js +2 -0
  394. package/dist/primitives/TextArea/TextArea.doc.js +35 -0
  395. package/dist/primitives/TextArea/TextArea.js +45 -0
  396. package/dist/primitives/TextArea/index.js +2 -0
  397. package/dist/primitives/TextField/TextField.doc.js +41 -0
  398. package/dist/primitives/TextField/TextField.js +290 -0
  399. package/dist/primitives/TextField/index.js +2 -0
  400. package/dist/primitives/ThemeProvider/ScopedThemeProvider.js +71 -0
  401. package/dist/primitives/ThemeProvider/ThemeProvider.doc.js +61 -0
  402. package/dist/primitives/ThemeProvider/ThemeProvider.js +143 -0
  403. package/dist/primitives/ThemeProvider/clientTheme.js +47 -0
  404. package/dist/primitives/ThemeProvider/index.js +3 -0
  405. package/dist/primitives/ThemeProvider/themeContext.js +11 -0
  406. package/dist/primitives/ThemeSwitcher/ThemeSwitcher.doc.js +49 -0
  407. package/dist/primitives/ThemeSwitcher/ThemeSwitcher.js +323 -0
  408. package/dist/primitives/ThemeSwitcher/index.js +2 -0
  409. package/dist/primitives/TimePicker/TimePicker.doc.js +36 -0
  410. package/dist/primitives/TimePicker/TimePicker.js +368 -0
  411. package/dist/primitives/TimePicker/index.js +2 -0
  412. package/dist/primitives/Toast/Toast.doc.js +65 -0
  413. package/dist/primitives/Toast/Toast.js +304 -0
  414. package/dist/primitives/Toast/index.js +2 -0
  415. package/dist/primitives/ToolCall/ToolCall.doc.js +29 -0
  416. package/dist/primitives/ToolCall/ToolCall.js +75 -0
  417. package/dist/primitives/ToolCall/index.js +2 -0
  418. package/dist/primitives/Tooltip/Tooltip.doc.js +37 -0
  419. package/dist/primitives/Tooltip/Tooltip.js +55 -0
  420. package/dist/primitives/Tooltip/index.js +2 -0
  421. package/dist/primitives/TopBar/TopBar.doc.js +34 -0
  422. package/dist/primitives/TopBar/TopBar.js +8 -0
  423. package/dist/primitives/TopBar/index.js +2 -0
  424. package/dist/primitives/Video/PauseToggle.js +49 -0
  425. package/dist/primitives/Video/Video.doc.js +47 -0
  426. package/dist/primitives/Video/Video.js +104 -0
  427. package/dist/primitives/Video/index.js +1 -0
  428. package/dist/primitives/VoiceInput/VoiceInput.doc.js +38 -0
  429. package/dist/primitives/VoiceInput/VoiceInput.js +96 -0
  430. package/dist/primitives/VoiceInput/index.js +2 -0
  431. package/dist/primitives/WiseOwlLogo/WiseOwlLogo.doc.js +38 -0
  432. package/dist/primitives/WiseOwlLogo/WiseOwlLogo.js +82 -0
  433. package/dist/primitives/WiseOwlLogo/index.js +2 -0
  434. package/dist/primitives/WiseOwlLogo/paths.js +10 -0
  435. package/dist/server.d.ts +256 -0
  436. package/dist/server.js +22 -0
  437. package/dist/styles/base-oklch.css +124 -0
  438. package/dist/styles/base-oklch.d.ts +2 -0
  439. package/dist/styles/base.css +124 -0
  440. package/dist/styles/base.d.ts +2 -0
  441. package/dist/styles/brand-preset.d.ts +22 -0
  442. package/dist/styles/brand-preset.js +13 -0
  443. package/dist/styles/brand-theme-v4-oklch.css +2 -0
  444. package/dist/styles/brand-theme-v4-oklch.d.ts +2 -0
  445. package/dist/styles/brand-theme-v4.css +2 -0
  446. package/dist/styles/brand-theme-v4.d.ts +2 -0
  447. package/dist/styles/brand-tokens-oklch.css +6 -0
  448. package/dist/styles/brand-tokens-oklch.d.ts +2 -0
  449. package/dist/styles/brand-tokens.css +6 -0
  450. package/dist/styles/brand-tokens.d.ts +2 -0
  451. package/dist/styles/global-oklch.css +1329 -0
  452. package/dist/styles/global-oklch.d.ts +2 -0
  453. package/dist/styles/global.css +1329 -0
  454. package/dist/styles/global.d.ts +2 -0
  455. package/dist/styles/theme-v4-oklch.css +22 -0
  456. package/dist/styles/theme-v4-oklch.d.ts +2 -0
  457. package/dist/styles/theme-v4.css +22 -0
  458. package/dist/styles/theme-v4.d.ts +2 -0
  459. package/dist/styles/tokens-oklch.css +1204 -0
  460. package/dist/styles/tokens-oklch.d.ts +2 -0
  461. package/dist/styles/tokens.css +1204 -0
  462. package/dist/styles/tokens.d.ts +2 -0
  463. package/dist/tailwind-preset.cjs +155 -0
  464. package/dist/tailwind-preset.d.ts +112 -0
  465. package/dist/tailwind-preset.js +133 -0
  466. package/dist/theme-presets-BVWZ_TxX.d.ts +514 -0
  467. package/global-oklch.css +3 -0
  468. package/package.json +169 -4
  469. package/styles.css +3 -0
  470. package/tailwind-preset.ts +140 -0
  471. package/tokens.json +423 -0
@@ -0,0 +1,776 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useState, useRef, useEffect, useMemo, useCallback } from "react";
4
+ import { Pipette, ChevronsUpDown } from "lucide-react";
5
+ import { cva } from "class-variance-authority";
6
+ import * as PopoverPrimitive from "@radix-ui/react-popover";
7
+ import { cn } from "../../lib/cn.js";
8
+ import { BRAND_PRESETS } from "../../lib/theme-presets.js";
9
+ const colorPickerVariants = cva(
10
+ "flex flex-col gap-3 rounded-[var(--radius-panel)] border border-hairline bg-surface p-3 shadow-card",
11
+ {
12
+ variants: {
13
+ size: {
14
+ sm: "max-w-[240px] text-xs",
15
+ md: "max-w-[280px] text-xs",
16
+ lg: "max-w-[320px] text-sm",
17
+ full: "w-full max-w-none text-xs"
18
+ }
19
+ },
20
+ defaultVariants: {
21
+ size: "md"
22
+ }
23
+ }
24
+ );
25
+ const DEFAULT_RGB_STR = "rgb(0, 0, 0)";
26
+ const DEFAULT_HEX_STR = "#000000";
27
+ function hexToRgb(hex) {
28
+ const clean = (hex || "").replace(/^#/, "");
29
+ if (clean.length === 3) {
30
+ return {
31
+ r: parseInt(clean[0] + clean[0], 16) || 0,
32
+ g: parseInt(clean[1] + clean[1], 16) || 0,
33
+ b: parseInt(clean[2] + clean[2], 16) || 0
34
+ };
35
+ }
36
+ if (clean.length === 6) {
37
+ return {
38
+ r: parseInt(clean.slice(0, 2), 16) || 0,
39
+ g: parseInt(clean.slice(2, 4), 16) || 0,
40
+ b: parseInt(clean.slice(4, 6), 16) || 0
41
+ };
42
+ }
43
+ return { r: 0, g: 0, b: 0 };
44
+ }
45
+ function hexToRgbStr(hex) {
46
+ const { r, g, b } = hexToRgb(hex);
47
+ return `rgb(${r}, ${g}, ${b})`;
48
+ }
49
+ function rgbToHsv(r, g, b) {
50
+ r /= 255;
51
+ g /= 255;
52
+ b /= 255;
53
+ const max = Math.max(r, g, b);
54
+ const min = Math.min(r, g, b);
55
+ const d = max - min;
56
+ let h = 0;
57
+ const s = max === 0 ? 0 : d / max;
58
+ const v = max;
59
+ if (max !== min) {
60
+ switch (max) {
61
+ case r:
62
+ h = (g - b) / d + (g < b ? 6 : 0);
63
+ break;
64
+ case g:
65
+ h = (b - r) / d + 2;
66
+ break;
67
+ case b:
68
+ h = (r - g) / d + 4;
69
+ break;
70
+ }
71
+ h /= 6;
72
+ }
73
+ return { h: Math.round(h * 360), s: Math.round(s * 100), v: Math.round(v * 100) };
74
+ }
75
+ function hsvToRgb(h, s, v) {
76
+ h = h % 360 / 360;
77
+ s = s / 100;
78
+ v = v / 100;
79
+ let r = 0, g = 0, b = 0;
80
+ const i = Math.floor(h * 6);
81
+ const f = h * 6 - i;
82
+ const p = v * (1 - s);
83
+ const q = v * (1 - f * s);
84
+ const t = v * (1 - (1 - f) * s);
85
+ switch (i % 6) {
86
+ case 0:
87
+ r = v;
88
+ g = t;
89
+ b = p;
90
+ break;
91
+ case 1:
92
+ r = q;
93
+ g = v;
94
+ b = p;
95
+ break;
96
+ case 2:
97
+ r = p;
98
+ g = v;
99
+ b = t;
100
+ break;
101
+ case 3:
102
+ r = p;
103
+ g = q;
104
+ b = v;
105
+ break;
106
+ case 4:
107
+ r = t;
108
+ g = p;
109
+ b = v;
110
+ break;
111
+ case 5:
112
+ r = v;
113
+ g = p;
114
+ b = q;
115
+ break;
116
+ }
117
+ return { r: Math.round(r * 255), g: Math.round(g * 255), b: Math.round(b * 255) };
118
+ }
119
+ function rgbToHex(r, g, b) {
120
+ const toHex = (n) => Math.max(0, Math.min(255, Math.round(n))).toString(16).padStart(2, "0");
121
+ return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
122
+ }
123
+ function CanvasColorPickerPopup({
124
+ value,
125
+ onChange,
126
+ className
127
+ }) {
128
+ const cleanValue = value || "#000000";
129
+ const rgb = useMemo(() => hexToRgb(cleanValue), [cleanValue]);
130
+ const hsv = useMemo(() => rgbToHsv(rgb.r, rgb.g, rgb.b), [rgb]);
131
+ const [hue, setHue] = useState(hsv.h);
132
+ const [sat, setSat] = useState(hsv.s);
133
+ const [canEyeDrop, setCanEyeDrop] = useState(false);
134
+ useEffect(() => setCanEyeDrop(typeof window !== "undefined" && "EyeDropper" in window), []);
135
+ const [val, setVal] = useState(hsv.v);
136
+ const [formatMode, setFormatMode] = useState("HEX");
137
+ const satValRef = useRef(null);
138
+ const isDraggingSatVal = useRef(false);
139
+ useEffect(() => {
140
+ setHue(hsv.h);
141
+ setSat(hsv.s);
142
+ setVal(hsv.v);
143
+ }, [cleanValue]);
144
+ const updateFromSatVal = useCallback(
145
+ (clientX, clientY) => {
146
+ if (!satValRef.current) return;
147
+ const rect = satValRef.current.getBoundingClientRect();
148
+ const x = Math.max(0, Math.min(rect.width, clientX - rect.left));
149
+ const y = Math.max(0, Math.min(rect.height, clientY - rect.top));
150
+ const s = Math.round(x / rect.width * 100);
151
+ const v = Math.round((1 - y / rect.height) * 100);
152
+ setSat(s);
153
+ setVal(v);
154
+ const { r, g, b } = hsvToRgb(hue, s, v);
155
+ onChange(rgbToHex(r, g, b));
156
+ },
157
+ [hue, onChange]
158
+ );
159
+ const handlePointerDownSatVal = (e) => {
160
+ isDraggingSatVal.current = true;
161
+ e.target.setPointerCapture(e.pointerId);
162
+ updateFromSatVal(e.clientX, e.clientY);
163
+ };
164
+ const handlePointerMoveSatVal = (e) => {
165
+ if (isDraggingSatVal.current) updateFromSatVal(e.clientX, e.clientY);
166
+ };
167
+ const handlePointerUpSatVal = (e) => {
168
+ isDraggingSatVal.current = false;
169
+ try {
170
+ e.target.releasePointerCapture(e.pointerId);
171
+ } catch {
172
+ }
173
+ };
174
+ const handleSatValKeyDown = (e) => {
175
+ const step = e.shiftKey ? 10 : 1;
176
+ let s = sat;
177
+ let v = val;
178
+ switch (e.key) {
179
+ case "ArrowLeft":
180
+ s -= step;
181
+ break;
182
+ case "ArrowRight":
183
+ s += step;
184
+ break;
185
+ case "ArrowUp":
186
+ v += step;
187
+ break;
188
+ case "ArrowDown":
189
+ v -= step;
190
+ break;
191
+ case "Home":
192
+ s = 0;
193
+ break;
194
+ case "End":
195
+ s = 100;
196
+ break;
197
+ case "PageUp":
198
+ v = 100;
199
+ break;
200
+ case "PageDown":
201
+ v = 0;
202
+ break;
203
+ default:
204
+ return;
205
+ }
206
+ e.preventDefault();
207
+ s = Math.max(0, Math.min(100, s));
208
+ v = Math.max(0, Math.min(100, v));
209
+ setSat(s);
210
+ setVal(v);
211
+ const { r, g, b } = hsvToRgb(hue, s, v);
212
+ onChange(rgbToHex(r, g, b));
213
+ };
214
+ const handleHueChange = (newHue) => {
215
+ setHue(newHue);
216
+ const { r, g, b } = hsvToRgb(newHue, sat, val);
217
+ onChange(rgbToHex(r, g, b));
218
+ };
219
+ const handleEyeDropper = async () => {
220
+ if ("EyeDropper" in window) {
221
+ try {
222
+ const eyeDropper = new window.EyeDropper();
223
+ const res = await eyeDropper.open();
224
+ if (res?.sRGBHex) {
225
+ onChange(res.sRGBHex);
226
+ }
227
+ } catch {
228
+ }
229
+ }
230
+ };
231
+ const pureHueRgb = hsvToRgb(hue, 100, 100);
232
+ return /* @__PURE__ */ jsxs(
233
+ "div",
234
+ {
235
+ className: cn(
236
+ "w-[240px] rounded-[var(--radius-panel)] border border-hairline bg-surface p-3 flex flex-col gap-3 select-none",
237
+ className
238
+ ),
239
+ children: [
240
+ /* @__PURE__ */ jsx(
241
+ "div",
242
+ {
243
+ ref: satValRef,
244
+ tabIndex: 0,
245
+ role: "slider",
246
+ "aria-roledescription": "2D slider",
247
+ "aria-label": "Saturation and brightness",
248
+ "aria-valuemin": 0,
249
+ "aria-valuemax": 100,
250
+ "aria-valuenow": sat,
251
+ "aria-valuetext": `Saturation ${sat}%, brightness ${val}%`,
252
+ onKeyDown: handleSatValKeyDown,
253
+ onPointerDown: handlePointerDownSatVal,
254
+ onPointerMove: handlePointerMoveSatVal,
255
+ onPointerUp: handlePointerUpSatVal,
256
+ className: "relative w-full h-32 rounded-[var(--radius-lg)] cursor-crosshair overflow-hidden touch-none",
257
+ style: {
258
+ backgroundColor: `rgb(${pureHueRgb.r}, ${pureHueRgb.g}, ${pureHueRgb.b})`,
259
+ backgroundImage: "linear-gradient(to right, #fff 0%, transparent 100%), linear-gradient(to top, #000 0%, transparent 100%)"
260
+ },
261
+ children: /* @__PURE__ */ jsx(
262
+ "div",
263
+ {
264
+ className: "absolute w-4 h-4 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white shadow-[0_0_2px_rgba(0,0,0,0.8)] pointer-events-none",
265
+ style: {
266
+ left: `${sat}%`,
267
+ top: `${100 - val}%`,
268
+ backgroundColor: cleanValue
269
+ }
270
+ }
271
+ )
272
+ }
273
+ ),
274
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
275
+ canEyeDrop && /* @__PURE__ */ jsx(
276
+ "button",
277
+ {
278
+ type: "button",
279
+ onClick: handleEyeDropper,
280
+ "aria-label": "Pick color from screen",
281
+ title: "Pick color from screen",
282
+ className: "p-1.5 rounded-[var(--radius-lg)] border border-hairline bg-surface hover:bg-surface-hover text-fg-subtle hover:text-fg transition cursor-pointer shrink-0",
283
+ children: /* @__PURE__ */ jsx(Pipette, { className: "w-3.5 h-3.5", "aria-hidden": true })
284
+ }
285
+ ),
286
+ /* @__PURE__ */ jsx("div", { className: "flex-1 flex flex-col justify-center", children: /* @__PURE__ */ jsxs("div", { className: "relative h-3 w-full rounded-full", children: [
287
+ /* @__PURE__ */ jsx(
288
+ "input",
289
+ {
290
+ type: "range",
291
+ min: 0,
292
+ max: 360,
293
+ value: hue,
294
+ onChange: (e) => handleHueChange(Number(e.target.value)),
295
+ "aria-label": "Hue",
296
+ "aria-valuetext": `${hue} degrees`,
297
+ className: "peer absolute inset-0 w-full h-full opacity-0 cursor-pointer z-20"
298
+ }
299
+ ),
300
+ /* @__PURE__ */ jsx(
301
+ "div",
302
+ {
303
+ className: "w-full h-full rounded-full overflow-hidden",
304
+ style: {
305
+ backgroundImage: "linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%)"
306
+ }
307
+ }
308
+ ),
309
+ /* @__PURE__ */ jsx(
310
+ "div",
311
+ {
312
+ className: "absolute top-1/2 -translate-y-1/2 -translate-x-1/2 w-2 h-4 rounded-full border-2 border-white shadow-[0_0_2px_rgba(0,0,0,0.8)] pointer-events-none z-10 peer-focus-visible:ring-[length:var(--focus-width)] peer-focus-visible:ring-fg peer-focus-visible:ring-offset-[length:var(--focus-offset)] peer-focus-visible:ring-offset-surface",
313
+ style: {
314
+ left: `${hue / 360 * 100}%`
315
+ }
316
+ }
317
+ )
318
+ ] }) }),
319
+ /* @__PURE__ */ jsx(
320
+ "div",
321
+ {
322
+ "data-swatch": "true",
323
+ className: "w-5 h-5 rounded-full border border-hairline/80 shrink-0",
324
+ style: { backgroundColor: cleanValue }
325
+ }
326
+ )
327
+ ] }),
328
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
329
+ formatMode === "HEX" ? /* @__PURE__ */ jsx("div", { className: "flex-1 flex items-center h-7 rounded-[var(--radius-lg)] border border-hairline bg-surface-hover/40 px-2.5 focus-within:border-brand-text focus-ring-within", children: /* @__PURE__ */ jsx(
330
+ "input",
331
+ {
332
+ type: "text",
333
+ value: cleanValue.toUpperCase(),
334
+ onChange: (e) => {
335
+ const val2 = e.target.value;
336
+ if (!val2) onChange("#000000");
337
+ else if (val2.startsWith("#")) onChange(val2);
338
+ else onChange(`#${val2}`);
339
+ },
340
+ "aria-label": "Hex color string",
341
+ className: "-my-1 w-full bg-transparent py-1 font-mono text-xs text-fg outline-none"
342
+ }
343
+ ) }) : /* @__PURE__ */ jsxs("div", { className: "flex-1 flex items-center gap-1", children: [
344
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 flex items-center h-7 bg-surface-hover/40 rounded-[var(--radius-lg)] border border-hairline px-1.5 focus-within:border-brand-text focus-ring-within", children: [
345
+ /* @__PURE__ */ jsx("span", { className: "text-[9px] text-fg-muted mr-1 font-mono select-none", children: "R" }),
346
+ /* @__PURE__ */ jsx(
347
+ "input",
348
+ {
349
+ type: "number",
350
+ min: 0,
351
+ max: 255,
352
+ value: rgb.r,
353
+ onChange: (e) => {
354
+ const rVal = Math.max(0, Math.min(255, Number(e.target.value) || 0));
355
+ onChange(rgbToHex(rVal, rgb.g, rgb.b));
356
+ },
357
+ "aria-label": "Red value (0-255)",
358
+ className: "w-full bg-transparent font-mono text-[11px] text-right text-fg outline-none p-0 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"
359
+ }
360
+ )
361
+ ] }),
362
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 flex items-center h-7 bg-surface-hover/40 rounded-[var(--radius-lg)] border border-hairline px-1.5 focus-within:border-brand-text focus-ring-within", children: [
363
+ /* @__PURE__ */ jsx("span", { className: "text-[9px] text-fg-muted mr-1 font-mono select-none", children: "G" }),
364
+ /* @__PURE__ */ jsx(
365
+ "input",
366
+ {
367
+ type: "number",
368
+ min: 0,
369
+ max: 255,
370
+ value: rgb.g,
371
+ onChange: (e) => {
372
+ const gVal = Math.max(0, Math.min(255, Number(e.target.value) || 0));
373
+ onChange(rgbToHex(rgb.r, gVal, rgb.b));
374
+ },
375
+ "aria-label": "Green value (0-255)",
376
+ className: "w-full bg-transparent font-mono text-[11px] text-right text-fg outline-none p-0 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"
377
+ }
378
+ )
379
+ ] }),
380
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 flex items-center h-7 bg-surface-hover/40 rounded-[var(--radius-lg)] border border-hairline px-1.5 focus-within:border-brand-text focus-ring-within", children: [
381
+ /* @__PURE__ */ jsx("span", { className: "text-[9px] text-fg-muted mr-1 font-mono select-none", children: "B" }),
382
+ /* @__PURE__ */ jsx(
383
+ "input",
384
+ {
385
+ type: "number",
386
+ min: 0,
387
+ max: 255,
388
+ value: rgb.b,
389
+ onChange: (e) => {
390
+ const bVal = Math.max(0, Math.min(255, Number(e.target.value) || 0));
391
+ onChange(rgbToHex(rgb.r, rgb.g, bVal));
392
+ },
393
+ "aria-label": "Blue value (0-255)",
394
+ className: "w-full bg-transparent font-mono text-[11px] text-right text-fg outline-none p-0 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"
395
+ }
396
+ )
397
+ ] })
398
+ ] }),
399
+ /* @__PURE__ */ jsx(
400
+ "button",
401
+ {
402
+ type: "button",
403
+ onPointerDown: (e) => e.preventDefault(),
404
+ onClick: () => setFormatMode(formatMode === "HEX" ? "RGB" : "HEX"),
405
+ "aria-label": `Switch to ${formatMode === "HEX" ? "RGB" : "HEX"} mode`,
406
+ title: `Switch to ${formatMode === "HEX" ? "RGB" : "HEX"} mode`,
407
+ className: "h-7 w-7 rounded-[var(--radius-lg)] border border-hairline bg-surface hover:bg-surface-hover text-fg-subtle hover:text-fg flex items-center justify-center transition active:scale-95 cursor-pointer shrink-0",
408
+ children: /* @__PURE__ */ jsx(ChevronsUpDown, { className: "w-3.5 h-3.5", "aria-hidden": true })
409
+ }
410
+ )
411
+ ] })
412
+ ]
413
+ }
414
+ );
415
+ }
416
+ function ColorPickerPopover({
417
+ value,
418
+ onChange,
419
+ trigger,
420
+ align = "start",
421
+ sideOffset = 6
422
+ }) {
423
+ return /* @__PURE__ */ jsxs(PopoverPrimitive.Root, { children: [
424
+ /* @__PURE__ */ jsx(PopoverPrimitive.Trigger, { asChild: true, children: trigger ? trigger : /* @__PURE__ */ jsx(
425
+ "button",
426
+ {
427
+ type: "button",
428
+ "aria-label": `Pick color, current ${value}`,
429
+ title: "Pick color",
430
+ className: "relative flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-[var(--radius-lg)] border border-hairline bg-surface hover:bg-surface-hover text-fg transition shadow-1",
431
+ children: /* @__PURE__ */ jsx(Pipette, { className: "h-3.5 w-3.5 text-fg-subtle", "aria-hidden": true })
432
+ }
433
+ ) }),
434
+ /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
435
+ PopoverPrimitive.Content,
436
+ {
437
+ "data-panel": true,
438
+ sideOffset,
439
+ align,
440
+ className: "z-[var(--z-floating)] outline-none shadow-panel rounded-[var(--radius-panel)]",
441
+ children: /* @__PURE__ */ jsx(CanvasColorPickerPopup, { value, onChange, className: "shadow-none border-none p-3" })
442
+ }
443
+ ) })
444
+ ] });
445
+ }
446
+ function ColorPicker({
447
+ value,
448
+ onChange,
449
+ variant = "popover",
450
+ trigger,
451
+ presets = BRAND_PRESETS,
452
+ swatchLayout = "grid",
453
+ maxSwatches,
454
+ colorMode = "hex",
455
+ customLabel = "Custom",
456
+ customLabelClassName,
457
+ allowCustom = true,
458
+ size,
459
+ className,
460
+ ...props
461
+ }) {
462
+ const normalizedValue = (value || "#000000").toLowerCase();
463
+ const visiblePresets = maxSwatches ? presets.slice(0, maxSwatches) : presets;
464
+ const displayInputValue = colorMode === "rgb" ? hexToRgbStr(normalizedValue) : value;
465
+ if (variant === "popover" || trigger) {
466
+ return /* @__PURE__ */ jsx(
467
+ ColorPickerPopover,
468
+ {
469
+ value: normalizedValue,
470
+ onChange,
471
+ trigger
472
+ }
473
+ );
474
+ }
475
+ if (variant === "canvas") {
476
+ return /* @__PURE__ */ jsx(
477
+ CanvasColorPickerPopup,
478
+ {
479
+ value: normalizedValue,
480
+ onChange,
481
+ className: cn("shadow-card", className)
482
+ }
483
+ );
484
+ }
485
+ if (variant === "field") {
486
+ return /* @__PURE__ */ jsxs(
487
+ "div",
488
+ {
489
+ "data-color-picker": "true",
490
+ className: cn(
491
+ "relative flex items-center rounded-[var(--radius-lg)] border border-hairline bg-surface px-2 py-1.5 transition focus-within:border-brand-text focus-ring-within shadow-1",
492
+ className
493
+ ),
494
+ ...props,
495
+ children: [
496
+ /* @__PURE__ */ jsxs(PopoverPrimitive.Root, { children: [
497
+ /* @__PURE__ */ jsx(PopoverPrimitive.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(
498
+ "button",
499
+ {
500
+ type: "button",
501
+ "aria-label": `Pick color, current ${value}`,
502
+ title: "Pick color",
503
+ className: "relative -my-0.5 -ml-0.5 mr-1.5 flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded-[var(--radius-lg)] select-none",
504
+ children: /* @__PURE__ */ jsx(
505
+ "span",
506
+ {
507
+ "aria-hidden": true,
508
+ "data-swatch": "true",
509
+ className: "h-5 w-5 shrink-0 rounded-[calc(var(--radius-lg)-2px)] border border-hairline shadow-1 transition-transform hover:scale-110 active:scale-95",
510
+ style: {
511
+ backgroundColor: normalizedValue.startsWith("#") ? normalizedValue : `#${normalizedValue}`
512
+ }
513
+ }
514
+ )
515
+ }
516
+ ) }),
517
+ /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
518
+ PopoverPrimitive.Content,
519
+ {
520
+ "data-panel": true,
521
+ sideOffset: 6,
522
+ align: "start",
523
+ className: "z-[var(--z-floating)] outline-none shadow-panel rounded-[var(--radius-panel)]",
524
+ children: /* @__PURE__ */ jsx(
525
+ CanvasColorPickerPopup,
526
+ {
527
+ value: normalizedValue,
528
+ onChange,
529
+ className: "shadow-none border-none p-3"
530
+ }
531
+ )
532
+ }
533
+ ) })
534
+ ] }),
535
+ /* @__PURE__ */ jsx(
536
+ "input",
537
+ {
538
+ type: "text",
539
+ value: displayInputValue,
540
+ placeholder: colorMode === "rgb" ? DEFAULT_RGB_STR : DEFAULT_HEX_STR,
541
+ onChange: (e) => {
542
+ const val = e.target.value;
543
+ if (colorMode === "hex") {
544
+ if (!val) onChange("#000000");
545
+ else if (val.startsWith("#")) onChange(val);
546
+ else onChange(`#${val}`);
547
+ } else {
548
+ onChange(val);
549
+ }
550
+ },
551
+ "aria-label": colorMode === "rgb" ? "RGB color string" : "Hex color string",
552
+ className: "-my-1 w-full border-none bg-transparent px-0 py-1 font-mono text-xs text-fg outline-none"
553
+ }
554
+ ),
555
+ /* @__PURE__ */ jsxs(PopoverPrimitive.Root, { children: [
556
+ /* @__PURE__ */ jsx(PopoverPrimitive.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(
557
+ "button",
558
+ {
559
+ type: "button",
560
+ "aria-label": "Open color picker",
561
+ title: "Open color picker",
562
+ className: "relative flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded-[var(--radius-lg)] text-fg-subtle transition hover:bg-surface-hover hover:text-fg ml-1",
563
+ children: /* @__PURE__ */ jsx(Pipette, { className: "h-3.5 w-3.5", "aria-hidden": true })
564
+ }
565
+ ) }),
566
+ /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
567
+ PopoverPrimitive.Content,
568
+ {
569
+ "data-panel": true,
570
+ sideOffset: 6,
571
+ align: "end",
572
+ className: "z-[var(--z-floating)] outline-none shadow-panel rounded-[var(--radius-panel)]",
573
+ children: /* @__PURE__ */ jsx(
574
+ CanvasColorPickerPopup,
575
+ {
576
+ value: normalizedValue,
577
+ onChange,
578
+ className: "shadow-none border-none p-3"
579
+ }
580
+ )
581
+ }
582
+ ) })
583
+ ] })
584
+ ]
585
+ }
586
+ );
587
+ }
588
+ return /* @__PURE__ */ jsxs(
589
+ "div",
590
+ {
591
+ "data-color-picker": "true",
592
+ className: cn(colorPickerVariants({ size }), className),
593
+ ...props,
594
+ children: [
595
+ /* @__PURE__ */ jsx(
596
+ "div",
597
+ {
598
+ role: "radiogroup",
599
+ "aria-label": "Colors",
600
+ onKeyDown: (e) => {
601
+ const cols = swatchLayout === "scroll" ? 1 : 8;
602
+ const step = { ArrowRight: 1, ArrowLeft: -1, ArrowDown: cols, ArrowUp: -cols }[e.key];
603
+ if (!step) return;
604
+ e.preventDefault();
605
+ const current = Math.max(0, visiblePresets.findIndex((p) => p.hex.toLowerCase() === normalizedValue));
606
+ const next = Math.min(visiblePresets.length - 1, Math.max(0, current + step));
607
+ onChange(visiblePresets[next].hex);
608
+ const buttons = e.currentTarget.querySelectorAll('[role="radio"]');
609
+ buttons[next]?.focus();
610
+ },
611
+ className: cn(
612
+ swatchLayout === "scroll" ? "flex items-center gap-1 overflow-x-auto py-1 scrollbar-none select-none" : "grid grid-cols-8 gap-1 justify-items-center"
613
+ ),
614
+ children: visiblePresets.map((p, i) => {
615
+ const isSelected = normalizedValue === p.hex.toLowerCase();
616
+ const anySelected = visiblePresets.some((x) => x.hex.toLowerCase() === normalizedValue);
617
+ const isMonochrome = p.hex === "#000000" || p.name.toLowerCase() === "monochrome";
618
+ return /* @__PURE__ */ jsx(
619
+ "button",
620
+ {
621
+ type: "button",
622
+ title: p.name,
623
+ "data-swatch": "true",
624
+ role: "radio",
625
+ "aria-label": p.name,
626
+ "aria-checked": isSelected,
627
+ tabIndex: isSelected || !anySelected && i === 0 ? 0 : -1,
628
+ onClick: () => onChange(p.hex),
629
+ className: cn(
630
+ "flex h-7 w-7 shrink-0 items-center justify-center rounded-[var(--radius-lg)] border transition cursor-pointer",
631
+ isSelected ? "border-fg-muted bg-surface-hover" : "border-transparent hover:bg-surface-hover"
632
+ ),
633
+ children: /* @__PURE__ */ jsx(
634
+ "span",
635
+ {
636
+ "data-swatch": "true",
637
+ className: "h-5 w-5 rounded-[calc(var(--radius-lg)-2px)] border border-hairline shrink-0",
638
+ style: {
639
+ backgroundColor: isMonochrome ? "rgb(var(--fg))" : p.hex
640
+ }
641
+ }
642
+ )
643
+ },
644
+ p.hex
645
+ );
646
+ })
647
+ }
648
+ ),
649
+ allowCustom && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-t border-hairline/60 pt-2.5 mt-1", children: [
650
+ /* @__PURE__ */ jsx(
651
+ "span",
652
+ {
653
+ className: cn(
654
+ "text-xs font-medium text-fg-subtle uppercase tracking-wider font-sans",
655
+ customLabelClassName
656
+ ),
657
+ children: customLabel
658
+ }
659
+ ),
660
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
661
+ /* @__PURE__ */ jsxs(PopoverPrimitive.Root, { children: [
662
+ /* @__PURE__ */ jsx(PopoverPrimitive.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(
663
+ "button",
664
+ {
665
+ type: "button",
666
+ "aria-label": `Pick custom color, current ${value}`,
667
+ title: "Pick custom color",
668
+ className: "relative flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-[var(--radius-lg)] border border-hairline text-fg-subtle transition hover:bg-surface-hover hover:text-fg",
669
+ children: /* @__PURE__ */ jsx(Pipette, { className: "h-3.5 w-3.5", "aria-hidden": true })
670
+ }
671
+ ) }),
672
+ /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
673
+ PopoverPrimitive.Content,
674
+ {
675
+ "data-panel": true,
676
+ sideOffset: 6,
677
+ align: "end",
678
+ className: "z-[var(--z-floating)] outline-none shadow-panel rounded-[var(--radius-panel)]",
679
+ children: /* @__PURE__ */ jsx(
680
+ CanvasColorPickerPopup,
681
+ {
682
+ value: normalizedValue,
683
+ onChange,
684
+ className: "shadow-none border-none p-3"
685
+ }
686
+ )
687
+ }
688
+ ) })
689
+ ] }),
690
+ /* @__PURE__ */ jsxs(
691
+ "div",
692
+ {
693
+ className: cn(
694
+ "flex items-center gap-1.5 rounded-[var(--radius-lg)] border border-hairline bg-surface py-1 pl-1.5 pr-1.5 transition focus-within:border-brand-text focus-ring-within",
695
+ colorMode === "rgb" ? "w-32" : "w-24"
696
+ ),
697
+ children: [
698
+ /* @__PURE__ */ jsxs(PopoverPrimitive.Root, { children: [
699
+ /* @__PURE__ */ jsx(PopoverPrimitive.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(
700
+ "button",
701
+ {
702
+ type: "button",
703
+ className: "relative -m-1 flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded-[var(--radius-lg)]",
704
+ "aria-label": `Pick color, current ${value}`,
705
+ title: "Pick color",
706
+ children: /* @__PURE__ */ jsx(
707
+ "span",
708
+ {
709
+ "aria-hidden": true,
710
+ "data-swatch": "true",
711
+ className: "h-4 w-4 shrink-0 rounded-[var(--radius-sm)] border border-hairline shadow-1 transition-transform hover:scale-110 active:scale-95",
712
+ style: {
713
+ backgroundColor: normalizedValue.startsWith("#") ? normalizedValue : `#${normalizedValue}`
714
+ }
715
+ }
716
+ )
717
+ }
718
+ ) }),
719
+ /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
720
+ PopoverPrimitive.Content,
721
+ {
722
+ "data-panel": true,
723
+ sideOffset: 6,
724
+ align: "end",
725
+ className: "z-[var(--z-floating)] outline-none shadow-panel rounded-[var(--radius-panel)]",
726
+ children: /* @__PURE__ */ jsx(
727
+ CanvasColorPickerPopup,
728
+ {
729
+ value: normalizedValue,
730
+ onChange,
731
+ className: "shadow-none border-none p-3"
732
+ }
733
+ )
734
+ }
735
+ ) })
736
+ ] }),
737
+ /* @__PURE__ */ jsx(
738
+ "input",
739
+ {
740
+ type: "text",
741
+ value: displayInputValue,
742
+ placeholder: colorMode === "rgb" ? DEFAULT_RGB_STR : DEFAULT_HEX_STR,
743
+ onChange: (e) => {
744
+ const val = e.target.value;
745
+ if (colorMode === "hex") {
746
+ if (!val) onChange("#000000");
747
+ else if (val.startsWith("#")) onChange(val);
748
+ else onChange(`#${val}`);
749
+ } else {
750
+ onChange(val);
751
+ }
752
+ },
753
+ "aria-label": colorMode === "rgb" ? "RGB color string" : "Hex color string",
754
+ className: "-my-1 w-full border-none bg-transparent px-0 py-1 font-mono text-xs text-fg outline-none"
755
+ }
756
+ )
757
+ ]
758
+ }
759
+ )
760
+ ] })
761
+ ] })
762
+ ]
763
+ }
764
+ );
765
+ }
766
+ export {
767
+ CanvasColorPickerPopup,
768
+ ColorPicker,
769
+ ColorPickerPopover,
770
+ colorPickerVariants,
771
+ hexToRgb,
772
+ hexToRgbStr,
773
+ hsvToRgb,
774
+ rgbToHex,
775
+ rgbToHsv
776
+ };