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