@minutemailer/kit 1.0.3 → 1.0.4
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/components/ui/alert.tsx.js +67 -0
- package/components/ui/alert.tsx.js.map +7 -0
- package/components/ui/avatar.tsx.js +54 -0
- package/components/ui/avatar.tsx.js.map +7 -0
- package/components/ui/button.tsx.js +51 -0
- package/components/ui/button.tsx.js.map +7 -0
- package/components/ui/checkbox.tsx.js +33 -0
- package/components/ui/checkbox.tsx.js.map +7 -0
- package/components/ui/dropdown-menu.tsx.js +244 -0
- package/components/ui/dropdown-menu.tsx.js.map +7 -0
- package/components/ui/input.tsx.js +22 -0
- package/components/ui/input.tsx.js.map +7 -0
- package/components/ui/label.tsx.js +24 -0
- package/components/ui/label.tsx.js.map +7 -0
- package/components/ui/separator.tsx.js +27 -0
- package/components/ui/separator.tsx.js.map +7 -0
- package/components/ui/sheet.tsx.js +128 -0
- package/components/ui/sheet.tsx.js.map +7 -0
- package/components/ui/sidebar.tsx.js +668 -0
- package/components/ui/sidebar.tsx.js.map +7 -0
- package/components/ui/skeleton.tsx.js +16 -0
- package/components/ui/skeleton.tsx.js.map +7 -0
- package/components/ui/sonner.tsx.js +23 -0
- package/components/ui/sonner.tsx.js.map +7 -0
- package/components/ui/tooltip.tsx.js +56 -0
- package/components/ui/tooltip.tsx.js.map +7 -0
- package/package.json +11 -12
|
@@ -0,0 +1,668 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
import { PanelLeftIcon } from "lucide-react";
|
|
7
|
+
import { useIsMobile } from "@/hooks/use-mobile";
|
|
8
|
+
import { cn } from "@/utils/utils";
|
|
9
|
+
import { Button } from "@/components/ui/button";
|
|
10
|
+
import { Input } from "@/components/ui/input";
|
|
11
|
+
import { Separator } from "@/components/ui/separator";
|
|
12
|
+
import {
|
|
13
|
+
Sheet,
|
|
14
|
+
SheetContent,
|
|
15
|
+
SheetDescription,
|
|
16
|
+
SheetHeader,
|
|
17
|
+
SheetTitle
|
|
18
|
+
} from "@/components/ui/sheet";
|
|
19
|
+
import { Skeleton } from "@/components/ui/skeleton";
|
|
20
|
+
import {
|
|
21
|
+
Tooltip,
|
|
22
|
+
TooltipContent,
|
|
23
|
+
TooltipProvider,
|
|
24
|
+
TooltipTrigger
|
|
25
|
+
} from "@/components/ui/tooltip";
|
|
26
|
+
const SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
27
|
+
const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
28
|
+
const SIDEBAR_WIDTH = "16rem";
|
|
29
|
+
const SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
30
|
+
const SIDEBAR_WIDTH_ICON = "3rem";
|
|
31
|
+
const SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
32
|
+
const SidebarContext = React.createContext(null);
|
|
33
|
+
function useSidebar() {
|
|
34
|
+
const context = React.useContext(SidebarContext);
|
|
35
|
+
if (!context) {
|
|
36
|
+
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
37
|
+
}
|
|
38
|
+
return context;
|
|
39
|
+
}
|
|
40
|
+
function SidebarProvider({
|
|
41
|
+
defaultOpen = true,
|
|
42
|
+
open: openProp,
|
|
43
|
+
onOpenChange: setOpenProp,
|
|
44
|
+
className,
|
|
45
|
+
style,
|
|
46
|
+
children,
|
|
47
|
+
...props
|
|
48
|
+
}) {
|
|
49
|
+
const isMobile = useIsMobile();
|
|
50
|
+
const [openMobile, setOpenMobile] = React.useState(false);
|
|
51
|
+
const [_open, _setOpen] = React.useState(defaultOpen);
|
|
52
|
+
const open = openProp ?? _open;
|
|
53
|
+
const setOpen = React.useCallback(
|
|
54
|
+
(value) => {
|
|
55
|
+
const openState = typeof value === "function" ? value(open) : value;
|
|
56
|
+
if (setOpenProp) {
|
|
57
|
+
setOpenProp(openState);
|
|
58
|
+
} else {
|
|
59
|
+
_setOpen(openState);
|
|
60
|
+
}
|
|
61
|
+
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
|
|
62
|
+
},
|
|
63
|
+
[setOpenProp, open]
|
|
64
|
+
);
|
|
65
|
+
const toggleSidebar = React.useCallback(() => {
|
|
66
|
+
return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
|
|
67
|
+
}, [isMobile, setOpen, setOpenMobile]);
|
|
68
|
+
React.useEffect(() => {
|
|
69
|
+
const handleKeyDown = (event) => {
|
|
70
|
+
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
71
|
+
event.preventDefault();
|
|
72
|
+
toggleSidebar();
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
76
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
77
|
+
}, [toggleSidebar]);
|
|
78
|
+
const state = open ? "expanded" : "collapsed";
|
|
79
|
+
const contextValue = React.useMemo(
|
|
80
|
+
() => ({
|
|
81
|
+
state,
|
|
82
|
+
open,
|
|
83
|
+
setOpen,
|
|
84
|
+
isMobile,
|
|
85
|
+
openMobile,
|
|
86
|
+
setOpenMobile,
|
|
87
|
+
toggleSidebar
|
|
88
|
+
}),
|
|
89
|
+
[
|
|
90
|
+
state,
|
|
91
|
+
open,
|
|
92
|
+
setOpen,
|
|
93
|
+
isMobile,
|
|
94
|
+
openMobile,
|
|
95
|
+
setOpenMobile,
|
|
96
|
+
toggleSidebar
|
|
97
|
+
]
|
|
98
|
+
);
|
|
99
|
+
return /* @__PURE__ */ jsx(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsx(
|
|
100
|
+
"div",
|
|
101
|
+
{
|
|
102
|
+
"data-slot": "sidebar-wrapper",
|
|
103
|
+
style: {
|
|
104
|
+
"--sidebar-width": SIDEBAR_WIDTH,
|
|
105
|
+
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
106
|
+
...style
|
|
107
|
+
},
|
|
108
|
+
className: cn(
|
|
109
|
+
"group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",
|
|
110
|
+
className
|
|
111
|
+
),
|
|
112
|
+
...props,
|
|
113
|
+
children
|
|
114
|
+
}
|
|
115
|
+
) }) });
|
|
116
|
+
}
|
|
117
|
+
function Sidebar({
|
|
118
|
+
side = "left",
|
|
119
|
+
variant = "sidebar",
|
|
120
|
+
collapsible = "offcanvas",
|
|
121
|
+
className,
|
|
122
|
+
children,
|
|
123
|
+
...props
|
|
124
|
+
}) {
|
|
125
|
+
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
126
|
+
if (collapsible === "none") {
|
|
127
|
+
return /* @__PURE__ */ jsx(
|
|
128
|
+
"div",
|
|
129
|
+
{
|
|
130
|
+
"data-slot": "sidebar",
|
|
131
|
+
className: cn(
|
|
132
|
+
"bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",
|
|
133
|
+
className
|
|
134
|
+
),
|
|
135
|
+
...props,
|
|
136
|
+
children
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
if (isMobile) {
|
|
141
|
+
return /* @__PURE__ */ jsx(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ jsxs(
|
|
142
|
+
SheetContent,
|
|
143
|
+
{
|
|
144
|
+
"data-sidebar": "sidebar",
|
|
145
|
+
"data-slot": "sidebar",
|
|
146
|
+
"data-mobile": "true",
|
|
147
|
+
className: "bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",
|
|
148
|
+
style: {
|
|
149
|
+
"--sidebar-width": SIDEBAR_WIDTH_MOBILE
|
|
150
|
+
},
|
|
151
|
+
side,
|
|
152
|
+
children: [
|
|
153
|
+
/* @__PURE__ */ jsxs(SheetHeader, { className: "sr-only", children: [
|
|
154
|
+
/* @__PURE__ */ jsx(SheetTitle, { children: "Sidebar" }),
|
|
155
|
+
/* @__PURE__ */ jsx(SheetDescription, { children: "Displays the mobile sidebar." })
|
|
156
|
+
] }),
|
|
157
|
+
/* @__PURE__ */ jsx("div", { className: "flex h-full w-full flex-col", children })
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
) });
|
|
161
|
+
}
|
|
162
|
+
return /* @__PURE__ */ jsxs(
|
|
163
|
+
"div",
|
|
164
|
+
{
|
|
165
|
+
className: "group peer text-sidebar-foreground hidden md:block",
|
|
166
|
+
"data-state": state,
|
|
167
|
+
"data-collapsible": state === "collapsed" ? collapsible : "",
|
|
168
|
+
"data-variant": variant,
|
|
169
|
+
"data-side": side,
|
|
170
|
+
"data-slot": "sidebar",
|
|
171
|
+
children: [
|
|
172
|
+
/* @__PURE__ */ jsx(
|
|
173
|
+
"div",
|
|
174
|
+
{
|
|
175
|
+
"data-slot": "sidebar-gap",
|
|
176
|
+
className: cn(
|
|
177
|
+
"relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear",
|
|
178
|
+
"group-data-[collapsible=offcanvas]:w-0",
|
|
179
|
+
"group-data-[side=right]:rotate-180",
|
|
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)"
|
|
181
|
+
)
|
|
182
|
+
}
|
|
183
|
+
),
|
|
184
|
+
/* @__PURE__ */ jsx(
|
|
185
|
+
"div",
|
|
186
|
+
{
|
|
187
|
+
"data-slot": "sidebar-container",
|
|
188
|
+
className: cn(
|
|
189
|
+
"fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",
|
|
190
|
+
side === "left" ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]" : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
|
|
191
|
+
// Adjust the padding for floating and inset variants.
|
|
192
|
+
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",
|
|
193
|
+
className
|
|
194
|
+
),
|
|
195
|
+
...props,
|
|
196
|
+
children: /* @__PURE__ */ jsx(
|
|
197
|
+
"div",
|
|
198
|
+
{
|
|
199
|
+
"data-sidebar": "sidebar",
|
|
200
|
+
"data-slot": "sidebar-inner",
|
|
201
|
+
className: "bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",
|
|
202
|
+
children
|
|
203
|
+
}
|
|
204
|
+
)
|
|
205
|
+
}
|
|
206
|
+
)
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
function SidebarTrigger({
|
|
212
|
+
className,
|
|
213
|
+
onClick,
|
|
214
|
+
...props
|
|
215
|
+
}) {
|
|
216
|
+
const { toggleSidebar } = useSidebar();
|
|
217
|
+
return /* @__PURE__ */ jsxs(
|
|
218
|
+
Button,
|
|
219
|
+
{
|
|
220
|
+
"data-sidebar": "trigger",
|
|
221
|
+
"data-slot": "sidebar-trigger",
|
|
222
|
+
variant: "ghost",
|
|
223
|
+
size: "icon",
|
|
224
|
+
className: cn("size-7", className),
|
|
225
|
+
onClick: (event) => {
|
|
226
|
+
onClick?.(event);
|
|
227
|
+
toggleSidebar();
|
|
228
|
+
},
|
|
229
|
+
...props,
|
|
230
|
+
children: [
|
|
231
|
+
/* @__PURE__ */ jsx(PanelLeftIcon, {}),
|
|
232
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Toggle Sidebar" })
|
|
233
|
+
]
|
|
234
|
+
}
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
function SidebarRail({ className, ...props }) {
|
|
238
|
+
const { toggleSidebar } = useSidebar();
|
|
239
|
+
return /* @__PURE__ */ jsx(
|
|
240
|
+
"button",
|
|
241
|
+
{
|
|
242
|
+
"data-sidebar": "rail",
|
|
243
|
+
"data-slot": "sidebar-rail",
|
|
244
|
+
"aria-label": "Toggle Sidebar",
|
|
245
|
+
tabIndex: -1,
|
|
246
|
+
onClick: toggleSidebar,
|
|
247
|
+
title: "Toggle Sidebar",
|
|
248
|
+
className: cn(
|
|
249
|
+
"hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex",
|
|
250
|
+
"in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize",
|
|
251
|
+
"[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
|
|
252
|
+
"hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full",
|
|
253
|
+
"[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
|
|
254
|
+
"[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
|
|
255
|
+
className
|
|
256
|
+
),
|
|
257
|
+
...props
|
|
258
|
+
}
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
function SidebarInset({ className, ...props }) {
|
|
262
|
+
return /* @__PURE__ */ jsx(
|
|
263
|
+
"main",
|
|
264
|
+
{
|
|
265
|
+
"data-slot": "sidebar-inset",
|
|
266
|
+
className: cn(
|
|
267
|
+
"bg-background relative flex w-full flex-1 flex-col",
|
|
268
|
+
"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",
|
|
269
|
+
className
|
|
270
|
+
),
|
|
271
|
+
...props
|
|
272
|
+
}
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
function SidebarInput({
|
|
276
|
+
className,
|
|
277
|
+
...props
|
|
278
|
+
}) {
|
|
279
|
+
return /* @__PURE__ */ jsx(
|
|
280
|
+
Input,
|
|
281
|
+
{
|
|
282
|
+
"data-slot": "sidebar-input",
|
|
283
|
+
"data-sidebar": "input",
|
|
284
|
+
className: cn("bg-background h-8 w-full shadow-none", className),
|
|
285
|
+
...props
|
|
286
|
+
}
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
function SidebarHeader({ className, ...props }) {
|
|
290
|
+
return /* @__PURE__ */ jsx(
|
|
291
|
+
"div",
|
|
292
|
+
{
|
|
293
|
+
"data-slot": "sidebar-header",
|
|
294
|
+
"data-sidebar": "header",
|
|
295
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
296
|
+
...props
|
|
297
|
+
}
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
function SidebarFooter({ className, ...props }) {
|
|
301
|
+
return /* @__PURE__ */ jsx(
|
|
302
|
+
"div",
|
|
303
|
+
{
|
|
304
|
+
"data-slot": "sidebar-footer",
|
|
305
|
+
"data-sidebar": "footer",
|
|
306
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
307
|
+
...props
|
|
308
|
+
}
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
function SidebarSeparator({
|
|
312
|
+
className,
|
|
313
|
+
...props
|
|
314
|
+
}) {
|
|
315
|
+
return /* @__PURE__ */ jsx(
|
|
316
|
+
Separator,
|
|
317
|
+
{
|
|
318
|
+
"data-slot": "sidebar-separator",
|
|
319
|
+
"data-sidebar": "separator",
|
|
320
|
+
className: cn("bg-sidebar-border mx-2 w-auto", className),
|
|
321
|
+
...props
|
|
322
|
+
}
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
function SidebarContent({ className, ...props }) {
|
|
326
|
+
return /* @__PURE__ */ jsx(
|
|
327
|
+
"div",
|
|
328
|
+
{
|
|
329
|
+
"data-slot": "sidebar-content",
|
|
330
|
+
"data-sidebar": "content",
|
|
331
|
+
className: cn(
|
|
332
|
+
"flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
|
|
333
|
+
className
|
|
334
|
+
),
|
|
335
|
+
...props
|
|
336
|
+
}
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
function SidebarGroup({ className, ...props }) {
|
|
340
|
+
return /* @__PURE__ */ jsx(
|
|
341
|
+
"div",
|
|
342
|
+
{
|
|
343
|
+
"data-slot": "sidebar-group",
|
|
344
|
+
"data-sidebar": "group",
|
|
345
|
+
className: cn(
|
|
346
|
+
"relative flex w-full min-w-0 flex-col p-2",
|
|
347
|
+
className
|
|
348
|
+
),
|
|
349
|
+
...props
|
|
350
|
+
}
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
function SidebarGroupLabel({
|
|
354
|
+
className,
|
|
355
|
+
asChild = false,
|
|
356
|
+
...props
|
|
357
|
+
}) {
|
|
358
|
+
const Comp = asChild ? Slot : "div";
|
|
359
|
+
return /* @__PURE__ */ jsx(
|
|
360
|
+
Comp,
|
|
361
|
+
{
|
|
362
|
+
"data-slot": "sidebar-group-label",
|
|
363
|
+
"data-sidebar": "group-label",
|
|
364
|
+
className: cn(
|
|
365
|
+
"text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
366
|
+
"group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
|
|
367
|
+
className
|
|
368
|
+
),
|
|
369
|
+
...props
|
|
370
|
+
}
|
|
371
|
+
);
|
|
372
|
+
}
|
|
373
|
+
function SidebarGroupAction({
|
|
374
|
+
className,
|
|
375
|
+
asChild = false,
|
|
376
|
+
...props
|
|
377
|
+
}) {
|
|
378
|
+
const Comp = asChild ? Slot : "button";
|
|
379
|
+
return /* @__PURE__ */ jsx(
|
|
380
|
+
Comp,
|
|
381
|
+
{
|
|
382
|
+
"data-slot": "sidebar-group-action",
|
|
383
|
+
"data-sidebar": "group-action",
|
|
384
|
+
className: cn(
|
|
385
|
+
"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
386
|
+
// Increases the hit area of the button on mobile.
|
|
387
|
+
"after:absolute after:-inset-2 md:after:hidden",
|
|
388
|
+
"group-data-[collapsible=icon]:hidden",
|
|
389
|
+
className
|
|
390
|
+
),
|
|
391
|
+
...props
|
|
392
|
+
}
|
|
393
|
+
);
|
|
394
|
+
}
|
|
395
|
+
function SidebarGroupContent({
|
|
396
|
+
className,
|
|
397
|
+
...props
|
|
398
|
+
}) {
|
|
399
|
+
return /* @__PURE__ */ jsx(
|
|
400
|
+
"div",
|
|
401
|
+
{
|
|
402
|
+
"data-slot": "sidebar-group-content",
|
|
403
|
+
"data-sidebar": "group-content",
|
|
404
|
+
className: cn("w-full text-sm", className),
|
|
405
|
+
...props
|
|
406
|
+
}
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
function SidebarMenu({ className, ...props }) {
|
|
410
|
+
return /* @__PURE__ */ jsx(
|
|
411
|
+
"ul",
|
|
412
|
+
{
|
|
413
|
+
"data-slot": "sidebar-menu",
|
|
414
|
+
"data-sidebar": "menu",
|
|
415
|
+
className: cn("flex w-full min-w-0 flex-col gap-1", className),
|
|
416
|
+
...props
|
|
417
|
+
}
|
|
418
|
+
);
|
|
419
|
+
}
|
|
420
|
+
function SidebarMenuItem({ className, ...props }) {
|
|
421
|
+
return /* @__PURE__ */ jsx(
|
|
422
|
+
"li",
|
|
423
|
+
{
|
|
424
|
+
"data-slot": "sidebar-menu-item",
|
|
425
|
+
"data-sidebar": "menu-item",
|
|
426
|
+
className: cn("group/menu-item relative", className),
|
|
427
|
+
...props
|
|
428
|
+
}
|
|
429
|
+
);
|
|
430
|
+
}
|
|
431
|
+
const sidebarMenuButtonVariants = cva(
|
|
432
|
+
"peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] 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 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
|
|
433
|
+
{
|
|
434
|
+
variants: {
|
|
435
|
+
variant: {
|
|
436
|
+
default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
437
|
+
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))]"
|
|
438
|
+
},
|
|
439
|
+
size: {
|
|
440
|
+
default: "h-8 text-sm",
|
|
441
|
+
sm: "h-7 text-xs",
|
|
442
|
+
lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!"
|
|
443
|
+
}
|
|
444
|
+
},
|
|
445
|
+
defaultVariants: {
|
|
446
|
+
variant: "default",
|
|
447
|
+
size: "default"
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
);
|
|
451
|
+
function SidebarMenuButton({
|
|
452
|
+
asChild = false,
|
|
453
|
+
isActive = false,
|
|
454
|
+
variant = "default",
|
|
455
|
+
size = "default",
|
|
456
|
+
tooltip,
|
|
457
|
+
className,
|
|
458
|
+
...props
|
|
459
|
+
}) {
|
|
460
|
+
const Comp = asChild ? Slot : "button";
|
|
461
|
+
const { isMobile, state } = useSidebar();
|
|
462
|
+
const button = /* @__PURE__ */ jsx(
|
|
463
|
+
Comp,
|
|
464
|
+
{
|
|
465
|
+
"data-slot": "sidebar-menu-button",
|
|
466
|
+
"data-sidebar": "menu-button",
|
|
467
|
+
"data-size": size,
|
|
468
|
+
"data-active": isActive,
|
|
469
|
+
className: cn(
|
|
470
|
+
sidebarMenuButtonVariants({ variant, size }),
|
|
471
|
+
className
|
|
472
|
+
),
|
|
473
|
+
...props
|
|
474
|
+
}
|
|
475
|
+
);
|
|
476
|
+
if (!tooltip) {
|
|
477
|
+
return button;
|
|
478
|
+
}
|
|
479
|
+
if (typeof tooltip === "string") {
|
|
480
|
+
tooltip = {
|
|
481
|
+
children: tooltip
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
485
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: button }),
|
|
486
|
+
/* @__PURE__ */ jsx(
|
|
487
|
+
TooltipContent,
|
|
488
|
+
{
|
|
489
|
+
side: "right",
|
|
490
|
+
align: "center",
|
|
491
|
+
hidden: state !== "collapsed" || isMobile,
|
|
492
|
+
...tooltip
|
|
493
|
+
}
|
|
494
|
+
)
|
|
495
|
+
] });
|
|
496
|
+
}
|
|
497
|
+
function SidebarMenuAction({
|
|
498
|
+
className,
|
|
499
|
+
asChild = false,
|
|
500
|
+
showOnHover = false,
|
|
501
|
+
...props
|
|
502
|
+
}) {
|
|
503
|
+
const Comp = asChild ? Slot : "button";
|
|
504
|
+
return /* @__PURE__ */ jsx(
|
|
505
|
+
Comp,
|
|
506
|
+
{
|
|
507
|
+
"data-slot": "sidebar-menu-action",
|
|
508
|
+
"data-sidebar": "menu-action",
|
|
509
|
+
className: cn(
|
|
510
|
+
"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
511
|
+
// Increases the hit area of the button on mobile.
|
|
512
|
+
"after:absolute after:-inset-2 md:after:hidden",
|
|
513
|
+
"peer-data-[size=sm]/menu-button:top-1",
|
|
514
|
+
"peer-data-[size=default]/menu-button:top-1.5",
|
|
515
|
+
"peer-data-[size=lg]/menu-button:top-2.5",
|
|
516
|
+
"group-data-[collapsible=icon]:hidden",
|
|
517
|
+
showOnHover && "peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0",
|
|
518
|
+
className
|
|
519
|
+
),
|
|
520
|
+
...props
|
|
521
|
+
}
|
|
522
|
+
);
|
|
523
|
+
}
|
|
524
|
+
function SidebarMenuBadge({
|
|
525
|
+
className,
|
|
526
|
+
...props
|
|
527
|
+
}) {
|
|
528
|
+
return /* @__PURE__ */ jsx(
|
|
529
|
+
"div",
|
|
530
|
+
{
|
|
531
|
+
"data-slot": "sidebar-menu-badge",
|
|
532
|
+
"data-sidebar": "menu-badge",
|
|
533
|
+
className: cn(
|
|
534
|
+
"text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none",
|
|
535
|
+
"peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
|
|
536
|
+
"peer-data-[size=sm]/menu-button:top-1",
|
|
537
|
+
"peer-data-[size=default]/menu-button:top-1.5",
|
|
538
|
+
"peer-data-[size=lg]/menu-button:top-2.5",
|
|
539
|
+
"group-data-[collapsible=icon]:hidden",
|
|
540
|
+
className
|
|
541
|
+
),
|
|
542
|
+
...props
|
|
543
|
+
}
|
|
544
|
+
);
|
|
545
|
+
}
|
|
546
|
+
function SidebarMenuSkeleton({
|
|
547
|
+
className,
|
|
548
|
+
showIcon = false,
|
|
549
|
+
...props
|
|
550
|
+
}) {
|
|
551
|
+
const width = React.useMemo(() => {
|
|
552
|
+
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
553
|
+
}, []);
|
|
554
|
+
return /* @__PURE__ */ jsxs(
|
|
555
|
+
"div",
|
|
556
|
+
{
|
|
557
|
+
"data-slot": "sidebar-menu-skeleton",
|
|
558
|
+
"data-sidebar": "menu-skeleton",
|
|
559
|
+
className: cn(
|
|
560
|
+
"flex h-8 items-center gap-2 rounded-md px-2",
|
|
561
|
+
className
|
|
562
|
+
),
|
|
563
|
+
...props,
|
|
564
|
+
children: [
|
|
565
|
+
showIcon && /* @__PURE__ */ jsx(
|
|
566
|
+
Skeleton,
|
|
567
|
+
{
|
|
568
|
+
className: "size-4 rounded-md",
|
|
569
|
+
"data-sidebar": "menu-skeleton-icon"
|
|
570
|
+
}
|
|
571
|
+
),
|
|
572
|
+
/* @__PURE__ */ jsx(
|
|
573
|
+
Skeleton,
|
|
574
|
+
{
|
|
575
|
+
className: "h-4 max-w-(--skeleton-width) flex-1",
|
|
576
|
+
"data-sidebar": "menu-skeleton-text",
|
|
577
|
+
style: {
|
|
578
|
+
"--skeleton-width": width
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
)
|
|
582
|
+
]
|
|
583
|
+
}
|
|
584
|
+
);
|
|
585
|
+
}
|
|
586
|
+
function SidebarMenuSub({ className, ...props }) {
|
|
587
|
+
return /* @__PURE__ */ jsx(
|
|
588
|
+
"ul",
|
|
589
|
+
{
|
|
590
|
+
"data-slot": "sidebar-menu-sub",
|
|
591
|
+
"data-sidebar": "menu-sub",
|
|
592
|
+
className: cn(
|
|
593
|
+
"border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5",
|
|
594
|
+
"group-data-[collapsible=icon]:hidden",
|
|
595
|
+
className
|
|
596
|
+
),
|
|
597
|
+
...props
|
|
598
|
+
}
|
|
599
|
+
);
|
|
600
|
+
}
|
|
601
|
+
function SidebarMenuSubItem({
|
|
602
|
+
className,
|
|
603
|
+
...props
|
|
604
|
+
}) {
|
|
605
|
+
return /* @__PURE__ */ jsx(
|
|
606
|
+
"li",
|
|
607
|
+
{
|
|
608
|
+
"data-slot": "sidebar-menu-sub-item",
|
|
609
|
+
"data-sidebar": "menu-sub-item",
|
|
610
|
+
className: cn("group/menu-sub-item relative", className),
|
|
611
|
+
...props
|
|
612
|
+
}
|
|
613
|
+
);
|
|
614
|
+
}
|
|
615
|
+
function SidebarMenuSubButton({
|
|
616
|
+
asChild = false,
|
|
617
|
+
size = "md",
|
|
618
|
+
isActive = false,
|
|
619
|
+
className,
|
|
620
|
+
...props
|
|
621
|
+
}) {
|
|
622
|
+
const Comp = asChild ? Slot : "a";
|
|
623
|
+
return /* @__PURE__ */ jsx(
|
|
624
|
+
Comp,
|
|
625
|
+
{
|
|
626
|
+
"data-slot": "sidebar-menu-sub-button",
|
|
627
|
+
"data-sidebar": "menu-sub-button",
|
|
628
|
+
"data-size": size,
|
|
629
|
+
"data-active": isActive,
|
|
630
|
+
className: cn(
|
|
631
|
+
"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
|
|
632
|
+
"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
|
|
633
|
+
size === "sm" && "text-xs",
|
|
634
|
+
size === "md" && "text-sm",
|
|
635
|
+
"group-data-[collapsible=icon]:hidden",
|
|
636
|
+
className
|
|
637
|
+
),
|
|
638
|
+
...props
|
|
639
|
+
}
|
|
640
|
+
);
|
|
641
|
+
}
|
|
642
|
+
export {
|
|
643
|
+
Sidebar,
|
|
644
|
+
SidebarContent,
|
|
645
|
+
SidebarFooter,
|
|
646
|
+
SidebarGroup,
|
|
647
|
+
SidebarGroupAction,
|
|
648
|
+
SidebarGroupContent,
|
|
649
|
+
SidebarGroupLabel,
|
|
650
|
+
SidebarHeader,
|
|
651
|
+
SidebarInput,
|
|
652
|
+
SidebarInset,
|
|
653
|
+
SidebarMenu,
|
|
654
|
+
SidebarMenuAction,
|
|
655
|
+
SidebarMenuBadge,
|
|
656
|
+
SidebarMenuButton,
|
|
657
|
+
SidebarMenuItem,
|
|
658
|
+
SidebarMenuSkeleton,
|
|
659
|
+
SidebarMenuSub,
|
|
660
|
+
SidebarMenuSubButton,
|
|
661
|
+
SidebarMenuSubItem,
|
|
662
|
+
SidebarProvider,
|
|
663
|
+
SidebarRail,
|
|
664
|
+
SidebarSeparator,
|
|
665
|
+
SidebarTrigger,
|
|
666
|
+
useSidebar
|
|
667
|
+
};
|
|
668
|
+
//# sourceMappingURL=sidebar.tsx.js.map
|