@codefast/ui 0.3.11 → 0.3.12-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +4 -0
  3. package/dist/components/accordion.d.ts +11 -29
  4. package/dist/components/accordion.d.ts.map +1 -0
  5. package/dist/components/accordion.js +10 -37
  6. package/dist/components/alert-dialog.d.ts +25 -60
  7. package/dist/components/alert-dialog.d.ts.map +1 -0
  8. package/dist/components/alert-dialog.js +16 -69
  9. package/dist/components/alert.d.ts +16 -27
  10. package/dist/components/alert.d.ts.map +1 -0
  11. package/dist/components/alert.js +22 -30
  12. package/dist/components/aspect-ratio.d.ts +5 -8
  13. package/dist/components/aspect-ratio.d.ts.map +1 -0
  14. package/dist/components/aspect-ratio.js +5 -7
  15. package/dist/components/avatar.d.ts +7 -17
  16. package/dist/components/avatar.d.ts.map +1 -0
  17. package/dist/components/avatar.js +7 -18
  18. package/dist/components/badge.d.ts +15 -21
  19. package/dist/components/badge.d.ts.map +1 -0
  20. package/dist/components/badge.js +23 -20
  21. package/dist/components/breadcrumb.d.ts +13 -35
  22. package/dist/components/breadcrumb.d.ts.map +1 -0
  23. package/dist/components/breadcrumb.js +13 -49
  24. package/dist/components/button-group.d.ts +15 -29
  25. package/dist/components/button-group.d.ts.map +1 -0
  26. package/dist/components/button-group.js +22 -27
  27. package/dist/components/button.d.ts +26 -35
  28. package/dist/components/button.d.ts.map +1 -0
  29. package/dist/components/button.js +43 -51
  30. package/dist/components/calendar.d.ts +10 -24
  31. package/dist/components/calendar.d.ts.map +1 -0
  32. package/dist/components/calendar.js +75 -92
  33. package/dist/components/card.d.ts +11 -34
  34. package/dist/components/card.d.ts.map +1 -0
  35. package/dist/components/card.js +11 -39
  36. package/dist/components/carousel.d.ts +25 -55
  37. package/dist/components/carousel.d.ts.map +1 -0
  38. package/dist/components/carousel.js +82 -114
  39. package/dist/components/chart.d.ts +37 -72
  40. package/dist/components/chart.d.ts.map +1 -0
  41. package/dist/components/chart.js +161 -150
  42. package/dist/components/checkbox-cards.d.ts +9 -15
  43. package/dist/components/checkbox-cards.d.ts.map +1 -0
  44. package/dist/components/checkbox-cards.js +8 -22
  45. package/dist/components/checkbox-group.d.ts +9 -16
  46. package/dist/components/checkbox-group.d.ts.map +1 -0
  47. package/dist/components/checkbox-group.js +7 -19
  48. package/dist/components/checkbox.d.ts +5 -9
  49. package/dist/components/checkbox.d.ts.map +1 -0
  50. package/dist/components/checkbox.js +6 -14
  51. package/dist/components/collapsible.d.ts +7 -14
  52. package/dist/components/collapsible.d.ts.map +1 -0
  53. package/dist/components/collapsible.js +7 -15
  54. package/dist/components/command.d.ts +24 -55
  55. package/dist/components/command.d.ts.map +1 -0
  56. package/dist/components/command.js +18 -69
  57. package/dist/components/context-menu.d.ts +23 -72
  58. package/dist/components/context-menu.d.ts.map +1 -0
  59. package/dist/components/context-menu.js +21 -89
  60. package/dist/components/dialog.d.ts +23 -53
  61. package/dist/components/dialog.d.ts.map +1 -0
  62. package/dist/components/dialog.js +20 -72
  63. package/dist/components/drawer.d.ts +29 -60
  64. package/dist/components/drawer.d.ts.map +1 -0
  65. package/dist/components/drawer.js +16 -58
  66. package/dist/components/dropdown-menu.d.ts +23 -73
  67. package/dist/components/dropdown-menu.d.ts.map +1 -0
  68. package/dist/components/dropdown-menu.js +21 -96
  69. package/dist/components/empty.d.ts +16 -37
  70. package/dist/components/empty.d.ts.map +1 -0
  71. package/dist/components/empty.js +24 -44
  72. package/dist/components/field.d.ts +26 -63
  73. package/dist/components/field.d.ts.map +1 -0
  74. package/dist/components/field.js +46 -89
  75. package/dist/components/form.d.ts +16 -37
  76. package/dist/components/form.d.ts.map +1 -0
  77. package/dist/components/form.js +50 -66
  78. package/dist/components/hover-card.d.ts +8 -21
  79. package/dist/components/hover-card.d.ts.map +1 -0
  80. package/dist/components/hover-card.js +8 -23
  81. package/dist/components/input-group.d.ts +29 -53
  82. package/dist/components/input-group.d.ts.map +1 -0
  83. package/dist/components/input-group.js +59 -66
  84. package/dist/components/input-number.d.ts +8 -28
  85. package/dist/components/input-number.d.ts.map +1 -0
  86. package/dist/components/input-number.js +14 -55
  87. package/dist/components/input-otp.d.ts +11 -24
  88. package/dist/components/input-otp.d.ts.map +1 -0
  89. package/dist/components/input-otp.js +13 -34
  90. package/dist/components/input-password.d.ts +6 -12
  91. package/dist/components/input-password.d.ts.map +1 -0
  92. package/dist/components/input-password.js +10 -31
  93. package/dist/components/input-search.d.ts +9 -18
  94. package/dist/components/input-search.d.ts.map +1 -0
  95. package/dist/components/input-search.js +16 -44
  96. package/dist/components/input.d.ts +5 -10
  97. package/dist/components/input.d.ts.map +1 -0
  98. package/dist/components/input.js +5 -9
  99. package/dist/components/item.d.ts +33 -69
  100. package/dist/components/item.d.ts.map +1 -0
  101. package/dist/components/item.js +47 -90
  102. package/dist/components/kbd.d.ts +6 -13
  103. package/dist/components/kbd.d.ts.map +1 -0
  104. package/dist/components/kbd.js +6 -13
  105. package/dist/components/label.d.ts +5 -9
  106. package/dist/components/label.d.ts.map +1 -0
  107. package/dist/components/label.js +5 -8
  108. package/dist/components/menubar.d.ts +24 -80
  109. package/dist/components/menubar.d.ts.map +1 -0
  110. package/dist/components/menubar.js +23 -99
  111. package/dist/components/native-select.d.ts +7 -16
  112. package/dist/components/native-select.d.ts.map +1 -0
  113. package/dist/components/native-select.js +7 -25
  114. package/dist/components/navigation-menu.d.ts +13 -36
  115. package/dist/components/navigation-menu.d.ts.map +1 -0
  116. package/dist/components/navigation-menu.js +25 -61
  117. package/dist/components/pagination.d.ts +15 -35
  118. package/dist/components/pagination.d.ts.map +1 -0
  119. package/dist/components/pagination.js +13 -55
  120. package/dist/components/popover.d.ts +9 -24
  121. package/dist/components/popover.d.ts.map +1 -0
  122. package/dist/components/popover.js +9 -27
  123. package/dist/components/progress-circle.d.ts +89 -106
  124. package/dist/components/progress-circle.d.ts.map +1 -0
  125. package/dist/components/progress-circle.js +70 -103
  126. package/dist/components/progress.d.ts +5 -10
  127. package/dist/components/progress.d.ts.map +1 -0
  128. package/dist/components/progress.js +7 -13
  129. package/dist/components/radio-cards.d.ts +5 -10
  130. package/dist/components/radio-cards.d.ts.map +1 -0
  131. package/dist/components/radio-cards.js +7 -21
  132. package/dist/components/radio-group.d.ts +6 -13
  133. package/dist/components/radio-group.d.ts.map +1 -0
  134. package/dist/components/radio-group.js +6 -17
  135. package/dist/components/radio.d.ts +6 -12
  136. package/dist/components/radio.d.ts.map +1 -0
  137. package/dist/components/radio.js +5 -10
  138. package/dist/components/resizable.d.ts +8 -18
  139. package/dist/components/resizable.d.ts.map +1 -0
  140. package/dist/components/resizable.js +7 -21
  141. package/dist/components/scroll-area.d.ts +21 -33
  142. package/dist/components/scroll-area.d.ts.map +1 -0
  143. package/dist/components/scroll-area.js +64 -84
  144. package/dist/components/select.d.ts +17 -50
  145. package/dist/components/select.d.ts.map +1 -0
  146. package/dist/components/select.js +26 -78
  147. package/dist/components/separator.d.ts +20 -29
  148. package/dist/components/separator.d.ts.map +1 -0
  149. package/dist/components/separator.js +27 -36
  150. package/dist/components/sheet.d.ts +30 -62
  151. package/dist/components/sheet.d.ts.map +1 -0
  152. package/dist/components/sheet.js +36 -80
  153. package/dist/components/sidebar.d.ts +67 -160
  154. package/dist/components/sidebar.d.ts.map +1 -0
  155. package/dist/components/sidebar.js +166 -301
  156. package/dist/components/skeleton.d.ts +5 -9
  157. package/dist/components/skeleton.d.ts.map +1 -0
  158. package/dist/components/skeleton.js +5 -8
  159. package/dist/components/slider.d.ts +5 -13
  160. package/dist/components/slider.d.ts.map +1 -0
  161. package/dist/components/slider.js +12 -34
  162. package/dist/components/sonner.d.ts +8 -10
  163. package/dist/components/sonner.d.ts.map +1 -0
  164. package/dist/components/sonner.js +13 -16
  165. package/dist/components/spinner.d.ts +6 -12
  166. package/dist/components/spinner.d.ts.map +1 -0
  167. package/dist/components/spinner.js +20 -33
  168. package/dist/components/switch.d.ts +5 -9
  169. package/dist/components/switch.d.ts.map +1 -0
  170. package/dist/components/switch.js +5 -12
  171. package/dist/components/table.d.ts +12 -37
  172. package/dist/components/table.d.ts.map +1 -0
  173. package/dist/components/table.js +12 -47
  174. package/dist/components/tabs.d.ts +8 -21
  175. package/dist/components/tabs.d.ts.map +1 -0
  176. package/dist/components/tabs.js +8 -23
  177. package/dist/components/textarea.d.ts +5 -9
  178. package/dist/components/textarea.d.ts.map +1 -0
  179. package/dist/components/textarea.js +5 -8
  180. package/dist/components/toggle-group.d.ts +10 -24
  181. package/dist/components/toggle-group.d.ts.map +1 -0
  182. package/dist/components/toggle-group.js +20 -38
  183. package/dist/components/toggle.d.ts +18 -25
  184. package/dist/components/toggle.d.ts.map +1 -0
  185. package/dist/components/toggle.js +24 -29
  186. package/dist/components/tooltip.d.ts +9 -24
  187. package/dist/components/tooltip.d.ts.map +1 -0
  188. package/dist/components/tooltip.js +9 -28
  189. package/dist/hooks/use-animated-value.d.ts +2 -4
  190. package/dist/hooks/use-animated-value.d.ts.map +1 -0
  191. package/dist/hooks/use-animated-value.js +67 -58
  192. package/dist/hooks/use-copy-to-clipboard.d.ts +6 -11
  193. package/dist/hooks/use-copy-to-clipboard.d.ts.map +1 -0
  194. package/dist/hooks/use-copy-to-clipboard.js +42 -39
  195. package/dist/hooks/use-is-mobile.d.ts +2 -4
  196. package/dist/hooks/use-is-mobile.d.ts.map +1 -0
  197. package/dist/hooks/use-is-mobile.js +20 -23
  198. package/dist/hooks/use-media-query.d.ts +2 -4
  199. package/dist/hooks/use-media-query.d.ts.map +1 -0
  200. package/dist/hooks/use-media-query.js +49 -46
  201. package/dist/hooks/use-mutation-observer.d.ts +3 -6
  202. package/dist/hooks/use-mutation-observer.d.ts.map +1 -0
  203. package/dist/hooks/use-mutation-observer.js +33 -34
  204. package/dist/hooks/use-pagination.d.ts +15 -22
  205. package/dist/hooks/use-pagination.d.ts.map +1 -0
  206. package/dist/hooks/use-pagination.js +99 -99
  207. package/dist/index.d.ts +131 -69
  208. package/dist/index.d.ts.map +1 -0
  209. package/dist/index.js +68 -69
  210. package/dist/primitives/checkbox-group.d.ts +84 -105
  211. package/dist/primitives/checkbox-group.d.ts.map +1 -0
  212. package/dist/primitives/checkbox-group.js +91 -105
  213. package/dist/primitives/input-number.d.ts +41 -51
  214. package/dist/primitives/input-number.d.ts.map +1 -0
  215. package/dist/primitives/input-number.js +417 -473
  216. package/dist/primitives/input.d.ts +43 -48
  217. package/dist/primitives/input.d.ts.map +1 -0
  218. package/dist/primitives/input.js +67 -66
  219. package/dist/primitives/progress-circle.d.ts +49 -79
  220. package/dist/primitives/progress-circle.d.ts.map +1 -0
  221. package/dist/primitives/progress-circle.js +134 -149
  222. package/package.json +17 -10
  223. package/{dist → src}/css/preset.css +1 -1
  224. /package/{dist → src}/css/amber.css +0 -0
  225. /package/{dist → src}/css/blue.css +0 -0
  226. /package/{dist → src}/css/cyan.css +0 -0
  227. /package/{dist → src}/css/emerald.css +0 -0
  228. /package/{dist → src}/css/fuchsia.css +0 -0
  229. /package/{dist → src}/css/gray.css +0 -0
  230. /package/{dist → src}/css/green.css +0 -0
  231. /package/{dist → src}/css/indigo.css +0 -0
  232. /package/{dist → src}/css/lime.css +0 -0
  233. /package/{dist → src}/css/neutral.css +0 -0
  234. /package/{dist → src}/css/orange.css +0 -0
  235. /package/{dist → src}/css/pink.css +0 -0
  236. /package/{dist → src}/css/purple.css +0 -0
  237. /package/{dist → src}/css/red.css +0 -0
  238. /package/{dist → src}/css/rose.css +0 -0
  239. /package/{dist → src}/css/sky.css +0 -0
  240. /package/{dist → src}/css/slate.css +0 -0
  241. /package/{dist → src}/css/stone.css +0 -0
  242. /package/{dist → src}/css/style.css +0 -0
  243. /package/{dist → src}/css/teal.css +0 -0
  244. /package/{dist → src}/css/violet.css +0 -0
  245. /package/{dist → src}/css/yellow.css +0 -0
  246. /package/{dist → src}/css/zinc.css +0 -0
@@ -1,187 +1,198 @@
1
1
  "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
3
  import { cn } from "@codefast/tailwind-variants";
3
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
- import { useId, useMemo } from "react";
5
4
  import { createContextScope } from "@radix-ui/react-context";
5
+ import { useId, useMemo } from "react";
6
6
  import * as RechartsPrimitive from "recharts";
7
- //#region src/components/chart.tsx
8
- const THEMES = {
9
- dark: ".dark",
10
- light: ""
11
- };
7
+ /* -----------------------------------------------------------------------------
8
+ * Chart Configuration and Theme Constants
9
+ * --------------------------------------------------------------------------- */
10
+ const THEMES = { dark: ".dark", light: "" };
11
+ /* -----------------------------------------------------------------------------
12
+ * Context: ChartProvider
13
+ * --------------------------------------------------------------------------- */
12
14
  const CHART_PROVIDER_NAME = "ChartProvider";
13
15
  const [createChartContext, createChartScope] = createContextScope(CHART_PROVIDER_NAME);
14
16
  const [ChartContextProvider, useChartContext] = createChartContext(CHART_PROVIDER_NAME);
15
17
  function ChartContainer({ __scopeChart, children, className, config, id, ...props }) {
16
- const uniqueId = useId();
17
- const chartId = `chart-${id ?? uniqueId}`;
18
- return /* @__PURE__ */ jsx(ChartContextProvider, {
19
- config,
20
- scope: __scopeChart,
21
- children: /* @__PURE__ */ jsxs("div", {
22
- className: cn("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden", className),
23
- "data-chart": chartId,
24
- "data-slot": "chart",
25
- ...props,
26
- children: [/* @__PURE__ */ jsx(ChartStyle, {
27
- config,
28
- id: chartId
29
- }), /* @__PURE__ */ jsx(RechartsPrimitive.ResponsiveContainer, { children })]
30
- })
31
- });
18
+ const uniqueId = useId();
19
+ const chartId = `chart-${id ?? uniqueId}`;
20
+ return (_jsx(ChartContextProvider, { config: config, scope: __scopeChart, children: _jsxs("div", { className: cn("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden", className), "data-chart": chartId, "data-slot": "chart", ...props, children: [_jsx(ChartStyle, { config: config, id: chartId }), _jsx(RechartsPrimitive.ResponsiveContainer, { children: children })] }) }));
32
21
  }
33
22
  function ChartStyle({ config, id }) {
34
- const colorConfig = Object.entries(config).filter(([, itemConfig]) => itemConfig.theme ?? itemConfig.color);
35
- if (colorConfig.length === 0) return null;
36
- return /* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: generateChartStyles(id, colorConfig) } });
23
+ const colorConfig = Object.entries(config).filter(([, itemConfig]) => itemConfig.theme ?? itemConfig.color);
24
+ if (colorConfig.length === 0) {
25
+ return null;
26
+ }
27
+ return (_jsx("style", { dangerouslySetInnerHTML: {
28
+ __html: generateChartStyles(id, colorConfig),
29
+ } }));
37
30
  }
38
31
  const ChartTooltip = RechartsPrimitive.Tooltip;
32
+ /* -----------------------------------------------------------------------------
33
+ * Component: ChartTooltipContent
34
+ * -------------------------------------------------------------------------- */
39
35
  const CHART_TOOLTIP_CONTENT_NAME = "ChartTooltipContent";
40
- function ChartTooltipContent({ __scopeChart, active, className, color, formatter, hideIndicator = false, hideLabel = false, indicator = "dot", label, labelClassName, labelFormatter, labelKey, nameKey, payload = [] }) {
41
- const { config } = useChartContext(CHART_TOOLTIP_CONTENT_NAME, __scopeChart);
42
- const tooltipLabel = useMemo(() => {
43
- if (hideLabel || payload.length === 0) return null;
44
- const [item] = payload;
45
- const itemConfig = getPayloadConfigFromPayload(config, item, safeToString(labelKey ?? item.dataKey ?? item.name ?? "value"));
46
- const value = !labelKey && typeof label === "string" ? label in config ? config[label].label ?? label : label : itemConfig?.label;
47
- if (labelFormatter) return /* @__PURE__ */ jsx("div", {
48
- className: cn("font-medium", labelClassName),
49
- children: labelFormatter(value, payload)
50
- });
51
- if (!value) return null;
52
- return /* @__PURE__ */ jsx("div", {
53
- className: cn("font-medium", labelClassName),
54
- children: value
55
- });
56
- }, [
57
- label,
58
- labelFormatter,
59
- payload,
60
- hideLabel,
61
- labelClassName,
62
- config,
63
- labelKey
64
- ]);
65
- if (!active || payload.length === 0) return null;
66
- const nestLabel = payload.length === 1 && indicator !== "dot";
67
- return /* @__PURE__ */ jsxs("div", {
68
- className: cn("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl", className),
69
- children: [nestLabel ? null : tooltipLabel, /* @__PURE__ */ jsx("div", {
70
- className: "grid gap-1.5",
71
- children: payload.map((item, index) => {
72
- const key = safeToString(nameKey ?? item.name ?? item.dataKey ?? "value");
73
- const itemConfig = getPayloadConfigFromPayload(config, item, key);
74
- const indicatorColor = color ?? (isRecord(item.payload) && "fill" in item.payload && typeof item.payload.fill === "string" ? item.payload.fill : void 0) ?? item.color;
75
- return /* @__PURE__ */ jsx("div", {
76
- className: cn("flex w-full flex-wrap items-stretch gap-2 [&>svg]:size-2.5 [&>svg]:text-muted-foreground", indicator === "dot" && "items-center"),
77
- children: formatter && item.value !== void 0 && item.name ? formatter(item.value, item.name, item, index, [item]) : /* @__PURE__ */ jsxs(Fragment, { children: [itemConfig?.icon ? /* @__PURE__ */ jsx(itemConfig.icon, {}) : !hideIndicator && /* @__PURE__ */ jsx("div", {
78
- className: cn("shrink-0 rounded-xs border-(--color-border) bg-(--color-bg)", {
79
- "h-2.5 w-2.5": indicator === "dot",
80
- "my-0.5": nestLabel && indicator === "dashed",
81
- "border-1.5 w-0 border-dashed bg-transparent": indicator === "dashed",
82
- "w-1": indicator === "line"
83
- }),
84
- style: {
85
- "--color-bg": indicatorColor,
86
- "--color-border": indicatorColor
87
- }
88
- }), /* @__PURE__ */ jsxs("div", {
89
- className: cn("flex flex-1 justify-between leading-none", nestLabel ? "items-end" : "items-center"),
90
- children: [/* @__PURE__ */ jsxs("div", {
91
- className: "grid gap-1.5",
92
- children: [nestLabel ? tooltipLabel : null, /* @__PURE__ */ jsx("span", {
93
- className: "text-muted-foreground",
94
- children: itemConfig?.label ?? item.name
95
- })]
96
- }), item.value != null && /* @__PURE__ */ jsx("span", {
97
- className: "font-mono font-medium text-foreground tabular-nums",
98
- children: typeof item.value === "number" ? item.value.toLocaleString() : safeToString(item.value)
99
- })]
100
- })] })
101
- }, key);
102
- })
103
- })]
104
- });
36
+ function ChartTooltipContent({ __scopeChart, active, className, color, formatter, hideIndicator = false, hideLabel = false, indicator = "dot", label, labelClassName, labelFormatter, labelKey, nameKey, payload = [], }) {
37
+ const { config } = useChartContext(CHART_TOOLTIP_CONTENT_NAME, __scopeChart);
38
+ const tooltipLabel = useMemo(() => {
39
+ if (hideLabel || payload.length === 0) {
40
+ return null;
41
+ }
42
+ const [item] = payload;
43
+ const key = safeToString(labelKey ?? item.dataKey ?? item.name ?? "value");
44
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
45
+ const value = !labelKey && typeof label === "string"
46
+ ? label in config
47
+ ? (config[label].label ?? label)
48
+ : label
49
+ : itemConfig?.label;
50
+ if (labelFormatter) {
51
+ return (_jsx("div", { className: cn("font-medium", labelClassName), children: labelFormatter(value, payload) }));
52
+ }
53
+ if (!value) {
54
+ return null;
55
+ }
56
+ return _jsx("div", { className: cn("font-medium", labelClassName), children: value });
57
+ }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
58
+ if (!active || payload.length === 0) {
59
+ return null;
60
+ }
61
+ const nestLabel = payload.length === 1 && indicator !== "dot";
62
+ return (_jsxs("div", { className: cn("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl", className), children: [nestLabel ? null : tooltipLabel, _jsx("div", { className: "grid gap-1.5", children: payload.map((item, index) => {
63
+ const key = safeToString(nameKey ?? item.name ?? item.dataKey ?? "value");
64
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
65
+ const indicatorColor = color ??
66
+ (isRecord(item.payload) &&
67
+ "fill" in item.payload &&
68
+ typeof item.payload.fill === "string"
69
+ ? item.payload.fill
70
+ : undefined) ??
71
+ item.color;
72
+ return (_jsx("div", { className: cn("flex w-full flex-wrap items-stretch gap-2 [&>svg]:size-2.5 [&>svg]:text-muted-foreground", indicator === "dot" && "items-center"), children: formatter && item.value !== undefined && item.name ? (formatter(item.value, item.name, item, index, [item])) : (_jsxs(_Fragment, { children: [itemConfig?.icon ? (_jsx(itemConfig.icon, {})) : (!hideIndicator && (_jsx("div", { className: cn("shrink-0 rounded-xs border-(--color-border) bg-(--color-bg)", {
73
+ "h-2.5 w-2.5": indicator === "dot",
74
+ "my-0.5": nestLabel && indicator === "dashed",
75
+ "border-1.5 w-0 border-dashed bg-transparent": indicator === "dashed",
76
+ "w-1": indicator === "line",
77
+ }), style: {
78
+ "--color-bg": indicatorColor,
79
+ "--color-border": indicatorColor,
80
+ } }))), _jsxs("div", { className: cn("flex flex-1 justify-between leading-none", nestLabel ? "items-end" : "items-center"), children: [_jsxs("div", { className: "grid gap-1.5", children: [nestLabel ? tooltipLabel : null, _jsx("span", { className: "text-muted-foreground", children: itemConfig?.label ?? item.name })] }), item.value != null && (_jsx("span", { className: "font-mono font-medium text-foreground tabular-nums", children: typeof item.value === "number"
81
+ ? item.value.toLocaleString()
82
+ : safeToString(item.value) }))] })] })) }, key));
83
+ }) })] }));
105
84
  }
106
85
  const ChartLegend = RechartsPrimitive.Legend;
86
+ /* -----------------------------------------------------------------------------
87
+ * Component: ChartLegendContent
88
+ * -------------------------------------------------------------------------- */
107
89
  const CHART_LEGEND_CONTENT_NAME = "ChartLegendContent";
108
- function ChartLegendContent({ __scopeChart, className, hideIcon = false, nameKey, payload, verticalAlign = "bottom" }) {
109
- const { config } = useChartContext(CHART_LEGEND_CONTENT_NAME, __scopeChart);
110
- if (!payload?.length) return null;
111
- return /* @__PURE__ */ jsx("div", {
112
- className: cn("flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className),
113
- children: payload.map((item) => {
114
- let key = "value";
115
- if (nameKey) key = nameKey;
116
- else if (item.dataKey != null) key = safeToString(item.dataKey);
117
- const itemConfig = getPayloadConfigFromPayload(config, item, key);
118
- return /* @__PURE__ */ jsxs("div", {
119
- className: cn("flex items-center gap-1.5 [&>svg]:size-3 [&>svg]:text-muted-foreground"),
120
- children: [itemConfig?.icon && !hideIcon ? /* @__PURE__ */ jsx(itemConfig.icon, {}) : /* @__PURE__ */ jsx("div", {
121
- className: "size-2 shrink-0 rounded-md",
122
- style: { backgroundColor: item.color }
123
- }), itemConfig?.label]
124
- }, nameKey ? safeToString(itemConfig?.color ?? "") : safeToString(item.value ?? ""));
125
- })
126
- });
90
+ function ChartLegendContent({ __scopeChart, className, hideIcon = false, nameKey, payload, verticalAlign = "bottom", }) {
91
+ const { config } = useChartContext(CHART_LEGEND_CONTENT_NAME, __scopeChart);
92
+ if (!payload?.length) {
93
+ return null;
94
+ }
95
+ return (_jsx("div", { className: cn("flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className), children: payload.map((item) => {
96
+ let key = "value";
97
+ if (nameKey) {
98
+ key = nameKey;
99
+ }
100
+ else if (item.dataKey != null) {
101
+ key = safeToString(item.dataKey);
102
+ }
103
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
104
+ return (_jsxs("div", { className: cn("flex items-center gap-1.5 [&>svg]:size-3 [&>svg]:text-muted-foreground"), children: [itemConfig?.icon && !hideIcon ? (_jsx(itemConfig.icon, {})) : (_jsx("div", { className: "size-2 shrink-0 rounded-md", style: {
105
+ backgroundColor: item.color,
106
+ } })), itemConfig?.label] }, nameKey ? safeToString(itemConfig?.color ?? "") : safeToString(item.value ?? "")));
107
+ }) }));
127
108
  }
109
+ /* -----------------------------------------------------------------------------
110
+ * Helpers
111
+ * -------------------------------------------------------------------------- */
128
112
  /**
129
- * Type guard to check if an unknown value is a record with string keys
130
- */
113
+ * Type guard to check if an unknown value is a record with string keys
114
+ */
131
115
  function isRecord(value) {
132
- return typeof value === "object" && value !== null;
116
+ return typeof value === "object" && value !== null;
133
117
  }
134
118
  /**
135
- * Safely gets a string value from a record by key
136
- */
119
+ * Safely gets a string value from a record by key
120
+ */
137
121
  function getStringValue(record, key) {
138
- if (key in record) {
139
- const value = record[key];
140
- return typeof value === "string" ? value : void 0;
141
- }
122
+ if (key in record) {
123
+ const value = record[key];
124
+ return typeof value === "string" ? value : undefined;
125
+ }
126
+ return undefined;
142
127
  }
143
128
  /**
144
- * Safely converts a value to string without type coercion
145
- */
129
+ * Safely converts a value to string without type coercion
130
+ */
146
131
  function safeToString(value) {
147
- if (typeof value === "string") return value;
148
- if (typeof value === "number") return value.toString();
149
- if (value === null || value === void 0) return "";
150
- if (typeof value === "boolean") return value.toString();
151
- if (typeof value === "bigint") return value.toString();
152
- if (typeof value === "symbol") return value.toString();
153
- return "";
132
+ if (typeof value === "string") {
133
+ return value;
134
+ }
135
+ if (typeof value === "number") {
136
+ return value.toString();
137
+ }
138
+ if (value === null || value === undefined) {
139
+ return "";
140
+ }
141
+ if (typeof value === "boolean") {
142
+ return value.toString();
143
+ }
144
+ if (typeof value === "bigint") {
145
+ return value.toString();
146
+ }
147
+ if (typeof value === "symbol") {
148
+ return value.toString();
149
+ }
150
+ // For objects, arrays, functions, and other complex types, return empty string to avoid [object Object]
151
+ return "";
154
152
  }
155
153
  function getPayloadConfigFromPayload(config, payload, key) {
156
- if (!isRecord(payload)) return;
157
- const payloadPayload = isRecord(payload.payload) ? payload.payload : void 0;
158
- let configLabelKey = key;
159
- const payloadValue = getStringValue(payload, key);
160
- if (payloadValue) configLabelKey = payloadValue;
161
- else if (payloadPayload) {
162
- const nestedValue = getStringValue(payloadPayload, key);
163
- if (nestedValue) configLabelKey = nestedValue;
164
- }
165
- return configLabelKey in config ? config[configLabelKey] : config[key];
154
+ if (!isRecord(payload)) {
155
+ return undefined;
156
+ }
157
+ const payloadPayload = isRecord(payload.payload) ? payload.payload : undefined;
158
+ let configLabelKey = key;
159
+ // Try to get the config key from the payload first
160
+ const payloadValue = getStringValue(payload, key);
161
+ if (payloadValue) {
162
+ configLabelKey = payloadValue;
163
+ }
164
+ else if (payloadPayload) {
165
+ // If not found in the payload, try the nested payload
166
+ const nestedValue = getStringValue(payloadPayload, key);
167
+ if (nestedValue) {
168
+ configLabelKey = nestedValue;
169
+ }
170
+ }
171
+ return configLabelKey in config ? config[configLabelKey] : config[key];
166
172
  }
167
173
  /**
168
- * Generates CSS custom property for a specific theme and config item
169
- */
174
+ * Generates CSS custom property for a specific theme and config item
175
+ */
170
176
  function generateCssVariable(key, itemConfig, theme) {
171
- const color = itemConfig.theme?.[theme] ?? itemConfig.color;
172
- return color ? ` --color-${key}: ${color};` : null;
177
+ const color = itemConfig.theme?.[theme] ?? itemConfig.color;
178
+ return color ? ` --color-${key}: ${color};` : null;
173
179
  }
174
180
  /**
175
- * Generates CSS rules for a specific theme
176
- */
181
+ * Generates CSS rules for a specific theme
182
+ */
177
183
  function generateThemeStyles(theme, prefix, id, colorConfig) {
178
- return `${prefix} [data-chart=${id}] {\n${colorConfig.map(([key, itemConfig]) => generateCssVariable(key, itemConfig, theme)).filter(Boolean).join("\n")}\n}`;
184
+ const cssVariables = colorConfig
185
+ .map(([key, itemConfig]) => generateCssVariable(key, itemConfig, theme))
186
+ .filter(Boolean)
187
+ .join("\n");
188
+ return `${prefix} [data-chart=${id}] {\n${cssVariables}\n}`;
179
189
  }
180
190
  /**
181
- * Generates complete CSS styles for all themes
182
- */
191
+ * Generates complete CSS styles for all themes
192
+ */
183
193
  function generateChartStyles(id, colorConfig) {
184
- return Object.entries(THEMES).map(([theme, prefix]) => generateThemeStyles(theme, prefix, id, colorConfig)).join("\n\n");
194
+ return Object.entries(THEMES)
195
+ .map(([theme, prefix]) => generateThemeStyles(theme, prefix, id, colorConfig))
196
+ .join("\n\n");
185
197
  }
186
- //#endregion
187
- export { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, createChartScope };
198
+ export { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, createChartScope, };
@@ -1,17 +1,11 @@
1
- import { CheckboxGroup, CheckboxGroupItem } from "../primitives/checkbox-group.js";
2
- import { ComponentProps, JSX } from "react";
3
-
4
- //#region src/components/checkbox-cards.d.ts
5
- type CheckboxCardsProps = ComponentProps<typeof CheckboxGroup>;
1
+ import type { ComponentProps, JSX } from "react";
2
+ import * as CheckboxGroupPrimitive from "#primitives/checkbox-group";
3
+ type CheckboxCardsProps = ComponentProps<typeof CheckboxGroupPrimitive.Root>;
6
4
  declare function CheckboxCards(props: CheckboxCardsProps): JSX.Element;
7
- interface CheckboxCardsItemProps extends ComponentProps<typeof CheckboxGroupItem> {
8
- checkboxClassName?: string;
5
+ interface CheckboxCardsItemProps extends ComponentProps<typeof CheckboxGroupPrimitive.Item> {
6
+ checkboxClassName?: string;
9
7
  }
10
- declare function CheckboxCardsItem({
11
- checkboxClassName,
12
- children,
13
- className,
14
- ...props
15
- }: CheckboxCardsItemProps): JSX.Element;
16
- //#endregion
17
- export { CheckboxCards, CheckboxCardsItem, type CheckboxCardsItemProps, type CheckboxCardsProps };
8
+ declare function CheckboxCardsItem({ checkboxClassName, children, className, ...props }: CheckboxCardsItemProps): JSX.Element;
9
+ export { CheckboxCards, CheckboxCardsItem };
10
+ export type { CheckboxCardsItemProps, CheckboxCardsProps };
11
+ //# sourceMappingURL=checkbox-cards.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox-cards.d.ts","sourceRoot":"","sources":["../../src/components/checkbox-cards.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAMjD,OAAO,KAAK,sBAAsB,MAAM,4BAA4B,CAAC;AAMrE,KAAK,kBAAkB,GAAG,cAAc,CAAC,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC;AAE7E,iBAAS,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAE7D;AAMD,UAAU,sBAAuB,SAAQ,cAAc,CAAC,OAAO,sBAAsB,CAAC,IAAI,CAAC;IACzF,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,iBAAS,iBAAiB,CAAC,EACzB,iBAAiB,EACjB,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,sBAAsB,GAAG,GAAG,CAAC,OAAO,CAwBtC;AAMD,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,CAAC;AAC5C,YAAY,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,CAAC"}
@@ -1,30 +1,16 @@
1
1
  "use client";
2
- import { Label } from "./label.js";
3
- import { CheckboxGroup, CheckboxGroupIndicator, CheckboxGroupItem } from "../primitives/checkbox-group.js";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
3
  import { cn } from "@codefast/tailwind-variants";
5
4
  import { CheckIcon } from "lucide-react";
6
- import { jsx, jsxs } from "react/jsx-runtime";
7
- //#region src/components/checkbox-cards.tsx
5
+ import { Label } from "#components/label";
6
+ import * as CheckboxGroupPrimitive from "#primitives/checkbox-group";
8
7
  function CheckboxCards(props) {
9
- return /* @__PURE__ */ jsx(CheckboxGroup, {
10
- "data-slot": "checkbox-cards",
11
- ...props
12
- });
8
+ return _jsx(CheckboxGroupPrimitive.Root, { "data-slot": "checkbox-cards", ...props });
13
9
  }
14
10
  function CheckboxCardsItem({ checkboxClassName, children, className, ...props }) {
15
- return /* @__PURE__ */ jsxs(Label, {
16
- className: cn("flex items-start gap-3 rounded-lg border border-input p-3 transition hover:not-has-disabled:not-has-aria-checked:bg-secondary has-focus-visible:border-ring has-disabled:opacity-50 has-aria-checked:border-primary has-aria-checked:bg-primary/10", className),
17
- "data-slot": "checkbox-card",
18
- children: [/* @__PURE__ */ jsx(CheckboxGroupItem, {
19
- className: cn("peer flex size-4 shrink-0 rounded-sm border border-input text-primary-foreground shadow-xs outline-hidden transition focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-checked:border-primary aria-checked:bg-primary focus-visible:aria-checked:ring-primary/20 dark:bg-input/30 dark:focus-visible:aria-checked:ring-primary/40", checkboxClassName),
20
- "data-slot": "checkbox-card-item",
21
- ...props,
22
- children: /* @__PURE__ */ jsx(CheckboxGroupIndicator, {
23
- "data-slot": "checkbox-card-indicator",
24
- children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-3.5" })
25
- })
26
- }), children]
27
- });
11
+ return (_jsxs(Label, { className: cn("flex items-start gap-3 rounded-lg border border-input p-3 transition hover:not-has-disabled:not-has-aria-checked:bg-secondary has-focus-visible:border-ring has-disabled:opacity-50 has-aria-checked:border-primary has-aria-checked:bg-primary/10", className), "data-slot": "checkbox-card", children: [_jsx(CheckboxGroupPrimitive.Item, { className: cn("peer flex size-4 shrink-0 rounded-sm border border-input text-primary-foreground shadow-xs outline-hidden transition focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-checked:border-primary aria-checked:bg-primary focus-visible:aria-checked:ring-primary/20 dark:bg-input/30 dark:focus-visible:aria-checked:ring-primary/40", checkboxClassName), "data-slot": "checkbox-card-item", ...props, children: _jsx(CheckboxGroupPrimitive.CheckboxGroupIndicator, { "data-slot": "checkbox-card-indicator", children: _jsx(CheckIcon, { className: "size-3.5" }) }) }), children] }));
28
12
  }
29
- //#endregion
13
+ /* -----------------------------------------------------------------------------
14
+ * Exports
15
+ * -------------------------------------------------------------------------- */
30
16
  export { CheckboxCards, CheckboxCardsItem };
@@ -1,16 +1,9 @@
1
- import { CheckboxGroup as CheckboxGroup$1, CheckboxGroupItem as CheckboxGroupItem$1 } from "../primitives/checkbox-group.js";
2
- import { ComponentProps, JSX } from "react";
3
-
4
- //#region src/components/checkbox-group.d.ts
5
- type CheckboxGroupProps = ComponentProps<typeof CheckboxGroup$1>;
6
- declare function CheckboxGroup({
7
- className,
8
- ...props
9
- }: CheckboxGroupProps): JSX.Element;
10
- type CheckboxGroupItemProps = ComponentProps<typeof CheckboxGroupItem$1>;
11
- declare function CheckboxGroupItem({
12
- className,
13
- ...props
14
- }: CheckboxGroupItemProps): JSX.Element;
15
- //#endregion
16
- export { CheckboxGroup, CheckboxGroupItem, type CheckboxGroupItemProps, type CheckboxGroupProps };
1
+ import type { ComponentProps, JSX } from "react";
2
+ import * as CheckboxGroupPrimitive from "#primitives/checkbox-group";
3
+ type CheckboxGroupProps = ComponentProps<typeof CheckboxGroupPrimitive.Root>;
4
+ declare function CheckboxGroup({ className, ...props }: CheckboxGroupProps): JSX.Element;
5
+ type CheckboxGroupItemProps = ComponentProps<typeof CheckboxGroupPrimitive.Item>;
6
+ declare function CheckboxGroupItem({ className, ...props }: CheckboxGroupItemProps): JSX.Element;
7
+ export { CheckboxGroup, CheckboxGroupItem };
8
+ export type { CheckboxGroupItemProps, CheckboxGroupProps };
9
+ //# sourceMappingURL=checkbox-group.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox-group.d.ts","sourceRoot":"","sources":["../../src/components/checkbox-group.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAKjD,OAAO,KAAK,sBAAsB,MAAM,4BAA4B,CAAC;AAMrE,KAAK,kBAAkB,GAAG,cAAc,CAAC,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC;AAE7E,iBAAS,aAAa,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAQ/E;AAMD,KAAK,sBAAsB,GAAG,cAAc,CAAC,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC;AAEjF,iBAAS,iBAAiB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,sBAAsB,GAAG,GAAG,CAAC,OAAO,CAkBvF;AAMD,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,CAAC;AAC5C,YAAY,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,CAAC"}
@@ -1,27 +1,15 @@
1
1
  "use client";
2
- import { CheckboxGroup as CheckboxGroup$1, CheckboxGroupIndicator, CheckboxGroupItem as CheckboxGroupItem$1 } from "../primitives/checkbox-group.js";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { cn } from "@codefast/tailwind-variants";
4
4
  import { CheckIcon } from "lucide-react";
5
- import { jsx } from "react/jsx-runtime";
6
- //#region src/components/checkbox-group.tsx
5
+ import * as CheckboxGroupPrimitive from "#primitives/checkbox-group";
7
6
  function CheckboxGroup({ className, ...props }) {
8
- return /* @__PURE__ */ jsx(CheckboxGroup$1, {
9
- className: cn("grid gap-2", className),
10
- "data-slot": "checkbox-group",
11
- ...props
12
- });
7
+ return (_jsx(CheckboxGroupPrimitive.Root, { className: cn("grid gap-2", className), "data-slot": "checkbox-group", ...props }));
13
8
  }
14
9
  function CheckboxGroupItem({ className, ...props }) {
15
- return /* @__PURE__ */ jsx(CheckboxGroupItem$1, {
16
- className: cn("peer flex size-4 shrink-0 items-center justify-center rounded-sm border border-input text-primary-foreground shadow-xs outline-hidden transition hover:not-disabled:not-aria-checked:border-ring/60 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50 aria-checked:border-primary aria-checked:bg-primary focus-visible:aria-checked:ring-primary/20 aria-invalid:border-destructive aria-invalid:ring-destructive/20 hover:not-disabled:not-aria-checked:aria-invalid:border-destructive/60 aria-checked:aria-invalid:bg-destructive dark:bg-input/30 dark:focus-visible:aria-checked:ring-primary/40 dark:aria-invalid:ring-destructive/40", className),
17
- "data-slot": "checkbox-group-item",
18
- ...props,
19
- children: /* @__PURE__ */ jsx(CheckboxGroupIndicator, {
20
- className: "flex items-center justify-center text-current transition-none",
21
- "data-slot": "checkbox-group-indicator",
22
- children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-3.5" })
23
- })
24
- });
10
+ return (_jsx(CheckboxGroupPrimitive.Item, { className: cn("peer flex size-4 shrink-0 items-center justify-center rounded-sm border border-input text-primary-foreground shadow-xs outline-hidden transition hover:not-disabled:not-aria-checked:border-ring/60 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50 aria-checked:border-primary aria-checked:bg-primary focus-visible:aria-checked:ring-primary/20 aria-invalid:border-destructive aria-invalid:ring-destructive/20 hover:not-disabled:not-aria-checked:aria-invalid:border-destructive/60 aria-checked:aria-invalid:bg-destructive dark:bg-input/30 dark:focus-visible:aria-checked:ring-primary/40 dark:aria-invalid:ring-destructive/40", className), "data-slot": "checkbox-group-item", ...props, children: _jsx(CheckboxGroupPrimitive.CheckboxGroupIndicator, { className: "flex items-center justify-center text-current transition-none", "data-slot": "checkbox-group-indicator", children: _jsx(CheckIcon, { className: "size-3.5" }) }) }));
25
11
  }
26
- //#endregion
12
+ /* -----------------------------------------------------------------------------
13
+ * Exports
14
+ * -------------------------------------------------------------------------- */
27
15
  export { CheckboxGroup, CheckboxGroupItem };
@@ -1,11 +1,7 @@
1
- import { ComponentProps, JSX } from "react";
1
+ import type { ComponentProps, JSX } from "react";
2
2
  import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
3
-
4
- //#region src/components/checkbox.d.ts
5
3
  type CheckboxProps = ComponentProps<typeof CheckboxPrimitive.Root>;
6
- declare function Checkbox({
7
- className,
8
- ...props
9
- }: CheckboxProps): JSX.Element;
10
- //#endregion
11
- export { Checkbox, type CheckboxProps };
4
+ declare function Checkbox({ className, ...props }: CheckboxProps): JSX.Element;
5
+ export { Checkbox };
6
+ export type { CheckboxProps };
7
+ //# sourceMappingURL=checkbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../src/components/checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAGjD,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAO9D,KAAK,aAAa,GAAG,cAAc,CAAC,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC;AAEnE,iBAAS,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,GAAG,GAAG,CAAC,OAAO,CAkBrE;AAMD,OAAO,EAAE,QAAQ,EAAE,CAAC;AACpB,YAAY,EAAE,aAAa,EAAE,CAAC"}
@@ -1,20 +1,12 @@
1
1
  "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
2
3
  import { cn } from "@codefast/tailwind-variants";
3
- import { CheckIcon } from "lucide-react";
4
- import { jsx } from "react/jsx-runtime";
5
4
  import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
6
- //#region src/components/checkbox.tsx
5
+ import { CheckIcon } from "lucide-react";
7
6
  function Checkbox({ className, ...props }) {
8
- return /* @__PURE__ */ jsx(CheckboxPrimitive.Root, {
9
- className: cn("peer flex size-4 shrink-0 items-center justify-center rounded-sm border border-input text-primary-foreground shadow-xs outline-hidden transition hover:not-disabled:not-aria-checked:border-ring/60 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50 aria-checked:border-primary aria-checked:bg-primary aria-checked:focus-visible:ring-primary/20 aria-invalid:border-destructive aria-invalid:ring-destructive/20 hover:not-disabled:not-aria-checked:aria-invalid:border-destructive/60 aria-checked:aria-invalid:bg-destructive dark:bg-input/30 dark:aria-checked:focus-visible:ring-primary/40 dark:aria-invalid:ring-destructive/40", className),
10
- "data-slot": "checkbox",
11
- ...props,
12
- children: /* @__PURE__ */ jsx(CheckboxPrimitive.Indicator, {
13
- className: "flex items-center justify-center text-current transition-none",
14
- "data-slot": "checkbox-indicator",
15
- children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-3.5" })
16
- })
17
- });
7
+ return (_jsx(CheckboxPrimitive.Root, { className: cn("peer flex size-4 shrink-0 items-center justify-center rounded-sm border border-input text-primary-foreground shadow-xs outline-hidden transition hover:not-disabled:not-aria-checked:border-ring/60 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50 aria-checked:border-primary aria-checked:bg-primary aria-checked:focus-visible:ring-primary/20 aria-invalid:border-destructive aria-invalid:ring-destructive/20 hover:not-disabled:not-aria-checked:aria-invalid:border-destructive/60 aria-checked:aria-invalid:bg-destructive dark:bg-input/30 dark:aria-checked:focus-visible:ring-primary/40 dark:aria-invalid:ring-destructive/40", className), "data-slot": "checkbox", ...props, children: _jsx(CheckboxPrimitive.Indicator, { className: "flex items-center justify-center text-current transition-none", "data-slot": "checkbox-indicator", children: _jsx(CheckIcon, { className: "size-3.5" }) }) }));
18
8
  }
19
- //#endregion
9
+ /* -----------------------------------------------------------------------------
10
+ * Exports
11
+ * -------------------------------------------------------------------------- */
20
12
  export { Checkbox };
@@ -1,18 +1,11 @@
1
- import { ComponentProps, JSX } from "react";
1
+ import type { ComponentProps, JSX } from "react";
2
2
  import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
3
-
4
- //#region src/components/collapsible.d.ts
5
3
  type CollapsibleProps = ComponentProps<typeof CollapsiblePrimitive.Root>;
6
- declare function Collapsible({
7
- ...props
8
- }: CollapsibleProps): JSX.Element;
4
+ declare function Collapsible({ ...props }: CollapsibleProps): JSX.Element;
9
5
  type CollapsibleTriggerProps = ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>;
10
- declare function CollapsibleTrigger({
11
- ...props
12
- }: CollapsibleTriggerProps): JSX.Element;
6
+ declare function CollapsibleTrigger({ ...props }: CollapsibleTriggerProps): JSX.Element;
13
7
  type CollapsibleContentProps = ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>;
14
- declare function CollapsibleContent({
15
- ...props
16
- }: CollapsibleContentProps): JSX.Element;
17
- //#endregion
18
- export { Collapsible, CollapsibleContent, type CollapsibleContentProps, type CollapsibleProps, CollapsibleTrigger, type CollapsibleTriggerProps };
8
+ declare function CollapsibleContent({ ...props }: CollapsibleContentProps): JSX.Element;
9
+ export { Collapsible, CollapsibleContent, CollapsibleTrigger };
10
+ export type { CollapsibleContentProps, CollapsibleProps, CollapsibleTriggerProps };
11
+ //# sourceMappingURL=collapsible.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collapsible.d.ts","sourceRoot":"","sources":["../../src/components/collapsible.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,KAAK,oBAAoB,MAAM,6BAA6B,CAAC;AAMpE,KAAK,gBAAgB,GAAG,cAAc,CAAC,OAAO,oBAAoB,CAAC,IAAI,CAAC,CAAC;AAEzE,iBAAS,WAAW,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CAEhE;AAMD,KAAK,uBAAuB,GAAG,cAAc,CAAC,OAAO,oBAAoB,CAAC,kBAAkB,CAAC,CAAC;AAE9F,iBAAS,kBAAkB,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,uBAAuB,GAAG,GAAG,CAAC,OAAO,CAE9E;AAMD,KAAK,uBAAuB,GAAG,cAAc,CAAC,OAAO,oBAAoB,CAAC,kBAAkB,CAAC,CAAC;AAE9F,iBAAS,kBAAkB,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,uBAAuB,GAAG,GAAG,CAAC,OAAO,CAE9E;AAMD,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAC;AAC/D,YAAY,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,CAAC"}
@@ -1,24 +1,16 @@
1
1
  "use client";
2
- import { jsx } from "react/jsx-runtime";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
4
- //#region src/components/collapsible.tsx
5
4
  function Collapsible({ ...props }) {
6
- return /* @__PURE__ */ jsx(CollapsiblePrimitive.Root, {
7
- "data-slot": "collapsible",
8
- ...props
9
- });
5
+ return _jsx(CollapsiblePrimitive.Root, { "data-slot": "collapsible", ...props });
10
6
  }
11
7
  function CollapsibleTrigger({ ...props }) {
12
- return /* @__PURE__ */ jsx(CollapsiblePrimitive.CollapsibleTrigger, {
13
- "data-slot": "collapsible-trigger",
14
- ...props
15
- });
8
+ return _jsx(CollapsiblePrimitive.CollapsibleTrigger, { "data-slot": "collapsible-trigger", ...props });
16
9
  }
17
10
  function CollapsibleContent({ ...props }) {
18
- return /* @__PURE__ */ jsx(CollapsiblePrimitive.CollapsibleContent, {
19
- "data-slot": "collapsible-content",
20
- ...props
21
- });
11
+ return _jsx(CollapsiblePrimitive.CollapsibleContent, { "data-slot": "collapsible-content", ...props });
22
12
  }
23
- //#endregion
13
+ /* -----------------------------------------------------------------------------
14
+ * Exports
15
+ * -------------------------------------------------------------------------- */
24
16
  export { Collapsible, CollapsibleContent, CollapsibleTrigger };