sparkdesign 0.0.1 → 0.2.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 (403) hide show
  1. package/README.md +279 -5
  2. package/cli/dist/commands/add.js +84 -0
  3. package/cli/dist/commands/diff.js +54 -0
  4. package/cli/dist/commands/init.js +96 -0
  5. package/cli/dist/commands/list.js +25 -0
  6. package/cli/dist/index.js +37 -0
  7. package/cli/dist/utils/config.js +53 -0
  8. package/cli/dist/utils/registry.js +34 -0
  9. package/cli/dist/utils/tokens.js +90 -0
  10. package/cli/dist/utils/transform.js +19 -0
  11. package/cli/registry/basic/alert-dialog.tsx +180 -0
  12. package/cli/registry/basic/avatar.tsx +120 -0
  13. package/cli/registry/basic/button.tsx +100 -0
  14. package/cli/registry/basic/collapse.tsx +94 -0
  15. package/cli/registry/basic/collapsible-card.tsx +230 -0
  16. package/cli/registry/basic/collapsible.tsx +21 -0
  17. package/cli/registry/basic/dropdown-menu.tsx +254 -0
  18. package/cli/registry/basic/icon-button.tsx +66 -0
  19. package/cli/registry/basic/icons-inline.tsx +206 -0
  20. package/cli/registry/basic/kbd.tsx +50 -0
  21. package/cli/registry/basic/option-list.tsx +125 -0
  22. package/cli/registry/basic/pagination.tsx +132 -0
  23. package/cli/registry/basic/progress.tsx +42 -0
  24. package/cli/registry/basic/radio-group.tsx +69 -0
  25. package/cli/registry/basic/resizable.tsx +67 -0
  26. package/cli/registry/basic/scrollbar.tsx +114 -0
  27. package/cli/registry/basic/select.tsx +177 -0
  28. package/cli/registry/basic/skeleton.tsx +33 -0
  29. package/cli/registry/basic/slider.tsx +55 -0
  30. package/cli/registry/basic/sonner.tsx +104 -0
  31. package/cli/registry/basic/spinner.tsx +17 -0
  32. package/cli/registry/basic/switch.tsx +49 -0
  33. package/cli/registry/basic/table.tsx +117 -0
  34. package/cli/registry/basic/tabs.tsx +85 -0
  35. package/cli/registry/basic/tag.tsx +161 -0
  36. package/cli/registry/basic/theme-from-document.ts +10 -0
  37. package/cli/registry/basic/toggle.tsx +223 -0
  38. package/cli/registry/basic/tooltip.tsx +80 -0
  39. package/cli/registry/basic/typography.tsx +201 -0
  40. package/cli/registry/chat/browser-use-part.tsx +166 -0
  41. package/cli/registry/chat/chat-input/chat-input-folder-selector.tsx +185 -0
  42. package/cli/registry/chat/chat-input/chat-input-model-switcher.tsx +131 -0
  43. package/cli/registry/chat/chat-input/chat-input-textarea.tsx +67 -0
  44. package/cli/registry/chat/chat-input/compound.tsx +334 -0
  45. package/cli/registry/chat/chat-input/context.tsx +189 -0
  46. package/cli/registry/chat/chat-input/folder-permission-dialog.tsx +61 -0
  47. package/cli/registry/chat/chat-input/index.tsx +123 -0
  48. package/cli/registry/chat/chat-input/types.ts +77 -0
  49. package/cli/registry/chat/chat-input/useAutoResizeTextarea.ts +20 -0
  50. package/cli/registry/chat/code-block-part.tsx +151 -0
  51. package/cli/registry/chat/file-attachment.tsx +44 -0
  52. package/cli/registry/chat/file-card.tsx +68 -0
  53. package/cli/registry/chat/file-review-part.tsx +259 -0
  54. package/cli/registry/chat/folder-button.tsx +169 -0
  55. package/cli/registry/chat/generated-images-grid.tsx +56 -0
  56. package/cli/registry/chat/generation-status-bar.tsx +72 -0
  57. package/cli/registry/chat/image-attachment.tsx +166 -0
  58. package/cli/registry/chat/image-generating.tsx +281 -0
  59. package/cli/registry/chat/markdown.tsx +146 -0
  60. package/cli/registry/chat/mermaid-part.tsx +90 -0
  61. package/cli/registry/chat/permission-card.tsx +178 -0
  62. package/cli/registry/chat/plan-part.tsx +168 -0
  63. package/cli/registry/chat/question-part.tsx +70 -0
  64. package/cli/registry/chat/queue-indicator.tsx +234 -0
  65. package/cli/registry/chat/reasoning-step.tsx +358 -0
  66. package/cli/registry/chat/related-prompts.tsx +91 -0
  67. package/cli/registry/chat/request.tsx +38 -0
  68. package/cli/registry/chat/response.tsx +271 -0
  69. package/cli/registry/chat/send-button.tsx +94 -0
  70. package/cli/registry/chat/sidebar-menu.tsx +177 -0
  71. package/cli/registry/chat/streaming-markdown-block.tsx +111 -0
  72. package/cli/registry/chat/suggestion-part.tsx +165 -0
  73. package/cli/registry/chat/task-part.tsx +109 -0
  74. package/cli/registry/chat/terminal-code-block-part.tsx +69 -0
  75. package/cli/registry/chat/thinking-indicator.tsx +91 -0
  76. package/cli/registry/chat/tool-invocation-card.tsx +132 -0
  77. package/cli/registry/chat/user-question/UserQuestionCard.tsx +198 -0
  78. package/cli/registry/chat/user-question/UserQuestionFooter.tsx +66 -0
  79. package/cli/registry/chat/user-question/UserQuestionHeader.tsx +64 -0
  80. package/cli/registry/chat/user-question/index.tsx +340 -0
  81. package/cli/registry/chat/user-question/types.ts +61 -0
  82. package/cli/registry/chat/user-question/useUserQuestionKeyboard.ts +127 -0
  83. package/cli/registry/chat/user-question/useUserQuestionState.ts +165 -0
  84. package/cli/registry/chat/user-question-answer.tsx +62 -0
  85. package/cli/registry/lib/file-icon-maps.ts +150 -0
  86. package/cli/registry/lib/use-mermaid-render.ts +76 -0
  87. package/cli/registry/lib/utils.ts +6 -0
  88. package/cli/registry/meta.json +1 -0
  89. package/cli/registry/tokens/scale.css +299 -0
  90. package/cli/registry/tokens/theme.css +633 -0
  91. package/dist/_basePickBy-DnQN8w3y.js +151 -0
  92. package/dist/_basePickBy-a-kPMlkg.cjs +1 -0
  93. package/dist/_baseUniq-B-N2NQ50.js +614 -0
  94. package/dist/_baseUniq-Cc_zbSif.cjs +1 -0
  95. package/dist/arc-BQBhijZ6.js +83 -0
  96. package/dist/arc-mWQt0Yph.cjs +1 -0
  97. package/dist/architectureDiagram-VXUJARFQ-BMZEucno.cjs +36 -0
  98. package/dist/architectureDiagram-VXUJARFQ-DTdjD3Bp.js +4661 -0
  99. package/dist/blockDiagram-VD42YOAC-CzHn0yob.js +2256 -0
  100. package/dist/blockDiagram-VD42YOAC-DDxdHAlz.cjs +122 -0
  101. package/dist/c4Diagram-YG6GDRKO-4Gz0I4gj.cjs +10 -0
  102. package/dist/c4Diagram-YG6GDRKO-BIy--yVN.js +1580 -0
  103. package/dist/channel-BQn0o8bs.js +5 -0
  104. package/dist/channel-DaN7XniJ.cjs +1 -0
  105. package/dist/chunk-4BX2VUAB-BlQFTQqz.cjs +1 -0
  106. package/dist/chunk-4BX2VUAB-Czitj3Kc.js +8 -0
  107. package/dist/chunk-55IACEB6-DXacNZbO.js +8 -0
  108. package/dist/chunk-55IACEB6-DnDxpye9.cjs +1 -0
  109. package/dist/chunk-B4BG7PRW-CBdN0q_V.js +1375 -0
  110. package/dist/chunk-B4BG7PRW-DbGvUkGO.cjs +165 -0
  111. package/dist/chunk-DI55MBZ5-D1YJMs6x.cjs +220 -0
  112. package/dist/chunk-DI55MBZ5-NCQTvayw.js +1370 -0
  113. package/dist/chunk-FMBD7UC4-CsGMbrtr.js +19 -0
  114. package/dist/chunk-FMBD7UC4-Di7cUUh5.cjs +15 -0
  115. package/dist/chunk-QN33PNHL-0j5LC8Lm.cjs +1 -0
  116. package/dist/chunk-QN33PNHL-3GERZBRm.js +19 -0
  117. package/dist/chunk-QZHKN3VN-AVEY9ImQ.js +15 -0
  118. package/dist/chunk-QZHKN3VN-s8Z0a8mc.cjs +1 -0
  119. package/dist/chunk-TZMSLE5B-CAf87HPt.cjs +1 -0
  120. package/dist/chunk-TZMSLE5B-sbiflal0.js +64 -0
  121. package/dist/classDiagram-2ON5EDUG-Ct9JLIN2.cjs +1 -0
  122. package/dist/classDiagram-2ON5EDUG-Dzfrft3a.js +16 -0
  123. package/dist/classDiagram-v2-WZHVMYZB-Ct9JLIN2.cjs +1 -0
  124. package/dist/classDiagram-v2-WZHVMYZB-Dzfrft3a.js +16 -0
  125. package/dist/clone-Cde_NQ8V.js +8 -0
  126. package/dist/clone-DCNjWuM2.cjs +1 -0
  127. package/dist/cose-bilkent-S5V4N54A-0uLijMro.cjs +1 -0
  128. package/dist/cose-bilkent-S5V4N54A-Bb08N431.js +2608 -0
  129. package/dist/cytoscape.esm-CNUX3VTg.cjs +321 -0
  130. package/dist/cytoscape.esm-Cvf3sx9F.js +18704 -0
  131. package/dist/dagre-6UL2VRFP-CY_Wz5Zd.js +444 -0
  132. package/dist/dagre-6UL2VRFP-Dxe7_qZc.cjs +4 -0
  133. package/dist/defaultLocale-BgPVtth8.js +171 -0
  134. package/dist/defaultLocale-C4wbwF1n.cjs +1 -0
  135. package/dist/diagram-PSM6KHXK-D2bdb7MT.js +531 -0
  136. package/dist/diagram-PSM6KHXK-YF69SUjY.cjs +24 -0
  137. package/dist/diagram-QEK2KX5R-BpUSoh0-.js +217 -0
  138. package/dist/diagram-QEK2KX5R-DZPGteon.cjs +43 -0
  139. package/dist/diagram-S2PKOQOG-ht-zdvFG.cjs +24 -0
  140. package/dist/diagram-S2PKOQOG-zFeLJ50Z.js +142 -0
  141. package/dist/erDiagram-Q2GNP2WA-B38iJ6ts.js +841 -0
  142. package/dist/erDiagram-Q2GNP2WA-RgS80DDU.cjs +60 -0
  143. package/dist/flowDiagram-NV44I4VS-BHilOs2p.cjs +162 -0
  144. package/dist/flowDiagram-NV44I4VS-BrBJcoce.js +1620 -0
  145. package/dist/fonts/KaTeX_AMS-Regular.ttf +0 -0
  146. package/dist/fonts/KaTeX_AMS-Regular.woff +0 -0
  147. package/dist/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  148. package/dist/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
  149. package/dist/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
  150. package/dist/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  151. package/dist/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
  152. package/dist/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
  153. package/dist/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  154. package/dist/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
  155. package/dist/fonts/KaTeX_Fraktur-Bold.woff +0 -0
  156. package/dist/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  157. package/dist/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
  158. package/dist/fonts/KaTeX_Fraktur-Regular.woff +0 -0
  159. package/dist/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  160. package/dist/fonts/KaTeX_Main-Bold.ttf +0 -0
  161. package/dist/fonts/KaTeX_Main-Bold.woff +0 -0
  162. package/dist/fonts/KaTeX_Main-Bold.woff2 +0 -0
  163. package/dist/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
  164. package/dist/fonts/KaTeX_Main-BoldItalic.woff +0 -0
  165. package/dist/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  166. package/dist/fonts/KaTeX_Main-Italic.ttf +0 -0
  167. package/dist/fonts/KaTeX_Main-Italic.woff +0 -0
  168. package/dist/fonts/KaTeX_Main-Italic.woff2 +0 -0
  169. package/dist/fonts/KaTeX_Main-Regular.ttf +0 -0
  170. package/dist/fonts/KaTeX_Main-Regular.woff +0 -0
  171. package/dist/fonts/KaTeX_Main-Regular.woff2 +0 -0
  172. package/dist/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
  173. package/dist/fonts/KaTeX_Math-BoldItalic.woff +0 -0
  174. package/dist/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  175. package/dist/fonts/KaTeX_Math-Italic.ttf +0 -0
  176. package/dist/fonts/KaTeX_Math-Italic.woff +0 -0
  177. package/dist/fonts/KaTeX_Math-Italic.woff2 +0 -0
  178. package/dist/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
  179. package/dist/fonts/KaTeX_SansSerif-Bold.woff +0 -0
  180. package/dist/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  181. package/dist/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
  182. package/dist/fonts/KaTeX_SansSerif-Italic.woff +0 -0
  183. package/dist/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  184. package/dist/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
  185. package/dist/fonts/KaTeX_SansSerif-Regular.woff +0 -0
  186. package/dist/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  187. package/dist/fonts/KaTeX_Script-Regular.ttf +0 -0
  188. package/dist/fonts/KaTeX_Script-Regular.woff +0 -0
  189. package/dist/fonts/KaTeX_Script-Regular.woff2 +0 -0
  190. package/dist/fonts/KaTeX_Size1-Regular.ttf +0 -0
  191. package/dist/fonts/KaTeX_Size1-Regular.woff +0 -0
  192. package/dist/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  193. package/dist/fonts/KaTeX_Size2-Regular.ttf +0 -0
  194. package/dist/fonts/KaTeX_Size2-Regular.woff +0 -0
  195. package/dist/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  196. package/dist/fonts/KaTeX_Size3-Regular.ttf +0 -0
  197. package/dist/fonts/KaTeX_Size3-Regular.woff +0 -0
  198. package/dist/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  199. package/dist/fonts/KaTeX_Size4-Regular.ttf +0 -0
  200. package/dist/fonts/KaTeX_Size4-Regular.woff +0 -0
  201. package/dist/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  202. package/dist/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
  203. package/dist/fonts/KaTeX_Typewriter-Regular.woff +0 -0
  204. package/dist/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  205. package/dist/ganttDiagram-JELNMOA3-pZiJeFio.cjs +267 -0
  206. package/dist/ganttDiagram-JELNMOA3-tw6FhkWJ.js +2670 -0
  207. package/dist/gitGraphDiagram-V2S2FVAM-BWn5uIK5.js +699 -0
  208. package/dist/gitGraphDiagram-V2S2FVAM-DKKeG-9R.cjs +65 -0
  209. package/dist/graph-DIbblrZP.cjs +1 -0
  210. package/dist/graph-DPcK91G3.js +247 -0
  211. package/dist/infoDiagram-HS3SLOUP-B8gwwhct.cjs +2 -0
  212. package/dist/infoDiagram-HS3SLOUP-D47PNcP_.js +24 -0
  213. package/dist/init-CHZsXQcr.cjs +1 -0
  214. package/dist/init-DjUOC4st.js +16 -0
  215. package/dist/journeyDiagram-XKPGCS4Q-BG3cfhyU.js +834 -0
  216. package/dist/journeyDiagram-XKPGCS4Q-D8DVLJof.cjs +139 -0
  217. package/dist/kanban-definition-3W4ZIXB7-4OCnEouP.cjs +89 -0
  218. package/dist/kanban-definition-3W4ZIXB7-CWi_ssF9.js +719 -0
  219. package/dist/katex.css +1 -0
  220. package/dist/layout-Byuh8f-J.cjs +1 -0
  221. package/dist/layout-CdLdvj1j.js +1335 -0
  222. package/dist/linear-C2Q_PI9B.js +259 -0
  223. package/dist/linear-C69aPBW1.cjs +1 -0
  224. package/dist/mermaid.core-DBwAx_jp.cjs +249 -0
  225. package/dist/mermaid.core-gFR0XUlD.js +15300 -0
  226. package/dist/mindmap-definition-VGOIOE7T-8P7obVV4.cjs +68 -0
  227. package/dist/mindmap-definition-VGOIOE7T-DnOa7WJ9.js +784 -0
  228. package/dist/ordinal-B6-f3MAq.js +61 -0
  229. package/dist/ordinal-CagbB1m8.cjs +1 -0
  230. package/dist/pieDiagram-ADFJNKIX-5NAlvhMo.js +161 -0
  231. package/dist/pieDiagram-ADFJNKIX-CQBG4yR9.cjs +30 -0
  232. package/dist/qoder-design.css +2 -0
  233. package/dist/quadrantDiagram-AYHSOK5B-Oe4y7RZ0.cjs +7 -0
  234. package/dist/quadrantDiagram-AYHSOK5B-rh2DPEP1.js +1022 -0
  235. package/dist/registry/basic/alert-dialog.d.ts +40 -0
  236. package/dist/registry/basic/avatar.d.ts +30 -0
  237. package/dist/registry/basic/button.d.ts +16 -0
  238. package/dist/registry/basic/collapse.d.ts +22 -0
  239. package/dist/registry/basic/collapsible-card.d.ts +34 -0
  240. package/dist/registry/basic/collapsible.d.ts +15 -0
  241. package/dist/registry/basic/dropdown-menu.d.ts +52 -0
  242. package/dist/registry/basic/icon-button.d.ts +12 -0
  243. package/dist/registry/basic/icons-inline.d.ts +51 -0
  244. package/dist/registry/basic/kbd.d.ts +23 -0
  245. package/dist/registry/basic/option-list.d.ts +16 -0
  246. package/dist/registry/basic/pagination.d.ts +33 -0
  247. package/dist/registry/basic/progress.d.ts +18 -0
  248. package/dist/registry/basic/radio-group.d.ts +25 -0
  249. package/dist/registry/basic/resizable.d.ts +318 -0
  250. package/dist/registry/basic/scrollbar.d.ts +12 -0
  251. package/dist/registry/basic/select.d.ts +35 -0
  252. package/dist/registry/basic/skeleton.d.ts +10 -0
  253. package/dist/registry/basic/slider.d.ts +16 -0
  254. package/dist/registry/basic/sonner.d.ts +23 -0
  255. package/dist/registry/basic/spinner.d.ts +5 -0
  256. package/dist/registry/basic/switch.d.ts +20 -0
  257. package/dist/registry/basic/table.d.ts +18 -0
  258. package/dist/registry/basic/tabs.d.ts +29 -0
  259. package/dist/registry/basic/tag.d.ts +23 -0
  260. package/dist/registry/basic/theme-from-document.d.ts +10 -0
  261. package/dist/registry/basic/toggle.d.ts +29 -0
  262. package/dist/registry/basic/tooltip.d.ts +34 -0
  263. package/dist/registry/basic/typography.d.ts +76 -0
  264. package/dist/registry/chat/browser-use-part.d.ts +28 -0
  265. package/dist/registry/chat/chat-input/chat-input-folder-selector.d.ts +22 -0
  266. package/dist/registry/chat/chat-input/chat-input-model-switcher.d.ts +12 -0
  267. package/dist/registry/chat/chat-input/chat-input-textarea.d.ts +9 -0
  268. package/dist/registry/chat/chat-input/compound.d.ts +97 -0
  269. package/dist/registry/chat/chat-input/context.d.ts +64 -0
  270. package/dist/registry/chat/chat-input/folder-permission-dialog.d.ts +11 -0
  271. package/dist/registry/chat/chat-input/index.d.ts +34 -0
  272. package/dist/registry/chat/chat-input/types.d.ts +79 -0
  273. package/dist/registry/chat/chat-input/useAutoResizeTextarea.d.ts +7 -0
  274. package/dist/registry/chat/code-block-part.d.ts +23 -0
  275. package/dist/registry/chat/file-attachment.d.ts +19 -0
  276. package/dist/registry/chat/file-card.d.ts +10 -0
  277. package/dist/registry/chat/file-review-part.d.ts +30 -0
  278. package/dist/registry/chat/folder-button.d.ts +20 -0
  279. package/dist/registry/chat/generated-images-grid.d.ts +15 -0
  280. package/dist/registry/chat/generation-status-bar.d.ts +19 -0
  281. package/dist/registry/chat/image-attachment.d.ts +19 -0
  282. package/dist/registry/chat/image-generating.d.ts +15 -0
  283. package/dist/registry/chat/markdown.d.ts +8 -0
  284. package/dist/registry/chat/mermaid-part.d.ts +17 -0
  285. package/dist/registry/chat/permission-card.d.ts +24 -0
  286. package/dist/registry/chat/plan-part.d.ts +30 -0
  287. package/dist/registry/chat/question-part.d.ts +24 -0
  288. package/dist/registry/chat/queue-indicator.d.ts +27 -0
  289. package/dist/registry/chat/reasoning-step.d.ts +35 -0
  290. package/dist/registry/chat/related-prompts.d.ts +23 -0
  291. package/dist/registry/chat/request.d.ts +6 -0
  292. package/dist/registry/chat/response.d.ts +28 -0
  293. package/dist/registry/chat/send-button.d.ts +17 -0
  294. package/dist/registry/chat/sidebar-menu.d.ts +23 -0
  295. package/dist/registry/chat/streaming-markdown-block.d.ts +8 -0
  296. package/dist/registry/chat/suggestion-part.d.ts +28 -0
  297. package/dist/registry/chat/task-part.d.ts +28 -0
  298. package/dist/registry/chat/terminal-code-block-part.d.ts +18 -0
  299. package/dist/registry/chat/thinking-indicator.d.ts +14 -0
  300. package/dist/registry/chat/tool-invocation-card.d.ts +20 -0
  301. package/dist/registry/chat/user-question/UserQuestionCard.d.ts +30 -0
  302. package/dist/registry/chat/user-question/UserQuestionFooter.d.ts +18 -0
  303. package/dist/registry/chat/user-question/UserQuestionHeader.d.ts +20 -0
  304. package/dist/registry/chat/user-question/index.d.ts +7 -0
  305. package/dist/registry/chat/user-question/types.d.ts +52 -0
  306. package/dist/registry/chat/user-question/useUserQuestionKeyboard.d.ts +18 -0
  307. package/dist/registry/chat/user-question/useUserQuestionState.d.ts +26 -0
  308. package/dist/registry/chat/user-question-answer.d.ts +13 -0
  309. package/dist/registry/lib/file-icon-maps.d.ts +20 -0
  310. package/dist/registry/lib/use-mermaid-render.d.ts +5 -0
  311. package/dist/registry/lib/utils.d.ts +11 -0
  312. package/dist/requirementDiagram-UZGBJVZJ-DcWaCuXr.js +850 -0
  313. package/dist/requirementDiagram-UZGBJVZJ-gfdlrFiq.cjs +64 -0
  314. package/dist/sankeyDiagram-TZEHDZUN-CQIKFwD0.js +810 -0
  315. package/dist/sankeyDiagram-TZEHDZUN-DvPtzQvC.cjs +10 -0
  316. package/dist/scale.css +307 -0
  317. package/dist/sequenceDiagram-WL72ISMW-BNrsMagL.cjs +145 -0
  318. package/dist/sequenceDiagram-WL72ISMW-iCX3ckKx.js +2511 -0
  319. package/dist/spark-design.cjs.js +265 -0
  320. package/dist/spark-design.es.js +13207 -0
  321. package/dist/src/components/chat/BrowserUsePart/index.d.ts +7 -0
  322. package/dist/src/components/chat/ChatInput/index.d.ts +29 -0
  323. package/dist/src/components/chat/CodeBlockPart/index.d.ts +7 -0
  324. package/dist/src/components/chat/CollapsibleCard/index.d.ts +7 -0
  325. package/dist/src/components/chat/FileAttachment/index.d.ts +3 -0
  326. package/dist/src/components/chat/FileCard/index.d.ts +3 -0
  327. package/dist/src/components/chat/FileReviewPart/index.d.ts +7 -0
  328. package/dist/src/components/chat/FolderButton/index.d.ts +5 -0
  329. package/dist/src/components/chat/GeneratedImagesGrid/index.d.ts +7 -0
  330. package/dist/src/components/chat/GenerationStatusBar/index.d.ts +7 -0
  331. package/dist/src/components/chat/ImageAttachment/index.d.ts +3 -0
  332. package/dist/src/components/chat/ImageGenerating/index.d.ts +6 -0
  333. package/dist/src/components/chat/Markdown/demo-content.d.ts +1 -0
  334. package/dist/src/components/chat/Markdown/index.d.ts +7 -0
  335. package/dist/src/components/chat/MermaidPart/index.d.ts +6 -0
  336. package/dist/src/components/chat/PermissionCard/index.d.ts +4 -0
  337. package/dist/src/components/chat/PlanPart/index.d.ts +6 -0
  338. package/dist/src/components/chat/QuestionPart/index.d.ts +6 -0
  339. package/dist/src/components/chat/QueueIndicator/index.d.ts +4 -0
  340. package/dist/src/components/chat/ReasoningStep/index.d.ts +7 -0
  341. package/dist/src/components/chat/RelatedPrompts/index.d.ts +6 -0
  342. package/dist/src/components/chat/Request/index.d.ts +7 -0
  343. package/dist/src/components/chat/Response/StreamingMarkdownBlock.d.ts +6 -0
  344. package/dist/src/components/chat/Response/index.d.ts +6 -0
  345. package/dist/src/components/chat/SendButton/index.d.ts +5 -0
  346. package/dist/src/components/chat/SidebarMenu/index.d.ts +4 -0
  347. package/dist/src/components/chat/SuggestionPart/index.d.ts +6 -0
  348. package/dist/src/components/chat/TaskPart/index.d.ts +7 -0
  349. package/dist/src/components/chat/TerminalCodeBlockPart/index.d.ts +6 -0
  350. package/dist/src/components/chat/ThinkingIndicator/index.d.ts +6 -0
  351. package/dist/src/components/chat/ToolInvocationCard/index.d.ts +4 -0
  352. package/dist/src/components/chat/UserQuestion/index.d.ts +5 -0
  353. package/dist/src/components/chat/UserQuestionAnswer/index.d.ts +3 -0
  354. package/dist/src/components/foundation/AlertDialog/index.d.ts +20 -0
  355. package/dist/src/components/foundation/Avatar/index.d.ts +7 -0
  356. package/dist/src/components/foundation/Button/index.d.ts +7 -0
  357. package/dist/src/components/foundation/Collapse/index.d.ts +15 -0
  358. package/dist/src/components/foundation/Collapsible/index.d.ts +7 -0
  359. package/dist/src/components/foundation/CollapsibleSection/index.d.ts +43 -0
  360. package/dist/src/components/foundation/DropdownMenu/index.d.ts +19 -0
  361. package/dist/src/components/foundation/EllipsisText/index.d.ts +53 -0
  362. package/dist/src/components/foundation/IconButton/index.d.ts +7 -0
  363. package/dist/src/components/foundation/Kbd/index.d.ts +7 -0
  364. package/dist/src/components/foundation/OptionList/index.d.ts +7 -0
  365. package/dist/src/components/foundation/Pagination/index.d.ts +7 -0
  366. package/dist/src/components/foundation/Progress/index.d.ts +7 -0
  367. package/dist/src/components/foundation/RadioGroup/index.d.ts +7 -0
  368. package/dist/src/components/foundation/Resizable/index.d.ts +7 -0
  369. package/dist/src/components/foundation/Scrollbar/index.d.ts +7 -0
  370. package/dist/src/components/foundation/Select/index.d.ts +17 -0
  371. package/dist/src/components/foundation/Skeleton/index.d.ts +7 -0
  372. package/dist/src/components/foundation/Slider/index.d.ts +7 -0
  373. package/dist/src/components/foundation/Spinner/index.d.ts +7 -0
  374. package/dist/src/components/foundation/Switch/index.d.ts +38 -0
  375. package/dist/src/components/foundation/Table/index.d.ts +7 -0
  376. package/dist/src/components/foundation/Tabs/index.d.ts +7 -0
  377. package/dist/src/components/foundation/Tag/index.d.ts +10 -0
  378. package/dist/src/components/foundation/Toast/index.d.ts +12 -0
  379. package/dist/src/components/foundation/Toggle/index.d.ts +7 -0
  380. package/dist/src/components/foundation/Tooltip/index.d.ts +21 -0
  381. package/dist/src/components/foundation/Typography/index.d.ts +7 -0
  382. package/dist/src/components/index.d.ts +136 -0
  383. package/dist/src/icons/context.d.ts +26 -0
  384. package/dist/src/icons/types.d.ts +18 -0
  385. package/dist/src/lib/ThemeStyleContext.d.ts +21 -0
  386. package/dist/src/lib/file-icon.d.ts +16 -0
  387. package/dist/src/lib/i18n.d.ts +12 -0
  388. package/dist/src/lib/index.d.ts +10 -0
  389. package/dist/src/lib/motion.d.ts +22 -0
  390. package/dist/src/lib/utils.d.ts +11 -0
  391. package/dist/stateDiagram-FKZM4ZOC-DBvJ_eeL.cjs +1 -0
  392. package/dist/stateDiagram-FKZM4ZOC-ZVsJlaHJ.js +263 -0
  393. package/dist/stateDiagram-v2-4FDKWEC3-CB_nTHcE.js +16 -0
  394. package/dist/stateDiagram-v2-4FDKWEC3-Xkx17v6T.cjs +1 -0
  395. package/dist/theme.css +804 -0
  396. package/dist/timeline-definition-IT6M3QCI-BmGkYQiz.cjs +61 -0
  397. package/dist/timeline-definition-IT6M3QCI-Ck8zTt6w.js +795 -0
  398. package/dist/treemap-GDKQZRPO-B9sfERx8.js +17922 -0
  399. package/dist/treemap-GDKQZRPO-BVfJRs0Z.cjs +160 -0
  400. package/dist/xychartDiagram-PRI3JC2R-By_S8NzN.js +1340 -0
  401. package/dist/xychartDiagram-PRI3JC2R-CNfDrGxM.cjs +7 -0
  402. package/package.json +111 -9
  403. package/index.js +0 -5
@@ -0,0 +1,230 @@
1
+ import { useState, useRef, useLayoutEffect, type ReactNode } from 'react'
2
+ import { motion, AnimatePresence } from 'framer-motion'
3
+ import { cn } from '@/lib/utils'
4
+ import { ArrowDownSLine } from './icons-inline'
5
+
6
+ export interface CollapsibleCardProps {
7
+ headerIcon?: ReactNode
8
+ headerTitle: ReactNode
9
+ headerRight?: ReactNode
10
+ children?: ReactNode
11
+ defaultExpanded?: boolean
12
+ /** CSS padding 如 '6px 8px',或 Tailwind 类 */
13
+ contentPadding?: string
14
+ onToggle?: (expanded: boolean) => void
15
+ collapsible?: boolean
16
+ footer?: ReactNode
17
+ contentMaxHeight?: number
18
+ /** 是否启用内容区底部展开/收起栏:内容高度超过 maxHeight 时显示,点击切换全部展开或收起 */
19
+ showExpandAllBar?: boolean
20
+ /** showExpandAllBar 为 true 时,未展开全部时的内容区最大高度(px) */
21
+ maxHeight?: number
22
+ titleShimmer?: boolean
23
+ className?: string
24
+ }
25
+
26
+ const DEFAULT_MAX_HEIGHT = 124
27
+
28
+ export function CollapsibleCard({
29
+ headerIcon,
30
+ headerTitle,
31
+ headerRight,
32
+ children,
33
+ defaultExpanded = true,
34
+ contentPadding = 'var(--spacing-1\.5) var(--spacing-2)',
35
+ onToggle,
36
+ collapsible = true,
37
+ footer,
38
+ contentMaxHeight,
39
+ showExpandAllBar = false,
40
+ maxHeight = DEFAULT_MAX_HEIGHT,
41
+ titleShimmer = false,
42
+ className,
43
+ }: CollapsibleCardProps) {
44
+ const [isExpanded, setIsExpanded] = useState(defaultExpanded)
45
+ const [isHovered, setIsHovered] = useState(false)
46
+ const [expandAll, setExpandAll] = useState(false)
47
+ const [shouldShowBar, setShouldShowBar] = useState(false)
48
+ const [contentHeight, setContentHeight] = useState(0)
49
+ const [isMeasuring, setIsMeasuring] = useState(showExpandAllBar && defaultExpanded)
50
+ const [isAnimating, setIsAnimating] = useState(false)
51
+ const measureRef = useRef<HTMLDivElement>(null)
52
+
53
+ useLayoutEffect(() => {
54
+ if (!showExpandAllBar || !isExpanded) {
55
+ setShouldShowBar(false)
56
+ setContentHeight(0)
57
+ setIsMeasuring(false)
58
+ return
59
+ }
60
+ setIsMeasuring(true)
61
+ const checkHeight = () => {
62
+ const el = measureRef.current
63
+ if (!el) return
64
+ const actualHeight = el.scrollHeight
65
+ setContentHeight(actualHeight)
66
+ setShouldShowBar(actualHeight > maxHeight)
67
+ setIsMeasuring(false)
68
+ }
69
+ const raf = requestAnimationFrame(checkHeight)
70
+ let resizeObserver: ResizeObserver | null = null
71
+ if (measureRef.current) {
72
+ resizeObserver = new ResizeObserver(checkHeight)
73
+ resizeObserver.observe(measureRef.current)
74
+ }
75
+ return () => {
76
+ cancelAnimationFrame(raf)
77
+ resizeObserver?.disconnect()
78
+ }
79
+ }, [showExpandAllBar, isExpanded, children, maxHeight])
80
+
81
+ const handleToggle = () => {
82
+ if (!collapsible) return
83
+ const next = !isExpanded
84
+ setIsAnimating(true)
85
+ if (next && showExpandAllBar) setIsMeasuring(true)
86
+ setIsExpanded(next)
87
+ onToggle?.(next)
88
+ setTimeout(() => setIsAnimating(false), 300)
89
+ }
90
+
91
+ const showArrow = collapsible && (isHovered || headerIcon == null)
92
+ const headerIconNode = showArrow
93
+ ? <ArrowDownSLine className={cn('w-[var(--font-size-sm)] h-[var(--font-size-sm)] shrink-0 transition-transform duration-200 text-text-secondary', isExpanded ? 'rotate-0' : '-rotate-90')} />
94
+ : headerIcon
95
+
96
+ const useExpandAllLogic = showExpandAllBar && isExpanded && !contentMaxHeight
97
+ const contentClamped = useExpandAllLogic && (isMeasuring || (shouldShowBar && !expandAll) || isAnimating || (!shouldShowBar && contentHeight === 0))
98
+ const contentMaxHeightStyle =
99
+ contentMaxHeight != null
100
+ ? `${contentMaxHeight}px`
101
+ : contentClamped
102
+ ? `${maxHeight}px`
103
+ : useExpandAllLogic && shouldShowBar && expandAll && contentHeight > 0
104
+ ? `${Math.max(contentHeight + 50, 2000)}px`
105
+ : undefined
106
+
107
+ return (
108
+ <div
109
+ className={cn(
110
+ 'rounded-md overflow-hidden border border-border-tertiary bg-fill-tertiary relative',
111
+ className
112
+ )}
113
+ >
114
+ <div
115
+ className={cn(
116
+ 'flex flex-row items-center gap-2 px-2 py-1.5 select-none',
117
+ isExpanded && 'border-b border-border-tertiary'
118
+ )}
119
+ onMouseEnter={() => collapsible && setIsHovered(true)}
120
+ onMouseLeave={() => collapsible && setIsHovered(false)}
121
+ >
122
+ <div
123
+ className={cn('flex flex-row items-center gap-2 flex-1 min-w-0', collapsible && 'cursor-pointer')}
124
+ onClick={handleToggle}
125
+ role={collapsible ? 'button' : undefined}
126
+ aria-expanded={collapsible ? isExpanded : undefined}
127
+ >
128
+ <div className="w-[var(--font-size-sm)] h-[var(--font-size-sm)] flex items-center justify-center shrink-0 text-text-secondary [&>svg]:w-[var(--font-size-sm)] [&>svg]:h-[var(--font-size-sm)]">
129
+ {headerIconNode}
130
+ </div>
131
+ <div className="min-w-0 flex-1 flex items-center text-xs leading-xs text-text-secondary">
132
+ {titleShimmer ? (
133
+ <span className="animate-pulse">{headerTitle}</span>
134
+ ) : (
135
+ headerTitle
136
+ )}
137
+ </div>
138
+ </div>
139
+ {headerRight != null && (
140
+ <div
141
+ className="flex items-center gap-1.5 shrink-0 relative z-10"
142
+ onClick={(e) => e.stopPropagation()}
143
+ onMouseDown={(e) => e.stopPropagation()}
144
+ >
145
+ {headerRight}
146
+ </div>
147
+ )}
148
+ </div>
149
+
150
+ <AnimatePresence initial={false}>
151
+ {isExpanded && (
152
+ <motion.div
153
+ initial={{ height: 0, opacity: 0 }}
154
+ animate={{ height: 'auto', opacity: 1 }}
155
+ exit={{ height: 0, opacity: 0 }}
156
+ transition={{ duration: 0.2, ease: [0.2, 0.8, 0.2, 1] }}
157
+ className={cn('overflow-hidden', isAnimating && 'select-none')}
158
+ >
159
+ {/* 隐藏测量用,用于获取内容实际高度 */}
160
+ {useExpandAllLogic && (
161
+ <div
162
+ ref={measureRef}
163
+ className="absolute invisible h-auto w-full pointer-events-none"
164
+ style={{ padding: contentPadding }}
165
+ aria-hidden
166
+ >
167
+ {children}
168
+ </div>
169
+ )}
170
+ <div
171
+ className={cn(
172
+ 'relative overflow-x-hidden bg-bg-base scrollbar-auto',
173
+ contentMaxHeight != null
174
+ ? 'overflow-y-auto'
175
+ : contentClamped
176
+ ? 'overflow-y-hidden'
177
+ : 'overflow-y-visible',
178
+ shouldShowBar && 'transition-[max-height] duration-300 ease-in-out'
179
+ )}
180
+ style={{
181
+ padding: contentPadding,
182
+ maxHeight: contentMaxHeightStyle,
183
+ }}
184
+ >
185
+ {children}
186
+ {/* 底部渐变遮罩:内容被截断且未展开全部时显示 */}
187
+ {useExpandAllLogic && shouldShowBar && contentHeight > maxHeight && (
188
+ <div
189
+ className={cn(
190
+ 'absolute bottom-0 left-0 right-0 pointer-events-none h-[25px] bg-gradient-to-b from-transparent to-[var(--color-bg-base)] transition-opacity duration-300',
191
+ expandAll ? 'opacity-0' : 'opacity-100'
192
+ )}
193
+ />
194
+ )}
195
+ </div>
196
+ {/* 内容区底部展开/收起栏:仅当内容高度超过 maxHeight 时显示 */}
197
+ {useExpandAllLogic && shouldShowBar && (
198
+ <button
199
+ type="button"
200
+ className="w-full h-4 flex items-center justify-center bg-bg-base border-0 cursor-pointer text-text-secondary hover:text-text transition-colors"
201
+ onClick={(e) => {
202
+ e.stopPropagation()
203
+ setIsAnimating(true)
204
+ setExpandAll((prev) => !prev)
205
+ setTimeout(() => setIsAnimating(false), 300)
206
+ }}
207
+ aria-label={expandAll ? '收起' : '展开全部'}
208
+ >
209
+ <ArrowDownSLine
210
+ className={cn(
211
+ 'w-[var(--font-size-sm)] h-[var(--font-size-sm)] transition-transform duration-200',
212
+ expandAll ? 'rotate-180' : 'rotate-0'
213
+ )}
214
+ />
215
+ </button>
216
+ )}
217
+ </motion.div>
218
+ )}
219
+ </AnimatePresence>
220
+
221
+ {footer != null && (
222
+ <div className="flex flex-row items-center gap-2 px-2 py-1.5 border-t border-border-tertiary">
223
+ {footer}
224
+ </div>
225
+ )}
226
+ </div>
227
+ )
228
+ }
229
+
230
+ CollapsibleCard.displayName = 'CollapsibleCard'
@@ -0,0 +1,21 @@
1
+ import * as React from 'react'
2
+ import * as CollapsiblePrimitive from '@radix-ui/react-collapsible'
3
+ import { cn } from '@/lib/utils'
4
+
5
+ const Collapsible = CollapsiblePrimitive.Root
6
+
7
+ const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger
8
+
9
+ const CollapsibleContent = React.forwardRef<
10
+ React.ElementRef<typeof CollapsiblePrimitive.CollapsibleContent>,
11
+ React.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.CollapsibleContent>
12
+ >(({ className, ...props }, ref) => (
13
+ <CollapsiblePrimitive.CollapsibleContent
14
+ ref={ref}
15
+ className={cn('overflow-hidden', className)}
16
+ {...props}
17
+ />
18
+ ))
19
+ CollapsibleContent.displayName = CollapsiblePrimitive.CollapsibleContent.displayName
20
+
21
+ export { Collapsible, CollapsibleTrigger, CollapsibleContent }
@@ -0,0 +1,254 @@
1
+ import * as React from 'react'
2
+ import { motion } from 'framer-motion'
3
+ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu'
4
+ import { cva, type VariantProps } from 'class-variance-authority'
5
+ import { cn } from '@/lib/utils'
6
+ import { ArrowRightLine, CheckLine } from './icons-inline'
7
+ import { getThemeFromDocument } from './theme-from-document'
8
+
9
+ /** 取消 outline/ring,避免与全局 *:focus-visible 冲突产生偶现 focus 环 */
10
+ const FOCUS_RESET =
11
+ 'outline-none focus:outline-none focus:ring-0 focus-visible:outline-none focus-visible:ring-0 focus-visible:!outline-none focus-visible:!ring-0 focus-visible:outline-offset-0 focus-visible:!outline-offset-0 focus-visible:ring-offset-0 focus-visible:!ring-offset-0'
12
+
13
+ const DropdownMenu = DropdownMenuPrimitive.Root
14
+ const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger
15
+ const DropdownMenuGroup = DropdownMenuPrimitive.Group
16
+ const DropdownMenuPortal = DropdownMenuPrimitive.Portal
17
+ const DropdownMenuSub = DropdownMenuPrimitive.Sub
18
+ const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup
19
+
20
+ const contentClasses =
21
+ 'min-w-32 overflow-hidden rounded-lg border border-border-tertiary bg-bg-container p-1 text-text shadow-lg z-50 outline-none focus:outline-none focus:ring-0 focus-visible:outline-none focus-visible:ring-0 focus-visible:!outline-none focus-visible:!ring-0'
22
+
23
+ export interface DropdownMenuContentProps
24
+ extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content> {
25
+ /** When provided (e.g. from ThemeStyleProvider), used for portal wrapper */
26
+ dataStyle?: string
27
+ dataTheme?: string
28
+ }
29
+
30
+ const DropdownMenuContent = React.forwardRef<
31
+ React.ElementRef<typeof DropdownMenuPrimitive.Content>,
32
+ DropdownMenuContentProps
33
+ >(({ className, sideOffset = 4, children, dataStyle, dataTheme, ...props }, ref) => {
34
+ const fromDoc = getThemeFromDocument()
35
+ const dataProps =
36
+ dataStyle !== undefined
37
+ ? { 'data-style': dataStyle, 'data-theme': dataTheme ?? fromDoc['data-theme'] ?? '' }
38
+ : fromDoc
39
+ return (
40
+ <DropdownMenuPrimitive.Portal>
41
+ <div style={{ display: 'contents' }} {...dataProps}>
42
+ <DropdownMenuPrimitive.Content
43
+ ref={ref}
44
+ sideOffset={sideOffset}
45
+ className={cn(contentClasses, className)}
46
+ {...props}
47
+ >
48
+ <motion.div
49
+ initial={{ opacity: 0 }}
50
+ animate={{ opacity: 1 }}
51
+ transition={{ duration: 0.15, ease: [0.4, 0, 0.2, 1] }}
52
+ >
53
+ {children}
54
+ </motion.div>
55
+ </DropdownMenuPrimitive.Content>
56
+ </div>
57
+ </DropdownMenuPrimitive.Portal>
58
+ )
59
+ })
60
+ DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName
61
+
62
+ const subTriggerVariants = cva(
63
+ 'flex h-9 w-full cursor-pointer select-none items-center gap-2 rounded-sm px-3 text-sm outline-none focus:outline-none focus:ring-0 focus-visible:outline-none focus-visible:ring-0 focus-visible:!outline-none hover:bg-fill-secondary focus:bg-fill-secondary data-[highlighted]:bg-fill-secondary data-[state=open]:bg-fill-secondary',
64
+ {
65
+ variants: {
66
+ inset: { true: 'pl-8 pr-3', false: '' },
67
+ },
68
+ defaultVariants: { inset: false },
69
+ }
70
+ )
71
+
72
+ const DropdownMenuSubTrigger = React.forwardRef<
73
+ React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
74
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> &
75
+ VariantProps<typeof subTriggerVariants> & { subTriggerIcon?: React.ReactNode }
76
+ >(({ className, inset = false, children, subTriggerIcon, ...rest }, ref) => (
77
+ <DropdownMenuPrimitive.SubTrigger
78
+ ref={ref}
79
+ className={subTriggerVariants({ inset, className })}
80
+ {...rest}
81
+ >
82
+ {children}
83
+ <span className="ml-auto flex h-4 w-4 items-center justify-center">
84
+ {subTriggerIcon ?? <ArrowRightLine className="h-4 w-4" />}
85
+ </span>
86
+ </DropdownMenuPrimitive.SubTrigger>
87
+ ))
88
+ DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName
89
+
90
+ export interface DropdownMenuSubContentProps
91
+ extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent> {
92
+ /** When provided (e.g. from ThemeStyleProvider), used for portal wrapper */
93
+ dataStyle?: string
94
+ dataTheme?: string
95
+ }
96
+
97
+ const DropdownMenuSubContent = React.forwardRef<
98
+ React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
99
+ DropdownMenuSubContentProps
100
+ >(({ className, sideOffset = -1, dataStyle, dataTheme, ...props }, ref) => {
101
+ const fromDoc = getThemeFromDocument()
102
+ const dataProps =
103
+ dataStyle !== undefined
104
+ ? { 'data-style': dataStyle, 'data-theme': dataTheme ?? fromDoc['data-theme'] ?? '' }
105
+ : fromDoc
106
+ return (
107
+ <DropdownMenuPrimitive.Portal>
108
+ <div style={{ display: 'contents' }} {...dataProps}>
109
+ <DropdownMenuPrimitive.SubContent
110
+ ref={ref}
111
+ sideOffset={sideOffset}
112
+ className={cn(contentClasses, className)}
113
+ {...props}
114
+ />
115
+ </div>
116
+ </DropdownMenuPrimitive.Portal>
117
+ )
118
+ })
119
+ DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName
120
+
121
+ const itemVariants = cva(
122
+ 'relative flex h-9 w-full min-w-0 cursor-pointer select-none items-center gap-2 rounded-sm px-3 text-sm outline-none focus:outline-none focus:ring-0 focus-visible:outline-none focus-visible:ring-0 focus-visible:!outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
123
+ {
124
+ variants: {
125
+ variant: {
126
+ default:
127
+ 'hover:bg-fill-secondary focus:bg-fill-secondary focus:text-text data-[highlighted]:bg-fill-secondary data-[highlighted]:text-text',
128
+ destructive:
129
+ 'text-error hover:bg-error-bg focus:bg-error-bg focus:text-error data-[highlighted]:bg-error-bg data-[highlighted]:text-error',
130
+ },
131
+ inset: { true: 'pl-8 pr-3', false: '' },
132
+ },
133
+ defaultVariants: { variant: 'default', inset: false },
134
+ }
135
+ )
136
+
137
+ const DropdownMenuItem = React.forwardRef<
138
+ React.ElementRef<typeof DropdownMenuPrimitive.Item>,
139
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> &
140
+ VariantProps<typeof itemVariants>
141
+ >(({ className, inset = false, variant = 'default', ...props }, ref) => (
142
+ <DropdownMenuPrimitive.Item
143
+ ref={ref}
144
+ className={itemVariants({ variant, inset, className })}
145
+ {...props}
146
+ />
147
+ ))
148
+ DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName
149
+
150
+ const itemIndicatorClasses =
151
+ 'relative flex h-9 w-full min-w-0 cursor-pointer select-none items-center gap-2 rounded-sm pl-8 pr-3 text-sm outline-none transition-colors hover:bg-fill-secondary focus:bg-fill-secondary focus:text-text data-[highlighted]:bg-fill-secondary data-[highlighted]:text-text data-[disabled]:pointer-events-none data-[disabled]:opacity-50'
152
+
153
+ const DropdownMenuCheckboxItem = React.forwardRef<
154
+ React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
155
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem> & { checkIcon?: React.ReactNode }
156
+ >(({ className, children, checked, checkIcon, ...rest }, ref) => (
157
+ <DropdownMenuPrimitive.CheckboxItem
158
+ ref={ref}
159
+ className={cn(itemIndicatorClasses, className)}
160
+ checked={checked}
161
+ {...rest}
162
+ >
163
+ <span className="absolute left-2 top-1/2 flex h-3.5 w-3.5 -translate-y-1/2 items-center justify-center">
164
+ <DropdownMenuPrimitive.ItemIndicator>
165
+ {checkIcon ?? <CheckLine className="h-4 w-4" />}
166
+ </DropdownMenuPrimitive.ItemIndicator>
167
+ </span>
168
+ {children}
169
+ </DropdownMenuPrimitive.CheckboxItem>
170
+ ))
171
+ DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName
172
+
173
+ const DropdownMenuRadioItem = React.forwardRef<
174
+ React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
175
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
176
+ >(({ className, children, ...props }, ref) => (
177
+ <DropdownMenuPrimitive.RadioItem
178
+ ref={ref}
179
+ className={cn(itemIndicatorClasses, className)}
180
+ {...props}
181
+ >
182
+ <span className="absolute left-2 top-1/2 flex h-3.5 w-3.5 -translate-y-1/2 items-center justify-center">
183
+ <DropdownMenuPrimitive.ItemIndicator>
184
+ <div className="h-2 w-2 rounded-full bg-primary" />
185
+ </DropdownMenuPrimitive.ItemIndicator>
186
+ </span>
187
+ {children}
188
+ </DropdownMenuPrimitive.RadioItem>
189
+ ))
190
+ DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName
191
+
192
+ const labelVariants = cva(
193
+ 'flex h-9 items-center px-3 text-sm font-semibold text-text-secondary',
194
+ {
195
+ variants: {
196
+ inset: { true: 'pl-8 pr-3', false: '' },
197
+ },
198
+ defaultVariants: { inset: false },
199
+ }
200
+ )
201
+
202
+ const DropdownMenuLabel = React.forwardRef<
203
+ React.ElementRef<typeof DropdownMenuPrimitive.Label>,
204
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> &
205
+ VariantProps<typeof labelVariants>
206
+ >(({ className, inset = false, ...props }, ref) => (
207
+ <DropdownMenuPrimitive.Label
208
+ ref={ref}
209
+ className={labelVariants({ inset, className })}
210
+ {...props}
211
+ />
212
+ ))
213
+ DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName
214
+
215
+ const DropdownMenuSeparator = React.forwardRef<
216
+ React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
217
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
218
+ >(({ className, ...props }, ref) => (
219
+ <DropdownMenuPrimitive.Separator
220
+ ref={ref}
221
+ className={cn('my-1 mx-1 h-px bg-border-tertiary', className)}
222
+ {...props}
223
+ />
224
+ ))
225
+ DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName
226
+
227
+ const DropdownMenuShortcut = ({
228
+ className,
229
+ ...props
230
+ }: React.HTMLAttributes<HTMLSpanElement>) => (
231
+ <span
232
+ className={cn('ml-auto text-xs tracking-widest text-text-tertiary', className)}
233
+ {...props}
234
+ />
235
+ )
236
+ DropdownMenuShortcut.displayName = 'DropdownMenuShortcut'
237
+
238
+ export {
239
+ DropdownMenu,
240
+ DropdownMenuTrigger,
241
+ DropdownMenuContent,
242
+ DropdownMenuItem,
243
+ DropdownMenuCheckboxItem,
244
+ DropdownMenuRadioItem,
245
+ DropdownMenuLabel,
246
+ DropdownMenuSeparator,
247
+ DropdownMenuShortcut,
248
+ DropdownMenuGroup,
249
+ DropdownMenuPortal,
250
+ DropdownMenuSub,
251
+ DropdownMenuSubContent,
252
+ DropdownMenuSubTrigger,
253
+ DropdownMenuRadioGroup,
254
+ }
@@ -0,0 +1,66 @@
1
+ import { forwardRef } from 'react'
2
+ import type { ButtonHTMLAttributes, ReactNode } from 'react'
3
+ import { cva, type VariantProps } from 'class-variance-authority'
4
+ import { cn } from '@/lib/utils'
5
+
6
+ const iconButtonVariants = cva(
7
+ 'flex-none shrink-0 inline-flex items-center justify-center box-border transition-colors duration-200 focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer [&>*]:flex [&>*]:items-center [&>*]:justify-center [&>*]:size-full [&>*]:[&>svg]:block [&>*]:[&>svg]:leading-none',
8
+ {
9
+ variants: {
10
+ variant: {
11
+ primary: 'bg-primary text-text-on-primary hover:bg-primary-hover',
12
+ secondary: 'bg-bg-highlight text-text-on-primary hover:bg-bg-highlight-hover',
13
+ tertiary: 'bg-fill-secondary text-text hover:bg-fill',
14
+ ghost: 'bg-transparent text-text-secondary hover:bg-fill-secondary hover:text-text',
15
+ iconOnly: 'bg-transparent text-text-secondary hover:text-text',
16
+ },
17
+ rounded: {
18
+ square: 'rounded',
19
+ pill: 'rounded-full',
20
+ },
21
+ size: {
22
+ sm: 'h-7 w-7 min-h-7 min-w-7 p-1.5',
23
+ md: 'h-9 w-9 min-h-9 min-w-9 p-1.5',
24
+ lg: 'h-11 w-11 min-h-11 min-w-11 p-2',
25
+ },
26
+ },
27
+ defaultVariants: {
28
+ variant: 'secondary',
29
+ size: 'md',
30
+ rounded: 'square',
31
+ },
32
+ }
33
+ )
34
+
35
+ export interface IconButtonProps
36
+ extends ButtonHTMLAttributes<HTMLButtonElement>,
37
+ VariantProps<typeof iconButtonVariants> {
38
+ icon: ReactNode
39
+ }
40
+
41
+ export const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(
42
+ (
43
+ {
44
+ variant = 'secondary',
45
+ size = 'md',
46
+ rounded = 'square',
47
+ icon,
48
+ disabled = false,
49
+ className,
50
+ ...props
51
+ },
52
+ ref
53
+ ) => (
54
+ <button
55
+ ref={ref}
56
+ className={cn(iconButtonVariants({ variant, size, rounded }), className)}
57
+ disabled={disabled}
58
+ {...props}
59
+ >
60
+ <span className="inline-flex shrink-0 size-full items-center justify-center">{icon}</span>
61
+ </button>
62
+ )
63
+ )
64
+ IconButton.displayName = 'IconButton'
65
+
66
+ export { iconButtonVariants }