@work-rjkashyap/unified-ui 0.3.4 → 0.3.6

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 (456) hide show
  1. package/CHANGELOG.md +105 -0
  2. package/LICENSE +21 -0
  3. package/dist/components/accordion.cjs +225 -0
  4. package/dist/components/accordion.d.cts +157 -0
  5. package/dist/components/accordion.d.ts +157 -0
  6. package/dist/components/accordion.mjs +199 -0
  7. package/dist/components/alert-dialog.cjs +246 -0
  8. package/dist/components/alert-dialog.d.cts +61 -0
  9. package/dist/components/alert-dialog.d.ts +61 -0
  10. package/dist/components/alert-dialog.mjs +218 -0
  11. package/dist/components/alert.cjs +401 -0
  12. package/dist/components/alert.d.cts +217 -0
  13. package/dist/components/alert.d.ts +217 -0
  14. package/dist/components/alert.mjs +374 -0
  15. package/dist/components/aspect-ratio.cjs +45 -0
  16. package/dist/components/aspect-ratio.d.cts +10 -0
  17. package/dist/components/aspect-ratio.d.ts +10 -0
  18. package/dist/components/aspect-ratio.mjs +23 -0
  19. package/dist/components/avatar.cjs +348 -0
  20. package/dist/components/avatar.d.cts +198 -0
  21. package/dist/components/avatar.d.ts +198 -0
  22. package/dist/components/avatar.mjs +329 -0
  23. package/dist/components/badge.cjs +325 -0
  24. package/dist/components/badge.d.cts +259 -0
  25. package/dist/components/badge.d.ts +259 -0
  26. package/dist/components/badge.mjs +298 -0
  27. package/dist/components/banner.cjs +147 -0
  28. package/dist/components/banner.d.cts +31 -0
  29. package/dist/components/banner.d.ts +31 -0
  30. package/dist/components/banner.mjs +122 -0
  31. package/dist/components/breadcrumb.cjs +266 -0
  32. package/dist/components/breadcrumb.d.cts +159 -0
  33. package/dist/components/breadcrumb.d.ts +159 -0
  34. package/dist/components/breadcrumb.mjs +235 -0
  35. package/dist/components/button.cjs +254 -0
  36. package/dist/components/button.d.cts +126 -0
  37. package/dist/components/button.d.ts +126 -0
  38. package/dist/components/button.mjs +229 -0
  39. package/dist/components/calendar.cjs +511 -0
  40. package/dist/components/calendar.d.cts +94 -0
  41. package/dist/components/calendar.d.ts +94 -0
  42. package/dist/components/calendar.mjs +492 -0
  43. package/dist/components/card.cjs +234 -0
  44. package/dist/components/card.d.cts +190 -0
  45. package/dist/components/card.d.ts +190 -0
  46. package/dist/components/card.mjs +210 -0
  47. package/dist/components/carousel.cjs +234 -0
  48. package/dist/components/carousel.d.cts +30 -0
  49. package/dist/components/carousel.d.ts +30 -0
  50. package/dist/components/carousel.mjs +217 -0
  51. package/dist/components/chart.cjs +122 -0
  52. package/dist/components/chart.d.cts +103 -0
  53. package/dist/components/chart.d.ts +103 -0
  54. package/dist/components/chart.mjs +96 -0
  55. package/dist/components/checkbox.cjs +318 -0
  56. package/dist/components/checkbox.d.cts +182 -0
  57. package/dist/components/checkbox.d.ts +182 -0
  58. package/dist/components/checkbox.mjs +296 -0
  59. package/dist/components/code-highlight.cjs +335 -0
  60. package/dist/components/code-highlight.d.cts +18 -0
  61. package/dist/components/code-highlight.d.ts +18 -0
  62. package/dist/components/code-highlight.mjs +308 -0
  63. package/dist/components/code.cjs +265 -0
  64. package/dist/components/code.d.cts +40 -0
  65. package/dist/components/code.d.ts +40 -0
  66. package/dist/components/code.mjs +243 -0
  67. package/dist/components/collapsible.cjs +143 -0
  68. package/dist/components/collapsible.d.cts +159 -0
  69. package/dist/components/collapsible.d.ts +159 -0
  70. package/dist/components/collapsible.mjs +123 -0
  71. package/dist/components/color-picker.cjs +348 -0
  72. package/dist/components/color-picker.d.cts +35 -0
  73. package/dist/components/color-picker.d.ts +35 -0
  74. package/dist/components/color-picker.mjs +331 -0
  75. package/dist/components/combobox.cjs +584 -0
  76. package/dist/components/combobox.d.cts +183 -0
  77. package/dist/components/combobox.d.ts +183 -0
  78. package/dist/components/combobox.mjs +571 -0
  79. package/dist/components/command.cjs +329 -0
  80. package/dist/components/command.d.cts +97 -0
  81. package/dist/components/command.d.ts +97 -0
  82. package/dist/components/command.mjs +311 -0
  83. package/dist/components/confirm-dialog.cjs +100 -0
  84. package/dist/components/confirm-dialog.d.cts +25 -0
  85. package/dist/components/confirm-dialog.d.ts +25 -0
  86. package/dist/components/confirm-dialog.mjs +86 -0
  87. package/dist/components/context-menu.cjs +325 -0
  88. package/dist/components/context-menu.d.cts +259 -0
  89. package/dist/components/context-menu.d.ts +259 -0
  90. package/dist/components/context-menu.mjs +290 -0
  91. package/dist/components/copy-button.cjs +203 -0
  92. package/dist/components/copy-button.d.cts +22 -0
  93. package/dist/components/copy-button.d.ts +22 -0
  94. package/dist/components/copy-button.mjs +178 -0
  95. package/dist/components/data-list.cjs +140 -0
  96. package/dist/components/data-list.d.cts +36 -0
  97. package/dist/components/data-list.d.ts +36 -0
  98. package/dist/components/data-list.mjs +113 -0
  99. package/dist/components/data-table-toolbar.cjs +338 -0
  100. package/dist/components/data-table-toolbar.d.cts +84 -0
  101. package/dist/components/data-table-toolbar.d.ts +84 -0
  102. package/dist/components/data-table-toolbar.mjs +320 -0
  103. package/dist/components/data-table.cjs +1324 -0
  104. package/dist/components/data-table.d.cts +349 -0
  105. package/dist/components/data-table.d.ts +349 -0
  106. package/dist/components/data-table.mjs +1323 -0
  107. package/dist/components/date-picker.cjs +282 -0
  108. package/dist/components/date-picker.d.cts +97 -0
  109. package/dist/components/date-picker.d.ts +97 -0
  110. package/dist/components/date-picker.mjs +258 -0
  111. package/dist/components/dialog.cjs +319 -0
  112. package/dist/components/dialog.d.cts +74 -0
  113. package/dist/components/dialog.d.ts +74 -0
  114. package/dist/components/dialog.mjs +292 -0
  115. package/dist/components/drawer.cjs +262 -0
  116. package/dist/components/drawer.d.cts +113 -0
  117. package/dist/components/drawer.d.ts +113 -0
  118. package/dist/components/drawer.mjs +230 -0
  119. package/dist/components/dropdown-menu.cjs +328 -0
  120. package/dist/components/dropdown-menu.d.cts +95 -0
  121. package/dist/components/dropdown-menu.d.ts +95 -0
  122. package/dist/components/dropdown-menu.mjs +293 -0
  123. package/dist/components/empty-state.cjs +123 -0
  124. package/dist/components/empty-state.d.cts +15 -0
  125. package/dist/components/empty-state.d.ts +15 -0
  126. package/dist/components/empty-state.mjs +99 -0
  127. package/dist/components/file-upload.cjs +442 -0
  128. package/dist/components/file-upload.d.cts +35 -0
  129. package/dist/components/file-upload.d.ts +35 -0
  130. package/dist/components/file-upload.mjs +423 -0
  131. package/dist/components/form-field.cjs +191 -0
  132. package/dist/components/form-field.d.cts +163 -0
  133. package/dist/components/form-field.d.ts +163 -0
  134. package/dist/components/form-field.mjs +167 -0
  135. package/dist/components/hover-card.cjs +99 -0
  136. package/dist/components/hover-card.d.cts +28 -0
  137. package/dist/components/hover-card.d.ts +28 -0
  138. package/dist/components/hover-card.mjs +75 -0
  139. package/dist/components/image-gallery.cjs +359 -0
  140. package/dist/components/image-gallery.d.cts +46 -0
  141. package/dist/components/image-gallery.d.ts +46 -0
  142. package/dist/components/image-gallery.mjs +340 -0
  143. package/dist/components/index.cjs +719 -0
  144. package/dist/components/index.d.cts +84 -0
  145. package/dist/components/index.d.ts +84 -0
  146. package/dist/components/index.mjs +771 -0
  147. package/dist/components/infinite-scroll.cjs +95 -0
  148. package/dist/components/infinite-scroll.d.cts +54 -0
  149. package/dist/components/infinite-scroll.d.ts +54 -0
  150. package/dist/components/infinite-scroll.mjs +71 -0
  151. package/dist/components/input-group.cjs +202 -0
  152. package/dist/components/input-group.d.cts +22 -0
  153. package/dist/components/input-group.d.ts +22 -0
  154. package/dist/components/input-group.mjs +178 -0
  155. package/dist/components/input.cjs +318 -0
  156. package/dist/components/input.d.cts +99 -0
  157. package/dist/components/input.d.ts +99 -0
  158. package/dist/components/input.mjs +296 -0
  159. package/dist/components/kbd.cjs +69 -0
  160. package/dist/components/kbd.d.cts +25 -0
  161. package/dist/components/kbd.d.ts +25 -0
  162. package/dist/components/kbd.mjs +44 -0
  163. package/dist/components/label.cjs +138 -0
  164. package/dist/components/label.d.cts +91 -0
  165. package/dist/components/label.d.ts +91 -0
  166. package/dist/components/label.mjs +113 -0
  167. package/dist/components/markdown.cjs +179 -0
  168. package/dist/components/markdown.d.cts +41 -0
  169. package/dist/components/markdown.d.ts +41 -0
  170. package/dist/components/markdown.mjs +155 -0
  171. package/dist/components/menubar.cjs +365 -0
  172. package/dist/components/menubar.d.cts +88 -0
  173. package/dist/components/menubar.d.ts +88 -0
  174. package/dist/components/menubar.mjs +329 -0
  175. package/dist/components/navigation-menu.cjs +280 -0
  176. package/dist/components/navigation-menu.d.cts +123 -0
  177. package/dist/components/navigation-menu.d.ts +123 -0
  178. package/dist/components/navigation-menu.mjs +250 -0
  179. package/dist/components/number-input.cjs +419 -0
  180. package/dist/components/number-input.d.cts +111 -0
  181. package/dist/components/number-input.d.ts +111 -0
  182. package/dist/components/number-input.mjs +400 -0
  183. package/dist/components/pagination.cjs +322 -0
  184. package/dist/components/pagination.d.cts +119 -0
  185. package/dist/components/pagination.d.ts +119 -0
  186. package/dist/components/pagination.mjs +297 -0
  187. package/dist/components/pin-input.cjs +321 -0
  188. package/dist/components/pin-input.d.cts +112 -0
  189. package/dist/components/pin-input.d.ts +112 -0
  190. package/dist/components/pin-input.mjs +303 -0
  191. package/dist/components/popover.cjs +194 -0
  192. package/dist/components/popover.d.cts +108 -0
  193. package/dist/components/popover.d.ts +108 -0
  194. package/dist/components/popover.mjs +168 -0
  195. package/dist/components/progress.cjs +237 -0
  196. package/dist/components/progress.d.cts +137 -0
  197. package/dist/components/progress.d.ts +137 -0
  198. package/dist/components/progress.mjs +211 -0
  199. package/dist/components/radio.cjs +344 -0
  200. package/dist/components/radio.d.cts +145 -0
  201. package/dist/components/radio.d.ts +145 -0
  202. package/dist/components/radio.mjs +320 -0
  203. package/dist/components/resizable.cjs +121 -0
  204. package/dist/components/resizable.d.cts +23 -0
  205. package/dist/components/resizable.d.ts +23 -0
  206. package/dist/components/resizable.mjs +99 -0
  207. package/dist/components/scroll-area.cjs +168 -0
  208. package/dist/components/scroll-area.d.cts +131 -0
  209. package/dist/components/scroll-area.d.ts +131 -0
  210. package/dist/components/scroll-area.mjs +143 -0
  211. package/dist/components/search-input.cjs +261 -0
  212. package/dist/components/search-input.d.cts +26 -0
  213. package/dist/components/search-input.d.ts +26 -0
  214. package/dist/components/search-input.mjs +243 -0
  215. package/dist/components/select.cjs +320 -0
  216. package/dist/components/select.d.cts +55 -0
  217. package/dist/components/select.d.ts +55 -0
  218. package/dist/components/select.mjs +288 -0
  219. package/dist/components/separator.cjs +193 -0
  220. package/dist/components/separator.d.cts +92 -0
  221. package/dist/components/separator.d.ts +92 -0
  222. package/dist/components/separator.mjs +170 -0
  223. package/dist/components/sheet.cjs +399 -0
  224. package/dist/components/sheet.d.cts +219 -0
  225. package/dist/components/sheet.d.ts +219 -0
  226. package/dist/components/sheet.mjs +379 -0
  227. package/dist/components/sidebar.cjs +1077 -0
  228. package/dist/components/sidebar.d.cts +733 -0
  229. package/dist/components/sidebar.d.ts +733 -0
  230. package/dist/components/sidebar.mjs +1033 -0
  231. package/dist/components/skeleton.cjs +210 -0
  232. package/dist/components/skeleton.d.cts +202 -0
  233. package/dist/components/skeleton.d.ts +202 -0
  234. package/dist/components/skeleton.mjs +182 -0
  235. package/dist/components/slider.cjs +319 -0
  236. package/dist/components/slider.d.cts +82 -0
  237. package/dist/components/slider.d.ts +82 -0
  238. package/dist/components/slider.mjs +296 -0
  239. package/dist/components/sonner.cjs +119 -0
  240. package/dist/components/sonner.d.cts +60 -0
  241. package/dist/components/sonner.d.ts +60 -0
  242. package/dist/components/sonner.mjs +94 -0
  243. package/dist/components/spinner.cjs +238 -0
  244. package/dist/components/spinner.d.cts +101 -0
  245. package/dist/components/spinner.d.ts +101 -0
  246. package/dist/components/spinner.mjs +213 -0
  247. package/dist/components/stat.cjs +180 -0
  248. package/dist/components/stat.d.cts +21 -0
  249. package/dist/components/stat.d.ts +21 -0
  250. package/dist/components/stat.mjs +161 -0
  251. package/dist/components/steps.cjs +228 -0
  252. package/dist/components/steps.d.cts +76 -0
  253. package/dist/components/steps.d.ts +76 -0
  254. package/dist/components/steps.mjs +207 -0
  255. package/dist/components/switch.cjs +243 -0
  256. package/dist/components/switch.d.cts +90 -0
  257. package/dist/components/switch.d.ts +90 -0
  258. package/dist/components/switch.mjs +228 -0
  259. package/dist/components/table.cjs +381 -0
  260. package/dist/components/table.d.cts +181 -0
  261. package/dist/components/table.d.ts +181 -0
  262. package/dist/components/table.mjs +349 -0
  263. package/dist/components/tabs.cjs +326 -0
  264. package/dist/components/tabs.d.cts +154 -0
  265. package/dist/components/tabs.d.ts +154 -0
  266. package/dist/components/tabs.mjs +304 -0
  267. package/dist/components/textarea.cjs +258 -0
  268. package/dist/components/textarea.d.cts +112 -0
  269. package/dist/components/textarea.d.ts +112 -0
  270. package/dist/components/textarea.mjs +233 -0
  271. package/dist/components/theme-toggle.cjs +282 -0
  272. package/dist/components/theme-toggle.d.cts +58 -0
  273. package/dist/components/theme-toggle.d.ts +58 -0
  274. package/dist/components/theme-toggle.mjs +258 -0
  275. package/dist/components/timeline.cjs +178 -0
  276. package/dist/components/timeline.d.cts +41 -0
  277. package/dist/components/timeline.d.ts +41 -0
  278. package/dist/components/timeline.mjs +157 -0
  279. package/dist/components/toast.cjs +546 -0
  280. package/dist/components/toast.d.cts +169 -0
  281. package/dist/components/toast.d.ts +169 -0
  282. package/dist/components/toast.mjs +528 -0
  283. package/dist/components/toggle-group.cjs +204 -0
  284. package/dist/components/toggle-group.d.cts +215 -0
  285. package/dist/components/toggle-group.d.ts +215 -0
  286. package/dist/components/toggle-group.mjs +180 -0
  287. package/dist/components/toggle.cjs +155 -0
  288. package/dist/components/toggle.d.cts +100 -0
  289. package/dist/components/toggle.d.ts +100 -0
  290. package/dist/components/toggle.mjs +130 -0
  291. package/dist/components/tooltip.cjs +155 -0
  292. package/dist/components/tooltip.d.cts +129 -0
  293. package/dist/components/tooltip.d.ts +129 -0
  294. package/dist/components/tooltip.mjs +132 -0
  295. package/dist/components/tree-view.cjs +450 -0
  296. package/dist/components/tree-view.d.cts +67 -0
  297. package/dist/components/tree-view.d.ts +67 -0
  298. package/dist/components/tree-view.mjs +433 -0
  299. package/dist/components/video-player.cjs +344 -0
  300. package/dist/components/video-player.d.cts +34 -0
  301. package/dist/components/video-player.d.ts +34 -0
  302. package/dist/components/video-player.mjs +320 -0
  303. package/dist/components/virtual-list.cjs +153 -0
  304. package/dist/components/virtual-list.d.cts +53 -0
  305. package/dist/components/virtual-list.d.ts +53 -0
  306. package/dist/components/virtual-list.mjs +136 -0
  307. package/dist/components/visually-hidden.cjs +43 -0
  308. package/dist/components/visually-hidden.d.cts +9 -0
  309. package/dist/components/visually-hidden.d.ts +9 -0
  310. package/dist/components/visually-hidden.mjs +21 -0
  311. package/dist/index.cjs +1081 -1957
  312. package/dist/index.d.cts +99 -11
  313. package/dist/index.d.ts +99 -11
  314. package/dist/index.mjs +1138 -16
  315. package/dist/motion/hooks.cjs +98 -0
  316. package/dist/motion/hooks.d.cts +32 -0
  317. package/dist/motion/hooks.d.ts +32 -0
  318. package/dist/motion/hooks.mjs +70 -0
  319. package/dist/motion/index.cjs +157 -0
  320. package/dist/motion/index.d.cts +5 -0
  321. package/dist/motion/index.d.ts +5 -0
  322. package/dist/motion/index.mjs +137 -0
  323. package/dist/motion/presets.cjs +609 -0
  324. package/dist/{motion.d.ts → motion/presets.d.cts} +1 -30
  325. package/dist/{motion.d.cts → motion/presets.d.ts} +1 -30
  326. package/dist/{chunk-PLRSH37T.mjs → motion/presets.mjs} +119 -126
  327. package/dist/primitives/container.cjs +88 -0
  328. package/dist/primitives/container.d.cts +82 -0
  329. package/dist/primitives/container.d.ts +82 -0
  330. package/dist/primitives/container.mjs +64 -0
  331. package/dist/primitives/divider.cjs +74 -0
  332. package/dist/primitives/divider.d.cts +30 -0
  333. package/dist/primitives/divider.d.ts +30 -0
  334. package/dist/primitives/divider.mjs +50 -0
  335. package/dist/primitives/index.cjs +54 -0
  336. package/dist/primitives/index.d.cts +6 -0
  337. package/dist/primitives/index.d.ts +6 -0
  338. package/dist/primitives/index.mjs +33 -0
  339. package/dist/primitives/stack.cjs +167 -0
  340. package/dist/primitives/stack.d.cts +132 -0
  341. package/dist/primitives/stack.d.ts +132 -0
  342. package/dist/primitives/stack.mjs +142 -0
  343. package/dist/primitives/typography.cjs +260 -0
  344. package/dist/primitives/typography.d.cts +157 -0
  345. package/dist/primitives/typography.d.ts +157 -0
  346. package/dist/primitives/typography.mjs +229 -0
  347. package/dist/theme/contract.cjs +246 -0
  348. package/dist/theme/contract.d.cts +76 -0
  349. package/dist/theme/contract.d.ts +76 -0
  350. package/dist/theme/contract.mjs +221 -0
  351. package/dist/theme/customizer-store.cjs +266 -0
  352. package/dist/theme/customizer-store.d.cts +76 -0
  353. package/dist/theme/customizer-store.d.ts +76 -0
  354. package/dist/theme/customizer-store.mjs +261 -0
  355. package/dist/theme/customizer.cjs +812 -0
  356. package/dist/theme/customizer.d.cts +13 -0
  357. package/dist/theme/customizer.d.ts +13 -0
  358. package/dist/theme/customizer.mjs +803 -0
  359. package/dist/theme/index.cjs +105 -0
  360. package/dist/theme/index.d.cts +13 -0
  361. package/dist/theme/index.d.ts +13 -0
  362. package/dist/theme/index.mjs +87 -0
  363. package/dist/theme/presets.cjs +1205 -0
  364. package/dist/theme/presets.d.cts +232 -0
  365. package/dist/theme/presets.d.ts +232 -0
  366. package/dist/theme/presets.mjs +1175 -0
  367. package/dist/theme/provider.cjs +122 -0
  368. package/dist/theme/provider.d.cts +57 -0
  369. package/dist/theme/provider.d.ts +57 -0
  370. package/dist/theme/provider.mjs +104 -0
  371. package/dist/{chunk-AAEWG5VR.mjs → tokens/colors.cjs} +94 -94
  372. package/dist/{z-index-DmLl6FUD.d.ts → tokens/colors.d.cts} +118 -72
  373. package/dist/{z-index-DmLl6FUD.d.cts → tokens/colors.d.ts} +118 -72
  374. package/dist/{chunk-6ZZZBOCH.cjs → tokens/colors.mjs} +47 -121
  375. package/dist/tokens/index.cjs +96 -0
  376. package/dist/tokens/index.d.cts +7 -0
  377. package/dist/tokens/index.d.ts +7 -0
  378. package/dist/tokens/index.mjs +71 -0
  379. package/dist/{chunk-XCKK6P46.cjs → tokens/motion.cjs} +46 -18
  380. package/dist/{motion-D9wQbcKL.d.cts → tokens/motion.d.cts} +1 -1
  381. package/dist/{motion-D9wQbcKL.d.ts → tokens/motion.d.ts} +1 -1
  382. package/dist/{chunk-EZ2L3XPS.mjs → tokens/motion.mjs} +16 -10
  383. package/dist/tokens/radius.cjs +41 -0
  384. package/dist/tokens/radius.d.cts +18 -0
  385. package/dist/tokens/radius.d.ts +18 -0
  386. package/dist/tokens/radius.mjs +17 -0
  387. package/dist/tokens/shadows.cjs +57 -0
  388. package/dist/tokens/shadows.d.cts +32 -0
  389. package/dist/tokens/shadows.d.ts +32 -0
  390. package/dist/tokens/shadows.mjs +32 -0
  391. package/dist/tokens/spacing.cjs +51 -0
  392. package/dist/tokens/spacing.d.cts +26 -0
  393. package/dist/tokens/spacing.d.ts +26 -0
  394. package/dist/{chunk-NMPHV6ZD.mjs → tokens/spacing.mjs} +4 -4
  395. package/dist/{chunk-ECIGDEAH.cjs → tokens/typography.cjs} +43 -16
  396. package/dist/{typography-DlvVjEdE.d.ts → tokens/typography.d.cts} +1 -1
  397. package/dist/{typography-DlvVjEdE.d.cts → tokens/typography.d.ts} +1 -1
  398. package/dist/{chunk-ITBG42M5.mjs → tokens/typography.mjs} +14 -9
  399. package/dist/tokens/z-index.cjs +47 -0
  400. package/dist/tokens/z-index.d.cts +24 -0
  401. package/dist/tokens/z-index.d.ts +24 -0
  402. package/dist/tokens/z-index.mjs +23 -0
  403. package/dist/utils/cn.cjs +102 -0
  404. package/dist/utils/cn.d.cts +84 -0
  405. package/dist/utils/cn.d.ts +84 -0
  406. package/dist/{chunk-ZT3PCXDF.mjs → utils/cn.mjs} +14 -7
  407. package/dist/{chunk-33QEKXRQ.cjs → utils/contrast.cjs} +68 -38
  408. package/dist/utils/contrast.d.cts +209 -0
  409. package/dist/utils/contrast.d.ts +209 -0
  410. package/dist/{chunk-5NZDQWRV.mjs → utils/contrast.mjs} +27 -18
  411. package/dist/utils/focus-ring.cjs +81 -0
  412. package/dist/utils/focus-ring.d.cts +80 -0
  413. package/dist/utils/focus-ring.d.ts +80 -0
  414. package/dist/utils/focus-ring.mjs +47 -0
  415. package/dist/utils/index.cjs +107 -0
  416. package/dist/utils/index.d.cts +6 -0
  417. package/dist/utils/index.d.ts +6 -0
  418. package/dist/utils/index.mjs +88 -0
  419. package/dist/utils/types.cjs +38 -0
  420. package/dist/utils/types.d.cts +187 -0
  421. package/dist/utils/types.d.ts +187 -0
  422. package/dist/utils/types.mjs +13 -0
  423. package/package.json +191 -191
  424. package/dist/chunk-2JFREULQ.cjs +0 -29
  425. package/dist/chunk-3EHT6IOA.cjs +0 -49
  426. package/dist/chunk-4ON3M3OM.cjs +0 -73
  427. package/dist/chunk-A2DGHQL2.cjs +0 -21808
  428. package/dist/chunk-BJ55D5IK.mjs +0 -2433
  429. package/dist/chunk-F4JJFWWU.cjs +0 -604
  430. package/dist/chunk-FUWXGHWQ.cjs +0 -468
  431. package/dist/chunk-MBYCK2JJ.mjs +0 -37
  432. package/dist/chunk-OHEH57BV.mjs +0 -455
  433. package/dist/chunk-RUG3BW2B.cjs +0 -2471
  434. package/dist/chunk-XAIUX2YS.mjs +0 -21477
  435. package/dist/components.cjs +0 -1247
  436. package/dist/components.d.cts +0 -7881
  437. package/dist/components.d.ts +0 -7881
  438. package/dist/components.mjs +0 -6
  439. package/dist/motion.cjs +0 -264
  440. package/dist/motion.mjs +0 -3
  441. package/dist/primitives.cjs +0 -57
  442. package/dist/primitives.d.cts +0 -390
  443. package/dist/primitives.d.ts +0 -390
  444. package/dist/primitives.mjs +0 -4
  445. package/dist/theme.cjs +0 -159
  446. package/dist/theme.d.cts +0 -440
  447. package/dist/theme.d.ts +0 -440
  448. package/dist/theme.mjs +0 -6
  449. package/dist/tokens.cjs +0 -137
  450. package/dist/tokens.d.cts +0 -30
  451. package/dist/tokens.d.ts +0 -30
  452. package/dist/tokens.mjs +0 -4
  453. package/dist/utils.cjs +0 -164
  454. package/dist/utils.d.cts +0 -525
  455. package/dist/utils.d.ts +0 -525
  456. package/dist/utils.mjs +0 -3
@@ -1,2433 +0,0 @@
1
- import { blue, red, amber, green, zinc, slate, gray, teal, brand, indigo, purple, pink, cyan, emerald, yellow, fuchsia, sky, lime, zIndex, shadow, radius, semanticLight, shadowDark, semanticDark } from './chunk-AAEWG5VR.mjs';
2
- import { fontFamily } from './chunk-ITBG42M5.mjs';
3
- import { easingCSS, durationCSS } from './chunk-EZ2L3XPS.mjs';
4
- import { cn } from './chunk-ZT3PCXDF.mjs';
5
- import { createContext, useContext, useState, useRef, useEffect, useCallback, useMemo } from 'react';
6
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
7
-
8
- // src/theme/contract.ts
9
- var colorVarNames = {
10
- background: "--background",
11
- foreground: "--foreground",
12
- surface: "--surface",
13
- surfaceRaised: "--surface-raised",
14
- surfaceOverlay: "--surface-overlay",
15
- card: "--card",
16
- cardForeground: "--card-foreground",
17
- popover: "--popover",
18
- popoverForeground: "--popover-foreground",
19
- muted: "--muted",
20
- mutedForeground: "--muted-foreground",
21
- primary: "--primary",
22
- primaryForeground: "--primary-foreground",
23
- primaryHover: "--primary-hover",
24
- primaryActive: "--primary-active",
25
- primaryMuted: "--primary-muted",
26
- primaryMutedForeground: "--primary-muted-foreground",
27
- secondary: "--secondary",
28
- secondaryForeground: "--secondary-foreground",
29
- secondaryHover: "--secondary-hover",
30
- secondaryActive: "--secondary-active",
31
- accent: "--accent",
32
- accentForeground: "--accent-foreground",
33
- success: "--success",
34
- successForeground: "--success-foreground",
35
- successMuted: "--success-muted",
36
- successMutedForeground: "--success-muted-foreground",
37
- warning: "--warning",
38
- warningForeground: "--warning-foreground",
39
- warningMuted: "--warning-muted",
40
- warningMutedForeground: "--warning-muted-foreground",
41
- danger: "--danger",
42
- dangerForeground: "--danger-foreground",
43
- dangerHover: "--danger-hover",
44
- dangerActive: "--danger-active",
45
- dangerMuted: "--danger-muted",
46
- dangerMutedForeground: "--danger-muted-foreground",
47
- destructive: "--destructive",
48
- destructiveForeground: "--destructive-foreground",
49
- info: "--info",
50
- infoForeground: "--info-foreground",
51
- infoMuted: "--info-muted",
52
- infoMutedForeground: "--info-muted-foreground",
53
- border: "--border",
54
- borderMuted: "--border-muted",
55
- borderStrong: "--border-strong",
56
- focusRing: "--focus-ring",
57
- ring: "--ring",
58
- input: "--input",
59
- inputForeground: "--input-foreground",
60
- inputPlaceholder: "--input-placeholder",
61
- disabled: "--disabled",
62
- disabledForeground: "--disabled-foreground",
63
- chart1: "--chart-1",
64
- chart2: "--chart-2",
65
- chart3: "--chart-3",
66
- chart4: "--chart-4",
67
- chart5: "--chart-5",
68
- sidebar: "--sidebar",
69
- sidebarForeground: "--sidebar-foreground",
70
- sidebarPrimary: "--sidebar-primary",
71
- sidebarPrimaryForeground: "--sidebar-primary-foreground",
72
- sidebarAccent: "--sidebar-accent",
73
- sidebarAccentForeground: "--sidebar-accent-foreground",
74
- sidebarBorder: "--sidebar-border",
75
- sidebarRing: "--sidebar-ring"
76
- };
77
- var radiusVarNames = {
78
- none: "--radius-none",
79
- sm: "--radius-sm",
80
- md: "--radius-md",
81
- lg: "--radius-lg",
82
- xl: "--radius-xl",
83
- full: "--radius-full"
84
- };
85
- var shadowVarNames = {
86
- none: "--shadow-none",
87
- xs: "--shadow-xs",
88
- sm: "--shadow-sm",
89
- md: "--shadow-md",
90
- lg: "--shadow-lg",
91
- xl: "--shadow-xl",
92
- "2xl": "--shadow-2xl",
93
- focusRing: "--shadow-focus-ring"
94
- };
95
- var zIndexVarNames = {
96
- base: "--z-base",
97
- dropdown: "--z-dropdown",
98
- sticky: "--z-sticky",
99
- overlay: "--z-overlay",
100
- modal: "--z-modal",
101
- popover: "--z-popover",
102
- toast: "--z-toast",
103
- tooltip: "--z-tooltip",
104
- max: "--z-max"
105
- };
106
- var durationVarNames = {
107
- instant: "--duration-instant",
108
- fast: "--duration-fast",
109
- moderate: "--duration-moderate",
110
- normal: "--duration-normal",
111
- slow: "--duration-slow",
112
- slower: "--duration-slower",
113
- slowest: "--duration-slowest"
114
- };
115
- var easingVarNames = {
116
- standard: "--easing-standard",
117
- decelerate: "--easing-decelerate",
118
- accelerate: "--easing-accelerate",
119
- emphasize: "--easing-emphasize",
120
- linear: "--easing-linear",
121
- snap: "--easing-snap"
122
- };
123
- var fontFamilyVarNames = {
124
- display: "--font-display",
125
- sans: "--font-sans",
126
- serif: "--font-serif",
127
- mono: "--font-mono",
128
- inherit: "--font-inherit"
129
- };
130
- function mapRecord(varNames, values) {
131
- const result = {};
132
- for (const key of Object.keys(varNames)) {
133
- result[varNames[key]] = values[key];
134
- }
135
- return result;
136
- }
137
- function buildLightThemeVars() {
138
- return {
139
- ...mapRecord(colorVarNames, semanticLight),
140
- ...mapRecord(radiusVarNames, radius),
141
- ...mapRecord(shadowVarNames, shadow),
142
- ...mapRecord(zIndexVarNames, zIndex),
143
- ...mapRecord(durationVarNames, durationCSS),
144
- ...mapRecord(easingVarNames, easingCSS),
145
- ...mapRecord(fontFamilyVarNames, fontFamily)
146
- };
147
- }
148
- function buildDarkThemeVars() {
149
- return {
150
- ...mapRecord(colorVarNames, semanticDark),
151
- ...mapRecord(radiusVarNames, radius),
152
- ...mapRecord(shadowVarNames, shadowDark),
153
- ...mapRecord(zIndexVarNames, zIndex),
154
- ...mapRecord(durationVarNames, durationCSS),
155
- ...mapRecord(easingVarNames, easingCSS),
156
- ...mapRecord(fontFamilyVarNames, fontFamily)
157
- };
158
- }
159
- function varsToCSS(vars) {
160
- return Object.entries(vars).map(([prop, value]) => ` ${prop}: ${value};`).join("\n");
161
- }
162
- function buildThemeCSS() {
163
- const lightVars = buildLightThemeVars();
164
- const darkVars = buildDarkThemeVars();
165
- return `:root {
166
- ${varsToCSS(lightVars)}
167
- }
168
-
169
- .dark {
170
- ${varsToCSS(darkVars)}
171
- }`;
172
- }
173
- var contract = {
174
- color: colorVarNames,
175
- radius: radiusVarNames,
176
- shadow: shadowVarNames,
177
- zIndex: zIndexVarNames,
178
- duration: durationVarNames,
179
- easing: easingVarNames,
180
- fontFamily: fontFamilyVarNames
181
- };
182
- var cssVar = {
183
- /** Returns `var(--<key>)` for use in style props */
184
- color: (key) => `var(${colorVarNames[key]})`,
185
- /**
186
- * Returns a color-mix() expression with a custom alpha channel.
187
- *
188
- * Because oklch values are stored as complete `oklch(L C H)` strings
189
- * in the CSS custom property, you cannot directly decompose them with
190
- * simple var() references. For alpha-modified colors, prefer using
191
- * Tailwind's built-in opacity modifier syntax (e.g. `bg-primary/50`)
192
- * or define a dedicated muted token.
193
- *
194
- * If you need programmatic alpha in JS, use this helper which produces
195
- * a color-mix() expression for broad browser support.
196
- */
197
- colorAlpha: (key, alpha) => `color-mix(in oklch, var(${colorVarNames[key]}) ${Math.round(alpha * 100)}%, transparent)`,
198
- /** Returns `var(--radius-<key>)` */
199
- radius: (key) => `var(${radiusVarNames[key]})`,
200
- /** Returns `var(--shadow-<key>)` */
201
- shadow: (key) => `var(${shadowVarNames[key]})`,
202
- /** Returns `var(--z-<key>)` */
203
- zIndex: (key) => `var(${zIndexVarNames[key]})`,
204
- /** Returns `var(--duration-<key>)` */
205
- duration: (key) => `var(${durationVarNames[key]})`,
206
- /** Returns `var(--easing-<key>)` */
207
- easing: (key) => `var(${easingVarNames[key]})`,
208
- /** Returns `var(--font-<key>)` */
209
- fontFamily: (key) => `var(${fontFamilyVarNames[key]})`,
210
- /** Returns the raw `var(--<key>)` — same as color() since values are complete oklch */
211
- colorChannels: (key) => `var(${colorVarNames[key]})`
212
- };
213
-
214
- // src/theme/presets.ts
215
- var STATUS_LIGHT = {
216
- success: green[600],
217
- successForeground: "oklch(0.145 0 0)",
218
- successMuted: green[50],
219
- successMutedForeground: green[700],
220
- warning: amber[500],
221
- warningForeground: "oklch(0.145 0 0)",
222
- warningMuted: amber[50],
223
- warningMutedForeground: amber[700],
224
- danger: red[600],
225
- dangerForeground: "oklch(0.985 0 0)",
226
- dangerHover: red[700],
227
- dangerActive: red[800],
228
- dangerMuted: red[50],
229
- dangerMutedForeground: red[700],
230
- destructive: red[600],
231
- destructiveForeground: "oklch(0.985 0 0)",
232
- info: blue[600],
233
- infoForeground: "oklch(0.985 0 0)",
234
- infoMuted: blue[50],
235
- infoMutedForeground: blue[700]
236
- };
237
- var STATUS_DARK = {
238
- success: green[500],
239
- successForeground: "oklch(0.145 0 0)",
240
- successMuted: green[950],
241
- successMutedForeground: green[300],
242
- warning: amber[400],
243
- warningForeground: "oklch(0.145 0 0)",
244
- warningMuted: amber[950],
245
- warningMutedForeground: amber[300],
246
- danger: red[500],
247
- dangerForeground: "oklch(0.985 0 0)",
248
- dangerHover: red[400],
249
- dangerActive: red[300],
250
- dangerMuted: red[950],
251
- dangerMutedForeground: red[300],
252
- destructive: red[500],
253
- destructiveForeground: "oklch(0.985 0 0)",
254
- info: blue[400],
255
- infoForeground: "oklch(0.145 0 0)",
256
- infoMuted: blue[950],
257
- infoMutedForeground: blue[300]
258
- };
259
- var CHART_LIGHT = {
260
- chart1: "oklch(0.646 0.222 41.116)",
261
- chart2: "oklch(0.6 0.118 184.704)",
262
- chart3: "oklch(0.398 0.07 227.392)",
263
- chart4: "oklch(0.828 0.189 84.429)",
264
- chart5: "oklch(0.769 0.188 70.08)"
265
- };
266
- var CHART_DARK = {
267
- chart1: "oklch(0.488 0.243 264.376)",
268
- chart2: "oklch(0.696 0.17 162.48)",
269
- chart3: "oklch(0.769 0.188 70.08)",
270
- chart4: "oklch(0.627 0.265 303.9)",
271
- chart5: "oklch(0.645 0.246 16.439)"
272
- };
273
- var stone = {
274
- 50: "oklch(0.985 0.001 106.424)",
275
- 100: "oklch(0.97 0.001 106.424)",
276
- 200: "oklch(0.923 0.003 48.717)",
277
- 300: "oklch(0.869 0.005 56.366)",
278
- 400: "oklch(0.709 0.01 56.259)",
279
- 500: "oklch(0.553 0.013 58.071)",
280
- 600: "oklch(0.444 0.011 73.639)",
281
- 700: "oklch(0.374 0.01 67.558)",
282
- 800: "oklch(0.268 0.007 34.298)",
283
- 900: "oklch(0.216 0.006 56.043)",
284
- 950: "oklch(0.147 0.004 49.25)"
285
- };
286
- var neutral = {
287
- 50: "oklch(0.985 0 0)",
288
- 100: "oklch(0.97 0 0)",
289
- 200: "oklch(0.922 0 0)",
290
- 300: "oklch(0.87 0 0)",
291
- 400: "oklch(0.708 0 0)",
292
- 500: "oklch(0.556 0 0)",
293
- 600: "oklch(0.439 0 0)",
294
- 700: "oklch(0.371 0 0)",
295
- 800: "oklch(0.269 0 0)",
296
- 900: "oklch(0.205 0 0)",
297
- 950: "oklch(0.145 0 0)"
298
- };
299
- var violet = {
300
- 50: "oklch(0.969 0.016 293.756)",
301
- 300: "oklch(0.811 0.111 293.571)",
302
- 400: "oklch(0.702 0.183 293.541)",
303
- 500: "oklch(0.606 0.25 292.717)",
304
- 600: "oklch(0.541 0.281 293.009)",
305
- 700: "oklch(0.491 0.27 292.581)",
306
- 800: "oklch(0.432 0.232 292.759)",
307
- 950: "oklch(0.283 0.141 291.089)"
308
- };
309
- var rose = {
310
- 50: "oklch(0.969 0.015 12.422)",
311
- 300: "oklch(0.81 0.117 11.638)",
312
- 400: "oklch(0.712 0.194 13.428)",
313
- 500: "oklch(0.645 0.246 16.439)",
314
- 600: "oklch(0.586 0.253 17.585)",
315
- 700: "oklch(0.514 0.222 16.935)",
316
- 800: "oklch(0.455 0.188 13.697)",
317
- 950: "oklch(0.271 0.105 12.094)"
318
- };
319
- var orange = {
320
- 50: "oklch(0.98 0.016 73.684)",
321
- 300: "oklch(0.837 0.128 66.29)",
322
- 400: "oklch(0.75 0.183 55.934)",
323
- 500: "oklch(0.705 0.213 47.604)",
324
- 600: "oklch(0.646 0.222 41.116)",
325
- 700: "oklch(0.553 0.195 38.402)",
326
- 800: "oklch(0.47 0.157 37.304)",
327
- 950: "oklch(0.266 0.079 36.259)"
328
- };
329
- function buildNeutralPreset(name, key, palette) {
330
- return {
331
- name,
332
- key,
333
- chromatic: false,
334
- light: {
335
- background: "oklch(1 0 0)",
336
- foreground: palette[950],
337
- surface: palette[50],
338
- surfaceRaised: "oklch(1 0 0)",
339
- surfaceOverlay: palette[100],
340
- card: "oklch(1 0 0)",
341
- cardForeground: palette[950],
342
- popover: "oklch(1 0 0)",
343
- popoverForeground: palette[950],
344
- muted: palette[100],
345
- mutedForeground: palette[500],
346
- primary: palette[900],
347
- primaryForeground: palette[50],
348
- primaryHover: palette[800],
349
- primaryActive: palette[700],
350
- primaryMuted: palette[100],
351
- primaryMutedForeground: palette[900],
352
- secondary: palette[100],
353
- secondaryForeground: palette[900],
354
- secondaryHover: palette[200],
355
- secondaryActive: palette[300],
356
- accent: palette[100],
357
- accentForeground: palette[900],
358
- ...STATUS_LIGHT,
359
- ...CHART_LIGHT,
360
- border: palette[200],
361
- borderMuted: palette[100],
362
- borderStrong: palette[400],
363
- focusRing: palette[400],
364
- ring: palette[400],
365
- input: palette[200],
366
- inputForeground: palette[900],
367
- inputPlaceholder: palette[500],
368
- disabled: palette[100],
369
- disabledForeground: palette[500],
370
- sidebar: palette[50],
371
- sidebarForeground: palette[950],
372
- sidebarPrimary: palette[900],
373
- sidebarPrimaryForeground: palette[50],
374
- sidebarAccent: palette[100],
375
- sidebarAccentForeground: palette[900],
376
- sidebarBorder: palette[200],
377
- sidebarRing: palette[400]
378
- },
379
- dark: {
380
- background: palette[950],
381
- foreground: palette[50],
382
- surface: palette[900],
383
- surfaceRaised: palette[800],
384
- surfaceOverlay: palette[800],
385
- card: palette[900],
386
- cardForeground: palette[50],
387
- popover: palette[800],
388
- popoverForeground: palette[50],
389
- muted: palette[800],
390
- mutedForeground: palette[400],
391
- primary: palette[50],
392
- primaryForeground: palette[900],
393
- primaryHover: palette[200],
394
- primaryActive: palette[300],
395
- primaryMuted: palette[800],
396
- primaryMutedForeground: palette[50],
397
- secondary: palette[800],
398
- secondaryForeground: palette[50],
399
- secondaryHover: palette[700],
400
- secondaryActive: palette[600],
401
- accent: palette[700],
402
- accentForeground: palette[50],
403
- ...STATUS_DARK,
404
- ...CHART_DARK,
405
- border: `color-mix(in oklch, ${palette[50]} 10%, transparent)`,
406
- borderMuted: palette[800],
407
- borderStrong: palette[500],
408
- focusRing: palette[500],
409
- ring: palette[500],
410
- input: `color-mix(in oklch, ${palette[50]} 15%, transparent)`,
411
- inputForeground: palette[50],
412
- inputPlaceholder: palette[500],
413
- disabled: palette[800],
414
- disabledForeground: palette[600],
415
- sidebar: palette[900],
416
- sidebarForeground: palette[50],
417
- sidebarPrimary: blue[600],
418
- sidebarPrimaryForeground: palette[50],
419
- sidebarAccent: palette[800],
420
- sidebarAccentForeground: palette[50],
421
- sidebarBorder: `color-mix(in oklch, ${palette[50]} 10%, transparent)`,
422
- sidebarRing: palette[600]
423
- }
424
- };
425
- }
426
- function buildChromaticPreset(name, key, primary, surface = zinc) {
427
- return {
428
- name,
429
- key,
430
- chromatic: true,
431
- light: {
432
- background: "oklch(1 0 0)",
433
- foreground: surface[950],
434
- surface: surface[50],
435
- surfaceRaised: "oklch(1 0 0)",
436
- surfaceOverlay: surface[100],
437
- card: "oklch(1 0 0)",
438
- cardForeground: surface[950],
439
- popover: "oklch(1 0 0)",
440
- popoverForeground: surface[950],
441
- muted: surface[100],
442
- mutedForeground: surface[500],
443
- primary: primary[600],
444
- primaryForeground: "oklch(0.985 0 0)",
445
- primaryHover: primary[700],
446
- primaryActive: primary[800],
447
- primaryMuted: primary[50],
448
- primaryMutedForeground: primary[700],
449
- secondary: surface[100],
450
- secondaryForeground: surface[900],
451
- secondaryHover: surface[200],
452
- secondaryActive: surface[300],
453
- accent: primary[50],
454
- accentForeground: primary[700],
455
- ...STATUS_LIGHT,
456
- ...CHART_LIGHT,
457
- border: surface[200],
458
- borderMuted: surface[100],
459
- borderStrong: surface[400],
460
- focusRing: primary[500],
461
- ring: primary[500],
462
- input: surface[200],
463
- inputForeground: surface[900],
464
- inputPlaceholder: surface[500],
465
- disabled: surface[100],
466
- disabledForeground: surface[500],
467
- sidebar: surface[50],
468
- sidebarForeground: surface[950],
469
- sidebarPrimary: primary[600],
470
- sidebarPrimaryForeground: "oklch(0.985 0 0)",
471
- sidebarAccent: primary[50],
472
- sidebarAccentForeground: primary[700],
473
- sidebarBorder: surface[200],
474
- sidebarRing: primary[500]
475
- },
476
- dark: {
477
- background: surface[950],
478
- foreground: surface[50],
479
- surface: surface[900],
480
- surfaceRaised: surface[800],
481
- surfaceOverlay: surface[800],
482
- card: surface[900],
483
- cardForeground: surface[50],
484
- popover: surface[800],
485
- popoverForeground: surface[50],
486
- muted: surface[800],
487
- mutedForeground: surface[400],
488
- primary: primary[500],
489
- primaryForeground: "oklch(0.985 0 0)",
490
- primaryHover: primary[400],
491
- primaryActive: primary[300],
492
- primaryMuted: primary[950],
493
- primaryMutedForeground: primary[300],
494
- secondary: surface[800],
495
- secondaryForeground: surface[50],
496
- secondaryHover: surface[700],
497
- secondaryActive: surface[600],
498
- accent: primary[950],
499
- accentForeground: primary[300],
500
- ...STATUS_DARK,
501
- ...CHART_DARK,
502
- border: `color-mix(in oklch, ${surface[50]} 10%, transparent)`,
503
- borderMuted: surface[800],
504
- borderStrong: surface[500],
505
- focusRing: primary[500],
506
- ring: primary[500],
507
- input: `color-mix(in oklch, ${surface[50]} 15%, transparent)`,
508
- inputForeground: surface[50],
509
- inputPlaceholder: surface[500],
510
- disabled: surface[800],
511
- disabledForeground: surface[600],
512
- sidebar: surface[900],
513
- sidebarForeground: surface[50],
514
- sidebarPrimary: primary[500],
515
- sidebarPrimaryForeground: "oklch(0.985 0 0)",
516
- sidebarAccent: primary[950],
517
- sidebarAccentForeground: primary[300],
518
- sidebarBorder: `color-mix(in oklch, ${surface[50]} 10%, transparent)`,
519
- sidebarRing: primary[500]
520
- }
521
- };
522
- }
523
- var COLOR_PRESETS = [
524
- // -------------------------------------------------------------------------
525
- // Neutral Presets (achromatic primaries)
526
- // -------------------------------------------------------------------------
527
- {
528
- swatch: zinc[900],
529
- ...buildNeutralPreset("Zinc", "zinc", zinc)
530
- },
531
- {
532
- swatch: slate[900],
533
- ...buildNeutralPreset("Slate", "slate", slate)
534
- },
535
- {
536
- swatch: gray[900],
537
- ...buildNeutralPreset("Gray", "gray", gray)
538
- },
539
- {
540
- swatch: stone[900],
541
- ...buildNeutralPreset("Stone", "stone", stone)
542
- },
543
- {
544
- swatch: neutral[900],
545
- ...buildNeutralPreset("Neutral", "neutral", neutral)
546
- },
547
- // -------------------------------------------------------------------------
548
- // Chromatic Presets (colored primaries)
549
- // -------------------------------------------------------------------------
550
- {
551
- swatch: blue[600],
552
- ...buildChromaticPreset("Blue", "blue", blue)
553
- },
554
- {
555
- swatch: green[600],
556
- ...buildChromaticPreset("Green", "green", green)
557
- },
558
- {
559
- swatch: violet[600],
560
- ...buildChromaticPreset("Violet", "violet", violet)
561
- },
562
- {
563
- swatch: rose[600],
564
- ...buildChromaticPreset("Rose", "rose", rose)
565
- },
566
- {
567
- swatch: orange[600],
568
- ...buildChromaticPreset("Orange", "orange", orange)
569
- },
570
- {
571
- swatch: red[600],
572
- ...buildChromaticPreset("Red", "red", red)
573
- },
574
- {
575
- swatch: teal[600],
576
- ...buildChromaticPreset("Teal", "teal", teal)
577
- },
578
- {
579
- swatch: brand[600],
580
- ...buildChromaticPreset("Brand", "brand", brand)
581
- },
582
- {
583
- swatch: indigo[600],
584
- ...buildChromaticPreset("Indigo", "indigo", indigo)
585
- },
586
- {
587
- swatch: purple[600],
588
- ...buildChromaticPreset("Purple", "purple", purple)
589
- },
590
- {
591
- swatch: pink[600],
592
- ...buildChromaticPreset("Pink", "pink", pink)
593
- },
594
- {
595
- swatch: cyan[600],
596
- ...buildChromaticPreset("Cyan", "cyan", cyan)
597
- },
598
- {
599
- swatch: emerald[600],
600
- ...buildChromaticPreset("Emerald", "emerald", emerald)
601
- },
602
- {
603
- swatch: yellow[600],
604
- ...buildChromaticPreset("Yellow", "yellow", yellow)
605
- },
606
- {
607
- swatch: fuchsia[600],
608
- ...buildChromaticPreset("Fuchsia", "fuchsia", fuchsia)
609
- },
610
- {
611
- swatch: sky[600],
612
- ...buildChromaticPreset("Sky", "sky", sky)
613
- },
614
- {
615
- swatch: lime[600],
616
- ...buildChromaticPreset("Lime", "lime", lime)
617
- },
618
- {
619
- swatch: amber[600],
620
- ...buildChromaticPreset("Amber", "amber", amber)
621
- }
622
- ];
623
- function getColorPreset(key) {
624
- return COLOR_PRESETS.find((p) => p.key === key) ?? COLOR_PRESETS[0];
625
- }
626
- var COLOR_PRESET_KEYS = COLOR_PRESETS.map((p) => p.key);
627
- var RADIUS_PRESETS = [
628
- { name: "None", key: "0", value: "0px", label: "0px" },
629
- { name: "Subtle", key: "0.25", value: "0.25rem", label: "4px" },
630
- { name: "Small", key: "0.375", value: "0.375rem", label: "6px" },
631
- { name: "Medium", key: "0.5", value: "0.5rem", label: "8px" },
632
- { name: "Default", key: "0.625", value: "0.625rem", label: "10px" },
633
- { name: "Large", key: "0.75", value: "0.75rem", label: "12px" },
634
- { name: "XL", key: "1", value: "1rem", label: "16px" }
635
- ];
636
- var DEFAULT_RADIUS_KEY = "0.625";
637
- function getRadiusPreset(key) {
638
- return RADIUS_PRESETS.find((r) => r.key === key) ?? RADIUS_PRESETS[4];
639
- }
640
- var FONT_PRESETS = [
641
- // ---- Built-in fonts (loaded via next/font in the docs app) ----
642
- {
643
- name: "Outfit",
644
- key: "outfit",
645
- value: 'var(--font-outfit), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
646
- sample: "Aa"
647
- },
648
- {
649
- name: "Inter",
650
- key: "inter",
651
- value: 'var(--font-inter), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
652
- sample: "Aa"
653
- },
654
- {
655
- name: "Geist Sans",
656
- key: "geist-sans",
657
- value: 'var(--font-geist-sans), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
658
- sample: "Aa"
659
- },
660
- {
661
- name: "DM Sans",
662
- key: "dm-sans",
663
- value: 'var(--font-dm-sans), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
664
- sample: "Aa"
665
- },
666
- {
667
- name: "Plus Jakarta Sans",
668
- key: "plus-jakarta-sans",
669
- value: 'var(--font-plus-jakarta-sans), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
670
- sample: "Aa"
671
- },
672
- {
673
- name: "Open Sans",
674
- key: "open-sans",
675
- value: 'var(--font-open-sans), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
676
- sample: "Aa"
677
- },
678
- {
679
- name: "Poppins",
680
- key: "poppins",
681
- value: 'var(--font-poppins), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
682
- sample: "Aa"
683
- },
684
- {
685
- name: "Montserrat",
686
- key: "montserrat",
687
- value: 'var(--font-montserrat), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
688
- sample: "Aa"
689
- },
690
- {
691
- name: "Lato",
692
- key: "lato",
693
- value: 'var(--font-lato), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
694
- sample: "Aa"
695
- },
696
- {
697
- name: "Nunito",
698
- key: "nunito",
699
- value: 'var(--font-nunito), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
700
- sample: "Aa"
701
- },
702
- {
703
- name: "Raleway",
704
- key: "raleway",
705
- value: 'var(--font-raleway), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
706
- sample: "Aa"
707
- },
708
- {
709
- name: "Rubik",
710
- key: "rubik",
711
- value: 'var(--font-rubik), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
712
- sample: "Aa"
713
- },
714
- {
715
- name: "Source Sans 3",
716
- key: "source-sans-3",
717
- value: 'var(--font-source-sans-3), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
718
- sample: "Aa"
719
- },
720
- {
721
- name: "Work Sans",
722
- key: "work-sans",
723
- value: 'var(--font-work-sans), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
724
- sample: "Aa"
725
- },
726
- {
727
- name: "Manrope",
728
- key: "manrope",
729
- value: 'var(--font-manrope), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
730
- sample: "Aa"
731
- },
732
- {
733
- name: "Space Grotesk",
734
- key: "space-grotesk",
735
- value: 'var(--font-space-grotesk), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
736
- sample: "Aa"
737
- },
738
- // ---- Additional popular fonts ----
739
- {
740
- name: "Figtree",
741
- key: "figtree",
742
- value: 'var(--font-figtree), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
743
- sample: "Aa"
744
- },
745
- {
746
- name: "IBM Plex Sans",
747
- key: "ibm-plex-sans",
748
- value: 'var(--font-ibm-plex-sans), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
749
- sample: "Aa"
750
- },
751
- {
752
- name: "Quicksand",
753
- key: "quicksand",
754
- value: 'var(--font-quicksand), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
755
- sample: "Aa"
756
- },
757
- {
758
- name: "Cabin",
759
- key: "cabin",
760
- value: 'var(--font-cabin), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
761
- sample: "Aa"
762
- },
763
- {
764
- name: "Barlow",
765
- key: "barlow",
766
- value: 'var(--font-barlow), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
767
- sample: "Aa"
768
- },
769
- {
770
- name: "Josefin Sans",
771
- key: "josefin-sans",
772
- value: 'var(--font-josefin-sans), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
773
- sample: "Aa"
774
- },
775
- {
776
- name: "Karla",
777
- key: "karla",
778
- value: 'var(--font-karla), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
779
- sample: "Aa"
780
- },
781
- {
782
- name: "Mulish",
783
- key: "mulish",
784
- value: 'var(--font-mulish), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
785
- sample: "Aa"
786
- },
787
- {
788
- name: "Noto Sans",
789
- key: "noto-sans",
790
- value: 'var(--font-noto-sans), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
791
- sample: "Aa"
792
- },
793
- {
794
- name: "Ubuntu",
795
- key: "ubuntu",
796
- value: 'var(--font-ubuntu), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
797
- sample: "Aa"
798
- },
799
- {
800
- name: "Sora",
801
- key: "sora",
802
- value: 'var(--font-sora), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
803
- sample: "Aa"
804
- },
805
- {
806
- name: "Lexend",
807
- key: "lexend",
808
- value: 'var(--font-lexend), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
809
- sample: "Aa"
810
- },
811
- // ---- Generic stacks ----
812
- {
813
- name: "System",
814
- key: "system",
815
- value: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
816
- sample: "Aa"
817
- },
818
- {
819
- name: "Serif",
820
- key: "serif",
821
- value: 'var(--font-lora), Georgia, "Times New Roman", serif',
822
- sample: "Aa"
823
- },
824
- {
825
- name: "Mono",
826
- key: "mono",
827
- value: 'var(--font-jetbrains), "Fira Code", "SF Mono", Consolas, "Liberation Mono", Menlo, monospace',
828
- sample: "Aa"
829
- }
830
- ];
831
- var DEFAULT_FONT_KEY = "outfit";
832
- function getFontPreset(key) {
833
- return FONT_PRESETS.find((f) => f.key === key) ?? FONT_PRESETS[0];
834
- }
835
- var SHADOW_PRESETS = [
836
- {
837
- name: "None",
838
- key: "none",
839
- description: "No shadows \u2014 flat design",
840
- light: {
841
- none: "none",
842
- xs: "none",
843
- sm: "none",
844
- md: "none",
845
- lg: "none",
846
- xl: "none",
847
- "2xl": "none"
848
- },
849
- dark: {
850
- none: "none",
851
- xs: "none",
852
- sm: "none",
853
- md: "none",
854
- lg: "none",
855
- xl: "none",
856
- "2xl": "none"
857
- }
858
- },
859
- {
860
- name: "Subtle",
861
- key: "subtle",
862
- description: "Soft, minimal shadows",
863
- light: {
864
- none: "none",
865
- xs: "0 1px 1px 0 oklch(0 0 0 / 0.03)",
866
- sm: "0 1px 2px 0 oklch(0 0 0 / 0.05), 0 1px 1px -1px oklch(0 0 0 / 0.05)",
867
- md: "0 2px 4px -1px oklch(0 0 0 / 0.06), 0 1px 2px -1px oklch(0 0 0 / 0.04)",
868
- lg: "0 6px 10px -2px oklch(0 0 0 / 0.06), 0 2px 4px -2px oklch(0 0 0 / 0.04)",
869
- xl: "0 12px 16px -4px oklch(0 0 0 / 0.06), 0 4px 6px -3px oklch(0 0 0 / 0.04)",
870
- "2xl": "0 16px 32px -8px oklch(0 0 0 / 0.12)"
871
- },
872
- dark: {
873
- none: "none",
874
- xs: "0 1px 1px 0 oklch(0 0 0 / 0.1)",
875
- sm: "0 1px 2px 0 oklch(0 0 0 / 0.15), 0 1px 1px -1px oklch(0 0 0 / 0.15)",
876
- md: "0 2px 4px -1px oklch(0 0 0 / 0.2), 0 1px 2px -1px oklch(0 0 0 / 0.15)",
877
- lg: "0 6px 10px -2px oklch(0 0 0 / 0.2), 0 2px 4px -2px oklch(0 0 0 / 0.15)",
878
- xl: "0 12px 16px -4px oklch(0 0 0 / 0.25), 0 4px 6px -3px oklch(0 0 0 / 0.2)",
879
- "2xl": "0 16px 32px -8px oklch(0 0 0 / 0.3)"
880
- }
881
- },
882
- {
883
- name: "Default",
884
- key: "default",
885
- description: "Standard shadow depth",
886
- light: {
887
- none: "none",
888
- xs: "0 1px 2px 0 oklch(0 0 0 / 0.05)",
889
- sm: "0 1px 3px 0 oklch(0 0 0 / 0.1), 0 1px 2px -1px oklch(0 0 0 / 0.1)",
890
- md: "0 4px 6px -1px oklch(0 0 0 / 0.1), 0 2px 4px -2px oklch(0 0 0 / 0.1)",
891
- lg: "0 10px 15px -3px oklch(0 0 0 / 0.1), 0 4px 6px -4px oklch(0 0 0 / 0.1)",
892
- xl: "0 20px 25px -5px oklch(0 0 0 / 0.1), 0 8px 10px -6px oklch(0 0 0 / 0.1)",
893
- "2xl": "0 25px 50px -12px oklch(0 0 0 / 0.25)"
894
- },
895
- dark: {
896
- none: "none",
897
- xs: "0 1px 2px 0 oklch(0 0 0 / 0.2)",
898
- sm: "0 1px 3px 0 oklch(0 0 0 / 0.3), 0 1px 2px -1px oklch(0 0 0 / 0.3)",
899
- md: "0 4px 6px -1px oklch(0 0 0 / 0.35), 0 2px 4px -2px oklch(0 0 0 / 0.3)",
900
- lg: "0 10px 15px -3px oklch(0 0 0 / 0.35), 0 4px 6px -4px oklch(0 0 0 / 0.3)",
901
- xl: "0 20px 25px -5px oklch(0 0 0 / 0.4), 0 8px 10px -6px oklch(0 0 0 / 0.35)",
902
- "2xl": "0 25px 50px -12px oklch(0 0 0 / 0.5)"
903
- }
904
- },
905
- {
906
- name: "Heavy",
907
- key: "heavy",
908
- description: "Bold, pronounced shadows",
909
- light: {
910
- none: "none",
911
- xs: "0 1px 3px 0 oklch(0 0 0 / 0.08)",
912
- sm: "0 2px 4px 0 oklch(0 0 0 / 0.14), 0 1px 3px -1px oklch(0 0 0 / 0.12)",
913
- md: "0 6px 10px -1px oklch(0 0 0 / 0.14), 0 3px 6px -2px oklch(0 0 0 / 0.12)",
914
- lg: "0 14px 20px -4px oklch(0 0 0 / 0.14), 0 6px 8px -4px oklch(0 0 0 / 0.12)",
915
- xl: "0 24px 32px -6px oklch(0 0 0 / 0.14), 0 10px 14px -6px oklch(0 0 0 / 0.12)",
916
- "2xl": "0 32px 60px -16px oklch(0 0 0 / 0.35)"
917
- },
918
- dark: {
919
- none: "none",
920
- xs: "0 1px 3px 0 oklch(0 0 0 / 0.3)",
921
- sm: "0 2px 4px 0 oklch(0 0 0 / 0.4), 0 1px 3px -1px oklch(0 0 0 / 0.4)",
922
- md: "0 6px 10px -1px oklch(0 0 0 / 0.45), 0 3px 6px -2px oklch(0 0 0 / 0.4)",
923
- lg: "0 14px 20px -4px oklch(0 0 0 / 0.45), 0 6px 8px -4px oklch(0 0 0 / 0.4)",
924
- xl: "0 24px 32px -6px oklch(0 0 0 / 0.5), 0 10px 14px -6px oklch(0 0 0 / 0.45)",
925
- "2xl": "0 32px 60px -16px oklch(0 0 0 / 0.6)"
926
- }
927
- }
928
- ];
929
- var DEFAULT_SHADOW_KEY = "default";
930
- function getShadowPreset(key) {
931
- return SHADOW_PRESETS.find((s) => s.key === key) ?? SHADOW_PRESETS[2];
932
- }
933
- var SURFACE_STYLE_PRESETS = [
934
- {
935
- name: "Bordered",
936
- key: "bordered",
937
- description: "Cards and surfaces use borders for separation"
938
- },
939
- {
940
- name: "Elevated",
941
- key: "elevated",
942
- description: "Cards and surfaces use shadows for depth"
943
- },
944
- {
945
- name: "Mixed",
946
- key: "mixed",
947
- description: "Combines borders with subtle shadows"
948
- }
949
- ];
950
- var DEFAULT_SURFACE_STYLE_KEY = "bordered";
951
- var MENU_COLOR_PRESETS = [
952
- {
953
- name: "Default",
954
- key: "default",
955
- description: "Uses the color preset's built-in sidebar colors"
956
- },
957
- {
958
- name: "Muted",
959
- key: "muted",
960
- description: "Sidebar matches the muted/surface tone \u2014 blends with content"
961
- },
962
- {
963
- name: "Inverted",
964
- key: "inverted",
965
- description: "Dark sidebar in light mode, lighter sidebar in dark mode for contrast"
966
- },
967
- {
968
- name: "Primary",
969
- key: "primary",
970
- description: "Sidebar uses the primary color as its background"
971
- }
972
- ];
973
- var DEFAULT_MENU_COLOR_KEY = "default";
974
- function getMenuColorPreset(key) {
975
- return MENU_COLOR_PRESETS.find((p) => p.key === key) ?? MENU_COLOR_PRESETS[0];
976
- }
977
- var MENU_ACCENT_PRESETS = [
978
- {
979
- name: "None",
980
- key: "none",
981
- description: "No visual accent highlight on sidebar items"
982
- },
983
- {
984
- name: "Subtle",
985
- key: "subtle",
986
- description: "Soft background tint on hover and active sidebar items"
987
- },
988
- {
989
- name: "Bold",
990
- key: "bold",
991
- description: "Prominent primary-colored accent on active sidebar items"
992
- }
993
- ];
994
- var DEFAULT_MENU_ACCENT_KEY = "subtle";
995
- function getMenuAccentPreset(key) {
996
- return MENU_ACCENT_PRESETS.find((p) => p.key === key) ?? MENU_ACCENT_PRESETS[1];
997
- }
998
- var STYLE_PRESETS = [
999
- {
1000
- name: "Vega",
1001
- key: "vega",
1002
- description: "The classic shadcn/ui look. Clean, neutral, and familiar.",
1003
- iconPath: "M3 3h18v18H3V3zm2 2v14h14V5H7z",
1004
- defaults: {
1005
- radius: "0.625",
1006
- font: "outfit",
1007
- shadow: "default",
1008
- surfaceStyle: "bordered"
1009
- },
1010
- vars: {
1011
- spacingUnit: "1",
1012
- paddingCard: "1.5rem",
1013
- paddingButtonX: "1rem",
1014
- paddingButtonY: "0.5rem",
1015
- gapDefault: "0.75rem",
1016
- borderWidth: "1px",
1017
- controlHeight: "2.25rem"
1018
- }
1019
- },
1020
- {
1021
- name: "Nova",
1022
- key: "nova",
1023
- description: "Reduced padding and margins for compact layouts.",
1024
- iconPath: "M4 4h16v16H4V4zm1.5 1.5v13h13v-13h-13z",
1025
- defaults: {
1026
- radius: "0.5",
1027
- font: "inter",
1028
- shadow: "subtle",
1029
- surfaceStyle: "bordered"
1030
- },
1031
- vars: {
1032
- spacingUnit: "0.875",
1033
- paddingCard: "1rem",
1034
- paddingButtonX: "0.75rem",
1035
- paddingButtonY: "0.375rem",
1036
- gapDefault: "0.5rem",
1037
- borderWidth: "1px",
1038
- controlHeight: "2rem"
1039
- }
1040
- },
1041
- {
1042
- name: "Maia",
1043
- key: "maia",
1044
- description: "Soft and rounded, with generous spacing.",
1045
- iconPath: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z",
1046
- defaults: {
1047
- radius: "0.75",
1048
- font: "outfit",
1049
- shadow: "default",
1050
- surfaceStyle: "mixed"
1051
- },
1052
- vars: {
1053
- spacingUnit: "1.125",
1054
- paddingCard: "1.75rem",
1055
- paddingButtonX: "1.25rem",
1056
- paddingButtonY: "0.625rem",
1057
- gapDefault: "1rem",
1058
- borderWidth: "1px",
1059
- controlHeight: "2.5rem"
1060
- }
1061
- },
1062
- {
1063
- name: "Lyra",
1064
- key: "lyra",
1065
- description: "Boxy and sharp. Pairs well with mono fonts.",
1066
- iconPath: "M3 3h18v18H3V3zm1 1v16h16V4H4z",
1067
- defaults: {
1068
- radius: "0",
1069
- font: "system",
1070
- shadow: "none",
1071
- surfaceStyle: "bordered"
1072
- },
1073
- vars: {
1074
- spacingUnit: "1",
1075
- paddingCard: "1.25rem",
1076
- paddingButtonX: "1rem",
1077
- paddingButtonY: "0.5rem",
1078
- gapDefault: "0.75rem",
1079
- borderWidth: "1px",
1080
- controlHeight: "2.25rem"
1081
- }
1082
- },
1083
- {
1084
- name: "Mira",
1085
- key: "mira",
1086
- description: "Compact. Made for dense interfaces.",
1087
- iconPath: "M5 3h14a2 2 0 012 2v14a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2zm0 2v14h14V5H5zm2 2h10v2H7V7zm0 4h10v2H7v-2zm0 4h7v2H7v-2z",
1088
- defaults: {
1089
- radius: "0.375",
1090
- font: "inter",
1091
- shadow: "none",
1092
- surfaceStyle: "bordered"
1093
- },
1094
- vars: {
1095
- spacingUnit: "0.75",
1096
- paddingCard: "0.75rem",
1097
- paddingButtonX: "0.625rem",
1098
- paddingButtonY: "0.25rem",
1099
- gapDefault: "0.375rem",
1100
- borderWidth: "1px",
1101
- controlHeight: "1.75rem"
1102
- }
1103
- }
1104
- ];
1105
- var DEFAULT_STYLE_KEY = "vega";
1106
- function getStylePreset(key) {
1107
- return STYLE_PRESETS.find((s) => s.key === key) ?? STYLE_PRESETS[0];
1108
- }
1109
- var DEFAULT_THEME_CONFIG = {
1110
- style: DEFAULT_STYLE_KEY,
1111
- colorPreset: "zinc",
1112
- radius: DEFAULT_RADIUS_KEY,
1113
- font: DEFAULT_FONT_KEY,
1114
- shadow: DEFAULT_SHADOW_KEY,
1115
- surfaceStyle: DEFAULT_SURFACE_STYLE_KEY,
1116
- menuColor: DEFAULT_MENU_COLOR_KEY,
1117
- menuAccent: DEFAULT_MENU_ACCENT_KEY
1118
- };
1119
- function buildThemeOverrides(config, mode) {
1120
- const vars = {};
1121
- const colorPreset = getColorPreset(config.colorPreset);
1122
- const colors = mode === "dark" ? colorPreset.dark : colorPreset.light;
1123
- const colorMapping = {
1124
- background: "--background",
1125
- foreground: "--foreground",
1126
- surface: "--surface",
1127
- surfaceRaised: "--surface-raised",
1128
- surfaceOverlay: "--surface-overlay",
1129
- card: "--card",
1130
- cardForeground: "--card-foreground",
1131
- popover: "--popover",
1132
- popoverForeground: "--popover-foreground",
1133
- muted: "--muted",
1134
- mutedForeground: "--muted-foreground",
1135
- primary: "--primary",
1136
- primaryForeground: "--primary-foreground",
1137
- primaryHover: "--primary-hover",
1138
- primaryActive: "--primary-active",
1139
- primaryMuted: "--primary-muted",
1140
- primaryMutedForeground: "--primary-muted-foreground",
1141
- secondary: "--secondary",
1142
- secondaryForeground: "--secondary-foreground",
1143
- secondaryHover: "--secondary-hover",
1144
- secondaryActive: "--secondary-active",
1145
- accent: "--accent",
1146
- accentForeground: "--accent-foreground",
1147
- success: "--success",
1148
- successForeground: "--success-foreground",
1149
- successMuted: "--success-muted",
1150
- successMutedForeground: "--success-muted-foreground",
1151
- warning: "--warning",
1152
- warningForeground: "--warning-foreground",
1153
- warningMuted: "--warning-muted",
1154
- warningMutedForeground: "--warning-muted-foreground",
1155
- danger: "--danger",
1156
- dangerForeground: "--danger-foreground",
1157
- dangerHover: "--danger-hover",
1158
- dangerActive: "--danger-active",
1159
- dangerMuted: "--danger-muted",
1160
- dangerMutedForeground: "--danger-muted-foreground",
1161
- destructive: "--destructive",
1162
- destructiveForeground: "--destructive-foreground",
1163
- info: "--info",
1164
- infoForeground: "--info-foreground",
1165
- infoMuted: "--info-muted",
1166
- infoMutedForeground: "--info-muted-foreground",
1167
- border: "--border",
1168
- borderMuted: "--border-muted",
1169
- borderStrong: "--border-strong",
1170
- focusRing: "--focus-ring",
1171
- ring: "--ring",
1172
- input: "--input",
1173
- inputForeground: "--input-foreground",
1174
- inputPlaceholder: "--input-placeholder",
1175
- disabled: "--disabled",
1176
- disabledForeground: "--disabled-foreground",
1177
- chart1: "--chart-1",
1178
- chart2: "--chart-2",
1179
- chart3: "--chart-3",
1180
- chart4: "--chart-4",
1181
- chart5: "--chart-5",
1182
- sidebar: "--sidebar",
1183
- sidebarForeground: "--sidebar-foreground",
1184
- sidebarPrimary: "--sidebar-primary",
1185
- sidebarPrimaryForeground: "--sidebar-primary-foreground",
1186
- sidebarAccent: "--sidebar-accent",
1187
- sidebarAccentForeground: "--sidebar-accent-foreground",
1188
- sidebarBorder: "--sidebar-border",
1189
- sidebarRing: "--sidebar-ring"
1190
- };
1191
- for (const [tokenKey, cssVar2] of Object.entries(colorMapping)) {
1192
- const value = colors[tokenKey];
1193
- if (value) {
1194
- vars[cssVar2] = value;
1195
- }
1196
- }
1197
- const radiusPreset = getRadiusPreset(config.radius);
1198
- const baseRem = Number.parseFloat(radiusPreset.value);
1199
- const isZero = radiusPreset.key === "0";
1200
- vars["--radius"] = radiusPreset.value;
1201
- vars["--radius-none"] = "0px";
1202
- vars["--radius-sm"] = isZero ? "0px" : `${Math.max(baseRem * 0.4, 0.125)}rem`;
1203
- vars["--radius-md"] = isZero ? "0px" : `${Math.max(baseRem * 0.6, 0.25)}rem`;
1204
- vars["--radius-lg"] = isZero ? "0px" : `${Math.max(baseRem * 0.8, 0.375)}rem`;
1205
- vars["--radius-xl"] = isZero ? "0px" : `${Math.max(baseRem * 1.2, 0.5)}rem`;
1206
- vars["--radius-full"] = "9999px";
1207
- const fontPreset = getFontPreset(config.font);
1208
- vars["--font-sans"] = fontPreset.value;
1209
- const shadowPreset = getShadowPreset(config.shadow);
1210
- const shadows = mode === "dark" ? shadowPreset.dark : shadowPreset.light;
1211
- vars["--shadow-none"] = shadows.none;
1212
- vars["--shadow-xs"] = shadows.xs;
1213
- vars["--shadow-sm"] = shadows.sm;
1214
- vars["--shadow-md"] = shadows.md;
1215
- vars["--shadow-lg"] = shadows.lg;
1216
- vars["--shadow-xl"] = shadows.xl;
1217
- vars["--shadow-2xl"] = shadows["2xl"];
1218
- const stylePreset = getStylePreset(config.style);
1219
- const sv = stylePreset.vars;
1220
- vars["--ds-spacing-unit"] = sv.spacingUnit;
1221
- vars["--ds-padding-card"] = sv.paddingCard;
1222
- vars["--ds-padding-button-x"] = sv.paddingButtonX;
1223
- vars["--ds-padding-button-y"] = sv.paddingButtonY;
1224
- vars["--ds-gap-default"] = sv.gapDefault;
1225
- vars["--ds-border-width"] = sv.borderWidth;
1226
- vars["--ds-control-height"] = sv.controlHeight;
1227
- const colorPresetObj = getColorPreset(config.colorPreset);
1228
- const presetColors = mode === "dark" ? colorPresetObj.dark : colorPresetObj.light;
1229
- if (config.menuColor === "muted") {
1230
- if (mode === "light") {
1231
- vars["--sidebar"] = presetColors.muted;
1232
- vars["--sidebar-foreground"] = presetColors.foreground;
1233
- vars["--sidebar-border"] = presetColors.border;
1234
- } else {
1235
- vars["--sidebar"] = presetColors.muted;
1236
- vars["--sidebar-foreground"] = presetColors.foreground;
1237
- vars["--sidebar-border"] = presetColors.border;
1238
- }
1239
- } else if (config.menuColor === "inverted") {
1240
- if (mode === "light") {
1241
- vars["--sidebar"] = "oklch(0.205 0 0)";
1242
- vars["--sidebar-foreground"] = "oklch(0.95 0 0)";
1243
- vars["--sidebar-primary"] = presetColors.primary;
1244
- vars["--sidebar-primary-foreground"] = "oklch(0.985 0 0)";
1245
- vars["--sidebar-border"] = "oklch(1 0 0 / 10%)";
1246
- vars["--sidebar-ring"] = "oklch(0.439 0 0)";
1247
- } else {
1248
- vars["--sidebar"] = "oklch(0.269 0 0)";
1249
- vars["--sidebar-foreground"] = "oklch(0.95 0 0)";
1250
- vars["--sidebar-primary"] = presetColors.primary;
1251
- vars["--sidebar-primary-foreground"] = "oklch(0.985 0 0)";
1252
- vars["--sidebar-border"] = "oklch(1 0 0 / 8%)";
1253
- vars["--sidebar-ring"] = "oklch(0.5 0 0)";
1254
- }
1255
- } else if (config.menuColor === "primary") {
1256
- if (mode === "light") {
1257
- vars["--sidebar"] = presetColors.primary;
1258
- vars["--sidebar-foreground"] = presetColors.primaryForeground;
1259
- vars["--sidebar-primary"] = presetColors.primaryForeground;
1260
- vars["--sidebar-primary-foreground"] = presetColors.primary;
1261
- vars["--sidebar-border"] = `color-mix(in oklch, ${presetColors.primaryForeground} 15%, transparent)`;
1262
- vars["--sidebar-ring"] = presetColors.primaryForeground;
1263
- } else {
1264
- vars["--sidebar"] = presetColors.primary;
1265
- vars["--sidebar-foreground"] = presetColors.primaryForeground;
1266
- vars["--sidebar-primary"] = presetColors.primaryForeground;
1267
- vars["--sidebar-primary-foreground"] = presetColors.primary;
1268
- vars["--sidebar-border"] = `color-mix(in oklch, ${presetColors.primaryForeground} 15%, transparent)`;
1269
- vars["--sidebar-ring"] = presetColors.primaryForeground;
1270
- }
1271
- }
1272
- if (config.menuAccent === "none") {
1273
- vars["--sidebar-accent"] = "transparent";
1274
- vars["--sidebar-accent-foreground"] = vars["--sidebar-foreground"] ?? presetColors.sidebarForeground;
1275
- } else if (config.menuAccent === "bold") {
1276
- if (config.menuColor === "primary") {
1277
- if (mode === "light") {
1278
- vars["--sidebar-accent"] = `color-mix(in oklch, ${presetColors.primaryForeground} 20%, transparent)`;
1279
- vars["--sidebar-accent-foreground"] = presetColors.primaryForeground;
1280
- } else {
1281
- vars["--sidebar-accent"] = `color-mix(in oklch, ${presetColors.primaryForeground} 20%, transparent)`;
1282
- vars["--sidebar-accent-foreground"] = presetColors.primaryForeground;
1283
- }
1284
- } else if (config.menuColor === "inverted") {
1285
- vars["--sidebar-accent"] = presetColors.primary;
1286
- vars["--sidebar-accent-foreground"] = presetColors.primaryForeground;
1287
- } else {
1288
- if (mode === "light") {
1289
- vars["--sidebar-accent"] = presetColors.primaryMuted;
1290
- vars["--sidebar-accent-foreground"] = presetColors.primary;
1291
- } else {
1292
- vars["--sidebar-accent"] = presetColors.primaryMuted;
1293
- vars["--sidebar-accent-foreground"] = presetColors.primaryMutedForeground;
1294
- }
1295
- }
1296
- }
1297
- if (config.surfaceStyle === "elevated") {
1298
- vars["--card"] = mode === "dark" ? "oklch(0.205 0 0)" : "oklch(1 0 0)";
1299
- vars["--border"] = mode === "dark" ? "oklch(0.205 0 0 / 0)" : "oklch(0.922 0 0 / 0)";
1300
- vars["--border-muted"] = mode === "dark" ? "oklch(0.205 0 0 / 0)" : "oklch(0.922 0 0 / 0)";
1301
- } else if (config.surfaceStyle === "mixed") {
1302
- vars["--border"] = mode === "dark" ? "oklch(0.4 0 0 / 0.15)" : "oklch(0.8 0 0 / 0.3)";
1303
- vars["--border-muted"] = mode === "dark" ? "oklch(0.4 0 0 / 0.1)" : "oklch(0.85 0 0 / 0.25)";
1304
- }
1305
- return vars;
1306
- }
1307
- function generateThemeCSS(config) {
1308
- const lightVars = buildThemeOverrides(config, "light");
1309
- const darkVars = buildThemeOverrides(config, "dark");
1310
- const formatVars = (vars) => Object.entries(vars).map(([prop, value]) => ` ${prop}: ${value};`).join("\n");
1311
- return [
1312
- "/* ============================================",
1313
- " * Unified UI \u2014 Custom Theme",
1314
- ` * Preset: ${getColorPreset(config.colorPreset).name}`,
1315
- ` * Style: ${getStylePreset(config.style).name}`,
1316
- ` * Radius: ${getRadiusPreset(config.radius).label}`,
1317
- ` * Font: ${getFontPreset(config.font).name}`,
1318
- ` * Shadows: ${getShadowPreset(config.shadow).name}`,
1319
- ` * Menu Color: ${getMenuColorPreset(config.menuColor).name}`,
1320
- ` * Menu Accent: ${getMenuAccentPreset(config.menuAccent).name}`,
1321
- " * ============================================ */",
1322
- "",
1323
- ":root {",
1324
- formatVars(lightVars),
1325
- "}",
1326
- "",
1327
- ".dark {",
1328
- formatVars(darkVars),
1329
- "}"
1330
- ].filter(Boolean).join("\n");
1331
- }
1332
- var STORAGE_KEY = "ds-theme-customizer";
1333
- var STYLE_ELEMENT_ID = "ds-theme-customizer";
1334
- var ThemeCustomizerContext = createContext(null);
1335
- function useThemeCustomizer() {
1336
- const ctx = useContext(ThemeCustomizerContext);
1337
- if (!ctx) {
1338
- throw new Error(
1339
- "useThemeCustomizer must be used within a <ThemeCustomizerProvider>. Wrap your application (or layout) with <ThemeCustomizerProvider>."
1340
- );
1341
- }
1342
- return ctx;
1343
- }
1344
- function loadConfig() {
1345
- if (typeof window === "undefined") return DEFAULT_THEME_CONFIG;
1346
- try {
1347
- const raw = localStorage.getItem(STORAGE_KEY);
1348
- if (!raw) return DEFAULT_THEME_CONFIG;
1349
- const parsed = JSON.parse(raw);
1350
- return {
1351
- style: STYLE_PRESETS.some((s) => s.key === parsed.style) ? parsed.style : DEFAULT_THEME_CONFIG.style,
1352
- colorPreset: COLOR_PRESET_KEYS.includes(parsed.colorPreset ?? "") ? parsed.colorPreset : DEFAULT_THEME_CONFIG.colorPreset,
1353
- radius: RADIUS_PRESETS.some((r) => r.key === parsed.radius) ? parsed.radius : DEFAULT_THEME_CONFIG.radius,
1354
- font: FONT_PRESETS.some((f) => f.key === parsed.font) ? parsed.font : DEFAULT_THEME_CONFIG.font,
1355
- shadow: SHADOW_PRESETS.some((s) => s.key === parsed.shadow) ? parsed.shadow : DEFAULT_THEME_CONFIG.shadow,
1356
- surfaceStyle: SURFACE_STYLE_PRESETS.some(
1357
- (s) => s.key === parsed.surfaceStyle
1358
- ) ? parsed.surfaceStyle : DEFAULT_THEME_CONFIG.surfaceStyle,
1359
- menuColor: MENU_COLOR_PRESETS.some((p) => p.key === parsed.menuColor) ? parsed.menuColor : DEFAULT_THEME_CONFIG.menuColor,
1360
- menuAccent: MENU_ACCENT_PRESETS.some((p) => p.key === parsed.menuAccent) ? parsed.menuAccent : DEFAULT_THEME_CONFIG.menuAccent
1361
- };
1362
- } catch {
1363
- return DEFAULT_THEME_CONFIG;
1364
- }
1365
- }
1366
- function saveConfig(config) {
1367
- if (typeof window === "undefined") return;
1368
- try {
1369
- localStorage.setItem(STORAGE_KEY, JSON.stringify(config));
1370
- } catch {
1371
- }
1372
- }
1373
- function getResolvedMode() {
1374
- if (typeof document === "undefined") return "light";
1375
- return document.documentElement.classList.contains("dark") ? "dark" : "light";
1376
- }
1377
- function injectStyles(config) {
1378
- if (typeof document === "undefined") return;
1379
- let styleEl = document.getElementById(
1380
- STYLE_ELEMENT_ID
1381
- );
1382
- if (!styleEl) {
1383
- styleEl = document.createElement("style");
1384
- styleEl.id = STYLE_ELEMENT_ID;
1385
- styleEl.setAttribute("data-ds-customizer", "");
1386
- document.head.appendChild(styleEl);
1387
- }
1388
- const lightVars = buildThemeOverrides(config, "light");
1389
- const darkVars = buildThemeOverrides(config, "dark");
1390
- const formatVars = (vars) => Object.entries(vars).map(([prop, value]) => `${prop}:${value}`).join(";");
1391
- styleEl.textContent = [
1392
- `:root:root{${formatVars(lightVars)}}`,
1393
- `.dark:root{${formatVars(darkVars)}}`
1394
- ].join("\n");
1395
- }
1396
- function removeStyles() {
1397
- if (typeof document === "undefined") return;
1398
- const styleEl = document.getElementById(STYLE_ELEMENT_ID);
1399
- if (styleEl) {
1400
- styleEl.remove();
1401
- }
1402
- }
1403
- function configsEqual(a, b) {
1404
- return a.style === b.style && a.colorPreset === b.colorPreset && a.radius === b.radius && a.font === b.font && a.shadow === b.shadow && a.surfaceStyle === b.surfaceStyle && a.menuColor === b.menuColor && a.menuAccent === b.menuAccent;
1405
- }
1406
- function ThemeCustomizerProvider({
1407
- children,
1408
- defaultConfig,
1409
- applyStyles = true
1410
- }) {
1411
- const [config, setConfigState] = useState(
1412
- () => defaultConfig ?? loadConfig()
1413
- );
1414
- const [_resolvedMode, setResolvedMode] = useState("light");
1415
- const configRef = useRef(config);
1416
- configRef.current = config;
1417
- useEffect(() => {
1418
- setResolvedMode(getResolvedMode());
1419
- const observer = new MutationObserver(() => {
1420
- const newMode = getResolvedMode();
1421
- setResolvedMode((prev) => {
1422
- if (prev !== newMode) return newMode;
1423
- return prev;
1424
- });
1425
- });
1426
- observer.observe(document.documentElement, {
1427
- attributes: true,
1428
- attributeFilter: ["class"]
1429
- });
1430
- return () => observer.disconnect();
1431
- }, []);
1432
- useEffect(() => {
1433
- if (applyStyles) {
1434
- injectStyles(config);
1435
- }
1436
- }, [config, applyStyles]);
1437
- useEffect(() => {
1438
- saveConfig(config);
1439
- }, [config]);
1440
- useEffect(() => {
1441
- return () => {
1442
- if (applyStyles) {
1443
- removeStyles();
1444
- }
1445
- };
1446
- }, [applyStyles]);
1447
- useEffect(() => {
1448
- const handleStorage = (e) => {
1449
- if (e.key === STORAGE_KEY && e.newValue) {
1450
- try {
1451
- const parsed = JSON.parse(e.newValue);
1452
- setConfigState((prev) => {
1453
- if (configsEqual(prev, parsed)) return prev;
1454
- return parsed;
1455
- });
1456
- } catch {
1457
- }
1458
- }
1459
- };
1460
- window.addEventListener("storage", handleStorage);
1461
- return () => window.removeEventListener("storage", handleStorage);
1462
- }, []);
1463
- const setConfig = useCallback((newConfig) => {
1464
- setConfigState(newConfig);
1465
- }, []);
1466
- const setStyle = useCallback((key) => {
1467
- const preset = getStylePreset(key);
1468
- setConfigState((prev) => {
1469
- if (prev.style === key) return prev;
1470
- return {
1471
- ...prev,
1472
- style: key,
1473
- radius: preset.defaults.radius,
1474
- font: preset.defaults.font,
1475
- shadow: preset.defaults.shadow,
1476
- surfaceStyle: preset.defaults.surfaceStyle
1477
- };
1478
- });
1479
- }, []);
1480
- const setColorPreset = useCallback((key) => {
1481
- setConfigState((prev) => {
1482
- if (prev.colorPreset === key) return prev;
1483
- return { ...prev, colorPreset: key };
1484
- });
1485
- }, []);
1486
- const setRadius = useCallback((key) => {
1487
- setConfigState((prev) => {
1488
- if (prev.radius === key) return prev;
1489
- return { ...prev, radius: key };
1490
- });
1491
- }, []);
1492
- const setFont = useCallback((key) => {
1493
- setConfigState((prev) => {
1494
- if (prev.font === key) return prev;
1495
- return { ...prev, font: key };
1496
- });
1497
- }, []);
1498
- const setShadow = useCallback((key) => {
1499
- setConfigState((prev) => {
1500
- if (prev.shadow === key) return prev;
1501
- return { ...prev, shadow: key };
1502
- });
1503
- }, []);
1504
- const setSurfaceStyle = useCallback((key) => {
1505
- setConfigState((prev) => {
1506
- if (prev.surfaceStyle === key) return prev;
1507
- return { ...prev, surfaceStyle: key };
1508
- });
1509
- }, []);
1510
- const setMenuColor = useCallback((key) => {
1511
- setConfigState((prev) => {
1512
- if (prev.menuColor === key) return prev;
1513
- return { ...prev, menuColor: key };
1514
- });
1515
- }, []);
1516
- const setMenuAccent = useCallback((key) => {
1517
- setConfigState((prev) => {
1518
- if (prev.menuAccent === key) return prev;
1519
- return { ...prev, menuAccent: key };
1520
- });
1521
- }, []);
1522
- const resetConfig = useCallback(() => {
1523
- setConfigState(DEFAULT_THEME_CONFIG);
1524
- }, []);
1525
- const isDefault = configsEqual(config, DEFAULT_THEME_CONFIG);
1526
- const generateCSSFn = useCallback(() => {
1527
- return generateThemeCSS(config);
1528
- }, [config]);
1529
- const value = useMemo(
1530
- () => ({
1531
- config,
1532
- setConfig,
1533
- setStyle,
1534
- setColorPreset,
1535
- setRadius,
1536
- setFont,
1537
- setShadow,
1538
- setSurfaceStyle,
1539
- setMenuColor,
1540
- setMenuAccent,
1541
- resetConfig,
1542
- isDefault,
1543
- generateCSS: generateCSSFn
1544
- }),
1545
- [
1546
- config,
1547
- setConfig,
1548
- setStyle,
1549
- setColorPreset,
1550
- setRadius,
1551
- setFont,
1552
- setShadow,
1553
- setSurfaceStyle,
1554
- setMenuColor,
1555
- setMenuAccent,
1556
- resetConfig,
1557
- isDefault,
1558
- generateCSSFn
1559
- ]
1560
- );
1561
- return /* @__PURE__ */ jsx(ThemeCustomizerContext.Provider, { value, children });
1562
- }
1563
- function Section({
1564
- title,
1565
- children,
1566
- className
1567
- }) {
1568
- return /* @__PURE__ */ jsxs("div", { className: cn("space-y-2", className), children: [
1569
- /* @__PURE__ */ jsx("h4", { className: "text-xs font-semibold uppercase tracking-wider text-muted-foreground", children: title }),
1570
- children
1571
- ] });
1572
- }
1573
- function CheckIcon({ className }) {
1574
- return /* @__PURE__ */ jsx(
1575
- "svg",
1576
- {
1577
- className: cn("size-4 shrink-0", className),
1578
- xmlns: "http://www.w3.org/2000/svg",
1579
- viewBox: "0 0 24 24",
1580
- fill: "none",
1581
- stroke: "currentColor",
1582
- strokeWidth: "2.5",
1583
- strokeLinecap: "round",
1584
- strokeLinejoin: "round",
1585
- "aria-hidden": "true",
1586
- children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" })
1587
- }
1588
- );
1589
- }
1590
- function RadiusOption({
1591
- preset,
1592
- isActive,
1593
- onClick
1594
- }) {
1595
- return /* @__PURE__ */ jsxs(
1596
- "button",
1597
- {
1598
- type: "button",
1599
- onClick,
1600
- className: cn(
1601
- "flex flex-col items-center justify-center gap-1 rounded-md border px-3 py-2 text-center transition-all duration-fast ease-standard",
1602
- "hover:border-border-strong hover:bg-muted/50",
1603
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
1604
- isActive ? "border-primary bg-muted/60 shadow-sm" : "border-border bg-transparent"
1605
- ),
1606
- title: `${preset.name} (${preset.label})`,
1607
- children: [
1608
- /* @__PURE__ */ jsx(
1609
- "span",
1610
- {
1611
- className: "size-8 border-2 border-foreground/30 bg-muted",
1612
- style: { borderRadius: preset.value },
1613
- "aria-hidden": "true"
1614
- }
1615
- ),
1616
- /* @__PURE__ */ jsx(
1617
- "span",
1618
- {
1619
- className: cn(
1620
- "text-[11px] font-medium leading-none",
1621
- isActive ? "text-foreground" : "text-muted-foreground"
1622
- ),
1623
- children: preset.label
1624
- }
1625
- )
1626
- ]
1627
- }
1628
- );
1629
- }
1630
- function ChevronDownIcon({ className }) {
1631
- return /* @__PURE__ */ jsx(
1632
- "svg",
1633
- {
1634
- className: cn("size-4 shrink-0", className),
1635
- xmlns: "http://www.w3.org/2000/svg",
1636
- viewBox: "0 0 24 24",
1637
- fill: "none",
1638
- stroke: "currentColor",
1639
- strokeWidth: "2",
1640
- strokeLinecap: "round",
1641
- strokeLinejoin: "round",
1642
- "aria-hidden": "true",
1643
- children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" })
1644
- }
1645
- );
1646
- }
1647
- function SearchIcon({ className }) {
1648
- return /* @__PURE__ */ jsxs(
1649
- "svg",
1650
- {
1651
- className: cn("size-4 shrink-0", className),
1652
- xmlns: "http://www.w3.org/2000/svg",
1653
- viewBox: "0 0 24 24",
1654
- fill: "none",
1655
- stroke: "currentColor",
1656
- strokeWidth: "2",
1657
- strokeLinecap: "round",
1658
- strokeLinejoin: "round",
1659
- "aria-hidden": "true",
1660
- children: [
1661
- /* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "8" }),
1662
- /* @__PURE__ */ jsx("path", { d: "m21 21-4.3-4.3" })
1663
- ]
1664
- }
1665
- );
1666
- }
1667
- function FontCombobox({
1668
- presets,
1669
- activeKey,
1670
- onSelect
1671
- }) {
1672
- const [open, setOpen] = useState(false);
1673
- const [search, setSearch] = useState("");
1674
- const [highlightIndex, setHighlightIndex] = useState(-1);
1675
- const containerRef = useRef(null);
1676
- const listRef = useRef(null);
1677
- const inputRef = useRef(null);
1678
- const activePreset = useMemo(
1679
- () => presets.find((p) => p.key === activeKey) ?? presets[0],
1680
- [presets, activeKey]
1681
- );
1682
- const filtered = useMemo(() => {
1683
- if (!search.trim()) return presets;
1684
- const q = search.toLowerCase();
1685
- return presets.filter((p) => p.name.toLowerCase().includes(q));
1686
- }, [presets, search]);
1687
- useEffect(() => {
1688
- setHighlightIndex(0);
1689
- }, [filtered]);
1690
- useEffect(() => {
1691
- if (!open) return;
1692
- function handleClick(e) {
1693
- if (containerRef.current && !containerRef.current.contains(e.target)) {
1694
- setOpen(false);
1695
- }
1696
- }
1697
- document.addEventListener("mousedown", handleClick);
1698
- return () => document.removeEventListener("mousedown", handleClick);
1699
- }, [open]);
1700
- useEffect(() => {
1701
- if (!open) return;
1702
- function handleKey(e) {
1703
- if (e.key === "Escape") {
1704
- setOpen(false);
1705
- }
1706
- }
1707
- document.addEventListener("keydown", handleKey);
1708
- return () => document.removeEventListener("keydown", handleKey);
1709
- }, [open]);
1710
- useEffect(() => {
1711
- if (open) {
1712
- requestAnimationFrame(() => inputRef.current?.focus());
1713
- } else {
1714
- setSearch("");
1715
- setHighlightIndex(-1);
1716
- }
1717
- }, [open]);
1718
- useEffect(() => {
1719
- if (!open || highlightIndex < 0 || !listRef.current) return;
1720
- const items = listRef.current.querySelectorAll("[data-font-item]");
1721
- items[highlightIndex]?.scrollIntoView({ block: "nearest" });
1722
- }, [highlightIndex, open]);
1723
- const handleSelect = useCallback(
1724
- (key) => {
1725
- onSelect(key);
1726
- setOpen(false);
1727
- },
1728
- [onSelect]
1729
- );
1730
- const handleKeyDown = useCallback(
1731
- (e) => {
1732
- if (e.key === "ArrowDown") {
1733
- e.preventDefault();
1734
- setHighlightIndex((i) => Math.min(i + 1, filtered.length - 1));
1735
- } else if (e.key === "ArrowUp") {
1736
- e.preventDefault();
1737
- setHighlightIndex((i) => Math.max(i - 1, 0));
1738
- } else if (e.key === "Enter") {
1739
- e.preventDefault();
1740
- if (highlightIndex >= 0 && highlightIndex < filtered.length) {
1741
- handleSelect(filtered[highlightIndex].key);
1742
- }
1743
- }
1744
- },
1745
- [filtered, highlightIndex, handleSelect]
1746
- );
1747
- return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: "relative", children: [
1748
- /* @__PURE__ */ jsxs(
1749
- "button",
1750
- {
1751
- type: "button",
1752
- onClick: () => setOpen((prev) => !prev),
1753
- className: cn(
1754
- "flex w-full items-center gap-2 rounded-md border px-3 py-2 text-left text-sm transition-all duration-fast ease-standard",
1755
- "hover:border-border-strong hover:bg-muted/50",
1756
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
1757
- open ? "border-primary shadow-sm" : "border-border"
1758
- ),
1759
- "aria-haspopup": "listbox",
1760
- "aria-expanded": open,
1761
- children: [
1762
- /* @__PURE__ */ jsx(
1763
- "span",
1764
- {
1765
- className: "text-sm font-semibold leading-none text-muted-foreground",
1766
- style: { fontFamily: activePreset.value },
1767
- children: activePreset.sample
1768
- }
1769
- ),
1770
- /* @__PURE__ */ jsx("span", { className: "flex-1 truncate font-medium text-foreground", children: activePreset.name }),
1771
- /* @__PURE__ */ jsx(
1772
- ChevronDownIcon,
1773
- {
1774
- className: cn(
1775
- "text-muted-foreground transition-transform duration-fast",
1776
- open && "rotate-180"
1777
- )
1778
- }
1779
- )
1780
- ]
1781
- }
1782
- ),
1783
- open && /* @__PURE__ */ jsxs(
1784
- "div",
1785
- {
1786
- className: cn(
1787
- "absolute left-0 z-50 mt-1 w-full rounded-md border border-border bg-popover shadow-md",
1788
- "animate-in fade-in-0 zoom-in-95 slide-in-from-top-2"
1789
- ),
1790
- role: "dialog",
1791
- "aria-label": "Select font",
1792
- children: [
1793
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 border-b border-border px-3 py-2", children: [
1794
- /* @__PURE__ */ jsx(SearchIcon, { className: "text-muted-foreground" }),
1795
- /* @__PURE__ */ jsx(
1796
- "input",
1797
- {
1798
- ref: inputRef,
1799
- type: "text",
1800
- value: search,
1801
- onChange: (e) => setSearch(e.target.value),
1802
- onKeyDown: handleKeyDown,
1803
- placeholder: "Search fonts\u2026",
1804
- className: "flex-1 bg-transparent text-sm text-foreground placeholder:text-muted-foreground outline-none",
1805
- "aria-label": "Search fonts",
1806
- autoComplete: "off",
1807
- spellCheck: false
1808
- }
1809
- )
1810
- ] }),
1811
- /* @__PURE__ */ jsx(
1812
- "div",
1813
- {
1814
- ref: listRef,
1815
- className: "max-h-52 overflow-y-auto overscroll-contain p-1",
1816
- role: "listbox",
1817
- children: filtered.length === 0 ? /* @__PURE__ */ jsx("div", { className: "px-3 py-4 text-center text-sm text-muted-foreground", children: "No fonts found" }) : filtered.map((preset, index) => {
1818
- const isActive = preset.key === activeKey;
1819
- const isHighlighted = index === highlightIndex;
1820
- return /* @__PURE__ */ jsxs(
1821
- "button",
1822
- {
1823
- type: "button",
1824
- "data-font-item": "",
1825
- role: "option",
1826
- "aria-selected": isActive,
1827
- onClick: () => handleSelect(preset.key),
1828
- onMouseEnter: () => setHighlightIndex(index),
1829
- className: cn(
1830
- "flex w-full items-center gap-2.5 rounded-sm px-2.5 py-1.5 text-left text-sm transition-colors",
1831
- "outline-none",
1832
- isHighlighted && "bg-muted",
1833
- isActive && "text-foreground font-medium",
1834
- !isActive && "text-muted-foreground"
1835
- ),
1836
- children: [
1837
- /* @__PURE__ */ jsx(
1838
- "span",
1839
- {
1840
- className: "w-6 text-center text-base font-semibold leading-none",
1841
- style: { fontFamily: preset.value },
1842
- "aria-hidden": "true",
1843
- children: preset.sample
1844
- }
1845
- ),
1846
- /* @__PURE__ */ jsx("span", { className: "flex-1 truncate", children: preset.name }),
1847
- isActive && /* @__PURE__ */ jsx(CheckIcon, { className: "text-primary shrink-0" })
1848
- ]
1849
- },
1850
- preset.key
1851
- );
1852
- })
1853
- }
1854
- )
1855
- ]
1856
- }
1857
- )
1858
- ] });
1859
- }
1860
- function ColorCombobox({
1861
- presets,
1862
- activeKey,
1863
- onSelect
1864
- }) {
1865
- const [open, setOpen] = useState(false);
1866
- const [search, setSearch] = useState("");
1867
- const [highlightIndex, setHighlightIndex] = useState(-1);
1868
- const containerRef = useRef(null);
1869
- const listRef = useRef(null);
1870
- const inputRef = useRef(null);
1871
- const activePreset = useMemo(
1872
- () => presets.find((p) => p.key === activeKey) ?? presets[0],
1873
- [presets, activeKey]
1874
- );
1875
- const filtered = useMemo(() => {
1876
- if (!search.trim()) return presets;
1877
- const q = search.toLowerCase();
1878
- return presets.filter((p) => p.name.toLowerCase().includes(q));
1879
- }, [presets, search]);
1880
- useEffect(() => {
1881
- setHighlightIndex(0);
1882
- }, [filtered]);
1883
- useEffect(() => {
1884
- if (!open) return;
1885
- function handleClick(e) {
1886
- if (containerRef.current && !containerRef.current.contains(e.target)) {
1887
- setOpen(false);
1888
- }
1889
- }
1890
- document.addEventListener("mousedown", handleClick);
1891
- return () => document.removeEventListener("mousedown", handleClick);
1892
- }, [open]);
1893
- useEffect(() => {
1894
- if (!open) return;
1895
- function handleKey(e) {
1896
- if (e.key === "Escape") {
1897
- setOpen(false);
1898
- }
1899
- }
1900
- document.addEventListener("keydown", handleKey);
1901
- return () => document.removeEventListener("keydown", handleKey);
1902
- }, [open]);
1903
- useEffect(() => {
1904
- if (open) {
1905
- requestAnimationFrame(() => inputRef.current?.focus());
1906
- } else {
1907
- setSearch("");
1908
- setHighlightIndex(-1);
1909
- }
1910
- }, [open]);
1911
- useEffect(() => {
1912
- if (!open || highlightIndex < 0 || !listRef.current) return;
1913
- const items = listRef.current.querySelectorAll("[data-color-item]");
1914
- items[highlightIndex]?.scrollIntoView({ block: "nearest" });
1915
- }, [highlightIndex, open]);
1916
- const handleSelect = useCallback(
1917
- (key) => {
1918
- onSelect(key);
1919
- setOpen(false);
1920
- },
1921
- [onSelect]
1922
- );
1923
- const handleKeyDown = useCallback(
1924
- (e) => {
1925
- if (e.key === "ArrowDown") {
1926
- e.preventDefault();
1927
- setHighlightIndex((i) => Math.min(i + 1, filtered.length - 1));
1928
- } else if (e.key === "ArrowUp") {
1929
- e.preventDefault();
1930
- setHighlightIndex((i) => Math.max(i - 1, 0));
1931
- } else if (e.key === "Enter") {
1932
- e.preventDefault();
1933
- if (highlightIndex >= 0 && highlightIndex < filtered.length) {
1934
- handleSelect(filtered[highlightIndex].key);
1935
- }
1936
- }
1937
- },
1938
- [filtered, highlightIndex, handleSelect]
1939
- );
1940
- return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: "relative", children: [
1941
- /* @__PURE__ */ jsxs(
1942
- "button",
1943
- {
1944
- type: "button",
1945
- onClick: () => setOpen((prev) => !prev),
1946
- className: cn(
1947
- "flex w-full items-center gap-2 rounded-md border px-3 py-2 text-left text-sm transition-all duration-fast ease-standard",
1948
- "hover:border-border-strong hover:bg-muted/50",
1949
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
1950
- open ? "border-primary shadow-sm" : "border-border"
1951
- ),
1952
- "aria-haspopup": "listbox",
1953
- "aria-expanded": open,
1954
- children: [
1955
- /* @__PURE__ */ jsx(
1956
- "span",
1957
- {
1958
- className: cn(
1959
- "size-5 shrink-0 rounded-full border shadow-xs",
1960
- "border-border"
1961
- ),
1962
- style: { backgroundColor: activePreset.swatch },
1963
- "aria-hidden": "true"
1964
- }
1965
- ),
1966
- /* @__PURE__ */ jsx("span", { className: "flex-1 truncate font-medium text-foreground", children: activePreset.name }),
1967
- /* @__PURE__ */ jsx(
1968
- ChevronDownIcon,
1969
- {
1970
- className: cn(
1971
- "text-muted-foreground transition-transform duration-fast",
1972
- open && "rotate-180"
1973
- )
1974
- }
1975
- )
1976
- ]
1977
- }
1978
- ),
1979
- open && /* @__PURE__ */ jsxs(
1980
- "div",
1981
- {
1982
- className: cn(
1983
- "absolute left-0 z-50 mt-1 w-full rounded-md border border-border bg-popover shadow-md",
1984
- "animate-in fade-in-0 zoom-in-95 slide-in-from-top-2"
1985
- ),
1986
- role: "dialog",
1987
- "aria-label": "Select color",
1988
- children: [
1989
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 border-b border-border px-3 py-2", children: [
1990
- /* @__PURE__ */ jsx(SearchIcon, { className: "text-muted-foreground" }),
1991
- /* @__PURE__ */ jsx(
1992
- "input",
1993
- {
1994
- ref: inputRef,
1995
- type: "text",
1996
- value: search,
1997
- onChange: (e) => setSearch(e.target.value),
1998
- onKeyDown: handleKeyDown,
1999
- placeholder: "Search colors\u2026",
2000
- className: "flex-1 bg-transparent text-sm text-foreground placeholder:text-muted-foreground outline-none",
2001
- "aria-label": "Search colors",
2002
- autoComplete: "off",
2003
- spellCheck: false
2004
- }
2005
- )
2006
- ] }),
2007
- /* @__PURE__ */ jsx(
2008
- "div",
2009
- {
2010
- ref: listRef,
2011
- className: "max-h-52 overflow-y-auto overscroll-contain p-1",
2012
- role: "listbox",
2013
- children: filtered.length === 0 ? /* @__PURE__ */ jsx("div", { className: "px-3 py-4 text-center text-sm text-muted-foreground", children: "No colors found" }) : filtered.map((preset, index) => {
2014
- const isActive = preset.key === activeKey;
2015
- const isHighlighted = index === highlightIndex;
2016
- return /* @__PURE__ */ jsxs(
2017
- "button",
2018
- {
2019
- type: "button",
2020
- "data-color-item": "",
2021
- role: "option",
2022
- "aria-selected": isActive,
2023
- onClick: () => handleSelect(preset.key),
2024
- onMouseEnter: () => setHighlightIndex(index),
2025
- className: cn(
2026
- "flex w-full items-center gap-2.5 rounded-sm px-2.5 py-1.5 text-left text-sm transition-colors",
2027
- "outline-none",
2028
- isHighlighted && "bg-muted",
2029
- isActive && "text-foreground font-medium",
2030
- !isActive && "text-muted-foreground"
2031
- ),
2032
- children: [
2033
- /* @__PURE__ */ jsx(
2034
- "span",
2035
- {
2036
- className: cn(
2037
- "size-4 shrink-0 rounded-full border shadow-xs",
2038
- isActive ? "border-primary/50 ring-2 ring-primary/20" : "border-border"
2039
- ),
2040
- style: { backgroundColor: preset.swatch },
2041
- "aria-hidden": "true"
2042
- }
2043
- ),
2044
- /* @__PURE__ */ jsx("span", { className: "flex-1 truncate", children: preset.name }),
2045
- isActive && /* @__PURE__ */ jsx(CheckIcon, { className: "text-primary shrink-0" })
2046
- ]
2047
- },
2048
- preset.key
2049
- );
2050
- })
2051
- }
2052
- )
2053
- ]
2054
- }
2055
- )
2056
- ] });
2057
- }
2058
- function PillToggle({
2059
- label,
2060
- isActive,
2061
- onClick,
2062
- description
2063
- }) {
2064
- return /* @__PURE__ */ jsx(
2065
- "button",
2066
- {
2067
- type: "button",
2068
- onClick,
2069
- className: cn(
2070
- "rounded-md border px-3 py-2 text-left text-sm transition-all duration-fast ease-standard",
2071
- "hover:border-border-strong hover:bg-muted/50",
2072
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
2073
- isActive ? "border-primary bg-muted/60 shadow-sm font-medium text-foreground" : "border-border bg-transparent text-muted-foreground"
2074
- ),
2075
- title: description,
2076
- children: label
2077
- }
2078
- );
2079
- }
2080
- function StyleOption({
2081
- preset,
2082
- isActive,
2083
- onClick
2084
- }) {
2085
- return /* @__PURE__ */ jsxs(
2086
- "button",
2087
- {
2088
- type: "button",
2089
- onClick,
2090
- className: cn(
2091
- "flex items-start gap-3 rounded-md border px-3 py-3 text-left transition-all duration-fast ease-standard",
2092
- "hover:border-border-strong hover:bg-muted/50",
2093
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
2094
- isActive ? "border-primary bg-muted/60 shadow-sm" : "border-border bg-transparent"
2095
- ),
2096
- title: preset.description,
2097
- children: [
2098
- /* @__PURE__ */ jsx(
2099
- "svg",
2100
- {
2101
- className: cn(
2102
- "size-5 shrink-0 mt-0.5",
2103
- isActive ? "text-primary" : "text-muted-foreground"
2104
- ),
2105
- xmlns: "http://www.w3.org/2000/svg",
2106
- viewBox: "0 0 24 24",
2107
- fill: "none",
2108
- stroke: "currentColor",
2109
- strokeWidth: "1.5",
2110
- strokeLinecap: "round",
2111
- strokeLinejoin: "round",
2112
- "aria-hidden": "true",
2113
- children: /* @__PURE__ */ jsx("path", { d: preset.iconPath })
2114
- }
2115
- ),
2116
- /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
2117
- /* @__PURE__ */ jsx(
2118
- "div",
2119
- {
2120
- className: cn(
2121
- "text-sm font-semibold leading-tight",
2122
- isActive ? "text-foreground" : "text-foreground"
2123
- ),
2124
- children: preset.name
2125
- }
2126
- ),
2127
- /* @__PURE__ */ jsx(
2128
- "div",
2129
- {
2130
- className: cn(
2131
- "mt-0.5 text-xs leading-snug",
2132
- isActive ? "text-muted-foreground" : "text-muted-foreground/70"
2133
- ),
2134
- children: preset.description
2135
- }
2136
- )
2137
- ] }),
2138
- isActive && /* @__PURE__ */ jsx(CheckIcon, { className: "shrink-0 mt-0.5 text-primary" })
2139
- ]
2140
- }
2141
- );
2142
- }
2143
- function CopyButton({
2144
- getText,
2145
- className,
2146
- children
2147
- }) {
2148
- const [copied, setCopied] = useState(false);
2149
- const timeoutRef = useRef(null);
2150
- const handleCopy = useCallback(() => {
2151
- const text = getText();
2152
- navigator.clipboard.writeText(text).then(() => {
2153
- setCopied(true);
2154
- if (timeoutRef.current) clearTimeout(timeoutRef.current);
2155
- timeoutRef.current = setTimeout(() => setCopied(false), 2e3);
2156
- });
2157
- }, [getText]);
2158
- useEffect(() => {
2159
- return () => {
2160
- if (timeoutRef.current) clearTimeout(timeoutRef.current);
2161
- };
2162
- }, []);
2163
- return /* @__PURE__ */ jsx(
2164
- "button",
2165
- {
2166
- type: "button",
2167
- onClick: handleCopy,
2168
- className: cn(
2169
- "inline-flex items-center justify-center gap-2 rounded-md border border-border bg-secondary px-4 py-2 text-sm font-medium text-secondary-foreground transition-all duration-fast ease-standard",
2170
- "hover:bg-secondary-hover active:bg-secondary-active",
2171
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
2172
- className
2173
- ),
2174
- children: copied ? /* @__PURE__ */ jsxs(Fragment, { children: [
2175
- /* @__PURE__ */ jsx(CheckIcon, { className: "text-success" }),
2176
- /* @__PURE__ */ jsx("span", { children: "Copied!" })
2177
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2178
- /* @__PURE__ */ jsxs(
2179
- "svg",
2180
- {
2181
- className: "size-4",
2182
- xmlns: "http://www.w3.org/2000/svg",
2183
- viewBox: "0 0 24 24",
2184
- fill: "none",
2185
- stroke: "currentColor",
2186
- strokeWidth: "2",
2187
- strokeLinecap: "round",
2188
- strokeLinejoin: "round",
2189
- "aria-hidden": "true",
2190
- children: [
2191
- /* @__PURE__ */ jsx("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" }),
2192
- /* @__PURE__ */ jsx("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })
2193
- ]
2194
- }
2195
- ),
2196
- /* @__PURE__ */ jsx("span", { children: children ?? "Copy CSS" })
2197
- ] })
2198
- }
2199
- );
2200
- }
2201
- function ThemeCustomizer({
2202
- className,
2203
- showCopyButton = true,
2204
- showResetButton = true
2205
- }) {
2206
- const {
2207
- config,
2208
- setStyle,
2209
- setColorPreset,
2210
- setRadius,
2211
- setFont,
2212
- setShadow,
2213
- setSurfaceStyle,
2214
- setMenuColor,
2215
- setMenuAccent,
2216
- resetConfig,
2217
- isDefault,
2218
- generateCSS
2219
- } = useThemeCustomizer();
2220
- return /* @__PURE__ */ jsxs(
2221
- "div",
2222
- {
2223
- className: cn("space-y-6", className),
2224
- "data-ds": "",
2225
- "data-ds-component": "theme-customizer",
2226
- children: [
2227
- /* @__PURE__ */ jsx(Section, { title: "Style", children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 gap-2", children: STYLE_PRESETS.map((preset) => /* @__PURE__ */ jsx(
2228
- StyleOption,
2229
- {
2230
- preset,
2231
- isActive: config.style === preset.key,
2232
- onClick: () => setStyle(preset.key)
2233
- },
2234
- preset.key
2235
- )) }) }),
2236
- /* @__PURE__ */ jsx(Section, { title: "Color", children: /* @__PURE__ */ jsx(
2237
- ColorCombobox,
2238
- {
2239
- presets: COLOR_PRESETS,
2240
- activeKey: config.colorPreset,
2241
- onSelect: setColorPreset
2242
- }
2243
- ) }),
2244
- /* @__PURE__ */ jsx(Section, { title: "Radius", children: /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: RADIUS_PRESETS.map((preset) => /* @__PURE__ */ jsx(
2245
- RadiusOption,
2246
- {
2247
- preset,
2248
- isActive: config.radius === preset.key,
2249
- onClick: () => setRadius(preset.key)
2250
- },
2251
- preset.key
2252
- )) }) }),
2253
- /* @__PURE__ */ jsx(Section, { title: "Font", children: /* @__PURE__ */ jsx(
2254
- FontCombobox,
2255
- {
2256
- presets: FONT_PRESETS,
2257
- activeKey: config.font,
2258
- onSelect: setFont
2259
- }
2260
- ) }),
2261
- /* @__PURE__ */ jsx(Section, { title: "Shadow", children: /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: SHADOW_PRESETS.map((preset) => /* @__PURE__ */ jsx(
2262
- PillToggle,
2263
- {
2264
- label: preset.name,
2265
- isActive: config.shadow === preset.key,
2266
- onClick: () => setShadow(preset.key),
2267
- description: preset.description
2268
- },
2269
- preset.key
2270
- )) }) }),
2271
- /* @__PURE__ */ jsx(Section, { title: "Surface", children: /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: SURFACE_STYLE_PRESETS.map((preset) => /* @__PURE__ */ jsx(
2272
- PillToggle,
2273
- {
2274
- label: preset.name,
2275
- isActive: config.surfaceStyle === preset.key,
2276
- onClick: () => setSurfaceStyle(preset.key),
2277
- description: preset.description
2278
- },
2279
- preset.key
2280
- )) }) }),
2281
- /* @__PURE__ */ jsx(Section, { title: "Menu Color", children: /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: MENU_COLOR_PRESETS.map((preset) => /* @__PURE__ */ jsx(
2282
- PillToggle,
2283
- {
2284
- label: preset.name,
2285
- isActive: config.menuColor === preset.key,
2286
- onClick: () => setMenuColor(preset.key),
2287
- description: preset.description
2288
- },
2289
- preset.key
2290
- )) }) }),
2291
- /* @__PURE__ */ jsx(Section, { title: "Menu Accent", children: /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: MENU_ACCENT_PRESETS.map((preset) => /* @__PURE__ */ jsx(
2292
- PillToggle,
2293
- {
2294
- label: preset.name,
2295
- isActive: config.menuAccent === preset.key,
2296
- onClick: () => setMenuAccent(preset.key),
2297
- description: preset.description
2298
- },
2299
- preset.key
2300
- )) }) }),
2301
- (showCopyButton || showResetButton) && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 border-t border-border pt-4", children: [
2302
- showCopyButton && /* @__PURE__ */ jsx(CopyButton, { getText: generateCSS, className: "flex-1" }),
2303
- showResetButton && !isDefault && /* @__PURE__ */ jsxs(
2304
- "button",
2305
- {
2306
- type: "button",
2307
- onClick: resetConfig,
2308
- className: cn(
2309
- "inline-flex items-center justify-center gap-2 rounded-md border border-border bg-transparent px-4 py-2 text-sm font-medium text-muted-foreground transition-all duration-fast ease-standard",
2310
- "hover:bg-muted hover:text-foreground",
2311
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
2312
- ),
2313
- children: [
2314
- /* @__PURE__ */ jsxs(
2315
- "svg",
2316
- {
2317
- className: "size-4",
2318
- xmlns: "http://www.w3.org/2000/svg",
2319
- viewBox: "0 0 24 24",
2320
- fill: "none",
2321
- stroke: "currentColor",
2322
- strokeWidth: "2",
2323
- strokeLinecap: "round",
2324
- strokeLinejoin: "round",
2325
- "aria-hidden": "true",
2326
- children: [
2327
- /* @__PURE__ */ jsx("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }),
2328
- /* @__PURE__ */ jsx("path", { d: "M3 3v5h5" })
2329
- ]
2330
- }
2331
- ),
2332
- /* @__PURE__ */ jsx("span", { children: "Reset" })
2333
- ]
2334
- }
2335
- )
2336
- ] })
2337
- ]
2338
- }
2339
- );
2340
- }
2341
- ThemeCustomizer.displayName = "ThemeCustomizer";
2342
- var DSThemeContext = createContext(null);
2343
- function useDSTheme() {
2344
- const ctx = useContext(DSThemeContext);
2345
- if (!ctx) {
2346
- throw new Error(
2347
- "useDSTheme must be used within a <DSThemeProvider>. Wrap your application (or layout) with <DSThemeProvider>."
2348
- );
2349
- }
2350
- return ctx;
2351
- }
2352
- function getSystemPreference() {
2353
- if (typeof window === "undefined") return "light";
2354
- return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
2355
- }
2356
- function resolveTheme(theme) {
2357
- if (theme === "system") return getSystemPreference();
2358
- return theme;
2359
- }
2360
- var STORAGE_KEY2 = "ds-theme-preference";
2361
- function getStoredTheme() {
2362
- if (typeof window === "undefined") return "system";
2363
- try {
2364
- const stored = localStorage.getItem(STORAGE_KEY2);
2365
- if (stored === "light" || stored === "dark" || stored === "system") {
2366
- return stored;
2367
- }
2368
- } catch {
2369
- }
2370
- return "system";
2371
- }
2372
- function storeTheme(theme) {
2373
- try {
2374
- localStorage.setItem(STORAGE_KEY2, theme);
2375
- } catch {
2376
- }
2377
- }
2378
- function DSThemeProvider({
2379
- children,
2380
- defaultTheme,
2381
- manageHtmlClass = false
2382
- }) {
2383
- const [theme, setThemeState] = useState(
2384
- () => defaultTheme ?? getStoredTheme()
2385
- );
2386
- const [systemPreference, setSystemPreference] = useState("light");
2387
- useEffect(() => {
2388
- setSystemPreference(getSystemPreference());
2389
- const mql = window.matchMedia("(prefers-color-scheme: dark)");
2390
- const handler = (e) => {
2391
- setSystemPreference(e.matches ? "dark" : "light");
2392
- };
2393
- mql.addEventListener("change", handler);
2394
- return () => mql.removeEventListener("change", handler);
2395
- }, []);
2396
- const resolvedTheme = useMemo(
2397
- () => theme === "system" ? systemPreference : theme,
2398
- [theme, systemPreference]
2399
- );
2400
- useEffect(() => {
2401
- if (!manageHtmlClass) return;
2402
- const root = document.documentElement;
2403
- if (resolvedTheme === "dark") {
2404
- root.classList.add("dark");
2405
- } else {
2406
- root.classList.remove("dark");
2407
- }
2408
- }, [resolvedTheme, manageHtmlClass]);
2409
- const setTheme = useCallback((newTheme) => {
2410
- setThemeState(newTheme);
2411
- storeTheme(newTheme);
2412
- }, []);
2413
- const toggleTheme = useCallback(() => {
2414
- setThemeState((current) => {
2415
- const resolved = resolveTheme(current);
2416
- const next = resolved === "dark" ? "light" : "dark";
2417
- storeTheme(next);
2418
- return next;
2419
- });
2420
- }, []);
2421
- const value = useMemo(
2422
- () => ({
2423
- theme,
2424
- resolvedTheme,
2425
- setTheme,
2426
- toggleTheme
2427
- }),
2428
- [theme, resolvedTheme, setTheme, toggleTheme]
2429
- );
2430
- return /* @__PURE__ */ jsx(DSThemeContext.Provider, { value, children });
2431
- }
2432
-
2433
- export { COLOR_PRESETS, COLOR_PRESET_KEYS, DEFAULT_FONT_KEY, DEFAULT_MENU_ACCENT_KEY, DEFAULT_MENU_COLOR_KEY, DEFAULT_RADIUS_KEY, DEFAULT_SHADOW_KEY, DEFAULT_STYLE_KEY, DEFAULT_SURFACE_STYLE_KEY, DEFAULT_THEME_CONFIG, DSThemeProvider, FONT_PRESETS, MENU_ACCENT_PRESETS, MENU_COLOR_PRESETS, RADIUS_PRESETS, SHADOW_PRESETS, STYLE_PRESETS, SURFACE_STYLE_PRESETS, ThemeCustomizer, ThemeCustomizerContext, ThemeCustomizerProvider, buildDarkThemeVars, buildLightThemeVars, buildThemeCSS, buildThemeOverrides, contract, cssVar, generateThemeCSS, getColorPreset, getFontPreset, getMenuAccentPreset, getMenuColorPreset, getRadiusPreset, getShadowPreset, getStylePreset, useDSTheme, useThemeCustomizer };