@crmy/web 0.5.5 → 0.5.9

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 (121) hide show
  1. package/dist/assets/index-CskfWp8E.js +560 -0
  2. package/dist/assets/index-D763l57m.css +1 -0
  3. package/{index.html → dist/index.html} +2 -1
  4. package/package.json +4 -1
  5. package/postcss.config.js +0 -6
  6. package/src/App.tsx +0 -158
  7. package/src/api/client.ts +0 -82
  8. package/src/api/hooks.ts +0 -689
  9. package/src/components/CustomFields.tsx +0 -240
  10. package/src/components/NavLink.tsx +0 -28
  11. package/src/components/crm/AIFab.tsx +0 -37
  12. package/src/components/crm/AccountDrawer.tsx +0 -372
  13. package/src/components/crm/ActivityTimeline.tsx +0 -115
  14. package/src/components/crm/AssignmentDrawer.tsx +0 -396
  15. package/src/components/crm/BriefingPanel.tsx +0 -217
  16. package/src/components/crm/CommandPalette.tsx +0 -254
  17. package/src/components/crm/ContactAvatar.tsx +0 -49
  18. package/src/components/crm/ContactDrawer.tsx +0 -438
  19. package/src/components/crm/ContextPanel.tsx +0 -200
  20. package/src/components/crm/CrmWidgets.tsx +0 -417
  21. package/src/components/crm/DrawerShell.tsx +0 -77
  22. package/src/components/crm/ListToolbar.tsx +0 -252
  23. package/src/components/crm/OpportunityDrawer.tsx +0 -372
  24. package/src/components/crm/PaginationBar.tsx +0 -111
  25. package/src/components/crm/QuickAddDrawer.tsx +0 -652
  26. package/src/components/crm/ShortcutsOverlay.tsx +0 -65
  27. package/src/components/crm/UseCaseDrawer.tsx +0 -454
  28. package/src/components/layout/MobileNav.tsx +0 -49
  29. package/src/components/layout/Sidebar.tsx +0 -157
  30. package/src/components/layout/TopBar.tsx +0 -54
  31. package/src/components/settings/ActorsSettings.tsx +0 -1190
  32. package/src/components/ui/accordion.tsx +0 -52
  33. package/src/components/ui/alert-dialog.tsx +0 -104
  34. package/src/components/ui/alert.tsx +0 -43
  35. package/src/components/ui/aspect-ratio.tsx +0 -5
  36. package/src/components/ui/avatar.tsx +0 -38
  37. package/src/components/ui/badge.tsx +0 -29
  38. package/src/components/ui/breadcrumb.tsx +0 -90
  39. package/src/components/ui/button.tsx +0 -47
  40. package/src/components/ui/calendar.tsx +0 -54
  41. package/src/components/ui/card.tsx +0 -43
  42. package/src/components/ui/carousel.tsx +0 -224
  43. package/src/components/ui/chart.tsx +0 -303
  44. package/src/components/ui/checkbox.tsx +0 -26
  45. package/src/components/ui/collapsible.tsx +0 -9
  46. package/src/components/ui/command.tsx +0 -132
  47. package/src/components/ui/context-menu.tsx +0 -178
  48. package/src/components/ui/date-picker.tsx +0 -313
  49. package/src/components/ui/dialog.tsx +0 -95
  50. package/src/components/ui/drawer.tsx +0 -87
  51. package/src/components/ui/dropdown-menu.tsx +0 -179
  52. package/src/components/ui/form.tsx +0 -129
  53. package/src/components/ui/hover-card.tsx +0 -27
  54. package/src/components/ui/input-otp.tsx +0 -61
  55. package/src/components/ui/input.tsx +0 -22
  56. package/src/components/ui/label.tsx +0 -17
  57. package/src/components/ui/menubar.tsx +0 -207
  58. package/src/components/ui/navigation-menu.tsx +0 -120
  59. package/src/components/ui/pagination.tsx +0 -81
  60. package/src/components/ui/popover.tsx +0 -29
  61. package/src/components/ui/progress.tsx +0 -23
  62. package/src/components/ui/radio-group.tsx +0 -36
  63. package/src/components/ui/resizable.tsx +0 -37
  64. package/src/components/ui/scroll-area.tsx +0 -38
  65. package/src/components/ui/select.tsx +0 -143
  66. package/src/components/ui/separator.tsx +0 -20
  67. package/src/components/ui/sheet.tsx +0 -107
  68. package/src/components/ui/sidebar.tsx +0 -637
  69. package/src/components/ui/skeleton.tsx +0 -7
  70. package/src/components/ui/slider.tsx +0 -23
  71. package/src/components/ui/sonner.tsx +0 -24
  72. package/src/components/ui/switch.tsx +0 -27
  73. package/src/components/ui/table.tsx +0 -72
  74. package/src/components/ui/tabs.tsx +0 -53
  75. package/src/components/ui/textarea.tsx +0 -21
  76. package/src/components/ui/toast.tsx +0 -111
  77. package/src/components/ui/toaster.tsx +0 -24
  78. package/src/components/ui/toggle-group.tsx +0 -49
  79. package/src/components/ui/toggle.tsx +0 -37
  80. package/src/components/ui/tooltip.tsx +0 -28
  81. package/src/components/ui/use-toast.ts +0 -1
  82. package/src/components/ui/utils.ts +0 -9
  83. package/src/contexts/AgentSettingsContext.tsx +0 -24
  84. package/src/hooks/use-mobile.tsx +0 -19
  85. package/src/hooks/use-toast.ts +0 -186
  86. package/src/hooks/useKeyboardShortcuts.ts +0 -95
  87. package/src/hooks/useTheme.ts +0 -24
  88. package/src/index.css +0 -245
  89. package/src/lib/entityColors.ts +0 -18
  90. package/src/lib/stageConfig.ts +0 -32
  91. package/src/lib/utils.ts +0 -6
  92. package/src/main.tsx +0 -25
  93. package/src/pages/Accounts.tsx +0 -205
  94. package/src/pages/Activities.tsx +0 -251
  95. package/src/pages/Agent.tsx +0 -237
  96. package/src/pages/AgentSettings.tsx +0 -544
  97. package/src/pages/Assignments.tsx +0 -750
  98. package/src/pages/Contacts.tsx +0 -200
  99. package/src/pages/Dashboard.tsx +0 -143
  100. package/src/pages/Inbox.tsx +0 -615
  101. package/src/pages/NotFound.tsx +0 -24
  102. package/src/pages/Opportunities.tsx +0 -386
  103. package/src/pages/SearchResults.tsx +0 -49
  104. package/src/pages/Settings.tsx +0 -1884
  105. package/src/pages/UseCases.tsx +0 -396
  106. package/src/pages/auth/Login.tsx +0 -261
  107. package/src/pages/hitl/HITL.tsx +0 -101
  108. package/src/store/appStore.ts +0 -103
  109. package/src/vite-env.d.ts +0 -14
  110. package/tailwind.config.js +0 -121
  111. package/tsconfig.json +0 -24
  112. package/vite.config.ts +0 -27
  113. /package/{public → dist}/android-chrome-192x192.png +0 -0
  114. /package/{public → dist}/android-chrome-512x512.png +0 -0
  115. /package/{public → dist}/apple-touch-icon.png +0 -0
  116. /package/{src/assets/crmy-logo.png → dist/assets/crmy-logo-DWN0xBPW.png} +0 -0
  117. /package/{public → dist}/favicon-16x16.png +0 -0
  118. /package/{public → dist}/favicon-32x32.png +0 -0
  119. /package/{public → dist}/favicon.ico +0 -0
  120. /package/{public → dist}/favicon.svg +0 -0
  121. /package/{public → dist}/site.webmanifest +0 -0
@@ -1,224 +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<HTMLDivElement, React.HTMLAttributes<HTMLDivElement> & CarouselProps>(
42
- ({ orientation = "horizontal", opts, setApi, plugins, className, children, ...props }, ref) => {
43
- const [carouselRef, api] = useEmblaCarousel(
44
- {
45
- ...opts,
46
- axis: orientation === "horizontal" ? "x" : "y",
47
- },
48
- plugins,
49
- );
50
- const [canScrollPrev, setCanScrollPrev] = React.useState(false);
51
- const [canScrollNext, setCanScrollNext] = React.useState(false);
52
-
53
- const onSelect = React.useCallback((api: CarouselApi) => {
54
- if (!api) {
55
- return;
56
- }
57
-
58
- setCanScrollPrev(api.canScrollPrev());
59
- setCanScrollNext(api.canScrollNext());
60
- }, []);
61
-
62
- const scrollPrev = React.useCallback(() => {
63
- api?.scrollPrev();
64
- }, [api]);
65
-
66
- const scrollNext = React.useCallback(() => {
67
- api?.scrollNext();
68
- }, [api]);
69
-
70
- const handleKeyDown = React.useCallback(
71
- (event: React.KeyboardEvent<HTMLDivElement>) => {
72
- if (event.key === "ArrowLeft") {
73
- event.preventDefault();
74
- scrollPrev();
75
- } else if (event.key === "ArrowRight") {
76
- event.preventDefault();
77
- scrollNext();
78
- }
79
- },
80
- [scrollPrev, scrollNext],
81
- );
82
-
83
- React.useEffect(() => {
84
- if (!api || !setApi) {
85
- return;
86
- }
87
-
88
- setApi(api);
89
- }, [api, setApi]);
90
-
91
- React.useEffect(() => {
92
- if (!api) {
93
- return;
94
- }
95
-
96
- onSelect(api);
97
- api.on("reInit", onSelect);
98
- api.on("select", onSelect);
99
-
100
- return () => {
101
- api?.off("select", onSelect);
102
- };
103
- }, [api, onSelect]);
104
-
105
- return (
106
- <CarouselContext.Provider
107
- value={{
108
- carouselRef,
109
- api: api,
110
- opts,
111
- orientation: orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
112
- scrollPrev,
113
- scrollNext,
114
- canScrollPrev,
115
- canScrollNext,
116
- }}
117
- >
118
- <div
119
- ref={ref}
120
- onKeyDownCapture={handleKeyDown}
121
- className={cn("relative", className)}
122
- role="region"
123
- aria-roledescription="carousel"
124
- {...props}
125
- >
126
- {children}
127
- </div>
128
- </CarouselContext.Provider>
129
- );
130
- },
131
- );
132
- Carousel.displayName = "Carousel";
133
-
134
- const CarouselContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
135
- ({ className, ...props }, ref) => {
136
- const { carouselRef, orientation } = useCarousel();
137
-
138
- return (
139
- <div ref={carouselRef} className="overflow-hidden">
140
- <div
141
- ref={ref}
142
- className={cn("flex", orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col", className)}
143
- {...props}
144
- />
145
- </div>
146
- );
147
- },
148
- );
149
- CarouselContent.displayName = "CarouselContent";
150
-
151
- const CarouselItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
152
- ({ className, ...props }, ref) => {
153
- const { orientation } = useCarousel();
154
-
155
- return (
156
- <div
157
- ref={ref}
158
- role="group"
159
- aria-roledescription="slide"
160
- className={cn("min-w-0 shrink-0 grow-0 basis-full", orientation === "horizontal" ? "pl-4" : "pt-4", className)}
161
- {...props}
162
- />
163
- );
164
- },
165
- );
166
- CarouselItem.displayName = "CarouselItem";
167
-
168
- const CarouselPrevious = React.forwardRef<HTMLButtonElement, React.ComponentProps<typeof Button>>(
169
- ({ className, variant = "outline", size = "icon", ...props }, ref) => {
170
- const { orientation, scrollPrev, canScrollPrev } = useCarousel();
171
-
172
- return (
173
- <Button
174
- ref={ref}
175
- variant={variant}
176
- size={size}
177
- className={cn(
178
- "absolute h-8 w-8 rounded-full",
179
- orientation === "horizontal"
180
- ? "-left-12 top-1/2 -translate-y-1/2"
181
- : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
182
- className,
183
- )}
184
- disabled={!canScrollPrev}
185
- onClick={scrollPrev}
186
- {...props}
187
- >
188
- <ArrowLeft className="h-4 w-4" />
189
- <span className="sr-only">Previous slide</span>
190
- </Button>
191
- );
192
- },
193
- );
194
- CarouselPrevious.displayName = "CarouselPrevious";
195
-
196
- const CarouselNext = React.forwardRef<HTMLButtonElement, React.ComponentProps<typeof Button>>(
197
- ({ className, variant = "outline", size = "icon", ...props }, ref) => {
198
- const { orientation, scrollNext, canScrollNext } = useCarousel();
199
-
200
- return (
201
- <Button
202
- ref={ref}
203
- variant={variant}
204
- size={size}
205
- className={cn(
206
- "absolute h-8 w-8 rounded-full",
207
- orientation === "horizontal"
208
- ? "-right-12 top-1/2 -translate-y-1/2"
209
- : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
210
- className,
211
- )}
212
- disabled={!canScrollNext}
213
- onClick={scrollNext}
214
- {...props}
215
- >
216
- <ArrowRight className="h-4 w-4" />
217
- <span className="sr-only">Next slide</span>
218
- </Button>
219
- );
220
- },
221
- );
222
- CarouselNext.displayName = "CarouselNext";
223
-
224
- export { type CarouselApi, Carousel, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext };
@@ -1,303 +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
- } & ({ color?: string; theme?: never } | { color?: never; theme: Record<keyof typeof THEMES, string> });
14
- };
15
-
16
- type ChartContextProps = {
17
- config: ChartConfig;
18
- };
19
-
20
- const ChartContext = React.createContext<ChartContextProps | null>(null);
21
-
22
- function useChart() {
23
- const context = React.useContext(ChartContext);
24
-
25
- if (!context) {
26
- throw new Error("useChart must be used within a <ChartContainer />");
27
- }
28
-
29
- return context;
30
- }
31
-
32
- const ChartContainer = React.forwardRef<
33
- HTMLDivElement,
34
- React.ComponentProps<"div"> & {
35
- config: ChartConfig;
36
- children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"];
37
- }
38
- >(({ id, className, children, config, ...props }, ref) => {
39
- const uniqueId = React.useId();
40
- const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
41
-
42
- return (
43
- <ChartContext.Provider value={{ config }}>
44
- <div
45
- data-chart={chartId}
46
- ref={ref}
47
- className={cn(
48
- "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",
49
- className,
50
- )}
51
- {...props}
52
- >
53
- <ChartStyle id={chartId} config={config} />
54
- <RechartsPrimitive.ResponsiveContainer>{children}</RechartsPrimitive.ResponsiveContainer>
55
- </div>
56
- </ChartContext.Provider>
57
- );
58
- });
59
- ChartContainer.displayName = "Chart";
60
-
61
- const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
62
- const colorConfig = Object.entries(config).filter(([_, config]) => config.theme || config.color);
63
-
64
- if (!colorConfig.length) {
65
- return null;
66
- }
67
-
68
- return (
69
- <style
70
- dangerouslySetInnerHTML={{
71
- __html: Object.entries(THEMES)
72
- .map(
73
- ([theme, prefix]) => `
74
- ${prefix} [data-chart=${id}] {
75
- ${colorConfig
76
- .map(([key, itemConfig]) => {
77
- const color = itemConfig.theme?.[theme as keyof typeof itemConfig.theme] || itemConfig.color;
78
- return color ? ` --color-${key}: ${color};` : null;
79
- })
80
- .join("\n")}
81
- }
82
- `,
83
- )
84
- .join("\n"),
85
- }}
86
- />
87
- );
88
- };
89
-
90
- const ChartTooltip = RechartsPrimitive.Tooltip;
91
-
92
- const ChartTooltipContent = React.forwardRef<
93
- HTMLDivElement,
94
- React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
95
- React.ComponentProps<"div"> & {
96
- hideLabel?: boolean;
97
- hideIndicator?: boolean;
98
- indicator?: "line" | "dot" | "dashed";
99
- nameKey?: string;
100
- labelKey?: string;
101
- }
102
- >(
103
- (
104
- {
105
- active,
106
- payload,
107
- className,
108
- indicator = "dot",
109
- hideLabel = false,
110
- hideIndicator = false,
111
- label,
112
- labelFormatter,
113
- labelClassName,
114
- formatter,
115
- color,
116
- nameKey,
117
- labelKey,
118
- },
119
- ref,
120
- ) => {
121
- const { config } = useChart();
122
-
123
- const tooltipLabel = React.useMemo(() => {
124
- if (hideLabel || !payload?.length) {
125
- return null;
126
- }
127
-
128
- const [item] = payload;
129
- const key = `${labelKey || item.dataKey || item.name || "value"}`;
130
- const itemConfig = getPayloadConfigFromPayload(config, item, key);
131
- const value =
132
- !labelKey && typeof label === "string"
133
- ? config[label as keyof typeof config]?.label || label
134
- : itemConfig?.label;
135
-
136
- if (labelFormatter) {
137
- return <div className={cn("font-medium", labelClassName)}>{labelFormatter(value, payload)}</div>;
138
- }
139
-
140
- if (!value) {
141
- return null;
142
- }
143
-
144
- return <div className={cn("font-medium", labelClassName)}>{value}</div>;
145
- }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
146
-
147
- if (!active || !payload?.length) {
148
- return null;
149
- }
150
-
151
- const nestLabel = payload.length === 1 && indicator !== "dot";
152
-
153
- return (
154
- <div
155
- ref={ref}
156
- className={cn(
157
- "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",
158
- className,
159
- )}
160
- >
161
- {!nestLabel ? tooltipLabel : null}
162
- <div className="grid gap-1.5">
163
- {payload.map((item, index) => {
164
- const key = `${nameKey || item.name || item.dataKey || "value"}`;
165
- const itemConfig = getPayloadConfigFromPayload(config, item, key);
166
- const indicatorColor = color || item.payload.fill || item.color;
167
-
168
- return (
169
- <div
170
- key={item.dataKey}
171
- className={cn(
172
- "flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",
173
- indicator === "dot" && "items-center",
174
- )}
175
- >
176
- {formatter && item?.value !== undefined && item.name ? (
177
- formatter(item.value, item.name, item, index, item.payload)
178
- ) : (
179
- <>
180
- {itemConfig?.icon ? (
181
- <itemConfig.icon />
182
- ) : (
183
- !hideIndicator && (
184
- <div
185
- className={cn("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]", {
186
- "h-2.5 w-2.5": indicator === "dot",
187
- "w-1": indicator === "line",
188
- "w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
189
- "my-0.5": nestLabel && indicator === "dashed",
190
- })}
191
- style={
192
- {
193
- "--color-bg": indicatorColor,
194
- "--color-border": indicatorColor,
195
- } as React.CSSProperties
196
- }
197
- />
198
- )
199
- )}
200
- <div
201
- className={cn(
202
- "flex flex-1 justify-between leading-none",
203
- nestLabel ? "items-end" : "items-center",
204
- )}
205
- >
206
- <div className="grid gap-1.5">
207
- {nestLabel ? tooltipLabel : null}
208
- <span className="text-muted-foreground">{itemConfig?.label || item.name}</span>
209
- </div>
210
- {item.value && (
211
- <span className="font-mono font-medium tabular-nums text-foreground">
212
- {item.value.toLocaleString()}
213
- </span>
214
- )}
215
- </div>
216
- </>
217
- )}
218
- </div>
219
- );
220
- })}
221
- </div>
222
- </div>
223
- );
224
- },
225
- );
226
- ChartTooltipContent.displayName = "ChartTooltip";
227
-
228
- const ChartLegend = RechartsPrimitive.Legend;
229
-
230
- const ChartLegendContent = React.forwardRef<
231
- HTMLDivElement,
232
- React.ComponentProps<"div"> &
233
- Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
234
- hideIcon?: boolean;
235
- nameKey?: string;
236
- }
237
- >(({ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey }, ref) => {
238
- const { config } = useChart();
239
-
240
- if (!payload?.length) {
241
- return null;
242
- }
243
-
244
- return (
245
- <div
246
- ref={ref}
247
- className={cn("flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className)}
248
- >
249
- {payload.map((item) => {
250
- const key = `${nameKey || item.dataKey || "value"}`;
251
- const itemConfig = getPayloadConfigFromPayload(config, item, key);
252
-
253
- return (
254
- <div
255
- key={item.value}
256
- className={cn("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground")}
257
- >
258
- {itemConfig?.icon && !hideIcon ? (
259
- <itemConfig.icon />
260
- ) : (
261
- <div
262
- className="h-2 w-2 shrink-0 rounded-[2px]"
263
- style={{
264
- backgroundColor: item.color,
265
- }}
266
- />
267
- )}
268
- {itemConfig?.label}
269
- </div>
270
- );
271
- })}
272
- </div>
273
- );
274
- });
275
- ChartLegendContent.displayName = "ChartLegend";
276
-
277
- // Helper to extract item config from a payload.
278
- function getPayloadConfigFromPayload(config: ChartConfig, payload: unknown, key: string) {
279
- if (typeof payload !== "object" || payload === null) {
280
- return undefined;
281
- }
282
-
283
- const payloadPayload =
284
- "payload" in payload && typeof payload.payload === "object" && payload.payload !== null
285
- ? payload.payload
286
- : undefined;
287
-
288
- let configLabelKey: string = key;
289
-
290
- if (key in payload && typeof payload[key as keyof typeof payload] === "string") {
291
- configLabelKey = payload[key as keyof typeof payload] as string;
292
- } else if (
293
- payloadPayload &&
294
- key in payloadPayload &&
295
- typeof payloadPayload[key as keyof typeof payloadPayload] === "string"
296
- ) {
297
- configLabelKey = payloadPayload[key as keyof typeof payloadPayload] as string;
298
- }
299
-
300
- return configLabelKey in config ? config[configLabelKey] : config[key as keyof typeof config];
301
- }
302
-
303
- export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle };
@@ -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
- "peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
15
- className,
16
- )}
17
- {...props}
18
- >
19
- <CheckboxPrimitive.Indicator className={cn("flex items-center justify-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,9 +0,0 @@
1
- import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
2
-
3
- const Collapsible = CollapsiblePrimitive.Root;
4
-
5
- const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;
6
-
7
- const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;
8
-
9
- export { Collapsible, CollapsibleTrigger, CollapsibleContent };
@@ -1,132 +0,0 @@
1
- import * as React from "react";
2
- import { type DialogProps } from "@radix-ui/react-dialog";
3
- import { Command as CommandPrimitive } from "cmdk";
4
- import { Search } from "lucide-react";
5
-
6
- import { cn } from "@/lib/utils";
7
- import { Dialog, DialogContent } from "@/components/ui/dialog";
8
-
9
- const Command = React.forwardRef<
10
- React.ElementRef<typeof CommandPrimitive>,
11
- React.ComponentPropsWithoutRef<typeof CommandPrimitive>
12
- >(({ className, ...props }, ref) => (
13
- <CommandPrimitive
14
- ref={ref}
15
- className={cn(
16
- "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
17
- className,
18
- )}
19
- {...props}
20
- />
21
- ));
22
- Command.displayName = CommandPrimitive.displayName;
23
-
24
- interface CommandDialogProps extends DialogProps {}
25
-
26
- const CommandDialog = ({ children, ...props }: CommandDialogProps) => {
27
- return (
28
- <Dialog {...props}>
29
- <DialogContent className="overflow-hidden p-0 shadow-lg">
30
- <Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
31
- {children}
32
- </Command>
33
- </DialogContent>
34
- </Dialog>
35
- );
36
- };
37
-
38
- const CommandInput = React.forwardRef<
39
- React.ElementRef<typeof CommandPrimitive.Input>,
40
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
41
- >(({ className, ...props }, ref) => (
42
- <div className="flex items-center border-b px-3" cmdk-input-wrapper="">
43
- <Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
44
- <CommandPrimitive.Input
45
- ref={ref}
46
- className={cn(
47
- "flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
48
- className,
49
- )}
50
- {...props}
51
- />
52
- </div>
53
- ));
54
-
55
- CommandInput.displayName = CommandPrimitive.Input.displayName;
56
-
57
- const CommandList = React.forwardRef<
58
- React.ElementRef<typeof CommandPrimitive.List>,
59
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
60
- >(({ className, ...props }, ref) => (
61
- <CommandPrimitive.List
62
- ref={ref}
63
- className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
64
- {...props}
65
- />
66
- ));
67
-
68
- CommandList.displayName = CommandPrimitive.List.displayName;
69
-
70
- const CommandEmpty = React.forwardRef<
71
- React.ElementRef<typeof CommandPrimitive.Empty>,
72
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
73
- >((props, ref) => <CommandPrimitive.Empty ref={ref} className="py-6 text-center text-sm" {...props} />);
74
-
75
- CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
76
-
77
- const CommandGroup = React.forwardRef<
78
- React.ElementRef<typeof CommandPrimitive.Group>,
79
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
80
- >(({ className, ...props }, ref) => (
81
- <CommandPrimitive.Group
82
- ref={ref}
83
- className={cn(
84
- "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
85
- className,
86
- )}
87
- {...props}
88
- />
89
- ));
90
-
91
- CommandGroup.displayName = CommandPrimitive.Group.displayName;
92
-
93
- const CommandSeparator = React.forwardRef<
94
- React.ElementRef<typeof CommandPrimitive.Separator>,
95
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
96
- >(({ className, ...props }, ref) => (
97
- <CommandPrimitive.Separator ref={ref} className={cn("-mx-1 h-px bg-border", className)} {...props} />
98
- ));
99
- CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
100
-
101
- const CommandItem = React.forwardRef<
102
- React.ElementRef<typeof CommandPrimitive.Item>,
103
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
104
- >(({ className, ...props }, ref) => (
105
- <CommandPrimitive.Item
106
- ref={ref}
107
- className={cn(
108
- "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",
109
- className,
110
- )}
111
- {...props}
112
- />
113
- ));
114
-
115
- CommandItem.displayName = CommandPrimitive.Item.displayName;
116
-
117
- const CommandShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {
118
- return <span className={cn("ml-auto text-xs tracking-widest text-muted-foreground", className)} {...props} />;
119
- };
120
- CommandShortcut.displayName = "CommandShortcut";
121
-
122
- export {
123
- Command,
124
- CommandDialog,
125
- CommandInput,
126
- CommandList,
127
- CommandEmpty,
128
- CommandGroup,
129
- CommandItem,
130
- CommandShortcut,
131
- CommandSeparator,
132
- };