@helloleo/plugins 0.1.20-beta.1 → 0.1.20

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 (132) hide show
  1. package/dist/index.js +9 -10
  2. package/package.json +1 -1
  3. package/src/tools/scaffold.ts +12 -20
  4. package/src/tools/setup-netsuite.ts +7 -4
  5. package/dist/templates/tanstack-start-2026-06-18/components.json +0 -22
  6. package/dist/templates/tanstack-start-2026-06-18/drizzle.config.ts +0 -20
  7. package/dist/templates/tanstack-start-2026-06-18/package.json +0 -103
  8. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/accordion.tsx +0 -51
  9. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/alert-dialog.tsx +0 -115
  10. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/alert.tsx +0 -49
  11. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/aspect-ratio.tsx +0 -5
  12. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/avatar.tsx +0 -47
  13. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/badge.tsx +0 -32
  14. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/breadcrumb.tsx +0 -101
  15. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/button.tsx +0 -49
  16. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/calendar.tsx +0 -177
  17. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/card.tsx +0 -55
  18. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/carousel.tsx +0 -240
  19. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/chart.tsx +0 -331
  20. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/checkbox.tsx +0 -26
  21. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/collapsible.tsx +0 -11
  22. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/command.tsx +0 -143
  23. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/context-menu.tsx +0 -187
  24. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/dialog.tsx +0 -104
  25. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/drawer.tsx +0 -98
  26. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/dropdown-menu.tsx +0 -188
  27. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/form.tsx +0 -171
  28. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/hover-card.tsx +0 -27
  29. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/input-otp.tsx +0 -69
  30. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/input.tsx +0 -22
  31. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/label.tsx +0 -21
  32. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/menubar.tsx +0 -229
  33. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/navigation-menu.tsx +0 -120
  34. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/pagination.tsx +0 -98
  35. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/popover.tsx +0 -31
  36. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/progress.tsx +0 -25
  37. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/radio-group.tsx +0 -36
  38. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/resizable.tsx +0 -37
  39. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/scroll-area.tsx +0 -44
  40. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/select.tsx +0 -152
  41. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/separator.tsx +0 -24
  42. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/sheet.tsx +0 -122
  43. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/sidebar.tsx +0 -744
  44. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/skeleton.tsx +0 -7
  45. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/slider.tsx +0 -23
  46. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/sonner.tsx +0 -23
  47. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/switch.tsx +0 -27
  48. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/table.tsx +0 -94
  49. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/tabs.tsx +0 -53
  50. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/textarea.tsx +0 -21
  51. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/toggle-group.tsx +0 -57
  52. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/toggle.tsx +0 -42
  53. package/dist/templates/tanstack-start-2026-06-18/src/components/ui/tooltip.tsx +0 -32
  54. package/dist/templates/tanstack-start-2026-06-18/src/db/index.ts +0 -9
  55. package/dist/templates/tanstack-start-2026-06-18/src/db/schema.ts +0 -18
  56. package/dist/templates/tanstack-start-2026-06-18/src/global.d.ts +0 -3
  57. package/dist/templates/tanstack-start-2026-06-18/src/hooks/use-mobile.tsx +0 -19
  58. package/dist/templates/tanstack-start-2026-06-18/src/lib/proxy.ts +0 -83
  59. package/dist/templates/tanstack-start-2026-06-18/src/lib/utils.ts +0 -6
  60. package/dist/templates/tanstack-start-2026-06-18/src/routeTree.gen.ts +0 -59
  61. package/dist/templates/tanstack-start-2026-06-18/src/router.tsx +0 -33
  62. package/dist/templates/tanstack-start-2026-06-18/src/routes/__root.tsx +0 -59
  63. package/dist/templates/tanstack-start-2026-06-18/src/routes/index.tsx +0 -33
  64. package/dist/templates/tanstack-start-2026-06-18/src/server.ts +0 -31
  65. package/dist/templates/tanstack-start-2026-06-18/src/styles.css +0 -214
  66. package/dist/templates/tanstack-start-2026-06-18/tsconfig.json +0 -27
  67. package/dist/templates/tanstack-start-2026-06-18/vite.config.ts +0 -17
  68. package/dist/templates/tanstack-start-2026-06-18/wrangler.jsonc +0 -27
  69. package/src/templates/tanstack-start-2026-06-18/components.json +0 -22
  70. package/src/templates/tanstack-start-2026-06-18/drizzle.config.ts +0 -20
  71. package/src/templates/tanstack-start-2026-06-18/package.json +0 -103
  72. package/src/templates/tanstack-start-2026-06-18/src/components/ui/accordion.tsx +0 -51
  73. package/src/templates/tanstack-start-2026-06-18/src/components/ui/alert-dialog.tsx +0 -115
  74. package/src/templates/tanstack-start-2026-06-18/src/components/ui/alert.tsx +0 -49
  75. package/src/templates/tanstack-start-2026-06-18/src/components/ui/aspect-ratio.tsx +0 -5
  76. package/src/templates/tanstack-start-2026-06-18/src/components/ui/avatar.tsx +0 -47
  77. package/src/templates/tanstack-start-2026-06-18/src/components/ui/badge.tsx +0 -32
  78. package/src/templates/tanstack-start-2026-06-18/src/components/ui/breadcrumb.tsx +0 -101
  79. package/src/templates/tanstack-start-2026-06-18/src/components/ui/button.tsx +0 -49
  80. package/src/templates/tanstack-start-2026-06-18/src/components/ui/calendar.tsx +0 -177
  81. package/src/templates/tanstack-start-2026-06-18/src/components/ui/card.tsx +0 -55
  82. package/src/templates/tanstack-start-2026-06-18/src/components/ui/carousel.tsx +0 -240
  83. package/src/templates/tanstack-start-2026-06-18/src/components/ui/chart.tsx +0 -331
  84. package/src/templates/tanstack-start-2026-06-18/src/components/ui/checkbox.tsx +0 -26
  85. package/src/templates/tanstack-start-2026-06-18/src/components/ui/collapsible.tsx +0 -11
  86. package/src/templates/tanstack-start-2026-06-18/src/components/ui/command.tsx +0 -143
  87. package/src/templates/tanstack-start-2026-06-18/src/components/ui/context-menu.tsx +0 -187
  88. package/src/templates/tanstack-start-2026-06-18/src/components/ui/dialog.tsx +0 -104
  89. package/src/templates/tanstack-start-2026-06-18/src/components/ui/drawer.tsx +0 -98
  90. package/src/templates/tanstack-start-2026-06-18/src/components/ui/dropdown-menu.tsx +0 -188
  91. package/src/templates/tanstack-start-2026-06-18/src/components/ui/form.tsx +0 -171
  92. package/src/templates/tanstack-start-2026-06-18/src/components/ui/hover-card.tsx +0 -27
  93. package/src/templates/tanstack-start-2026-06-18/src/components/ui/input-otp.tsx +0 -69
  94. package/src/templates/tanstack-start-2026-06-18/src/components/ui/input.tsx +0 -22
  95. package/src/templates/tanstack-start-2026-06-18/src/components/ui/label.tsx +0 -21
  96. package/src/templates/tanstack-start-2026-06-18/src/components/ui/menubar.tsx +0 -229
  97. package/src/templates/tanstack-start-2026-06-18/src/components/ui/navigation-menu.tsx +0 -120
  98. package/src/templates/tanstack-start-2026-06-18/src/components/ui/pagination.tsx +0 -98
  99. package/src/templates/tanstack-start-2026-06-18/src/components/ui/popover.tsx +0 -31
  100. package/src/templates/tanstack-start-2026-06-18/src/components/ui/progress.tsx +0 -25
  101. package/src/templates/tanstack-start-2026-06-18/src/components/ui/radio-group.tsx +0 -36
  102. package/src/templates/tanstack-start-2026-06-18/src/components/ui/resizable.tsx +0 -37
  103. package/src/templates/tanstack-start-2026-06-18/src/components/ui/scroll-area.tsx +0 -44
  104. package/src/templates/tanstack-start-2026-06-18/src/components/ui/select.tsx +0 -152
  105. package/src/templates/tanstack-start-2026-06-18/src/components/ui/separator.tsx +0 -24
  106. package/src/templates/tanstack-start-2026-06-18/src/components/ui/sheet.tsx +0 -122
  107. package/src/templates/tanstack-start-2026-06-18/src/components/ui/sidebar.tsx +0 -744
  108. package/src/templates/tanstack-start-2026-06-18/src/components/ui/skeleton.tsx +0 -7
  109. package/src/templates/tanstack-start-2026-06-18/src/components/ui/slider.tsx +0 -23
  110. package/src/templates/tanstack-start-2026-06-18/src/components/ui/sonner.tsx +0 -23
  111. package/src/templates/tanstack-start-2026-06-18/src/components/ui/switch.tsx +0 -27
  112. package/src/templates/tanstack-start-2026-06-18/src/components/ui/table.tsx +0 -94
  113. package/src/templates/tanstack-start-2026-06-18/src/components/ui/tabs.tsx +0 -53
  114. package/src/templates/tanstack-start-2026-06-18/src/components/ui/textarea.tsx +0 -21
  115. package/src/templates/tanstack-start-2026-06-18/src/components/ui/toggle-group.tsx +0 -57
  116. package/src/templates/tanstack-start-2026-06-18/src/components/ui/toggle.tsx +0 -42
  117. package/src/templates/tanstack-start-2026-06-18/src/components/ui/tooltip.tsx +0 -32
  118. package/src/templates/tanstack-start-2026-06-18/src/db/index.ts +0 -9
  119. package/src/templates/tanstack-start-2026-06-18/src/db/schema.ts +0 -18
  120. package/src/templates/tanstack-start-2026-06-18/src/global.d.ts +0 -3
  121. package/src/templates/tanstack-start-2026-06-18/src/hooks/use-mobile.tsx +0 -19
  122. package/src/templates/tanstack-start-2026-06-18/src/lib/proxy.ts +0 -83
  123. package/src/templates/tanstack-start-2026-06-18/src/lib/utils.ts +0 -6
  124. package/src/templates/tanstack-start-2026-06-18/src/routeTree.gen.ts +0 -59
  125. package/src/templates/tanstack-start-2026-06-18/src/router.tsx +0 -33
  126. package/src/templates/tanstack-start-2026-06-18/src/routes/__root.tsx +0 -59
  127. package/src/templates/tanstack-start-2026-06-18/src/routes/index.tsx +0 -33
  128. package/src/templates/tanstack-start-2026-06-18/src/server.ts +0 -31
  129. package/src/templates/tanstack-start-2026-06-18/src/styles.css +0 -214
  130. package/src/templates/tanstack-start-2026-06-18/tsconfig.json +0 -27
  131. package/src/templates/tanstack-start-2026-06-18/vite.config.ts +0 -17
  132. package/src/templates/tanstack-start-2026-06-18/wrangler.jsonc +0 -27
@@ -1,240 +0,0 @@
1
- import * as React from "react";
2
- import useEmblaCarousel, { type UseEmblaCarouselType } from "embla-carousel-react";
3
- import { ArrowLeft, ArrowRight } from "lucide-react";
4
-
5
- import { cn } from "@/lib/utils";
6
- import { Button } from "@/components/ui/button";
7
-
8
- type CarouselApi = UseEmblaCarouselType[1];
9
- type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
10
- type CarouselOptions = UseCarouselParameters[0];
11
- type CarouselPlugin = UseCarouselParameters[1];
12
-
13
- type CarouselProps = {
14
- opts?: CarouselOptions;
15
- plugins?: CarouselPlugin;
16
- orientation?: "horizontal" | "vertical";
17
- setApi?: (api: CarouselApi) => void;
18
- };
19
-
20
- type CarouselContextProps = {
21
- carouselRef: ReturnType<typeof useEmblaCarousel>[0];
22
- api: ReturnType<typeof useEmblaCarousel>[1];
23
- scrollPrev: () => void;
24
- scrollNext: () => void;
25
- canScrollPrev: boolean;
26
- canScrollNext: boolean;
27
- } & CarouselProps;
28
-
29
- const CarouselContext = React.createContext<CarouselContextProps | null>(null);
30
-
31
- function useCarousel() {
32
- const context = React.useContext(CarouselContext);
33
-
34
- if (!context) {
35
- throw new Error("useCarousel must be used within a <Carousel />");
36
- }
37
-
38
- return context;
39
- }
40
-
41
- const Carousel = React.forwardRef<
42
- HTMLDivElement,
43
- React.HTMLAttributes<HTMLDivElement> & CarouselProps
44
- >(({ orientation = "horizontal", opts, setApi, plugins, className, children, ...props }, ref) => {
45
- const [carouselRef, api] = useEmblaCarousel(
46
- {
47
- ...opts,
48
- axis: orientation === "horizontal" ? "x" : "y",
49
- },
50
- plugins,
51
- );
52
- const [canScrollPrev, setCanScrollPrev] = React.useState(false);
53
- const [canScrollNext, setCanScrollNext] = React.useState(false);
54
-
55
- const onSelect = React.useCallback((api: CarouselApi) => {
56
- if (!api) {
57
- return;
58
- }
59
-
60
- setCanScrollPrev(api.canScrollPrev());
61
- setCanScrollNext(api.canScrollNext());
62
- }, []);
63
-
64
- const scrollPrev = React.useCallback(() => {
65
- api?.scrollPrev();
66
- }, [api]);
67
-
68
- const scrollNext = React.useCallback(() => {
69
- api?.scrollNext();
70
- }, [api]);
71
-
72
- const handleKeyDown = React.useCallback(
73
- (event: React.KeyboardEvent<HTMLDivElement>) => {
74
- if (event.key === "ArrowLeft") {
75
- event.preventDefault();
76
- scrollPrev();
77
- } else if (event.key === "ArrowRight") {
78
- event.preventDefault();
79
- scrollNext();
80
- }
81
- },
82
- [scrollPrev, scrollNext],
83
- );
84
-
85
- React.useEffect(() => {
86
- if (!api || !setApi) {
87
- return;
88
- }
89
-
90
- setApi(api);
91
- }, [api, setApi]);
92
-
93
- React.useEffect(() => {
94
- if (!api) {
95
- return;
96
- }
97
-
98
- onSelect(api);
99
- api.on("reInit", onSelect);
100
- api.on("select", onSelect);
101
-
102
- return () => {
103
- api?.off("select", onSelect);
104
- };
105
- }, [api, onSelect]);
106
-
107
- return (
108
- <CarouselContext.Provider
109
- value={{
110
- carouselRef,
111
- api: api,
112
- opts,
113
- orientation: orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
114
- scrollPrev,
115
- scrollNext,
116
- canScrollPrev,
117
- canScrollNext,
118
- }}
119
- >
120
- <div
121
- ref={ref}
122
- onKeyDownCapture={handleKeyDown}
123
- className={cn("relative", className)}
124
- role="region"
125
- aria-roledescription="carousel"
126
- {...props}
127
- >
128
- {children}
129
- </div>
130
- </CarouselContext.Provider>
131
- );
132
- });
133
- Carousel.displayName = "Carousel";
134
-
135
- const CarouselContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
136
- ({ className, ...props }, ref) => {
137
- const { carouselRef, orientation } = useCarousel();
138
-
139
- return (
140
- <div ref={carouselRef} className="overflow-hidden">
141
- <div
142
- ref={ref}
143
- className={cn(
144
- "flex",
145
- orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
146
- className,
147
- )}
148
- {...props}
149
- />
150
- </div>
151
- );
152
- },
153
- );
154
- CarouselContent.displayName = "CarouselContent";
155
-
156
- const CarouselItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
157
- ({ className, ...props }, ref) => {
158
- const { orientation } = useCarousel();
159
-
160
- return (
161
- <div
162
- ref={ref}
163
- role="group"
164
- aria-roledescription="slide"
165
- className={cn(
166
- "min-w-0 shrink-0 grow-0 basis-full",
167
- orientation === "horizontal" ? "pl-4" : "pt-4",
168
- className,
169
- )}
170
- {...props}
171
- />
172
- );
173
- },
174
- );
175
- CarouselItem.displayName = "CarouselItem";
176
-
177
- const CarouselPrevious = React.forwardRef<HTMLButtonElement, React.ComponentProps<typeof Button>>(
178
- ({ className, variant = "outline", size = "icon", ...props }, ref) => {
179
- const { orientation, scrollPrev, canScrollPrev } = useCarousel();
180
-
181
- return (
182
- <Button
183
- ref={ref}
184
- variant={variant}
185
- size={size}
186
- className={cn(
187
- "absolute h-8 w-8 rounded-full",
188
- orientation === "horizontal"
189
- ? "-left-12 top-1/2 -translate-y-1/2"
190
- : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
191
- className,
192
- )}
193
- disabled={!canScrollPrev}
194
- onClick={scrollPrev}
195
- {...props}
196
- >
197
- <ArrowLeft className="h-4 w-4" />
198
- <span className="sr-only">Previous slide</span>
199
- </Button>
200
- );
201
- },
202
- );
203
- CarouselPrevious.displayName = "CarouselPrevious";
204
-
205
- const CarouselNext = React.forwardRef<HTMLButtonElement, React.ComponentProps<typeof Button>>(
206
- ({ className, variant = "outline", size = "icon", ...props }, ref) => {
207
- const { orientation, scrollNext, canScrollNext } = useCarousel();
208
-
209
- return (
210
- <Button
211
- ref={ref}
212
- variant={variant}
213
- size={size}
214
- className={cn(
215
- "absolute h-8 w-8 rounded-full",
216
- orientation === "horizontal"
217
- ? "-right-12 top-1/2 -translate-y-1/2"
218
- : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
219
- className,
220
- )}
221
- disabled={!canScrollNext}
222
- onClick={scrollNext}
223
- {...props}
224
- >
225
- <ArrowRight className="h-4 w-4" />
226
- <span className="sr-only">Next slide</span>
227
- </Button>
228
- );
229
- },
230
- );
231
- CarouselNext.displayName = "CarouselNext";
232
-
233
- export {
234
- type CarouselApi,
235
- Carousel,
236
- CarouselContent,
237
- CarouselItem,
238
- CarouselPrevious,
239
- CarouselNext,
240
- };
@@ -1,331 +0,0 @@
1
- import * as React from "react";
2
- import * as RechartsPrimitive from "recharts";
3
-
4
- import { cn } from "@/lib/utils";
5
-
6
- // Format: { THEME_NAME: CSS_SELECTOR }
7
- const THEMES = { light: "", dark: ".dark" } as const;
8
-
9
- export type ChartConfig = {
10
- [k in string]: {
11
- label?: React.ReactNode;
12
- icon?: React.ComponentType;
13
- } & (
14
- | { color?: string; theme?: never }
15
- | { color?: never; theme: Record<keyof typeof THEMES, string> }
16
- );
17
- };
18
-
19
- type ChartContextProps = {
20
- config: ChartConfig;
21
- };
22
-
23
- const ChartContext = React.createContext<ChartContextProps | null>(null);
24
-
25
- function useChart() {
26
- const context = React.useContext(ChartContext);
27
-
28
- if (!context) {
29
- throw new Error("useChart must be used within a <ChartContainer />");
30
- }
31
-
32
- return context;
33
- }
34
-
35
- const ChartContainer = React.forwardRef<
36
- HTMLDivElement,
37
- React.ComponentProps<"div"> & {
38
- config: ChartConfig;
39
- children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"];
40
- }
41
- >(({ id, className, children, config, ...props }, ref) => {
42
- const uniqueId = React.useId();
43
- const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
44
-
45
- return (
46
- <ChartContext.Provider value={{ config }}>
47
- <div
48
- data-chart={chartId}
49
- ref={ref}
50
- className={cn(
51
- "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-none [&_.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[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",
52
- className,
53
- )}
54
- {...props}
55
- >
56
- <ChartStyle id={chartId} config={config} />
57
- <RechartsPrimitive.ResponsiveContainer>{children}</RechartsPrimitive.ResponsiveContainer>
58
- </div>
59
- </ChartContext.Provider>
60
- );
61
- });
62
- ChartContainer.displayName = "Chart";
63
-
64
- const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
65
- const colorConfig = Object.entries(config).filter(([, config]) => config.theme || config.color);
66
-
67
- if (!colorConfig.length) {
68
- return null;
69
- }
70
-
71
- return (
72
- <style
73
- dangerouslySetInnerHTML={{
74
- __html: Object.entries(THEMES)
75
- .map(
76
- ([theme, prefix]) => `
77
- ${prefix} [data-chart=${id}] {
78
- ${colorConfig
79
- .map(([key, itemConfig]) => {
80
- const color = itemConfig.theme?.[theme as keyof typeof itemConfig.theme] || itemConfig.color;
81
- return color ? ` --color-${key}: ${color};` : null;
82
- })
83
- .join("\n")}
84
- }
85
- `,
86
- )
87
- .join("\n"),
88
- }}
89
- />
90
- );
91
- };
92
-
93
- const ChartTooltip = RechartsPrimitive.Tooltip;
94
-
95
- const ChartTooltipContent = React.forwardRef<
96
- HTMLDivElement,
97
- React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
98
- React.ComponentProps<"div"> & {
99
- hideLabel?: boolean;
100
- hideIndicator?: boolean;
101
- indicator?: "line" | "dot" | "dashed";
102
- nameKey?: string;
103
- labelKey?: string;
104
- }
105
- >(
106
- (
107
- {
108
- active,
109
- payload,
110
- className,
111
- indicator = "dot",
112
- hideLabel = false,
113
- hideIndicator = false,
114
- label,
115
- labelFormatter,
116
- labelClassName,
117
- formatter,
118
- color,
119
- nameKey,
120
- labelKey,
121
- },
122
- ref,
123
- ) => {
124
- const { config } = useChart();
125
-
126
- const tooltipLabel = React.useMemo(() => {
127
- if (hideLabel || !payload?.length) {
128
- return null;
129
- }
130
-
131
- const [item] = payload;
132
- const key = `${labelKey || item?.dataKey || item?.name || "value"}`;
133
- const itemConfig = getPayloadConfigFromPayload(config, item, key);
134
- const value =
135
- !labelKey && typeof label === "string"
136
- ? config[label as keyof typeof config]?.label || label
137
- : itemConfig?.label;
138
-
139
- if (labelFormatter) {
140
- return (
141
- <div className={cn("font-medium", labelClassName)}>{labelFormatter(value, payload)}</div>
142
- );
143
- }
144
-
145
- if (!value) {
146
- return null;
147
- }
148
-
149
- return <div className={cn("font-medium", labelClassName)}>{value}</div>;
150
- }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
151
-
152
- if (!active || !payload?.length) {
153
- return null;
154
- }
155
-
156
- const nestLabel = payload.length === 1 && indicator !== "dot";
157
-
158
- return (
159
- <div
160
- ref={ref}
161
- className={cn(
162
- "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",
163
- className,
164
- )}
165
- >
166
- {!nestLabel ? tooltipLabel : null}
167
- <div className="grid gap-1.5">
168
- {payload
169
- .filter((item) => item.type !== "none")
170
- .map((item, index) => {
171
- const key = `${nameKey || item.name || item.dataKey || "value"}`;
172
- const itemConfig = getPayloadConfigFromPayload(config, item, key);
173
- const indicatorColor = color || item.payload.fill || item.color;
174
-
175
- return (
176
- <div
177
- key={item.dataKey}
178
- className={cn(
179
- "flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",
180
- indicator === "dot" && "items-center",
181
- )}
182
- >
183
- {formatter && item?.value !== undefined && item.name ? (
184
- formatter(item.value, item.name, item, index, item.payload)
185
- ) : (
186
- <>
187
- {itemConfig?.icon ? (
188
- <itemConfig.icon />
189
- ) : (
190
- !hideIndicator && (
191
- <div
192
- className={cn(
193
- "shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",
194
- {
195
- "h-2.5 w-2.5": indicator === "dot",
196
- "w-1": indicator === "line",
197
- "w-0 border-[1.5px] border-dashed bg-transparent":
198
- indicator === "dashed",
199
- "my-0.5": nestLabel && indicator === "dashed",
200
- },
201
- )}
202
- style={
203
- {
204
- "--color-bg": indicatorColor,
205
- "--color-border": indicatorColor,
206
- } as React.CSSProperties
207
- }
208
- />
209
- )
210
- )}
211
- <div
212
- className={cn(
213
- "flex flex-1 justify-between leading-none",
214
- nestLabel ? "items-end" : "items-center",
215
- )}
216
- >
217
- <div className="grid gap-1.5">
218
- {nestLabel ? tooltipLabel : null}
219
- <span className="text-muted-foreground">
220
- {itemConfig?.label || item.name}
221
- </span>
222
- </div>
223
- {item.value && (
224
- <span className="font-mono font-medium tabular-nums text-foreground">
225
- {item.value.toLocaleString()}
226
- </span>
227
- )}
228
- </div>
229
- </>
230
- )}
231
- </div>
232
- );
233
- })}
234
- </div>
235
- </div>
236
- );
237
- },
238
- );
239
- ChartTooltipContent.displayName = "ChartTooltip";
240
-
241
- const ChartLegend = RechartsPrimitive.Legend;
242
-
243
- const ChartLegendContent = React.forwardRef<
244
- HTMLDivElement,
245
- React.ComponentProps<"div"> &
246
- Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
247
- hideIcon?: boolean;
248
- nameKey?: string;
249
- }
250
- >(({ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey }, ref) => {
251
- const { config } = useChart();
252
-
253
- if (!payload?.length) {
254
- return null;
255
- }
256
-
257
- return (
258
- <div
259
- ref={ref}
260
- className={cn(
261
- "flex items-center justify-center gap-4",
262
- verticalAlign === "top" ? "pb-3" : "pt-3",
263
- className,
264
- )}
265
- >
266
- {payload
267
- .filter((item) => item.type !== "none")
268
- .map((item) => {
269
- const key = `${nameKey || item.dataKey || "value"}`;
270
- const itemConfig = getPayloadConfigFromPayload(config, item, key);
271
-
272
- return (
273
- <div
274
- key={item.value}
275
- className={cn(
276
- "flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground",
277
- )}
278
- >
279
- {itemConfig?.icon && !hideIcon ? (
280
- <itemConfig.icon />
281
- ) : (
282
- <div
283
- className="h-2 w-2 shrink-0 rounded-[2px]"
284
- style={{
285
- backgroundColor: item.color,
286
- }}
287
- />
288
- )}
289
- {itemConfig?.label}
290
- </div>
291
- );
292
- })}
293
- </div>
294
- );
295
- });
296
- ChartLegendContent.displayName = "ChartLegend";
297
-
298
- // Helper to extract item config from a payload.
299
- function getPayloadConfigFromPayload(config: ChartConfig, payload: unknown, key: string) {
300
- if (typeof payload !== "object" || payload === null) {
301
- return undefined;
302
- }
303
-
304
- const payloadPayload =
305
- "payload" in payload && typeof payload.payload === "object" && payload.payload !== null
306
- ? payload.payload
307
- : undefined;
308
-
309
- let configLabelKey: string = key;
310
-
311
- if (key in payload && typeof payload[key as keyof typeof payload] === "string") {
312
- configLabelKey = payload[key as keyof typeof payload] as string;
313
- } else if (
314
- payloadPayload &&
315
- key in payloadPayload &&
316
- typeof payloadPayload[key as keyof typeof payloadPayload] === "string"
317
- ) {
318
- configLabelKey = payloadPayload[key as keyof typeof payloadPayload] as string;
319
- }
320
-
321
- return configLabelKey in config ? config[configLabelKey] : config[key as keyof typeof config];
322
- }
323
-
324
- export {
325
- ChartContainer,
326
- ChartTooltip,
327
- ChartTooltipContent,
328
- ChartLegend,
329
- ChartLegendContent,
330
- ChartStyle,
331
- };
@@ -1,26 +0,0 @@
1
- import * as React from "react";
2
- import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
3
- import { Check } from "lucide-react";
4
-
5
- import { cn } from "@/lib/utils";
6
-
7
- const Checkbox = React.forwardRef<
8
- React.ElementRef<typeof CheckboxPrimitive.Root>,
9
- React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
10
- >(({ className, ...props }, ref) => (
11
- <CheckboxPrimitive.Root
12
- ref={ref}
13
- className={cn(
14
- "grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow cursor-pointer focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
15
- className,
16
- )}
17
- {...props}
18
- >
19
- <CheckboxPrimitive.Indicator className={cn("grid place-content-center text-current")}>
20
- <Check className="h-4 w-4" />
21
- </CheckboxPrimitive.Indicator>
22
- </CheckboxPrimitive.Root>
23
- ));
24
- Checkbox.displayName = CheckboxPrimitive.Root.displayName;
25
-
26
- export { Checkbox };
@@ -1,11 +0,0 @@
1
- "use client";
2
-
3
- import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
4
-
5
- const Collapsible = CollapsiblePrimitive.Root;
6
-
7
- const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;
8
-
9
- const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;
10
-
11
- export { Collapsible, CollapsibleTrigger, CollapsibleContent };