sparkdesign 0.4.6 → 0.4.7

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 (252) hide show
  1. package/AI_README.md +60 -0
  2. package/README.md +1 -1
  3. package/cli/dist/commands/add.js +1 -1
  4. package/cli/dist/commands/init.js +1 -1
  5. package/cli/registry/AGENTS.md +9 -2
  6. package/cli/registry/agent-manifest.json +794 -0
  7. package/cli/registry/basic/alert.tsx +76 -0
  8. package/cli/registry/basic/aspect-ratio.tsx +8 -0
  9. package/cli/registry/basic/breadcrumb.tsx +117 -0
  10. package/cli/registry/basic/button-group.tsx +79 -0
  11. package/cli/registry/basic/button.tsx +1 -1
  12. package/cli/registry/basic/calendar.tsx +221 -0
  13. package/cli/registry/basic/card.tsx +103 -0
  14. package/cli/registry/basic/carousel.tsx +241 -0
  15. package/cli/registry/basic/chart.tsx +372 -0
  16. package/cli/registry/basic/checkbox.tsx +42 -0
  17. package/cli/registry/basic/collapsible-card.tsx +2 -2
  18. package/cli/registry/basic/combobox.tsx +75 -0
  19. package/cli/registry/basic/command.tsx +184 -0
  20. package/cli/registry/basic/context-menu.tsx +239 -0
  21. package/cli/registry/basic/data-table.tsx +73 -0
  22. package/cli/registry/basic/date-picker.tsx +13 -0
  23. package/cli/registry/basic/dialog.tsx +169 -0
  24. package/cli/registry/basic/direction.tsx +25 -0
  25. package/cli/registry/basic/drawer.tsx +164 -0
  26. package/cli/registry/basic/dropdown-menu.tsx +0 -4
  27. package/cli/registry/basic/empty.tsx +104 -0
  28. package/cli/registry/basic/field.tsx +248 -0
  29. package/cli/registry/basic/hover-card.tsx +58 -0
  30. package/cli/registry/basic/input-group.tsx +168 -0
  31. package/cli/registry/basic/input-otp.tsx +75 -0
  32. package/cli/registry/basic/input.tsx +27 -0
  33. package/cli/registry/basic/item.tsx +204 -0
  34. package/cli/registry/basic/label.tsx +24 -0
  35. package/cli/registry/basic/menubar.tsx +274 -0
  36. package/cli/registry/basic/native-select.tsx +62 -0
  37. package/cli/registry/basic/navigation-menu.tsx +168 -0
  38. package/cli/registry/basic/popover.tsx +59 -0
  39. package/cli/registry/basic/scroll-area.tsx +58 -0
  40. package/cli/registry/basic/select.tsx +2 -1
  41. package/cli/registry/basic/separator.tsx +26 -0
  42. package/cli/registry/basic/sheet.tsx +18 -0
  43. package/cli/registry/basic/textarea.tsx +25 -0
  44. package/cli/registry/basic/toggle.tsx +1 -1
  45. package/cli/registry/basic/typography.tsx +1 -1
  46. package/cli/registry/chat/chat-input/chat-input-textarea.tsx +1 -1
  47. package/cli/registry/chat/chat-input/compound.tsx +4 -3
  48. package/cli/registry/chat/chat-input/context.tsx +4 -1
  49. package/cli/registry/chat/code-block-part.tsx +1 -1
  50. package/cli/registry/chat/conversation-anchor-nav.tsx +349 -0
  51. package/cli/registry/chat/file-attachment.tsx +2 -1
  52. package/cli/registry/chat/file-review-part.tsx +21 -21
  53. package/cli/registry/chat/markdown.tsx +2 -2
  54. package/cli/registry/chat/queue-indicator.tsx +1 -0
  55. package/cli/registry/chat/streaming-markdown-block.tsx +12 -8
  56. package/cli/registry/chat/tool-invocation-card.tsx +4 -1
  57. package/cli/registry/lib/file-icon-maps.ts +22 -22
  58. package/cli/registry/meta.json +518 -0
  59. package/cli/registry/tokens/ontology.json +404 -0
  60. package/cli/registry/tokens/scale/presets/compact.css +16 -5
  61. package/cli/registry/tokens/scale/presets/dense.css +13 -2
  62. package/cli/registry/tokens/scale/presets/sharp.css +18 -6
  63. package/cli/registry/tokens/scale/presets/soft.css +23 -1
  64. package/dist/registry/basic/alert.d.ts +24 -0
  65. package/dist/registry/basic/aspect-ratio.d.ts +16 -0
  66. package/dist/registry/basic/breadcrumb.d.ts +24 -0
  67. package/dist/registry/basic/button-group.d.ts +26 -0
  68. package/dist/registry/basic/button.d.ts +1 -1
  69. package/dist/registry/basic/calendar.d.ts +22 -0
  70. package/dist/registry/basic/card.d.ts +27 -0
  71. package/dist/registry/basic/carousel.d.ts +19 -0
  72. package/dist/registry/basic/chart.d.ts +55 -0
  73. package/dist/registry/basic/checkbox.d.ts +21 -0
  74. package/dist/registry/basic/combobox.d.ts +26 -0
  75. package/dist/registry/basic/command.d.ts +18 -0
  76. package/dist/registry/basic/context-menu.d.ts +44 -0
  77. package/dist/registry/basic/data-table.d.ts +26 -0
  78. package/dist/registry/basic/date-picker.d.ts +18 -0
  79. package/dist/registry/basic/dialog.d.ts +39 -0
  80. package/dist/registry/basic/direction.d.ts +19 -0
  81. package/dist/registry/basic/drawer.d.ts +37 -0
  82. package/dist/registry/basic/empty.d.ts +22 -0
  83. package/dist/registry/basic/field.d.ts +24 -0
  84. package/dist/registry/basic/hover-card.d.ts +22 -0
  85. package/dist/registry/basic/input-group.d.ts +27 -0
  86. package/dist/registry/basic/input-otp.d.ts +22 -0
  87. package/dist/registry/basic/input.d.ts +15 -0
  88. package/dist/registry/basic/item.d.ts +34 -0
  89. package/dist/registry/basic/label.d.ts +16 -0
  90. package/dist/registry/basic/menubar.d.ts +37 -0
  91. package/dist/registry/basic/native-select.d.ts +18 -0
  92. package/dist/registry/basic/navigation-menu.d.ts +25 -0
  93. package/dist/registry/basic/popover.d.ts +23 -0
  94. package/dist/registry/basic/scroll-area.d.ts +5 -0
  95. package/dist/registry/basic/separator.d.ts +16 -0
  96. package/dist/registry/basic/sheet.d.ts +13 -0
  97. package/dist/registry/basic/textarea.d.ts +15 -0
  98. package/dist/registry/basic/toggle.d.ts +1 -1
  99. package/dist/registry/chat/chat-input/context.d.ts +3 -1
  100. package/dist/registry/chat/conversation-anchor-nav.d.ts +72 -0
  101. package/dist/registry/chat/tool-invocation-card.d.ts +2 -0
  102. package/dist/scale/presets/compact.css +16 -5
  103. package/dist/scale/presets/dense.css +13 -2
  104. package/dist/scale/presets/sharp.css +18 -6
  105. package/dist/scale/presets/soft.css +23 -1
  106. package/dist/spark-design.cjs.js +40 -36
  107. package/dist/spark-design.es.js +8647 -8657
  108. package/dist/sparkdesign.css +1 -1
  109. package/dist/src/components/basic/Alert/index.d.ts +13 -0
  110. package/dist/src/components/basic/AspectRatio/index.d.ts +13 -0
  111. package/dist/src/components/basic/Breadcrumb/index.d.ts +12 -0
  112. package/dist/src/components/basic/ButtonGroup/index.d.ts +13 -0
  113. package/dist/src/components/basic/Calendar/index.d.ts +13 -0
  114. package/dist/src/components/basic/Card/index.d.ts +13 -0
  115. package/dist/src/components/basic/Carousel/index.d.ts +12 -0
  116. package/dist/src/components/basic/Chart/index.d.ts +13 -0
  117. package/dist/src/components/basic/Checkbox/index.d.ts +13 -0
  118. package/dist/src/components/basic/Combobox/index.d.ts +13 -0
  119. package/dist/src/components/basic/Command/index.d.ts +12 -0
  120. package/dist/src/components/basic/ContextMenu/index.d.ts +19 -0
  121. package/dist/src/components/basic/DataTable/index.d.ts +13 -0
  122. package/dist/src/components/basic/DatePicker/index.d.ts +13 -0
  123. package/dist/src/components/basic/Dialog/index.d.ts +16 -0
  124. package/dist/src/components/basic/Direction/index.d.ts +13 -0
  125. package/dist/src/components/basic/Drawer/index.d.ts +16 -0
  126. package/dist/src/components/basic/Empty/index.d.ts +12 -0
  127. package/dist/src/components/basic/Field/index.d.ts +12 -0
  128. package/dist/src/components/basic/HoverCard/index.d.ts +16 -0
  129. package/dist/src/components/basic/Input/index.d.ts +13 -0
  130. package/dist/src/components/basic/InputGroup/index.d.ts +12 -0
  131. package/dist/src/components/basic/InputOTP/index.d.ts +12 -0
  132. package/dist/src/components/basic/Item/index.d.ts +12 -0
  133. package/dist/src/components/basic/Label/index.d.ts +13 -0
  134. package/dist/src/components/basic/Menubar/index.d.ts +12 -0
  135. package/dist/src/components/basic/NativeSelect/index.d.ts +12 -0
  136. package/dist/src/components/basic/NavigationMenu/index.d.ts +12 -0
  137. package/dist/src/components/basic/Popover/index.d.ts +16 -0
  138. package/dist/src/components/basic/ScrollArea/index.d.ts +12 -0
  139. package/dist/src/components/basic/Separator/index.d.ts +13 -0
  140. package/dist/src/components/basic/Sheet/index.d.ts +13 -0
  141. package/dist/src/components/basic/Textarea/index.d.ts +13 -0
  142. package/dist/src/components/chat/ConversationAnchorNav/index.d.ts +13 -0
  143. package/dist/src/components/chat/StreamingMarkdownBlock/index.d.ts +13 -0
  144. package/dist/src/components/index.d.ts +57 -0
  145. package/dist/tokens/AGENTS.md +1 -0
  146. package/dist/tokens/scale/presets/compact.css +16 -5
  147. package/dist/tokens/scale/presets/dense.css +13 -2
  148. package/dist/tokens/scale/presets/sharp.css +18 -6
  149. package/dist/tokens/scale/presets/soft.css +23 -1
  150. package/docs/agent/component-selection.md +60 -0
  151. package/docs/agent/token-ontology.md +37 -0
  152. package/package.json +31 -5
  153. package/registry/agent-manifest.json +794 -0
  154. package/registry/tokens/ontology.json +404 -0
  155. package/dist/_basePickBy-DnQN8w3y.js +0 -151
  156. package/dist/_basePickBy-a-kPMlkg.cjs +0 -1
  157. package/dist/_baseUniq-B-N2NQ50.js +0 -614
  158. package/dist/_baseUniq-Cc_zbSif.cjs +0 -1
  159. package/dist/arc-BQBhijZ6.js +0 -83
  160. package/dist/arc-mWQt0Yph.cjs +0 -1
  161. package/dist/architectureDiagram-VXUJARFQ-BMZEucno.cjs +0 -36
  162. package/dist/architectureDiagram-VXUJARFQ-DTdjD3Bp.js +0 -4661
  163. package/dist/blockDiagram-VD42YOAC-CzHn0yob.js +0 -2256
  164. package/dist/blockDiagram-VD42YOAC-DDxdHAlz.cjs +0 -122
  165. package/dist/c4Diagram-YG6GDRKO-4Gz0I4gj.cjs +0 -10
  166. package/dist/c4Diagram-YG6GDRKO-BIy--yVN.js +0 -1580
  167. package/dist/channel-BQn0o8bs.js +0 -5
  168. package/dist/channel-DaN7XniJ.cjs +0 -1
  169. package/dist/chunk-4BX2VUAB-BlQFTQqz.cjs +0 -1
  170. package/dist/chunk-4BX2VUAB-Czitj3Kc.js +0 -8
  171. package/dist/chunk-55IACEB6-DXacNZbO.js +0 -8
  172. package/dist/chunk-55IACEB6-DnDxpye9.cjs +0 -1
  173. package/dist/chunk-B4BG7PRW-CBdN0q_V.js +0 -1375
  174. package/dist/chunk-B4BG7PRW-DbGvUkGO.cjs +0 -165
  175. package/dist/chunk-DI55MBZ5-D1YJMs6x.cjs +0 -220
  176. package/dist/chunk-DI55MBZ5-NCQTvayw.js +0 -1370
  177. package/dist/chunk-FMBD7UC4-CsGMbrtr.js +0 -19
  178. package/dist/chunk-FMBD7UC4-Di7cUUh5.cjs +0 -15
  179. package/dist/chunk-QN33PNHL-0j5LC8Lm.cjs +0 -1
  180. package/dist/chunk-QN33PNHL-3GERZBRm.js +0 -19
  181. package/dist/chunk-QZHKN3VN-AVEY9ImQ.js +0 -15
  182. package/dist/chunk-QZHKN3VN-s8Z0a8mc.cjs +0 -1
  183. package/dist/chunk-TZMSLE5B-CAf87HPt.cjs +0 -1
  184. package/dist/chunk-TZMSLE5B-sbiflal0.js +0 -64
  185. package/dist/classDiagram-2ON5EDUG-Ct9JLIN2.cjs +0 -1
  186. package/dist/classDiagram-2ON5EDUG-Dzfrft3a.js +0 -16
  187. package/dist/classDiagram-v2-WZHVMYZB-Ct9JLIN2.cjs +0 -1
  188. package/dist/classDiagram-v2-WZHVMYZB-Dzfrft3a.js +0 -16
  189. package/dist/clone-Cde_NQ8V.js +0 -8
  190. package/dist/clone-DCNjWuM2.cjs +0 -1
  191. package/dist/cose-bilkent-S5V4N54A-0uLijMro.cjs +0 -1
  192. package/dist/cose-bilkent-S5V4N54A-Bb08N431.js +0 -2608
  193. package/dist/cytoscape.esm-CNUX3VTg.cjs +0 -321
  194. package/dist/cytoscape.esm-Cvf3sx9F.js +0 -18704
  195. package/dist/dagre-6UL2VRFP-CY_Wz5Zd.js +0 -444
  196. package/dist/dagre-6UL2VRFP-Dxe7_qZc.cjs +0 -4
  197. package/dist/defaultLocale-BgPVtth8.js +0 -171
  198. package/dist/defaultLocale-C4wbwF1n.cjs +0 -1
  199. package/dist/diagram-PSM6KHXK-D2bdb7MT.js +0 -531
  200. package/dist/diagram-PSM6KHXK-YF69SUjY.cjs +0 -24
  201. package/dist/diagram-QEK2KX5R-BpUSoh0-.js +0 -217
  202. package/dist/diagram-QEK2KX5R-DZPGteon.cjs +0 -43
  203. package/dist/diagram-S2PKOQOG-ht-zdvFG.cjs +0 -24
  204. package/dist/diagram-S2PKOQOG-zFeLJ50Z.js +0 -142
  205. package/dist/erDiagram-Q2GNP2WA-B38iJ6ts.js +0 -841
  206. package/dist/erDiagram-Q2GNP2WA-RgS80DDU.cjs +0 -60
  207. package/dist/flowDiagram-NV44I4VS-BHilOs2p.cjs +0 -162
  208. package/dist/flowDiagram-NV44I4VS-BrBJcoce.js +0 -1620
  209. package/dist/ganttDiagram-JELNMOA3-pZiJeFio.cjs +0 -267
  210. package/dist/ganttDiagram-JELNMOA3-tw6FhkWJ.js +0 -2670
  211. package/dist/gitGraphDiagram-V2S2FVAM-BWn5uIK5.js +0 -699
  212. package/dist/gitGraphDiagram-V2S2FVAM-DKKeG-9R.cjs +0 -65
  213. package/dist/graph-DIbblrZP.cjs +0 -1
  214. package/dist/graph-DPcK91G3.js +0 -247
  215. package/dist/infoDiagram-HS3SLOUP-B8gwwhct.cjs +0 -2
  216. package/dist/infoDiagram-HS3SLOUP-D47PNcP_.js +0 -24
  217. package/dist/init-CHZsXQcr.cjs +0 -1
  218. package/dist/init-DjUOC4st.js +0 -16
  219. package/dist/journeyDiagram-XKPGCS4Q-BG3cfhyU.js +0 -834
  220. package/dist/journeyDiagram-XKPGCS4Q-D8DVLJof.cjs +0 -139
  221. package/dist/kanban-definition-3W4ZIXB7-4OCnEouP.cjs +0 -89
  222. package/dist/kanban-definition-3W4ZIXB7-CWi_ssF9.js +0 -719
  223. package/dist/layout-Byuh8f-J.cjs +0 -1
  224. package/dist/layout-CdLdvj1j.js +0 -1335
  225. package/dist/linear-C2Q_PI9B.js +0 -259
  226. package/dist/linear-C69aPBW1.cjs +0 -1
  227. package/dist/mermaid.core-DBwAx_jp.cjs +0 -249
  228. package/dist/mermaid.core-gFR0XUlD.js +0 -15300
  229. package/dist/mindmap-definition-VGOIOE7T-8P7obVV4.cjs +0 -68
  230. package/dist/mindmap-definition-VGOIOE7T-DnOa7WJ9.js +0 -784
  231. package/dist/ordinal-B6-f3MAq.js +0 -61
  232. package/dist/ordinal-CagbB1m8.cjs +0 -1
  233. package/dist/pieDiagram-ADFJNKIX-5NAlvhMo.js +0 -161
  234. package/dist/pieDiagram-ADFJNKIX-CQBG4yR9.cjs +0 -30
  235. package/dist/quadrantDiagram-AYHSOK5B-Oe4y7RZ0.cjs +0 -7
  236. package/dist/quadrantDiagram-AYHSOK5B-rh2DPEP1.js +0 -1022
  237. package/dist/requirementDiagram-UZGBJVZJ-DcWaCuXr.js +0 -850
  238. package/dist/requirementDiagram-UZGBJVZJ-gfdlrFiq.cjs +0 -64
  239. package/dist/sankeyDiagram-TZEHDZUN-CQIKFwD0.js +0 -810
  240. package/dist/sankeyDiagram-TZEHDZUN-DvPtzQvC.cjs +0 -10
  241. package/dist/sequenceDiagram-WL72ISMW-BNrsMagL.cjs +0 -145
  242. package/dist/sequenceDiagram-WL72ISMW-iCX3ckKx.js +0 -2511
  243. package/dist/stateDiagram-FKZM4ZOC-DBvJ_eeL.cjs +0 -1
  244. package/dist/stateDiagram-FKZM4ZOC-ZVsJlaHJ.js +0 -263
  245. package/dist/stateDiagram-v2-4FDKWEC3-CB_nTHcE.js +0 -16
  246. package/dist/stateDiagram-v2-4FDKWEC3-Xkx17v6T.cjs +0 -1
  247. package/dist/timeline-definition-IT6M3QCI-BmGkYQiz.cjs +0 -61
  248. package/dist/timeline-definition-IT6M3QCI-Ck8zTt6w.js +0 -795
  249. package/dist/treemap-GDKQZRPO-B9sfERx8.js +0 -17922
  250. package/dist/treemap-GDKQZRPO-BVfJRs0Z.cjs +0 -160
  251. package/dist/xychartDiagram-PRI3JC2R-By_S8NzN.js +0 -1340
  252. package/dist/xychartDiagram-PRI3JC2R-CNfDrGxM.cjs +0 -7
@@ -0,0 +1,241 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import useEmblaCarousel, {
5
+ type UseEmblaCarouselType,
6
+ } from "embla-carousel-react"
7
+ import { ArrowLeft, ArrowRight } from "lucide-react"
8
+
9
+ import { cn } from "@/lib/utils"
10
+ import { Button } from "./button"
11
+
12
+ type CarouselApi = UseEmblaCarouselType[1]
13
+ type UseCarouselParameters = Parameters<typeof useEmblaCarousel>
14
+ type CarouselOptions = UseCarouselParameters[0]
15
+ type CarouselPlugin = UseCarouselParameters[1]
16
+
17
+ type CarouselProps = {
18
+ opts?: CarouselOptions
19
+ plugins?: CarouselPlugin
20
+ orientation?: "horizontal" | "vertical"
21
+ setApi?: (api: CarouselApi) => void
22
+ }
23
+
24
+ type CarouselContextProps = {
25
+ carouselRef: ReturnType<typeof useEmblaCarousel>[0]
26
+ api: ReturnType<typeof useEmblaCarousel>[1]
27
+ scrollPrev: () => void
28
+ scrollNext: () => void
29
+ canScrollPrev: boolean
30
+ canScrollNext: boolean
31
+ } & CarouselProps
32
+
33
+ const CarouselContext = React.createContext<CarouselContextProps | null>(null)
34
+
35
+ function useCarousel() {
36
+ const context = React.useContext(CarouselContext)
37
+
38
+ if (!context) {
39
+ throw new Error("useCarousel must be used within a <Carousel />")
40
+ }
41
+
42
+ return context
43
+ }
44
+
45
+ function Carousel({
46
+ orientation = "horizontal",
47
+ opts,
48
+ setApi,
49
+ plugins,
50
+ className,
51
+ children,
52
+ ...props
53
+ }: React.ComponentProps<"div"> & CarouselProps) {
54
+ const [carouselRef, api] = useEmblaCarousel(
55
+ {
56
+ ...opts,
57
+ axis: orientation === "horizontal" ? "x" : "y",
58
+ },
59
+ plugins
60
+ )
61
+ const [canScrollPrev, setCanScrollPrev] = React.useState(false)
62
+ const [canScrollNext, setCanScrollNext] = React.useState(false)
63
+
64
+ const onSelect = React.useCallback((api: CarouselApi) => {
65
+ if (!api) return
66
+ setCanScrollPrev(api.canScrollPrev())
67
+ setCanScrollNext(api.canScrollNext())
68
+ }, [])
69
+
70
+ const scrollPrev = React.useCallback(() => {
71
+ api?.scrollPrev()
72
+ }, [api])
73
+
74
+ const scrollNext = React.useCallback(() => {
75
+ api?.scrollNext()
76
+ }, [api])
77
+
78
+ const handleKeyDown = React.useCallback(
79
+ (event: React.KeyboardEvent<HTMLDivElement>) => {
80
+ if (event.key === "ArrowLeft") {
81
+ event.preventDefault()
82
+ scrollPrev()
83
+ } else if (event.key === "ArrowRight") {
84
+ event.preventDefault()
85
+ scrollNext()
86
+ }
87
+ },
88
+ [scrollPrev, scrollNext]
89
+ )
90
+
91
+ React.useEffect(() => {
92
+ if (!api || !setApi) return
93
+ setApi(api)
94
+ }, [api, setApi])
95
+
96
+ React.useEffect(() => {
97
+ if (!api) return
98
+ onSelect(api)
99
+ api.on("reInit", onSelect)
100
+ api.on("select", onSelect)
101
+
102
+ return () => {
103
+ api?.off("select", onSelect)
104
+ }
105
+ }, [api, onSelect])
106
+
107
+ return (
108
+ <CarouselContext.Provider
109
+ value={{
110
+ carouselRef,
111
+ api: api,
112
+ opts,
113
+ orientation:
114
+ orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
115
+ scrollPrev,
116
+ scrollNext,
117
+ canScrollPrev,
118
+ canScrollNext,
119
+ }}
120
+ >
121
+ <div
122
+ onKeyDownCapture={handleKeyDown}
123
+ className={cn("relative", className)}
124
+ role="region"
125
+ aria-roledescription="carousel"
126
+ data-slot="carousel"
127
+ {...props}
128
+ >
129
+ {children}
130
+ </div>
131
+ </CarouselContext.Provider>
132
+ )
133
+ }
134
+
135
+ function CarouselContent({ className, ...props }: React.ComponentProps<"div">) {
136
+ const { carouselRef, orientation } = useCarousel()
137
+
138
+ return (
139
+ <div
140
+ ref={carouselRef}
141
+ className="overflow-hidden"
142
+ data-slot="carousel-content"
143
+ >
144
+ <div
145
+ className={cn(
146
+ "flex",
147
+ orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
148
+ className
149
+ )}
150
+ {...props}
151
+ />
152
+ </div>
153
+ )
154
+ }
155
+
156
+ function CarouselItem({ className, ...props }: React.ComponentProps<"div">) {
157
+ const { orientation } = useCarousel()
158
+
159
+ return (
160
+ <div
161
+ role="group"
162
+ aria-roledescription="slide"
163
+ data-slot="carousel-item"
164
+ className={cn(
165
+ "min-w-0 shrink-0 grow-0 basis-full",
166
+ orientation === "horizontal" ? "pl-4" : "pt-4",
167
+ className
168
+ )}
169
+ {...props}
170
+ />
171
+ )
172
+ }
173
+
174
+ function CarouselPrevious({
175
+ className,
176
+ variant = "outline",
177
+ size = "sm",
178
+ ...props
179
+ }: React.ComponentProps<typeof Button>) {
180
+ const { orientation, scrollPrev, canScrollPrev } = useCarousel()
181
+
182
+ return (
183
+ <Button
184
+ data-slot="carousel-previous"
185
+ variant={variant}
186
+ size={size}
187
+ className={cn(
188
+ "absolute size-8 rounded-full",
189
+ orientation === "horizontal"
190
+ ? "top-1/2 -left-12 -translate-y-1/2"
191
+ : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
192
+ className
193
+ )}
194
+ disabled={!canScrollPrev}
195
+ onClick={scrollPrev}
196
+ {...props}
197
+ >
198
+ <ArrowLeft />
199
+ <span className="sr-only">Previous slide</span>
200
+ </Button>
201
+ )
202
+ }
203
+
204
+ function CarouselNext({
205
+ className,
206
+ variant = "outline",
207
+ size = "sm",
208
+ ...props
209
+ }: React.ComponentProps<typeof Button>) {
210
+ const { orientation, scrollNext, canScrollNext } = useCarousel()
211
+
212
+ return (
213
+ <Button
214
+ data-slot="carousel-next"
215
+ variant={variant}
216
+ size={size}
217
+ className={cn(
218
+ "absolute size-8 rounded-full",
219
+ orientation === "horizontal"
220
+ ? "top-1/2 -right-12 -translate-y-1/2"
221
+ : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
222
+ className
223
+ )}
224
+ disabled={!canScrollNext}
225
+ onClick={scrollNext}
226
+ {...props}
227
+ >
228
+ <ArrowRight />
229
+ <span className="sr-only">Next slide</span>
230
+ </Button>
231
+ )
232
+ }
233
+
234
+ export {
235
+ type CarouselApi,
236
+ Carousel,
237
+ CarouselContent,
238
+ CarouselItem,
239
+ CarouselPrevious,
240
+ CarouselNext,
241
+ }
@@ -0,0 +1,372 @@
1
+ import * as React from "react"
2
+ import * as RechartsPrimitive from "recharts"
3
+ import type { TooltipValueType } from "recharts"
4
+
5
+ import { cn } from "@/lib/utils"
6
+
7
+ // Format: { THEME_NAME: CSS_SELECTOR }
8
+ const THEMES = { light: "", dark: ".dark" } as const
9
+
10
+ const INITIAL_DIMENSION = { width: 320, height: 200 } as const
11
+ type TooltipNameType = number | string
12
+
13
+ export type ChartConfig = Record<
14
+ string,
15
+ {
16
+ label?: React.ReactNode
17
+ icon?: React.ComponentType
18
+ } & (
19
+ | { color?: string; theme?: never }
20
+ | { color?: never; theme: Record<keyof typeof THEMES, string> }
21
+ )
22
+ >
23
+
24
+ type ChartContextProps = {
25
+ config: ChartConfig
26
+ }
27
+
28
+ const ChartContext = React.createContext<ChartContextProps | null>(null)
29
+
30
+ function useChart() {
31
+ const context = React.useContext(ChartContext)
32
+
33
+ if (!context) {
34
+ throw new Error("useChart must be used within a <ChartContainer />")
35
+ }
36
+
37
+ return context
38
+ }
39
+
40
+ function ChartContainer({
41
+ id,
42
+ className,
43
+ children,
44
+ config,
45
+ initialDimension = INITIAL_DIMENSION,
46
+ ...props
47
+ }: React.ComponentProps<"div"> & {
48
+ config: ChartConfig
49
+ children: React.ComponentProps<
50
+ typeof RechartsPrimitive.ResponsiveContainer
51
+ >["children"]
52
+ initialDimension?: {
53
+ width: number
54
+ height: number
55
+ }
56
+ }) {
57
+ const uniqueId = React.useId()
58
+ const chartId = `chart-${id ?? uniqueId.replace(/:/g, "")}`
59
+
60
+ return (
61
+ <ChartContext.Provider value={{ config }}>
62
+ <div
63
+ data-slot="chart"
64
+ data-chart={chartId}
65
+ className={cn(
66
+ "flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-text-tertiary [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-layer]:outline-none [&_.recharts-radial-bar-background-sector]:fill-fill-tertiary [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-fill-tertiary [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",
67
+ className
68
+ )}
69
+ {...props}
70
+ >
71
+ <ChartStyle id={chartId} config={config} />
72
+ <RechartsPrimitive.ResponsiveContainer
73
+ initialDimension={initialDimension}
74
+ >
75
+ {children}
76
+ </RechartsPrimitive.ResponsiveContainer>
77
+ </div>
78
+ </ChartContext.Provider>
79
+ )
80
+ }
81
+
82
+ const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
83
+ const colorConfig = Object.entries(config).filter(
84
+ ([, config]) => config.theme ?? config.color
85
+ )
86
+
87
+ if (!colorConfig.length) {
88
+ return null
89
+ }
90
+
91
+ return (
92
+ <style
93
+ dangerouslySetInnerHTML={{
94
+ __html: Object.entries(THEMES)
95
+ .map(
96
+ ([theme, prefix]) => `
97
+ ${prefix} [data-chart=${id}] {
98
+ ${colorConfig
99
+ .map(([key, itemConfig]) => {
100
+ const color =
101
+ itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ??
102
+ itemConfig.color
103
+ return color ? ` --color-${key}: ${color};` : null
104
+ })
105
+ .join("\n")}
106
+ }
107
+ `
108
+ )
109
+ .join("\n"),
110
+ }}
111
+ />
112
+ )
113
+ }
114
+
115
+ const ChartTooltip = RechartsPrimitive.Tooltip
116
+
117
+ function ChartTooltipContent({
118
+ active,
119
+ payload,
120
+ className,
121
+ indicator = "dot",
122
+ hideLabel = false,
123
+ hideIndicator = false,
124
+ label,
125
+ labelFormatter,
126
+ labelClassName,
127
+ formatter,
128
+ color,
129
+ nameKey,
130
+ labelKey,
131
+ }: React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
132
+ React.ComponentProps<"div"> & {
133
+ hideLabel?: boolean
134
+ hideIndicator?: boolean
135
+ indicator?: "line" | "dot" | "dashed"
136
+ nameKey?: string
137
+ labelKey?: string
138
+ } & Omit<
139
+ RechartsPrimitive.DefaultTooltipContentProps<
140
+ TooltipValueType,
141
+ TooltipNameType
142
+ >,
143
+ "accessibilityLayer"
144
+ >) {
145
+ const { config } = useChart()
146
+
147
+ const tooltipLabel = React.useMemo(() => {
148
+ if (hideLabel || !payload?.length) {
149
+ return null
150
+ }
151
+
152
+ const [item] = payload
153
+ const key = `${labelKey ?? item?.dataKey ?? item?.name ?? "value"}`
154
+ const itemConfig = getPayloadConfigFromPayload(config, item, key)
155
+ const value =
156
+ !labelKey && typeof label === "string"
157
+ ? (config[label]?.label ?? label)
158
+ : itemConfig?.label
159
+
160
+ if (labelFormatter) {
161
+ return (
162
+ <div className={cn("font-medium", labelClassName)}>
163
+ {labelFormatter(value, payload)}
164
+ </div>
165
+ )
166
+ }
167
+
168
+ if (!value) {
169
+ return null
170
+ }
171
+
172
+ return <div className={cn("font-medium", labelClassName)}>{value}</div>
173
+ }, [
174
+ label,
175
+ labelFormatter,
176
+ payload,
177
+ hideLabel,
178
+ labelClassName,
179
+ config,
180
+ labelKey,
181
+ ])
182
+
183
+ if (!active || !payload?.length) {
184
+ return null
185
+ }
186
+
187
+ const nestLabel = payload.length === 1 && indicator !== "dot"
188
+
189
+ return (
190
+ <div
191
+ className={cn(
192
+ "grid min-w-32 items-start gap-1.5 rounded-lg border border-border/50 bg-bg-base px-2.5 py-1.5 text-xs shadow-xl",
193
+ className
194
+ )}
195
+ >
196
+ {!nestLabel ? tooltipLabel : null}
197
+ <div className="grid gap-1.5">
198
+ {payload
199
+ .filter((item) => item.type !== "none")
200
+ .map((item, index) => {
201
+ const key = `${nameKey ?? item.name ?? item.dataKey ?? "value"}`
202
+ const itemConfig = getPayloadConfigFromPayload(config, item, key)
203
+ const indicatorColor = color ?? item.payload?.fill ?? item.color
204
+
205
+ return (
206
+ <div
207
+ key={index}
208
+ className={cn(
209
+ "flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-text-tertiary",
210
+ indicator === "dot" && "items-center"
211
+ )}
212
+ >
213
+ {formatter && item?.value !== undefined && item.name ? (
214
+ formatter(item.value, item.name, item, index, item.payload)
215
+ ) : (
216
+ <>
217
+ {itemConfig?.icon ? (
218
+ <itemConfig.icon />
219
+ ) : (
220
+ !hideIndicator && (
221
+ <div
222
+ className={cn(
223
+ "shrink-0 rounded-sm border-(--color-border) bg-(--color-bg)",
224
+ {
225
+ "h-2.5 w-2.5": indicator === "dot",
226
+ "w-1": indicator === "line",
227
+ "w-0 border-[1.5px] border-dashed bg-transparent":
228
+ indicator === "dashed",
229
+ "my-0.5": nestLabel && indicator === "dashed",
230
+ }
231
+ )}
232
+ style={
233
+ {
234
+ "--color-bg": indicatorColor,
235
+ "--color-border": indicatorColor,
236
+ } as React.CSSProperties
237
+ }
238
+ />
239
+ )
240
+ )}
241
+ <div
242
+ className={cn(
243
+ "flex flex-1 justify-between leading-none",
244
+ nestLabel ? "items-end" : "items-center"
245
+ )}
246
+ >
247
+ <div className="grid gap-1.5">
248
+ {nestLabel ? tooltipLabel : null}
249
+ <span className="text-text-tertiary">
250
+ {itemConfig?.label ?? item.name}
251
+ </span>
252
+ </div>
253
+ {item.value != null && (
254
+ <span className="font-mono font-medium text-text tabular-nums">
255
+ {typeof item.value === "number"
256
+ ? item.value.toLocaleString()
257
+ : String(item.value)}
258
+ </span>
259
+ )}
260
+ </div>
261
+ </>
262
+ )}
263
+ </div>
264
+ )
265
+ })}
266
+ </div>
267
+ </div>
268
+ )
269
+ }
270
+
271
+ const ChartLegend = RechartsPrimitive.Legend
272
+
273
+ function ChartLegendContent({
274
+ className,
275
+ hideIcon = false,
276
+ payload,
277
+ verticalAlign = "bottom",
278
+ nameKey,
279
+ }: React.ComponentProps<"div"> & {
280
+ hideIcon?: boolean
281
+ nameKey?: string
282
+ } & RechartsPrimitive.DefaultLegendContentProps) {
283
+ const { config } = useChart()
284
+
285
+ if (!payload?.length) {
286
+ return null
287
+ }
288
+
289
+ return (
290
+ <div
291
+ className={cn(
292
+ "flex items-center justify-center gap-4",
293
+ verticalAlign === "top" ? "pb-3" : "pt-3",
294
+ className
295
+ )}
296
+ >
297
+ {payload
298
+ .filter((item) => item.type !== "none")
299
+ .map((item, index) => {
300
+ const key = `${nameKey ?? item.dataKey ?? "value"}`
301
+ const itemConfig = getPayloadConfigFromPayload(config, item, key)
302
+
303
+ return (
304
+ <div
305
+ key={index}
306
+ className={cn(
307
+ "flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-text-tertiary"
308
+ )}
309
+ >
310
+ {itemConfig?.icon && !hideIcon ? (
311
+ <itemConfig.icon />
312
+ ) : (
313
+ <div
314
+ className="h-2 w-2 shrink-0 rounded-sm"
315
+ style={{
316
+ backgroundColor: item.color,
317
+ }}
318
+ />
319
+ )}
320
+ {itemConfig?.label}
321
+ </div>
322
+ )
323
+ })}
324
+ </div>
325
+ )
326
+ }
327
+
328
+ // Helper to extract item config from a payload.
329
+ function getPayloadConfigFromPayload(
330
+ config: ChartConfig,
331
+ payload: unknown,
332
+ key: string
333
+ ) {
334
+ if (typeof payload !== "object" || payload === null) {
335
+ return undefined
336
+ }
337
+
338
+ const payloadPayload =
339
+ "payload" in payload &&
340
+ typeof payload.payload === "object" &&
341
+ payload.payload !== null
342
+ ? payload.payload
343
+ : undefined
344
+
345
+ let configLabelKey: string = key
346
+
347
+ if (
348
+ key in payload &&
349
+ typeof payload[key as keyof typeof payload] === "string"
350
+ ) {
351
+ configLabelKey = payload[key as keyof typeof payload] as string
352
+ } else if (
353
+ payloadPayload &&
354
+ key in payloadPayload &&
355
+ typeof payloadPayload[key as keyof typeof payloadPayload] === "string"
356
+ ) {
357
+ configLabelKey = payloadPayload[
358
+ key as keyof typeof payloadPayload
359
+ ] as string
360
+ }
361
+
362
+ return configLabelKey in config ? config[configLabelKey] : config[key]
363
+ }
364
+
365
+ export {
366
+ ChartContainer,
367
+ ChartTooltip,
368
+ ChartTooltipContent,
369
+ ChartLegend,
370
+ ChartLegendContent,
371
+ ChartStyle,
372
+ }
@@ -0,0 +1,42 @@
1
+ import * as React from 'react'
2
+ import * as CheckboxPrimitive from '@radix-ui/react-checkbox'
3
+ import { cva, type VariantProps } from 'class-variance-authority'
4
+ import { cn } from '@/lib/utils'
5
+ import { CheckLine } from './icons-inline'
6
+
7
+ const checkboxVariants = cva(
8
+ 'group peer shrink-0 rounded-sm border border-border-tertiary bg-bg-container outline-offset-2 transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary-border disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-text-on-primary data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-text-on-primary',
9
+ {
10
+ variants: {
11
+ size: {
12
+ sm: 'size-3.5',
13
+ md: 'size-4',
14
+ lg: 'size-5',
15
+ },
16
+ },
17
+ defaultVariants: { size: 'md' },
18
+ },
19
+ )
20
+
21
+ export interface CheckboxProps
22
+ extends React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>,
23
+ VariantProps<typeof checkboxVariants> {}
24
+
25
+ const Checkbox = React.forwardRef<
26
+ React.ElementRef<typeof CheckboxPrimitive.Root>,
27
+ CheckboxProps
28
+ >(({ className, size = 'md', ...props }, ref) => (
29
+ <CheckboxPrimitive.Root
30
+ ref={ref}
31
+ className={cn(checkboxVariants({ size }), className)}
32
+ {...props}
33
+ >
34
+ <CheckboxPrimitive.Indicator className="flex items-center justify-center text-current">
35
+ <CheckLine className="size-[0.875em] group-data-[state=indeterminate]:hidden" />
36
+ <span className="hidden h-[0.125em] w-[0.625em] rounded-sm bg-current group-data-[state=indeterminate]:block" />
37
+ </CheckboxPrimitive.Indicator>
38
+ </CheckboxPrimitive.Root>
39
+ ))
40
+ Checkbox.displayName = CheckboxPrimitive.Root.displayName
41
+
42
+ export { Checkbox, checkboxVariants }
@@ -31,7 +31,7 @@ export function CollapsibleCard({
31
31
  headerRight,
32
32
  children,
33
33
  defaultExpanded = true,
34
- contentPadding = 'var(--spacing-1\.5) var(--spacing-2)',
34
+ contentPadding = 'var(--spacing-1.5) var(--spacing-2)',
35
35
  onToggle,
36
36
  collapsible = true,
37
37
  footer,
@@ -187,7 +187,7 @@ export function CollapsibleCard({
187
187
  {useExpandAllLogic && shouldShowBar && contentHeight > maxHeight && (
188
188
  <div
189
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',
190
+ 'absolute bottom-0 left-0 right-0 pointer-events-none h-6 bg-gradient-to-b from-transparent to-[var(--color-bg-base)] transition-opacity duration-300',
191
191
  expandAll ? 'opacity-0' : 'opacity-100'
192
192
  )}
193
193
  />