@mesob/ui 0.0.2
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.ts +10 -0
- package/dist/components/accordion.js +74 -0
- package/dist/components/accordion.js.map +1 -0
- package/dist/components/alert-dialog.d.ts +17 -0
- package/dist/components/alert-dialog.js +187 -0
- package/dist/components/alert-dialog.js.map +1 -0
- package/dist/components/alert.d.ts +13 -0
- package/dist/components/alert.js +74 -0
- package/dist/components/alert.js.map +1 -0
- package/dist/components/animated-tabs.d.ts +26 -0
- package/dist/components/animated-tabs.js +290 -0
- package/dist/components/animated-tabs.js.map +1 -0
- package/dist/components/aspect-ratio.d.ts +6 -0
- package/dist/components/aspect-ratio.js +14 -0
- package/dist/components/aspect-ratio.js.map +1 -0
- package/dist/components/avatar.d.ts +9 -0
- package/dist/components/avatar.js +63 -0
- package/dist/components/avatar.js.map +1 -0
- package/dist/components/badge.d.ts +13 -0
- package/dist/components/badge.js +48 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/breadcrumb.d.ts +14 -0
- package/dist/components/breadcrumb.js +110 -0
- package/dist/components/breadcrumb.js.map +1 -0
- package/dist/components/button-group.d.ts +17 -0
- package/dist/components/button-group.js +106 -0
- package/dist/components/button-group.js.map +1 -0
- package/dist/components/button.d.ts +14 -0
- package/dist/components/button.js +60 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/calendar.d.ts +13 -0
- package/dist/components/calendar.js +254 -0
- package/dist/components/calendar.js.map +1 -0
- package/dist/components/card.d.ts +12 -0
- package/dist/components/card.js +98 -0
- package/dist/components/card.js.map +1 -0
- package/dist/components/carousel.d.ts +24 -0
- package/dist/components/carousel.js +260 -0
- package/dist/components/carousel.js.map +1 -0
- package/dist/components/chart.d.ts +43 -0
- package/dist/components/chart.js +261 -0
- package/dist/components/chart.js.map +1 -0
- package/dist/components/checkbox.d.ts +7 -0
- package/dist/components/checkbox.js +41 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/collapsible.d.ts +8 -0
- package/dist/components/collapsible.js +38 -0
- package/dist/components/collapsible.js.map +1 -0
- package/dist/components/command.d.ts +22 -0
- package/dist/components/command.js +281 -0
- package/dist/components/command.js.map +1 -0
- package/dist/components/context-menu.d.ts +28 -0
- package/dist/components/context-menu.js +233 -0
- package/dist/components/context-menu.js.map +1 -0
- package/dist/components/data-table/index.d.ts +46 -0
- package/dist/components/data-table/index.js +639 -0
- package/dist/components/data-table/index.js.map +1 -0
- package/dist/components/dialog.d.ts +18 -0
- package/dist/components/dialog.js +146 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/drawer.d.ts +16 -0
- package/dist/components/drawer.js +138 -0
- package/dist/components/drawer.js.map +1 -0
- package/dist/components/dropdown-menu.d.ts +28 -0
- package/dist/components/dropdown-menu.js +241 -0
- package/dist/components/dropdown-menu.js.map +1 -0
- package/dist/components/empty.d.ts +15 -0
- package/dist/components/empty.js +110 -0
- package/dist/components/empty.js.map +1 -0
- package/dist/components/entity/index.d.ts +160 -0
- package/dist/components/entity/index.js +1671 -0
- package/dist/components/entity/index.js.map +1 -0
- package/dist/components/field.d.ts +30 -0
- package/dist/components/field.js +279 -0
- package/dist/components/field.js.map +1 -0
- package/dist/components/form.d.ts +28 -0
- package/dist/components/form.js +150 -0
- package/dist/components/form.js.map +1 -0
- package/dist/components/hover-card.d.ts +9 -0
- package/dist/components/hover-card.js +48 -0
- package/dist/components/hover-card.js.map +1 -0
- package/dist/components/input-group.d.ts +20 -0
- package/dist/components/input-group.js +257 -0
- package/dist/components/input-group.js.map +1 -0
- package/dist/components/input-otp.d.ts +14 -0
- package/dist/components/input-otp.js +76 -0
- package/dist/components/input-otp.js.map +1 -0
- package/dist/components/input.d.ts +6 -0
- package/dist/components/input.js +29 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/item.d.ts +28 -0
- package/dist/components/item.js +220 -0
- package/dist/components/item.js.map +1 -0
- package/dist/components/jiret-logo.d.ts +13 -0
- package/dist/components/jiret-logo.js +80 -0
- package/dist/components/jiret-logo.js.map +1 -0
- package/dist/components/kbd.d.ts +6 -0
- package/dist/components/kbd.js +39 -0
- package/dist/components/kbd.js.map +1 -0
- package/dist/components/label.d.ts +7 -0
- package/dist/components/label.js +32 -0
- package/dist/components/label.js.map +1 -0
- package/dist/components/menubar.d.ts +29 -0
- package/dist/components/menubar.js +261 -0
- package/dist/components/menubar.js.map +1 -0
- package/dist/components/navigation-menu.d.ts +18 -0
- package/dist/components/navigation-menu.js +178 -0
- package/dist/components/navigation-menu.js.map +1 -0
- package/dist/components/pagination.d.ts +18 -0
- package/dist/components/pagination.js +160 -0
- package/dist/components/pagination.js.map +1 -0
- package/dist/components/popover.d.ts +10 -0
- package/dist/components/popover.js +54 -0
- package/dist/components/popover.js.map +1 -0
- package/dist/components/powered-by.d.ts +5 -0
- package/dist/components/powered-by.js +98 -0
- package/dist/components/powered-by.js.map +1 -0
- package/dist/components/progress.d.ts +7 -0
- package/dist/components/progress.js +41 -0
- package/dist/components/progress.js.map +1 -0
- package/dist/components/radio-group.d.ts +8 -0
- package/dist/components/radio-group.js +55 -0
- package/dist/components/radio-group.js.map +1 -0
- package/dist/components/resizable.d.ts +11 -0
- package/dist/components/resizable.js +58 -0
- package/dist/components/resizable.js.map +1 -0
- package/dist/components/scroll-area.d.ts +8 -0
- package/dist/components/scroll-area.js +70 -0
- package/dist/components/scroll-area.js.map +1 -0
- package/dist/components/section/index.d.ts +14 -0
- package/dist/components/section/index.js +139 -0
- package/dist/components/section/index.js.map +1 -0
- package/dist/components/select.d.ts +18 -0
- package/dist/components/select.js +181 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/separator.d.ts +7 -0
- package/dist/components/separator.js +36 -0
- package/dist/components/separator.js.map +1 -0
- package/dist/components/sheet.d.ts +16 -0
- package/dist/components/sheet.js +136 -0
- package/dist/components/sheet.js.map +1 -0
- package/dist/components/sidebar.d.ts +75 -0
- package/dist/components/sidebar.js +909 -0
- package/dist/components/sidebar.js.map +1 -0
- package/dist/components/skeleton.d.ts +5 -0
- package/dist/components/skeleton.js +23 -0
- package/dist/components/skeleton.js.map +1 -0
- package/dist/components/slider.d.ts +7 -0
- package/dist/components/slider.js +76 -0
- package/dist/components/slider.js.map +1 -0
- package/dist/components/sonner.d.ts +6 -0
- package/dist/components/sonner.js +41 -0
- package/dist/components/sonner.js.map +1 -0
- package/dist/components/spinner.d.ts +6 -0
- package/dist/components/spinner.js +28 -0
- package/dist/components/spinner.js.map +1 -0
- package/dist/components/spotlight-search.d.ts +25 -0
- package/dist/components/spotlight-search.js +387 -0
- package/dist/components/spotlight-search.js.map +1 -0
- package/dist/components/switch.d.ts +7 -0
- package/dist/components/switch.js +41 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/table.d.ts +13 -0
- package/dist/components/table.js +124 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.d.ts +10 -0
- package/dist/components/tabs.js +77 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/textarea.d.ts +6 -0
- package/dist/components/textarea.js +26 -0
- package/dist/components/textarea.js.map +1 -0
- package/dist/components/theme-toggle.d.ts +8 -0
- package/dist/components/theme-toggle.js +86 -0
- package/dist/components/theme-toggle.js.map +1 -0
- package/dist/components/toggle-group.d.ts +14 -0
- package/dist/components/toggle-group.js +102 -0
- package/dist/components/toggle-group.js.map +1 -0
- package/dist/components/toggle.d.ts +13 -0
- package/dist/components/toggle.js +53 -0
- package/dist/components/toggle.js.map +1 -0
- package/dist/components/tooltip.d.ts +10 -0
- package/dist/components/tooltip.js +65 -0
- package/dist/components/tooltip.js.map +1 -0
- package/dist/hooks/use-mobile.d.ts +3 -0
- package/dist/hooks/use-mobile.js +22 -0
- package/dist/hooks/use-mobile.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/utils.d.ts +5 -0
- package/dist/lib/utils.js +10 -0
- package/dist/lib/utils.js.map +1 -0
- package/package.json +123 -0
- package/src/styles/globals.css +125 -0
|
@@ -0,0 +1,909 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/lib/utils.ts
|
|
4
|
+
import { clsx } from "clsx";
|
|
5
|
+
import { twMerge } from "tailwind-merge";
|
|
6
|
+
function cn(...inputs) {
|
|
7
|
+
return twMerge(clsx(inputs));
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// src/components/button.tsx
|
|
11
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
12
|
+
import { cva } from "class-variance-authority";
|
|
13
|
+
import { jsx } from "react/jsx-runtime";
|
|
14
|
+
var buttonVariants = cva(
|
|
15
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
16
|
+
{
|
|
17
|
+
variants: {
|
|
18
|
+
variant: {
|
|
19
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
20
|
+
destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
21
|
+
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
22
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
23
|
+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
24
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
25
|
+
},
|
|
26
|
+
size: {
|
|
27
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
28
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
29
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
30
|
+
icon: "size-9",
|
|
31
|
+
"icon-sm": "size-8",
|
|
32
|
+
"icon-lg": "size-10"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
defaultVariants: {
|
|
36
|
+
variant: "default",
|
|
37
|
+
size: "default"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
function Button({
|
|
42
|
+
className,
|
|
43
|
+
variant,
|
|
44
|
+
size,
|
|
45
|
+
asChild = false,
|
|
46
|
+
...props
|
|
47
|
+
}) {
|
|
48
|
+
const Comp = asChild ? Slot : "button";
|
|
49
|
+
return /* @__PURE__ */ jsx(
|
|
50
|
+
Comp,
|
|
51
|
+
{
|
|
52
|
+
"data-slot": "button",
|
|
53
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
54
|
+
...props
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// src/components/input.tsx
|
|
60
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
61
|
+
function Input({ className, type, ...props }) {
|
|
62
|
+
return /* @__PURE__ */ jsx2(
|
|
63
|
+
"input",
|
|
64
|
+
{
|
|
65
|
+
type,
|
|
66
|
+
"data-slot": "input",
|
|
67
|
+
className: cn(
|
|
68
|
+
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
69
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
70
|
+
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
71
|
+
className
|
|
72
|
+
),
|
|
73
|
+
...props
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// src/components/separator.tsx
|
|
79
|
+
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
80
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
81
|
+
function Separator({
|
|
82
|
+
className,
|
|
83
|
+
orientation = "horizontal",
|
|
84
|
+
decorative = true,
|
|
85
|
+
...props
|
|
86
|
+
}) {
|
|
87
|
+
return /* @__PURE__ */ jsx3(
|
|
88
|
+
SeparatorPrimitive.Root,
|
|
89
|
+
{
|
|
90
|
+
"data-slot": "separator",
|
|
91
|
+
decorative,
|
|
92
|
+
orientation,
|
|
93
|
+
className: cn(
|
|
94
|
+
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
|
95
|
+
className
|
|
96
|
+
),
|
|
97
|
+
...props
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// src/components/sheet.tsx
|
|
103
|
+
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
104
|
+
import { IconX } from "@tabler/icons-react";
|
|
105
|
+
import { jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
106
|
+
function Sheet({ ...props }) {
|
|
107
|
+
return /* @__PURE__ */ jsx4(SheetPrimitive.Root, { "data-slot": "sheet", ...props });
|
|
108
|
+
}
|
|
109
|
+
function SheetPortal({
|
|
110
|
+
...props
|
|
111
|
+
}) {
|
|
112
|
+
return /* @__PURE__ */ jsx4(SheetPrimitive.Portal, { "data-slot": "sheet-portal", ...props });
|
|
113
|
+
}
|
|
114
|
+
function SheetOverlay({
|
|
115
|
+
className,
|
|
116
|
+
...props
|
|
117
|
+
}) {
|
|
118
|
+
return /* @__PURE__ */ jsx4(
|
|
119
|
+
SheetPrimitive.Overlay,
|
|
120
|
+
{
|
|
121
|
+
"data-slot": "sheet-overlay",
|
|
122
|
+
className: cn(
|
|
123
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
|
|
124
|
+
className
|
|
125
|
+
),
|
|
126
|
+
...props
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
function SheetContent({
|
|
131
|
+
className,
|
|
132
|
+
children,
|
|
133
|
+
side = "right",
|
|
134
|
+
...props
|
|
135
|
+
}) {
|
|
136
|
+
return /* @__PURE__ */ jsxs(SheetPortal, { children: [
|
|
137
|
+
/* @__PURE__ */ jsx4(SheetOverlay, {}),
|
|
138
|
+
/* @__PURE__ */ jsxs(
|
|
139
|
+
SheetPrimitive.Content,
|
|
140
|
+
{
|
|
141
|
+
"data-slot": "sheet-content",
|
|
142
|
+
className: cn(
|
|
143
|
+
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
|
|
144
|
+
side === "right" && "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
|
|
145
|
+
side === "left" && "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
|
|
146
|
+
side === "top" && "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
|
|
147
|
+
side === "bottom" && "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
|
|
148
|
+
className
|
|
149
|
+
),
|
|
150
|
+
...props,
|
|
151
|
+
children: [
|
|
152
|
+
children,
|
|
153
|
+
/* @__PURE__ */ jsxs(SheetPrimitive.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none", children: [
|
|
154
|
+
/* @__PURE__ */ jsx4(IconX, { className: "size-4" }),
|
|
155
|
+
/* @__PURE__ */ jsx4("span", { className: "sr-only", children: "Close" })
|
|
156
|
+
] })
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
)
|
|
160
|
+
] });
|
|
161
|
+
}
|
|
162
|
+
function SheetHeader({ className, ...props }) {
|
|
163
|
+
return /* @__PURE__ */ jsx4(
|
|
164
|
+
"div",
|
|
165
|
+
{
|
|
166
|
+
"data-slot": "sheet-header",
|
|
167
|
+
className: cn("flex flex-col gap-1.5 p-4", className),
|
|
168
|
+
...props
|
|
169
|
+
}
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
function SheetTitle({
|
|
173
|
+
className,
|
|
174
|
+
...props
|
|
175
|
+
}) {
|
|
176
|
+
return /* @__PURE__ */ jsx4(
|
|
177
|
+
SheetPrimitive.Title,
|
|
178
|
+
{
|
|
179
|
+
"data-slot": "sheet-title",
|
|
180
|
+
className: cn("text-foreground font-semibold", className),
|
|
181
|
+
...props
|
|
182
|
+
}
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
function SheetDescription({
|
|
186
|
+
className,
|
|
187
|
+
...props
|
|
188
|
+
}) {
|
|
189
|
+
return /* @__PURE__ */ jsx4(
|
|
190
|
+
SheetPrimitive.Description,
|
|
191
|
+
{
|
|
192
|
+
"data-slot": "sheet-description",
|
|
193
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
194
|
+
...props
|
|
195
|
+
}
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// src/components/skeleton.tsx
|
|
200
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
201
|
+
function Skeleton({ className, ...props }) {
|
|
202
|
+
return /* @__PURE__ */ jsx5(
|
|
203
|
+
"div",
|
|
204
|
+
{
|
|
205
|
+
"data-slot": "skeleton",
|
|
206
|
+
className: cn("bg-accent animate-pulse rounded-md", className),
|
|
207
|
+
...props
|
|
208
|
+
}
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// src/components/tooltip.tsx
|
|
213
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
214
|
+
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
215
|
+
function TooltipProvider({
|
|
216
|
+
delayDuration = 0,
|
|
217
|
+
...props
|
|
218
|
+
}) {
|
|
219
|
+
return /* @__PURE__ */ jsx6(
|
|
220
|
+
TooltipPrimitive.Provider,
|
|
221
|
+
{
|
|
222
|
+
"data-slot": "tooltip-provider",
|
|
223
|
+
delayDuration,
|
|
224
|
+
...props
|
|
225
|
+
}
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
function Tooltip({
|
|
229
|
+
...props
|
|
230
|
+
}) {
|
|
231
|
+
return /* @__PURE__ */ jsx6(TooltipProvider, { children: /* @__PURE__ */ jsx6(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props }) });
|
|
232
|
+
}
|
|
233
|
+
function TooltipTrigger({
|
|
234
|
+
...props
|
|
235
|
+
}) {
|
|
236
|
+
return /* @__PURE__ */ jsx6(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
237
|
+
}
|
|
238
|
+
function TooltipContent({
|
|
239
|
+
className,
|
|
240
|
+
sideOffset = 0,
|
|
241
|
+
children,
|
|
242
|
+
...props
|
|
243
|
+
}) {
|
|
244
|
+
return /* @__PURE__ */ jsx6(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs2(
|
|
245
|
+
TooltipPrimitive.Content,
|
|
246
|
+
{
|
|
247
|
+
"data-slot": "tooltip-content",
|
|
248
|
+
sideOffset,
|
|
249
|
+
className: cn(
|
|
250
|
+
"bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
|
|
251
|
+
className
|
|
252
|
+
),
|
|
253
|
+
...props,
|
|
254
|
+
children: [
|
|
255
|
+
children,
|
|
256
|
+
/* @__PURE__ */ jsx6(TooltipPrimitive.Arrow, { className: "bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })
|
|
257
|
+
]
|
|
258
|
+
}
|
|
259
|
+
) });
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// src/hooks/use-mobile.ts
|
|
263
|
+
import * as React from "react";
|
|
264
|
+
var MOBILE_BREAKPOINT = 768;
|
|
265
|
+
function useIsMobile() {
|
|
266
|
+
const [isMobile, setIsMobile] = React.useState(
|
|
267
|
+
void 0
|
|
268
|
+
);
|
|
269
|
+
React.useEffect(() => {
|
|
270
|
+
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
271
|
+
const onChange = () => {
|
|
272
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
273
|
+
};
|
|
274
|
+
mql.addEventListener("change", onChange);
|
|
275
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
276
|
+
return () => mql.removeEventListener("change", onChange);
|
|
277
|
+
}, []);
|
|
278
|
+
return !!isMobile;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// src/components/sidebar.tsx
|
|
282
|
+
import { Slot as Slot2 } from "@radix-ui/react-slot";
|
|
283
|
+
import { IconMenu2 } from "@tabler/icons-react";
|
|
284
|
+
import { cva as cva2 } from "class-variance-authority";
|
|
285
|
+
import * as React2 from "react";
|
|
286
|
+
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
287
|
+
var SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
288
|
+
var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
289
|
+
var SIDEBAR_WIDTH = "16rem";
|
|
290
|
+
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
291
|
+
var SIDEBAR_WIDTH_ICON = "3rem";
|
|
292
|
+
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
293
|
+
var SidebarContext = React2.createContext(null);
|
|
294
|
+
function useSidebar() {
|
|
295
|
+
const context = React2.useContext(SidebarContext);
|
|
296
|
+
if (!context) {
|
|
297
|
+
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
298
|
+
}
|
|
299
|
+
return context;
|
|
300
|
+
}
|
|
301
|
+
function SidebarProvider({
|
|
302
|
+
defaultOpen = true,
|
|
303
|
+
open: openProp,
|
|
304
|
+
onOpenChange: setOpenProp,
|
|
305
|
+
className,
|
|
306
|
+
style,
|
|
307
|
+
children,
|
|
308
|
+
...props
|
|
309
|
+
}) {
|
|
310
|
+
const isMobile = useIsMobile();
|
|
311
|
+
const [openMobile, setOpenMobile] = React2.useState(false);
|
|
312
|
+
const [_open, _setOpen] = React2.useState(defaultOpen);
|
|
313
|
+
const open = openProp ?? _open;
|
|
314
|
+
const setOpen = React2.useCallback(
|
|
315
|
+
(value) => {
|
|
316
|
+
const openState = typeof value === "function" ? value(open) : value;
|
|
317
|
+
if (setOpenProp) {
|
|
318
|
+
setOpenProp(openState);
|
|
319
|
+
} else {
|
|
320
|
+
_setOpen(openState);
|
|
321
|
+
}
|
|
322
|
+
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
|
|
323
|
+
},
|
|
324
|
+
[open, setOpenProp]
|
|
325
|
+
);
|
|
326
|
+
const toggleSidebar = React2.useCallback(() => {
|
|
327
|
+
return isMobile ? setOpenMobile((value) => !value) : setOpen((value) => !value);
|
|
328
|
+
}, [isMobile, setOpen]);
|
|
329
|
+
React2.useEffect(() => {
|
|
330
|
+
const handleKeyDown = (event) => {
|
|
331
|
+
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
332
|
+
event.preventDefault();
|
|
333
|
+
toggleSidebar();
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
337
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
338
|
+
}, [toggleSidebar]);
|
|
339
|
+
const state = open ? "expanded" : "collapsed";
|
|
340
|
+
const contextValue = {
|
|
341
|
+
state,
|
|
342
|
+
open,
|
|
343
|
+
setOpen,
|
|
344
|
+
isMobile,
|
|
345
|
+
openMobile,
|
|
346
|
+
setOpenMobile,
|
|
347
|
+
toggleSidebar
|
|
348
|
+
};
|
|
349
|
+
return /* @__PURE__ */ jsx7(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx7(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsx7(
|
|
350
|
+
"div",
|
|
351
|
+
{
|
|
352
|
+
"data-slot": "sidebar-wrapper",
|
|
353
|
+
style: {
|
|
354
|
+
"--sidebar-width": SIDEBAR_WIDTH,
|
|
355
|
+
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
356
|
+
...style
|
|
357
|
+
},
|
|
358
|
+
className: cn(
|
|
359
|
+
"group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",
|
|
360
|
+
className
|
|
361
|
+
),
|
|
362
|
+
...props,
|
|
363
|
+
children
|
|
364
|
+
}
|
|
365
|
+
) }) });
|
|
366
|
+
}
|
|
367
|
+
function Sidebar({
|
|
368
|
+
side = "left",
|
|
369
|
+
variant = "sidebar",
|
|
370
|
+
collapsible = "offcanvas",
|
|
371
|
+
className,
|
|
372
|
+
children,
|
|
373
|
+
...props
|
|
374
|
+
}) {
|
|
375
|
+
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
376
|
+
if (collapsible === "none") {
|
|
377
|
+
return /* @__PURE__ */ jsx7(
|
|
378
|
+
"div",
|
|
379
|
+
{
|
|
380
|
+
"data-slot": "sidebar",
|
|
381
|
+
className: cn(
|
|
382
|
+
"bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",
|
|
383
|
+
className
|
|
384
|
+
),
|
|
385
|
+
...props,
|
|
386
|
+
children
|
|
387
|
+
}
|
|
388
|
+
);
|
|
389
|
+
}
|
|
390
|
+
if (isMobile) {
|
|
391
|
+
return /* @__PURE__ */ jsx7(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ jsxs3(
|
|
392
|
+
SheetContent,
|
|
393
|
+
{
|
|
394
|
+
"data-sidebar": "sidebar",
|
|
395
|
+
"data-slot": "sidebar",
|
|
396
|
+
"data-mobile": "true",
|
|
397
|
+
className: "bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",
|
|
398
|
+
style: {
|
|
399
|
+
"--sidebar-width": SIDEBAR_WIDTH_MOBILE
|
|
400
|
+
},
|
|
401
|
+
side,
|
|
402
|
+
children: [
|
|
403
|
+
/* @__PURE__ */ jsxs3(SheetHeader, { className: "sr-only", children: [
|
|
404
|
+
/* @__PURE__ */ jsx7(SheetTitle, { children: "Sidebar" }),
|
|
405
|
+
/* @__PURE__ */ jsx7(SheetDescription, { children: "Displays the mobile sidebar." })
|
|
406
|
+
] }),
|
|
407
|
+
/* @__PURE__ */ jsx7("div", { className: "flex h-full w-full flex-col", children })
|
|
408
|
+
]
|
|
409
|
+
}
|
|
410
|
+
) });
|
|
411
|
+
}
|
|
412
|
+
return /* @__PURE__ */ jsxs3(
|
|
413
|
+
"div",
|
|
414
|
+
{
|
|
415
|
+
className: "group peer text-sidebar-foreground hidden md:block",
|
|
416
|
+
"data-state": state,
|
|
417
|
+
"data-collapsible": state === "collapsed" ? collapsible : "",
|
|
418
|
+
"data-variant": variant,
|
|
419
|
+
"data-side": side,
|
|
420
|
+
"data-slot": "sidebar",
|
|
421
|
+
children: [
|
|
422
|
+
/* @__PURE__ */ jsx7(
|
|
423
|
+
"div",
|
|
424
|
+
{
|
|
425
|
+
"data-slot": "sidebar-gap",
|
|
426
|
+
className: cn(
|
|
427
|
+
"relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear",
|
|
428
|
+
"group-data-[collapsible=offcanvas]:w-0",
|
|
429
|
+
"group-data-[side=right]:rotate-180",
|
|
430
|
+
variant === "floating" || variant === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)"
|
|
431
|
+
)
|
|
432
|
+
}
|
|
433
|
+
),
|
|
434
|
+
/* @__PURE__ */ jsx7(
|
|
435
|
+
"div",
|
|
436
|
+
{
|
|
437
|
+
"data-slot": "sidebar-container",
|
|
438
|
+
className: cn(
|
|
439
|
+
"fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",
|
|
440
|
+
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)]",
|
|
441
|
+
// Adjust the padding for floating and inset variants.
|
|
442
|
+
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",
|
|
443
|
+
className
|
|
444
|
+
),
|
|
445
|
+
...props,
|
|
446
|
+
children: /* @__PURE__ */ jsx7(
|
|
447
|
+
"div",
|
|
448
|
+
{
|
|
449
|
+
"data-sidebar": "sidebar",
|
|
450
|
+
"data-slot": "sidebar-inner",
|
|
451
|
+
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",
|
|
452
|
+
children
|
|
453
|
+
}
|
|
454
|
+
)
|
|
455
|
+
}
|
|
456
|
+
)
|
|
457
|
+
]
|
|
458
|
+
}
|
|
459
|
+
);
|
|
460
|
+
}
|
|
461
|
+
function SidebarTrigger({
|
|
462
|
+
className,
|
|
463
|
+
onClick,
|
|
464
|
+
...props
|
|
465
|
+
}) {
|
|
466
|
+
const { toggleSidebar } = useSidebar();
|
|
467
|
+
return /* @__PURE__ */ jsxs3(
|
|
468
|
+
Button,
|
|
469
|
+
{
|
|
470
|
+
"data-sidebar": "trigger",
|
|
471
|
+
"data-slot": "sidebar-trigger",
|
|
472
|
+
variant: "ghost",
|
|
473
|
+
size: "icon",
|
|
474
|
+
className: cn("size-7", className),
|
|
475
|
+
onClick: (event) => {
|
|
476
|
+
onClick?.(event);
|
|
477
|
+
toggleSidebar();
|
|
478
|
+
},
|
|
479
|
+
...props,
|
|
480
|
+
children: [
|
|
481
|
+
/* @__PURE__ */ jsx7(IconMenu2, {}),
|
|
482
|
+
/* @__PURE__ */ jsx7("span", { className: "sr-only", children: "Toggle Sidebar" })
|
|
483
|
+
]
|
|
484
|
+
}
|
|
485
|
+
);
|
|
486
|
+
}
|
|
487
|
+
function SidebarRail({ className, ...props }) {
|
|
488
|
+
const { toggleSidebar } = useSidebar();
|
|
489
|
+
return /* @__PURE__ */ jsx7(
|
|
490
|
+
"button",
|
|
491
|
+
{
|
|
492
|
+
"data-sidebar": "rail",
|
|
493
|
+
"data-slot": "sidebar-rail",
|
|
494
|
+
"aria-label": "Toggle Sidebar",
|
|
495
|
+
tabIndex: -1,
|
|
496
|
+
onClick: toggleSidebar,
|
|
497
|
+
title: "Toggle Sidebar",
|
|
498
|
+
className: cn(
|
|
499
|
+
"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",
|
|
500
|
+
"in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize",
|
|
501
|
+
"[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
|
|
502
|
+
"hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full",
|
|
503
|
+
"[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
|
|
504
|
+
"[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
|
|
505
|
+
className
|
|
506
|
+
),
|
|
507
|
+
...props
|
|
508
|
+
}
|
|
509
|
+
);
|
|
510
|
+
}
|
|
511
|
+
function SidebarInset({ className, ...props }) {
|
|
512
|
+
return /* @__PURE__ */ jsx7(
|
|
513
|
+
"main",
|
|
514
|
+
{
|
|
515
|
+
"data-slot": "sidebar-inset",
|
|
516
|
+
className: cn(
|
|
517
|
+
"bg-background relative flex w-full flex-1 flex-col",
|
|
518
|
+
"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",
|
|
519
|
+
className
|
|
520
|
+
),
|
|
521
|
+
...props
|
|
522
|
+
}
|
|
523
|
+
);
|
|
524
|
+
}
|
|
525
|
+
function SidebarInput({
|
|
526
|
+
className,
|
|
527
|
+
...props
|
|
528
|
+
}) {
|
|
529
|
+
return /* @__PURE__ */ jsx7(
|
|
530
|
+
Input,
|
|
531
|
+
{
|
|
532
|
+
"data-slot": "sidebar-input",
|
|
533
|
+
"data-sidebar": "input",
|
|
534
|
+
className: cn("bg-background h-8 w-full shadow-none", className),
|
|
535
|
+
...props
|
|
536
|
+
}
|
|
537
|
+
);
|
|
538
|
+
}
|
|
539
|
+
function SidebarHeader({ className, ...props }) {
|
|
540
|
+
return /* @__PURE__ */ jsx7(
|
|
541
|
+
"div",
|
|
542
|
+
{
|
|
543
|
+
"data-slot": "sidebar-header",
|
|
544
|
+
"data-sidebar": "header",
|
|
545
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
546
|
+
...props
|
|
547
|
+
}
|
|
548
|
+
);
|
|
549
|
+
}
|
|
550
|
+
function SidebarFooter({ className, ...props }) {
|
|
551
|
+
return /* @__PURE__ */ jsx7(
|
|
552
|
+
"div",
|
|
553
|
+
{
|
|
554
|
+
"data-slot": "sidebar-footer",
|
|
555
|
+
"data-sidebar": "footer",
|
|
556
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
557
|
+
...props
|
|
558
|
+
}
|
|
559
|
+
);
|
|
560
|
+
}
|
|
561
|
+
function SidebarSeparator({
|
|
562
|
+
className,
|
|
563
|
+
...props
|
|
564
|
+
}) {
|
|
565
|
+
return /* @__PURE__ */ jsx7(
|
|
566
|
+
Separator,
|
|
567
|
+
{
|
|
568
|
+
"data-slot": "sidebar-separator",
|
|
569
|
+
"data-sidebar": "separator",
|
|
570
|
+
className: cn("bg-sidebar-border mx-2 w-auto", className),
|
|
571
|
+
...props
|
|
572
|
+
}
|
|
573
|
+
);
|
|
574
|
+
}
|
|
575
|
+
function SidebarContent({ className, ...props }) {
|
|
576
|
+
return /* @__PURE__ */ jsx7(
|
|
577
|
+
"div",
|
|
578
|
+
{
|
|
579
|
+
"data-slot": "sidebar-content",
|
|
580
|
+
"data-sidebar": "content",
|
|
581
|
+
className: cn(
|
|
582
|
+
"flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
|
|
583
|
+
className
|
|
584
|
+
),
|
|
585
|
+
...props
|
|
586
|
+
}
|
|
587
|
+
);
|
|
588
|
+
}
|
|
589
|
+
function SidebarGroup({ className, ...props }) {
|
|
590
|
+
return /* @__PURE__ */ jsx7(
|
|
591
|
+
"div",
|
|
592
|
+
{
|
|
593
|
+
"data-slot": "sidebar-group",
|
|
594
|
+
"data-sidebar": "group",
|
|
595
|
+
className: cn("relative flex w-full min-w-0 flex-col p-2", className),
|
|
596
|
+
...props
|
|
597
|
+
}
|
|
598
|
+
);
|
|
599
|
+
}
|
|
600
|
+
function SidebarGroupLabel({
|
|
601
|
+
className,
|
|
602
|
+
asChild = false,
|
|
603
|
+
...props
|
|
604
|
+
}) {
|
|
605
|
+
const Comp = asChild ? Slot2 : "div";
|
|
606
|
+
return /* @__PURE__ */ jsx7(
|
|
607
|
+
Comp,
|
|
608
|
+
{
|
|
609
|
+
"data-slot": "sidebar-group-label",
|
|
610
|
+
"data-sidebar": "group-label",
|
|
611
|
+
className: cn(
|
|
612
|
+
"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",
|
|
613
|
+
"group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
|
|
614
|
+
className
|
|
615
|
+
),
|
|
616
|
+
...props
|
|
617
|
+
}
|
|
618
|
+
);
|
|
619
|
+
}
|
|
620
|
+
function SidebarGroupAction({
|
|
621
|
+
className,
|
|
622
|
+
asChild = false,
|
|
623
|
+
...props
|
|
624
|
+
}) {
|
|
625
|
+
const Comp = asChild ? Slot2 : "button";
|
|
626
|
+
return /* @__PURE__ */ jsx7(
|
|
627
|
+
Comp,
|
|
628
|
+
{
|
|
629
|
+
"data-slot": "sidebar-group-action",
|
|
630
|
+
"data-sidebar": "group-action",
|
|
631
|
+
className: cn(
|
|
632
|
+
"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",
|
|
633
|
+
// Increases the hit area of the button on mobile.
|
|
634
|
+
"after:absolute after:-inset-2 md:after:hidden",
|
|
635
|
+
"group-data-[collapsible=icon]:hidden",
|
|
636
|
+
className
|
|
637
|
+
),
|
|
638
|
+
...props
|
|
639
|
+
}
|
|
640
|
+
);
|
|
641
|
+
}
|
|
642
|
+
function SidebarGroupContent({
|
|
643
|
+
className,
|
|
644
|
+
...props
|
|
645
|
+
}) {
|
|
646
|
+
return /* @__PURE__ */ jsx7(
|
|
647
|
+
"div",
|
|
648
|
+
{
|
|
649
|
+
"data-slot": "sidebar-group-content",
|
|
650
|
+
"data-sidebar": "group-content",
|
|
651
|
+
className: cn("w-full text-sm", className),
|
|
652
|
+
...props
|
|
653
|
+
}
|
|
654
|
+
);
|
|
655
|
+
}
|
|
656
|
+
function SidebarMenu({ className, ...props }) {
|
|
657
|
+
return /* @__PURE__ */ jsx7(
|
|
658
|
+
"ul",
|
|
659
|
+
{
|
|
660
|
+
"data-slot": "sidebar-menu",
|
|
661
|
+
"data-sidebar": "menu",
|
|
662
|
+
className: cn("flex w-full min-w-0 flex-col gap-1", className),
|
|
663
|
+
...props
|
|
664
|
+
}
|
|
665
|
+
);
|
|
666
|
+
}
|
|
667
|
+
function SidebarMenuItem({ className, ...props }) {
|
|
668
|
+
return /* @__PURE__ */ jsx7(
|
|
669
|
+
"li",
|
|
670
|
+
{
|
|
671
|
+
"data-slot": "sidebar-menu-item",
|
|
672
|
+
"data-sidebar": "menu-item",
|
|
673
|
+
className: cn("group/menu-item relative", className),
|
|
674
|
+
...props
|
|
675
|
+
}
|
|
676
|
+
);
|
|
677
|
+
}
|
|
678
|
+
var sidebarMenuButtonVariants = cva2(
|
|
679
|
+
"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",
|
|
680
|
+
{
|
|
681
|
+
variants: {
|
|
682
|
+
variant: {
|
|
683
|
+
default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
684
|
+
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))]"
|
|
685
|
+
},
|
|
686
|
+
size: {
|
|
687
|
+
default: "h-8 text-sm",
|
|
688
|
+
sm: "h-7 text-xs",
|
|
689
|
+
lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!"
|
|
690
|
+
}
|
|
691
|
+
},
|
|
692
|
+
defaultVariants: {
|
|
693
|
+
variant: "default",
|
|
694
|
+
size: "default"
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
);
|
|
698
|
+
function SidebarMenuButton({
|
|
699
|
+
asChild = false,
|
|
700
|
+
isActive = false,
|
|
701
|
+
variant = "default",
|
|
702
|
+
size = "default",
|
|
703
|
+
tooltip,
|
|
704
|
+
className,
|
|
705
|
+
...props
|
|
706
|
+
}) {
|
|
707
|
+
const Comp = asChild ? Slot2 : "button";
|
|
708
|
+
const { isMobile, state } = useSidebar();
|
|
709
|
+
const button = /* @__PURE__ */ jsx7(
|
|
710
|
+
Comp,
|
|
711
|
+
{
|
|
712
|
+
"data-slot": "sidebar-menu-button",
|
|
713
|
+
"data-sidebar": "menu-button",
|
|
714
|
+
"data-size": size,
|
|
715
|
+
"data-active": isActive,
|
|
716
|
+
className: cn(sidebarMenuButtonVariants({ variant, size }), className),
|
|
717
|
+
...props
|
|
718
|
+
}
|
|
719
|
+
);
|
|
720
|
+
if (!tooltip) {
|
|
721
|
+
return button;
|
|
722
|
+
}
|
|
723
|
+
if (typeof tooltip === "string") {
|
|
724
|
+
tooltip = {
|
|
725
|
+
children: tooltip
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
return /* @__PURE__ */ jsxs3(Tooltip, { children: [
|
|
729
|
+
/* @__PURE__ */ jsx7(TooltipTrigger, { asChild: true, children: button }),
|
|
730
|
+
/* @__PURE__ */ jsx7(
|
|
731
|
+
TooltipContent,
|
|
732
|
+
{
|
|
733
|
+
side: "right",
|
|
734
|
+
align: "center",
|
|
735
|
+
hidden: state !== "collapsed" || isMobile,
|
|
736
|
+
...tooltip
|
|
737
|
+
}
|
|
738
|
+
)
|
|
739
|
+
] });
|
|
740
|
+
}
|
|
741
|
+
function SidebarMenuAction({
|
|
742
|
+
className,
|
|
743
|
+
asChild = false,
|
|
744
|
+
showOnHover = false,
|
|
745
|
+
...props
|
|
746
|
+
}) {
|
|
747
|
+
const Comp = asChild ? Slot2 : "button";
|
|
748
|
+
return /* @__PURE__ */ jsx7(
|
|
749
|
+
Comp,
|
|
750
|
+
{
|
|
751
|
+
"data-slot": "sidebar-menu-action",
|
|
752
|
+
"data-sidebar": "menu-action",
|
|
753
|
+
className: cn(
|
|
754
|
+
"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",
|
|
755
|
+
// Increases the hit area of the button on mobile.
|
|
756
|
+
"after:absolute after:-inset-2 md:after:hidden",
|
|
757
|
+
"peer-data-[size=sm]/menu-button:top-1",
|
|
758
|
+
"peer-data-[size=default]/menu-button:top-1.5",
|
|
759
|
+
"peer-data-[size=lg]/menu-button:top-2.5",
|
|
760
|
+
"group-data-[collapsible=icon]:hidden",
|
|
761
|
+
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",
|
|
762
|
+
className
|
|
763
|
+
),
|
|
764
|
+
...props
|
|
765
|
+
}
|
|
766
|
+
);
|
|
767
|
+
}
|
|
768
|
+
function SidebarMenuBadge({
|
|
769
|
+
className,
|
|
770
|
+
...props
|
|
771
|
+
}) {
|
|
772
|
+
return /* @__PURE__ */ jsx7(
|
|
773
|
+
"div",
|
|
774
|
+
{
|
|
775
|
+
"data-slot": "sidebar-menu-badge",
|
|
776
|
+
"data-sidebar": "menu-badge",
|
|
777
|
+
className: cn(
|
|
778
|
+
"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",
|
|
779
|
+
"peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
|
|
780
|
+
"peer-data-[size=sm]/menu-button:top-1",
|
|
781
|
+
"peer-data-[size=default]/menu-button:top-1.5",
|
|
782
|
+
"peer-data-[size=lg]/menu-button:top-2.5",
|
|
783
|
+
"group-data-[collapsible=icon]:hidden",
|
|
784
|
+
className
|
|
785
|
+
),
|
|
786
|
+
...props
|
|
787
|
+
}
|
|
788
|
+
);
|
|
789
|
+
}
|
|
790
|
+
function SidebarMenuSkeleton({
|
|
791
|
+
className,
|
|
792
|
+
showIcon = false,
|
|
793
|
+
...props
|
|
794
|
+
}) {
|
|
795
|
+
const [width] = React2.useState(
|
|
796
|
+
() => `${Math.floor(Math.random() * 40) + 50}%`
|
|
797
|
+
);
|
|
798
|
+
return /* @__PURE__ */ jsxs3(
|
|
799
|
+
"div",
|
|
800
|
+
{
|
|
801
|
+
"data-slot": "sidebar-menu-skeleton",
|
|
802
|
+
"data-sidebar": "menu-skeleton",
|
|
803
|
+
className: cn("flex h-8 items-center gap-2 rounded-md px-2", className),
|
|
804
|
+
...props,
|
|
805
|
+
children: [
|
|
806
|
+
showIcon && /* @__PURE__ */ jsx7(
|
|
807
|
+
Skeleton,
|
|
808
|
+
{
|
|
809
|
+
className: "size-4 rounded-md",
|
|
810
|
+
"data-sidebar": "menu-skeleton-icon"
|
|
811
|
+
}
|
|
812
|
+
),
|
|
813
|
+
/* @__PURE__ */ jsx7(
|
|
814
|
+
Skeleton,
|
|
815
|
+
{
|
|
816
|
+
className: "h-4 max-w-(--skeleton-width) flex-1",
|
|
817
|
+
"data-sidebar": "menu-skeleton-text",
|
|
818
|
+
style: {
|
|
819
|
+
"--skeleton-width": width
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
)
|
|
823
|
+
]
|
|
824
|
+
}
|
|
825
|
+
);
|
|
826
|
+
}
|
|
827
|
+
function SidebarMenuSub({ className, ...props }) {
|
|
828
|
+
return /* @__PURE__ */ jsx7(
|
|
829
|
+
"ul",
|
|
830
|
+
{
|
|
831
|
+
"data-slot": "sidebar-menu-sub",
|
|
832
|
+
"data-sidebar": "menu-sub",
|
|
833
|
+
className: cn(
|
|
834
|
+
"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",
|
|
835
|
+
"group-data-[collapsible=icon]:hidden",
|
|
836
|
+
className
|
|
837
|
+
),
|
|
838
|
+
...props
|
|
839
|
+
}
|
|
840
|
+
);
|
|
841
|
+
}
|
|
842
|
+
function SidebarMenuSubItem({
|
|
843
|
+
className,
|
|
844
|
+
...props
|
|
845
|
+
}) {
|
|
846
|
+
return /* @__PURE__ */ jsx7(
|
|
847
|
+
"li",
|
|
848
|
+
{
|
|
849
|
+
"data-slot": "sidebar-menu-sub-item",
|
|
850
|
+
"data-sidebar": "menu-sub-item",
|
|
851
|
+
className: cn("group/menu-sub-item relative", className),
|
|
852
|
+
...props
|
|
853
|
+
}
|
|
854
|
+
);
|
|
855
|
+
}
|
|
856
|
+
function SidebarMenuSubButton({
|
|
857
|
+
asChild = false,
|
|
858
|
+
size = "md",
|
|
859
|
+
isActive = false,
|
|
860
|
+
className,
|
|
861
|
+
...props
|
|
862
|
+
}) {
|
|
863
|
+
const Comp = asChild ? Slot2 : "a";
|
|
864
|
+
return /* @__PURE__ */ jsx7(
|
|
865
|
+
Comp,
|
|
866
|
+
{
|
|
867
|
+
"data-slot": "sidebar-menu-sub-button",
|
|
868
|
+
"data-sidebar": "menu-sub-button",
|
|
869
|
+
"data-size": size,
|
|
870
|
+
"data-active": isActive,
|
|
871
|
+
className: cn(
|
|
872
|
+
"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",
|
|
873
|
+
"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
|
|
874
|
+
size === "sm" && "text-xs",
|
|
875
|
+
size === "md" && "text-sm",
|
|
876
|
+
"group-data-[collapsible=icon]:hidden",
|
|
877
|
+
className
|
|
878
|
+
),
|
|
879
|
+
...props
|
|
880
|
+
}
|
|
881
|
+
);
|
|
882
|
+
}
|
|
883
|
+
export {
|
|
884
|
+
Sidebar,
|
|
885
|
+
SidebarContent,
|
|
886
|
+
SidebarFooter,
|
|
887
|
+
SidebarGroup,
|
|
888
|
+
SidebarGroupAction,
|
|
889
|
+
SidebarGroupContent,
|
|
890
|
+
SidebarGroupLabel,
|
|
891
|
+
SidebarHeader,
|
|
892
|
+
SidebarInput,
|
|
893
|
+
SidebarInset,
|
|
894
|
+
SidebarMenu,
|
|
895
|
+
SidebarMenuAction,
|
|
896
|
+
SidebarMenuBadge,
|
|
897
|
+
SidebarMenuButton,
|
|
898
|
+
SidebarMenuItem,
|
|
899
|
+
SidebarMenuSkeleton,
|
|
900
|
+
SidebarMenuSub,
|
|
901
|
+
SidebarMenuSubButton,
|
|
902
|
+
SidebarMenuSubItem,
|
|
903
|
+
SidebarProvider,
|
|
904
|
+
SidebarRail,
|
|
905
|
+
SidebarSeparator,
|
|
906
|
+
SidebarTrigger,
|
|
907
|
+
useSidebar
|
|
908
|
+
};
|
|
909
|
+
//# sourceMappingURL=sidebar.js.map
|