eai-frontend-components 2.0.4 → 2.0.6

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