@karakuri-ui/react 0.2.2 → 0.2.4

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 (238) hide show
  1. package/README.md +9 -0
  2. package/dist/components/ui/accordion.d.mts +49 -0
  3. package/dist/components/ui/accordion.d.ts +49 -0
  4. package/dist/components/ui/accordion.js +220 -0
  5. package/dist/components/ui/accordion.js.map +1 -0
  6. package/dist/components/ui/accordion.mjs +181 -0
  7. package/dist/components/ui/accordion.mjs.map +1 -0
  8. package/dist/components/ui/alert.d.mts +47 -0
  9. package/dist/components/ui/alert.d.ts +47 -0
  10. package/dist/components/ui/alert.js +223 -0
  11. package/dist/components/ui/alert.js.map +1 -0
  12. package/dist/components/ui/alert.mjs +185 -0
  13. package/dist/components/ui/alert.mjs.map +1 -0
  14. package/dist/components/ui/avatar.d.mts +232 -0
  15. package/dist/components/ui/avatar.d.ts +232 -0
  16. package/dist/components/ui/avatar.js +250 -0
  17. package/dist/components/ui/avatar.js.map +1 -0
  18. package/dist/components/ui/avatar.mjs +209 -0
  19. package/dist/components/ui/avatar.mjs.map +1 -0
  20. package/dist/components/ui/badge.d.mts +31 -0
  21. package/dist/components/ui/badge.d.ts +31 -0
  22. package/dist/components/ui/badge.js +205 -0
  23. package/dist/components/ui/badge.js.map +1 -0
  24. package/dist/components/ui/badge.mjs +170 -0
  25. package/dist/components/ui/badge.mjs.map +1 -0
  26. package/dist/components/ui/breadcrumb.d.mts +57 -0
  27. package/dist/components/ui/breadcrumb.d.ts +57 -0
  28. package/dist/components/ui/breadcrumb.js +209 -0
  29. package/dist/components/ui/breadcrumb.js.map +1 -0
  30. package/dist/components/ui/breadcrumb.mjs +168 -0
  31. package/dist/components/ui/breadcrumb.mjs.map +1 -0
  32. package/dist/components/ui/button-group.d.mts +22 -0
  33. package/dist/components/ui/button-group.d.ts +22 -0
  34. package/dist/components/ui/button-group.js +107 -0
  35. package/dist/components/ui/button-group.js.map +1 -0
  36. package/dist/components/ui/button-group.mjs +72 -0
  37. package/dist/components/ui/button-group.mjs.map +1 -0
  38. package/dist/components/ui/button.d.mts +31 -0
  39. package/dist/components/ui/button.d.ts +31 -0
  40. package/dist/components/ui/button.js +176 -0
  41. package/dist/components/ui/button.js.map +1 -0
  42. package/dist/components/ui/button.mjs +141 -0
  43. package/dist/components/ui/button.mjs.map +1 -0
  44. package/dist/components/ui/card.d.mts +77 -0
  45. package/dist/components/ui/card.d.ts +77 -0
  46. package/dist/components/ui/card.js +370 -0
  47. package/dist/components/ui/card.js.map +1 -0
  48. package/dist/components/ui/card.mjs +328 -0
  49. package/dist/components/ui/card.mjs.map +1 -0
  50. package/dist/{chart.js → components/ui/chart.js} +29 -39
  51. package/dist/components/ui/chart.js.map +1 -0
  52. package/dist/{chart.mjs → components/ui/chart.mjs} +21 -31
  53. package/dist/components/ui/chart.mjs.map +1 -0
  54. package/dist/components/ui/checkbox.d.mts +24 -0
  55. package/dist/components/ui/checkbox.d.ts +24 -0
  56. package/dist/components/ui/checkbox.js +173 -0
  57. package/dist/components/ui/checkbox.js.map +1 -0
  58. package/dist/components/ui/checkbox.mjs +138 -0
  59. package/dist/components/ui/checkbox.mjs.map +1 -0
  60. package/dist/components/ui/divider.d.mts +27 -0
  61. package/dist/components/ui/divider.d.ts +27 -0
  62. package/dist/components/ui/divider.js +147 -0
  63. package/dist/components/ui/divider.js.map +1 -0
  64. package/dist/components/ui/divider.mjs +112 -0
  65. package/dist/components/ui/divider.mjs.map +1 -0
  66. package/dist/components/ui/drawer.d.mts +51 -0
  67. package/dist/components/ui/drawer.d.ts +51 -0
  68. package/dist/components/ui/drawer.js +225 -0
  69. package/dist/components/ui/drawer.js.map +1 -0
  70. package/dist/components/ui/drawer.mjs +178 -0
  71. package/dist/components/ui/drawer.mjs.map +1 -0
  72. package/dist/components/ui/dropdown.d.mts +59 -0
  73. package/dist/components/ui/dropdown.d.ts +59 -0
  74. package/dist/components/ui/dropdown.js +310 -0
  75. package/dist/components/ui/dropdown.js.map +1 -0
  76. package/dist/components/ui/dropdown.mjs +263 -0
  77. package/dist/components/ui/dropdown.mjs.map +1 -0
  78. package/dist/components/ui/field.d.mts +33 -0
  79. package/dist/components/ui/field.d.ts +33 -0
  80. package/dist/components/ui/field.js +146 -0
  81. package/dist/components/ui/field.js.map +1 -0
  82. package/dist/components/ui/field.mjs +108 -0
  83. package/dist/components/ui/field.mjs.map +1 -0
  84. package/dist/components/ui/icon-button.d.mts +20 -0
  85. package/dist/components/ui/icon-button.d.ts +20 -0
  86. package/dist/components/ui/icon-button.js +147 -0
  87. package/dist/components/ui/icon-button.js.map +1 -0
  88. package/dist/components/ui/icon-button.mjs +112 -0
  89. package/dist/components/ui/icon-button.mjs.map +1 -0
  90. package/dist/components/ui/index.d.mts +55 -0
  91. package/dist/components/ui/index.d.ts +55 -0
  92. package/dist/components/ui/index.js +476 -0
  93. package/dist/components/ui/index.js.map +1 -0
  94. package/dist/components/ui/index.mjs +246 -0
  95. package/dist/components/ui/index.mjs.map +1 -0
  96. package/dist/components/ui/input.d.mts +20 -0
  97. package/dist/components/ui/input.d.ts +20 -0
  98. package/dist/components/ui/input.js +250 -0
  99. package/dist/components/ui/input.js.map +1 -0
  100. package/dist/components/ui/input.mjs +215 -0
  101. package/dist/components/ui/input.mjs.map +1 -0
  102. package/dist/components/ui/metric-card.d.mts +53 -0
  103. package/dist/components/ui/metric-card.d.ts +53 -0
  104. package/dist/components/ui/metric-card.js +258 -0
  105. package/dist/components/ui/metric-card.js.map +1 -0
  106. package/dist/components/ui/metric-card.mjs +217 -0
  107. package/dist/components/ui/metric-card.mjs.map +1 -0
  108. package/dist/components/ui/modal.d.mts +77 -0
  109. package/dist/components/ui/modal.d.ts +77 -0
  110. package/dist/components/ui/modal.js +396 -0
  111. package/dist/components/ui/modal.js.map +1 -0
  112. package/dist/components/ui/modal.mjs +338 -0
  113. package/dist/components/ui/modal.mjs.map +1 -0
  114. package/dist/components/ui/navigation-menu.d.mts +139 -0
  115. package/dist/components/ui/navigation-menu.d.ts +139 -0
  116. package/dist/components/ui/navigation-menu.js +531 -0
  117. package/dist/components/ui/navigation-menu.js.map +1 -0
  118. package/dist/components/ui/navigation-menu.mjs +488 -0
  119. package/dist/components/ui/navigation-menu.mjs.map +1 -0
  120. package/dist/components/ui/pagination.d.mts +130 -0
  121. package/dist/components/ui/pagination.d.ts +130 -0
  122. package/dist/components/ui/pagination.js +495 -0
  123. package/dist/components/ui/pagination.js.map +1 -0
  124. package/dist/components/ui/pagination.mjs +449 -0
  125. package/dist/components/ui/pagination.mjs.map +1 -0
  126. package/dist/components/ui/popover.d.mts +41 -0
  127. package/dist/components/ui/popover.d.ts +41 -0
  128. package/dist/components/ui/popover.js +175 -0
  129. package/dist/components/ui/popover.js.map +1 -0
  130. package/dist/components/ui/popover.mjs +133 -0
  131. package/dist/components/ui/popover.mjs.map +1 -0
  132. package/dist/components/ui/progress.d.mts +35 -0
  133. package/dist/components/ui/progress.d.ts +35 -0
  134. package/dist/components/ui/progress.js +194 -0
  135. package/dist/components/ui/progress.js.map +1 -0
  136. package/dist/components/ui/progress.mjs +159 -0
  137. package/dist/components/ui/progress.mjs.map +1 -0
  138. package/dist/components/ui/radio-group.d.mts +40 -0
  139. package/dist/components/ui/radio-group.d.ts +40 -0
  140. package/dist/components/ui/radio-group.js +177 -0
  141. package/dist/components/ui/radio-group.js.map +1 -0
  142. package/dist/components/ui/radio-group.mjs +140 -0
  143. package/dist/components/ui/radio-group.mjs.map +1 -0
  144. package/dist/components/ui/segmented.d.mts +30 -0
  145. package/dist/components/ui/segmented.d.ts +30 -0
  146. package/dist/components/ui/segmented.js +241 -0
  147. package/dist/components/ui/segmented.js.map +1 -0
  148. package/dist/components/ui/segmented.mjs +204 -0
  149. package/dist/components/ui/segmented.mjs.map +1 -0
  150. package/dist/components/ui/select.d.mts +31 -0
  151. package/dist/components/ui/select.d.ts +31 -0
  152. package/dist/components/ui/select.js +317 -0
  153. package/dist/components/ui/select.js.map +1 -0
  154. package/dist/components/ui/select.mjs +276 -0
  155. package/dist/components/ui/select.mjs.map +1 -0
  156. package/dist/components/ui/skeleton.d.mts +26 -0
  157. package/dist/components/ui/skeleton.d.ts +26 -0
  158. package/dist/components/ui/skeleton.js +144 -0
  159. package/dist/components/ui/skeleton.js.map +1 -0
  160. package/dist/components/ui/skeleton.mjs +109 -0
  161. package/dist/components/ui/skeleton.mjs.map +1 -0
  162. package/dist/components/ui/slider.d.mts +38 -0
  163. package/dist/components/ui/slider.d.ts +38 -0
  164. package/dist/components/ui/slider.js +180 -0
  165. package/dist/components/ui/slider.js.map +1 -0
  166. package/dist/components/ui/slider.mjs +145 -0
  167. package/dist/components/ui/slider.mjs.map +1 -0
  168. package/dist/components/ui/spinner.d.mts +23 -0
  169. package/dist/components/ui/spinner.d.ts +23 -0
  170. package/dist/components/ui/spinner.js +471 -0
  171. package/dist/components/ui/spinner.js.map +1 -0
  172. package/dist/components/ui/spinner.mjs +436 -0
  173. package/dist/components/ui/spinner.mjs.map +1 -0
  174. package/dist/components/ui/switch.d.mts +22 -0
  175. package/dist/components/ui/switch.d.ts +22 -0
  176. package/dist/components/ui/switch.js +173 -0
  177. package/dist/components/ui/switch.js.map +1 -0
  178. package/dist/components/ui/switch.mjs +138 -0
  179. package/dist/components/ui/switch.mjs.map +1 -0
  180. package/dist/components/ui/table.d.mts +74 -0
  181. package/dist/components/ui/table.d.ts +74 -0
  182. package/dist/components/ui/table.js +240 -0
  183. package/dist/components/ui/table.js.map +1 -0
  184. package/dist/components/ui/table.mjs +199 -0
  185. package/dist/components/ui/table.mjs.map +1 -0
  186. package/dist/components/ui/tabs.d.mts +40 -0
  187. package/dist/components/ui/tabs.d.ts +40 -0
  188. package/dist/components/ui/tabs.js +238 -0
  189. package/dist/components/ui/tabs.js.map +1 -0
  190. package/dist/components/ui/tabs.mjs +199 -0
  191. package/dist/components/ui/tabs.mjs.map +1 -0
  192. package/dist/components/ui/textarea.d.mts +19 -0
  193. package/dist/components/ui/textarea.d.ts +19 -0
  194. package/dist/components/ui/textarea.js +181 -0
  195. package/dist/components/ui/textarea.js.map +1 -0
  196. package/dist/components/ui/textarea.mjs +146 -0
  197. package/dist/components/ui/textarea.mjs.map +1 -0
  198. package/dist/components/ui/toast.d.mts +93 -0
  199. package/dist/components/ui/toast.d.ts +93 -0
  200. package/dist/components/ui/toast.js +429 -0
  201. package/dist/components/ui/toast.js.map +1 -0
  202. package/dist/components/ui/toast.mjs +393 -0
  203. package/dist/components/ui/toast.mjs.map +1 -0
  204. package/dist/components/ui/toggle-group.d.mts +47 -0
  205. package/dist/components/ui/toggle-group.d.ts +47 -0
  206. package/dist/components/ui/toggle-group.js +186 -0
  207. package/dist/components/ui/toggle-group.js.map +1 -0
  208. package/dist/components/ui/toggle-group.mjs +149 -0
  209. package/dist/components/ui/toggle-group.mjs.map +1 -0
  210. package/dist/components/ui/toggle.d.mts +19 -0
  211. package/dist/components/ui/toggle.d.ts +19 -0
  212. package/dist/components/ui/toggle.js +194 -0
  213. package/dist/components/ui/toggle.js.map +1 -0
  214. package/dist/components/ui/toggle.mjs +159 -0
  215. package/dist/components/ui/toggle.mjs.map +1 -0
  216. package/dist/components/ui/tooltip.d.mts +37 -0
  217. package/dist/components/ui/tooltip.d.ts +37 -0
  218. package/dist/components/ui/tooltip.js +137 -0
  219. package/dist/components/ui/tooltip.js.map +1 -0
  220. package/dist/components/ui/tooltip.mjs +96 -0
  221. package/dist/components/ui/tooltip.mjs.map +1 -0
  222. package/dist/lib/utils.d.mts +10 -0
  223. package/dist/lib/utils.d.ts +10 -0
  224. package/dist/lib/utils.js +33 -0
  225. package/dist/lib/utils.js.map +1 -0
  226. package/dist/lib/utils.mjs +9 -0
  227. package/dist/lib/utils.mjs.map +1 -0
  228. package/package.json +11 -11
  229. package/dist/chart.js.map +0 -1
  230. package/dist/chart.mjs.map +0 -1
  231. package/dist/index.d.mts +0 -1636
  232. package/dist/index.d.ts +0 -1636
  233. package/dist/index.js +0 -7291
  234. package/dist/index.js.map +0 -1
  235. package/dist/index.mjs +0 -7048
  236. package/dist/index.mjs.map +0 -1
  237. /package/dist/{chart.d.mts → components/ui/chart.d.mts} +0 -0
  238. /package/dist/{chart.d.ts → components/ui/chart.d.ts} +0 -0
@@ -1,19 +1,9 @@
1
1
  "use client";
2
-
3
- // src/components/ui/chart.tsx
4
2
  import * as React from "react";
5
3
  import * as RechartsPrimitive from "recharts";
6
-
7
- // src/lib/utils.ts
8
- import { clsx } from "clsx";
9
- import { twMerge } from "tailwind-merge";
10
- function cn(...inputs) {
11
- return twMerge(clsx(inputs));
12
- }
13
-
14
- // src/components/ui/chart.tsx
15
- var THEMES = { light: "", dark: ".dark" };
16
- var ChartContext = React.createContext(null);
4
+ import { cn } from "../../lib/utils";
5
+ const THEMES = { light: "", dark: ".dark" };
6
+ const ChartContext = React.createContext(null);
17
7
  function useChart() {
18
8
  const context = React.useContext(ChartContext);
19
9
  if (!context) {
@@ -68,8 +58,8 @@ function ChartContainer({
68
58
  /* @__PURE__ */ React.createElement(RechartsPrimitive.ResponsiveContainer, null, children)
69
59
  ));
70
60
  }
71
- var CHART_TOOLTIP_KEYFRAME = "@keyframes chart-tooltip-in{from{opacity:0}to{opacity:1}}";
72
- var ChartStyle = ({ id, config }) => {
61
+ const CHART_TOOLTIP_KEYFRAME = "@keyframes chart-tooltip-in{from{opacity:0}to{opacity:1}}";
62
+ const ChartStyle = ({ id, config }) => {
73
63
  const colorConfig = Object.entries(config).filter(
74
64
  ([, config2]) => config2.theme || config2.color
75
65
  );
@@ -92,9 +82,9 @@ ${colorConfig.map(([key, itemConfig]) => {
92
82
  }
93
83
  );
94
84
  };
95
- var CHART_HOVER_FADE_OPACITY = 0.35;
96
- var CHART_FADE_TRANSITION = { transition: "fill-opacity var(--duration-fast) ease-out, stroke-opacity var(--duration-fast) ease-out" };
97
- var CHART_BAR_RADIUS_MAP = {
85
+ const CHART_HOVER_FADE_OPACITY = 0.35;
86
+ const CHART_FADE_TRANSITION = { transition: "fill-opacity var(--duration-fast) ease-out, stroke-opacity var(--duration-fast) ease-out" };
87
+ const CHART_BAR_RADIUS_MAP = {
98
88
  none: 0,
99
89
  // --radius-none: 0px
100
90
  sm: 2,
@@ -267,7 +257,7 @@ function ChartTooltipContent({
267
257
  }))
268
258
  );
269
259
  }
270
- var ChartLegend = RechartsPrimitive.Legend;
260
+ const ChartLegend = RechartsPrimitive.Legend;
271
261
  function ChartLegendContent({
272
262
  className,
273
263
  hideIcon = false,
@@ -331,17 +321,17 @@ function getPayloadConfigFromPayload(config, payload, key) {
331
321
  }
332
322
  return configLabelKey in config ? config[configLabelKey] : config[key];
333
323
  }
334
- var CHART_AXIS_TICK_STYLE = { style: { fontSize: "var(--chart-axis-fs)", fill: "var(--color-text-subtle)" } };
335
- var CHART_XAXIS_PADDING = { left: 16, right: 16 };
324
+ const CHART_AXIS_TICK_STYLE = { style: { fontSize: "var(--chart-axis-fs)", fill: "var(--color-text-subtle)" } };
325
+ const CHART_XAXIS_PADDING = { left: 16, right: 16 };
336
326
  function ChartXAxis({ tick, padding, ...props }) {
337
327
  return /* @__PURE__ */ React.createElement(RechartsPrimitive.XAxis, { tick: tick ?? CHART_AXIS_TICK_STYLE, padding: padding ?? CHART_XAXIS_PADDING, ...props });
338
328
  }
339
329
  function ChartYAxis({ tick, width = "auto", ...props }) {
340
330
  return /* @__PURE__ */ React.createElement(RechartsPrimitive.YAxis, { tick: tick ?? CHART_AXIS_TICK_STYLE, width, ...props });
341
331
  }
342
- var CHART_LINE_DASH = "5 5";
343
- var CHART_DOT_PROPS = { r: 3, strokeWidth: 2 };
344
- var CHART_ACTIVE_DOT_PROPS = { r: 5, strokeWidth: 2 };
332
+ const CHART_LINE_DASH = "5 5";
333
+ const CHART_DOT_PROPS = { r: 3, strokeWidth: 2 };
334
+ const CHART_ACTIVE_DOT_PROPS = { r: 5, strokeWidth: 2 };
345
335
  function ChartLine({
346
336
  type = "monotone",
347
337
  variant = "solid",
@@ -374,7 +364,7 @@ function ChartLine({
374
364
  }
375
365
  );
376
366
  }
377
- var CHART_AREA_DEFAULT_OPACITY = 0.4;
367
+ const CHART_AREA_DEFAULT_OPACITY = 0.4;
378
368
  function ChartArea({
379
369
  type = "monotone",
380
370
  variant = "solid",
@@ -413,11 +403,11 @@ function ChartArea({
413
403
  }
414
404
  ));
415
405
  }
416
- var CHART_PIE_ACTIVE_OFFSET = 8;
417
- var CHART_PIE_DONUT_INNER_RADIUS = 60;
418
- var CHART_PIE_LABEL_RADIAL = 16;
419
- var CHART_PIE_LABEL_HORIZ = 20;
420
- var CHART_PIE_SKIP_ANGLE = 15;
406
+ const CHART_PIE_ACTIVE_OFFSET = 8;
407
+ const CHART_PIE_DONUT_INNER_RADIUS = 60;
408
+ const CHART_PIE_LABEL_RADIAL = 16;
409
+ const CHART_PIE_LABEL_HORIZ = 20;
410
+ const CHART_PIE_SKIP_ANGLE = 15;
421
411
  function ChartPie({
422
412
  variant = "pie",
423
413
  label: labelMode = "none",
@@ -504,7 +494,7 @@ function ChartPie({
504
494
  }
505
495
  );
506
496
  }
507
- var Chart = Object.assign(ChartContainer, {
497
+ const Chart = Object.assign(ChartContainer, {
508
498
  Bar: ChartBar,
509
499
  Line: ChartLine,
510
500
  Area: ChartArea,
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/ui/chart.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport * as RechartsPrimitive from 'recharts'\nimport { cn } from '../../lib/utils'\n\n// Format: { THEME_NAME: CSS_SELECTOR }\nconst THEMES = { light: '', dark: '.dark' } as const\n\nexport type ChartConfig = {\n [k in string]: {\n label?: React.ReactNode\n icon?: React.ComponentType\n } & (\n | { color?: string; theme?: never }\n | { color?: never; theme: Record<keyof typeof THEMES, string> }\n )\n}\n\ntype ChartContextProps = {\n config: ChartConfig\n // Hover fade state\n hoverFade: boolean\n activeIndex: number | null\n setActiveIndex: (index: number | null) => void\n // Series-level hover fade (used by ChartLine)\n activeDataKey: string | null\n setActiveDataKey: (key: string | null) => void\n}\n\nconst ChartContext = React.createContext<ChartContextProps | null>(null)\n\nfunction useChart() {\n const context = React.useContext(ChartContext)\n if (!context) {\n throw new Error('useChart must be used within a <ChartContainer />')\n }\n return context\n}\n\nfunction ChartContainer({\n id,\n className,\n children,\n config,\n hoverFade = false,\n ...props\n}: React.ComponentProps<'div'> & {\n config: ChartConfig\n /** Enable hover-to-highlight: hovered bar group stays full opacity, others fade. */\n hoverFade?: boolean\n children: React.ComponentProps<\n typeof RechartsPrimitive.ResponsiveContainer\n >['children']\n}) {\n const uniqueId = React.useId()\n const chartId = `chart-${id || uniqueId.replace(/:/g, '')}`\n const [activeIndex, setActiveIndex] = React.useState<number | null>(null)\n const [activeDataKey, setActiveDataKey] = React.useState<string | null>(null)\n\n return (\n <ChartContext.Provider value={{ config, hoverFade, activeIndex, setActiveIndex, activeDataKey, setActiveDataKey }}>\n <div\n data-slot=\"chart\"\n data-chart={chartId}\n onMouseLeave={hoverFade ? () => { setActiveIndex(null); setActiveDataKey(null) } : undefined}\n className={cn(\n 'flex aspect-video w-full justify-center text-xs outline-none [&_*]:outline-none',\n // Responsive axis tick font-size — consumed by ChartXAxis / ChartYAxis via var()\n '[--chart-axis-fs:var(--font-size-2xs)] sm:[--chart-axis-fs:var(--font-size-xs)]',\n // Recharts element overrides — use arbitrary properties for v3/v4 compat\n '[&_.recharts-cartesian-axis-tick_text]:[fill:var(--color-text-muted)]',\n \"[&_.recharts-cartesian-grid_line[stroke='#ccc']]:[stroke:var(--color-border)]\",\n '[&_.recharts-cartesian-grid_line]:[stroke-dasharray:3_3]',\n '[&_.recharts-curve.recharts-tooltip-cursor]:[stroke:var(--color-border)]',\n \"[&_.recharts-dot[stroke='#fff']]:stroke-transparent\",\n '[&_.recharts-layer]:outline-none',\n \"[&_.recharts-polar-grid_[stroke='#ccc']]:[stroke:var(--color-border)]\",\n '[&_.recharts-radial-bar-background-sector]:[fill:var(--color-background-muted)]',\n '[&_.recharts-rectangle.recharts-tooltip-cursor]:[fill:transparent]',\n \"[&_.recharts-reference-line_[stroke='#ccc']]:[stroke:var(--color-border)]\",\n '[&_.recharts-sector]:outline-none',\n \"[&_.recharts-sector[stroke='#fff']]:stroke-transparent\",\n '[&_.recharts-surface]:outline-none',\n className\n )}\n {...props}\n >\n <ChartStyle id={chartId} config={config} />\n <RechartsPrimitive.ResponsiveContainer>\n {children}\n </RechartsPrimitive.ResponsiveContainer>\n </div>\n </ChartContext.Provider>\n )\n}\n\n// Tooltip fade-in keyframe — injected once per chart via ChartStyle\nconst CHART_TOOLTIP_KEYFRAME = '@keyframes chart-tooltip-in{from{opacity:0}to{opacity:1}}'\n\nconst ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {\n const colorConfig = Object.entries(config).filter(\n ([, config]) => config.theme || config.color\n )\n\n const colorCss = colorConfig.length\n ? Object.entries(THEMES)\n .map(\n ([theme, prefix]) => `\n${prefix} [data-chart=${id}] {\n${colorConfig\n .map(([key, itemConfig]) => {\n const color =\n itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ||\n itemConfig.color\n return color ? ` --color-${key}: ${color};` : null\n })\n .join('\\n')}\n}\n`\n )\n .join('\\n')\n : ''\n\n return (\n <style\n dangerouslySetInnerHTML={{\n __html: CHART_TOOLTIP_KEYFRAME + colorCss,\n }}\n />\n )\n}\n\n// ─── ChartBar ─────────────────────────────────────────────────────────────────\n\nexport type ChartBarRadius = 'none' | 'sm' | 'base' | 'md' | 'lg'\nexport type ChartBarVariant = 'solid' | 'outline'\n\n// TOKEN-EXCEPTION: SVG fillOpacity requires numeric value.\n// Matches --opacity-35 token (0.35).\nconst CHART_HOVER_FADE_OPACITY = 0.35\n\n// Fade transition for hover effect — uses --duration-fast token via CSS variable\nconst CHART_FADE_TRANSITION = { transition: 'fill-opacity var(--duration-fast) ease-out, stroke-opacity var(--duration-fast) ease-out' } as const\n\n// TOKEN-EXCEPTION: Recharts Bar radius is an SVG attribute — CSS variables not supported.\n// Values mirror --radius-* tokens from variables.css.\nconst CHART_BAR_RADIUS_MAP: Record<ChartBarRadius, number> = {\n none: 0, // --radius-none: 0px\n sm: 2, // --radius-sm: 2px\n base: 4, // --radius-base: 4px\n md: 6, // --radius-md: 6px\n lg: 8, // --radius-lg: 8px\n}\n\ntype ChartBarProps = Omit<React.ComponentProps<typeof RechartsPrimitive.Bar>, 'radius'> & {\n /** Named radius token. Auto-adapts corners based on layout and stack position. */\n radius?: ChartBarRadius\n /** 'horizontal' rounds the right side (away from Y-axis). Default: 'vertical' */\n layout?: 'vertical' | 'horizontal'\n /** 'bottom' rounds the bottom corners (base of a stack). Default: 'top' */\n stackPosition?: 'top' | 'bottom'\n /** 'outline' renders a thick border with a semi-transparent fill. Default: 'solid' */\n variant?: ChartBarVariant\n}\n\nfunction ChartBar({\n radius = 'none',\n layout = 'vertical',\n stackPosition = 'top',\n variant = 'solid',\n fill,\n stackId,\n ...props\n}: ChartBarProps) {\n const { hoverFade, activeIndex, setActiveIndex } = useChart()\n const r = CHART_BAR_RADIUS_MAP[radius]\n const isStacked = !!stackId || stackPosition === 'bottom'\n const appliedRadius: number | [number, number, number, number] =\n r === 0 ? 0\n : variant === 'outline' && !isStacked ? r // outline standalone: all 4 corners (works for negative bars too)\n : layout === 'horizontal' && stackPosition === 'bottom' ? 0 // stacked horiz inner: all flat (connects to next bar)\n : layout === 'horizontal' ? [0, r, r, 0] // horiz tip: right corners\n : stackPosition === 'bottom' ? 0 // vertical stacked base: all flat (sits on axis, top connects to next bar)\n : [r, r, 0, 0] // default vertical: top corners only\n\n // TOKEN-EXCEPTION: SVG stroke is centered by default (half inside, half outside).\n // Custom shape renders an inset rect so the stroke stays fully inside the bar bounds.\n const outlineShape = React.useCallback((shapeProps: RechartsPrimitive.BarShapeProps & { x?: number; y?: number; width?: number; height?: number; index?: number }) => {\n const x = shapeProps.x ?? 0\n const y = shapeProps.y ?? 0\n const width = shapeProps.width ?? 0\n const height = shapeProps.height ?? 0\n if (!width || !height || width <= 0 || height <= 0) return <g />\n const sw = 2\n const inset = sw / 2\n const rx = typeof appliedRadius === 'number' ? Math.max(0, appliedRadius - inset) : 0\n // Hover fade: modulate base outline opacity (fill: 0.4, stroke: 1.0)\n const fadeMultiplier = hoverFade && activeIndex !== null && shapeProps.index !== activeIndex ? CHART_HOVER_FADE_OPACITY : 1\n return (\n <rect\n x={x + inset}\n y={y + inset}\n width={Math.max(0, width - sw)}\n height={Math.max(0, height - sw)}\n rx={rx}\n fill={fill}\n fillOpacity={0.4 * fadeMultiplier}\n stroke={fill}\n strokeOpacity={fadeMultiplier}\n strokeWidth={sw}\n style={hoverFade ? CHART_FADE_TRANSITION : undefined}\n />\n )\n }, [appliedRadius, fill, hoverFade, activeIndex])\n\n // Solid variant hover-fade shape: renders Rectangle with per-bar opacity\n const solidHoverShape = React.useCallback((shapeProps: any) => {\n const opacity = activeIndex === null ? 1 : shapeProps.index === activeIndex ? 1 : CHART_HOVER_FADE_OPACITY\n return (\n <RechartsPrimitive.Rectangle\n {...shapeProps}\n fillOpacity={opacity}\n style={CHART_FADE_TRANSITION}\n />\n )\n }, [activeIndex])\n\n // Determine which shape function to use\n const useOutline = variant === 'outline' && !isStacked\n const needsHoverShape = hoverFade && variant === 'solid' && !useOutline\n\n return (\n <RechartsPrimitive.Bar\n radius={appliedRadius}\n fill={fill}\n stackId={stackId}\n // Disable Recharts animation to prevent label/total flicker on hover\n {...(hoverFade && { isAnimationActive: false })}\n {...(useOutline && { shape: outlineShape as any })}\n {...(needsHoverShape && { shape: solidHoverShape as any })}\n {...(hoverFade && { onMouseEnter: (_: unknown, index: number) => setActiveIndex(index) })}\n {...props}\n />\n )\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n\n// Wrapper: kill position-slide so tooltip appears at the hovered bar instantly.\n// Smooth appearance is handled by CSS fade on ChartTooltipContent instead.\nfunction ChartTooltip(props: React.ComponentProps<typeof RechartsPrimitive.Tooltip>) {\n return <RechartsPrimitive.Tooltip animationDuration={0} {...props} />\n}\n\n// Recharts 3.x injects these props at runtime via content render prop.\n// We define explicit types instead of deriving from RechartsPrimitive.Tooltip.\ntype TooltipPayloadItem = {\n dataKey?: string | number\n name?: string\n value?: number | string\n type?: string\n color?: string\n payload?: Record<string, unknown>\n fill?: string\n}\n\ntype ChartTooltipContentProps = React.ComponentProps<'div'> & {\n active?: boolean\n payload?: TooltipPayloadItem[]\n label?: string\n labelFormatter?: (value: unknown, payload: TooltipPayloadItem[]) => React.ReactNode\n labelClassName?: string\n formatter?: (value: unknown, name: string, item: TooltipPayloadItem, index: number, payload: Record<string, unknown>) => React.ReactNode\n color?: string\n hideLabel?: boolean\n hideIndicator?: boolean\n indicator?: 'line' | 'dot' | 'dashed'\n nameKey?: string\n labelKey?: string\n}\n\nfunction ChartTooltipContent({\n active,\n payload,\n className,\n indicator = 'dot',\n hideLabel = false,\n hideIndicator = false,\n label,\n labelFormatter,\n labelClassName,\n formatter,\n color,\n nameKey,\n labelKey,\n}: ChartTooltipContentProps) {\n const { config } = useChart()\n\n const tooltipLabel = React.useMemo(() => {\n if (hideLabel || !payload?.length) {\n return null\n }\n\n const [item] = payload\n const key = `${labelKey || item?.dataKey || item?.name || 'value'}`\n const itemConfig = getPayloadConfigFromPayload(config, item, key)\n const value =\n !labelKey && typeof label === 'string'\n ? config[label as keyof typeof config]?.label || label\n : itemConfig?.label\n\n if (labelFormatter) {\n return (\n <div className={cn('font-semibold', labelClassName)}>\n {labelFormatter(value, payload)}\n </div>\n )\n }\n\n if (!value) {\n return null\n }\n\n return <div className={cn('font-semibold', labelClassName)}>{value}</div>\n }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey])\n\n if (!active || !payload?.length) {\n return null\n }\n\n const nestLabel = payload.length === 1 && indicator !== 'dot'\n\n return (\n <div\n className={cn(\n 'grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border bg-background px-2.5 py-1.5 text-xs shadow-xl',\n className\n )}\n style={{ animation: 'chart-tooltip-in var(--duration-slow) ease-out' }}\n >\n {!nestLabel ? tooltipLabel : null}\n <div className=\"grid gap-1.5\">\n {payload\n .filter((item: TooltipPayloadItem) => item.type !== 'none')\n .map((item: TooltipPayloadItem, index: number) => {\n const key = `${nameKey || item.name || item.dataKey || 'value'}`\n const itemConfig = getPayloadConfigFromPayload(config, item, key)\n const indicatorColor = color || (item.payload as Record<string, unknown>)?.fill as string || item.color\n\n return (\n <div\n key={item.dataKey}\n className={cn(\n 'flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-text-muted',\n indicator === 'dot' && 'items-center'\n )}\n >\n {formatter && item?.value !== undefined && item.name ? (\n formatter(item.value, item.name, item, index, item.payload as Record<string, unknown>)\n ) : (\n <>\n {itemConfig?.icon ? (\n <itemConfig.icon />\n ) : (\n !hideIndicator && (\n <div\n className={cn(\n 'shrink-0 rounded-sm',\n {\n 'h-2.5 w-2.5': indicator === 'dot',\n 'w-1': indicator === 'line',\n 'w-0 border-[1.5px] border-dashed bg-transparent':\n indicator === 'dashed',\n 'my-0.5': nestLabel && indicator === 'dashed',\n }\n )}\n style={{\n backgroundColor: indicator === 'dashed' ? 'transparent' : indicatorColor,\n borderColor: indicatorColor,\n }}\n />\n )\n )}\n <div\n className={cn(\n 'flex flex-1 justify-between leading-none',\n nestLabel ? 'items-end' : 'items-center'\n )}\n >\n <div className=\"grid gap-1.5\">\n {nestLabel ? tooltipLabel : null}\n <span className=\"text-text-muted\">\n {itemConfig?.label || item.name}\n </span>\n </div>\n {item.value && (\n <span className=\"font-mono font-semibold text-foreground tabular-nums\">\n {item.value.toLocaleString()}\n </span>\n )}\n </div>\n </>\n )}\n </div>\n )\n })}\n </div>\n </div>\n )\n}\n\nconst ChartLegend = RechartsPrimitive.Legend\n\n// Recharts 3.x legend payload type\ntype LegendPayloadItem = {\n value?: string\n type?: string\n color?: string\n dataKey?: string\n}\n\ntype ChartLegendContentProps = React.ComponentProps<'div'> & {\n payload?: LegendPayloadItem[]\n verticalAlign?: 'top' | 'middle' | 'bottom'\n align?: 'left' | 'center' | 'right'\n /** Recharts passes layout when Legend uses layout prop */\n layout?: 'horizontal' | 'vertical'\n hideIcon?: boolean\n nameKey?: string\n}\n\nfunction ChartLegendContent({\n className,\n hideIcon = false,\n payload,\n verticalAlign = 'bottom',\n align = 'center',\n layout = 'horizontal',\n nameKey,\n}: ChartLegendContentProps) {\n const { config } = useChart()\n\n if (!payload?.length) {\n return null\n }\n\n const isVertical = layout === 'vertical'\n\n return (\n <div\n className={cn(\n 'flex gap-4',\n isVertical\n ? 'flex-col items-start gap-1.5'\n : [\n 'items-center',\n align === 'left' ? 'justify-start' : align === 'right' ? 'justify-end' : 'justify-center',\n verticalAlign === 'top' ? 'pb-3' : 'pt-3',\n ],\n className\n )}\n >\n {payload\n .filter((item: LegendPayloadItem) => item.type !== 'none')\n .map((item: LegendPayloadItem) => {\n const key = `${nameKey || item.dataKey || 'value'}`\n const itemConfig = getPayloadConfigFromPayload(config, item, key)\n\n return (\n <div\n key={item.value}\n className=\"flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-text-muted\"\n >\n {itemConfig?.icon && !hideIcon ? (\n <itemConfig.icon />\n ) : (\n <div\n className=\"h-2 w-2 shrink-0 rounded-sm\"\n style={{\n backgroundColor: item.color,\n }}\n />\n )}\n <span className=\"text-foreground\">{itemConfig?.label}</span>\n </div>\n )\n })}\n </div>\n )\n}\n\n// Helper to extract item config from a payload\nfunction getPayloadConfigFromPayload(\n config: ChartConfig,\n payload: unknown,\n key: string\n) {\n if (typeof payload !== 'object' || payload === null) {\n return undefined\n }\n\n const payloadPayload =\n 'payload' in payload &&\n typeof payload.payload === 'object' &&\n payload.payload !== null\n ? payload.payload\n : undefined\n\n let configLabelKey: string = key\n\n if (\n key in payload &&\n typeof payload[key as keyof typeof payload] === 'string'\n ) {\n configLabelKey = payload[key as keyof typeof payload] as string\n } else if (\n payloadPayload &&\n key in payloadPayload &&\n typeof payloadPayload[key as keyof typeof payloadPayload] === 'string'\n ) {\n configLabelKey = payloadPayload[\n key as keyof typeof payloadPayload\n ] as string\n }\n\n return configLabelKey in config\n ? config[configLabelKey]\n : config[key as keyof typeof config]\n}\n\n// ─── ChartXAxis / ChartYAxis ──────────────────────────────────────────────────\n\n// TOKEN-EXCEPTION: Recharts ignores CSS overrides on axis tick text.\n// Wrapper components apply design-token styles via inline style to ensure override.\nconst CHART_AXIS_TICK_STYLE = { style: { fontSize: 'var(--chart-axis-fs)', fill: 'var(--color-text-subtle)' } } as const\n\ntype ChartXAxisProps = React.ComponentProps<typeof RechartsPrimitive.XAxis>\ntype ChartYAxisProps = React.ComponentProps<typeof RechartsPrimitive.YAxis>\n\nconst CHART_XAXIS_PADDING = { left: 16, right: 16 } as const\n\nfunction ChartXAxis({ tick, padding, ...props }: ChartXAxisProps) {\n return <RechartsPrimitive.XAxis tick={tick ?? CHART_AXIS_TICK_STYLE} padding={padding ?? CHART_XAXIS_PADDING} {...props} />\n}\n\nfunction ChartYAxis({ tick, width = 'auto', ...props }: ChartYAxisProps) {\n return <RechartsPrimitive.YAxis tick={tick ?? CHART_AXIS_TICK_STYLE} width={width} {...props} />\n}\n\n// ─── ChartLine ───────────────────────────────────────────────────────────────\n\nexport type ChartLineType = 'linear' | 'monotone' | 'step' | 'natural'\nexport type ChartLineVariant = 'solid' | 'dashed'\n\n// TOKEN-EXCEPTION: SVG strokeDasharray requires numeric values — CSS variables not supported.\nconst CHART_LINE_DASH = '5 5' as const\n\n// TOKEN-EXCEPTION: SVG r / strokeWidth are geometric attributes — CSS variables not supported.\n// Dot: r=3 strokeWidth=2, ActiveDot: r=5 strokeWidth=2\nconst CHART_DOT_PROPS = { r: 3, strokeWidth: 2 } as const\nconst CHART_ACTIVE_DOT_PROPS = { r: 5, strokeWidth: 2 } as const\n\ntype ChartLineProps = Omit<React.ComponentProps<typeof RechartsPrimitive.Line>, 'type' | 'dot' | 'activeDot'> & {\n /** Curve interpolation type. Default: 'monotone' */\n type?: ChartLineType\n /** Line style. 'dashed' applies stroke-dasharray. Default: 'solid' */\n variant?: ChartLineVariant\n /** Show data point dots. Default: true */\n dot?: boolean\n /** Show highlighted dot on hover. Default: true */\n activeDot?: boolean\n}\n\nfunction ChartLine({\n type = 'monotone',\n variant = 'solid',\n dot: showDot = true,\n activeDot: showActiveDot = true,\n stroke,\n dataKey,\n ...props\n}: ChartLineProps) {\n const { hoverFade, activeDataKey, setActiveDataKey } = useChart()\n\n const isFaded = hoverFade && activeDataKey !== null && activeDataKey !== dataKey\n const opacity = isFaded ? CHART_HOVER_FADE_OPACITY : 1\n\n // When dashed, override strokeDasharray on dots so they remain solid circles.\n const dotProps = showDot\n ? variant === 'dashed' ? { ...CHART_DOT_PROPS, strokeDasharray: '0' } : CHART_DOT_PROPS\n : false\n const activeDotProps = showActiveDot\n ? variant === 'dashed' ? { ...CHART_ACTIVE_DOT_PROPS, strokeDasharray: '0' } : CHART_ACTIVE_DOT_PROPS\n : false\n\n return (\n <RechartsPrimitive.Line\n type={type}\n dataKey={dataKey}\n stroke={stroke}\n strokeWidth={2}\n strokeDasharray={variant === 'dashed' ? CHART_LINE_DASH : undefined}\n dot={dotProps}\n activeDot={activeDotProps}\n strokeOpacity={opacity}\n // Disable Recharts animation to prevent flicker on hover\n {...(hoverFade && { isAnimationActive: false })}\n {...(hoverFade && { onMouseEnter: () => setActiveDataKey(dataKey as string) })}\n style={hoverFade ? { transition: 'stroke-opacity var(--duration-fast) ease-out' } : undefined}\n {...props}\n />\n )\n}\n\n// ─── ChartArea ───────────────────────────────────────────────────────────────\n\nexport type ChartAreaType = 'linear' | 'monotone' | 'step' | 'natural'\nexport type ChartAreaVariant = 'solid' | 'gradient'\n\n// TOKEN-EXCEPTION: SVG fillOpacity requires numeric value.\nconst CHART_AREA_DEFAULT_OPACITY = 0.4\n\ntype ChartAreaProps = Omit<React.ComponentProps<typeof RechartsPrimitive.Area>, 'type' | 'dot' | 'activeDot'> & {\n /** Curve interpolation type. Default: 'monotone' */\n type?: ChartAreaType\n /** Fill style. 'gradient' auto-generates an SVG linearGradient. Default: 'solid' */\n variant?: ChartAreaVariant\n /** Show data point dots. Default: true */\n dot?: boolean\n /** Show highlighted dot on hover. Default: true */\n activeDot?: boolean\n /** Fill opacity for this area (0–1). Default: 0.4 */\n fillOpacity?: number\n}\n\nfunction ChartArea({\n type = 'monotone',\n variant = 'solid',\n dot: showDot = true,\n activeDot: showActiveDot = true,\n fillOpacity = CHART_AREA_DEFAULT_OPACITY,\n stroke,\n fill,\n dataKey,\n ...props\n}: ChartAreaProps) {\n const { hoverFade, activeDataKey, setActiveDataKey } = useChart()\n\n const isFaded = hoverFade && activeDataKey !== null && activeDataKey !== dataKey\n const opacity = isFaded ? CHART_HOVER_FADE_OPACITY : 1\n\n const dotProps = showDot\n ? CHART_DOT_PROPS\n : false\n const activeDotProps = showActiveDot\n ? CHART_ACTIVE_DOT_PROPS\n : false\n\n // Gradient variant: use unique ID referencing dataKey\n const gradientId = `area-gradient-${String(dataKey)}`\n const effectiveFill = variant === 'gradient' ? `url(#${gradientId})` : (fill || stroke)\n const effectiveFillOpacity = variant === 'gradient' ? 1 : fillOpacity\n\n return (\n <>\n {variant === 'gradient' && (\n <defs>\n <linearGradient id={gradientId} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n {/* TOKEN-EXCEPTION: SVG stop attributes require inline values */}\n <stop offset=\"5%\" stopColor={fill || stroke} stopOpacity={0.8} />\n <stop offset=\"95%\" stopColor={fill || stroke} stopOpacity={0} />\n </linearGradient>\n </defs>\n )}\n <RechartsPrimitive.Area\n type={type}\n dataKey={dataKey}\n stroke={stroke}\n fill={effectiveFill}\n fillOpacity={effectiveFillOpacity * opacity}\n strokeWidth={2}\n dot={dotProps}\n activeDot={activeDotProps}\n strokeOpacity={opacity}\n // Disable Recharts animation to prevent flicker on hover\n {...(hoverFade && { isAnimationActive: false })}\n {...(hoverFade && { onMouseEnter: () => setActiveDataKey(dataKey as string) })}\n style={hoverFade ? { transition: 'fill-opacity var(--duration-fast) ease-out, stroke-opacity var(--duration-fast) ease-out' } : undefined}\n {...props}\n />\n </>\n )\n}\n\n// ─── ChartPie ────────────────────────────────────────────────────────────────\n\nexport type ChartPieVariant = 'pie' | 'donut'\nexport type ChartPieLabel = 'none' | 'outside' | 'inside'\nexport type ChartPieLabelContent = 'value' | 'percent'\n\n// TOKEN-EXCEPTION: SVG outerRadius expansion on hover — numeric constant.\nconst CHART_PIE_ACTIVE_OFFSET = 8\n\n// TOKEN-EXCEPTION: SVG innerRadius for donut variant — numeric constant.\nconst CHART_PIE_DONUT_INNER_RADIUS = 60\n\n// TOKEN-EXCEPTION: SVG outside label line — numeric constants.\nconst CHART_PIE_LABEL_RADIAL = 16 // radial segment length from slice edge\nconst CHART_PIE_LABEL_HORIZ = 20 // horizontal segment length\n\n// TOKEN-EXCEPTION: SVG inside label skip angle — numeric constant.\nconst CHART_PIE_SKIP_ANGLE = 15 // hide label for slices smaller than this (degrees)\n\ntype ChartPieProps = Omit<React.ComponentProps<typeof RechartsPrimitive.Pie>, 'label' | 'labelLine' | 'activeShape'> & {\n /** 'donut' applies innerRadius automatically. Default: 'pie' */\n variant?: ChartPieVariant\n /** Label position. Default: 'none' */\n label?: ChartPieLabel\n /** Label display content. Default: 'value' */\n labelContent?: ChartPieLabelContent\n /** Hover expand effect. Default: true */\n activeShape?: boolean\n /** Override inner radius (default: 0 for pie, 60 for donut) */\n innerRadius?: number\n /** Padding angle between slices (degrees). Default: 0 */\n paddingAngle?: number\n /** Corner radius for slices. Default: 0 */\n cornerRadius?: number\n}\n\nfunction ChartPie({\n variant = 'pie',\n label: labelMode = 'none',\n labelContent = 'value',\n activeShape: showActiveShape = true,\n innerRadius,\n paddingAngle = 0,\n cornerRadius = 0,\n startAngle = 90,\n endAngle = -270,\n ...props\n}: ChartPieProps) {\n // Resolve inner radius: explicit prop > variant default\n const resolvedInnerRadius = innerRadius ?? (variant === 'donut' ? CHART_PIE_DONUT_INNER_RADIUS : 0)\n\n // Active shape: render Sector with expanded outer radius on hover\n const activeShapeConfig = showActiveShape\n ? (props: any) => (\n <RechartsPrimitive.Sector\n {...props}\n outerRadius={props.outerRadius + CHART_PIE_ACTIVE_OFFSET}\n />\n )\n : undefined\n\n // Resolve display text from labelContent\n const getDisplayText = (entry: any) =>\n labelContent === 'percent'\n ? `${(entry.percent * 100).toFixed(0)}%`\n : entry.value\n\n // Label rendering\n const labelConfig = labelMode === 'outside'\n ? (entry: any) => {\n const RADIAN = Math.PI / 180\n const { cx, cy, midAngle, outerRadius, fill } = entry\n\n // Point on slice edge\n const sx = cx + outerRadius * Math.cos(-midAngle * RADIAN)\n const sy = cy + outerRadius * Math.sin(-midAngle * RADIAN)\n\n // End of radial segment\n const mx = cx + (outerRadius + CHART_PIE_LABEL_RADIAL) * Math.cos(-midAngle * RADIAN)\n const my = cy + (outerRadius + CHART_PIE_LABEL_RADIAL) * Math.sin(-midAngle * RADIAN)\n\n // Horizontal elbow direction\n const isRight = mx > cx\n const ex = mx + (isRight ? CHART_PIE_LABEL_HORIZ : -CHART_PIE_LABEL_HORIZ)\n\n return (\n <g>\n <polyline\n points={`${sx},${sy} ${mx},${my} ${ex},${my}`}\n fill=\"none\"\n stroke={fill}\n strokeWidth={1}\n strokeOpacity={0.5}\n />\n <text\n x={ex + (isRight ? 4 : -4)}\n y={my}\n textAnchor={isRight ? 'start' : 'end'}\n dominantBaseline=\"central\"\n style={{ fontSize: 'var(--font-size-xs)', fill: 'var(--color-text-muted)' }}\n >\n {getDisplayText(entry)}\n </text>\n </g>\n )\n }\n : labelMode === 'inside'\n ? (entry: any) => {\n // Skip label for small slices\n const angle = Math.abs(entry.endAngle - entry.startAngle)\n if (angle < CHART_PIE_SKIP_ANGLE) return null\n\n const RADIAN = Math.PI / 180\n const { cx, cy, innerRadius: ir, outerRadius: or, midAngle } = entry\n // Pie: push toward outer edge (0.65). Donut ring: use midpoint (0.5)\n const ratio = ir > 0 ? 0.5 : 0.65\n const radius = ir + (or - ir) * ratio\n const x = cx + radius * Math.cos(-midAngle * RADIAN)\n const y = cy + radius * Math.sin(-midAngle * RADIAN)\n\n return (\n <text\n x={x}\n y={y}\n textAnchor=\"middle\"\n dominantBaseline=\"central\"\n style={{ fontSize: 'var(--font-size-xs)', fill: 'white', fontWeight: 600 }}\n >\n {getDisplayText(entry)}\n </text>\n )\n }\n : false\n\n return (\n <RechartsPrimitive.Pie\n innerRadius={resolvedInnerRadius}\n paddingAngle={paddingAngle}\n cornerRadius={cornerRadius}\n startAngle={startAngle}\n endAngle={endAngle}\n label={labelConfig as any}\n labelLine={false}\n activeShape={activeShapeConfig as any}\n {...props}\n />\n )\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n\n// ─── Namespace ──────────────────────────────────────────\nconst Chart = Object.assign(ChartContainer, {\n Bar: ChartBar,\n Line: ChartLine,\n Area: ChartArea,\n Pie: ChartPie,\n Tooltip: ChartTooltip,\n TooltipContent: ChartTooltipContent,\n Legend: ChartLegend,\n LegendContent: ChartLegendContent,\n XAxis: ChartXAxis,\n YAxis: ChartYAxis,\n Style: ChartStyle,\n})\n\nexport {\n Chart,\n ChartContainer,\n ChartBar,\n ChartLine,\n ChartArea,\n ChartPie,\n ChartTooltip,\n ChartTooltipContent,\n ChartLegend,\n ChartLegendContent,\n ChartXAxis,\n ChartYAxis,\n ChartStyle,\n useChart,\n}\n"],"mappings":";AAEA,YAAY,WAAW;AACvB,YAAY,uBAAuB;AACnC,SAAS,UAAU;AAGnB,MAAM,SAAS,EAAE,OAAO,IAAI,MAAM,QAAQ;AAuB1C,MAAM,eAAe,MAAM,cAAwC,IAAI;AAEvE,SAAS,WAAW;AAClB,QAAM,UAAU,MAAM,WAAW,YAAY;AAC7C,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,mDAAmD;AAAA,EACrE;AACA,SAAO;AACT;AAEA,SAAS,eAAe;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,GAAG;AACL,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AEJ,IACA;AAEN,SACE;AAAA,IAAC,kBAAkB;AAAA,IAAlB;AAAA,MACC,aAAa;AAAA,MACb;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO;AAAA,MACP,WAAW;AAAA,MACX,aAAa;AAAA,MACZ,GAAG;AAAA;AAAA,EACN;AAEJ;AAKA,MAAM,QAAQ,OAAO,OAAO,gBAAgB;AAAA,EAC1C,KAAK;AAAA,EACL,MAAM;AAAA,EACN,MAAM;AAAA,EACN,KAAK;AAAA,EACL,SAAS;AAAA,EACT,gBAAgB;AAAA,EAChB,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AACT,CAAC;","names":["config","props"]}
@@ -0,0 +1,24 @@
1
+ import * as class_variance_authority_types from 'class-variance-authority/types';
2
+ import * as React from 'react';
3
+ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
4
+ import { VariantProps } from 'class-variance-authority';
5
+
6
+ declare const checkboxColorMap: {
7
+ readonly default: "data-[state=checked]:bg-foreground data-[state=checked]:border-foreground data-[state=checked]:text-background data-[state=indeterminate]:bg-foreground data-[state=indeterminate]:border-foreground data-[state=indeterminate]:text-background";
8
+ readonly primary: "data-[state=checked]:bg-primary data-[state=checked]:border-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:bg-primary data-[state=indeterminate]:border-primary data-[state=indeterminate]:text-primary-foreground";
9
+ };
10
+ type CheckboxColor = keyof typeof checkboxColorMap;
11
+ declare const checkboxVariants: (props?: ({
12
+ size?: "default" | "sm" | "lg" | null | undefined;
13
+ radius?: "sm" | "none" | "md" | null | undefined;
14
+ weight?: "bold" | "thin" | null | undefined;
15
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
16
+ interface CheckboxProps extends Omit<React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>, 'children'>, VariantProps<typeof checkboxVariants> {
17
+ /** Checked state color */
18
+ color?: CheckboxColor;
19
+ label?: string;
20
+ radius?: 'none' | 'sm' | 'md';
21
+ }
22
+ declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLButtonElement>>;
23
+
24
+ export { Checkbox, type CheckboxColor, type CheckboxProps, checkboxVariants };
@@ -0,0 +1,24 @@
1
+ import * as class_variance_authority_types from 'class-variance-authority/types';
2
+ import * as React from 'react';
3
+ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
4
+ import { VariantProps } from 'class-variance-authority';
5
+
6
+ declare const checkboxColorMap: {
7
+ readonly default: "data-[state=checked]:bg-foreground data-[state=checked]:border-foreground data-[state=checked]:text-background data-[state=indeterminate]:bg-foreground data-[state=indeterminate]:border-foreground data-[state=indeterminate]:text-background";
8
+ readonly primary: "data-[state=checked]:bg-primary data-[state=checked]:border-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:bg-primary data-[state=indeterminate]:border-primary data-[state=indeterminate]:text-primary-foreground";
9
+ };
10
+ type CheckboxColor = keyof typeof checkboxColorMap;
11
+ declare const checkboxVariants: (props?: ({
12
+ size?: "default" | "sm" | "lg" | null | undefined;
13
+ radius?: "sm" | "none" | "md" | null | undefined;
14
+ weight?: "bold" | "thin" | null | undefined;
15
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
16
+ interface CheckboxProps extends Omit<React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>, 'children'>, VariantProps<typeof checkboxVariants> {
17
+ /** Checked state color */
18
+ color?: CheckboxColor;
19
+ label?: string;
20
+ radius?: 'none' | 'sm' | 'md';
21
+ }
22
+ declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLButtonElement>>;
23
+
24
+ export { Checkbox, type CheckboxColor, type CheckboxProps, checkboxVariants };
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var checkbox_exports = {};
31
+ __export(checkbox_exports, {
32
+ Checkbox: () => Checkbox,
33
+ checkboxVariants: () => checkboxVariants
34
+ });
35
+ module.exports = __toCommonJS(checkbox_exports);
36
+ var React = __toESM(require("react"));
37
+ var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"));
38
+ var import_class_variance_authority = require("class-variance-authority");
39
+ var import_utils = require("../../lib/utils");
40
+ var import_field = require("./field");
41
+ const checkboxColorMap = {
42
+ default: "data-[state=checked]:bg-foreground data-[state=checked]:border-foreground data-[state=checked]:text-background data-[state=indeterminate]:bg-foreground data-[state=indeterminate]:border-foreground data-[state=indeterminate]:text-background",
43
+ primary: "data-[state=checked]:bg-primary data-[state=checked]:border-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:bg-primary data-[state=indeterminate]:border-primary data-[state=indeterminate]:text-primary-foreground"
44
+ };
45
+ const checkboxVariants = (0, import_class_variance_authority.cva)(
46
+ [
47
+ "peer relative shrink-0 border-border-form hover:border-border-form-strong transition-all duration-micro ease-out",
48
+ "focus-visible:focus-ring",
49
+ "disabled:cursor-not-allowed disabled:opacity-50",
50
+ // Transparent hit area expansion via ::after
51
+ "after:absolute after:content-['']"
52
+ ].join(" "),
53
+ {
54
+ variants: {
55
+ size: {
56
+ sm: "w-3.5 h-3.5 after:-inset-[5px]",
57
+ // 14px box → 24px click
58
+ default: "w-4 h-4 after:-inset-2",
59
+ // 16px box → 32px click
60
+ lg: "w-5 h-5 after:-inset-2"
61
+ // 20px box → 36px click
62
+ },
63
+ radius: {
64
+ none: "rounded-none",
65
+ // 0px — sharp square
66
+ sm: "rounded-sm",
67
+ // 2px — default checkbox style
68
+ md: "rounded"
69
+ // 4px — softer corners
70
+ },
71
+ weight: {
72
+ thin: "border",
73
+ // 1px
74
+ bold: "border-2"
75
+ // 2px
76
+ }
77
+ },
78
+ defaultVariants: {
79
+ size: "default",
80
+ radius: "sm",
81
+ weight: "bold"
82
+ }
83
+ }
84
+ );
85
+ const checkIconSizes = {
86
+ sm: "w-2.5 h-2.5",
87
+ // 10px in 14px box
88
+ default: "w-3 h-3",
89
+ // 12px in 16px box
90
+ lg: "icon-xs"
91
+ // 14px in 20px box
92
+ };
93
+ const labelSizes = {
94
+ sm: "text-xs",
95
+ // 12px
96
+ default: "text-md",
97
+ // 14px
98
+ lg: "text-base"
99
+ // 16px
100
+ };
101
+ const gapSizes = {
102
+ sm: "gap-1.5",
103
+ default: "gap-2",
104
+ lg: "gap-2.5"
105
+ };
106
+ const Checkbox = React.forwardRef(({ className, size, radius, weight, color = "default", label, disabled, id, ...props }, ref) => {
107
+ const fieldContext = (0, import_field.useFieldContext)();
108
+ const resolvedSize = size || "default";
109
+ const resolvedDisabled = disabled ?? fieldContext?.disabled;
110
+ const generatedId = React.useId();
111
+ const checkboxId = id ?? fieldContext?.id ?? generatedId;
112
+ const checkbox = /* @__PURE__ */ React.createElement(
113
+ CheckboxPrimitive.Root,
114
+ {
115
+ ref,
116
+ id: checkboxId,
117
+ disabled: resolvedDisabled,
118
+ className: (0, import_utils.cn)(
119
+ checkboxVariants({ size, radius, weight }),
120
+ checkboxColorMap[color],
121
+ className
122
+ ),
123
+ ...props
124
+ },
125
+ /* @__PURE__ */ React.createElement(CheckboxPrimitive.Indicator, { className: "flex items-center justify-center animate-checkbox-enter" }, /* @__PURE__ */ React.createElement(CheckIcon, { className: checkIconSizes[resolvedSize] }))
126
+ );
127
+ if (!label) return checkbox;
128
+ return /* @__PURE__ */ React.createElement("div", { className: (0, import_utils.cn)("group flex items-center", gapSizes[resolvedSize]) }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center" }, checkbox), /* @__PURE__ */ React.createElement(
129
+ "label",
130
+ {
131
+ htmlFor: checkboxId,
132
+ className: (0, import_utils.cn)(
133
+ labelSizes[resolvedSize],
134
+ "text-text-muted cursor-pointer select-none transition-colors duration-micro",
135
+ "group-hover:text-foreground",
136
+ resolvedDisabled && "opacity-50 cursor-not-allowed"
137
+ )
138
+ },
139
+ label
140
+ ));
141
+ });
142
+ Checkbox.displayName = "Checkbox";
143
+ function CheckIcon({ className }) {
144
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
145
+ "svg",
146
+ {
147
+ className: (0, import_utils.cn)(className, "hidden [[data-state=checked]_&]:block"),
148
+ fill: "none",
149
+ viewBox: "0 0 24 24",
150
+ stroke: "currentColor",
151
+ strokeWidth: 3,
152
+ "aria-hidden": "true"
153
+ },
154
+ /* @__PURE__ */ React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" })
155
+ ), /* @__PURE__ */ React.createElement(
156
+ "svg",
157
+ {
158
+ className: (0, import_utils.cn)(className, "hidden [[data-state=indeterminate]_&]:block"),
159
+ fill: "none",
160
+ viewBox: "0 0 24 24",
161
+ stroke: "currentColor",
162
+ strokeWidth: 3,
163
+ "aria-hidden": "true"
164
+ },
165
+ /* @__PURE__ */ React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 12h14" })
166
+ ));
167
+ }
168
+ // Annotate the CommonJS export names for ESM import in node:
169
+ 0 && (module.exports = {
170
+ Checkbox,
171
+ checkboxVariants
172
+ });
173
+ //# sourceMappingURL=checkbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/ui/checkbox.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport * as CheckboxPrimitive from '@radix-ui/react-checkbox'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\nimport { useFieldContext } from './field'\n\n// Color maps for checked/indeterminate state\nconst checkboxColorMap = {\n default: 'data-[state=checked]:bg-foreground data-[state=checked]:border-foreground data-[state=checked]:text-background data-[state=indeterminate]:bg-foreground data-[state=indeterminate]:border-foreground data-[state=indeterminate]:text-background',\n primary: 'data-[state=checked]:bg-primary data-[state=checked]:border-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:bg-primary data-[state=indeterminate]:border-primary data-[state=indeterminate]:text-primary-foreground',\n} as const\n\nexport type CheckboxColor = keyof typeof checkboxColorMap\n\n// Checkbox box variants\nconst checkboxVariants = cva(\n [\n 'peer relative shrink-0 border-border-form hover:border-border-form-strong transition-all duration-micro ease-out',\n 'focus-visible:focus-ring',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n // Transparent hit area expansion via ::after\n \"after:absolute after:content-['']\",\n ].join(' '),\n {\n variants: {\n size: {\n sm: 'w-3.5 h-3.5 after:-inset-[5px]', // 14px box → 24px click\n default: 'w-4 h-4 after:-inset-2', // 16px box → 32px click\n lg: 'w-5 h-5 after:-inset-2', // 20px box → 36px click\n },\n radius: {\n none: 'rounded-none', // 0px — sharp square\n sm: 'rounded-sm', // 2px — default checkbox style\n md: 'rounded', // 4px — softer corners\n },\n weight: {\n thin: 'border', // 1px\n bold: 'border-2', // 2px\n },\n },\n defaultVariants: {\n size: 'default',\n radius: 'sm',\n weight: 'bold',\n },\n }\n)\n\n// Check icon sizes per checkbox size\nconst checkIconSizes = {\n sm: 'w-2.5 h-2.5', // 10px in 14px box\n default: 'w-3 h-3', // 12px in 16px box\n lg: 'icon-xs', // 14px in 20px box\n}\n\n// Label font sizes per checkbox size\nconst labelSizes = {\n sm: 'text-xs', // 12px\n default: 'text-md', // 14px\n lg: 'text-base', // 16px\n}\n\n// Gap between checkbox and label\nconst gapSizes = {\n sm: 'gap-1.5',\n default: 'gap-2',\n lg: 'gap-2.5',\n}\n\nexport interface CheckboxProps\n extends Omit<React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>, 'children'>,\n VariantProps<typeof checkboxVariants> {\n /** Checked state color */\n color?: CheckboxColor\n label?: string\n radius?: 'none' | 'sm' | 'md'\n}\n\nconst Checkbox = React.forwardRef<\n React.ElementRef<typeof CheckboxPrimitive.Root>,\n CheckboxProps\n>(({ className, size, radius, weight, color = 'default', label, disabled, id, ...props }, ref) => {\n const fieldContext = useFieldContext()\n const resolvedSize = size || 'default'\n const resolvedDisabled = disabled ?? fieldContext?.disabled\n const generatedId = React.useId()\n const checkboxId = id ?? fieldContext?.id ?? generatedId\n\n const checkbox = (\n <CheckboxPrimitive.Root\n ref={ref}\n id={checkboxId}\n disabled={resolvedDisabled}\n className={cn(\n checkboxVariants({ size, radius, weight }),\n checkboxColorMap[color],\n className\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator className=\"flex items-center justify-center animate-checkbox-enter\">\n <CheckIcon className={checkIconSizes[resolvedSize]} />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n )\n\n if (!label) return checkbox\n\n return (\n <div className={cn('group flex items-center', gapSizes[resolvedSize])}>\n <div className=\"flex items-center\">\n {checkbox}\n </div>\n <label\n htmlFor={checkboxId}\n className={cn(\n labelSizes[resolvedSize],\n 'text-text-muted cursor-pointer select-none transition-colors duration-micro',\n 'group-hover:text-foreground',\n resolvedDisabled && 'opacity-50 cursor-not-allowed'\n )}\n >\n {label}\n </label>\n </div>\n )\n})\nCheckbox.displayName = 'Checkbox'\n\n// Check icon — renders ✓ for checked, — for indeterminate\nfunction CheckIcon({ className }: { className?: string }) {\n return (\n <>\n {/* Check mark (shown when data-state=checked on parent Indicator) */}\n <svg\n className={cn(className, 'hidden [[data-state=checked]_&]:block')}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={3}\n aria-hidden=\"true\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M5 13l4 4L19 7\" />\n </svg>\n {/* Dash (shown when data-state=indeterminate on parent Indicator) */}\n <svg\n className={cn(className, 'hidden [[data-state=indeterminate]_&]:block')}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={3}\n aria-hidden=\"true\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M5 12h14\" />\n </svg>\n </>\n )\n}\n\nexport { Checkbox, checkboxVariants }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AACvB,wBAAmC;AACnC,sCAAuC;AACvC,mBAAmB;AACnB,mBAAgC;AAGhC,MAAM,mBAAmB;AAAA,EACvB,SAAS;AAAA,EACT,SAAS;AACX;AAKA,MAAM,uBAAmB;AAAA,EACvB;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA;AAAA,IAEA;AAAA,EACF,EAAE,KAAK,GAAG;AAAA,EACV;AAAA,IACE,UAAU;AAAA,MACR,MAAM;AAAA,QACJ,IAAI;AAAA;AAAA,QACJ,SAAS;AAAA;AAAA,QACT,IAAI;AAAA;AAAA,MACN;AAAA,MACA,QAAQ;AAAA,QACN,MAAM;AAAA;AAAA,QACN,IAAI;AAAA;AAAA,QACJ,IAAI;AAAA;AAAA,MACN;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AAAA,MACC,SAAS;AAAA,MACT,eAAW;AAAA,QACT,WAAW,YAAY;AAAA,QACvB;AAAA,QACA;AAAA,QACA,oBAAoB;AAAA,MACtB;AAAA;AAAA,IAEC;AAAA,EACH,CACF;AAEJ,CAAC;AACD,SAAS,cAAc;AAGvB,SAAS,UAAU,EAAE,UAAU,GAA2B;AACxD,SACE,0DAEE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW,iBAAG,WAAW,uCAAuC;AAAA,MAChE,MAAK;AAAA,MACL,SAAQ;AAAA,MACR,QAAO;AAAA,MACP,aAAa;AAAA,MACb,eAAY;AAAA;AAAA,IAEZ,oCAAC,UAAK,eAAc,SAAQ,gBAAe,SAAQ,GAAE,kBAAiB;AAAA,EACxE,GAEA;AAAA,IAAC;AAAA;AAAA,MACC,eAAW,iBAAG,WAAW,6CAA6C;AAAA,MACtE,MAAK;AAAA,MACL,SAAQ;AAAA,MACR,QAAO;AAAA,MACP,aAAa;AAAA,MACb,eAAY;AAAA;AAAA,IAEZ,oCAAC,UAAK,eAAc,SAAQ,gBAAe,SAAQ,GAAE,YAAW;AAAA,EAClE,CACF;AAEJ;","names":[]}
@@ -0,0 +1,138 @@
1
+ "use client";
2
+ import * as React from "react";
3
+ import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
4
+ import { cva } from "class-variance-authority";
5
+ import { cn } from "../../lib/utils";
6
+ import { useFieldContext } from "./field";
7
+ const checkboxColorMap = {
8
+ default: "data-[state=checked]:bg-foreground data-[state=checked]:border-foreground data-[state=checked]:text-background data-[state=indeterminate]:bg-foreground data-[state=indeterminate]:border-foreground data-[state=indeterminate]:text-background",
9
+ primary: "data-[state=checked]:bg-primary data-[state=checked]:border-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:bg-primary data-[state=indeterminate]:border-primary data-[state=indeterminate]:text-primary-foreground"
10
+ };
11
+ const checkboxVariants = cva(
12
+ [
13
+ "peer relative shrink-0 border-border-form hover:border-border-form-strong transition-all duration-micro ease-out",
14
+ "focus-visible:focus-ring",
15
+ "disabled:cursor-not-allowed disabled:opacity-50",
16
+ // Transparent hit area expansion via ::after
17
+ "after:absolute after:content-['']"
18
+ ].join(" "),
19
+ {
20
+ variants: {
21
+ size: {
22
+ sm: "w-3.5 h-3.5 after:-inset-[5px]",
23
+ // 14px box → 24px click
24
+ default: "w-4 h-4 after:-inset-2",
25
+ // 16px box → 32px click
26
+ lg: "w-5 h-5 after:-inset-2"
27
+ // 20px box → 36px click
28
+ },
29
+ radius: {
30
+ none: "rounded-none",
31
+ // 0px — sharp square
32
+ sm: "rounded-sm",
33
+ // 2px — default checkbox style
34
+ md: "rounded"
35
+ // 4px — softer corners
36
+ },
37
+ weight: {
38
+ thin: "border",
39
+ // 1px
40
+ bold: "border-2"
41
+ // 2px
42
+ }
43
+ },
44
+ defaultVariants: {
45
+ size: "default",
46
+ radius: "sm",
47
+ weight: "bold"
48
+ }
49
+ }
50
+ );
51
+ const checkIconSizes = {
52
+ sm: "w-2.5 h-2.5",
53
+ // 10px in 14px box
54
+ default: "w-3 h-3",
55
+ // 12px in 16px box
56
+ lg: "icon-xs"
57
+ // 14px in 20px box
58
+ };
59
+ const labelSizes = {
60
+ sm: "text-xs",
61
+ // 12px
62
+ default: "text-md",
63
+ // 14px
64
+ lg: "text-base"
65
+ // 16px
66
+ };
67
+ const gapSizes = {
68
+ sm: "gap-1.5",
69
+ default: "gap-2",
70
+ lg: "gap-2.5"
71
+ };
72
+ const Checkbox = React.forwardRef(({ className, size, radius, weight, color = "default", label, disabled, id, ...props }, ref) => {
73
+ const fieldContext = useFieldContext();
74
+ const resolvedSize = size || "default";
75
+ const resolvedDisabled = disabled ?? fieldContext?.disabled;
76
+ const generatedId = React.useId();
77
+ const checkboxId = id ?? fieldContext?.id ?? generatedId;
78
+ const checkbox = /* @__PURE__ */ React.createElement(
79
+ CheckboxPrimitive.Root,
80
+ {
81
+ ref,
82
+ id: checkboxId,
83
+ disabled: resolvedDisabled,
84
+ className: cn(
85
+ checkboxVariants({ size, radius, weight }),
86
+ checkboxColorMap[color],
87
+ className
88
+ ),
89
+ ...props
90
+ },
91
+ /* @__PURE__ */ React.createElement(CheckboxPrimitive.Indicator, { className: "flex items-center justify-center animate-checkbox-enter" }, /* @__PURE__ */ React.createElement(CheckIcon, { className: checkIconSizes[resolvedSize] }))
92
+ );
93
+ if (!label) return checkbox;
94
+ return /* @__PURE__ */ React.createElement("div", { className: cn("group flex items-center", gapSizes[resolvedSize]) }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center" }, checkbox), /* @__PURE__ */ React.createElement(
95
+ "label",
96
+ {
97
+ htmlFor: checkboxId,
98
+ className: cn(
99
+ labelSizes[resolvedSize],
100
+ "text-text-muted cursor-pointer select-none transition-colors duration-micro",
101
+ "group-hover:text-foreground",
102
+ resolvedDisabled && "opacity-50 cursor-not-allowed"
103
+ )
104
+ },
105
+ label
106
+ ));
107
+ });
108
+ Checkbox.displayName = "Checkbox";
109
+ function CheckIcon({ className }) {
110
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
111
+ "svg",
112
+ {
113
+ className: cn(className, "hidden [[data-state=checked]_&]:block"),
114
+ fill: "none",
115
+ viewBox: "0 0 24 24",
116
+ stroke: "currentColor",
117
+ strokeWidth: 3,
118
+ "aria-hidden": "true"
119
+ },
120
+ /* @__PURE__ */ React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" })
121
+ ), /* @__PURE__ */ React.createElement(
122
+ "svg",
123
+ {
124
+ className: cn(className, "hidden [[data-state=indeterminate]_&]:block"),
125
+ fill: "none",
126
+ viewBox: "0 0 24 24",
127
+ stroke: "currentColor",
128
+ strokeWidth: 3,
129
+ "aria-hidden": "true"
130
+ },
131
+ /* @__PURE__ */ React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 12h14" })
132
+ ));
133
+ }
134
+ export {
135
+ Checkbox,
136
+ checkboxVariants
137
+ };
138
+ //# sourceMappingURL=checkbox.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/ui/checkbox.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport * as CheckboxPrimitive from '@radix-ui/react-checkbox'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\nimport { useFieldContext } from './field'\n\n// Color maps for checked/indeterminate state\nconst checkboxColorMap = {\n default: 'data-[state=checked]:bg-foreground data-[state=checked]:border-foreground data-[state=checked]:text-background data-[state=indeterminate]:bg-foreground data-[state=indeterminate]:border-foreground data-[state=indeterminate]:text-background',\n primary: 'data-[state=checked]:bg-primary data-[state=checked]:border-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:bg-primary data-[state=indeterminate]:border-primary data-[state=indeterminate]:text-primary-foreground',\n} as const\n\nexport type CheckboxColor = keyof typeof checkboxColorMap\n\n// Checkbox box variants\nconst checkboxVariants = cva(\n [\n 'peer relative shrink-0 border-border-form hover:border-border-form-strong transition-all duration-micro ease-out',\n 'focus-visible:focus-ring',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n // Transparent hit area expansion via ::after\n \"after:absolute after:content-['']\",\n ].join(' '),\n {\n variants: {\n size: {\n sm: 'w-3.5 h-3.5 after:-inset-[5px]', // 14px box → 24px click\n default: 'w-4 h-4 after:-inset-2', // 16px box → 32px click\n lg: 'w-5 h-5 after:-inset-2', // 20px box → 36px click\n },\n radius: {\n none: 'rounded-none', // 0px — sharp square\n sm: 'rounded-sm', // 2px — default checkbox style\n md: 'rounded', // 4px — softer corners\n },\n weight: {\n thin: 'border', // 1px\n bold: 'border-2', // 2px\n },\n },\n defaultVariants: {\n size: 'default',\n radius: 'sm',\n weight: 'bold',\n },\n }\n)\n\n// Check icon sizes per checkbox size\nconst checkIconSizes = {\n sm: 'w-2.5 h-2.5', // 10px in 14px box\n default: 'w-3 h-3', // 12px in 16px box\n lg: 'icon-xs', // 14px in 20px box\n}\n\n// Label font sizes per checkbox size\nconst labelSizes = {\n sm: 'text-xs', // 12px\n default: 'text-md', // 14px\n lg: 'text-base', // 16px\n}\n\n// Gap between checkbox and label\nconst gapSizes = {\n sm: 'gap-1.5',\n default: 'gap-2',\n lg: 'gap-2.5',\n}\n\nexport interface CheckboxProps\n extends Omit<React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>, 'children'>,\n VariantProps<typeof checkboxVariants> {\n /** Checked state color */\n color?: CheckboxColor\n label?: string\n radius?: 'none' | 'sm' | 'md'\n}\n\nconst Checkbox = React.forwardRef<\n React.ElementRef<typeof CheckboxPrimitive.Root>,\n CheckboxProps\n>(({ className, size, radius, weight, color = 'default', label, disabled, id, ...props }, ref) => {\n const fieldContext = useFieldContext()\n const resolvedSize = size || 'default'\n const resolvedDisabled = disabled ?? fieldContext?.disabled\n const generatedId = React.useId()\n const checkboxId = id ?? fieldContext?.id ?? generatedId\n\n const checkbox = (\n <CheckboxPrimitive.Root\n ref={ref}\n id={checkboxId}\n disabled={resolvedDisabled}\n className={cn(\n checkboxVariants({ size, radius, weight }),\n checkboxColorMap[color],\n className\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator className=\"flex items-center justify-center animate-checkbox-enter\">\n <CheckIcon className={checkIconSizes[resolvedSize]} />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n )\n\n if (!label) return checkbox\n\n return (\n <div className={cn('group flex items-center', gapSizes[resolvedSize])}>\n <div className=\"flex items-center\">\n {checkbox}\n </div>\n <label\n htmlFor={checkboxId}\n className={cn(\n labelSizes[resolvedSize],\n 'text-text-muted cursor-pointer select-none transition-colors duration-micro',\n 'group-hover:text-foreground',\n resolvedDisabled && 'opacity-50 cursor-not-allowed'\n )}\n >\n {label}\n </label>\n </div>\n )\n})\nCheckbox.displayName = 'Checkbox'\n\n// Check icon — renders ✓ for checked, — for indeterminate\nfunction CheckIcon({ className }: { className?: string }) {\n return (\n <>\n {/* Check mark (shown when data-state=checked on parent Indicator) */}\n <svg\n className={cn(className, 'hidden [[data-state=checked]_&]:block')}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={3}\n aria-hidden=\"true\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M5 13l4 4L19 7\" />\n </svg>\n {/* Dash (shown when data-state=indeterminate on parent Indicator) */}\n <svg\n className={cn(className, 'hidden [[data-state=indeterminate]_&]:block')}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={3}\n aria-hidden=\"true\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M5 12h14\" />\n </svg>\n </>\n )\n}\n\nexport { Checkbox, checkboxVariants }\n"],"mappings":";AAEA,YAAY,WAAW;AACvB,YAAY,uBAAuB;AACnC,SAAS,WAA8B;AACvC,SAAS,UAAU;AACnB,SAAS,uBAAuB;AAGhC,MAAM,mBAAmB;AAAA,EACvB,SAAS;AAAA,EACT,SAAS;AACX;AAKA,MAAM,mBAAmB;AAAA,EACvB;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA;AAAA,IAEA;AAAA,EACF,EAAE,KAAK,GAAG;AAAA,EACV;AAAA,IACE,UAAU;AAAA,MACR,MAAM;AAAA,QACJ,IAAI;AAAA;AAAA,QACJ,SAAS;AAAA;AAAA,QACT,IAAI;AAAA;AAAA,MACN;AAAA,MACA,QAAQ;AAAA,QACN,MAAM;AAAA;AAAA,QACN,IAAI;AAAA;AAAA,QACJ,IAAI;AAAA;AAAA,MACN;AAAA,MACA,QAAQ;AAAA,QACN,MAAM;AAAA;AAAA,QACN,MAAM;AAAA;AAAA,MACR;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,EACF;AACF;AAGA,MAAM,iBAAiB;AAAA,EACrB,IAAI;AAAA;AAAA,EACJ,SAAS;AAAA;AAAA,EACT,IAAI;AAAA;AAC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