@turtleclub/ui 0.7.0-beta.32 → 0.7.0-beta.34

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 (139) hide show
  1. package/dist/index.cjs +10331 -110
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +7652 -47844
  4. package/dist/index.js.map +1 -1
  5. package/dist/types/components/features/sidebar-layout.d.ts +2 -0
  6. package/dist/types/components/features/sidebar-layout.d.ts.map +1 -1
  7. package/dist/types/components/ui/chart.d.ts +1 -1
  8. package/dist/types/components/ui/chart.d.ts.map +1 -1
  9. package/package.json +26 -22
  10. package/.prettierrc.json +0 -4
  11. package/.turbo/turbo-build.log +0 -182
  12. package/CHANGELOG.md +0 -795
  13. package/components.json +0 -21
  14. package/src/components/charts/QUICK_REFERENCE.md +0 -323
  15. package/src/components/charts/README.md +0 -658
  16. package/src/components/charts/RECHARTS_FEATURES.md +0 -458
  17. package/src/components/charts/area-chart.tsx +0 -248
  18. package/src/components/charts/bar-chart.tsx +0 -362
  19. package/src/components/charts/index.ts +0 -4
  20. package/src/components/charts/pie-chart.tsx +0 -277
  21. package/src/components/charts/radial-chart.tsx +0 -312
  22. package/src/components/features/api-status/index.tsx +0 -23
  23. package/src/components/features/data-table/data-table.tsx +0 -538
  24. package/src/components/features/data-table/expand-toggle.tsx +0 -17
  25. package/src/components/features/data-table/fuzzy-filter.tsx +0 -34
  26. package/src/components/features/data-table/index.ts +0 -3
  27. package/src/components/features/data-table/item-info.tsx +0 -19
  28. package/src/components/features/data-table/skeleton.tsx +0 -23
  29. package/src/components/features/data-table/sort-dropdown.tsx +0 -118
  30. package/src/components/features/data-table/sortable-header.tsx +0 -37
  31. package/src/components/features/index.ts +0 -6
  32. package/src/components/features/page-heading.tsx +0 -27
  33. package/src/components/features/search-bar.tsx +0 -55
  34. package/src/components/features/segmented-navigation.tsx +0 -18
  35. package/src/components/features/sidebar-layout.tsx +0 -193
  36. package/src/components/features/turtle-tooltip.tsx +0 -67
  37. package/src/components/icons/arrow.tsx +0 -23
  38. package/src/components/icons/beta.tsx +0 -95
  39. package/src/components/icons/dot.tsx +0 -102
  40. package/src/components/icons/index.ts +0 -7
  41. package/src/components/icons/issue.tsx +0 -106
  42. package/src/components/icons/turtle.tsx +0 -156
  43. package/src/components/icons/update.tsx +0 -113
  44. package/src/components/icons/warning.tsx +0 -95
  45. package/src/components/molecules/index.ts +0 -9
  46. package/src/components/molecules/opportunity/index.ts +0 -10
  47. package/src/components/molecules/opportunity/opportunity-apr.tsx +0 -129
  48. package/src/components/molecules/opportunity/opportunity-disclaimer.tsx +0 -46
  49. package/src/components/molecules/opportunity/opportunity-rate-estimator.tsx +0 -62
  50. package/src/components/molecules/opportunity/opportunity-section.tsx +0 -113
  51. package/src/components/molecules/opportunity/opportunity-selector.tsx +0 -30
  52. package/src/components/molecules/opportunity/opportunity-type.tsx +0 -16
  53. package/src/components/molecules/route-details.tsx +0 -112
  54. package/src/components/molecules/slippage-selector.tsx +0 -200
  55. package/src/components/molecules/swap-details.tsx +0 -55
  56. package/src/components/molecules/swap-input.tsx +0 -186
  57. package/src/components/molecules/tabs.tsx +0 -79
  58. package/src/components/molecules/token-selector.tsx +0 -180
  59. package/src/components/molecules/tx-status.tsx +0 -312
  60. package/src/components/molecules/widget/asset-list/asset-filters.tsx +0 -113
  61. package/src/components/molecules/widget/asset-list/asset-list.tsx +0 -178
  62. package/src/components/molecules/widget/asset-list/asset-row.tsx +0 -45
  63. package/src/components/molecules/widget/asset-list/hooks/index.ts +0 -2
  64. package/src/components/molecules/widget/asset-list/hooks/use-asset-filtering.ts +0 -44
  65. package/src/components/molecules/widget/asset-list/hooks/use-asset-grouping.ts +0 -87
  66. package/src/components/molecules/widget/asset-list/index.ts +0 -3
  67. package/src/components/molecules/widget/base-selector.tsx +0 -121
  68. package/src/components/molecules/widget/campaign-item.tsx +0 -82
  69. package/src/components/molecules/widget/deal-item.tsx +0 -92
  70. package/src/components/molecules/widget/index.ts +0 -36
  71. package/src/components/molecules/widget/opportunity-item.tsx +0 -105
  72. package/src/components/molecules/widget/widget-item-stats.tsx +0 -50
  73. package/src/components/molecules/widget/widget-item.tsx +0 -139
  74. package/src/components/molecules/widget/widget-list-items.tsx +0 -86
  75. package/src/components/ui/alert-dialog.tsx +0 -163
  76. package/src/components/ui/animated-background/animated-background.tsx +0 -182
  77. package/src/components/ui/animated-background/index.ts +0 -1
  78. package/src/components/ui/avatar.tsx +0 -73
  79. package/src/components/ui/badge.tsx +0 -59
  80. package/src/components/ui/banner.tsx +0 -84
  81. package/src/components/ui/button.tsx +0 -100
  82. package/src/components/ui/card.tsx +0 -119
  83. package/src/components/ui/chart.tsx +0 -346
  84. package/src/components/ui/checkbox.tsx +0 -32
  85. package/src/components/ui/chip.tsx +0 -52
  86. package/src/components/ui/collapsible.tsx +0 -34
  87. package/src/components/ui/combobox.tsx +0 -730
  88. package/src/components/ui/command.tsx +0 -184
  89. package/src/components/ui/dialog.tsx +0 -129
  90. package/src/components/ui/dropdown.tsx +0 -316
  91. package/src/components/ui/field.tsx +0 -244
  92. package/src/components/ui/heading.tsx +0 -74
  93. package/src/components/ui/hover-card.tsx +0 -139
  94. package/src/components/ui/icon-animation.tsx +0 -82
  95. package/src/components/ui/icon-list.tsx +0 -168
  96. package/src/components/ui/index.ts +0 -48
  97. package/src/components/ui/info-card.tsx +0 -110
  98. package/src/components/ui/input-group.tsx +0 -170
  99. package/src/components/ui/input.tsx +0 -72
  100. package/src/components/ui/label-with-icon.tsx +0 -122
  101. package/src/components/ui/label.tsx +0 -24
  102. package/src/components/ui/multi-select.tsx +0 -1090
  103. package/src/components/ui/navigation-bar.tsx +0 -153
  104. package/src/components/ui/navigation-menu.tsx +0 -188
  105. package/src/components/ui/opportunity-details-v1.tsx +0 -104
  106. package/src/components/ui/pagination.tsx +0 -127
  107. package/src/components/ui/popover.tsx +0 -48
  108. package/src/components/ui/scroll-area.tsx +0 -64
  109. package/src/components/ui/segment-control.tsx +0 -146
  110. package/src/components/ui/select.tsx +0 -199
  111. package/src/components/ui/separator.tsx +0 -26
  112. package/src/components/ui/sheet.tsx +0 -139
  113. package/src/components/ui/sidebar.tsx +0 -728
  114. package/src/components/ui/skeleton.tsx +0 -14
  115. package/src/components/ui/slider.tsx +0 -58
  116. package/src/components/ui/sonner.tsx +0 -24
  117. package/src/components/ui/switch.tsx +0 -29
  118. package/src/components/ui/table-shadcn.tsx +0 -110
  119. package/src/components/ui/table.tsx +0 -117
  120. package/src/components/ui/textarea.tsx +0 -22
  121. package/src/components/ui/toggle-group.tsx +0 -71
  122. package/src/components/ui/toggle.tsx +0 -47
  123. package/src/components/ui/tooltip.tsx +0 -66
  124. package/src/hooks/index.ts +0 -1
  125. package/src/hooks/useIsMobile.ts +0 -77
  126. package/src/index.ts +0 -16
  127. package/src/lib/utils.ts +0 -6
  128. package/src/styles/globals.css +0 -181
  129. package/src/styles/themes/index.css +0 -9
  130. package/src/styles/themes/semantic.css +0 -117
  131. package/src/styles/tokens/colors.css +0 -124
  132. package/src/styles/tokens/index.css +0 -15
  133. package/src/styles/tokens/radius.css +0 -18
  134. package/src/styles/tokens/spacing.css +0 -58
  135. package/src/styles/tokens/typography.css +0 -87
  136. package/src/tokens/index.ts +0 -108
  137. package/tsconfig.json +0 -20
  138. package/vite.config.js +0 -49
  139. /package/{src/images/enso.png → dist/enso-22FJ4GNK.png} +0 -0
@@ -1,84 +0,0 @@
1
- import { cn } from "@/lib/utils";
2
- import {
3
- BetaIcon,
4
- IssueIcon,
5
- UpdateIcon,
6
- ArrowIcon,
7
- WarningIcon,
8
- } from "../icons";
9
-
10
- export function Banner({
11
- type = "beta",
12
- text,
13
- link,
14
- className,
15
- }: {
16
- type?: "beta" | "warning" | "issue" | "update";
17
- text?: string;
18
- link?: string;
19
- className?: string;
20
- }) {
21
- const textColor =
22
- type === "beta"
23
- ? "text-[#AAF1D5]"
24
- : type === "warning"
25
- ? "text-[#F7931A]"
26
- : type === "issue"
27
- ? "text-[#FF0608]"
28
- : "text-[#73F36C]";
29
- const bg =
30
- type === "beta"
31
- ? "bg-[linear-gradient(90deg,rgba(18,19,18,0.6)_0%,rgba(170,241,213,0.2)_50%,rgba(18,19,18,0.6)_100%)]"
32
- : type === "warning"
33
- ? "bg-[linear-gradient(90deg,rgba(18,19,18,0.6)_0%,rgba(247,147,26,0.2)_50%,rgba(18,19,18,0.6)_100%)]"
34
- : type === "issue"
35
- ? "bg-[linear-gradient(90deg,rgba(18,19,18,0.6)_0%,rgba(255,6,8,0.2)_50%,rgba(18,19,18,0.6)_100%)]"
36
- : "bg-[linear-gradient(90deg,rgba(18,19,18,0.6)_0%,rgba(115,243,108,0.2)_50%,rgba(18,19,18,0.6)_100%)]";
37
- const title =
38
- type === "beta"
39
- ? "Beta"
40
- : type === "warning"
41
- ? "Warning"
42
- : type === "issue"
43
- ? "Critical Issue"
44
- : "Update";
45
- const Icon =
46
- type === "beta"
47
- ? BetaIcon
48
- : type === "warning"
49
- ? WarningIcon
50
- : type === "issue"
51
- ? IssueIcon
52
- : UpdateIcon;
53
-
54
- return (
55
- <div
56
- className={cn(
57
- "border-border flex h-[70px] items-center justify-center gap-2.5 rounded-full border py-2.5 pr-5 pl-2.5 shadow-[0_4px_20px_0_rgba(0,0,0,0.3)] md:h-[50px]",
58
- bg,
59
- className,
60
- )}
61
- >
62
- <div
63
- className={cn(
64
- "bg-neutral-alpha-5 flex h-[30px] items-center gap-1.5 rounded-full py-1 pr-2.5 pl-1.5 text-xs",
65
- textColor,
66
- )}
67
- >
68
- <Icon className="size-6" />
69
- {title}
70
- </div>
71
- <div className="text-[10px] md:text-xs">
72
- {text}{" "}
73
- {link && (
74
- <div className={cn("inline-flex items-center", textColor)}>
75
- <a href={link} target="_blank" rel="noopener noreferrer">
76
- here
77
- </a>
78
- <ArrowIcon />
79
- </div>
80
- )}
81
- </div>
82
- </div>
83
- );
84
- }
@@ -1,100 +0,0 @@
1
- import * as React from "react";
2
- import { Slot } from "@radix-ui/react-slot";
3
- import { cva, type VariantProps } from "class-variance-authority";
4
- import { cn } from "@/lib/utils";
5
-
6
- const buttonVariants = cva(
7
- [
8
- "cursor-pointer border border-transparent",
9
- "inline-flex items-center justify-center gap-2 text-xs font-medium whitespace-nowrap transition-all",
10
- "group-disabled:opacity-80 disabled:pointer-events-none",
11
- "shrink-0 rounded-full outline-none",
12
- ],
13
- {
14
- variants: {
15
- variant: {
16
- default:
17
- "bg-neutral-alpha-10 hover:bg-background text-foreground disabled:text-muted-foreground active:bg-background/90",
18
- green:
19
- "bg-neutral-alpha-10 hover:bg-background text-primary disabled:text-muted-foreground active:bg-background/90",
20
- menu: "bg-background hover:text-primary justify-between disabled:grayscale-100",
21
- ghost:
22
- "bg-background text-secondary-foreground hover:text-foreground disabled:text-muted-foreground",
23
- none: "",
24
- },
25
- size: {
26
- default: "h-9 px-4 py-1.5",
27
- sm: "h-7 gap-1.5 px-3 py-1 text-[0.65rem]",
28
- lg: "h-10 px-6 py-2",
29
- icon: "size-9",
30
- none: "",
31
- },
32
- border: {
33
- plain: "hover:border-border active:border-primary border",
34
- bordered:
35
- "hover:border-foreground/30 active:border-primary border-border border",
36
- gradient: "border-gradient-white active:border-gradient-accent",
37
- interactive:
38
- "hover:border-gradient-white active:border-gradient-accent",
39
- "gradient-white": "border-gradient-white",
40
- "gradient-primary": "border-gradient-accent",
41
- none: "",
42
- },
43
- withIcon: {
44
- true: "[&_svg]:bg-neutral-alpha-10 [&_svg]:stroke-primary bg-neutral-alpha-2 justify-between gap-3 p-[3px] [&_svg]:pointer-events-none [&_svg]:aspect-square [&_svg]:shrink-0 [&_svg]:rounded-full [&_svg]:p-2 [&_svg:not([class*='size-'])]:size-7",
45
- false:
46
- "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
47
- },
48
- },
49
- defaultVariants: {
50
- variant: "default",
51
- size: "default",
52
- border: "plain",
53
- withIcon: false,
54
- },
55
- },
56
- );
57
-
58
- function Button({
59
- className,
60
- variant,
61
- size,
62
- border,
63
- withIcon,
64
- asChild = false,
65
- children,
66
- ...props
67
- }: React.ComponentProps<"button"> &
68
- VariantProps<typeof buttonVariants> & {
69
- asChild?: boolean;
70
- }) {
71
- const Comp = asChild ? Slot : "button";
72
-
73
- return (
74
- <Comp
75
- data-slot="button"
76
- {...props}
77
- className={
78
- withIcon
79
- ? buttonVariants({
80
- withIcon,
81
- variant: "none",
82
- size: "none",
83
- border: "bordered",
84
- className: cn(className),
85
- })
86
- : buttonVariants({
87
- variant,
88
- size,
89
- border,
90
- withIcon,
91
- className: cn(className),
92
- })
93
- }
94
- >
95
- {children}
96
- </Comp>
97
- );
98
- }
99
-
100
- export { Button, buttonVariants };
@@ -1,119 +0,0 @@
1
- import * as React from "react";
2
- import { cva, type VariantProps } from "class-variance-authority";
3
-
4
- import { cn } from "@/lib/utils";
5
-
6
- const cardVariants = cva("transition-all", {
7
- variants: {
8
- variant: {
9
- default: "bg-background",
10
- border: "bg-background border-border border",
11
- shadow: "bg-muted shadow-lg",
12
- },
13
- gradient: {
14
- none: "",
15
- primary: "border-gradient-primary",
16
- white: "border-gradient-white",
17
- },
18
- rounded: {
19
- default: "rounded-lg",
20
- infoCard: "rounded-info-card",
21
- none: "rounded-none",
22
- sm: "rounded-sm",
23
- md: "rounded-md",
24
- lg: "rounded-lg",
25
- xl: "rounded-lg",
26
- full: "rounded-full",
27
- },
28
- },
29
- defaultVariants: {
30
- variant: "default",
31
- rounded: "default",
32
- gradient: "none",
33
- },
34
- });
35
-
36
- function Card({
37
- className,
38
- variant,
39
- rounded,
40
- gradient,
41
- ...props
42
- }: React.ComponentProps<"div"> & VariantProps<typeof cardVariants>) {
43
- return (
44
- <div
45
- data-slot="card"
46
- className={cardVariants({ variant, gradient, rounded, className })}
47
- {...props}
48
- />
49
- );
50
- }
51
-
52
- function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
53
- return (
54
- <div
55
- data-slot="card-header"
56
- className={cn("flex gap-2 p-5", className)}
57
- {...props}
58
- />
59
- );
60
- }
61
-
62
- function CardTitle({
63
- className,
64
- children,
65
- ...props
66
- }: React.ComponentProps<"h3">) {
67
- return (
68
- <h3
69
- data-slot="card-title"
70
- className={cn(
71
- "text-base leading-none font-semibold tracking-tight",
72
- className,
73
- )}
74
- {...props}
75
- >
76
- {children}
77
- </h3>
78
- );
79
- }
80
-
81
- function CardDescription({ className, ...props }: React.ComponentProps<"p">) {
82
- return (
83
- <p
84
- data-slot="card-description"
85
- className={cn("text-muted-foreground text-[10px]", className)}
86
- {...props}
87
- />
88
- );
89
- }
90
-
91
- function CardContent({ className, ...props }: React.ComponentProps<"div">) {
92
- return (
93
- <div
94
- data-slot="card-content"
95
- className={cn("p-5 pt-0", className)}
96
- {...props}
97
- />
98
- );
99
- }
100
-
101
- function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
102
- return (
103
- <div
104
- data-slot="card-footer"
105
- className={cn("flex items-center p-5 pt-0", className)}
106
- {...props}
107
- />
108
- );
109
- }
110
-
111
- export {
112
- Card,
113
- CardContent,
114
- CardDescription,
115
- CardFooter,
116
- CardHeader,
117
- CardTitle,
118
- cardVariants,
119
- };
@@ -1,346 +0,0 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import * as RechartsPrimitive from "recharts";
5
- import type { Payload, NameType, ValueType } from "recharts/types/component/DefaultTooltipContent";
6
-
7
- import { cn } from "@/lib/utils";
8
-
9
- // Format: { THEME_NAME: CSS_SELECTOR }
10
- const THEMES = { light: "", dark: ".dark" } as const;
11
-
12
- export type ChartConfig = {
13
- [k in string]: {
14
- label?: React.ReactNode;
15
- icon?: React.ComponentType;
16
- } & (
17
- | { color?: string; theme?: never }
18
- | { color?: never; theme: Record<keyof typeof THEMES, string> }
19
- );
20
- };
21
-
22
- type ChartContextProps = {
23
- config: ChartConfig;
24
- };
25
-
26
- const ChartContext = React.createContext<ChartContextProps | null>(null);
27
-
28
- function useChart() {
29
- const context = React.useContext(ChartContext);
30
-
31
- if (!context) {
32
- throw new Error("useChart must be used within a <ChartContainer />");
33
- }
34
-
35
- return context;
36
- }
37
-
38
- function ChartContainer({
39
- id,
40
- className,
41
- children,
42
- config,
43
- initialDimension = { width: 100, height: 50 },
44
- ...props
45
- }: React.ComponentProps<"div"> & {
46
- config: ChartConfig;
47
- children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"];
48
- initialDimension?: { width: number; height: number };
49
- }) {
50
- const uniqueId = React.useId();
51
- const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
52
-
53
- return (
54
- <ChartContext.Provider value={{ config }}>
55
- <div
56
- data-slot="chart"
57
- data-chart={chartId}
58
- className={cn(
59
- "[&_.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-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 flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",
60
- className
61
- )}
62
- {...props}
63
- >
64
- <ChartStyle id={chartId} config={config} />
65
- <RechartsPrimitive.ResponsiveContainer initialDimension={initialDimension}>
66
- {children}
67
- </RechartsPrimitive.ResponsiveContainer>
68
- </div>
69
- </ChartContext.Provider>
70
- );
71
- }
72
-
73
- const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
74
- const colorConfig = Object.entries(config).filter(([, config]) => config.theme || config.color);
75
-
76
- if (!colorConfig.length) {
77
- return null;
78
- }
79
-
80
- return (
81
- <style
82
- dangerouslySetInnerHTML={{
83
- __html: Object.entries(THEMES)
84
- .map(
85
- ([theme, prefix]) => `
86
- ${prefix} [data-chart=${id}] {
87
- ${colorConfig
88
- .map(([key, itemConfig]) => {
89
- const color = itemConfig.theme?.[theme as keyof typeof itemConfig.theme] || 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
- function ChartTooltipContent<
105
- TValue extends ValueType = ValueType,
106
- TName extends NameType = NameType,
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
- active?: boolean;
123
- payload?: ReadonlyArray<Payload<TValue, TName>>;
124
- label?: TValue;
125
- labelFormatter?: (label: any, payload: ReadonlyArray<Payload<TValue, TName>>) => React.ReactNode;
126
- formatter?: (
127
- value: TValue,
128
- name: TName,
129
- item: Payload<TValue, TName>,
130
- index: number,
131
- payload: ReadonlyArray<Payload<TValue, TName>>
132
- ) => React.ReactNode;
133
- color?: string;
134
- labelClassName?: string;
135
- hideLabel?: boolean;
136
- hideIndicator?: boolean;
137
- indicator?: "line" | "dot" | "dashed";
138
- nameKey?: string;
139
- labelKey?: string;
140
- } & React.ComponentProps<"div">) {
141
- const { config } = useChart();
142
-
143
- const tooltipLabel = React.useMemo(() => {
144
- if (hideLabel || !payload?.length) {
145
- return null;
146
- }
147
-
148
- const [item] = payload;
149
- const key = `${labelKey || item?.dataKey || item?.name || "value"}`;
150
- const itemConfig = getPayloadConfigFromPayload(config, item, key);
151
- const value =
152
- !labelKey && typeof label === "string"
153
- ? config[label as keyof typeof config]?.label || label
154
- : itemConfig?.label;
155
-
156
- if (labelFormatter) {
157
- return (
158
- <div className={cn("font-medium", labelClassName)}>{labelFormatter(value, payload)}</div>
159
- );
160
- }
161
-
162
- if (!value) {
163
- return null;
164
- }
165
-
166
- return <div className={cn("font-medium", labelClassName)}>{value}</div>;
167
- }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
168
-
169
- if (!active || !payload?.length) {
170
- return null;
171
- }
172
-
173
- const nestLabel = payload.length === 1 && indicator !== "dot";
174
-
175
- return (
176
- <div
177
- className={cn(
178
- "border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl",
179
- className
180
- )}
181
- >
182
- {!nestLabel ? tooltipLabel : null}
183
- <div className="grid gap-1.5">
184
- {payload
185
- .filter((item) => item.type !== "none")
186
- .map((item, index) => {
187
- const key = `${nameKey || item.name || item.dataKey || "value"}`;
188
- const itemConfig = getPayloadConfigFromPayload(config, item, key);
189
- const indicatorColor = color || item.payload.fill || item.color;
190
-
191
- return (
192
- <div
193
- key={String(item.dataKey) || index}
194
- className={cn(
195
- "[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5",
196
- indicator === "dot" && "items-center"
197
- )}
198
- >
199
- {formatter && item?.value !== undefined && item.name ? (
200
- formatter(item.value, item.name, item, index, item.payload)
201
- ) : (
202
- <>
203
- {itemConfig?.icon ? (
204
- <itemConfig.icon />
205
- ) : (
206
- !hideIndicator && (
207
- <div
208
- className={cn(
209
- "shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",
210
- {
211
- "h-2.5 w-2.5": indicator === "dot",
212
- "w-1": indicator === "line",
213
- "w-0 border-[1.5px] border-dashed bg-transparent":
214
- indicator === "dashed",
215
- "my-0.5": nestLabel && indicator === "dashed",
216
- }
217
- )}
218
- style={
219
- {
220
- "--color-bg": indicatorColor,
221
- "--color-border": indicatorColor,
222
- } as React.CSSProperties
223
- }
224
- />
225
- )
226
- )}
227
- <div
228
- className={cn(
229
- "flex flex-1 justify-between leading-none",
230
- nestLabel ? "items-end" : "items-center"
231
- )}
232
- >
233
- <div className="grid gap-1.5">
234
- {nestLabel ? tooltipLabel : null}
235
- <span className="text-muted-foreground">
236
- {itemConfig?.label || item.name}
237
- </span>
238
- </div>
239
- {item.value && (
240
- <span className="text-foreground font-mono font-medium tabular-nums">
241
- {item.value.toLocaleString()}
242
- </span>
243
- )}
244
- </div>
245
- </>
246
- )}
247
- </div>
248
- );
249
- })}
250
- </div>
251
- </div>
252
- );
253
- }
254
-
255
- const ChartLegend = RechartsPrimitive.Legend;
256
-
257
- function ChartLegendContent({
258
- className,
259
- hideIcon = false,
260
- payload,
261
- verticalAlign = "bottom",
262
- nameKey,
263
- }: React.ComponentProps<"div"> & {
264
- payload?: ReadonlyArray<Payload<ValueType, NameType>>;
265
- verticalAlign?: "top" | "bottom";
266
- hideIcon?: boolean;
267
- nameKey?: string;
268
- }) {
269
- const { config } = useChart();
270
-
271
- if (!payload?.length) {
272
- return null;
273
- }
274
-
275
- return (
276
- <div
277
- className={cn(
278
- "flex items-center justify-center gap-4",
279
- verticalAlign === "top" ? "pb-3" : "pt-3",
280
- className
281
- )}
282
- >
283
- {payload
284
- .filter((item) => item.type !== "none")
285
- .map((item, index) => {
286
- const key = `${nameKey || item.dataKey || "value"}`;
287
- const itemConfig = getPayloadConfigFromPayload(config, item, key);
288
-
289
- return (
290
- <div
291
- key={String(item.value) || index}
292
- className={cn(
293
- "[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"
294
- )}
295
- >
296
- {itemConfig?.icon && !hideIcon ? (
297
- <itemConfig.icon />
298
- ) : (
299
- <div
300
- className="h-2 w-2 shrink-0 rounded-[2px]"
301
- style={{
302
- backgroundColor: item.color,
303
- }}
304
- />
305
- )}
306
- {itemConfig?.label}
307
- </div>
308
- );
309
- })}
310
- </div>
311
- );
312
- }
313
-
314
- function getPayloadConfigFromPayload(config: ChartConfig, payload: unknown, key: string) {
315
- if (typeof payload !== "object" || payload === null) {
316
- return undefined;
317
- }
318
-
319
- const payloadPayload =
320
- "payload" in payload && typeof payload.payload === "object" && payload.payload !== null
321
- ? payload.payload
322
- : undefined;
323
-
324
- let configLabelKey: string = key;
325
-
326
- if (key in payload && typeof payload[key as keyof typeof payload] === "string") {
327
- configLabelKey = payload[key as keyof typeof payload] as string;
328
- } else if (
329
- payloadPayload &&
330
- key in payloadPayload &&
331
- typeof payloadPayload[key as keyof typeof payloadPayload] === "string"
332
- ) {
333
- configLabelKey = payloadPayload[key as keyof typeof payloadPayload] as string;
334
- }
335
-
336
- return configLabelKey in config ? config[configLabelKey] : config[key as keyof typeof config];
337
- }
338
-
339
- export {
340
- ChartContainer,
341
- ChartTooltip,
342
- ChartTooltipContent,
343
- ChartLegend,
344
- ChartLegendContent,
345
- ChartStyle,
346
- };
@@ -1,32 +0,0 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
5
- import { CheckIcon } from "lucide-react";
6
-
7
- import { cn } from "@/lib/utils";
8
-
9
- function Checkbox({
10
- className,
11
- ...props
12
- }: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
13
- return (
14
- <CheckboxPrimitive.Root
15
- data-slot="checkbox"
16
- className={cn(
17
- "peer border-border data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 aria-invalid:border-destructive size-4 shrink-0 rounded-full border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
18
- className,
19
- )}
20
- {...props}
21
- >
22
- <CheckboxPrimitive.Indicator
23
- data-slot="checkbox-indicator"
24
- className="flex items-center justify-center text-current transition-none"
25
- >
26
- <CheckIcon className="size-3.5" />
27
- </CheckboxPrimitive.Indicator>
28
- </CheckboxPrimitive.Root>
29
- );
30
- }
31
-
32
- export { Checkbox };