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,377 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
import { useIsMobile } from "../../hooks/use-mobile.js";
|
|
4
|
+
import { Button } from "./button.js";
|
|
5
|
+
import { Input } from "./input.js";
|
|
6
|
+
import { Separator as Separator$1 } from "./separator.js";
|
|
7
|
+
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "./sheet.js";
|
|
8
|
+
import { Skeleton } from "./skeleton.js";
|
|
9
|
+
import { Tooltip as Tooltip$1, TooltipContent, TooltipTrigger } from "./tooltip.js";
|
|
10
|
+
import * as React from "react";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { PanelLeftIcon } from "lucide-react";
|
|
13
|
+
import { cva } from "class-variance-authority";
|
|
14
|
+
import { Slot } from "radix-ui";
|
|
15
|
+
// src/components/ui/sidebar.tsx
|
|
16
|
+
const SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
17
|
+
const SIDEBAR_COOKIE_MAX_AGE = 604800;
|
|
18
|
+
const SIDEBAR_WIDTH = "16rem";
|
|
19
|
+
const SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
20
|
+
const SIDEBAR_WIDTH_ICON = "3rem";
|
|
21
|
+
const SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
22
|
+
const SidebarContext = React.createContext(null);
|
|
23
|
+
function useSidebar() {
|
|
24
|
+
const context = React.useContext(SidebarContext);
|
|
25
|
+
if (!context) throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
26
|
+
return context;
|
|
27
|
+
}
|
|
28
|
+
function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props }) {
|
|
29
|
+
const isMobile = useIsMobile();
|
|
30
|
+
const [openMobile, setOpenMobile] = React.useState(false);
|
|
31
|
+
const [_open, _setOpen] = React.useState(defaultOpen);
|
|
32
|
+
const open = openProp ?? _open;
|
|
33
|
+
const setOpen = React.useCallback((value) => {
|
|
34
|
+
const openState = typeof value === "function" ? value(open) : value;
|
|
35
|
+
if (setOpenProp) setOpenProp(openState);
|
|
36
|
+
else _setOpen(openState);
|
|
37
|
+
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
|
|
38
|
+
}, [setOpenProp, open]);
|
|
39
|
+
const toggleSidebar = React.useCallback(() => {
|
|
40
|
+
return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
|
|
41
|
+
}, [
|
|
42
|
+
isMobile,
|
|
43
|
+
setOpen,
|
|
44
|
+
setOpenMobile
|
|
45
|
+
]);
|
|
46
|
+
React.useEffect(() => {
|
|
47
|
+
const handleKeyDown = (event) => {
|
|
48
|
+
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
49
|
+
event.preventDefault();
|
|
50
|
+
toggleSidebar();
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
54
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
55
|
+
}, [toggleSidebar]);
|
|
56
|
+
const state = open ? "expanded" : "collapsed";
|
|
57
|
+
const contextValue = React.useMemo(() => ({
|
|
58
|
+
state,
|
|
59
|
+
open,
|
|
60
|
+
setOpen,
|
|
61
|
+
isMobile,
|
|
62
|
+
openMobile,
|
|
63
|
+
setOpenMobile,
|
|
64
|
+
toggleSidebar
|
|
65
|
+
}), [
|
|
66
|
+
state,
|
|
67
|
+
open,
|
|
68
|
+
setOpen,
|
|
69
|
+
isMobile,
|
|
70
|
+
openMobile,
|
|
71
|
+
setOpenMobile,
|
|
72
|
+
toggleSidebar
|
|
73
|
+
]);
|
|
74
|
+
return /* @__PURE__ */ jsx(SidebarContext.Provider, {
|
|
75
|
+
value: contextValue,
|
|
76
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
77
|
+
"data-slot": "sidebar-wrapper",
|
|
78
|
+
style: {
|
|
79
|
+
"--sidebar-width": SIDEBAR_WIDTH,
|
|
80
|
+
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
81
|
+
...style
|
|
82
|
+
},
|
|
83
|
+
className: cn("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar", className),
|
|
84
|
+
...props,
|
|
85
|
+
children
|
|
86
|
+
})
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function Sidebar({ side = "left", variant = "sidebar", collapsible = "offcanvas", className, children, dir, ...props }) {
|
|
90
|
+
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
91
|
+
if (collapsible === "none") return /* @__PURE__ */ jsx("div", {
|
|
92
|
+
"data-slot": "sidebar",
|
|
93
|
+
className: cn("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground", className),
|
|
94
|
+
...props,
|
|
95
|
+
children
|
|
96
|
+
});
|
|
97
|
+
if (isMobile) return /* @__PURE__ */ jsx(Sheet, {
|
|
98
|
+
open: openMobile,
|
|
99
|
+
onOpenChange: setOpenMobile,
|
|
100
|
+
...props,
|
|
101
|
+
children: /* @__PURE__ */ jsxs(SheetContent, {
|
|
102
|
+
dir,
|
|
103
|
+
"data-sidebar": "sidebar",
|
|
104
|
+
"data-slot": "sidebar",
|
|
105
|
+
"data-mobile": "true",
|
|
106
|
+
className: "w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",
|
|
107
|
+
style: { "--sidebar-width": SIDEBAR_WIDTH_MOBILE },
|
|
108
|
+
side,
|
|
109
|
+
children: [/* @__PURE__ */ jsxs(SheetHeader, {
|
|
110
|
+
className: "sr-only",
|
|
111
|
+
children: [/* @__PURE__ */ jsx(SheetTitle, { children: "Sidebar" }), /* @__PURE__ */ jsx(SheetDescription, { children: "Displays the mobile sidebar." })]
|
|
112
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
113
|
+
className: "flex h-full w-full flex-col",
|
|
114
|
+
children
|
|
115
|
+
})]
|
|
116
|
+
})
|
|
117
|
+
});
|
|
118
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
119
|
+
className: "group peer hidden text-sidebar-foreground md:block",
|
|
120
|
+
"data-state": state,
|
|
121
|
+
"data-collapsible": state === "collapsed" ? collapsible : "",
|
|
122
|
+
"data-variant": variant,
|
|
123
|
+
"data-side": side,
|
|
124
|
+
"data-slot": "sidebar",
|
|
125
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
126
|
+
"data-slot": "sidebar-gap",
|
|
127
|
+
className: cn("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear", "group-data-[collapsible=offcanvas]:w-0", "group-data-[side=right]:rotate-180", variant === "floating" || variant === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)")
|
|
128
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
129
|
+
"data-slot": "sidebar-container",
|
|
130
|
+
"data-side": side,
|
|
131
|
+
className: cn("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex", variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l", className),
|
|
132
|
+
...props,
|
|
133
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
134
|
+
"data-sidebar": "sidebar",
|
|
135
|
+
"data-slot": "sidebar-inner",
|
|
136
|
+
className: "flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border",
|
|
137
|
+
children
|
|
138
|
+
})
|
|
139
|
+
})]
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
function SidebarTrigger({ className, onClick, ...props }) {
|
|
143
|
+
const { toggleSidebar } = useSidebar();
|
|
144
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
145
|
+
"data-sidebar": "trigger",
|
|
146
|
+
"data-slot": "sidebar-trigger",
|
|
147
|
+
variant: "ghost",
|
|
148
|
+
size: "icon-sm",
|
|
149
|
+
className: cn(className),
|
|
150
|
+
onClick: (event) => {
|
|
151
|
+
onClick?.(event);
|
|
152
|
+
toggleSidebar();
|
|
153
|
+
},
|
|
154
|
+
...props,
|
|
155
|
+
children: [/* @__PURE__ */ jsx(PanelLeftIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
156
|
+
className: "sr-only",
|
|
157
|
+
children: "Toggle Sidebar"
|
|
158
|
+
})]
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
function SidebarRail({ className, ...props }) {
|
|
162
|
+
const { toggleSidebar } = useSidebar();
|
|
163
|
+
return /* @__PURE__ */ jsx("button", {
|
|
164
|
+
"data-sidebar": "rail",
|
|
165
|
+
"data-slot": "sidebar-rail",
|
|
166
|
+
"aria-label": "Toggle Sidebar",
|
|
167
|
+
tabIndex: -1,
|
|
168
|
+
onClick: toggleSidebar,
|
|
169
|
+
title: "Toggle Sidebar",
|
|
170
|
+
className: cn("absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2", "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize", "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize", "group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar", "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2", "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2", className),
|
|
171
|
+
...props
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
function SidebarInset({ className, ...props }) {
|
|
175
|
+
return /* @__PURE__ */ jsx("main", {
|
|
176
|
+
"data-slot": "sidebar-inset",
|
|
177
|
+
className: cn("relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2", className),
|
|
178
|
+
...props
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
function SidebarInput({ className, ...props }) {
|
|
182
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
183
|
+
"data-slot": "sidebar-input",
|
|
184
|
+
"data-sidebar": "input",
|
|
185
|
+
className: cn("h-8 w-full bg-background shadow-none", className),
|
|
186
|
+
...props
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
function SidebarHeader({ className, ...props }) {
|
|
190
|
+
return /* @__PURE__ */ jsx("div", {
|
|
191
|
+
"data-slot": "sidebar-header",
|
|
192
|
+
"data-sidebar": "header",
|
|
193
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
194
|
+
...props
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
function SidebarFooter({ className, ...props }) {
|
|
198
|
+
return /* @__PURE__ */ jsx("div", {
|
|
199
|
+
"data-slot": "sidebar-footer",
|
|
200
|
+
"data-sidebar": "footer",
|
|
201
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
202
|
+
...props
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
function SidebarSeparator({ className, ...props }) {
|
|
206
|
+
return /* @__PURE__ */ jsx(Separator$1, {
|
|
207
|
+
"data-slot": "sidebar-separator",
|
|
208
|
+
"data-sidebar": "separator",
|
|
209
|
+
className: cn("mx-2 w-auto bg-sidebar-border", className),
|
|
210
|
+
...props
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
function SidebarContent({ className, ...props }) {
|
|
214
|
+
return /* @__PURE__ */ jsx("div", {
|
|
215
|
+
"data-slot": "sidebar-content",
|
|
216
|
+
"data-sidebar": "content",
|
|
217
|
+
className: cn("no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden", className),
|
|
218
|
+
...props
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
function SidebarGroup({ className, ...props }) {
|
|
222
|
+
return /* @__PURE__ */ jsx("div", {
|
|
223
|
+
"data-slot": "sidebar-group",
|
|
224
|
+
"data-sidebar": "group",
|
|
225
|
+
className: cn("relative flex w-full min-w-0 flex-col p-2", className),
|
|
226
|
+
...props
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
function SidebarGroupLabel({ className, asChild = false, ...props }) {
|
|
230
|
+
const Comp = asChild ? Slot.Root : "div";
|
|
231
|
+
return /* @__PURE__ */ jsx(Comp, {
|
|
232
|
+
"data-slot": "sidebar-group-label",
|
|
233
|
+
"data-sidebar": "group-label",
|
|
234
|
+
className: cn("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", className),
|
|
235
|
+
...props
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
function SidebarGroupAction({ className, asChild = false, ...props }) {
|
|
239
|
+
const Comp = asChild ? Slot.Root : "button";
|
|
240
|
+
return /* @__PURE__ */ jsx(Comp, {
|
|
241
|
+
"data-slot": "sidebar-group-action",
|
|
242
|
+
"data-sidebar": "group-action",
|
|
243
|
+
className: cn("absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0", className),
|
|
244
|
+
...props
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
function SidebarGroupContent({ className, ...props }) {
|
|
248
|
+
return /* @__PURE__ */ jsx("div", {
|
|
249
|
+
"data-slot": "sidebar-group-content",
|
|
250
|
+
"data-sidebar": "group-content",
|
|
251
|
+
className: cn("w-full text-sm", className),
|
|
252
|
+
...props
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
function SidebarMenu({ className, ...props }) {
|
|
256
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
257
|
+
"data-slot": "sidebar-menu",
|
|
258
|
+
"data-sidebar": "menu",
|
|
259
|
+
className: cn("flex w-full min-w-0 flex-col gap-0", className),
|
|
260
|
+
...props
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
function SidebarMenuItem({ className, ...props }) {
|
|
264
|
+
return /* @__PURE__ */ jsx("li", {
|
|
265
|
+
"data-slot": "sidebar-menu-item",
|
|
266
|
+
"data-sidebar": "menu-item",
|
|
267
|
+
className: cn("group/menu-item relative", className),
|
|
268
|
+
...props
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
const sidebarMenuButtonVariants = cva("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md px-3 py-2 text-left text-sm font-medium text-muted-foreground ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-card data-active:text-foreground data-active:shadow-card [&_svg]:size-[18px] [&_svg]:shrink-0 [&>span:last-child]:truncate", {
|
|
272
|
+
variants: {
|
|
273
|
+
variant: {
|
|
274
|
+
default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
275
|
+
outline: "bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]"
|
|
276
|
+
},
|
|
277
|
+
size: {
|
|
278
|
+
default: "h-10 text-sm",
|
|
279
|
+
sm: "h-8 text-xs",
|
|
280
|
+
lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!"
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
defaultVariants: {
|
|
284
|
+
variant: "default",
|
|
285
|
+
size: "default"
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
function SidebarMenuButton({ asChild = false, isActive = false, variant = "default", size = "default", tooltip, className, ...props }) {
|
|
289
|
+
const Comp = asChild ? Slot.Root : "button";
|
|
290
|
+
const { isMobile, state } = useSidebar();
|
|
291
|
+
const button = /* @__PURE__ */ jsx(Comp, {
|
|
292
|
+
"data-slot": "sidebar-menu-button",
|
|
293
|
+
"data-sidebar": "menu-button",
|
|
294
|
+
"data-size": size,
|
|
295
|
+
"data-active": isActive,
|
|
296
|
+
className: cn(sidebarMenuButtonVariants({
|
|
297
|
+
variant,
|
|
298
|
+
size
|
|
299
|
+
}), className),
|
|
300
|
+
...props
|
|
301
|
+
});
|
|
302
|
+
if (!tooltip) return button;
|
|
303
|
+
if (typeof tooltip === "string") tooltip = { children: tooltip };
|
|
304
|
+
return /* @__PURE__ */ jsxs(Tooltip$1, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
305
|
+
asChild: true,
|
|
306
|
+
children: button
|
|
307
|
+
}), /* @__PURE__ */ jsx(TooltipContent, {
|
|
308
|
+
side: "right",
|
|
309
|
+
align: "center",
|
|
310
|
+
hidden: state !== "collapsed" || isMobile,
|
|
311
|
+
...tooltip
|
|
312
|
+
})] });
|
|
313
|
+
}
|
|
314
|
+
function SidebarMenuAction({ className, asChild = false, showOnHover = false, ...props }) {
|
|
315
|
+
const Comp = asChild ? Slot.Root : "button";
|
|
316
|
+
return /* @__PURE__ */ jsx(Comp, {
|
|
317
|
+
"data-slot": "sidebar-menu-action",
|
|
318
|
+
"data-sidebar": "menu-action",
|
|
319
|
+
className: cn("absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0", showOnHover && "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0", className),
|
|
320
|
+
...props
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
function SidebarMenuBadge({ className, ...props }) {
|
|
324
|
+
return /* @__PURE__ */ jsx("div", {
|
|
325
|
+
"data-slot": "sidebar-menu-badge",
|
|
326
|
+
"data-sidebar": "menu-badge",
|
|
327
|
+
className: cn("pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 peer-data-active/menu-button:text-sidebar-accent-foreground", className),
|
|
328
|
+
...props
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
function SidebarMenuSkeleton({ className, showIcon = false, ...props }) {
|
|
332
|
+
const [width] = React.useState(() => {
|
|
333
|
+
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
334
|
+
});
|
|
335
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
336
|
+
"data-slot": "sidebar-menu-skeleton",
|
|
337
|
+
"data-sidebar": "menu-skeleton",
|
|
338
|
+
className: cn("flex h-8 items-center gap-2 rounded-md px-2", className),
|
|
339
|
+
...props,
|
|
340
|
+
children: [showIcon && /* @__PURE__ */ jsx(Skeleton, {
|
|
341
|
+
className: "size-4 rounded-md",
|
|
342
|
+
"data-sidebar": "menu-skeleton-icon"
|
|
343
|
+
}), /* @__PURE__ */ jsx(Skeleton, {
|
|
344
|
+
className: "h-4 max-w-(--skeleton-width) flex-1",
|
|
345
|
+
"data-sidebar": "menu-skeleton-text",
|
|
346
|
+
style: { "--skeleton-width": width }
|
|
347
|
+
})]
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
function SidebarMenuSub({ className, ...props }) {
|
|
351
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
352
|
+
"data-slot": "sidebar-menu-sub",
|
|
353
|
+
"data-sidebar": "menu-sub",
|
|
354
|
+
className: cn("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden", className),
|
|
355
|
+
...props
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
function SidebarMenuSubItem({ className, ...props }) {
|
|
359
|
+
return /* @__PURE__ */ jsx("li", {
|
|
360
|
+
"data-slot": "sidebar-menu-sub-item",
|
|
361
|
+
"data-sidebar": "menu-sub-item",
|
|
362
|
+
className: cn("group/menu-sub-item relative", className),
|
|
363
|
+
...props
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
function SidebarMenuSubButton({ asChild = false, size = "md", isActive = false, className, ...props }) {
|
|
367
|
+
const Comp = asChild ? Slot.Root : "a";
|
|
368
|
+
return /* @__PURE__ */ jsx(Comp, {
|
|
369
|
+
"data-slot": "sidebar-menu-sub-button",
|
|
370
|
+
"data-sidebar": "menu-sub-button",
|
|
371
|
+
"data-size": size,
|
|
372
|
+
"data-active": isActive,
|
|
373
|
+
className: cn("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[size=md]:text-sm data-[size=sm]:text-xs data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground", className),
|
|
374
|
+
...props
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
// src/components/ui/skeleton.tsx
|
|
5
|
+
function Skeleton({ className, ...props }) {
|
|
6
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7
|
+
"data-slot": "skeleton",
|
|
8
|
+
className: cn("animate-pulse rounded-md bg-muted", className),
|
|
9
|
+
...props
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export { Skeleton };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Slider as Slider$1 } from "radix-ui";
|
|
6
|
+
// src/components/ui/slider.tsx
|
|
7
|
+
function Slider({ className, defaultValue, value, min = 0, max = 100, ...props }) {
|
|
8
|
+
const _values = React.useMemo(() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max], [
|
|
9
|
+
value,
|
|
10
|
+
defaultValue,
|
|
11
|
+
min,
|
|
12
|
+
max
|
|
13
|
+
]);
|
|
14
|
+
return /* @__PURE__ */ jsxs(Slider$1.Root, {
|
|
15
|
+
"data-slot": "slider",
|
|
16
|
+
defaultValue,
|
|
17
|
+
value,
|
|
18
|
+
min,
|
|
19
|
+
max,
|
|
20
|
+
className: cn("relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col", className),
|
|
21
|
+
...props,
|
|
22
|
+
children: [/* @__PURE__ */ jsx(Slider$1.Track, {
|
|
23
|
+
"data-slot": "slider-track",
|
|
24
|
+
className: "relative grow overflow-hidden rounded-full bg-muted data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1",
|
|
25
|
+
children: /* @__PURE__ */ jsx(Slider$1.Range, {
|
|
26
|
+
"data-slot": "slider-range",
|
|
27
|
+
className: "absolute bg-primary select-none data-horizontal:h-full data-vertical:w-full"
|
|
28
|
+
})
|
|
29
|
+
}), Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ jsx(Slider$1.Thumb, {
|
|
30
|
+
"data-slot": "slider-thumb",
|
|
31
|
+
className: "relative block size-3 shrink-0 rounded-full border border-ring bg-white ring-ring/50 transition-[color,box-shadow] select-none after:absolute after:-inset-2 hover:ring-3 focus-visible:ring-3 focus-visible:outline-hidden active:ring-3 disabled:pointer-events-none disabled:opacity-50"
|
|
32
|
+
}, index))]
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export { Slider };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useTheme } from "../theme/theme-provider.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { CircleCheckIcon, InfoIcon, Loader2Icon, OctagonXIcon, TriangleAlertIcon } from "lucide-react";
|
|
5
|
+
import { Toaster as Toaster$1 } from "sonner";
|
|
6
|
+
// src/components/ui/sonner.tsx
|
|
7
|
+
const Toaster = ({ ...props }) => {
|
|
8
|
+
const { resolvedMode } = useTheme();
|
|
9
|
+
return /* @__PURE__ */ jsx(Toaster$1, {
|
|
10
|
+
theme: resolvedMode,
|
|
11
|
+
className: "toaster group",
|
|
12
|
+
icons: {
|
|
13
|
+
success: /* @__PURE__ */ jsx(CircleCheckIcon, { className: "size-4" }),
|
|
14
|
+
info: /* @__PURE__ */ jsx(InfoIcon, { className: "size-4" }),
|
|
15
|
+
warning: /* @__PURE__ */ jsx(TriangleAlertIcon, { className: "size-4" }),
|
|
16
|
+
error: /* @__PURE__ */ jsx(OctagonXIcon, { className: "size-4" }),
|
|
17
|
+
loading: /* @__PURE__ */ jsx(Loader2Icon, { className: "size-4 animate-spin" })
|
|
18
|
+
},
|
|
19
|
+
style: {
|
|
20
|
+
"--normal-bg": "var(--popover)",
|
|
21
|
+
"--normal-text": "var(--popover-foreground)",
|
|
22
|
+
"--normal-border": "var(--border)",
|
|
23
|
+
"--border-radius": "var(--radius)"
|
|
24
|
+
},
|
|
25
|
+
toastOptions: { classNames: { toast: "cn-toast" } },
|
|
26
|
+
...props
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
export { Toaster };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Loader2Icon } from "lucide-react";
|
|
5
|
+
// src/components/ui/spinner.tsx
|
|
6
|
+
function Spinner({ className, ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(Loader2Icon, {
|
|
8
|
+
"data-slot": "spinner",
|
|
9
|
+
role: "status",
|
|
10
|
+
"aria-label": "Loading",
|
|
11
|
+
className: cn("size-4 animate-spin", className),
|
|
12
|
+
...props
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
export { Spinner };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Switch as Switch$1 } from "radix-ui";
|
|
5
|
+
// src/components/ui/switch.tsx
|
|
6
|
+
function Switch({ className, size = "default", ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(Switch$1.Root, {
|
|
8
|
+
"data-slot": "switch",
|
|
9
|
+
"data-size": size,
|
|
10
|
+
className: cn("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50", className),
|
|
11
|
+
...props,
|
|
12
|
+
children: /* @__PURE__ */ jsx(Switch$1.Thumb, {
|
|
13
|
+
"data-slot": "switch-thumb",
|
|
14
|
+
className: "pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"
|
|
15
|
+
})
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
export { Switch };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare function Table({ className, ...props }: React.ComponentProps<"table">): React.JSX.Element;
|
|
3
|
+
declare function TableHeader({ className, ...props }: React.ComponentProps<"thead">): React.JSX.Element;
|
|
4
|
+
declare function TableBody({ className, ...props }: React.ComponentProps<"tbody">): React.JSX.Element;
|
|
5
|
+
declare function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">): React.JSX.Element;
|
|
6
|
+
declare function TableRow({ className, ...props }: React.ComponentProps<"tr">): React.JSX.Element;
|
|
7
|
+
declare function TableHead({ className, ...props }: React.ComponentProps<"th">): React.JSX.Element;
|
|
8
|
+
declare function TableCell({ className, ...props }: React.ComponentProps<"td">): React.JSX.Element;
|
|
9
|
+
declare function TableCaption({ className, ...props }: React.ComponentProps<"caption">): React.JSX.Element;
|
|
10
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
// src/components/ui/table.tsx
|
|
5
|
+
function Table({ className, ...props }) {
|
|
6
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7
|
+
"data-slot": "table-container",
|
|
8
|
+
className: "relative w-full overflow-x-auto",
|
|
9
|
+
children: /* @__PURE__ */ jsx("table", {
|
|
10
|
+
"data-slot": "table",
|
|
11
|
+
className: cn("w-full caption-bottom border-separate border-spacing-0 text-sm", className),
|
|
12
|
+
...props
|
|
13
|
+
})
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function TableHeader({ className, ...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsx("thead", {
|
|
18
|
+
"data-slot": "table-header",
|
|
19
|
+
className: cn("[&_tr]:hover:bg-transparent", className),
|
|
20
|
+
...props
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function TableBody({ className, ...props }) {
|
|
24
|
+
return /* @__PURE__ */ jsx("tbody", {
|
|
25
|
+
"data-slot": "table-body",
|
|
26
|
+
className: cn("[&_td:first-child]:rounded-l-md [&_td:last-child]:rounded-r-md", className),
|
|
27
|
+
...props
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function TableFooter({ className, ...props }) {
|
|
31
|
+
return /* @__PURE__ */ jsx("tfoot", {
|
|
32
|
+
"data-slot": "table-footer",
|
|
33
|
+
className: cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className),
|
|
34
|
+
...props
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function TableRow({ className, ...props }) {
|
|
38
|
+
return /* @__PURE__ */ jsx("tr", {
|
|
39
|
+
"data-slot": "table-row",
|
|
40
|
+
className: cn("transition-colors hover:bg-muted has-aria-expanded:bg-muted data-[state=selected]:bg-primary-soft", className),
|
|
41
|
+
...props
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function TableHead({ className, ...props }) {
|
|
45
|
+
return /* @__PURE__ */ jsx("th", {
|
|
46
|
+
"data-slot": "table-head",
|
|
47
|
+
className: cn("h-9 px-4 pb-1 text-left align-middle text-xs font-medium whitespace-nowrap text-muted-foreground [&:has([role=checkbox])]:pr-0", className),
|
|
48
|
+
...props
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function TableCell({ className, ...props }) {
|
|
52
|
+
return /* @__PURE__ */ jsx("td", {
|
|
53
|
+
"data-slot": "table-cell",
|
|
54
|
+
className: cn("px-4 py-3.5 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0", className),
|
|
55
|
+
...props
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function TableCaption({ className, ...props }) {
|
|
59
|
+
return /* @__PURE__ */ jsx("caption", {
|
|
60
|
+
"data-slot": "table-caption",
|
|
61
|
+
className: cn("mt-4 text-sm text-muted-foreground", className),
|
|
62
|
+
...props
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
|
+
import { Tabs as Tabs$1 } from "radix-ui";
|
|
4
|
+
declare function Tabs({ className, orientation, ...props }: React.ComponentProps<typeof Tabs$1.Root>): React.JSX.Element;
|
|
5
|
+
declare const tabsListVariants: (props?: ({
|
|
6
|
+
variant?: "default" | "line" | "pill" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
declare function TabsList({ className, variant, ...props }: React.ComponentProps<typeof Tabs$1.List> & VariantProps<typeof tabsListVariants>): React.JSX.Element;
|
|
9
|
+
declare function TabsTrigger({ className, ...props }: React.ComponentProps<typeof Tabs$1.Trigger>): React.JSX.Element;
|
|
10
|
+
declare function TabsContent({ className, ...props }: React.ComponentProps<typeof Tabs$1.Content>): React.JSX.Element;
|
|
11
|
+
export { Tabs, TabsContent, TabsList, TabsTrigger, tabsListVariants };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { Tabs as Tabs$1 } from "radix-ui";
|
|
6
|
+
// src/components/ui/tabs.tsx
|
|
7
|
+
function Tabs({ className, orientation = "horizontal", ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(Tabs$1.Root, {
|
|
9
|
+
"data-slot": "tabs",
|
|
10
|
+
"data-orientation": orientation,
|
|
11
|
+
className: cn("group/tabs flex gap-2 data-horizontal:flex-col", className),
|
|
12
|
+
...props
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
const tabsListVariants = cva("group/tabs-list inline-flex w-fit items-center justify-center gap-0.5 rounded-md p-1 text-muted-foreground group-data-horizontal/tabs:h-10 data-[variant=pill]:rounded-full group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none", {
|
|
16
|
+
variants: { variant: {
|
|
17
|
+
default: "bg-muted",
|
|
18
|
+
pill: "gap-1 bg-muted group-data-horizontal/tabs:h-11",
|
|
19
|
+
line: "gap-1 bg-transparent"
|
|
20
|
+
} },
|
|
21
|
+
defaultVariants: { variant: "default" }
|
|
22
|
+
});
|
|
23
|
+
function TabsList({ className, variant = "default", ...props }) {
|
|
24
|
+
return /* @__PURE__ */ jsx(Tabs$1.List, {
|
|
25
|
+
"data-slot": "tabs-list",
|
|
26
|
+
"data-variant": variant,
|
|
27
|
+
className: cn(tabsListVariants({ variant }), className),
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function TabsTrigger({ className, ...props }) {
|
|
32
|
+
return /* @__PURE__ */ jsx(Tabs$1.Trigger, {
|
|
33
|
+
"data-slot": "tabs-trigger",
|
|
34
|
+
className: cn("relative inline-flex h-full flex-1 items-center justify-center gap-1.5 rounded-[calc(var(--radius-md)-3px)] border border-transparent px-3 py-0.5 text-sm font-medium whitespace-nowrap text-muted-foreground group-data-[variant=pill]/tabs-list:rounded-full group-data-[variant=pill]/tabs-list:px-3.5 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-card group-data-[variant=pill]/tabs-list:data-active:shadow-card group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", "group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent", "data-active:bg-card data-active:text-foreground", "after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100", className),
|
|
35
|
+
...props
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function TabsContent({ className, ...props }) {
|
|
39
|
+
return /* @__PURE__ */ jsx(Tabs$1.Content, {
|
|
40
|
+
"data-slot": "tabs-content",
|
|
41
|
+
className: cn("flex-1 text-sm outline-none", className),
|
|
42
|
+
...props
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
export { Tabs, TabsContent, TabsList, TabsTrigger, tabsListVariants };
|