harebear-ui 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +63 -0
- package/LICENSE +21 -0
- package/README.md +92 -2
- package/bin/harebear-ui.mjs +125 -0
- package/dist/components/admin/activity-feed.d.ts +15 -0
- package/dist/components/admin/activity-feed.js +50 -0
- package/dist/components/admin/app-shell.d.ts +47 -0
- package/dist/components/admin/app-shell.js +108 -0
- package/dist/components/admin/callout.d.ts +7 -0
- package/dist/components/admin/callout.js +18 -0
- package/dist/components/admin/key-value-grid.d.ts +11 -0
- package/dist/components/admin/key-value-grid.js +23 -0
- package/dist/components/admin/link-tile.d.ts +17 -0
- package/dist/components/admin/link-tile.js +36 -0
- package/dist/components/admin/page-header.d.ts +14 -0
- package/dist/components/admin/page-header.js +41 -0
- package/dist/components/admin/search-input.d.ts +12 -0
- package/dist/components/admin/search-input.js +32 -0
- package/dist/components/admin/stat-card.d.ts +20 -0
- package/dist/components/admin/stat-card.js +53 -0
- package/dist/components/admin/status.d.ts +12 -0
- package/dist/components/admin/status.js +32 -0
- package/dist/components/admin/timeline.d.ts +13 -0
- package/dist/components/admin/timeline.js +36 -0
- package/dist/components/admin/usage-meter.d.ts +17 -0
- package/dist/components/admin/usage-meter.js +43 -0
- package/dist/components/admin/user-chip.d.ts +14 -0
- package/dist/components/admin/user-chip.js +38 -0
- package/dist/components/ai/chat.d.ts +44 -0
- package/dist/components/ai/chat.js +147 -0
- package/dist/components/ai/code-block.d.ts +21 -0
- package/dist/components/ai/code-block.js +53 -0
- package/dist/components/ai/conversation-list.d.ts +18 -0
- package/dist/components/ai/conversation-list.js +30 -0
- package/dist/components/ai/model-picker.d.ts +21 -0
- package/dist/components/ai/model-picker.js +55 -0
- package/dist/components/ai/prompt-input.d.ts +27 -0
- package/dist/components/ai/prompt-input.js +99 -0
- package/dist/components/data/bar-list.d.ts +14 -0
- package/dist/components/data/bar-list.js +27 -0
- package/dist/components/data/data-table.d.ts +70 -0
- package/dist/components/data/data-table.js +208 -0
- package/dist/components/data/sparkline.d.ts +16 -0
- package/dist/components/data/sparkline.js +72 -0
- package/dist/components/data/status-bars.d.ts +17 -0
- package/dist/components/data/status-bars.js +37 -0
- package/dist/components/data/trend-chart.d.ts +31 -0
- package/dist/components/data/trend-chart.js +136 -0
- package/dist/components/theme/theme-provider.d.ts +42 -0
- package/dist/components/theme/theme-provider.js +110 -0
- package/dist/components/theme/theme-toggle.d.ts +5 -0
- package/dist/components/theme/theme-toggle.js +20 -0
- package/dist/components/ui/accordion.d.ts +7 -0
- package/dist/components/ui/accordion.js +53 -0
- package/dist/components/ui/alert-dialog.d.ts +18 -0
- package/dist/components/ui/alert-dialog.js +99 -0
- package/dist/components/ui/alert.d.ts +10 -0
- package/dist/components/ui/alert.js +42 -0
- package/dist/components/ui/aspect-ratio.d.ts +3 -0
- package/dist/components/ui/aspect-ratio.js +11 -0
- package/dist/components/ui/avatar.d.ts +11 -0
- package/dist/components/ui/avatar.js +49 -0
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/badge.js +30 -0
- package/dist/components/ui/breadcrumb.d.ts +11 -0
- package/dist/components/ui/breadcrumb.js +70 -0
- package/dist/components/ui/button-group.d.ts +11 -0
- package/dist/components/ui/button-group.js +39 -0
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/button.js +55 -0
- package/dist/components/ui/calendar.d.ts +10 -0
- package/dist/components/ui/calendar.js +108 -0
- package/dist/components/ui/card.d.ts +11 -0
- package/dist/components/ui/card.js +55 -0
- package/dist/components/ui/carousel.d.ts +28 -0
- package/dist/components/ui/carousel.js +131 -0
- package/dist/components/ui/chart.d.ts +44 -0
- package/dist/components/ui/chart.js +148 -0
- package/dist/components/ui/checkbox.d.ts +4 -0
- package/dist/components/ui/checkbox.js +19 -0
- package/dist/components/ui/collapsible.d.ts +5 -0
- package/dist/components/ui/collapsible.js +23 -0
- package/dist/components/ui/command.d.ts +18 -0
- package/dist/components/ui/command.js +86 -0
- package/dist/components/ui/context-menu.d.ts +31 -0
- package/dist/components/ui/context-menu.js +123 -0
- package/dist/components/ui/dialog.d.ts +17 -0
- package/dist/components/ui/dialog.js +94 -0
- package/dist/components/ui/drawer.d.ts +13 -0
- package/dist/components/ui/drawer.js +76 -0
- package/dist/components/ui/dropdown-menu.d.ts +29 -0
- package/dist/components/ui/dropdown-menu.js +126 -0
- package/dist/components/ui/empty.d.ts +11 -0
- package/dist/components/ui/empty.js +59 -0
- package/dist/components/ui/field.d.ts +24 -0
- package/dist/components/ui/field.js +109 -0
- package/dist/components/ui/hover-card.d.ts +6 -0
- package/dist/components/ui/hover-card.js +30 -0
- package/dist/components/ui/input-group.d.ts +16 -0
- package/dist/components/ui/input-group.js +77 -0
- package/dist/components/ui/input-otp.d.ts +11 -0
- package/dist/components/ui/input-otp.js +46 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/input.js +13 -0
- package/dist/components/ui/item.d.ts +23 -0
- package/dist/components/ui/item.js +117 -0
- package/dist/components/ui/kbd.d.ts +3 -0
- package/dist/components/ui/kbd.js +19 -0
- package/dist/components/ui/label.d.ts +4 -0
- package/dist/components/ui/label.js +13 -0
- package/dist/components/ui/menubar.d.ts +30 -0
- package/dist/components/ui/menubar.js +133 -0
- package/dist/components/ui/navigation-menu.d.ts +14 -0
- package/dist/components/ui/navigation-menu.js +79 -0
- package/dist/components/ui/pagination.d.ts +17 -0
- package/dist/components/ui/pagination.js +79 -0
- package/dist/components/ui/popover.d.ts +10 -0
- package/dist/components/ui/popover.js +54 -0
- package/dist/components/ui/progress.d.ts +4 -0
- package/dist/components/ui/progress.js +18 -0
- package/dist/components/ui/radio-group.d.ts +5 -0
- package/dist/components/ui/radio-group.js +25 -0
- package/dist/components/ui/resizable.d.ts +7 -0
- package/dist/components/ui/resizable.js +27 -0
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/scroll-area.js +35 -0
- package/dist/components/ui/select.d.ts +15 -0
- package/dist/components/ui/select.js +98 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/separator.js +15 -0
- package/dist/components/ui/sheet.d.ts +14 -0
- package/dist/components/ui/sheet.js +88 -0
- package/dist/components/ui/sidebar.d.ts +69 -0
- package/dist/components/ui/sidebar.js +377 -0
- package/dist/components/ui/skeleton.d.ts +2 -0
- package/dist/components/ui/skeleton.js +12 -0
- package/dist/components/ui/slider.d.ts +4 -0
- package/dist/components/ui/slider.js +35 -0
- package/dist/components/ui/sonner.d.ts +3 -0
- package/dist/components/ui/sonner.js +29 -0
- package/dist/components/ui/spinner.d.ts +2 -0
- package/dist/components/ui/spinner.js +15 -0
- package/dist/components/ui/switch.d.ts +6 -0
- package/dist/components/ui/switch.js +18 -0
- package/dist/components/ui/table.d.ts +10 -0
- package/dist/components/ui/table.js +65 -0
- package/dist/components/ui/tabs.d.ts +11 -0
- package/dist/components/ui/tabs.js +45 -0
- package/dist/components/ui/textarea.d.ts +3 -0
- package/dist/components/ui/textarea.js +12 -0
- package/dist/components/ui/toggle-group.d.ts +10 -0
- package/dist/components/ui/toggle-group.js +50 -0
- package/dist/components/ui/toggle.d.ts +9 -0
- package/dist/components/ui/toggle.js +35 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/components/ui/tooltip.js +34 -0
- package/dist/hooks/use-copy-to-clipboard.d.ts +5 -0
- package/dist/hooks/use-copy-to-clipboard.js +24 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.js +17 -0
- package/dist/index.d.ts +80 -0
- package/dist/index.js +80 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.js +8 -0
- package/dist/shadcn-base.css +638 -0
- package/dist/styles.css +188 -0
- package/docs/COMPONENTS.md +352 -0
- package/llms.txt +34 -0
- package/package.json +116 -4
- package/skills/harebear-ui/SKILL.md +33 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
import { Button } from "./button.js";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
7
|
+
import useEmblaCarousel from "embla-carousel-react";
|
|
8
|
+
// src/components/ui/carousel.tsx
|
|
9
|
+
const CarouselContext = React.createContext(null);
|
|
10
|
+
function useCarousel() {
|
|
11
|
+
const context = React.useContext(CarouselContext);
|
|
12
|
+
if (!context) throw new Error("useCarousel must be used within a <Carousel />");
|
|
13
|
+
return context;
|
|
14
|
+
}
|
|
15
|
+
function Carousel({ orientation = "horizontal", opts, setApi, plugins, className, children, ...props }) {
|
|
16
|
+
const [carouselRef, api] = useEmblaCarousel({
|
|
17
|
+
...opts,
|
|
18
|
+
axis: orientation === "horizontal" ? "x" : "y"
|
|
19
|
+
}, plugins);
|
|
20
|
+
const [canScrollPrev, setCanScrollPrev] = React.useState(false);
|
|
21
|
+
const [canScrollNext, setCanScrollNext] = React.useState(false);
|
|
22
|
+
const onSelect = React.useCallback((api) => {
|
|
23
|
+
if (!api) return;
|
|
24
|
+
setCanScrollPrev(api.canScrollPrev());
|
|
25
|
+
setCanScrollNext(api.canScrollNext());
|
|
26
|
+
}, []);
|
|
27
|
+
const scrollPrev = React.useCallback(() => {
|
|
28
|
+
api?.scrollPrev();
|
|
29
|
+
}, [api]);
|
|
30
|
+
const scrollNext = React.useCallback(() => {
|
|
31
|
+
api?.scrollNext();
|
|
32
|
+
}, [api]);
|
|
33
|
+
const handleKeyDown = React.useCallback((event) => {
|
|
34
|
+
if (event.key === "ArrowLeft") {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
scrollPrev();
|
|
37
|
+
} else if (event.key === "ArrowRight") {
|
|
38
|
+
event.preventDefault();
|
|
39
|
+
scrollNext();
|
|
40
|
+
}
|
|
41
|
+
}, [scrollPrev, scrollNext]);
|
|
42
|
+
React.useEffect(() => {
|
|
43
|
+
if (!api || !setApi) return;
|
|
44
|
+
setApi(api);
|
|
45
|
+
}, [api, setApi]);
|
|
46
|
+
React.useEffect(() => {
|
|
47
|
+
if (!api) return;
|
|
48
|
+
onSelect(api);
|
|
49
|
+
api.on("reInit", onSelect);
|
|
50
|
+
api.on("select", onSelect);
|
|
51
|
+
return () => {
|
|
52
|
+
api?.off("select", onSelect);
|
|
53
|
+
};
|
|
54
|
+
}, [api, onSelect]);
|
|
55
|
+
return /* @__PURE__ */ jsx(CarouselContext.Provider, {
|
|
56
|
+
value: {
|
|
57
|
+
carouselRef,
|
|
58
|
+
api,
|
|
59
|
+
opts,
|
|
60
|
+
orientation: orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
|
|
61
|
+
scrollPrev,
|
|
62
|
+
scrollNext,
|
|
63
|
+
canScrollPrev,
|
|
64
|
+
canScrollNext
|
|
65
|
+
},
|
|
66
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
67
|
+
onKeyDownCapture: handleKeyDown,
|
|
68
|
+
className: cn("relative", className),
|
|
69
|
+
role: "region",
|
|
70
|
+
"aria-roledescription": "carousel",
|
|
71
|
+
"data-slot": "carousel",
|
|
72
|
+
...props,
|
|
73
|
+
children
|
|
74
|
+
})
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function CarouselContent({ className, ...props }) {
|
|
78
|
+
const { carouselRef, orientation } = useCarousel();
|
|
79
|
+
return /* @__PURE__ */ jsx("div", {
|
|
80
|
+
ref: carouselRef,
|
|
81
|
+
className: "overflow-hidden",
|
|
82
|
+
"data-slot": "carousel-content",
|
|
83
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
84
|
+
className: cn("flex", orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col", className),
|
|
85
|
+
...props
|
|
86
|
+
})
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function CarouselItem({ className, ...props }) {
|
|
90
|
+
const { orientation } = useCarousel();
|
|
91
|
+
return /* @__PURE__ */ jsx("div", {
|
|
92
|
+
role: "group",
|
|
93
|
+
"aria-roledescription": "slide",
|
|
94
|
+
"data-slot": "carousel-item",
|
|
95
|
+
className: cn("min-w-0 shrink-0 grow-0 basis-full", orientation === "horizontal" ? "pl-4" : "pt-4", className),
|
|
96
|
+
...props
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function CarouselPrevious({ className, variant = "outline", size = "icon-sm", ...props }) {
|
|
100
|
+
const { orientation, scrollPrev, canScrollPrev } = useCarousel();
|
|
101
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
102
|
+
"data-slot": "carousel-previous",
|
|
103
|
+
variant,
|
|
104
|
+
size,
|
|
105
|
+
className: cn("absolute touch-manipulation rounded-full", orientation === "horizontal" ? "inset-y-0 -left-12 my-auto" : "-top-12 left-1/2 -translate-x-1/2 rotate-90", className),
|
|
106
|
+
disabled: !canScrollPrev,
|
|
107
|
+
onClick: scrollPrev,
|
|
108
|
+
...props,
|
|
109
|
+
children: [/* @__PURE__ */ jsx(ChevronLeftIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
110
|
+
className: "sr-only",
|
|
111
|
+
children: "Previous slide"
|
|
112
|
+
})]
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
function CarouselNext({ className, variant = "outline", size = "icon-sm", ...props }) {
|
|
116
|
+
const { orientation, scrollNext, canScrollNext } = useCarousel();
|
|
117
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
118
|
+
"data-slot": "carousel-next",
|
|
119
|
+
variant,
|
|
120
|
+
size,
|
|
121
|
+
className: cn("absolute touch-manipulation rounded-full", orientation === "horizontal" ? "inset-y-0 -right-12 my-auto" : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90", className),
|
|
122
|
+
disabled: !canScrollNext,
|
|
123
|
+
onClick: scrollNext,
|
|
124
|
+
...props,
|
|
125
|
+
children: [/* @__PURE__ */ jsx(ChevronRightIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
126
|
+
className: "sr-only",
|
|
127
|
+
children: "Next slide"
|
|
128
|
+
})]
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
export { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, useCarousel };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as RechartsPrimitive from "recharts";
|
|
3
|
+
import { TooltipValueType } from "recharts";
|
|
4
|
+
declare const THEMES: {
|
|
5
|
+
readonly light: "";
|
|
6
|
+
readonly dark: ".dark";
|
|
7
|
+
};
|
|
8
|
+
type TooltipNameType = number | string;
|
|
9
|
+
export type ChartConfig = Record<string, {
|
|
10
|
+
label?: React.ReactNode;
|
|
11
|
+
icon?: React.ComponentType;
|
|
12
|
+
} & ({
|
|
13
|
+
color?: string;
|
|
14
|
+
theme?: never;
|
|
15
|
+
} | {
|
|
16
|
+
color?: never;
|
|
17
|
+
theme: Record<keyof typeof THEMES, string>;
|
|
18
|
+
})>;
|
|
19
|
+
declare function ChartContainer({ id, className, children, config, initialDimension, ...props }: React.ComponentProps<"div"> & {
|
|
20
|
+
config: ChartConfig;
|
|
21
|
+
children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"];
|
|
22
|
+
initialDimension?: {
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
};
|
|
26
|
+
}): React.JSX.Element;
|
|
27
|
+
declare const ChartStyle: ({ id, config }: {
|
|
28
|
+
id: string;
|
|
29
|
+
config: ChartConfig;
|
|
30
|
+
}) => React.JSX.Element | null;
|
|
31
|
+
declare const ChartTooltip: typeof RechartsPrimitive.Tooltip;
|
|
32
|
+
declare function ChartTooltipContent({ active, payload, className, indicator, hideLabel, hideIndicator, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey }: React.ComponentProps<typeof RechartsPrimitive.Tooltip> & React.ComponentProps<"div"> & {
|
|
33
|
+
hideLabel?: boolean;
|
|
34
|
+
hideIndicator?: boolean;
|
|
35
|
+
indicator?: "line" | "dot" | "dashed";
|
|
36
|
+
nameKey?: string;
|
|
37
|
+
labelKey?: string;
|
|
38
|
+
} & Omit<RechartsPrimitive.DefaultTooltipContentProps<TooltipValueType, TooltipNameType>, "accessibilityLayer">): React.JSX.Element | null;
|
|
39
|
+
declare const ChartLegend: React.MemoExoticComponent<(outsideProps: RechartsPrimitive.LegendProps) => React.ReactPortal | null>;
|
|
40
|
+
declare function ChartLegendContent({ className, hideIcon, payload, verticalAlign, nameKey }: React.ComponentProps<"div"> & {
|
|
41
|
+
hideIcon?: boolean;
|
|
42
|
+
nameKey?: string;
|
|
43
|
+
} & RechartsPrimitive.DefaultLegendContentProps): React.JSX.Element | null;
|
|
44
|
+
export { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent };
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import * as RechartsPrimitive from "recharts";
|
|
6
|
+
// src/components/ui/chart.tsx
|
|
7
|
+
const THEMES = {
|
|
8
|
+
light: "",
|
|
9
|
+
dark: ".dark"
|
|
10
|
+
};
|
|
11
|
+
const INITIAL_DIMENSION = {
|
|
12
|
+
width: 320,
|
|
13
|
+
height: 200
|
|
14
|
+
};
|
|
15
|
+
const ChartContext = React.createContext(null);
|
|
16
|
+
function useChart() {
|
|
17
|
+
const context = React.useContext(ChartContext);
|
|
18
|
+
if (!context) throw new Error("useChart must be used within a <ChartContainer />");
|
|
19
|
+
return context;
|
|
20
|
+
}
|
|
21
|
+
function ChartContainer({ id, className, children, config, initialDimension = INITIAL_DIMENSION, ...props }) {
|
|
22
|
+
const uniqueId = React.useId();
|
|
23
|
+
const chartId = `chart-${id ?? uniqueId.replace(/:/g, "")}`;
|
|
24
|
+
return /* @__PURE__ */ jsx(ChartContext.Provider, {
|
|
25
|
+
value: { config },
|
|
26
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
27
|
+
"data-slot": "chart",
|
|
28
|
+
"data-chart": chartId,
|
|
29
|
+
className: cn("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden", className),
|
|
30
|
+
...props,
|
|
31
|
+
children: [/* @__PURE__ */ jsx(ChartStyle, {
|
|
32
|
+
id: chartId,
|
|
33
|
+
config
|
|
34
|
+
}), /* @__PURE__ */ jsx(RechartsPrimitive.ResponsiveContainer, {
|
|
35
|
+
initialDimension,
|
|
36
|
+
children
|
|
37
|
+
})]
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
const ChartStyle = ({ id, config }) => {
|
|
42
|
+
const colorConfig = Object.entries(config).filter(([, config]) => config.theme ?? config.color);
|
|
43
|
+
if (!colorConfig.length) return null;
|
|
44
|
+
return /* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: Object.entries(THEMES).map(([theme, prefix]) => `
|
|
45
|
+
${prefix} [data-chart=${id}] {
|
|
46
|
+
${colorConfig.map(([key, itemConfig]) => {
|
|
47
|
+
const color = itemConfig.theme?.[theme] ?? itemConfig.color;
|
|
48
|
+
return color ? ` --color-${key}: ${color};` : null;
|
|
49
|
+
}).join("\n")}
|
|
50
|
+
}
|
|
51
|
+
`).join("\n") } });
|
|
52
|
+
};
|
|
53
|
+
const ChartTooltip = RechartsPrimitive.Tooltip;
|
|
54
|
+
function ChartTooltipContent({ active, payload, className, indicator = "dot", hideLabel = false, hideIndicator = false, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey }) {
|
|
55
|
+
const { config } = useChart();
|
|
56
|
+
const tooltipLabel = React.useMemo(() => {
|
|
57
|
+
if (hideLabel || !payload?.length) return null;
|
|
58
|
+
const [item] = payload;
|
|
59
|
+
const key = `${labelKey ?? item?.dataKey ?? item?.name ?? "value"}`;
|
|
60
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
61
|
+
const value = !labelKey && typeof label === "string" ? config[label]?.label ?? label : itemConfig?.label;
|
|
62
|
+
if (labelFormatter) return /* @__PURE__ */ jsx("div", {
|
|
63
|
+
className: cn("font-medium", labelClassName),
|
|
64
|
+
children: labelFormatter(value, payload)
|
|
65
|
+
});
|
|
66
|
+
if (!value) return null;
|
|
67
|
+
return /* @__PURE__ */ jsx("div", {
|
|
68
|
+
className: cn("font-medium", labelClassName),
|
|
69
|
+
children: value
|
|
70
|
+
});
|
|
71
|
+
}, [
|
|
72
|
+
label,
|
|
73
|
+
labelFormatter,
|
|
74
|
+
payload,
|
|
75
|
+
hideLabel,
|
|
76
|
+
labelClassName,
|
|
77
|
+
config,
|
|
78
|
+
labelKey
|
|
79
|
+
]);
|
|
80
|
+
if (!active || !payload?.length) return null;
|
|
81
|
+
const nestLabel = payload.length === 1 && indicator !== "dot";
|
|
82
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
83
|
+
className: cn("grid min-w-32 items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl", className),
|
|
84
|
+
children: [!nestLabel ? tooltipLabel : null, /* @__PURE__ */ jsx("div", {
|
|
85
|
+
className: "grid gap-1.5",
|
|
86
|
+
children: payload.filter((item) => item.type !== "none").map((item, index) => {
|
|
87
|
+
const key = `${nameKey ?? item.name ?? item.dataKey ?? "value"}`;
|
|
88
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
89
|
+
const indicatorColor = color ?? item.payload?.fill ?? item.color;
|
|
90
|
+
return /* @__PURE__ */ jsx("div", {
|
|
91
|
+
className: cn("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground", indicator === "dot" && "items-center"),
|
|
92
|
+
children: formatter && item?.value !== void 0 && item.name ? formatter(item.value, item.name, item, index, item.payload) : /* @__PURE__ */ jsxs(Fragment, { children: [itemConfig?.icon ? /* @__PURE__ */ jsx(itemConfig.icon, {}) : !hideIndicator && /* @__PURE__ */ jsx("div", {
|
|
93
|
+
className: cn("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)", {
|
|
94
|
+
"h-2.5 w-2.5": indicator === "dot",
|
|
95
|
+
"w-1": indicator === "line",
|
|
96
|
+
"w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
|
|
97
|
+
"my-0.5": nestLabel && indicator === "dashed"
|
|
98
|
+
}),
|
|
99
|
+
style: {
|
|
100
|
+
"--color-bg": indicatorColor,
|
|
101
|
+
"--color-border": indicatorColor
|
|
102
|
+
}
|
|
103
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
104
|
+
className: cn("flex flex-1 justify-between leading-none", nestLabel ? "items-end" : "items-center"),
|
|
105
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
106
|
+
className: "grid gap-1.5",
|
|
107
|
+
children: [nestLabel ? tooltipLabel : null, /* @__PURE__ */ jsx("span", {
|
|
108
|
+
className: "text-muted-foreground",
|
|
109
|
+
children: itemConfig?.label ?? item.name
|
|
110
|
+
})]
|
|
111
|
+
}), item.value != null && /* @__PURE__ */ jsx("span", {
|
|
112
|
+
className: "font-mono font-medium text-foreground tabular-nums",
|
|
113
|
+
children: typeof item.value === "number" ? item.value.toLocaleString() : String(item.value)
|
|
114
|
+
})]
|
|
115
|
+
})] })
|
|
116
|
+
}, index);
|
|
117
|
+
})
|
|
118
|
+
})]
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
const ChartLegend = RechartsPrimitive.Legend;
|
|
122
|
+
function ChartLegendContent({ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey }) {
|
|
123
|
+
const { config } = useChart();
|
|
124
|
+
if (!payload?.length) return null;
|
|
125
|
+
return /* @__PURE__ */ jsx("div", {
|
|
126
|
+
className: cn("flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className),
|
|
127
|
+
children: payload.filter((item) => item.type !== "none").map((item, index) => {
|
|
128
|
+
const key = `${nameKey ?? item.dataKey ?? "value"}`;
|
|
129
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
130
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
131
|
+
className: cn("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),
|
|
132
|
+
children: [itemConfig?.icon && !hideIcon ? /* @__PURE__ */ jsx(itemConfig.icon, {}) : /* @__PURE__ */ jsx("div", {
|
|
133
|
+
className: "h-2 w-2 shrink-0 rounded-[2px]",
|
|
134
|
+
style: { backgroundColor: item.color }
|
|
135
|
+
}), itemConfig?.label]
|
|
136
|
+
}, index);
|
|
137
|
+
})
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
function getPayloadConfigFromPayload(config, payload, key) {
|
|
141
|
+
if (typeof payload !== "object" || payload === null) return;
|
|
142
|
+
const payloadPayload = "payload" in payload && typeof payload.payload === "object" && payload.payload !== null ? payload.payload : void 0;
|
|
143
|
+
let configLabelKey = key;
|
|
144
|
+
if (key in payload && typeof payload[key] === "string") configLabelKey = payload[key];
|
|
145
|
+
else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === "string") configLabelKey = payloadPayload[key];
|
|
146
|
+
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
147
|
+
}
|
|
148
|
+
export { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { CheckIcon } from "lucide-react";
|
|
5
|
+
import { Checkbox as Checkbox$1 } from "radix-ui";
|
|
6
|
+
// src/components/ui/checkbox.tsx
|
|
7
|
+
function Checkbox({ className, ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(Checkbox$1.Root, {
|
|
9
|
+
"data-slot": "checkbox",
|
|
10
|
+
className: cn("peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary", className),
|
|
11
|
+
...props,
|
|
12
|
+
children: /* @__PURE__ */ jsx(Checkbox$1.Indicator, {
|
|
13
|
+
"data-slot": "checkbox-indicator",
|
|
14
|
+
className: "grid place-content-center text-current transition-none [&>svg]:size-3.5",
|
|
15
|
+
children: /* @__PURE__ */ jsx(CheckIcon, {})
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
export { Checkbox };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Collapsible as Collapsible$1 } from "radix-ui";
|
|
2
|
+
declare function Collapsible({ ...props }: React.ComponentProps<typeof Collapsible$1.Root>): import("react").JSX.Element;
|
|
3
|
+
declare function CollapsibleTrigger({ ...props }: React.ComponentProps<typeof Collapsible$1.CollapsibleTrigger>): import("react").JSX.Element;
|
|
4
|
+
declare function CollapsibleContent({ ...props }: React.ComponentProps<typeof Collapsible$1.CollapsibleContent>): import("react").JSX.Element;
|
|
5
|
+
export { Collapsible, CollapsibleContent, CollapsibleTrigger };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Collapsible as Collapsible$1 } from "radix-ui";
|
|
4
|
+
// src/components/ui/collapsible.tsx
|
|
5
|
+
function Collapsible({ ...props }) {
|
|
6
|
+
return /* @__PURE__ */ jsx(Collapsible$1.Root, {
|
|
7
|
+
"data-slot": "collapsible",
|
|
8
|
+
...props
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
function CollapsibleTrigger({ ...props }) {
|
|
12
|
+
return /* @__PURE__ */ jsx(Collapsible$1.CollapsibleTrigger, {
|
|
13
|
+
"data-slot": "collapsible-trigger",
|
|
14
|
+
...props
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function CollapsibleContent({ ...props }) {
|
|
18
|
+
return /* @__PURE__ */ jsx(Collapsible$1.CollapsibleContent, {
|
|
19
|
+
"data-slot": "collapsible-content",
|
|
20
|
+
...props
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export { Collapsible, CollapsibleContent, CollapsibleTrigger };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Dialog } from "./dialog.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Command as Command$1 } from "cmdk";
|
|
4
|
+
declare function Command({ className, ...props }: React.ComponentProps<typeof Command$1>): React.JSX.Element;
|
|
5
|
+
declare function CommandDialog({ title, description, children, className, showCloseButton, ...props }: React.ComponentProps<typeof Dialog> & {
|
|
6
|
+
title?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
showCloseButton?: boolean;
|
|
10
|
+
}): React.JSX.Element;
|
|
11
|
+
declare function CommandInput({ className, ...props }: React.ComponentProps<typeof Command$1.Input>): React.JSX.Element;
|
|
12
|
+
declare function CommandList({ className, ...props }: React.ComponentProps<typeof Command$1.List>): React.JSX.Element;
|
|
13
|
+
declare function CommandEmpty({ className, ...props }: React.ComponentProps<typeof Command$1.Empty>): React.JSX.Element;
|
|
14
|
+
declare function CommandGroup({ className, ...props }: React.ComponentProps<typeof Command$1.Group>): React.JSX.Element;
|
|
15
|
+
declare function CommandSeparator({ className, ...props }: React.ComponentProps<typeof Command$1.Separator>): React.JSX.Element;
|
|
16
|
+
declare function CommandItem({ className, children, ...props }: React.ComponentProps<typeof Command$1.Item>): React.JSX.Element;
|
|
17
|
+
declare function CommandShortcut({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
18
|
+
export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "./dialog.js";
|
|
4
|
+
import { InputGroup, InputGroupAddon } from "./input-group.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { CheckIcon, SearchIcon } from "lucide-react";
|
|
7
|
+
import { Command as Command$1 } from "cmdk";
|
|
8
|
+
// src/components/ui/command.tsx
|
|
9
|
+
function Command({ className, ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx(Command$1, {
|
|
11
|
+
"data-slot": "command",
|
|
12
|
+
className: cn("flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground", className),
|
|
13
|
+
...props
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function CommandDialog({ title = "Command Palette", description = "Search for a command to run...", children, className, showCloseButton = false, ...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsxs(Dialog, {
|
|
18
|
+
...props,
|
|
19
|
+
children: [/* @__PURE__ */ jsxs(DialogHeader, {
|
|
20
|
+
className: "sr-only",
|
|
21
|
+
children: [/* @__PURE__ */ jsx(DialogTitle, { children: title }), /* @__PURE__ */ jsx(DialogDescription, { children: description })]
|
|
22
|
+
}), /* @__PURE__ */ jsx(DialogContent, {
|
|
23
|
+
className: cn("top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0", className),
|
|
24
|
+
showCloseButton,
|
|
25
|
+
children
|
|
26
|
+
})]
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function CommandInput({ className, ...props }) {
|
|
30
|
+
return /* @__PURE__ */ jsx("div", {
|
|
31
|
+
"data-slot": "command-input-wrapper",
|
|
32
|
+
className: "p-1 pb-0",
|
|
33
|
+
children: /* @__PURE__ */ jsxs(InputGroup, {
|
|
34
|
+
className: "h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!",
|
|
35
|
+
children: [/* @__PURE__ */ jsx(Command$1.Input, {
|
|
36
|
+
"data-slot": "command-input",
|
|
37
|
+
className: cn("w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
38
|
+
...props
|
|
39
|
+
}), /* @__PURE__ */ jsx(InputGroupAddon, { children: /* @__PURE__ */ jsx(SearchIcon, { className: "size-4 shrink-0 opacity-50" }) })]
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function CommandList({ className, ...props }) {
|
|
44
|
+
return /* @__PURE__ */ jsx(Command$1.List, {
|
|
45
|
+
"data-slot": "command-list",
|
|
46
|
+
className: cn("no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none", className),
|
|
47
|
+
...props
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function CommandEmpty({ className, ...props }) {
|
|
51
|
+
return /* @__PURE__ */ jsx(Command$1.Empty, {
|
|
52
|
+
"data-slot": "command-empty",
|
|
53
|
+
className: cn("py-6 text-center text-sm", className),
|
|
54
|
+
...props
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function CommandGroup({ className, ...props }) {
|
|
58
|
+
return /* @__PURE__ */ jsx(Command$1.Group, {
|
|
59
|
+
"data-slot": "command-group",
|
|
60
|
+
className: cn("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", className),
|
|
61
|
+
...props
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function CommandSeparator({ className, ...props }) {
|
|
65
|
+
return /* @__PURE__ */ jsx(Command$1.Separator, {
|
|
66
|
+
"data-slot": "command-separator",
|
|
67
|
+
className: cn("-mx-1 h-px bg-border", className),
|
|
68
|
+
...props
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function CommandItem({ className, children, ...props }) {
|
|
72
|
+
return /* @__PURE__ */ jsxs(Command$1.Item, {
|
|
73
|
+
"data-slot": "command-item",
|
|
74
|
+
className: cn("group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground", className),
|
|
75
|
+
...props,
|
|
76
|
+
children: [children, /* @__PURE__ */ jsx(CheckIcon, { className: "ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100" })]
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function CommandShortcut({ className, ...props }) {
|
|
80
|
+
return /* @__PURE__ */ jsx("span", {
|
|
81
|
+
"data-slot": "command-shortcut",
|
|
82
|
+
className: cn("ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground", className),
|
|
83
|
+
...props
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { ContextMenu as ContextMenu$1 } from "radix-ui";
|
|
3
|
+
declare function ContextMenu({ ...props }: React.ComponentProps<typeof ContextMenu$1.Root>): React.JSX.Element;
|
|
4
|
+
declare function ContextMenuTrigger({ className, ...props }: React.ComponentProps<typeof ContextMenu$1.Trigger>): React.JSX.Element;
|
|
5
|
+
declare function ContextMenuGroup({ ...props }: React.ComponentProps<typeof ContextMenu$1.Group>): React.JSX.Element;
|
|
6
|
+
declare function ContextMenuPortal({ ...props }: React.ComponentProps<typeof ContextMenu$1.Portal>): React.JSX.Element;
|
|
7
|
+
declare function ContextMenuSub({ ...props }: React.ComponentProps<typeof ContextMenu$1.Sub>): React.JSX.Element;
|
|
8
|
+
declare function ContextMenuRadioGroup({ ...props }: React.ComponentProps<typeof ContextMenu$1.RadioGroup>): React.JSX.Element;
|
|
9
|
+
declare function ContextMenuContent({ className, ...props }: React.ComponentProps<typeof ContextMenu$1.Content> & {
|
|
10
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
11
|
+
}): React.JSX.Element;
|
|
12
|
+
declare function ContextMenuItem({ className, inset, variant, ...props }: React.ComponentProps<typeof ContextMenu$1.Item> & {
|
|
13
|
+
inset?: boolean;
|
|
14
|
+
variant?: "default" | "destructive";
|
|
15
|
+
}): React.JSX.Element;
|
|
16
|
+
declare function ContextMenuSubTrigger({ className, inset, children, ...props }: React.ComponentProps<typeof ContextMenu$1.SubTrigger> & {
|
|
17
|
+
inset?: boolean;
|
|
18
|
+
}): React.JSX.Element;
|
|
19
|
+
declare function ContextMenuSubContent({ className, ...props }: React.ComponentProps<typeof ContextMenu$1.SubContent>): React.JSX.Element;
|
|
20
|
+
declare function ContextMenuCheckboxItem({ className, children, checked, inset, ...props }: React.ComponentProps<typeof ContextMenu$1.CheckboxItem> & {
|
|
21
|
+
inset?: boolean;
|
|
22
|
+
}): React.JSX.Element;
|
|
23
|
+
declare function ContextMenuRadioItem({ className, children, inset, ...props }: React.ComponentProps<typeof ContextMenu$1.RadioItem> & {
|
|
24
|
+
inset?: boolean;
|
|
25
|
+
}): React.JSX.Element;
|
|
26
|
+
declare function ContextMenuLabel({ className, inset, ...props }: React.ComponentProps<typeof ContextMenu$1.Label> & {
|
|
27
|
+
inset?: boolean;
|
|
28
|
+
}): React.JSX.Element;
|
|
29
|
+
declare function ContextMenuSeparator({ className, ...props }: React.ComponentProps<typeof ContextMenu$1.Separator>): React.JSX.Element;
|
|
30
|
+
declare function ContextMenuShortcut({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
31
|
+
export { ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger };
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { CheckIcon, ChevronRightIcon } from "lucide-react";
|
|
5
|
+
import { ContextMenu as ContextMenu$1 } from "radix-ui";
|
|
6
|
+
// src/components/ui/context-menu.tsx
|
|
7
|
+
function ContextMenu({ ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Root, {
|
|
9
|
+
"data-slot": "context-menu",
|
|
10
|
+
...props
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function ContextMenuTrigger({ className, ...props }) {
|
|
14
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Trigger, {
|
|
15
|
+
"data-slot": "context-menu-trigger",
|
|
16
|
+
className: cn("select-none", className),
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function ContextMenuGroup({ ...props }) {
|
|
21
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Group, {
|
|
22
|
+
"data-slot": "context-menu-group",
|
|
23
|
+
...props
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function ContextMenuPortal({ ...props }) {
|
|
27
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Portal, {
|
|
28
|
+
"data-slot": "context-menu-portal",
|
|
29
|
+
...props
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function ContextMenuSub({ ...props }) {
|
|
33
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Sub, {
|
|
34
|
+
"data-slot": "context-menu-sub",
|
|
35
|
+
...props
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function ContextMenuRadioGroup({ ...props }) {
|
|
39
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.RadioGroup, {
|
|
40
|
+
"data-slot": "context-menu-radio-group",
|
|
41
|
+
...props
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function ContextMenuContent({ className, ...props }) {
|
|
45
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Portal, { children: /* @__PURE__ */ jsx(ContextMenu$1.Content, {
|
|
46
|
+
"data-slot": "context-menu-content",
|
|
47
|
+
className: cn("z-50 max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
|
|
48
|
+
...props
|
|
49
|
+
}) });
|
|
50
|
+
}
|
|
51
|
+
function ContextMenuItem({ className, inset, variant = "default", ...props }) {
|
|
52
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Item, {
|
|
53
|
+
"data-slot": "context-menu-item",
|
|
54
|
+
"data-inset": inset,
|
|
55
|
+
"data-variant": variant,
|
|
56
|
+
className: cn("group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive", className),
|
|
57
|
+
...props
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function ContextMenuSubTrigger({ className, inset, children, ...props }) {
|
|
61
|
+
return /* @__PURE__ */ jsxs(ContextMenu$1.SubTrigger, {
|
|
62
|
+
"data-slot": "context-menu-sub-trigger",
|
|
63
|
+
"data-inset": inset,
|
|
64
|
+
className: cn("flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
65
|
+
...props,
|
|
66
|
+
children: [children, /* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto" })]
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function ContextMenuSubContent({ className, ...props }) {
|
|
70
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.SubContent, {
|
|
71
|
+
"data-slot": "context-menu-sub-content",
|
|
72
|
+
className: cn("z-50 min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-lg duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
|
|
73
|
+
...props
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function ContextMenuCheckboxItem({ className, children, checked, inset, ...props }) {
|
|
77
|
+
return /* @__PURE__ */ jsxs(ContextMenu$1.CheckboxItem, {
|
|
78
|
+
"data-slot": "context-menu-checkbox-item",
|
|
79
|
+
"data-inset": inset,
|
|
80
|
+
className: cn("relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
81
|
+
checked,
|
|
82
|
+
...props,
|
|
83
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
84
|
+
className: "pointer-events-none absolute right-2",
|
|
85
|
+
children: /* @__PURE__ */ jsx(ContextMenu$1.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {}) })
|
|
86
|
+
}), children]
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function ContextMenuRadioItem({ className, children, inset, ...props }) {
|
|
90
|
+
return /* @__PURE__ */ jsxs(ContextMenu$1.RadioItem, {
|
|
91
|
+
"data-slot": "context-menu-radio-item",
|
|
92
|
+
"data-inset": inset,
|
|
93
|
+
className: cn("relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
94
|
+
...props,
|
|
95
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
96
|
+
className: "pointer-events-none absolute right-2",
|
|
97
|
+
children: /* @__PURE__ */ jsx(ContextMenu$1.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {}) })
|
|
98
|
+
}), children]
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
function ContextMenuLabel({ className, inset, ...props }) {
|
|
102
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Label, {
|
|
103
|
+
"data-slot": "context-menu-label",
|
|
104
|
+
"data-inset": inset,
|
|
105
|
+
className: cn("px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7", className),
|
|
106
|
+
...props
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function ContextMenuSeparator({ className, ...props }) {
|
|
110
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Separator, {
|
|
111
|
+
"data-slot": "context-menu-separator",
|
|
112
|
+
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
113
|
+
...props
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function ContextMenuShortcut({ className, ...props }) {
|
|
117
|
+
return /* @__PURE__ */ jsx("span", {
|
|
118
|
+
"data-slot": "context-menu-shortcut",
|
|
119
|
+
className: cn("ml-auto text-xs tracking-widest text-muted-foreground group-focus/context-menu-item:text-accent-foreground", className),
|
|
120
|
+
...props
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
export { ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger };
|