@websolutespa/ask-ui 1.0.3 → 1.0.5
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/dist/components/accordion.d.mts +25 -0
- package/dist/components/accordion.mjs +55 -0
- package/dist/components/ai-elements/attachments.d.mts +94 -0
- package/dist/components/ai-elements/attachments.mjs +174 -0
- package/dist/components/ai-elements/conversation.d.mts +51 -0
- package/dist/components/ai-elements/conversation.mjs +85 -0
- package/dist/components/ai-elements/message.d.mts +89 -0
- package/dist/components/ai-elements/message.mjs +175 -0
- package/dist/components/ai-elements/prompt-input.d.mts +277 -0
- package/dist/components/ai-elements/prompt-input.mjs +703 -0
- package/dist/components/ai-elements/speech-input.d.mts +64 -0
- package/dist/components/ai-elements/speech-input.mjs +153 -0
- package/dist/components/alert-dialog.d.mts +60 -0
- package/dist/components/alert-dialog.mjs +101 -0
- package/dist/components/alert.d.mts +28 -0
- package/dist/components/alert.mjs +43 -0
- package/dist/components/aspect-ratio.d.mts +9 -0
- package/dist/components/aspect-ratio.mjs +12 -0
- package/dist/components/avatar.d.mts +34 -0
- package/dist/components/avatar.mjs +51 -0
- package/dist/components/badge.d.mts +19 -0
- package/dist/components/badge.mjs +27 -0
- package/dist/components/breadcrumb.d.mts +38 -0
- package/dist/components/breadcrumb.mjs +70 -0
- package/dist/components/button-group.d.mts +28 -0
- package/dist/components/button-group.mjs +38 -0
- package/dist/components/button.d.mts +21 -0
- package/dist/components/button.mjs +47 -0
- package/dist/components/calendar.d.mts +30 -0
- package/dist/components/calendar.mjs +109 -0
- package/dist/components/card.d.mts +37 -0
- package/dist/components/card.mjs +56 -0
- package/dist/components/carousel.d.mts +56 -0
- package/dist/components/carousel.mjs +132 -0
- package/dist/components/chart.d.mts +78 -0
- package/dist/components/chart.mjs +146 -0
- package/dist/components/checkbox.d.mts +11 -0
- package/dist/components/checkbox.mjs +21 -0
- package/dist/components/collapsible.d.mts +15 -0
- package/dist/components/collapsible.mjs +24 -0
- package/dist/components/combobox.d.mts +81 -0
- package/dist/components/combobox.mjs +163 -0
- package/dist/components/command.d.mts +54 -0
- package/dist/components/command.mjs +88 -0
- package/dist/components/context-menu.d.mts +85 -0
- package/dist/components/context-menu.mjs +125 -0
- package/dist/components/dialog.d.mts +51 -0
- package/dist/components/dialog.mjs +96 -0
- package/dist/components/direction.d.mts +15 -0
- package/dist/components/direction.mjs +14 -0
- package/dist/components/drawer.d.mts +47 -0
- package/dist/components/drawer.mjs +79 -0
- package/dist/components/dropdown-menu.d.mts +87 -0
- package/dist/components/dropdown-menu.mjs +131 -0
- package/dist/components/empty.d.mts +35 -0
- package/dist/components/empty.mjs +59 -0
- package/dist/components/field.d.mts +64 -0
- package/dist/components/field.mjs +110 -0
- package/dist/components/hover-card.d.mts +22 -0
- package/dist/components/hover-card.mjs +33 -0
- package/dist/components/input-group.d.mts +43 -0
- package/dist/components/input-group.mjs +79 -0
- package/dist/components/input-otp.d.mts +28 -0
- package/dist/components/input-otp.mjs +47 -0
- package/dist/components/input.d.mts +11 -0
- package/dist/components/input.mjs +14 -0
- package/dist/components/item.d.mts +62 -0
- package/dist/components/item.mjs +117 -0
- package/dist/components/kbd.d.mts +13 -0
- package/dist/components/kbd.mjs +19 -0
- package/dist/components/label.d.mts +11 -0
- package/dist/components/label.mjs +15 -0
- package/dist/components/menubar.d.mts +90 -0
- package/dist/components/menubar.mjs +135 -0
- package/dist/components/native-select.d.mts +21 -0
- package/dist/components/native-select.mjs +37 -0
- package/dist/components/navigation-menu.d.mts +46 -0
- package/dist/components/navigation-menu.mjs +80 -0
- package/dist/components/pagination.d.mts +45 -0
- package/dist/components/pagination.mjs +80 -0
- package/dist/components/popover.d.mts +34 -0
- package/dist/components/popover.mjs +56 -0
- package/dist/components/progress.d.mts +12 -0
- package/dist/components/progress.mjs +20 -0
- package/dist/components/radio-group.d.mts +15 -0
- package/dist/components/radio-group.mjs +27 -0
- package/dist/components/resizable.d.mts +20 -0
- package/dist/components/resizable.mjs +28 -0
- package/dist/components/scroll-area.d.mts +17 -0
- package/dist/components/scroll-area.mjs +37 -0
- package/dist/components/select.d.mts +53 -0
- package/dist/components/select.mjs +100 -0
- package/dist/components/separator.d.mts +13 -0
- package/dist/components/separator.mjs +17 -0
- package/dist/components/sheet.d.mts +42 -0
- package/dist/components/sheet.mjs +90 -0
- package/dist/components/sidebar.d.mts +167 -0
- package/dist/components/sidebar.mjs +374 -0
- package/dist/components/skeleton.d.mts +9 -0
- package/dist/components/skeleton.mjs +12 -0
- package/dist/components/slider.d.mts +15 -0
- package/dist/components/slider.mjs +36 -0
- package/dist/components/sonner.d.mts +9 -0
- package/dist/components/sonner.mjs +30 -0
- package/dist/components/spinner.d.mts +9 -0
- package/dist/components/spinner.mjs +14 -0
- package/dist/components/switch.d.mts +14 -0
- package/dist/components/switch.mjs +20 -0
- package/dist/components/table.d.mts +38 -0
- package/dist/components/table.mjs +67 -0
- package/dist/components/tabs.d.mts +30 -0
- package/dist/components/tabs.mjs +46 -0
- package/dist/components/textarea.d.mts +10 -0
- package/dist/components/textarea.mjs +13 -0
- package/dist/components/toggle-group.d.mts +28 -0
- package/dist/components/toggle-group.mjs +51 -0
- package/dist/components/toggle.d.mts +19 -0
- package/dist/components/toggle.mjs +37 -0
- package/dist/components/tooltip.d.mts +23 -0
- package/dist/components/tooltip.mjs +36 -0
- package/dist/exports/components.d.mts +61 -0
- package/dist/exports/components.mjs +61 -0
- package/dist/exports/hooks.d.mts +2 -0
- package/dist/exports/hooks.mjs +2 -0
- package/dist/exports/lib.d.mts +2 -0
- package/dist/exports/lib.mjs +2 -0
- package/dist/hooks/use-mobile.d.mts +4 -0
- package/dist/hooks/use-mobile.mjs +18 -0
- package/package.json +7 -7
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/utils.mjs";
|
|
3
|
+
import { Button } from "./button.mjs";
|
|
4
|
+
import { Separator as Separator$1 } from "./separator.mjs";
|
|
5
|
+
import { Tooltip as Tooltip$1, TooltipContent, TooltipTrigger } from "./tooltip.mjs";
|
|
6
|
+
import { Input } from "./input.mjs";
|
|
7
|
+
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "./sheet.mjs";
|
|
8
|
+
import { useIsMobile } from "../hooks/use-mobile.mjs";
|
|
9
|
+
import { Skeleton } from "./skeleton.mjs";
|
|
10
|
+
import { PanelLeftIcon } from "lucide-react";
|
|
11
|
+
import { Slot } from "radix-ui";
|
|
12
|
+
import * as React from "react";
|
|
13
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { cva } from "class-variance-authority";
|
|
15
|
+
//#region src/components/sidebar.tsx
|
|
16
|
+
const SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
17
|
+
const SIDEBAR_COOKIE_MAX_AGE = 3600 * 24 * 7;
|
|
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-2 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
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "div", {
|
|
231
|
+
"data-slot": "sidebar-group-label",
|
|
232
|
+
"data-sidebar": "group-label",
|
|
233
|
+
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),
|
|
234
|
+
...props
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
function SidebarGroupAction({ className, asChild = false, ...props }) {
|
|
238
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "button", {
|
|
239
|
+
"data-slot": "sidebar-group-action",
|
|
240
|
+
"data-sidebar": "group-action",
|
|
241
|
+
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),
|
|
242
|
+
...props
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
function SidebarGroupContent({ className, ...props }) {
|
|
246
|
+
return /* @__PURE__ */ jsx("div", {
|
|
247
|
+
"data-slot": "sidebar-group-content",
|
|
248
|
+
"data-sidebar": "group-content",
|
|
249
|
+
className: cn("w-full text-sm", className),
|
|
250
|
+
...props
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
function SidebarMenu({ className, ...props }) {
|
|
254
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
255
|
+
"data-slot": "sidebar-menu",
|
|
256
|
+
"data-sidebar": "menu",
|
|
257
|
+
className: cn("flex w-full min-w-0 flex-col gap-1", className),
|
|
258
|
+
...props
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
function SidebarMenuItem({ className, ...props }) {
|
|
262
|
+
return /* @__PURE__ */ jsx("li", {
|
|
263
|
+
"data-slot": "sidebar-menu-item",
|
|
264
|
+
"data-sidebar": "menu-item",
|
|
265
|
+
className: cn("group/menu-item relative", className),
|
|
266
|
+
...props
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
const sidebarMenuButtonVariants = cva("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm 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-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate", {
|
|
270
|
+
variants: {
|
|
271
|
+
variant: {
|
|
272
|
+
default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
273
|
+
outline: "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"
|
|
274
|
+
},
|
|
275
|
+
size: {
|
|
276
|
+
default: "h-8 text-sm",
|
|
277
|
+
sm: "h-7 text-xs",
|
|
278
|
+
lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!"
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
defaultVariants: {
|
|
282
|
+
variant: "default",
|
|
283
|
+
size: "default"
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
function SidebarMenuButton({ asChild = false, isActive = false, variant = "default", size = "default", tooltip, className, ...props }) {
|
|
287
|
+
const Comp = asChild ? Slot.Root : "button";
|
|
288
|
+
const { isMobile, state } = useSidebar();
|
|
289
|
+
const button = /* @__PURE__ */ jsx(Comp, {
|
|
290
|
+
"data-slot": "sidebar-menu-button",
|
|
291
|
+
"data-sidebar": "menu-button",
|
|
292
|
+
"data-size": size,
|
|
293
|
+
"data-active": isActive,
|
|
294
|
+
className: cn(sidebarMenuButtonVariants({
|
|
295
|
+
variant,
|
|
296
|
+
size
|
|
297
|
+
}), className),
|
|
298
|
+
...props
|
|
299
|
+
});
|
|
300
|
+
if (!tooltip) return button;
|
|
301
|
+
if (typeof tooltip === "string") tooltip = { children: tooltip };
|
|
302
|
+
return /* @__PURE__ */ jsxs(Tooltip$1, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
303
|
+
asChild: true,
|
|
304
|
+
children: button
|
|
305
|
+
}), /* @__PURE__ */ jsx(TooltipContent, {
|
|
306
|
+
side: "right",
|
|
307
|
+
align: "center",
|
|
308
|
+
hidden: state !== "collapsed" || isMobile,
|
|
309
|
+
...tooltip
|
|
310
|
+
})] });
|
|
311
|
+
}
|
|
312
|
+
function SidebarMenuAction({ className, asChild = false, showOnHover = false, ...props }) {
|
|
313
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "button", {
|
|
314
|
+
"data-slot": "sidebar-menu-action",
|
|
315
|
+
"data-sidebar": "menu-action",
|
|
316
|
+
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),
|
|
317
|
+
...props
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
function SidebarMenuBadge({ className, ...props }) {
|
|
321
|
+
return /* @__PURE__ */ jsx("div", {
|
|
322
|
+
"data-slot": "sidebar-menu-badge",
|
|
323
|
+
"data-sidebar": "menu-badge",
|
|
324
|
+
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),
|
|
325
|
+
...props
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
function SidebarMenuSkeleton({ className, showIcon = false, ...props }) {
|
|
329
|
+
const [width] = React.useState(() => {
|
|
330
|
+
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
331
|
+
});
|
|
332
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
333
|
+
"data-slot": "sidebar-menu-skeleton",
|
|
334
|
+
"data-sidebar": "menu-skeleton",
|
|
335
|
+
className: cn("flex h-8 items-center gap-2 rounded-md px-2", className),
|
|
336
|
+
...props,
|
|
337
|
+
children: [showIcon && /* @__PURE__ */ jsx(Skeleton, {
|
|
338
|
+
className: "size-4 rounded-md",
|
|
339
|
+
"data-sidebar": "menu-skeleton-icon"
|
|
340
|
+
}), /* @__PURE__ */ jsx(Skeleton, {
|
|
341
|
+
className: "h-4 max-w-(--skeleton-width) flex-1",
|
|
342
|
+
"data-sidebar": "menu-skeleton-text",
|
|
343
|
+
style: { "--skeleton-width": width }
|
|
344
|
+
})]
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
function SidebarMenuSub({ className, ...props }) {
|
|
348
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
349
|
+
"data-slot": "sidebar-menu-sub",
|
|
350
|
+
"data-sidebar": "menu-sub",
|
|
351
|
+
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),
|
|
352
|
+
...props
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
function SidebarMenuSubItem({ className, ...props }) {
|
|
356
|
+
return /* @__PURE__ */ jsx("li", {
|
|
357
|
+
"data-slot": "sidebar-menu-sub-item",
|
|
358
|
+
"data-sidebar": "menu-sub-item",
|
|
359
|
+
className: cn("group/menu-sub-item relative", className),
|
|
360
|
+
...props
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
function SidebarMenuSubButton({ asChild = false, size = "md", isActive = false, className, ...props }) {
|
|
364
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "a", {
|
|
365
|
+
"data-slot": "sidebar-menu-sub-button",
|
|
366
|
+
"data-sidebar": "menu-sub-button",
|
|
367
|
+
"data-size": size,
|
|
368
|
+
"data-active": isActive,
|
|
369
|
+
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),
|
|
370
|
+
...props
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
//#endregion
|
|
374
|
+
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
|
+
import { cn } from "../lib/utils.mjs";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/skeleton.tsx
|
|
4
|
+
function Skeleton({ className, ...props }) {
|
|
5
|
+
return /* @__PURE__ */ jsx("div", {
|
|
6
|
+
"data-slot": "skeleton",
|
|
7
|
+
className: cn("animate-pulse rounded-md bg-muted", className),
|
|
8
|
+
...props
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { Skeleton };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Slider } from "radix-ui";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/components/slider.d.ts
|
|
6
|
+
declare function Slider$1({
|
|
7
|
+
className,
|
|
8
|
+
defaultValue,
|
|
9
|
+
value,
|
|
10
|
+
min,
|
|
11
|
+
max,
|
|
12
|
+
...props
|
|
13
|
+
}: React.ComponentProps<typeof Slider.Root>): _$react_jsx_runtime0.JSX.Element;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { Slider$1 as Slider };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/utils.mjs";
|
|
3
|
+
import { Slider } from "radix-ui";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/slider.tsx
|
|
7
|
+
function Slider$1({ 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.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.Track, {
|
|
23
|
+
"data-slot": "slider-track",
|
|
24
|
+
className: "relative grow overflow-hidden rounded-full bg-muted data-horizontal:h-1.5 data-horizontal:w-full data-vertical:h-full data-vertical:w-1.5",
|
|
25
|
+
children: /* @__PURE__ */ jsx(Slider.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.Thumb, {
|
|
30
|
+
"data-slot": "slider-thumb",
|
|
31
|
+
className: "block size-4 shrink-0 rounded-full border border-primary bg-white shadow-sm ring-ring/50 transition-[color,box-shadow] select-none hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
|
|
32
|
+
}, index))]
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { Slider$1 as Slider };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
+
import { ToasterProps } from "sonner";
|
|
3
|
+
|
|
4
|
+
//#region src/components/sonner.d.ts
|
|
5
|
+
declare const Toaster$1: ({
|
|
6
|
+
...props
|
|
7
|
+
}: ToasterProps) => _$react_jsx_runtime0.JSX.Element;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { Toaster$1 as Toaster };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { CircleCheckIcon, InfoIcon, Loader2Icon, OctagonXIcon, TriangleAlertIcon } from "lucide-react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { useTheme } from "next-themes";
|
|
5
|
+
import { Toaster } from "sonner";
|
|
6
|
+
//#region src/components/sonner.tsx
|
|
7
|
+
const Toaster$1 = ({ ...props }) => {
|
|
8
|
+
const { theme = "system" } = useTheme();
|
|
9
|
+
return /* @__PURE__ */ jsx(Toaster, {
|
|
10
|
+
theme,
|
|
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
|
+
//#endregion
|
|
30
|
+
export { Toaster$1 as Toaster };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.mjs";
|
|
2
|
+
import { Loader2Icon } from "lucide-react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/spinner.tsx
|
|
5
|
+
function Spinner({ className, ...props }) {
|
|
6
|
+
return /* @__PURE__ */ jsx(Loader2Icon, {
|
|
7
|
+
role: "status",
|
|
8
|
+
"aria-label": "Loading",
|
|
9
|
+
className: cn("size-4 animate-spin", className),
|
|
10
|
+
...props
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Spinner };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Switch } from "radix-ui";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/components/switch.d.ts
|
|
6
|
+
declare function Switch$1({
|
|
7
|
+
className,
|
|
8
|
+
size,
|
|
9
|
+
...props
|
|
10
|
+
}: React.ComponentProps<typeof Switch.Root> & {
|
|
11
|
+
size?: 'sm' | 'default';
|
|
12
|
+
}): _$react_jsx_runtime0.JSX.Element;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Switch$1 as Switch };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/utils.mjs";
|
|
3
|
+
import { Switch } from "radix-ui";
|
|
4
|
+
import "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/switch.tsx
|
|
7
|
+
function Switch$1({ className, size = "default", ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(Switch.Root, {
|
|
9
|
+
"data-slot": "switch",
|
|
10
|
+
"data-size": size,
|
|
11
|
+
className: cn("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none 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),
|
|
12
|
+
...props,
|
|
13
|
+
children: /* @__PURE__ */ jsx(Switch.Thumb, {
|
|
14
|
+
"data-slot": "switch-thumb",
|
|
15
|
+
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"
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { Switch$1 as Switch };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/components/table.d.ts
|
|
5
|
+
declare function Table({
|
|
6
|
+
className,
|
|
7
|
+
...props
|
|
8
|
+
}: React.ComponentProps<'table'>): _$react_jsx_runtime0.JSX.Element;
|
|
9
|
+
declare function TableHeader({
|
|
10
|
+
className,
|
|
11
|
+
...props
|
|
12
|
+
}: React.ComponentProps<'thead'>): _$react_jsx_runtime0.JSX.Element;
|
|
13
|
+
declare function TableBody({
|
|
14
|
+
className,
|
|
15
|
+
...props
|
|
16
|
+
}: React.ComponentProps<'tbody'>): _$react_jsx_runtime0.JSX.Element;
|
|
17
|
+
declare function TableFooter({
|
|
18
|
+
className,
|
|
19
|
+
...props
|
|
20
|
+
}: React.ComponentProps<'tfoot'>): _$react_jsx_runtime0.JSX.Element;
|
|
21
|
+
declare function TableRow({
|
|
22
|
+
className,
|
|
23
|
+
...props
|
|
24
|
+
}: React.ComponentProps<'tr'>): _$react_jsx_runtime0.JSX.Element;
|
|
25
|
+
declare function TableHead({
|
|
26
|
+
className,
|
|
27
|
+
...props
|
|
28
|
+
}: React.ComponentProps<'th'>): _$react_jsx_runtime0.JSX.Element;
|
|
29
|
+
declare function TableCell({
|
|
30
|
+
className,
|
|
31
|
+
...props
|
|
32
|
+
}: React.ComponentProps<'td'>): _$react_jsx_runtime0.JSX.Element;
|
|
33
|
+
declare function TableCaption({
|
|
34
|
+
className,
|
|
35
|
+
...props
|
|
36
|
+
}: React.ComponentProps<'caption'>): _$react_jsx_runtime0.JSX.Element;
|
|
37
|
+
//#endregion
|
|
38
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/utils.mjs";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/table.tsx
|
|
6
|
+
function Table({ className, ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsx("div", {
|
|
8
|
+
"data-slot": "table-container",
|
|
9
|
+
className: "relative w-full overflow-x-auto",
|
|
10
|
+
children: /* @__PURE__ */ jsx("table", {
|
|
11
|
+
"data-slot": "table",
|
|
12
|
+
className: cn("w-full caption-bottom text-sm", className),
|
|
13
|
+
...props
|
|
14
|
+
})
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function TableHeader({ className, ...props }) {
|
|
18
|
+
return /* @__PURE__ */ jsx("thead", {
|
|
19
|
+
"data-slot": "table-header",
|
|
20
|
+
className: cn("[&_tr]:border-b", className),
|
|
21
|
+
...props
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function TableBody({ className, ...props }) {
|
|
25
|
+
return /* @__PURE__ */ jsx("tbody", {
|
|
26
|
+
"data-slot": "table-body",
|
|
27
|
+
className: cn("[&_tr:last-child]:border-0", className),
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function TableFooter({ className, ...props }) {
|
|
32
|
+
return /* @__PURE__ */ jsx("tfoot", {
|
|
33
|
+
"data-slot": "table-footer",
|
|
34
|
+
className: cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className),
|
|
35
|
+
...props
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function TableRow({ className, ...props }) {
|
|
39
|
+
return /* @__PURE__ */ jsx("tr", {
|
|
40
|
+
"data-slot": "table-row",
|
|
41
|
+
className: cn("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted", className),
|
|
42
|
+
...props
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function TableHead({ className, ...props }) {
|
|
46
|
+
return /* @__PURE__ */ jsx("th", {
|
|
47
|
+
"data-slot": "table-head",
|
|
48
|
+
className: cn("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0", className),
|
|
49
|
+
...props
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function TableCell({ className, ...props }) {
|
|
53
|
+
return /* @__PURE__ */ jsx("td", {
|
|
54
|
+
"data-slot": "table-cell",
|
|
55
|
+
className: cn("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0", className),
|
|
56
|
+
...props
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function TableCaption({ className, ...props }) {
|
|
60
|
+
return /* @__PURE__ */ jsx("caption", {
|
|
61
|
+
"data-slot": "table-caption",
|
|
62
|
+
className: cn("mt-4 text-sm text-muted-foreground", className),
|
|
63
|
+
...props
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
|