@websolutespa/ask-ui 1.0.0 → 1.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/exports/components.d.mts +2232 -5
- package/dist/exports/components.mjs +4439 -4
- package/dist/exports/hooks.mjs +1 -17
- package/dist/exports/lib.d.mts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/use-mobile-SSHtEcOs.mjs +18 -0
- package/package.json +38 -22
- /package/dist/{utils-Dnvgforf.d.mts → utils-CCM7KiiI.d.mts} +0 -0
|
@@ -1,8 +1,76 @@
|
|
|
1
1
|
import { t as cn } from "../utils-XdqGR1qq.mjs";
|
|
2
|
+
import { t as useIsMobile } from "../use-mobile-SSHtEcOs.mjs";
|
|
3
|
+
import { ArrowDownIcon, ArrowUpIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CircleCheckIcon, DownloadIcon, FileTextIcon, GlobeIcon, ImageIcon, InfoIcon, Loader2Icon, MicIcon, MinusIcon, Monitor, MoreHorizontalIcon, Music2Icon, OctagonXIcon, PanelLeftIcon, PaperclipIcon, PlusIcon, SearchIcon, SquareIcon, TriangleAlertIcon, VideoIcon, XIcon } from "lucide-react";
|
|
4
|
+
import { Accordion as Accordion$1, AlertDialog as AlertDialog$1, AspectRatio as AspectRatio$1, Avatar as Avatar$1, Checkbox as Checkbox$1, Collapsible as Collapsible$1, ContextMenu as ContextMenu$1, Dialog as Dialog$1, Direction, DropdownMenu as DropdownMenu$1, HoverCard as HoverCard$1, Label as Label$1, Menubar as Menubar$1, NavigationMenu as NavigationMenu$1, Popover as Popover$1, Progress as Progress$1, RadioGroup as RadioGroup$1, ScrollArea as ScrollArea$1, Select as Select$1, Separator as Separator$1, Slider as Slider$1, Slot, Switch as Switch$1, Tabs as Tabs$1, Toggle as Toggle$1, ToggleGroup as ToggleGroup$1, Tooltip as Tooltip$1 } from "radix-ui";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { Children, createContext, memo, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
8
|
import { cva } from "class-variance-authority";
|
|
3
|
-
import {
|
|
4
|
-
import "
|
|
5
|
-
import {
|
|
9
|
+
import { StickToBottom, useStickToBottomContext } from "use-stick-to-bottom";
|
|
10
|
+
import { cjk } from "@streamdown/cjk";
|
|
11
|
+
import { code } from "@streamdown/code";
|
|
12
|
+
import { math } from "@streamdown/math";
|
|
13
|
+
import { mermaid } from "@streamdown/mermaid";
|
|
14
|
+
import { Streamdown } from "streamdown";
|
|
15
|
+
import { nanoid } from "nanoid";
|
|
16
|
+
import { Command as Command$1 } from "cmdk";
|
|
17
|
+
import { DayPicker, getDefaultClassNames } from "react-day-picker";
|
|
18
|
+
import useEmblaCarousel from "embla-carousel-react";
|
|
19
|
+
import * as RechartsPrimitive from "recharts";
|
|
20
|
+
import { Combobox as Combobox$1 } from "@base-ui/react";
|
|
21
|
+
import { Drawer as Drawer$1 } from "vaul";
|
|
22
|
+
import { OTPInput, OTPInputContext } from "input-otp";
|
|
23
|
+
import * as ResizablePrimitive from "react-resizable-panels";
|
|
24
|
+
import { useTheme } from "next-themes";
|
|
25
|
+
import { Toaster as Toaster$1 } from "sonner";
|
|
26
|
+
//#region src/components/accordion.tsx
|
|
27
|
+
function Accordion({ className, ...props }) {
|
|
28
|
+
return /* @__PURE__ */ jsx(Accordion$1.Root, {
|
|
29
|
+
"data-slot": "accordion",
|
|
30
|
+
className: cn("flex w-full flex-col", className),
|
|
31
|
+
...props
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function AccordionItem({ className, ...props }) {
|
|
35
|
+
return /* @__PURE__ */ jsx(Accordion$1.Item, {
|
|
36
|
+
"data-slot": "accordion-item",
|
|
37
|
+
className: cn("not-last:border-b", className),
|
|
38
|
+
...props
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function AccordionTrigger({ className, children, ...props }) {
|
|
42
|
+
return /* @__PURE__ */ jsx(Accordion$1.Header, {
|
|
43
|
+
className: "flex",
|
|
44
|
+
children: /* @__PURE__ */ jsxs(Accordion$1.Trigger, {
|
|
45
|
+
"data-slot": "accordion-trigger",
|
|
46
|
+
className: cn("group/accordion-trigger relative flex flex-1 items-start justify-between rounded-md border border-transparent py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:after:border-ring disabled:pointer-events-none disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground", className),
|
|
47
|
+
...props,
|
|
48
|
+
children: [
|
|
49
|
+
children,
|
|
50
|
+
/* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
51
|
+
"data-slot": "accordion-trigger-icon",
|
|
52
|
+
className: "pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden"
|
|
53
|
+
}),
|
|
54
|
+
/* @__PURE__ */ jsx(ChevronUpIcon, {
|
|
55
|
+
"data-slot": "accordion-trigger-icon",
|
|
56
|
+
className: "pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline"
|
|
57
|
+
})
|
|
58
|
+
]
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function AccordionContent({ className, children, ...props }) {
|
|
63
|
+
return /* @__PURE__ */ jsx(Accordion$1.Content, {
|
|
64
|
+
"data-slot": "accordion-content",
|
|
65
|
+
className: "overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up",
|
|
66
|
+
...props,
|
|
67
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
68
|
+
className: cn("h-(--radix-accordion-content-height) pt-0 pb-4 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4", className),
|
|
69
|
+
children
|
|
70
|
+
})
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
6
74
|
//#region src/components/button.tsx
|
|
7
75
|
const buttonVariants = cva("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none cursor-pointer 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", {
|
|
8
76
|
variants: {
|
|
@@ -44,4 +112,4371 @@ function Button({ className, variant = "default", size = "default", asChild = fa
|
|
|
44
112
|
});
|
|
45
113
|
}
|
|
46
114
|
//#endregion
|
|
47
|
-
|
|
115
|
+
//#region src/components/hover-card.tsx
|
|
116
|
+
function HoverCard({ ...props }) {
|
|
117
|
+
return /* @__PURE__ */ jsx(HoverCard$1.Root, {
|
|
118
|
+
"data-slot": "hover-card",
|
|
119
|
+
...props
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function HoverCardTrigger({ ...props }) {
|
|
123
|
+
return /* @__PURE__ */ jsx(HoverCard$1.Trigger, {
|
|
124
|
+
"data-slot": "hover-card-trigger",
|
|
125
|
+
...props
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
function HoverCardContent({ className, align = "center", sideOffset = 4, container, ...props }) {
|
|
129
|
+
return /* @__PURE__ */ jsx(HoverCard$1.Portal, {
|
|
130
|
+
"data-slot": "hover-card-portal",
|
|
131
|
+
container,
|
|
132
|
+
children: /* @__PURE__ */ jsx(HoverCard$1.Content, {
|
|
133
|
+
"data-slot": "hover-card-content",
|
|
134
|
+
align,
|
|
135
|
+
sideOffset,
|
|
136
|
+
className: cn("z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-lg bg-popover p-4 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 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-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", className),
|
|
137
|
+
...props
|
|
138
|
+
})
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
//#endregion
|
|
142
|
+
//#region src/components/ai-elements/attachments.tsx
|
|
143
|
+
const mediaCategoryIcons = {
|
|
144
|
+
audio: Music2Icon,
|
|
145
|
+
document: FileTextIcon,
|
|
146
|
+
image: ImageIcon,
|
|
147
|
+
source: GlobeIcon,
|
|
148
|
+
unknown: PaperclipIcon,
|
|
149
|
+
video: VideoIcon
|
|
150
|
+
};
|
|
151
|
+
const getMediaCategory = (data) => {
|
|
152
|
+
if (data.type === "source-document") return "source";
|
|
153
|
+
const mediaType = data.mediaType ?? "";
|
|
154
|
+
if (mediaType.startsWith("image/")) return "image";
|
|
155
|
+
if (mediaType.startsWith("video/")) return "video";
|
|
156
|
+
if (mediaType.startsWith("audio/")) return "audio";
|
|
157
|
+
if (mediaType.startsWith("application/") || mediaType.startsWith("text/")) return "document";
|
|
158
|
+
return "unknown";
|
|
159
|
+
};
|
|
160
|
+
const getAttachmentLabel = (data) => {
|
|
161
|
+
if (data.type === "source-document") return data.title || data.filename || "Source";
|
|
162
|
+
const category = getMediaCategory(data);
|
|
163
|
+
return data.filename || (category === "image" ? "Image" : "Attachment");
|
|
164
|
+
};
|
|
165
|
+
const renderAttachmentImage = (url, filename, isGrid) => isGrid ? /* @__PURE__ */ jsx("img", {
|
|
166
|
+
alt: filename || "Image",
|
|
167
|
+
className: "size-full object-cover",
|
|
168
|
+
height: 96,
|
|
169
|
+
src: url,
|
|
170
|
+
width: 96
|
|
171
|
+
}) : /* @__PURE__ */ jsx("img", {
|
|
172
|
+
alt: filename || "Image",
|
|
173
|
+
className: "size-full rounded object-cover",
|
|
174
|
+
height: 20,
|
|
175
|
+
src: url,
|
|
176
|
+
width: 20
|
|
177
|
+
});
|
|
178
|
+
const AttachmentsContext = createContext(null);
|
|
179
|
+
const AttachmentContext = createContext(null);
|
|
180
|
+
const useAttachmentsContext = () => useContext(AttachmentsContext) ?? { variant: "grid" };
|
|
181
|
+
const useAttachmentContext = () => {
|
|
182
|
+
const ctx = useContext(AttachmentContext);
|
|
183
|
+
if (!ctx) throw new Error("Attachment components must be used within <Attachment>");
|
|
184
|
+
return ctx;
|
|
185
|
+
};
|
|
186
|
+
const Attachments = ({ variant = "grid", className, children, ...props }) => {
|
|
187
|
+
const contextValue = useMemo(() => ({ variant }), [variant]);
|
|
188
|
+
return /* @__PURE__ */ jsx(AttachmentsContext.Provider, {
|
|
189
|
+
value: contextValue,
|
|
190
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
191
|
+
className: cn("flex items-start", variant === "list" ? "flex-col gap-2" : "flex-wrap gap-2", variant === "grid" && "ml-auto w-fit", className),
|
|
192
|
+
...props,
|
|
193
|
+
children
|
|
194
|
+
})
|
|
195
|
+
});
|
|
196
|
+
};
|
|
197
|
+
const Attachment = ({ data, onRemove, className, children, ...props }) => {
|
|
198
|
+
const { variant } = useAttachmentsContext();
|
|
199
|
+
const mediaCategory = getMediaCategory(data);
|
|
200
|
+
const contextValue = useMemo(() => ({
|
|
201
|
+
data,
|
|
202
|
+
mediaCategory,
|
|
203
|
+
onRemove,
|
|
204
|
+
variant
|
|
205
|
+
}), [
|
|
206
|
+
data,
|
|
207
|
+
mediaCategory,
|
|
208
|
+
onRemove,
|
|
209
|
+
variant
|
|
210
|
+
]);
|
|
211
|
+
return /* @__PURE__ */ jsx(AttachmentContext.Provider, {
|
|
212
|
+
value: contextValue,
|
|
213
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
214
|
+
className: cn("group relative", variant === "grid" && "size-24 overflow-hidden rounded-lg", variant === "inline" && [
|
|
215
|
+
"flex h-8 cursor-pointer select-none items-center gap-1.5",
|
|
216
|
+
"rounded-md border border-border px-1.5",
|
|
217
|
+
"font-medium text-sm transition-all",
|
|
218
|
+
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50"
|
|
219
|
+
], variant === "list" && ["flex w-full items-center gap-3 rounded-lg border p-3", "hover:bg-accent/50"], className),
|
|
220
|
+
...props,
|
|
221
|
+
children
|
|
222
|
+
})
|
|
223
|
+
});
|
|
224
|
+
};
|
|
225
|
+
const AttachmentPreview = ({ fallbackIcon, className, ...props }) => {
|
|
226
|
+
const { data, mediaCategory, variant } = useAttachmentContext();
|
|
227
|
+
const iconSize = variant === "inline" ? "size-3" : "size-4";
|
|
228
|
+
const renderIcon = (Icon) => /* @__PURE__ */ jsx(Icon, { className: cn(iconSize, "text-muted-foreground") });
|
|
229
|
+
const renderContent = () => {
|
|
230
|
+
if (mediaCategory === "image" && data.type === "file" && data.url) return renderAttachmentImage(data.url, data.filename, variant === "grid");
|
|
231
|
+
if (mediaCategory === "video" && data.type === "file" && data.url) return /* @__PURE__ */ jsx("video", {
|
|
232
|
+
className: "size-full object-cover",
|
|
233
|
+
muted: true,
|
|
234
|
+
src: data.url
|
|
235
|
+
});
|
|
236
|
+
const Icon = mediaCategoryIcons[mediaCategory];
|
|
237
|
+
return fallbackIcon ?? renderIcon(Icon);
|
|
238
|
+
};
|
|
239
|
+
return /* @__PURE__ */ jsx("div", {
|
|
240
|
+
className: cn("flex shrink-0 items-center justify-center overflow-hidden", variant === "grid" && "size-full bg-muted", variant === "inline" && "size-5 rounded bg-background", variant === "list" && "size-12 rounded bg-muted", className),
|
|
241
|
+
...props,
|
|
242
|
+
children: renderContent()
|
|
243
|
+
});
|
|
244
|
+
};
|
|
245
|
+
const AttachmentInfo = ({ showMediaType = false, className, ...props }) => {
|
|
246
|
+
const { data, variant } = useAttachmentContext();
|
|
247
|
+
const label = getAttachmentLabel(data);
|
|
248
|
+
if (variant === "grid") return null;
|
|
249
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
250
|
+
className: cn("min-w-0 flex-1", className),
|
|
251
|
+
...props,
|
|
252
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
253
|
+
className: "block truncate",
|
|
254
|
+
children: label
|
|
255
|
+
}), showMediaType && data.mediaType && /* @__PURE__ */ jsx("span", {
|
|
256
|
+
className: "block truncate text-muted-foreground text-xs",
|
|
257
|
+
children: data.mediaType
|
|
258
|
+
})]
|
|
259
|
+
});
|
|
260
|
+
};
|
|
261
|
+
const AttachmentRemove = ({ label = "Remove", className, children, ...props }) => {
|
|
262
|
+
const { onRemove, variant } = useAttachmentContext();
|
|
263
|
+
const handleClick = useCallback((e) => {
|
|
264
|
+
e.stopPropagation();
|
|
265
|
+
onRemove?.();
|
|
266
|
+
}, [onRemove]);
|
|
267
|
+
if (!onRemove) return null;
|
|
268
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
269
|
+
"aria-label": label,
|
|
270
|
+
className: cn(variant === "grid" && [
|
|
271
|
+
"absolute top-2 right-2 size-6 rounded-full p-0",
|
|
272
|
+
"bg-background/80 backdrop-blur-sm",
|
|
273
|
+
"opacity-0 transition-opacity group-hover:opacity-100",
|
|
274
|
+
"hover:bg-background",
|
|
275
|
+
"[&>svg]:size-3"
|
|
276
|
+
], variant === "inline" && [
|
|
277
|
+
"size-5 rounded p-0",
|
|
278
|
+
"opacity-0 transition-opacity group-hover:opacity-100",
|
|
279
|
+
"[&>svg]:size-2.5"
|
|
280
|
+
], variant === "list" && ["size-8 shrink-0 rounded p-0", "[&>svg]:size-4"], className),
|
|
281
|
+
onClick: handleClick,
|
|
282
|
+
type: "button",
|
|
283
|
+
variant: "ghost",
|
|
284
|
+
...props,
|
|
285
|
+
children: [children ?? /* @__PURE__ */ jsx(XIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
286
|
+
className: "sr-only",
|
|
287
|
+
children: label
|
|
288
|
+
})]
|
|
289
|
+
});
|
|
290
|
+
};
|
|
291
|
+
const AttachmentHoverCard = ({ openDelay = 0, closeDelay = 0, ...props }) => /* @__PURE__ */ jsx(HoverCard, {
|
|
292
|
+
closeDelay,
|
|
293
|
+
openDelay,
|
|
294
|
+
...props
|
|
295
|
+
});
|
|
296
|
+
const AttachmentHoverCardTrigger = (props) => /* @__PURE__ */ jsx(HoverCardTrigger, { ...props });
|
|
297
|
+
const AttachmentHoverCardContent = ({ align = "start", className, ...props }) => /* @__PURE__ */ jsx(HoverCardContent, {
|
|
298
|
+
align,
|
|
299
|
+
className: cn("w-auto p-2", className),
|
|
300
|
+
...props
|
|
301
|
+
});
|
|
302
|
+
const AttachmentEmpty = ({ className, children, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
303
|
+
className: cn("flex items-center justify-center p-4 text-muted-foreground text-sm", className),
|
|
304
|
+
...props,
|
|
305
|
+
children: children ?? "No attachments"
|
|
306
|
+
});
|
|
307
|
+
//#endregion
|
|
308
|
+
//#region src/components/ai-elements/conversation.tsx
|
|
309
|
+
const Conversation = ({ className, ...props }) => /* @__PURE__ */ jsx(StickToBottom, {
|
|
310
|
+
className: cn("relative flex-1 overflow-y-hidden", className),
|
|
311
|
+
initial: "smooth",
|
|
312
|
+
resize: "smooth",
|
|
313
|
+
role: "log",
|
|
314
|
+
...props
|
|
315
|
+
});
|
|
316
|
+
const ConversationContent = ({ className, ...props }) => /* @__PURE__ */ jsx(StickToBottom.Content, {
|
|
317
|
+
className: cn("flex flex-col gap-8 p-4", className),
|
|
318
|
+
...props
|
|
319
|
+
});
|
|
320
|
+
const ConversationEmptyState = ({ className, title = "No messages yet", description = "Start a conversation to see messages here", icon, children, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
321
|
+
className: cn("flex size-full flex-col items-center justify-center gap-3 p-8 text-center", className),
|
|
322
|
+
...props,
|
|
323
|
+
children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [icon && /* @__PURE__ */ jsx("div", {
|
|
324
|
+
className: "text-muted-foreground",
|
|
325
|
+
children: icon
|
|
326
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
327
|
+
className: "space-y-1",
|
|
328
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
329
|
+
className: "font-medium text-sm",
|
|
330
|
+
children: title
|
|
331
|
+
}), description && /* @__PURE__ */ jsx("p", {
|
|
332
|
+
className: "text-muted-foreground text-sm",
|
|
333
|
+
children: description
|
|
334
|
+
})]
|
|
335
|
+
})] })
|
|
336
|
+
});
|
|
337
|
+
const ConversationScrollButton = ({ className, ...props }) => {
|
|
338
|
+
const { isAtBottom, scrollToBottom } = useStickToBottomContext();
|
|
339
|
+
const handleScrollToBottom = useCallback(() => {
|
|
340
|
+
scrollToBottom();
|
|
341
|
+
}, [scrollToBottom]);
|
|
342
|
+
return !isAtBottom && /* @__PURE__ */ jsx(Button, {
|
|
343
|
+
className: cn("absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full dark:bg-background dark:hover:bg-muted", className),
|
|
344
|
+
onClick: handleScrollToBottom,
|
|
345
|
+
size: "icon",
|
|
346
|
+
type: "button",
|
|
347
|
+
variant: "outline",
|
|
348
|
+
...props,
|
|
349
|
+
children: /* @__PURE__ */ jsx(ArrowDownIcon, { className: "size-4" })
|
|
350
|
+
});
|
|
351
|
+
};
|
|
352
|
+
const getMessageText = (message) => message.parts.filter((part) => part.type === "text").map((part) => part.text).join("");
|
|
353
|
+
const defaultFormatMessage = (message) => {
|
|
354
|
+
return `**${message.role.charAt(0).toUpperCase() + message.role.slice(1)}:** ${getMessageText(message)}`;
|
|
355
|
+
};
|
|
356
|
+
const messagesToMarkdown = (messages, formatMessage = defaultFormatMessage) => messages.map((msg, i) => formatMessage(msg, i)).join("\n\n");
|
|
357
|
+
const ConversationDownload = ({ messages, filename = "conversation.md", formatMessage = defaultFormatMessage, className, children, ...props }) => {
|
|
358
|
+
const handleDownload = useCallback(() => {
|
|
359
|
+
const markdown = messagesToMarkdown(messages, formatMessage);
|
|
360
|
+
const blob = new Blob([markdown], { type: "text/markdown" });
|
|
361
|
+
const url = URL.createObjectURL(blob);
|
|
362
|
+
const link = document.createElement("a");
|
|
363
|
+
link.href = url;
|
|
364
|
+
link.download = filename;
|
|
365
|
+
document.body.append(link);
|
|
366
|
+
link.click();
|
|
367
|
+
link.remove();
|
|
368
|
+
URL.revokeObjectURL(url);
|
|
369
|
+
}, [
|
|
370
|
+
messages,
|
|
371
|
+
filename,
|
|
372
|
+
formatMessage
|
|
373
|
+
]);
|
|
374
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
375
|
+
className: cn("absolute top-4 right-4 rounded-full dark:bg-background dark:hover:bg-muted", className),
|
|
376
|
+
onClick: handleDownload,
|
|
377
|
+
size: "icon",
|
|
378
|
+
type: "button",
|
|
379
|
+
variant: "outline",
|
|
380
|
+
...props,
|
|
381
|
+
children: children ?? /* @__PURE__ */ jsx(DownloadIcon, { className: "size-4" })
|
|
382
|
+
});
|
|
383
|
+
};
|
|
384
|
+
//#endregion
|
|
385
|
+
//#region src/components/separator.tsx
|
|
386
|
+
function Separator({ className, orientation = "horizontal", decorative = true, ...props }) {
|
|
387
|
+
return /* @__PURE__ */ jsx(Separator$1.Root, {
|
|
388
|
+
"data-slot": "separator",
|
|
389
|
+
decorative,
|
|
390
|
+
orientation,
|
|
391
|
+
className: cn("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch", className),
|
|
392
|
+
...props
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
//#endregion
|
|
396
|
+
//#region src/components/button-group.tsx
|
|
397
|
+
const buttonGroupVariants = cva("flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1", {
|
|
398
|
+
variants: { orientation: {
|
|
399
|
+
horizontal: "[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-md!",
|
|
400
|
+
vertical: "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-md!"
|
|
401
|
+
} },
|
|
402
|
+
defaultVariants: { orientation: "horizontal" }
|
|
403
|
+
});
|
|
404
|
+
function ButtonGroup({ className, orientation, ...props }) {
|
|
405
|
+
return /* @__PURE__ */ jsx("div", {
|
|
406
|
+
role: "group",
|
|
407
|
+
"data-slot": "button-group",
|
|
408
|
+
"data-orientation": orientation,
|
|
409
|
+
className: cn(buttonGroupVariants({ orientation }), className),
|
|
410
|
+
...props
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
function ButtonGroupText({ className, asChild = false, ...props }) {
|
|
414
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "div", {
|
|
415
|
+
className: cn("flex items-center gap-2 rounded-md border bg-muted px-2.5 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4", className),
|
|
416
|
+
...props
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
function ButtonGroupSeparator({ className, orientation = "vertical", ...props }) {
|
|
420
|
+
return /* @__PURE__ */ jsx(Separator, {
|
|
421
|
+
"data-slot": "button-group-separator",
|
|
422
|
+
orientation,
|
|
423
|
+
className: cn("relative self-stretch bg-input data-horizontal:mx-px data-horizontal:w-auto data-vertical:my-px data-vertical:h-auto", className),
|
|
424
|
+
...props
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
//#endregion
|
|
428
|
+
//#region src/components/tooltip.tsx
|
|
429
|
+
function TooltipProvider({ delayDuration = 0, ...props }) {
|
|
430
|
+
return /* @__PURE__ */ jsx(Tooltip$1.Provider, {
|
|
431
|
+
"data-slot": "tooltip-provider",
|
|
432
|
+
delayDuration,
|
|
433
|
+
...props
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
function Tooltip({ ...props }) {
|
|
437
|
+
return /* @__PURE__ */ jsx(Tooltip$1.Root, {
|
|
438
|
+
"data-slot": "tooltip",
|
|
439
|
+
...props
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
function TooltipTrigger({ ...props }) {
|
|
443
|
+
return /* @__PURE__ */ jsx(Tooltip$1.Trigger, {
|
|
444
|
+
"data-slot": "tooltip-trigger",
|
|
445
|
+
...props
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
function TooltipContent({ className, sideOffset = 0, children, ...props }) {
|
|
449
|
+
return /* @__PURE__ */ jsx(Tooltip$1.Portal, { children: /* @__PURE__ */ jsxs(Tooltip$1.Content, {
|
|
450
|
+
"data-slot": "tooltip-content",
|
|
451
|
+
sideOffset,
|
|
452
|
+
className: cn("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", className),
|
|
453
|
+
...props,
|
|
454
|
+
children: [children, /* @__PURE__ */ jsx(Tooltip$1.Arrow, { className: "z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" })]
|
|
455
|
+
}) });
|
|
456
|
+
}
|
|
457
|
+
//#endregion
|
|
458
|
+
//#region src/components/ai-elements/message.tsx
|
|
459
|
+
const Message = ({ className, from, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
460
|
+
className: cn("group flex w-full max-w-[95%] flex-col gap-2", from === "user" ? "is-user ml-auto justify-end" : "is-assistant", className),
|
|
461
|
+
...props
|
|
462
|
+
});
|
|
463
|
+
const MessageContent = ({ children, className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
464
|
+
className: cn("is-user:dark flex w-fit min-w-0 max-w-full flex-col gap-2 overflow-hidden text-sm", "group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground", "group-[.is-assistant]:text-foreground", className),
|
|
465
|
+
...props,
|
|
466
|
+
children
|
|
467
|
+
});
|
|
468
|
+
const MessageActions = ({ className, children, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
469
|
+
className: cn("flex items-center gap-1", className),
|
|
470
|
+
...props,
|
|
471
|
+
children
|
|
472
|
+
});
|
|
473
|
+
const MessageAction = ({ tooltip, children, label, variant = "ghost", size = "icon-sm", ...props }) => {
|
|
474
|
+
const button = /* @__PURE__ */ jsxs(Button, {
|
|
475
|
+
size,
|
|
476
|
+
type: "button",
|
|
477
|
+
variant,
|
|
478
|
+
...props,
|
|
479
|
+
children: [children, /* @__PURE__ */ jsx("span", {
|
|
480
|
+
className: "sr-only",
|
|
481
|
+
children: label || tooltip
|
|
482
|
+
})]
|
|
483
|
+
});
|
|
484
|
+
if (tooltip) return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
485
|
+
asChild: true,
|
|
486
|
+
children: button
|
|
487
|
+
}), /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: tooltip }) })] }) });
|
|
488
|
+
return button;
|
|
489
|
+
};
|
|
490
|
+
const MessageBranchContext = createContext(null);
|
|
491
|
+
const useMessageBranch = () => {
|
|
492
|
+
const context = useContext(MessageBranchContext);
|
|
493
|
+
if (!context) throw new Error("MessageBranch components must be used within MessageBranch");
|
|
494
|
+
return context;
|
|
495
|
+
};
|
|
496
|
+
const MessageBranch = ({ defaultBranch = 0, onBranchChange, className, ...props }) => {
|
|
497
|
+
const [currentBranch, setCurrentBranch] = useState(defaultBranch);
|
|
498
|
+
const [branches, setBranches] = useState([]);
|
|
499
|
+
const handleBranchChange = useCallback((newBranch) => {
|
|
500
|
+
setCurrentBranch(newBranch);
|
|
501
|
+
onBranchChange?.(newBranch);
|
|
502
|
+
}, [onBranchChange]);
|
|
503
|
+
const goToPrevious = useCallback(() => {
|
|
504
|
+
handleBranchChange(currentBranch > 0 ? currentBranch - 1 : branches.length - 1);
|
|
505
|
+
}, [
|
|
506
|
+
currentBranch,
|
|
507
|
+
branches.length,
|
|
508
|
+
handleBranchChange
|
|
509
|
+
]);
|
|
510
|
+
const goToNext = useCallback(() => {
|
|
511
|
+
handleBranchChange(currentBranch < branches.length - 1 ? currentBranch + 1 : 0);
|
|
512
|
+
}, [
|
|
513
|
+
currentBranch,
|
|
514
|
+
branches.length,
|
|
515
|
+
handleBranchChange
|
|
516
|
+
]);
|
|
517
|
+
const contextValue = useMemo(() => ({
|
|
518
|
+
branches,
|
|
519
|
+
currentBranch,
|
|
520
|
+
goToNext,
|
|
521
|
+
goToPrevious,
|
|
522
|
+
setBranches,
|
|
523
|
+
totalBranches: branches.length
|
|
524
|
+
}), [
|
|
525
|
+
branches,
|
|
526
|
+
currentBranch,
|
|
527
|
+
goToNext,
|
|
528
|
+
goToPrevious
|
|
529
|
+
]);
|
|
530
|
+
return /* @__PURE__ */ jsx(MessageBranchContext.Provider, {
|
|
531
|
+
value: contextValue,
|
|
532
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
533
|
+
className: cn("grid w-full gap-2 [&>div]:pb-0", className),
|
|
534
|
+
...props
|
|
535
|
+
})
|
|
536
|
+
});
|
|
537
|
+
};
|
|
538
|
+
const MessageBranchContent = ({ children, ...props }) => {
|
|
539
|
+
const { currentBranch, setBranches, branches } = useMessageBranch();
|
|
540
|
+
const childrenArray = useMemo(() => Array.isArray(children) ? children : [children], [children]);
|
|
541
|
+
useEffect(() => {
|
|
542
|
+
if (branches.length !== childrenArray.length) setBranches(childrenArray);
|
|
543
|
+
}, [
|
|
544
|
+
childrenArray,
|
|
545
|
+
branches,
|
|
546
|
+
setBranches
|
|
547
|
+
]);
|
|
548
|
+
return childrenArray.map((branch, index) => /* @__PURE__ */ jsx("div", {
|
|
549
|
+
className: cn("grid gap-2 overflow-hidden [&>div]:pb-0", index === currentBranch ? "block" : "hidden"),
|
|
550
|
+
...props,
|
|
551
|
+
children: branch
|
|
552
|
+
}, branch.key));
|
|
553
|
+
};
|
|
554
|
+
const MessageBranchSelector = ({ className, ...props }) => {
|
|
555
|
+
const { totalBranches } = useMessageBranch();
|
|
556
|
+
if (totalBranches <= 1) return null;
|
|
557
|
+
return /* @__PURE__ */ jsx(ButtonGroup, {
|
|
558
|
+
className: cn("[&>*:not(:first-child)]:rounded-l-md [&>*:not(:last-child)]:rounded-r-md", className),
|
|
559
|
+
orientation: "horizontal",
|
|
560
|
+
...props
|
|
561
|
+
});
|
|
562
|
+
};
|
|
563
|
+
const MessageBranchPrevious = ({ children, ...props }) => {
|
|
564
|
+
const { goToPrevious, totalBranches } = useMessageBranch();
|
|
565
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
566
|
+
"aria-label": "Previous branch",
|
|
567
|
+
disabled: totalBranches <= 1,
|
|
568
|
+
onClick: goToPrevious,
|
|
569
|
+
size: "icon-sm",
|
|
570
|
+
type: "button",
|
|
571
|
+
variant: "ghost",
|
|
572
|
+
...props,
|
|
573
|
+
children: children ?? /* @__PURE__ */ jsx(ChevronLeftIcon, { size: 14 })
|
|
574
|
+
});
|
|
575
|
+
};
|
|
576
|
+
const MessageBranchNext = ({ children, ...props }) => {
|
|
577
|
+
const { goToNext, totalBranches } = useMessageBranch();
|
|
578
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
579
|
+
"aria-label": "Next branch",
|
|
580
|
+
disabled: totalBranches <= 1,
|
|
581
|
+
onClick: goToNext,
|
|
582
|
+
size: "icon-sm",
|
|
583
|
+
type: "button",
|
|
584
|
+
variant: "ghost",
|
|
585
|
+
...props,
|
|
586
|
+
children: children ?? /* @__PURE__ */ jsx(ChevronRightIcon, { size: 14 })
|
|
587
|
+
});
|
|
588
|
+
};
|
|
589
|
+
const MessageBranchPage = ({ className, ...props }) => {
|
|
590
|
+
const { currentBranch, totalBranches } = useMessageBranch();
|
|
591
|
+
return /* @__PURE__ */ jsxs(ButtonGroupText, {
|
|
592
|
+
className: cn("border-none bg-transparent text-muted-foreground shadow-none", className),
|
|
593
|
+
...props,
|
|
594
|
+
children: [
|
|
595
|
+
currentBranch + 1,
|
|
596
|
+
" of ",
|
|
597
|
+
totalBranches
|
|
598
|
+
]
|
|
599
|
+
});
|
|
600
|
+
};
|
|
601
|
+
const streamdownPlugins = {
|
|
602
|
+
cjk,
|
|
603
|
+
code,
|
|
604
|
+
math,
|
|
605
|
+
mermaid
|
|
606
|
+
};
|
|
607
|
+
const MessageResponse = memo(({ className, ...props }) => /* @__PURE__ */ jsx(Streamdown, {
|
|
608
|
+
className: cn("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0", className),
|
|
609
|
+
plugins: streamdownPlugins,
|
|
610
|
+
...props
|
|
611
|
+
}), (prevProps, nextProps) => prevProps.children === nextProps.children && nextProps.isAnimating === prevProps.isAnimating);
|
|
612
|
+
MessageResponse.displayName = "MessageResponse";
|
|
613
|
+
const MessageToolbar = ({ className, children, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
614
|
+
className: cn("mt-4 flex w-full items-center justify-between gap-4", className),
|
|
615
|
+
...props,
|
|
616
|
+
children
|
|
617
|
+
});
|
|
618
|
+
//#endregion
|
|
619
|
+
//#region src/components/dialog.tsx
|
|
620
|
+
function Dialog({ ...props }) {
|
|
621
|
+
return /* @__PURE__ */ jsx(Dialog$1.Root, {
|
|
622
|
+
"data-slot": "dialog",
|
|
623
|
+
...props
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
function DialogTrigger({ ...props }) {
|
|
627
|
+
return /* @__PURE__ */ jsx(Dialog$1.Trigger, {
|
|
628
|
+
"data-slot": "dialog-trigger",
|
|
629
|
+
...props
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
function DialogPortal({ ...props }) {
|
|
633
|
+
return /* @__PURE__ */ jsx(Dialog$1.Portal, {
|
|
634
|
+
"data-slot": "dialog-portal",
|
|
635
|
+
...props
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
function DialogClose({ ...props }) {
|
|
639
|
+
return /* @__PURE__ */ jsx(Dialog$1.Close, {
|
|
640
|
+
"data-slot": "dialog-close",
|
|
641
|
+
...props
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
function DialogOverlay({ className, ...props }) {
|
|
645
|
+
return /* @__PURE__ */ jsx(Dialog$1.Overlay, {
|
|
646
|
+
"data-slot": "dialog-overlay",
|
|
647
|
+
className: cn("fixed inset-0 isolate 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", className),
|
|
648
|
+
...props
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
function DialogContent({ className, children, showCloseButton = true, ...props }) {
|
|
652
|
+
return /* @__PURE__ */ jsxs(DialogPortal, { children: [/* @__PURE__ */ jsx(DialogOverlay, {}), /* @__PURE__ */ jsxs(Dialog$1.Content, {
|
|
653
|
+
"data-slot": "dialog-content",
|
|
654
|
+
className: cn("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl bg-popover p-6 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-md 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", className),
|
|
655
|
+
...props,
|
|
656
|
+
children: [children, showCloseButton && /* @__PURE__ */ jsx(Dialog$1.Close, {
|
|
657
|
+
"data-slot": "dialog-close",
|
|
658
|
+
asChild: true,
|
|
659
|
+
children: /* @__PURE__ */ jsxs(Button, {
|
|
660
|
+
variant: "ghost",
|
|
661
|
+
className: "absolute top-4 right-4",
|
|
662
|
+
size: "icon-sm",
|
|
663
|
+
children: [/* @__PURE__ */ jsx(XIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
664
|
+
className: "sr-only",
|
|
665
|
+
children: "Close"
|
|
666
|
+
})]
|
|
667
|
+
})
|
|
668
|
+
})]
|
|
669
|
+
})] });
|
|
670
|
+
}
|
|
671
|
+
function DialogHeader({ className, ...props }) {
|
|
672
|
+
return /* @__PURE__ */ jsx("div", {
|
|
673
|
+
"data-slot": "dialog-header",
|
|
674
|
+
className: cn("flex flex-col gap-2", className),
|
|
675
|
+
...props
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
function DialogFooter({ className, showCloseButton = false, children, ...props }) {
|
|
679
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
680
|
+
"data-slot": "dialog-footer",
|
|
681
|
+
className: cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className),
|
|
682
|
+
...props,
|
|
683
|
+
children: [children, showCloseButton && /* @__PURE__ */ jsx(Dialog$1.Close, {
|
|
684
|
+
asChild: true,
|
|
685
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
686
|
+
variant: "outline",
|
|
687
|
+
children: "Close"
|
|
688
|
+
})
|
|
689
|
+
})]
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
function DialogTitle({ className, ...props }) {
|
|
693
|
+
return /* @__PURE__ */ jsx(Dialog$1.Title, {
|
|
694
|
+
"data-slot": "dialog-title",
|
|
695
|
+
className: cn("leading-none font-medium", className),
|
|
696
|
+
...props
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
function DialogDescription({ className, ...props }) {
|
|
700
|
+
return /* @__PURE__ */ jsx(Dialog$1.Description, {
|
|
701
|
+
"data-slot": "dialog-description",
|
|
702
|
+
className: cn("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground", className),
|
|
703
|
+
...props
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
//#endregion
|
|
707
|
+
//#region src/components/input.tsx
|
|
708
|
+
function Input({ className, type, ...props }) {
|
|
709
|
+
return /* @__PURE__ */ jsx("input", {
|
|
710
|
+
type,
|
|
711
|
+
"data-slot": "input",
|
|
712
|
+
className: cn("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 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 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:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", className),
|
|
713
|
+
...props
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
//#endregion
|
|
717
|
+
//#region src/components/textarea.tsx
|
|
718
|
+
function Textarea({ className, ...props }) {
|
|
719
|
+
return /* @__PURE__ */ jsx("textarea", {
|
|
720
|
+
"data-slot": "textarea",
|
|
721
|
+
className: cn("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-2.5 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", className),
|
|
722
|
+
...props
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
//#endregion
|
|
726
|
+
//#region src/components/input-group.tsx
|
|
727
|
+
function InputGroup({ className, ...props }) {
|
|
728
|
+
return /* @__PURE__ */ jsx("div", {
|
|
729
|
+
"data-slot": "input-group",
|
|
730
|
+
role: "group",
|
|
731
|
+
className: cn("group/input-group relative flex h-9 w-full min-w-0 items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5", className),
|
|
732
|
+
...props
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
const inputGroupAddonVariants = cva("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4", {
|
|
736
|
+
variants: { align: {
|
|
737
|
+
"inline-start": "order-first pl-2 has-[>button]:-ml-1 has-[>kbd]:ml-[-0.15rem]",
|
|
738
|
+
"inline-end": "order-last pr-2 has-[>button]:-mr-1 has-[>kbd]:mr-[-0.15rem]",
|
|
739
|
+
"block-start": "order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2",
|
|
740
|
+
"block-end": "order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"
|
|
741
|
+
} },
|
|
742
|
+
defaultVariants: { align: "inline-start" }
|
|
743
|
+
});
|
|
744
|
+
function InputGroupAddon({ className, align = "inline-start", ...props }) {
|
|
745
|
+
return /* @__PURE__ */ jsx("div", {
|
|
746
|
+
role: "group",
|
|
747
|
+
"data-slot": "input-group-addon",
|
|
748
|
+
"data-align": align,
|
|
749
|
+
className: cn(inputGroupAddonVariants({ align }), className),
|
|
750
|
+
onClick: (e) => {
|
|
751
|
+
if (e.target.closest("button")) return;
|
|
752
|
+
e.currentTarget.parentElement?.querySelector("input")?.focus();
|
|
753
|
+
},
|
|
754
|
+
...props
|
|
755
|
+
});
|
|
756
|
+
}
|
|
757
|
+
const inputGroupButtonVariants = cva("flex items-center gap-2 text-sm shadow-none", {
|
|
758
|
+
variants: { size: {
|
|
759
|
+
xs: "h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
|
|
760
|
+
sm: "",
|
|
761
|
+
"icon-xs": "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
|
|
762
|
+
"icon-sm": "size-8 p-0 has-[>svg]:p-0"
|
|
763
|
+
} },
|
|
764
|
+
defaultVariants: { size: "xs" }
|
|
765
|
+
});
|
|
766
|
+
function InputGroupButton({ className, type = "button", variant = "ghost", size = "xs", ...props }) {
|
|
767
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
768
|
+
type,
|
|
769
|
+
"data-size": size,
|
|
770
|
+
variant,
|
|
771
|
+
className: cn(inputGroupButtonVariants({ size }), className),
|
|
772
|
+
...props
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
function InputGroupText({ className, ...props }) {
|
|
776
|
+
return /* @__PURE__ */ jsx("span", {
|
|
777
|
+
className: cn("flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4", className),
|
|
778
|
+
...props
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
function InputGroupInput({ className, ...props }) {
|
|
782
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
783
|
+
"data-slot": "input-group-control",
|
|
784
|
+
className: cn("flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent", className),
|
|
785
|
+
...props
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
function InputGroupTextarea({ className, ...props }) {
|
|
789
|
+
return /* @__PURE__ */ jsx(Textarea, {
|
|
790
|
+
"data-slot": "input-group-control",
|
|
791
|
+
className: cn("flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent", className),
|
|
792
|
+
...props
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
//#endregion
|
|
796
|
+
//#region src/components/command.tsx
|
|
797
|
+
function Command({ className, ...props }) {
|
|
798
|
+
return /* @__PURE__ */ jsx(Command$1, {
|
|
799
|
+
"data-slot": "command",
|
|
800
|
+
className: cn("flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground", className),
|
|
801
|
+
...props
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
function CommandDialog({ title = "Command Palette", description = "Search for a command to run...", children, className, showCloseButton = false, ...props }) {
|
|
805
|
+
return /* @__PURE__ */ jsxs(Dialog, {
|
|
806
|
+
...props,
|
|
807
|
+
children: [/* @__PURE__ */ jsxs(DialogHeader, {
|
|
808
|
+
className: "sr-only",
|
|
809
|
+
children: [/* @__PURE__ */ jsx(DialogTitle, { children: title }), /* @__PURE__ */ jsx(DialogDescription, { children: description })]
|
|
810
|
+
}), /* @__PURE__ */ jsx(DialogContent, {
|
|
811
|
+
className: cn("top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0", className),
|
|
812
|
+
showCloseButton,
|
|
813
|
+
children
|
|
814
|
+
})]
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
function CommandInput({ className, ...props }) {
|
|
818
|
+
return /* @__PURE__ */ jsx("div", {
|
|
819
|
+
"data-slot": "command-input-wrapper",
|
|
820
|
+
className: "p-1 pb-0",
|
|
821
|
+
children: /* @__PURE__ */ jsxs(InputGroup, {
|
|
822
|
+
className: "h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!",
|
|
823
|
+
children: [/* @__PURE__ */ jsx(Command$1.Input, {
|
|
824
|
+
"data-slot": "command-input",
|
|
825
|
+
className: cn("w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
826
|
+
...props
|
|
827
|
+
}), /* @__PURE__ */ jsx(InputGroupAddon, { children: /* @__PURE__ */ jsx(SearchIcon, { className: "size-4 shrink-0 opacity-50" }) })]
|
|
828
|
+
})
|
|
829
|
+
});
|
|
830
|
+
}
|
|
831
|
+
function CommandList({ className, ...props }) {
|
|
832
|
+
return /* @__PURE__ */ jsx(Command$1.List, {
|
|
833
|
+
"data-slot": "command-list",
|
|
834
|
+
className: cn("no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none", className),
|
|
835
|
+
...props
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
function CommandEmpty({ className, ...props }) {
|
|
839
|
+
return /* @__PURE__ */ jsx(Command$1.Empty, {
|
|
840
|
+
"data-slot": "command-empty",
|
|
841
|
+
className: cn("py-6 text-center text-sm", className),
|
|
842
|
+
...props
|
|
843
|
+
});
|
|
844
|
+
}
|
|
845
|
+
function CommandGroup({ className, ...props }) {
|
|
846
|
+
return /* @__PURE__ */ jsx(Command$1.Group, {
|
|
847
|
+
"data-slot": "command-group",
|
|
848
|
+
className: cn("overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground", className),
|
|
849
|
+
...props
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
function CommandSeparator({ className, ...props }) {
|
|
853
|
+
return /* @__PURE__ */ jsx(Command$1.Separator, {
|
|
854
|
+
"data-slot": "command-separator",
|
|
855
|
+
className: cn("-mx-1 h-px w-auto bg-border", className),
|
|
856
|
+
...props
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
function CommandItem({ className, children, ...props }) {
|
|
860
|
+
return /* @__PURE__ */ jsxs(Command$1.Item, {
|
|
861
|
+
"data-slot": "command-item",
|
|
862
|
+
className: cn("group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:**:[svg]:text-foreground", className),
|
|
863
|
+
...props,
|
|
864
|
+
children: [children, /* @__PURE__ */ jsx(CheckIcon, { className: "ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100" })]
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
function CommandShortcut({ className, ...props }) {
|
|
868
|
+
return /* @__PURE__ */ jsx("span", {
|
|
869
|
+
"data-slot": "command-shortcut",
|
|
870
|
+
className: cn("ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground", className),
|
|
871
|
+
...props
|
|
872
|
+
});
|
|
873
|
+
}
|
|
874
|
+
//#endregion
|
|
875
|
+
//#region src/components/dropdown-menu.tsx
|
|
876
|
+
function DropdownMenu({ ...props }) {
|
|
877
|
+
return /* @__PURE__ */ jsx(DropdownMenu$1.Root, {
|
|
878
|
+
"data-slot": "dropdown-menu",
|
|
879
|
+
...props
|
|
880
|
+
});
|
|
881
|
+
}
|
|
882
|
+
function DropdownMenuPortal({ ...props }) {
|
|
883
|
+
return /* @__PURE__ */ jsx(DropdownMenu$1.Portal, {
|
|
884
|
+
"data-slot": "dropdown-menu-portal",
|
|
885
|
+
...props
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
function DropdownMenuTrigger({ ...props }) {
|
|
889
|
+
return /* @__PURE__ */ jsx(DropdownMenu$1.Trigger, {
|
|
890
|
+
"data-slot": "dropdown-menu-trigger",
|
|
891
|
+
...props
|
|
892
|
+
});
|
|
893
|
+
}
|
|
894
|
+
function DropdownMenuContent({ className, align = "start", sideOffset = 4, container, ...props }) {
|
|
895
|
+
return /* @__PURE__ */ jsx(DropdownMenu$1.Portal, {
|
|
896
|
+
container,
|
|
897
|
+
children: /* @__PURE__ */ jsx(DropdownMenu$1.Content, {
|
|
898
|
+
"data-slot": "dropdown-menu-content",
|
|
899
|
+
sideOffset,
|
|
900
|
+
align,
|
|
901
|
+
className: cn("z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 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-[state=closed]:overflow-hidden 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", className),
|
|
902
|
+
...props
|
|
903
|
+
})
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
function DropdownMenuGroup({ ...props }) {
|
|
907
|
+
return /* @__PURE__ */ jsx(DropdownMenu$1.Group, {
|
|
908
|
+
"data-slot": "dropdown-menu-group",
|
|
909
|
+
...props
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
function DropdownMenuItem({ className, inset, variant = "default", ...props }) {
|
|
913
|
+
return /* @__PURE__ */ jsx(DropdownMenu$1.Item, {
|
|
914
|
+
"data-slot": "dropdown-menu-item",
|
|
915
|
+
"data-inset": inset,
|
|
916
|
+
"data-variant": variant,
|
|
917
|
+
className: cn("group/dropdown-menu-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive", className),
|
|
918
|
+
...props
|
|
919
|
+
});
|
|
920
|
+
}
|
|
921
|
+
function DropdownMenuCheckboxItem({ className, children, checked, inset, ...props }) {
|
|
922
|
+
return /* @__PURE__ */ jsxs(DropdownMenu$1.CheckboxItem, {
|
|
923
|
+
"data-slot": "dropdown-menu-checkbox-item",
|
|
924
|
+
"data-inset": inset,
|
|
925
|
+
className: cn("relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-8 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
926
|
+
checked,
|
|
927
|
+
...props,
|
|
928
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
929
|
+
className: "pointer-events-none absolute right-2 flex items-center justify-center",
|
|
930
|
+
"data-slot": "dropdown-menu-checkbox-item-indicator",
|
|
931
|
+
children: /* @__PURE__ */ jsx(DropdownMenu$1.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {}) })
|
|
932
|
+
}), children]
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
function DropdownMenuRadioGroup({ ...props }) {
|
|
936
|
+
return /* @__PURE__ */ jsx(DropdownMenu$1.RadioGroup, {
|
|
937
|
+
"data-slot": "dropdown-menu-radio-group",
|
|
938
|
+
...props
|
|
939
|
+
});
|
|
940
|
+
}
|
|
941
|
+
function DropdownMenuRadioItem({ className, children, inset, ...props }) {
|
|
942
|
+
return /* @__PURE__ */ jsxs(DropdownMenu$1.RadioItem, {
|
|
943
|
+
"data-slot": "dropdown-menu-radio-item",
|
|
944
|
+
"data-inset": inset,
|
|
945
|
+
className: cn("relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-8 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
946
|
+
...props,
|
|
947
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
948
|
+
className: "pointer-events-none absolute right-2 flex items-center justify-center",
|
|
949
|
+
"data-slot": "dropdown-menu-radio-item-indicator",
|
|
950
|
+
children: /* @__PURE__ */ jsx(DropdownMenu$1.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {}) })
|
|
951
|
+
}), children]
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
function DropdownMenuLabel({ className, inset, ...props }) {
|
|
955
|
+
return /* @__PURE__ */ jsx(DropdownMenu$1.Label, {
|
|
956
|
+
"data-slot": "dropdown-menu-label",
|
|
957
|
+
"data-inset": inset,
|
|
958
|
+
className: cn("px-2 py-1.5 text-xs font-medium text-muted-foreground data-inset:pl-8", className),
|
|
959
|
+
...props
|
|
960
|
+
});
|
|
961
|
+
}
|
|
962
|
+
function DropdownMenuSeparator({ className, ...props }) {
|
|
963
|
+
return /* @__PURE__ */ jsx(DropdownMenu$1.Separator, {
|
|
964
|
+
"data-slot": "dropdown-menu-separator",
|
|
965
|
+
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
966
|
+
...props
|
|
967
|
+
});
|
|
968
|
+
}
|
|
969
|
+
function DropdownMenuShortcut({ className, ...props }) {
|
|
970
|
+
return /* @__PURE__ */ jsx("span", {
|
|
971
|
+
"data-slot": "dropdown-menu-shortcut",
|
|
972
|
+
className: cn("ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground", className),
|
|
973
|
+
...props
|
|
974
|
+
});
|
|
975
|
+
}
|
|
976
|
+
function DropdownMenuSub({ ...props }) {
|
|
977
|
+
return /* @__PURE__ */ jsx(DropdownMenu$1.Sub, {
|
|
978
|
+
"data-slot": "dropdown-menu-sub",
|
|
979
|
+
...props
|
|
980
|
+
});
|
|
981
|
+
}
|
|
982
|
+
function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
|
|
983
|
+
return /* @__PURE__ */ jsxs(DropdownMenu$1.SubTrigger, {
|
|
984
|
+
"data-slot": "dropdown-menu-sub-trigger",
|
|
985
|
+
"data-inset": inset,
|
|
986
|
+
className: cn("flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-8 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
987
|
+
...props,
|
|
988
|
+
children: [children, /* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto" })]
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
function DropdownMenuSubContent({ className, ...props }) {
|
|
992
|
+
return /* @__PURE__ */ jsx(DropdownMenu$1.SubContent, {
|
|
993
|
+
"data-slot": "dropdown-menu-sub-content",
|
|
994
|
+
className: cn("z-50 min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 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-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", className),
|
|
995
|
+
...props
|
|
996
|
+
});
|
|
997
|
+
}
|
|
998
|
+
//#endregion
|
|
999
|
+
//#region src/components/select.tsx
|
|
1000
|
+
function Select({ ...props }) {
|
|
1001
|
+
return /* @__PURE__ */ jsx(Select$1.Root, {
|
|
1002
|
+
"data-slot": "select",
|
|
1003
|
+
...props
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1006
|
+
function SelectGroup({ className, ...props }) {
|
|
1007
|
+
return /* @__PURE__ */ jsx(Select$1.Group, {
|
|
1008
|
+
"data-slot": "select-group",
|
|
1009
|
+
className: cn("scroll-my-1 p-1", className),
|
|
1010
|
+
...props
|
|
1011
|
+
});
|
|
1012
|
+
}
|
|
1013
|
+
function SelectValue({ ...props }) {
|
|
1014
|
+
return /* @__PURE__ */ jsx(Select$1.Value, {
|
|
1015
|
+
"data-slot": "select-value",
|
|
1016
|
+
...props
|
|
1017
|
+
});
|
|
1018
|
+
}
|
|
1019
|
+
function SelectTrigger({ className, size = "default", children, ...props }) {
|
|
1020
|
+
return /* @__PURE__ */ jsxs(Select$1.Trigger, {
|
|
1021
|
+
"data-slot": "select-trigger",
|
|
1022
|
+
"data-size": size,
|
|
1023
|
+
className: cn("flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 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", className),
|
|
1024
|
+
...props,
|
|
1025
|
+
children: [children, /* @__PURE__ */ jsx(Select$1.Icon, {
|
|
1026
|
+
asChild: true,
|
|
1027
|
+
children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "pointer-events-none size-4 text-muted-foreground" })
|
|
1028
|
+
})]
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1031
|
+
function SelectContent({ className, children, position = "item-aligned", align = "center", ...props }) {
|
|
1032
|
+
return /* @__PURE__ */ jsx(Select$1.Portal, { children: /* @__PURE__ */ jsxs(Select$1.Content, {
|
|
1033
|
+
"data-slot": "select-content",
|
|
1034
|
+
"data-align-trigger": position === "item-aligned",
|
|
1035
|
+
className: cn("relative z-50 max-h-(--radix-select-content-available-height) min-w-36 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none 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-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", position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className),
|
|
1036
|
+
position,
|
|
1037
|
+
align,
|
|
1038
|
+
...props,
|
|
1039
|
+
children: [
|
|
1040
|
+
/* @__PURE__ */ jsx(SelectScrollUpButton, {}),
|
|
1041
|
+
/* @__PURE__ */ jsx(Select$1.Viewport, {
|
|
1042
|
+
"data-position": position,
|
|
1043
|
+
className: cn("data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)", position === "popper" && ""),
|
|
1044
|
+
children
|
|
1045
|
+
}),
|
|
1046
|
+
/* @__PURE__ */ jsx(SelectScrollDownButton, {})
|
|
1047
|
+
]
|
|
1048
|
+
}) });
|
|
1049
|
+
}
|
|
1050
|
+
function SelectLabel({ className, ...props }) {
|
|
1051
|
+
return /* @__PURE__ */ jsx(Select$1.Label, {
|
|
1052
|
+
"data-slot": "select-label",
|
|
1053
|
+
className: cn("px-2 py-1.5 text-xs text-muted-foreground", className),
|
|
1054
|
+
...props
|
|
1055
|
+
});
|
|
1056
|
+
}
|
|
1057
|
+
function SelectItem({ className, children, ...props }) {
|
|
1058
|
+
return /* @__PURE__ */ jsxs(Select$1.Item, {
|
|
1059
|
+
"data-slot": "select-item",
|
|
1060
|
+
className: cn("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className),
|
|
1061
|
+
...props,
|
|
1062
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1063
|
+
className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center",
|
|
1064
|
+
children: /* @__PURE__ */ jsx(Select$1.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "pointer-events-none" }) })
|
|
1065
|
+
}), /* @__PURE__ */ jsx(Select$1.ItemText, { children })]
|
|
1066
|
+
});
|
|
1067
|
+
}
|
|
1068
|
+
function SelectSeparator({ className, ...props }) {
|
|
1069
|
+
return /* @__PURE__ */ jsx(Select$1.Separator, {
|
|
1070
|
+
"data-slot": "select-separator",
|
|
1071
|
+
className: cn("pointer-events-none -mx-1 my-1 h-px bg-border", className),
|
|
1072
|
+
...props
|
|
1073
|
+
});
|
|
1074
|
+
}
|
|
1075
|
+
function SelectScrollUpButton({ className, ...props }) {
|
|
1076
|
+
return /* @__PURE__ */ jsx(Select$1.ScrollUpButton, {
|
|
1077
|
+
"data-slot": "select-scroll-up-button",
|
|
1078
|
+
className: cn("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", className),
|
|
1079
|
+
...props,
|
|
1080
|
+
children: /* @__PURE__ */ jsx(ChevronUpIcon, {})
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
1083
|
+
function SelectScrollDownButton({ className, ...props }) {
|
|
1084
|
+
return /* @__PURE__ */ jsx(Select$1.ScrollDownButton, {
|
|
1085
|
+
"data-slot": "select-scroll-down-button",
|
|
1086
|
+
className: cn("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", className),
|
|
1087
|
+
...props,
|
|
1088
|
+
children: /* @__PURE__ */ jsx(ChevronDownIcon, {})
|
|
1089
|
+
});
|
|
1090
|
+
}
|
|
1091
|
+
//#endregion
|
|
1092
|
+
//#region src/components/spinner.tsx
|
|
1093
|
+
function Spinner({ className, ...props }) {
|
|
1094
|
+
return /* @__PURE__ */ jsx(Loader2Icon, {
|
|
1095
|
+
role: "status",
|
|
1096
|
+
"aria-label": "Loading",
|
|
1097
|
+
className: cn("size-4 animate-spin", className),
|
|
1098
|
+
...props
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
//#endregion
|
|
1102
|
+
//#region src/components/ai-elements/prompt-input.tsx
|
|
1103
|
+
const convertBlobUrlToDataUrl = async (url) => {
|
|
1104
|
+
try {
|
|
1105
|
+
const blob = await (await fetch(url)).blob();
|
|
1106
|
+
return new Promise((resolve) => {
|
|
1107
|
+
const reader = new FileReader();
|
|
1108
|
+
reader.onloadend = () => resolve(reader.result);
|
|
1109
|
+
reader.onerror = () => resolve(null);
|
|
1110
|
+
reader.readAsDataURL(blob);
|
|
1111
|
+
});
|
|
1112
|
+
} catch {
|
|
1113
|
+
return null;
|
|
1114
|
+
}
|
|
1115
|
+
};
|
|
1116
|
+
const captureScreenshot = async () => {
|
|
1117
|
+
if (typeof navigator === "undefined" || !navigator.mediaDevices?.getDisplayMedia) return null;
|
|
1118
|
+
let stream = null;
|
|
1119
|
+
const video = document.createElement("video");
|
|
1120
|
+
video.muted = true;
|
|
1121
|
+
video.playsInline = true;
|
|
1122
|
+
try {
|
|
1123
|
+
stream = await navigator.mediaDevices.getDisplayMedia({
|
|
1124
|
+
audio: false,
|
|
1125
|
+
video: true
|
|
1126
|
+
});
|
|
1127
|
+
video.srcObject = stream;
|
|
1128
|
+
await new Promise((resolve, reject) => {
|
|
1129
|
+
video.onloadedmetadata = () => resolve();
|
|
1130
|
+
video.onerror = () => reject(/* @__PURE__ */ new Error("Failed to load screen stream"));
|
|
1131
|
+
});
|
|
1132
|
+
await video.play();
|
|
1133
|
+
const width = video.videoWidth;
|
|
1134
|
+
const height = video.videoHeight;
|
|
1135
|
+
if (!width || !height) return null;
|
|
1136
|
+
const canvas = document.createElement("canvas");
|
|
1137
|
+
canvas.width = width;
|
|
1138
|
+
canvas.height = height;
|
|
1139
|
+
const context = canvas.getContext("2d");
|
|
1140
|
+
if (!context) return null;
|
|
1141
|
+
context.drawImage(video, 0, 0, width, height);
|
|
1142
|
+
const blob = await new Promise((resolve) => {
|
|
1143
|
+
canvas.toBlob(resolve, "image/png");
|
|
1144
|
+
});
|
|
1145
|
+
if (!blob) return null;
|
|
1146
|
+
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replaceAll(/[:.]/g, "-").replace("T", "_").replace("Z", "");
|
|
1147
|
+
return new File([blob], `screenshot-${timestamp}.png`, {
|
|
1148
|
+
lastModified: Date.now(),
|
|
1149
|
+
type: "image/png"
|
|
1150
|
+
});
|
|
1151
|
+
} finally {
|
|
1152
|
+
if (stream) for (const track of stream.getTracks()) track.stop();
|
|
1153
|
+
video.pause();
|
|
1154
|
+
video.srcObject = null;
|
|
1155
|
+
}
|
|
1156
|
+
};
|
|
1157
|
+
const PromptInputController = createContext(null);
|
|
1158
|
+
const ProviderAttachmentsContext = createContext(null);
|
|
1159
|
+
const usePromptInputController = () => {
|
|
1160
|
+
const ctx = useContext(PromptInputController);
|
|
1161
|
+
if (!ctx) throw new Error("Wrap your component inside <PromptInputProvider> to use usePromptInputController().");
|
|
1162
|
+
return ctx;
|
|
1163
|
+
};
|
|
1164
|
+
const useOptionalPromptInputController = () => useContext(PromptInputController);
|
|
1165
|
+
const useProviderAttachments = () => {
|
|
1166
|
+
const ctx = useContext(ProviderAttachmentsContext);
|
|
1167
|
+
if (!ctx) throw new Error("Wrap your component inside <PromptInputProvider> to use useProviderAttachments().");
|
|
1168
|
+
return ctx;
|
|
1169
|
+
};
|
|
1170
|
+
const useOptionalProviderAttachments = () => useContext(ProviderAttachmentsContext);
|
|
1171
|
+
/**
|
|
1172
|
+
* Optional global provider that lifts PromptInput state outside of PromptInput.
|
|
1173
|
+
* If you don't use it, PromptInput stays fully self-managed.
|
|
1174
|
+
*/
|
|
1175
|
+
const PromptInputProvider = ({ initialInput: initialTextInput = "", children }) => {
|
|
1176
|
+
const [textInput, setTextInput] = useState(initialTextInput);
|
|
1177
|
+
const clearInput = useCallback(() => setTextInput(""), []);
|
|
1178
|
+
const [attachmentFiles, setAttachmentFiles] = useState([]);
|
|
1179
|
+
const fileInputRef = useRef(null);
|
|
1180
|
+
const openRef = useRef(() => {});
|
|
1181
|
+
const add = useCallback((files) => {
|
|
1182
|
+
const incoming = [...files];
|
|
1183
|
+
if (incoming.length === 0) return;
|
|
1184
|
+
setAttachmentFiles((prev) => [...prev, ...incoming.map((file) => ({
|
|
1185
|
+
filename: file.name,
|
|
1186
|
+
id: nanoid(),
|
|
1187
|
+
mediaType: file.type,
|
|
1188
|
+
type: "file",
|
|
1189
|
+
url: URL.createObjectURL(file)
|
|
1190
|
+
}))]);
|
|
1191
|
+
}, []);
|
|
1192
|
+
const remove = useCallback((id) => {
|
|
1193
|
+
setAttachmentFiles((prev) => {
|
|
1194
|
+
const found = prev.find((f) => f.id === id);
|
|
1195
|
+
if (found?.url) URL.revokeObjectURL(found.url);
|
|
1196
|
+
return prev.filter((f) => f.id !== id);
|
|
1197
|
+
});
|
|
1198
|
+
}, []);
|
|
1199
|
+
const clear = useCallback(() => {
|
|
1200
|
+
setAttachmentFiles((prev) => {
|
|
1201
|
+
for (const f of prev) if (f.url) URL.revokeObjectURL(f.url);
|
|
1202
|
+
return [];
|
|
1203
|
+
});
|
|
1204
|
+
}, []);
|
|
1205
|
+
const attachmentsRef = useRef(attachmentFiles);
|
|
1206
|
+
useEffect(() => {
|
|
1207
|
+
attachmentsRef.current = attachmentFiles;
|
|
1208
|
+
}, [attachmentFiles]);
|
|
1209
|
+
useEffect(() => () => {
|
|
1210
|
+
for (const f of attachmentsRef.current) if (f.url) URL.revokeObjectURL(f.url);
|
|
1211
|
+
}, []);
|
|
1212
|
+
const openFileDialog = useCallback(() => {
|
|
1213
|
+
openRef.current?.();
|
|
1214
|
+
}, []);
|
|
1215
|
+
const attachments = useMemo(() => ({
|
|
1216
|
+
add,
|
|
1217
|
+
clear,
|
|
1218
|
+
fileInputRef,
|
|
1219
|
+
files: attachmentFiles,
|
|
1220
|
+
openFileDialog,
|
|
1221
|
+
remove
|
|
1222
|
+
}), [
|
|
1223
|
+
attachmentFiles,
|
|
1224
|
+
add,
|
|
1225
|
+
remove,
|
|
1226
|
+
clear,
|
|
1227
|
+
openFileDialog
|
|
1228
|
+
]);
|
|
1229
|
+
const __registerFileInput = useCallback((ref, open) => {
|
|
1230
|
+
fileInputRef.current = ref.current;
|
|
1231
|
+
openRef.current = open;
|
|
1232
|
+
}, []);
|
|
1233
|
+
const controller = useMemo(() => ({
|
|
1234
|
+
__registerFileInput,
|
|
1235
|
+
attachments,
|
|
1236
|
+
textInput: {
|
|
1237
|
+
clear: clearInput,
|
|
1238
|
+
setInput: setTextInput,
|
|
1239
|
+
value: textInput
|
|
1240
|
+
}
|
|
1241
|
+
}), [
|
|
1242
|
+
textInput,
|
|
1243
|
+
clearInput,
|
|
1244
|
+
attachments,
|
|
1245
|
+
__registerFileInput
|
|
1246
|
+
]);
|
|
1247
|
+
return /* @__PURE__ */ jsx(PromptInputController.Provider, {
|
|
1248
|
+
value: controller,
|
|
1249
|
+
children: /* @__PURE__ */ jsx(ProviderAttachmentsContext.Provider, {
|
|
1250
|
+
value: attachments,
|
|
1251
|
+
children
|
|
1252
|
+
})
|
|
1253
|
+
});
|
|
1254
|
+
};
|
|
1255
|
+
const LocalAttachmentsContext = createContext(null);
|
|
1256
|
+
const usePromptInputAttachments = () => {
|
|
1257
|
+
const provider = useOptionalProviderAttachments();
|
|
1258
|
+
const context = useContext(LocalAttachmentsContext) ?? provider;
|
|
1259
|
+
if (!context) throw new Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");
|
|
1260
|
+
return context;
|
|
1261
|
+
};
|
|
1262
|
+
const LocalReferencedSourcesContext = createContext(null);
|
|
1263
|
+
const usePromptInputReferencedSources = () => {
|
|
1264
|
+
const ctx = useContext(LocalReferencedSourcesContext);
|
|
1265
|
+
if (!ctx) throw new Error("usePromptInputReferencedSources must be used within a LocalReferencedSourcesContext.Provider");
|
|
1266
|
+
return ctx;
|
|
1267
|
+
};
|
|
1268
|
+
const PromptInputActionAddAttachments = ({ label = "Add photos or files", ...props }) => {
|
|
1269
|
+
const attachments = usePromptInputAttachments();
|
|
1270
|
+
const handleSelect = useCallback((e) => {
|
|
1271
|
+
e.preventDefault();
|
|
1272
|
+
attachments.openFileDialog();
|
|
1273
|
+
}, [attachments]);
|
|
1274
|
+
return /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
1275
|
+
...props,
|
|
1276
|
+
onSelect: handleSelect,
|
|
1277
|
+
children: [
|
|
1278
|
+
/* @__PURE__ */ jsx(ImageIcon, { className: "mr-2 size-4" }),
|
|
1279
|
+
" ",
|
|
1280
|
+
label
|
|
1281
|
+
]
|
|
1282
|
+
});
|
|
1283
|
+
};
|
|
1284
|
+
const PromptInputActionAddScreenshot = ({ label = "Take screenshot", onSelect, ...props }) => {
|
|
1285
|
+
const attachments = usePromptInputAttachments();
|
|
1286
|
+
const handleSelect = useCallback(async (event) => {
|
|
1287
|
+
onSelect?.(event);
|
|
1288
|
+
if (event.defaultPrevented) return;
|
|
1289
|
+
try {
|
|
1290
|
+
const screenshot = await captureScreenshot();
|
|
1291
|
+
if (screenshot) attachments.add([screenshot]);
|
|
1292
|
+
} catch (error) {
|
|
1293
|
+
if (error instanceof DOMException && (error.name === "NotAllowedError" || error.name === "AbortError")) return;
|
|
1294
|
+
throw error;
|
|
1295
|
+
}
|
|
1296
|
+
}, [onSelect, attachments]);
|
|
1297
|
+
return /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
1298
|
+
...props,
|
|
1299
|
+
onSelect: handleSelect,
|
|
1300
|
+
children: [/* @__PURE__ */ jsx(Monitor, { className: "mr-2 size-4" }), label]
|
|
1301
|
+
});
|
|
1302
|
+
};
|
|
1303
|
+
const PromptInput = ({ className, groupClassName, accept, multiple, globalDrop, syncHiddenInput, maxFiles, maxFileSize, onError, onSubmit, children, ...props }) => {
|
|
1304
|
+
const controller = useOptionalPromptInputController();
|
|
1305
|
+
const usingProvider = !!controller;
|
|
1306
|
+
const inputRef = useRef(null);
|
|
1307
|
+
const formRef = useRef(null);
|
|
1308
|
+
const [items, setItems] = useState([]);
|
|
1309
|
+
const files = usingProvider ? controller.attachments.files : items;
|
|
1310
|
+
const [referencedSources, setReferencedSources] = useState([]);
|
|
1311
|
+
const filesRef = useRef(files);
|
|
1312
|
+
useEffect(() => {
|
|
1313
|
+
filesRef.current = files;
|
|
1314
|
+
}, [files]);
|
|
1315
|
+
const openFileDialogLocal = useCallback(() => {
|
|
1316
|
+
inputRef.current?.click();
|
|
1317
|
+
}, []);
|
|
1318
|
+
const matchesAccept = useCallback((f) => {
|
|
1319
|
+
if (!accept || accept.trim() === "") return true;
|
|
1320
|
+
return accept.split(",").map((s) => s.trim()).filter(Boolean).some((pattern) => {
|
|
1321
|
+
if (pattern.endsWith("/*")) {
|
|
1322
|
+
const prefix = pattern.slice(0, -1);
|
|
1323
|
+
return f.type.startsWith(prefix);
|
|
1324
|
+
}
|
|
1325
|
+
return f.type === pattern;
|
|
1326
|
+
});
|
|
1327
|
+
}, [accept]);
|
|
1328
|
+
const addLocal = useCallback((fileList) => {
|
|
1329
|
+
const incoming = [...fileList];
|
|
1330
|
+
const accepted = incoming.filter((f) => matchesAccept(f));
|
|
1331
|
+
if (incoming.length && accepted.length === 0) {
|
|
1332
|
+
onError?.({
|
|
1333
|
+
code: "accept",
|
|
1334
|
+
message: "No files match the accepted types."
|
|
1335
|
+
});
|
|
1336
|
+
return;
|
|
1337
|
+
}
|
|
1338
|
+
const withinSize = (f) => maxFileSize ? f.size <= maxFileSize : true;
|
|
1339
|
+
const sized = accepted.filter(withinSize);
|
|
1340
|
+
if (accepted.length > 0 && sized.length === 0) {
|
|
1341
|
+
onError?.({
|
|
1342
|
+
code: "max_file_size",
|
|
1343
|
+
message: "All files exceed the maximum size."
|
|
1344
|
+
});
|
|
1345
|
+
return;
|
|
1346
|
+
}
|
|
1347
|
+
setItems((prev) => {
|
|
1348
|
+
const capacity = typeof maxFiles === "number" ? Math.max(0, maxFiles - prev.length) : void 0;
|
|
1349
|
+
const capped = typeof capacity === "number" ? sized.slice(0, capacity) : sized;
|
|
1350
|
+
if (typeof capacity === "number" && sized.length > capacity) onError?.({
|
|
1351
|
+
code: "max_files",
|
|
1352
|
+
message: "Too many files. Some were not added."
|
|
1353
|
+
});
|
|
1354
|
+
const next = [];
|
|
1355
|
+
for (const file of capped) next.push({
|
|
1356
|
+
filename: file.name,
|
|
1357
|
+
id: nanoid(),
|
|
1358
|
+
mediaType: file.type,
|
|
1359
|
+
type: "file",
|
|
1360
|
+
url: URL.createObjectURL(file)
|
|
1361
|
+
});
|
|
1362
|
+
return [...prev, ...next];
|
|
1363
|
+
});
|
|
1364
|
+
}, [
|
|
1365
|
+
matchesAccept,
|
|
1366
|
+
maxFiles,
|
|
1367
|
+
maxFileSize,
|
|
1368
|
+
onError
|
|
1369
|
+
]);
|
|
1370
|
+
const removeLocal = useCallback((id) => setItems((prev) => {
|
|
1371
|
+
const found = prev.find((file) => file.id === id);
|
|
1372
|
+
if (found?.url) URL.revokeObjectURL(found.url);
|
|
1373
|
+
return prev.filter((file) => file.id !== id);
|
|
1374
|
+
}), []);
|
|
1375
|
+
const addWithProviderValidation = useCallback((fileList) => {
|
|
1376
|
+
const incoming = [...fileList];
|
|
1377
|
+
const accepted = incoming.filter((f) => matchesAccept(f));
|
|
1378
|
+
if (incoming.length && accepted.length === 0) {
|
|
1379
|
+
onError?.({
|
|
1380
|
+
code: "accept",
|
|
1381
|
+
message: "No files match the accepted types."
|
|
1382
|
+
});
|
|
1383
|
+
return;
|
|
1384
|
+
}
|
|
1385
|
+
const withinSize = (f) => maxFileSize ? f.size <= maxFileSize : true;
|
|
1386
|
+
const sized = accepted.filter(withinSize);
|
|
1387
|
+
if (accepted.length > 0 && sized.length === 0) {
|
|
1388
|
+
onError?.({
|
|
1389
|
+
code: "max_file_size",
|
|
1390
|
+
message: "All files exceed the maximum size."
|
|
1391
|
+
});
|
|
1392
|
+
return;
|
|
1393
|
+
}
|
|
1394
|
+
const currentCount = files.length;
|
|
1395
|
+
const capacity = typeof maxFiles === "number" ? Math.max(0, maxFiles - currentCount) : void 0;
|
|
1396
|
+
const capped = typeof capacity === "number" ? sized.slice(0, capacity) : sized;
|
|
1397
|
+
if (typeof capacity === "number" && sized.length > capacity) onError?.({
|
|
1398
|
+
code: "max_files",
|
|
1399
|
+
message: "Too many files. Some were not added."
|
|
1400
|
+
});
|
|
1401
|
+
if (capped.length > 0) controller?.attachments.add(capped);
|
|
1402
|
+
}, [
|
|
1403
|
+
matchesAccept,
|
|
1404
|
+
maxFileSize,
|
|
1405
|
+
maxFiles,
|
|
1406
|
+
onError,
|
|
1407
|
+
files.length,
|
|
1408
|
+
controller
|
|
1409
|
+
]);
|
|
1410
|
+
const clearAttachments = useCallback(() => usingProvider ? controller?.attachments.clear() : setItems((prev) => {
|
|
1411
|
+
for (const file of prev) if (file.url) URL.revokeObjectURL(file.url);
|
|
1412
|
+
return [];
|
|
1413
|
+
}), [usingProvider, controller]);
|
|
1414
|
+
const clearReferencedSources = useCallback(() => setReferencedSources([]), []);
|
|
1415
|
+
const add = usingProvider ? addWithProviderValidation : addLocal;
|
|
1416
|
+
const remove = usingProvider ? controller.attachments.remove : removeLocal;
|
|
1417
|
+
const openFileDialog = usingProvider ? controller.attachments.openFileDialog : openFileDialogLocal;
|
|
1418
|
+
const clear = useCallback(() => {
|
|
1419
|
+
clearAttachments();
|
|
1420
|
+
clearReferencedSources();
|
|
1421
|
+
}, [clearAttachments, clearReferencedSources]);
|
|
1422
|
+
useEffect(() => {
|
|
1423
|
+
if (!usingProvider) return;
|
|
1424
|
+
controller.__registerFileInput(inputRef, () => inputRef.current?.click());
|
|
1425
|
+
}, [usingProvider, controller]);
|
|
1426
|
+
useEffect(() => {
|
|
1427
|
+
if (syncHiddenInput && inputRef.current && files.length === 0) inputRef.current.value = "";
|
|
1428
|
+
}, [files, syncHiddenInput]);
|
|
1429
|
+
useEffect(() => {
|
|
1430
|
+
const form = formRef.current;
|
|
1431
|
+
if (!form) return;
|
|
1432
|
+
if (globalDrop) return;
|
|
1433
|
+
const onDragOver = (e) => {
|
|
1434
|
+
if (e.dataTransfer?.types?.includes("Files")) e.preventDefault();
|
|
1435
|
+
};
|
|
1436
|
+
const onDrop = (e) => {
|
|
1437
|
+
if (e.dataTransfer?.types?.includes("Files")) e.preventDefault();
|
|
1438
|
+
if (e.dataTransfer?.files && e.dataTransfer.files.length > 0) add(e.dataTransfer.files);
|
|
1439
|
+
};
|
|
1440
|
+
form.addEventListener("dragover", onDragOver);
|
|
1441
|
+
form.addEventListener("drop", onDrop);
|
|
1442
|
+
return () => {
|
|
1443
|
+
form.removeEventListener("dragover", onDragOver);
|
|
1444
|
+
form.removeEventListener("drop", onDrop);
|
|
1445
|
+
};
|
|
1446
|
+
}, [add, globalDrop]);
|
|
1447
|
+
useEffect(() => {
|
|
1448
|
+
if (!globalDrop) return;
|
|
1449
|
+
const onDragOver = (e) => {
|
|
1450
|
+
if (e.dataTransfer?.types?.includes("Files")) e.preventDefault();
|
|
1451
|
+
};
|
|
1452
|
+
const onDrop = (e) => {
|
|
1453
|
+
if (e.dataTransfer?.types?.includes("Files")) e.preventDefault();
|
|
1454
|
+
if (e.dataTransfer?.files && e.dataTransfer.files.length > 0) add(e.dataTransfer.files);
|
|
1455
|
+
};
|
|
1456
|
+
document.addEventListener("dragover", onDragOver);
|
|
1457
|
+
document.addEventListener("drop", onDrop);
|
|
1458
|
+
return () => {
|
|
1459
|
+
document.removeEventListener("dragover", onDragOver);
|
|
1460
|
+
document.removeEventListener("drop", onDrop);
|
|
1461
|
+
};
|
|
1462
|
+
}, [add, globalDrop]);
|
|
1463
|
+
useEffect(() => () => {
|
|
1464
|
+
if (!usingProvider) {
|
|
1465
|
+
for (const f of filesRef.current) if (f.url) URL.revokeObjectURL(f.url);
|
|
1466
|
+
}
|
|
1467
|
+
}, [usingProvider]);
|
|
1468
|
+
const handleChange = useCallback((event) => {
|
|
1469
|
+
if (event.currentTarget.files) add(event.currentTarget.files);
|
|
1470
|
+
event.currentTarget.value = "";
|
|
1471
|
+
}, [add]);
|
|
1472
|
+
const attachmentsCtx = useMemo(() => ({
|
|
1473
|
+
add,
|
|
1474
|
+
clear: clearAttachments,
|
|
1475
|
+
fileInputRef: inputRef,
|
|
1476
|
+
files: files.map((item) => ({
|
|
1477
|
+
...item,
|
|
1478
|
+
id: item.id
|
|
1479
|
+
})),
|
|
1480
|
+
openFileDialog,
|
|
1481
|
+
remove
|
|
1482
|
+
}), [
|
|
1483
|
+
files,
|
|
1484
|
+
add,
|
|
1485
|
+
remove,
|
|
1486
|
+
clearAttachments,
|
|
1487
|
+
openFileDialog
|
|
1488
|
+
]);
|
|
1489
|
+
const refsCtx = useMemo(() => ({
|
|
1490
|
+
add: (incoming) => {
|
|
1491
|
+
const array = Array.isArray(incoming) ? incoming : [incoming];
|
|
1492
|
+
setReferencedSources((prev) => [...prev, ...array.map((s) => ({
|
|
1493
|
+
...s,
|
|
1494
|
+
id: nanoid()
|
|
1495
|
+
}))]);
|
|
1496
|
+
},
|
|
1497
|
+
clear: clearReferencedSources,
|
|
1498
|
+
remove: (id) => {
|
|
1499
|
+
setReferencedSources((prev) => prev.filter((s) => s.id !== id));
|
|
1500
|
+
},
|
|
1501
|
+
sources: referencedSources
|
|
1502
|
+
}), [referencedSources, clearReferencedSources]);
|
|
1503
|
+
const handleSubmit = useCallback(async (event) => {
|
|
1504
|
+
event.preventDefault();
|
|
1505
|
+
const form = event.currentTarget;
|
|
1506
|
+
const text = usingProvider ? controller.textInput.value : new FormData(form).get("message") || "";
|
|
1507
|
+
if (!usingProvider) form.reset();
|
|
1508
|
+
try {
|
|
1509
|
+
const result = onSubmit({
|
|
1510
|
+
files: await Promise.all(files.map(async ({ id: _id, ...item }) => {
|
|
1511
|
+
if (item.url?.startsWith("blob:")) {
|
|
1512
|
+
const dataUrl = await convertBlobUrlToDataUrl(item.url);
|
|
1513
|
+
return {
|
|
1514
|
+
...item,
|
|
1515
|
+
url: dataUrl ?? item.url
|
|
1516
|
+
};
|
|
1517
|
+
}
|
|
1518
|
+
return item;
|
|
1519
|
+
})),
|
|
1520
|
+
text
|
|
1521
|
+
}, event);
|
|
1522
|
+
if (result instanceof Promise) try {
|
|
1523
|
+
await result;
|
|
1524
|
+
clear();
|
|
1525
|
+
if (usingProvider) controller.textInput.clear();
|
|
1526
|
+
} catch {}
|
|
1527
|
+
else {
|
|
1528
|
+
clear();
|
|
1529
|
+
if (usingProvider) controller.textInput.clear();
|
|
1530
|
+
}
|
|
1531
|
+
} catch {}
|
|
1532
|
+
}, [
|
|
1533
|
+
usingProvider,
|
|
1534
|
+
controller,
|
|
1535
|
+
files,
|
|
1536
|
+
onSubmit,
|
|
1537
|
+
clear
|
|
1538
|
+
]);
|
|
1539
|
+
const inner = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("input", {
|
|
1540
|
+
accept,
|
|
1541
|
+
"aria-label": "Upload files",
|
|
1542
|
+
className: "hidden",
|
|
1543
|
+
multiple,
|
|
1544
|
+
onChange: handleChange,
|
|
1545
|
+
ref: inputRef,
|
|
1546
|
+
title: "Upload files",
|
|
1547
|
+
type: "file"
|
|
1548
|
+
}), /* @__PURE__ */ jsx("form", {
|
|
1549
|
+
className: cn("w-full", className),
|
|
1550
|
+
onSubmit: handleSubmit,
|
|
1551
|
+
ref: formRef,
|
|
1552
|
+
...props,
|
|
1553
|
+
children: /* @__PURE__ */ jsx(InputGroup, {
|
|
1554
|
+
className: cn("overflow-hidden bg-white dark:bg-white", groupClassName),
|
|
1555
|
+
children
|
|
1556
|
+
})
|
|
1557
|
+
})] });
|
|
1558
|
+
const withReferencedSources = /* @__PURE__ */ jsx(LocalReferencedSourcesContext.Provider, {
|
|
1559
|
+
value: refsCtx,
|
|
1560
|
+
children: inner
|
|
1561
|
+
});
|
|
1562
|
+
return /* @__PURE__ */ jsx(LocalAttachmentsContext.Provider, {
|
|
1563
|
+
value: attachmentsCtx,
|
|
1564
|
+
children: withReferencedSources
|
|
1565
|
+
});
|
|
1566
|
+
};
|
|
1567
|
+
const PromptInputBody = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
1568
|
+
className: cn("contents", className),
|
|
1569
|
+
...props
|
|
1570
|
+
});
|
|
1571
|
+
const PromptInputTextarea = ({ onChange, onKeyDown, className, placeholder = "What would you like to know?", ...props }) => {
|
|
1572
|
+
const controller = useOptionalPromptInputController();
|
|
1573
|
+
const attachments = usePromptInputAttachments();
|
|
1574
|
+
const [isComposing, setIsComposing] = useState(false);
|
|
1575
|
+
const handleKeyDown = useCallback((e) => {
|
|
1576
|
+
onKeyDown?.(e);
|
|
1577
|
+
if (e.defaultPrevented) return;
|
|
1578
|
+
if (e.key === "Enter") {
|
|
1579
|
+
if (isComposing || e.nativeEvent.isComposing) return;
|
|
1580
|
+
if (e.shiftKey) return;
|
|
1581
|
+
e.preventDefault();
|
|
1582
|
+
const { form } = e.currentTarget;
|
|
1583
|
+
if ((form?.querySelector("button[type=\"submit\"]"))?.disabled) return;
|
|
1584
|
+
form?.requestSubmit();
|
|
1585
|
+
}
|
|
1586
|
+
if (e.key === "Backspace" && e.currentTarget.value === "" && attachments.files.length > 0) {
|
|
1587
|
+
e.preventDefault();
|
|
1588
|
+
const lastAttachment = attachments.files.at(-1);
|
|
1589
|
+
if (lastAttachment) attachments.remove(lastAttachment.id);
|
|
1590
|
+
}
|
|
1591
|
+
}, [
|
|
1592
|
+
onKeyDown,
|
|
1593
|
+
isComposing,
|
|
1594
|
+
attachments
|
|
1595
|
+
]);
|
|
1596
|
+
const handlePaste = useCallback((event) => {
|
|
1597
|
+
const items = event.clipboardData?.items;
|
|
1598
|
+
if (!items) return;
|
|
1599
|
+
const files = [];
|
|
1600
|
+
for (const item of items) if (item.kind === "file") {
|
|
1601
|
+
const file = item.getAsFile();
|
|
1602
|
+
if (file) files.push(file);
|
|
1603
|
+
}
|
|
1604
|
+
if (files.length > 0) {
|
|
1605
|
+
event.preventDefault();
|
|
1606
|
+
attachments.add(files);
|
|
1607
|
+
}
|
|
1608
|
+
}, [attachments]);
|
|
1609
|
+
const handleCompositionEnd = useCallback(() => setIsComposing(false), []);
|
|
1610
|
+
const handleCompositionStart = useCallback(() => setIsComposing(true), []);
|
|
1611
|
+
const controlledProps = controller ? {
|
|
1612
|
+
onChange: (e) => {
|
|
1613
|
+
controller.textInput.setInput(e.currentTarget.value);
|
|
1614
|
+
onChange?.(e);
|
|
1615
|
+
},
|
|
1616
|
+
value: controller.textInput.value
|
|
1617
|
+
} : { onChange };
|
|
1618
|
+
return /* @__PURE__ */ jsx(InputGroupTextarea, {
|
|
1619
|
+
className: cn("field-sizing-content max-h-48 min-h-16", className),
|
|
1620
|
+
name: "message",
|
|
1621
|
+
onCompositionEnd: handleCompositionEnd,
|
|
1622
|
+
onCompositionStart: handleCompositionStart,
|
|
1623
|
+
onKeyDown: handleKeyDown,
|
|
1624
|
+
onPaste: handlePaste,
|
|
1625
|
+
placeholder,
|
|
1626
|
+
...props,
|
|
1627
|
+
...controlledProps
|
|
1628
|
+
});
|
|
1629
|
+
};
|
|
1630
|
+
const PromptInputHeader = ({ className, ...props }) => /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
1631
|
+
align: "block-end",
|
|
1632
|
+
className: cn("order-first flex-wrap gap-1", className),
|
|
1633
|
+
...props
|
|
1634
|
+
});
|
|
1635
|
+
const PromptInputFooter = ({ className, ...props }) => /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
1636
|
+
align: "block-end",
|
|
1637
|
+
className: cn("justify-between gap-1", className),
|
|
1638
|
+
...props
|
|
1639
|
+
});
|
|
1640
|
+
const PromptInputTools = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
1641
|
+
className: cn("flex min-w-0 items-center gap-1", className),
|
|
1642
|
+
...props
|
|
1643
|
+
});
|
|
1644
|
+
const PromptInputButton = ({ variant = "ghost", className, size, tooltip, ...props }) => {
|
|
1645
|
+
const newSize = size ?? (Children.count(props.children) > 1 ? "sm" : "icon-sm");
|
|
1646
|
+
const button = /* @__PURE__ */ jsx(InputGroupButton, {
|
|
1647
|
+
className: cn(className),
|
|
1648
|
+
size: newSize,
|
|
1649
|
+
type: "button",
|
|
1650
|
+
variant,
|
|
1651
|
+
...props
|
|
1652
|
+
});
|
|
1653
|
+
if (!tooltip) return button;
|
|
1654
|
+
const tooltipContent = typeof tooltip === "string" ? tooltip : tooltip.content;
|
|
1655
|
+
const shortcut = typeof tooltip === "string" ? void 0 : tooltip.shortcut;
|
|
1656
|
+
const side = typeof tooltip === "string" ? "top" : tooltip.side ?? "top";
|
|
1657
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
1658
|
+
asChild: true,
|
|
1659
|
+
children: button
|
|
1660
|
+
}), /* @__PURE__ */ jsxs(TooltipContent, {
|
|
1661
|
+
side,
|
|
1662
|
+
children: [tooltipContent, shortcut && /* @__PURE__ */ jsx("span", {
|
|
1663
|
+
className: "ml-2 text-muted-foreground",
|
|
1664
|
+
children: shortcut
|
|
1665
|
+
})]
|
|
1666
|
+
})] });
|
|
1667
|
+
};
|
|
1668
|
+
const PromptInputActionMenu = (props) => /* @__PURE__ */ jsx(DropdownMenu, { ...props });
|
|
1669
|
+
const PromptInputActionMenuTrigger = ({ className, children, ...props }) => /* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
1670
|
+
asChild: true,
|
|
1671
|
+
children: /* @__PURE__ */ jsx(PromptInputButton, {
|
|
1672
|
+
className,
|
|
1673
|
+
...props,
|
|
1674
|
+
children: children ?? /* @__PURE__ */ jsx(PlusIcon, { className: "size-4" })
|
|
1675
|
+
})
|
|
1676
|
+
});
|
|
1677
|
+
const PromptInputActionMenuContent = ({ className, ...props }) => /* @__PURE__ */ jsx(DropdownMenuContent, {
|
|
1678
|
+
align: "start",
|
|
1679
|
+
className: cn(className),
|
|
1680
|
+
...props
|
|
1681
|
+
});
|
|
1682
|
+
const PromptInputActionMenuItem = ({ className, ...props }) => /* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
1683
|
+
className: cn(className),
|
|
1684
|
+
...props
|
|
1685
|
+
});
|
|
1686
|
+
const PromptInputSubmit = ({ className, variant = "default", size = "icon-sm", status, onStop, onClick, children, ...props }) => {
|
|
1687
|
+
const isGenerating = status === "submitted" || status === "streaming";
|
|
1688
|
+
let Icon = /* @__PURE__ */ jsx(ArrowUpIcon, { className: "size-4" });
|
|
1689
|
+
if (status === "submitted") Icon = /* @__PURE__ */ jsx(Spinner, {});
|
|
1690
|
+
else if (status === "streaming") Icon = /* @__PURE__ */ jsx(SquareIcon, { className: "size-4" });
|
|
1691
|
+
else if (status === "error") Icon = /* @__PURE__ */ jsx(XIcon, { className: "size-4" });
|
|
1692
|
+
const handleClick = useCallback((e) => {
|
|
1693
|
+
if (isGenerating && onStop) {
|
|
1694
|
+
e.preventDefault();
|
|
1695
|
+
onStop();
|
|
1696
|
+
return;
|
|
1697
|
+
}
|
|
1698
|
+
onClick?.(e);
|
|
1699
|
+
}, [
|
|
1700
|
+
isGenerating,
|
|
1701
|
+
onStop,
|
|
1702
|
+
onClick
|
|
1703
|
+
]);
|
|
1704
|
+
return /* @__PURE__ */ jsx(InputGroupButton, {
|
|
1705
|
+
"aria-label": isGenerating ? "Stop" : "Submit",
|
|
1706
|
+
className: cn(className),
|
|
1707
|
+
onClick: handleClick,
|
|
1708
|
+
size,
|
|
1709
|
+
type: isGenerating && onStop ? "button" : "submit",
|
|
1710
|
+
variant,
|
|
1711
|
+
...props,
|
|
1712
|
+
children: children ?? Icon
|
|
1713
|
+
});
|
|
1714
|
+
};
|
|
1715
|
+
const PromptInputSelect = (props) => /* @__PURE__ */ jsx(Select, { ...props });
|
|
1716
|
+
const PromptInputSelectTrigger = ({ className, ...props }) => /* @__PURE__ */ jsx(SelectTrigger, {
|
|
1717
|
+
className: cn("border-none bg-transparent font-medium text-muted-foreground shadow-none transition-colors", "hover:bg-accent hover:text-foreground aria-expanded:bg-accent aria-expanded:text-foreground", className),
|
|
1718
|
+
...props
|
|
1719
|
+
});
|
|
1720
|
+
const PromptInputSelectContent = ({ className, ...props }) => /* @__PURE__ */ jsx(SelectContent, {
|
|
1721
|
+
className: cn(className),
|
|
1722
|
+
...props
|
|
1723
|
+
});
|
|
1724
|
+
const PromptInputSelectItem = ({ className, ...props }) => /* @__PURE__ */ jsx(SelectItem, {
|
|
1725
|
+
className: cn(className),
|
|
1726
|
+
...props
|
|
1727
|
+
});
|
|
1728
|
+
const PromptInputSelectValue = ({ className, ...props }) => /* @__PURE__ */ jsx(SelectValue, {
|
|
1729
|
+
className: cn(className),
|
|
1730
|
+
...props
|
|
1731
|
+
});
|
|
1732
|
+
const PromptInputHoverCard = ({ openDelay = 0, closeDelay = 0, ...props }) => /* @__PURE__ */ jsx(HoverCard, {
|
|
1733
|
+
closeDelay,
|
|
1734
|
+
openDelay,
|
|
1735
|
+
...props
|
|
1736
|
+
});
|
|
1737
|
+
const PromptInputHoverCardTrigger = (props) => /* @__PURE__ */ jsx(HoverCardTrigger, { ...props });
|
|
1738
|
+
const PromptInputHoverCardContent = ({ align = "start", ...props }) => /* @__PURE__ */ jsx(HoverCardContent, {
|
|
1739
|
+
align,
|
|
1740
|
+
...props
|
|
1741
|
+
});
|
|
1742
|
+
const PromptInputTabsList = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
1743
|
+
className: cn(className),
|
|
1744
|
+
...props
|
|
1745
|
+
});
|
|
1746
|
+
const PromptInputTab = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
1747
|
+
className: cn(className),
|
|
1748
|
+
...props
|
|
1749
|
+
});
|
|
1750
|
+
const PromptInputTabLabel = ({ className, ...props }) => /* @__PURE__ */ jsx("h3", {
|
|
1751
|
+
className: cn("mb-2 px-3 font-medium text-muted-foreground text-xs", className),
|
|
1752
|
+
...props
|
|
1753
|
+
});
|
|
1754
|
+
const PromptInputTabBody = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
1755
|
+
className: cn("space-y-1", className),
|
|
1756
|
+
...props
|
|
1757
|
+
});
|
|
1758
|
+
const PromptInputTabItem = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
1759
|
+
className: cn("flex items-center gap-2 px-3 py-2 text-xs hover:bg-accent", className),
|
|
1760
|
+
...props
|
|
1761
|
+
});
|
|
1762
|
+
const PromptInputCommand = ({ className, ...props }) => /* @__PURE__ */ jsx(Command, {
|
|
1763
|
+
className: cn(className),
|
|
1764
|
+
...props
|
|
1765
|
+
});
|
|
1766
|
+
const PromptInputCommandInput = ({ className, ...props }) => /* @__PURE__ */ jsx(CommandInput, {
|
|
1767
|
+
className: cn(className),
|
|
1768
|
+
...props
|
|
1769
|
+
});
|
|
1770
|
+
const PromptInputCommandList = ({ className, ...props }) => /* @__PURE__ */ jsx(CommandList, {
|
|
1771
|
+
className: cn(className),
|
|
1772
|
+
...props
|
|
1773
|
+
});
|
|
1774
|
+
const PromptInputCommandEmpty = ({ className, ...props }) => /* @__PURE__ */ jsx(CommandEmpty, {
|
|
1775
|
+
className: cn(className),
|
|
1776
|
+
...props
|
|
1777
|
+
});
|
|
1778
|
+
const PromptInputCommandGroup = ({ className, ...props }) => /* @__PURE__ */ jsx(CommandGroup, {
|
|
1779
|
+
className: cn(className),
|
|
1780
|
+
...props
|
|
1781
|
+
});
|
|
1782
|
+
const PromptInputCommandItem = ({ className, ...props }) => /* @__PURE__ */ jsx(CommandItem, {
|
|
1783
|
+
className: cn(className),
|
|
1784
|
+
...props
|
|
1785
|
+
});
|
|
1786
|
+
const PromptInputCommandSeparator = ({ className, ...props }) => /* @__PURE__ */ jsx(CommandSeparator, {
|
|
1787
|
+
className: cn(className),
|
|
1788
|
+
...props
|
|
1789
|
+
});
|
|
1790
|
+
//#endregion
|
|
1791
|
+
//#region src/components/ai-elements/speech-input.tsx
|
|
1792
|
+
const detectSpeechInputMode = () => {
|
|
1793
|
+
if (typeof window === "undefined") return "none";
|
|
1794
|
+
if ("SpeechRecognition" in window || "webkitSpeechRecognition" in window) return "speech-recognition";
|
|
1795
|
+
if ("MediaRecorder" in window && "mediaDevices" in navigator) return "media-recorder";
|
|
1796
|
+
return "none";
|
|
1797
|
+
};
|
|
1798
|
+
const SpeechInput = ({ className, onTranscriptionChange, onAudioRecorded, lang = "en-US", ...props }) => {
|
|
1799
|
+
const [isListening, setIsListening] = useState(false);
|
|
1800
|
+
const [isProcessing, setIsProcessing] = useState(false);
|
|
1801
|
+
const [mode] = useState(detectSpeechInputMode);
|
|
1802
|
+
const [isRecognitionReady, setIsRecognitionReady] = useState(false);
|
|
1803
|
+
const recognitionRef = useRef(null);
|
|
1804
|
+
const mediaRecorderRef = useRef(null);
|
|
1805
|
+
const streamRef = useRef(null);
|
|
1806
|
+
const audioChunksRef = useRef([]);
|
|
1807
|
+
const onTranscriptionChangeRef = useRef(onTranscriptionChange);
|
|
1808
|
+
const onAudioRecordedRef = useRef(onAudioRecorded);
|
|
1809
|
+
onTranscriptionChangeRef.current = onTranscriptionChange;
|
|
1810
|
+
onAudioRecordedRef.current = onAudioRecorded;
|
|
1811
|
+
useEffect(() => {
|
|
1812
|
+
if (mode !== "speech-recognition") return;
|
|
1813
|
+
const speechRecognition = new (window.SpeechRecognition || window.webkitSpeechRecognition)();
|
|
1814
|
+
speechRecognition.continuous = true;
|
|
1815
|
+
speechRecognition.interimResults = true;
|
|
1816
|
+
speechRecognition.lang = lang;
|
|
1817
|
+
const handleStart = () => {
|
|
1818
|
+
setIsListening(true);
|
|
1819
|
+
};
|
|
1820
|
+
const handleEnd = () => {
|
|
1821
|
+
setIsListening(false);
|
|
1822
|
+
};
|
|
1823
|
+
const handleResult = (event) => {
|
|
1824
|
+
const speechEvent = event;
|
|
1825
|
+
let finalTranscript = "";
|
|
1826
|
+
for (let i = speechEvent.resultIndex; i < speechEvent.results.length; i += 1) {
|
|
1827
|
+
const result = speechEvent.results[i];
|
|
1828
|
+
if (result.isFinal) finalTranscript += result[0]?.transcript ?? "";
|
|
1829
|
+
}
|
|
1830
|
+
if (finalTranscript) onTranscriptionChangeRef.current?.(finalTranscript);
|
|
1831
|
+
};
|
|
1832
|
+
const handleError = () => {
|
|
1833
|
+
setIsListening(false);
|
|
1834
|
+
};
|
|
1835
|
+
speechRecognition.addEventListener("start", handleStart);
|
|
1836
|
+
speechRecognition.addEventListener("end", handleEnd);
|
|
1837
|
+
speechRecognition.addEventListener("result", handleResult);
|
|
1838
|
+
speechRecognition.addEventListener("error", handleError);
|
|
1839
|
+
recognitionRef.current = speechRecognition;
|
|
1840
|
+
setIsRecognitionReady(true);
|
|
1841
|
+
return () => {
|
|
1842
|
+
speechRecognition.removeEventListener("start", handleStart);
|
|
1843
|
+
speechRecognition.removeEventListener("end", handleEnd);
|
|
1844
|
+
speechRecognition.removeEventListener("result", handleResult);
|
|
1845
|
+
speechRecognition.removeEventListener("error", handleError);
|
|
1846
|
+
speechRecognition.stop();
|
|
1847
|
+
recognitionRef.current = null;
|
|
1848
|
+
setIsRecognitionReady(false);
|
|
1849
|
+
};
|
|
1850
|
+
}, [mode, lang]);
|
|
1851
|
+
useEffect(() => () => {
|
|
1852
|
+
if (mediaRecorderRef.current?.state === "recording") mediaRecorderRef.current.stop();
|
|
1853
|
+
if (streamRef.current) for (const track of streamRef.current.getTracks()) track.stop();
|
|
1854
|
+
}, []);
|
|
1855
|
+
const startMediaRecorder = useCallback(async () => {
|
|
1856
|
+
if (!onAudioRecordedRef.current) return;
|
|
1857
|
+
try {
|
|
1858
|
+
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
|
|
1859
|
+
streamRef.current = stream;
|
|
1860
|
+
const mediaRecorder = new MediaRecorder(stream);
|
|
1861
|
+
audioChunksRef.current = [];
|
|
1862
|
+
const handleDataAvailable = (event) => {
|
|
1863
|
+
if (event.data.size > 0) audioChunksRef.current.push(event.data);
|
|
1864
|
+
};
|
|
1865
|
+
const handleStop = async () => {
|
|
1866
|
+
for (const track of stream.getTracks()) track.stop();
|
|
1867
|
+
streamRef.current = null;
|
|
1868
|
+
const audioBlob = new Blob(audioChunksRef.current, { type: "audio/webm" });
|
|
1869
|
+
if (audioBlob.size > 0 && onAudioRecordedRef.current) {
|
|
1870
|
+
setIsProcessing(true);
|
|
1871
|
+
try {
|
|
1872
|
+
const transcript = await onAudioRecordedRef.current(audioBlob);
|
|
1873
|
+
if (transcript) onTranscriptionChangeRef.current?.(transcript);
|
|
1874
|
+
} catch {} finally {
|
|
1875
|
+
setIsProcessing(false);
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
};
|
|
1879
|
+
const handleError = () => {
|
|
1880
|
+
setIsListening(false);
|
|
1881
|
+
for (const track of stream.getTracks()) track.stop();
|
|
1882
|
+
streamRef.current = null;
|
|
1883
|
+
};
|
|
1884
|
+
mediaRecorder.addEventListener("dataavailable", handleDataAvailable);
|
|
1885
|
+
mediaRecorder.addEventListener("stop", handleStop);
|
|
1886
|
+
mediaRecorder.addEventListener("error", handleError);
|
|
1887
|
+
mediaRecorderRef.current = mediaRecorder;
|
|
1888
|
+
mediaRecorder.start();
|
|
1889
|
+
setIsListening(true);
|
|
1890
|
+
} catch {
|
|
1891
|
+
setIsListening(false);
|
|
1892
|
+
}
|
|
1893
|
+
}, []);
|
|
1894
|
+
const stopMediaRecorder = useCallback(() => {
|
|
1895
|
+
if (mediaRecorderRef.current?.state === "recording") mediaRecorderRef.current.stop();
|
|
1896
|
+
setIsListening(false);
|
|
1897
|
+
}, []);
|
|
1898
|
+
const toggleListening = useCallback(() => {
|
|
1899
|
+
if (mode === "speech-recognition" && recognitionRef.current) if (isListening) recognitionRef.current.stop();
|
|
1900
|
+
else recognitionRef.current.start();
|
|
1901
|
+
else if (mode === "media-recorder") if (isListening) stopMediaRecorder();
|
|
1902
|
+
else startMediaRecorder();
|
|
1903
|
+
}, [
|
|
1904
|
+
mode,
|
|
1905
|
+
isListening,
|
|
1906
|
+
startMediaRecorder,
|
|
1907
|
+
stopMediaRecorder
|
|
1908
|
+
]);
|
|
1909
|
+
const isDisabled = mode === "none" || mode === "speech-recognition" && !isRecognitionReady || mode === "media-recorder" && !onAudioRecorded || isProcessing;
|
|
1910
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1911
|
+
className: "relative inline-flex items-center justify-center",
|
|
1912
|
+
children: [isListening && [
|
|
1913
|
+
0,
|
|
1914
|
+
1,
|
|
1915
|
+
2
|
|
1916
|
+
].map((index) => /* @__PURE__ */ jsx("div", {
|
|
1917
|
+
className: "absolute inset-0 animate-ping rounded-full border-2 border-red-400/30",
|
|
1918
|
+
style: {
|
|
1919
|
+
animationDelay: `${index * .3}s`,
|
|
1920
|
+
animationDuration: "2s"
|
|
1921
|
+
}
|
|
1922
|
+
}, index)), /* @__PURE__ */ jsxs(Button, {
|
|
1923
|
+
className: cn("relative z-10 rounded-full transition-all duration-300", isListening ? "bg-destructive text-white hover:bg-destructive/80 hover:text-white" : "bg-primary text-primary-foreground hover:bg-primary/80 hover:text-primary-foreground", className),
|
|
1924
|
+
disabled: isDisabled,
|
|
1925
|
+
onClick: toggleListening,
|
|
1926
|
+
...props,
|
|
1927
|
+
children: [
|
|
1928
|
+
isProcessing && /* @__PURE__ */ jsx(Spinner, {}),
|
|
1929
|
+
!isProcessing && isListening && /* @__PURE__ */ jsx(SquareIcon, { className: "size-4" }),
|
|
1930
|
+
!(isProcessing || isListening) && /* @__PURE__ */ jsx(MicIcon, { className: "size-4" })
|
|
1931
|
+
]
|
|
1932
|
+
})]
|
|
1933
|
+
});
|
|
1934
|
+
};
|
|
1935
|
+
//#endregion
|
|
1936
|
+
//#region src/components/alert.tsx
|
|
1937
|
+
const alertVariants = cva("group/alert relative grid w-full gap-0.5 rounded-lg border px-4 py-3 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4", {
|
|
1938
|
+
variants: { variant: {
|
|
1939
|
+
default: "bg-card text-card-foreground",
|
|
1940
|
+
destructive: "bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current"
|
|
1941
|
+
} },
|
|
1942
|
+
defaultVariants: { variant: "default" }
|
|
1943
|
+
});
|
|
1944
|
+
function Alert({ className, variant, ...props }) {
|
|
1945
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1946
|
+
"data-slot": "alert",
|
|
1947
|
+
role: "alert",
|
|
1948
|
+
className: cn(alertVariants({ variant }), className),
|
|
1949
|
+
...props
|
|
1950
|
+
});
|
|
1951
|
+
}
|
|
1952
|
+
function AlertTitle({ className, ...props }) {
|
|
1953
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1954
|
+
"data-slot": "alert-title",
|
|
1955
|
+
className: cn("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground", className),
|
|
1956
|
+
...props
|
|
1957
|
+
});
|
|
1958
|
+
}
|
|
1959
|
+
function AlertDescription({ className, ...props }) {
|
|
1960
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1961
|
+
"data-slot": "alert-description",
|
|
1962
|
+
className: cn("text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4", className),
|
|
1963
|
+
...props
|
|
1964
|
+
});
|
|
1965
|
+
}
|
|
1966
|
+
function AlertAction({ className, ...props }) {
|
|
1967
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1968
|
+
"data-slot": "alert-action",
|
|
1969
|
+
className: cn("absolute top-2.5 right-3", className),
|
|
1970
|
+
...props
|
|
1971
|
+
});
|
|
1972
|
+
}
|
|
1973
|
+
//#endregion
|
|
1974
|
+
//#region src/components/alert-dialog.tsx
|
|
1975
|
+
function AlertDialog({ ...props }) {
|
|
1976
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Root, {
|
|
1977
|
+
"data-slot": "alert-dialog",
|
|
1978
|
+
...props
|
|
1979
|
+
});
|
|
1980
|
+
}
|
|
1981
|
+
function AlertDialogTrigger({ ...props }) {
|
|
1982
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Trigger, {
|
|
1983
|
+
"data-slot": "alert-dialog-trigger",
|
|
1984
|
+
...props
|
|
1985
|
+
});
|
|
1986
|
+
}
|
|
1987
|
+
function AlertDialogPortal({ ...props }) {
|
|
1988
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Portal, {
|
|
1989
|
+
"data-slot": "alert-dialog-portal",
|
|
1990
|
+
...props
|
|
1991
|
+
});
|
|
1992
|
+
}
|
|
1993
|
+
function AlertDialogOverlay({ className, ...props }) {
|
|
1994
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Overlay, {
|
|
1995
|
+
"data-slot": "alert-dialog-overlay",
|
|
1996
|
+
className: cn("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", className),
|
|
1997
|
+
...props
|
|
1998
|
+
});
|
|
1999
|
+
}
|
|
2000
|
+
function AlertDialogContent({ className, size = "default", ...props }) {
|
|
2001
|
+
return /* @__PURE__ */ jsxs(AlertDialogPortal, { children: [/* @__PURE__ */ jsx(AlertDialogOverlay, {}), /* @__PURE__ */ jsx(AlertDialog$1.Content, {
|
|
2002
|
+
"data-slot": "alert-dialog-content",
|
|
2003
|
+
"data-size": size,
|
|
2004
|
+
className: cn("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl bg-popover p-6 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-lg 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", className),
|
|
2005
|
+
...props
|
|
2006
|
+
})] });
|
|
2007
|
+
}
|
|
2008
|
+
function AlertDialogHeader({ className, ...props }) {
|
|
2009
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2010
|
+
"data-slot": "alert-dialog-header",
|
|
2011
|
+
className: cn("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]", className),
|
|
2012
|
+
...props
|
|
2013
|
+
});
|
|
2014
|
+
}
|
|
2015
|
+
function AlertDialogFooter({ className, ...props }) {
|
|
2016
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2017
|
+
"data-slot": "alert-dialog-footer",
|
|
2018
|
+
className: cn("flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end", className),
|
|
2019
|
+
...props
|
|
2020
|
+
});
|
|
2021
|
+
}
|
|
2022
|
+
function AlertDialogMedia({ className, ...props }) {
|
|
2023
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2024
|
+
"data-slot": "alert-dialog-media",
|
|
2025
|
+
className: cn("mb-2 inline-flex size-16 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-8", className),
|
|
2026
|
+
...props
|
|
2027
|
+
});
|
|
2028
|
+
}
|
|
2029
|
+
function AlertDialogTitle({ className, ...props }) {
|
|
2030
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Title, {
|
|
2031
|
+
"data-slot": "alert-dialog-title",
|
|
2032
|
+
className: cn("text-lg font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2", className),
|
|
2033
|
+
...props
|
|
2034
|
+
});
|
|
2035
|
+
}
|
|
2036
|
+
function AlertDialogDescription({ className, ...props }) {
|
|
2037
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Description, {
|
|
2038
|
+
"data-slot": "alert-dialog-description",
|
|
2039
|
+
className: cn("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground", className),
|
|
2040
|
+
...props
|
|
2041
|
+
});
|
|
2042
|
+
}
|
|
2043
|
+
function AlertDialogAction({ className, variant = "default", size = "default", ...props }) {
|
|
2044
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
2045
|
+
variant,
|
|
2046
|
+
size,
|
|
2047
|
+
asChild: true,
|
|
2048
|
+
children: /* @__PURE__ */ jsx(AlertDialog$1.Action, {
|
|
2049
|
+
"data-slot": "alert-dialog-action",
|
|
2050
|
+
className: cn(className),
|
|
2051
|
+
...props
|
|
2052
|
+
})
|
|
2053
|
+
});
|
|
2054
|
+
}
|
|
2055
|
+
function AlertDialogCancel({ className, variant = "outline", size = "default", ...props }) {
|
|
2056
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
2057
|
+
variant,
|
|
2058
|
+
size,
|
|
2059
|
+
asChild: true,
|
|
2060
|
+
children: /* @__PURE__ */ jsx(AlertDialog$1.Cancel, {
|
|
2061
|
+
"data-slot": "alert-dialog-cancel",
|
|
2062
|
+
className: cn(className),
|
|
2063
|
+
...props
|
|
2064
|
+
})
|
|
2065
|
+
});
|
|
2066
|
+
}
|
|
2067
|
+
//#endregion
|
|
2068
|
+
//#region src/components/aspect-ratio.tsx
|
|
2069
|
+
function AspectRatio({ ...props }) {
|
|
2070
|
+
return /* @__PURE__ */ jsx(AspectRatio$1.Root, {
|
|
2071
|
+
"data-slot": "aspect-ratio",
|
|
2072
|
+
...props
|
|
2073
|
+
});
|
|
2074
|
+
}
|
|
2075
|
+
//#endregion
|
|
2076
|
+
//#region src/components/avatar.tsx
|
|
2077
|
+
function Avatar({ className, size = "default", ...props }) {
|
|
2078
|
+
return /* @__PURE__ */ jsx(Avatar$1.Root, {
|
|
2079
|
+
"data-slot": "avatar",
|
|
2080
|
+
"data-size": size,
|
|
2081
|
+
className: cn("group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten", className),
|
|
2082
|
+
...props
|
|
2083
|
+
});
|
|
2084
|
+
}
|
|
2085
|
+
function AvatarImage({ className, ...props }) {
|
|
2086
|
+
return /* @__PURE__ */ jsx(Avatar$1.Image, {
|
|
2087
|
+
"data-slot": "avatar-image",
|
|
2088
|
+
className: cn("aspect-square size-full rounded-full object-cover", className),
|
|
2089
|
+
...props
|
|
2090
|
+
});
|
|
2091
|
+
}
|
|
2092
|
+
function AvatarFallback({ className, ...props }) {
|
|
2093
|
+
return /* @__PURE__ */ jsx(Avatar$1.Fallback, {
|
|
2094
|
+
"data-slot": "avatar-fallback",
|
|
2095
|
+
className: cn("flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs", className),
|
|
2096
|
+
...props
|
|
2097
|
+
});
|
|
2098
|
+
}
|
|
2099
|
+
function AvatarBadge({ className, ...props }) {
|
|
2100
|
+
return /* @__PURE__ */ jsx("span", {
|
|
2101
|
+
"data-slot": "avatar-badge",
|
|
2102
|
+
className: cn("absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground bg-blend-color ring-2 ring-background select-none", "group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden", "group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2", "group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2", className),
|
|
2103
|
+
...props
|
|
2104
|
+
});
|
|
2105
|
+
}
|
|
2106
|
+
function AvatarGroup({ className, ...props }) {
|
|
2107
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2108
|
+
"data-slot": "avatar-group",
|
|
2109
|
+
className: cn("group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background", className),
|
|
2110
|
+
...props
|
|
2111
|
+
});
|
|
2112
|
+
}
|
|
2113
|
+
function AvatarGroupCount({ className, ...props }) {
|
|
2114
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2115
|
+
"data-slot": "avatar-group-count",
|
|
2116
|
+
className: cn("relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3", className),
|
|
2117
|
+
...props
|
|
2118
|
+
});
|
|
2119
|
+
}
|
|
2120
|
+
//#endregion
|
|
2121
|
+
//#region src/components/badge.tsx
|
|
2122
|
+
const badgeVariants = cva("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", {
|
|
2123
|
+
variants: { variant: {
|
|
2124
|
+
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
2125
|
+
secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
|
|
2126
|
+
destructive: "bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
|
|
2127
|
+
outline: "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
|
|
2128
|
+
ghost: "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
|
|
2129
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
2130
|
+
} },
|
|
2131
|
+
defaultVariants: { variant: "default" }
|
|
2132
|
+
});
|
|
2133
|
+
function Badge({ className, variant = "default", asChild = false, ...props }) {
|
|
2134
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "span", {
|
|
2135
|
+
"data-slot": "badge",
|
|
2136
|
+
"data-variant": variant,
|
|
2137
|
+
className: cn(badgeVariants({ variant }), className),
|
|
2138
|
+
...props
|
|
2139
|
+
});
|
|
2140
|
+
}
|
|
2141
|
+
//#endregion
|
|
2142
|
+
//#region src/components/breadcrumb.tsx
|
|
2143
|
+
function Breadcrumb({ className, ...props }) {
|
|
2144
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
2145
|
+
"aria-label": "breadcrumb",
|
|
2146
|
+
"data-slot": "breadcrumb",
|
|
2147
|
+
className: cn(className),
|
|
2148
|
+
...props
|
|
2149
|
+
});
|
|
2150
|
+
}
|
|
2151
|
+
function BreadcrumbList({ className, ...props }) {
|
|
2152
|
+
return /* @__PURE__ */ jsx("ol", {
|
|
2153
|
+
"data-slot": "breadcrumb-list",
|
|
2154
|
+
className: cn("flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground sm:gap-2.5", className),
|
|
2155
|
+
...props
|
|
2156
|
+
});
|
|
2157
|
+
}
|
|
2158
|
+
function BreadcrumbItem({ className, ...props }) {
|
|
2159
|
+
return /* @__PURE__ */ jsx("li", {
|
|
2160
|
+
"data-slot": "breadcrumb-item",
|
|
2161
|
+
className: cn("inline-flex items-center gap-1.5", className),
|
|
2162
|
+
...props
|
|
2163
|
+
});
|
|
2164
|
+
}
|
|
2165
|
+
function BreadcrumbLink({ asChild, className, ...props }) {
|
|
2166
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "a", {
|
|
2167
|
+
"data-slot": "breadcrumb-link",
|
|
2168
|
+
className: cn("transition-colors hover:text-foreground", className),
|
|
2169
|
+
...props
|
|
2170
|
+
});
|
|
2171
|
+
}
|
|
2172
|
+
function BreadcrumbPage({ className, ...props }) {
|
|
2173
|
+
return /* @__PURE__ */ jsx("span", {
|
|
2174
|
+
"data-slot": "breadcrumb-page",
|
|
2175
|
+
role: "link",
|
|
2176
|
+
"aria-disabled": "true",
|
|
2177
|
+
"aria-current": "page",
|
|
2178
|
+
className: cn("font-normal text-foreground", className),
|
|
2179
|
+
...props
|
|
2180
|
+
});
|
|
2181
|
+
}
|
|
2182
|
+
function BreadcrumbSeparator({ children, className, ...props }) {
|
|
2183
|
+
return /* @__PURE__ */ jsx("li", {
|
|
2184
|
+
"data-slot": "breadcrumb-separator",
|
|
2185
|
+
role: "presentation",
|
|
2186
|
+
"aria-hidden": "true",
|
|
2187
|
+
className: cn("[&>svg]:size-3.5", className),
|
|
2188
|
+
...props,
|
|
2189
|
+
children: children ?? /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
2190
|
+
});
|
|
2191
|
+
}
|
|
2192
|
+
function BreadcrumbEllipsis({ className, ...props }) {
|
|
2193
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
2194
|
+
"data-slot": "breadcrumb-ellipsis",
|
|
2195
|
+
role: "presentation",
|
|
2196
|
+
"aria-hidden": "true",
|
|
2197
|
+
className: cn("flex size-5 items-center justify-center [&>svg]:size-4", className),
|
|
2198
|
+
...props,
|
|
2199
|
+
children: [/* @__PURE__ */ jsx(MoreHorizontalIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
2200
|
+
className: "sr-only",
|
|
2201
|
+
children: "More"
|
|
2202
|
+
})]
|
|
2203
|
+
});
|
|
2204
|
+
}
|
|
2205
|
+
//#endregion
|
|
2206
|
+
//#region src/components/calendar.tsx
|
|
2207
|
+
function Calendar({ className, classNames, showOutsideDays = true, captionLayout = "label", buttonVariant = "ghost", locale, formatters, components, ...props }) {
|
|
2208
|
+
const defaultClassNames = getDefaultClassNames();
|
|
2209
|
+
return /* @__PURE__ */ jsx(DayPicker, {
|
|
2210
|
+
showOutsideDays,
|
|
2211
|
+
className: cn("group/calendar bg-background p-3 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(8)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent", String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`, String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`, className),
|
|
2212
|
+
captionLayout,
|
|
2213
|
+
locale,
|
|
2214
|
+
formatters: {
|
|
2215
|
+
formatMonthDropdown: (date) => date.toLocaleString(locale?.code, { month: "short" }),
|
|
2216
|
+
...formatters
|
|
2217
|
+
},
|
|
2218
|
+
classNames: {
|
|
2219
|
+
root: cn("w-fit", defaultClassNames.root),
|
|
2220
|
+
months: cn("relative flex flex-col gap-4 md:flex-row", defaultClassNames.months),
|
|
2221
|
+
month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
|
|
2222
|
+
nav: cn("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1", defaultClassNames.nav),
|
|
2223
|
+
button_previous: cn(buttonVariants({ variant: buttonVariant }), "size-(--cell-size) p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_previous),
|
|
2224
|
+
button_next: cn(buttonVariants({ variant: buttonVariant }), "size-(--cell-size) p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_next),
|
|
2225
|
+
month_caption: cn("flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)", defaultClassNames.month_caption),
|
|
2226
|
+
dropdowns: cn("flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium", defaultClassNames.dropdowns),
|
|
2227
|
+
dropdown_root: cn("relative rounded-(--cell-radius)", defaultClassNames.dropdown_root),
|
|
2228
|
+
dropdown: cn("absolute inset-0 bg-popover opacity-0", defaultClassNames.dropdown),
|
|
2229
|
+
caption_label: cn("font-medium select-none", captionLayout === "label" ? "text-sm" : "flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground", defaultClassNames.caption_label),
|
|
2230
|
+
table: "w-full border-collapse",
|
|
2231
|
+
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
2232
|
+
weekday: cn("flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none", defaultClassNames.weekday),
|
|
2233
|
+
week: cn("mt-2 flex w-full", defaultClassNames.week),
|
|
2234
|
+
week_number_header: cn("w-(--cell-size) select-none", defaultClassNames.week_number_header),
|
|
2235
|
+
week_number: cn("text-[0.8rem] text-muted-foreground select-none", defaultClassNames.week_number),
|
|
2236
|
+
day: cn("group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)", props.showWeekNumber ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)" : "[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)", defaultClassNames.day),
|
|
2237
|
+
range_start: cn("relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-muted", defaultClassNames.range_start),
|
|
2238
|
+
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
2239
|
+
range_end: cn("relative isolate z-0 rounded-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-muted", defaultClassNames.range_end),
|
|
2240
|
+
today: cn("rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none", defaultClassNames.today),
|
|
2241
|
+
outside: cn("text-muted-foreground aria-selected:text-muted-foreground", defaultClassNames.outside),
|
|
2242
|
+
disabled: cn("text-muted-foreground opacity-50", defaultClassNames.disabled),
|
|
2243
|
+
hidden: cn("invisible", defaultClassNames.hidden),
|
|
2244
|
+
...classNames
|
|
2245
|
+
},
|
|
2246
|
+
components: {
|
|
2247
|
+
Root: ({ className, rootRef, ...props }) => {
|
|
2248
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2249
|
+
"data-slot": "calendar",
|
|
2250
|
+
ref: rootRef,
|
|
2251
|
+
className: cn(className),
|
|
2252
|
+
...props
|
|
2253
|
+
});
|
|
2254
|
+
},
|
|
2255
|
+
Chevron: ({ className, orientation, ...props }) => {
|
|
2256
|
+
if (orientation === "left") return /* @__PURE__ */ jsx(ChevronLeftIcon, {
|
|
2257
|
+
className: cn("size-4", className),
|
|
2258
|
+
...props
|
|
2259
|
+
});
|
|
2260
|
+
if (orientation === "right") return /* @__PURE__ */ jsx(ChevronRightIcon, {
|
|
2261
|
+
className: cn("size-4", className),
|
|
2262
|
+
...props
|
|
2263
|
+
});
|
|
2264
|
+
return /* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
2265
|
+
className: cn("size-4", className),
|
|
2266
|
+
...props
|
|
2267
|
+
});
|
|
2268
|
+
},
|
|
2269
|
+
DayButton: ({ ...props }) => /* @__PURE__ */ jsx(CalendarDayButton, {
|
|
2270
|
+
locale,
|
|
2271
|
+
...props
|
|
2272
|
+
}),
|
|
2273
|
+
WeekNumber: ({ children, ...props }) => {
|
|
2274
|
+
return /* @__PURE__ */ jsx("td", {
|
|
2275
|
+
...props,
|
|
2276
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
2277
|
+
className: "flex size-(--cell-size) items-center justify-center text-center",
|
|
2278
|
+
children
|
|
2279
|
+
})
|
|
2280
|
+
});
|
|
2281
|
+
},
|
|
2282
|
+
...components
|
|
2283
|
+
},
|
|
2284
|
+
...props
|
|
2285
|
+
});
|
|
2286
|
+
}
|
|
2287
|
+
function CalendarDayButton({ className, day, modifiers, locale, ...props }) {
|
|
2288
|
+
const defaultClassNames = getDefaultClassNames();
|
|
2289
|
+
const ref = React.useRef(null);
|
|
2290
|
+
React.useEffect(() => {
|
|
2291
|
+
if (modifiers.focused) ref.current?.focus();
|
|
2292
|
+
}, [modifiers.focused]);
|
|
2293
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
2294
|
+
ref,
|
|
2295
|
+
variant: "ghost",
|
|
2296
|
+
size: "icon",
|
|
2297
|
+
"data-day": day.date.toLocaleDateString(locale?.code),
|
|
2298
|
+
"data-selected-single": modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle,
|
|
2299
|
+
"data-range-start": modifiers.range_start,
|
|
2300
|
+
"data-range-end": modifiers.range_end,
|
|
2301
|
+
"data-range-middle": modifiers.range_middle,
|
|
2302
|
+
className: cn("relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70", defaultClassNames.day, className),
|
|
2303
|
+
...props
|
|
2304
|
+
});
|
|
2305
|
+
}
|
|
2306
|
+
//#endregion
|
|
2307
|
+
//#region src/components/card.tsx
|
|
2308
|
+
function Card({ className, size = "default", ...props }) {
|
|
2309
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2310
|
+
"data-slot": "card",
|
|
2311
|
+
"data-size": size,
|
|
2312
|
+
className: cn("group/card flex flex-col gap-6 overflow-hidden rounded-xl bg-card py-6 text-sm text-card-foreground shadow-xs ring-1 ring-foreground/10 has-[>img:first-child]:pt-0 data-[size=sm]:gap-4 data-[size=sm]:py-4 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl", className),
|
|
2313
|
+
...props
|
|
2314
|
+
});
|
|
2315
|
+
}
|
|
2316
|
+
function CardHeader({ className, ...props }) {
|
|
2317
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2318
|
+
"data-slot": "card-header",
|
|
2319
|
+
className: cn("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-6 group-data-[size=sm]/card:px-4 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-6 group-data-[size=sm]/card:[.border-b]:pb-4", className),
|
|
2320
|
+
...props
|
|
2321
|
+
});
|
|
2322
|
+
}
|
|
2323
|
+
function CardTitle({ className, ...props }) {
|
|
2324
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2325
|
+
"data-slot": "card-title",
|
|
2326
|
+
className: cn("text-base leading-normal font-medium group-data-[size=sm]/card:text-sm", className),
|
|
2327
|
+
...props
|
|
2328
|
+
});
|
|
2329
|
+
}
|
|
2330
|
+
function CardDescription({ className, ...props }) {
|
|
2331
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2332
|
+
"data-slot": "card-description",
|
|
2333
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
2334
|
+
...props
|
|
2335
|
+
});
|
|
2336
|
+
}
|
|
2337
|
+
function CardAction({ className, ...props }) {
|
|
2338
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2339
|
+
"data-slot": "card-action",
|
|
2340
|
+
className: cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className),
|
|
2341
|
+
...props
|
|
2342
|
+
});
|
|
2343
|
+
}
|
|
2344
|
+
function CardContent({ className, ...props }) {
|
|
2345
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2346
|
+
"data-slot": "card-content",
|
|
2347
|
+
className: cn("px-6 group-data-[size=sm]/card:px-4", className),
|
|
2348
|
+
...props
|
|
2349
|
+
});
|
|
2350
|
+
}
|
|
2351
|
+
function CardFooter({ className, ...props }) {
|
|
2352
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2353
|
+
"data-slot": "card-footer",
|
|
2354
|
+
className: cn("flex items-center rounded-b-xl px-6 group-data-[size=sm]/card:px-4 [.border-t]:pt-6 group-data-[size=sm]/card:[.border-t]:pt-4", className),
|
|
2355
|
+
...props
|
|
2356
|
+
});
|
|
2357
|
+
}
|
|
2358
|
+
//#endregion
|
|
2359
|
+
//#region src/components/carousel.tsx
|
|
2360
|
+
const CarouselContext = React.createContext(null);
|
|
2361
|
+
function useCarousel() {
|
|
2362
|
+
const context = React.useContext(CarouselContext);
|
|
2363
|
+
if (!context) throw new Error("useCarousel must be used within a <Carousel />");
|
|
2364
|
+
return context;
|
|
2365
|
+
}
|
|
2366
|
+
function Carousel({ orientation = "horizontal", opts, setApi, plugins, className, children, ...props }) {
|
|
2367
|
+
const [carouselRef, api] = useEmblaCarousel({
|
|
2368
|
+
...opts,
|
|
2369
|
+
axis: orientation === "horizontal" ? "x" : "y"
|
|
2370
|
+
}, plugins);
|
|
2371
|
+
const [canScrollPrev, setCanScrollPrev] = React.useState(false);
|
|
2372
|
+
const [canScrollNext, setCanScrollNext] = React.useState(false);
|
|
2373
|
+
const onSelect = React.useCallback((api) => {
|
|
2374
|
+
if (!api) return;
|
|
2375
|
+
setCanScrollPrev(api.canScrollPrev());
|
|
2376
|
+
setCanScrollNext(api.canScrollNext());
|
|
2377
|
+
}, []);
|
|
2378
|
+
const scrollPrev = React.useCallback(() => {
|
|
2379
|
+
api?.scrollPrev();
|
|
2380
|
+
}, [api]);
|
|
2381
|
+
const scrollNext = React.useCallback(() => {
|
|
2382
|
+
api?.scrollNext();
|
|
2383
|
+
}, [api]);
|
|
2384
|
+
const handleKeyDown = React.useCallback((event) => {
|
|
2385
|
+
if (event.key === "ArrowLeft") {
|
|
2386
|
+
event.preventDefault();
|
|
2387
|
+
scrollPrev();
|
|
2388
|
+
} else if (event.key === "ArrowRight") {
|
|
2389
|
+
event.preventDefault();
|
|
2390
|
+
scrollNext();
|
|
2391
|
+
}
|
|
2392
|
+
}, [scrollPrev, scrollNext]);
|
|
2393
|
+
React.useEffect(() => {
|
|
2394
|
+
if (!api || !setApi) return;
|
|
2395
|
+
setApi(api);
|
|
2396
|
+
}, [api, setApi]);
|
|
2397
|
+
React.useEffect(() => {
|
|
2398
|
+
if (!api) return;
|
|
2399
|
+
onSelect(api);
|
|
2400
|
+
api.on("reInit", onSelect);
|
|
2401
|
+
api.on("select", onSelect);
|
|
2402
|
+
return () => {
|
|
2403
|
+
api?.off("select", onSelect);
|
|
2404
|
+
};
|
|
2405
|
+
}, [api, onSelect]);
|
|
2406
|
+
return /* @__PURE__ */ jsx(CarouselContext.Provider, {
|
|
2407
|
+
value: {
|
|
2408
|
+
carouselRef,
|
|
2409
|
+
api,
|
|
2410
|
+
opts,
|
|
2411
|
+
orientation: orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
|
|
2412
|
+
scrollPrev,
|
|
2413
|
+
scrollNext,
|
|
2414
|
+
canScrollPrev,
|
|
2415
|
+
canScrollNext
|
|
2416
|
+
},
|
|
2417
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
2418
|
+
onKeyDownCapture: handleKeyDown,
|
|
2419
|
+
className: cn("relative", className),
|
|
2420
|
+
role: "region",
|
|
2421
|
+
"aria-roledescription": "carousel",
|
|
2422
|
+
"data-slot": "carousel",
|
|
2423
|
+
...props,
|
|
2424
|
+
children
|
|
2425
|
+
})
|
|
2426
|
+
});
|
|
2427
|
+
}
|
|
2428
|
+
function CarouselContent({ className, ...props }) {
|
|
2429
|
+
const { carouselRef, orientation } = useCarousel();
|
|
2430
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2431
|
+
ref: carouselRef,
|
|
2432
|
+
className: "overflow-hidden",
|
|
2433
|
+
"data-slot": "carousel-content",
|
|
2434
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
2435
|
+
className: cn("flex", orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col", className),
|
|
2436
|
+
...props
|
|
2437
|
+
})
|
|
2438
|
+
});
|
|
2439
|
+
}
|
|
2440
|
+
function CarouselItem({ className, ...props }) {
|
|
2441
|
+
const { orientation } = useCarousel();
|
|
2442
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2443
|
+
role: "group",
|
|
2444
|
+
"aria-roledescription": "slide",
|
|
2445
|
+
"data-slot": "carousel-item",
|
|
2446
|
+
className: cn("min-w-0 shrink-0 grow-0 basis-full", orientation === "horizontal" ? "pl-4" : "pt-4", className),
|
|
2447
|
+
...props
|
|
2448
|
+
});
|
|
2449
|
+
}
|
|
2450
|
+
function CarouselPrevious({ className, variant = "outline", size = "icon-sm", ...props }) {
|
|
2451
|
+
const { orientation, scrollPrev, canScrollPrev } = useCarousel();
|
|
2452
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
2453
|
+
"data-slot": "carousel-previous",
|
|
2454
|
+
variant,
|
|
2455
|
+
size,
|
|
2456
|
+
className: cn("absolute touch-manipulation rounded-full", orientation === "horizontal" ? "top-1/2 -left-12 -translate-y-1/2" : "-top-12 left-1/2 -translate-x-1/2 rotate-90", className),
|
|
2457
|
+
disabled: !canScrollPrev,
|
|
2458
|
+
onClick: scrollPrev,
|
|
2459
|
+
...props,
|
|
2460
|
+
children: [/* @__PURE__ */ jsx(ChevronLeftIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
2461
|
+
className: "sr-only",
|
|
2462
|
+
children: "Previous slide"
|
|
2463
|
+
})]
|
|
2464
|
+
});
|
|
2465
|
+
}
|
|
2466
|
+
function CarouselNext({ className, variant = "outline", size = "icon-sm", ...props }) {
|
|
2467
|
+
const { orientation, scrollNext, canScrollNext } = useCarousel();
|
|
2468
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
2469
|
+
"data-slot": "carousel-next",
|
|
2470
|
+
variant,
|
|
2471
|
+
size,
|
|
2472
|
+
className: cn("absolute touch-manipulation rounded-full", orientation === "horizontal" ? "top-1/2 -right-12 -translate-y-1/2" : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90", className),
|
|
2473
|
+
disabled: !canScrollNext,
|
|
2474
|
+
onClick: scrollNext,
|
|
2475
|
+
...props,
|
|
2476
|
+
children: [/* @__PURE__ */ jsx(ChevronRightIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
2477
|
+
className: "sr-only",
|
|
2478
|
+
children: "Next slide"
|
|
2479
|
+
})]
|
|
2480
|
+
});
|
|
2481
|
+
}
|
|
2482
|
+
//#endregion
|
|
2483
|
+
//#region src/components/chart.tsx
|
|
2484
|
+
const THEMES = {
|
|
2485
|
+
light: "",
|
|
2486
|
+
dark: ".dark"
|
|
2487
|
+
};
|
|
2488
|
+
const INITIAL_DIMENSION = {
|
|
2489
|
+
width: 320,
|
|
2490
|
+
height: 200
|
|
2491
|
+
};
|
|
2492
|
+
const ChartContext = React.createContext(null);
|
|
2493
|
+
function useChart() {
|
|
2494
|
+
const context = React.useContext(ChartContext);
|
|
2495
|
+
if (!context) throw new Error("useChart must be used within a <ChartContainer />");
|
|
2496
|
+
return context;
|
|
2497
|
+
}
|
|
2498
|
+
function ChartContainer({ id, className, children, config, initialDimension = INITIAL_DIMENSION, ...props }) {
|
|
2499
|
+
const uniqueId = React.useId();
|
|
2500
|
+
const chartId = `chart-${id ?? uniqueId.replace(/:/g, "")}`;
|
|
2501
|
+
return /* @__PURE__ */ jsx(ChartContext.Provider, {
|
|
2502
|
+
value: { config },
|
|
2503
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
2504
|
+
"data-slot": "chart",
|
|
2505
|
+
"data-chart": chartId,
|
|
2506
|
+
className: cn("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden", className),
|
|
2507
|
+
...props,
|
|
2508
|
+
children: [/* @__PURE__ */ jsx(ChartStyle, {
|
|
2509
|
+
id: chartId,
|
|
2510
|
+
config
|
|
2511
|
+
}), /* @__PURE__ */ jsx(RechartsPrimitive.ResponsiveContainer, {
|
|
2512
|
+
initialDimension,
|
|
2513
|
+
children
|
|
2514
|
+
})]
|
|
2515
|
+
})
|
|
2516
|
+
});
|
|
2517
|
+
}
|
|
2518
|
+
const ChartStyle = ({ id, config }) => {
|
|
2519
|
+
const colorConfig = Object.entries(config).filter(([, config]) => config.theme ?? config.color);
|
|
2520
|
+
if (!colorConfig.length) return null;
|
|
2521
|
+
return /* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: Object.entries(THEMES).map(([theme, prefix]) => `
|
|
2522
|
+
${prefix} [data-chart=${id}] {
|
|
2523
|
+
${colorConfig.map(([key, itemConfig]) => {
|
|
2524
|
+
const color = itemConfig.theme?.[theme] ?? itemConfig.color;
|
|
2525
|
+
return color ? ` --color-${key}: ${color};` : null;
|
|
2526
|
+
}).join("\n")}
|
|
2527
|
+
}
|
|
2528
|
+
`).join("\n") } });
|
|
2529
|
+
};
|
|
2530
|
+
const ChartTooltip = RechartsPrimitive.Tooltip;
|
|
2531
|
+
function ChartTooltipContent({ active, payload, className, indicator = "dot", hideLabel = false, hideIndicator = false, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey }) {
|
|
2532
|
+
const { config } = useChart();
|
|
2533
|
+
const tooltipLabel = React.useMemo(() => {
|
|
2534
|
+
if (hideLabel || !payload?.length) return null;
|
|
2535
|
+
const [item] = payload;
|
|
2536
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, `${labelKey ?? item?.dataKey ?? item?.name ?? "value"}`);
|
|
2537
|
+
const value = !labelKey && typeof label === "string" ? config[label]?.label ?? label : itemConfig?.label;
|
|
2538
|
+
if (labelFormatter) return /* @__PURE__ */ jsx("div", {
|
|
2539
|
+
className: cn("font-medium", labelClassName),
|
|
2540
|
+
children: labelFormatter(value, payload)
|
|
2541
|
+
});
|
|
2542
|
+
if (!value) return null;
|
|
2543
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2544
|
+
className: cn("font-medium", labelClassName),
|
|
2545
|
+
children: value
|
|
2546
|
+
});
|
|
2547
|
+
}, [
|
|
2548
|
+
label,
|
|
2549
|
+
labelFormatter,
|
|
2550
|
+
payload,
|
|
2551
|
+
hideLabel,
|
|
2552
|
+
labelClassName,
|
|
2553
|
+
config,
|
|
2554
|
+
labelKey
|
|
2555
|
+
]);
|
|
2556
|
+
if (!active || !payload?.length) return null;
|
|
2557
|
+
const nestLabel = payload.length === 1 && indicator !== "dot";
|
|
2558
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2559
|
+
className: cn("grid min-w-32 items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl", className),
|
|
2560
|
+
children: [!nestLabel ? tooltipLabel : null, /* @__PURE__ */ jsx("div", {
|
|
2561
|
+
className: "grid gap-1.5",
|
|
2562
|
+
children: payload.filter((item) => item.type !== "none").map((item, index) => {
|
|
2563
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, `${nameKey ?? item.name ?? item.dataKey ?? "value"}`);
|
|
2564
|
+
const indicatorColor = color ?? item.payload?.fill ?? item.color;
|
|
2565
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2566
|
+
className: cn("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground", indicator === "dot" && "items-center"),
|
|
2567
|
+
children: formatter && item?.value !== void 0 && item.name ? formatter(item.value, item.name, item, index, item.payload) : /* @__PURE__ */ jsxs(Fragment, { children: [itemConfig?.icon ? /* @__PURE__ */ jsx(itemConfig.icon, {}) : !hideIndicator && /* @__PURE__ */ jsx("div", {
|
|
2568
|
+
className: cn("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)", {
|
|
2569
|
+
"h-2.5 w-2.5": indicator === "dot",
|
|
2570
|
+
"w-1": indicator === "line",
|
|
2571
|
+
"w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
|
|
2572
|
+
"my-0.5": nestLabel && indicator === "dashed"
|
|
2573
|
+
}),
|
|
2574
|
+
style: {
|
|
2575
|
+
"--color-bg": indicatorColor,
|
|
2576
|
+
"--color-border": indicatorColor
|
|
2577
|
+
}
|
|
2578
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
2579
|
+
className: cn("flex flex-1 justify-between leading-none", nestLabel ? "items-end" : "items-center"),
|
|
2580
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
2581
|
+
className: "grid gap-1.5",
|
|
2582
|
+
children: [nestLabel ? tooltipLabel : null, /* @__PURE__ */ jsx("span", {
|
|
2583
|
+
className: "text-muted-foreground",
|
|
2584
|
+
children: itemConfig?.label ?? item.name
|
|
2585
|
+
})]
|
|
2586
|
+
}), item.value != null && /* @__PURE__ */ jsx("span", {
|
|
2587
|
+
className: "font-mono font-medium text-foreground tabular-nums",
|
|
2588
|
+
children: typeof item.value === "number" ? item.value.toLocaleString() : String(item.value)
|
|
2589
|
+
})]
|
|
2590
|
+
})] })
|
|
2591
|
+
}, index);
|
|
2592
|
+
})
|
|
2593
|
+
})]
|
|
2594
|
+
});
|
|
2595
|
+
}
|
|
2596
|
+
const ChartLegend = RechartsPrimitive.Legend;
|
|
2597
|
+
function ChartLegendContent({ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey }) {
|
|
2598
|
+
const { config } = useChart();
|
|
2599
|
+
if (!payload?.length) return null;
|
|
2600
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2601
|
+
className: cn("flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className),
|
|
2602
|
+
children: payload.filter((item) => item.type !== "none").map((item, index) => {
|
|
2603
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, `${nameKey ?? item.dataKey ?? "value"}`);
|
|
2604
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2605
|
+
className: cn("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),
|
|
2606
|
+
children: [itemConfig?.icon && !hideIcon ? /* @__PURE__ */ jsx(itemConfig.icon, {}) : /* @__PURE__ */ jsx("div", {
|
|
2607
|
+
className: "h-2 w-2 shrink-0 rounded-[2px]",
|
|
2608
|
+
style: { backgroundColor: item.color }
|
|
2609
|
+
}), itemConfig?.label]
|
|
2610
|
+
}, index);
|
|
2611
|
+
})
|
|
2612
|
+
});
|
|
2613
|
+
}
|
|
2614
|
+
function getPayloadConfigFromPayload(config, payload, key) {
|
|
2615
|
+
if (typeof payload !== "object" || payload === null) return;
|
|
2616
|
+
const payloadPayload = "payload" in payload && typeof payload.payload === "object" && payload.payload !== null ? payload.payload : void 0;
|
|
2617
|
+
let configLabelKey = key;
|
|
2618
|
+
if (key in payload && typeof payload[key] === "string") configLabelKey = payload[key];
|
|
2619
|
+
else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === "string") configLabelKey = payloadPayload[key];
|
|
2620
|
+
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
2621
|
+
}
|
|
2622
|
+
//#endregion
|
|
2623
|
+
//#region src/components/checkbox.tsx
|
|
2624
|
+
function Checkbox({ className, ...props }) {
|
|
2625
|
+
return /* @__PURE__ */ jsx(Checkbox$1.Root, {
|
|
2626
|
+
"data-slot": "checkbox",
|
|
2627
|
+
className: cn("peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input shadow-xs transition-shadow outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary", className),
|
|
2628
|
+
...props,
|
|
2629
|
+
children: /* @__PURE__ */ jsx(Checkbox$1.Indicator, {
|
|
2630
|
+
"data-slot": "checkbox-indicator",
|
|
2631
|
+
className: "grid place-content-center text-current transition-none [&>svg]:size-3.5",
|
|
2632
|
+
children: /* @__PURE__ */ jsx(CheckIcon, {})
|
|
2633
|
+
})
|
|
2634
|
+
});
|
|
2635
|
+
}
|
|
2636
|
+
//#endregion
|
|
2637
|
+
//#region src/components/collapsible.tsx
|
|
2638
|
+
function Collapsible({ ...props }) {
|
|
2639
|
+
return /* @__PURE__ */ jsx(Collapsible$1.Root, {
|
|
2640
|
+
"data-slot": "collapsible",
|
|
2641
|
+
...props
|
|
2642
|
+
});
|
|
2643
|
+
}
|
|
2644
|
+
function CollapsibleTrigger({ ...props }) {
|
|
2645
|
+
return /* @__PURE__ */ jsx(Collapsible$1.CollapsibleTrigger, {
|
|
2646
|
+
"data-slot": "collapsible-trigger",
|
|
2647
|
+
...props
|
|
2648
|
+
});
|
|
2649
|
+
}
|
|
2650
|
+
function CollapsibleContent({ ...props }) {
|
|
2651
|
+
return /* @__PURE__ */ jsx(Collapsible$1.CollapsibleContent, {
|
|
2652
|
+
"data-slot": "collapsible-content",
|
|
2653
|
+
...props
|
|
2654
|
+
});
|
|
2655
|
+
}
|
|
2656
|
+
//#endregion
|
|
2657
|
+
//#region src/components/combobox.tsx
|
|
2658
|
+
const Combobox = Combobox$1.Root;
|
|
2659
|
+
function ComboboxValue({ ...props }) {
|
|
2660
|
+
return /* @__PURE__ */ jsx(Combobox$1.Value, {
|
|
2661
|
+
"data-slot": "combobox-value",
|
|
2662
|
+
...props
|
|
2663
|
+
});
|
|
2664
|
+
}
|
|
2665
|
+
function ComboboxTrigger({ className, children, ...props }) {
|
|
2666
|
+
return /* @__PURE__ */ jsxs(Combobox$1.Trigger, {
|
|
2667
|
+
"data-slot": "combobox-trigger",
|
|
2668
|
+
className: cn("[&_svg:not([class*='size-'])]:size-4", className),
|
|
2669
|
+
...props,
|
|
2670
|
+
children: [children, /* @__PURE__ */ jsx(ChevronDownIcon, { className: "pointer-events-none size-4 text-muted-foreground" })]
|
|
2671
|
+
});
|
|
2672
|
+
}
|
|
2673
|
+
function ComboboxClear({ className, ...props }) {
|
|
2674
|
+
return /* @__PURE__ */ jsx(Combobox$1.Clear, {
|
|
2675
|
+
"data-slot": "combobox-clear",
|
|
2676
|
+
render: /* @__PURE__ */ jsx(InputGroupButton, {
|
|
2677
|
+
variant: "ghost",
|
|
2678
|
+
size: "icon-xs"
|
|
2679
|
+
}),
|
|
2680
|
+
className: cn(className),
|
|
2681
|
+
...props,
|
|
2682
|
+
children: /* @__PURE__ */ jsx(XIcon, { className: "pointer-events-none" })
|
|
2683
|
+
});
|
|
2684
|
+
}
|
|
2685
|
+
function ComboboxInput({ className, children, disabled = false, showTrigger = true, showClear = false, ...props }) {
|
|
2686
|
+
return /* @__PURE__ */ jsxs(InputGroup, {
|
|
2687
|
+
className: cn("w-auto", className),
|
|
2688
|
+
children: [
|
|
2689
|
+
/* @__PURE__ */ jsx(Combobox$1.Input, {
|
|
2690
|
+
render: /* @__PURE__ */ jsx(InputGroupInput, { disabled }),
|
|
2691
|
+
...props
|
|
2692
|
+
}),
|
|
2693
|
+
/* @__PURE__ */ jsxs(InputGroupAddon, {
|
|
2694
|
+
align: "inline-end",
|
|
2695
|
+
children: [showTrigger && /* @__PURE__ */ jsx(InputGroupButton, {
|
|
2696
|
+
size: "icon-xs",
|
|
2697
|
+
variant: "ghost",
|
|
2698
|
+
asChild: true,
|
|
2699
|
+
"data-slot": "input-group-button",
|
|
2700
|
+
className: "group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent",
|
|
2701
|
+
disabled,
|
|
2702
|
+
children: /* @__PURE__ */ jsx(ComboboxTrigger, {})
|
|
2703
|
+
}), showClear && /* @__PURE__ */ jsx(ComboboxClear, { disabled })]
|
|
2704
|
+
}),
|
|
2705
|
+
children
|
|
2706
|
+
]
|
|
2707
|
+
});
|
|
2708
|
+
}
|
|
2709
|
+
function ComboboxContent({ className, side = "bottom", sideOffset = 6, align = "start", alignOffset = 0, anchor, ...props }) {
|
|
2710
|
+
return /* @__PURE__ */ jsx(Combobox$1.Portal, { children: /* @__PURE__ */ jsx(Combobox$1.Positioner, {
|
|
2711
|
+
side,
|
|
2712
|
+
sideOffset,
|
|
2713
|
+
align,
|
|
2714
|
+
alignOffset,
|
|
2715
|
+
anchor,
|
|
2716
|
+
className: "isolate z-50",
|
|
2717
|
+
children: /* @__PURE__ */ jsx(Combobox$1.Popup, {
|
|
2718
|
+
"data-slot": "combobox-content",
|
|
2719
|
+
"data-chips": !!anchor,
|
|
2720
|
+
className: cn("group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none 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", className),
|
|
2721
|
+
...props
|
|
2722
|
+
})
|
|
2723
|
+
}) });
|
|
2724
|
+
}
|
|
2725
|
+
function ComboboxList({ className, ...props }) {
|
|
2726
|
+
return /* @__PURE__ */ jsx(Combobox$1.List, {
|
|
2727
|
+
"data-slot": "combobox-list",
|
|
2728
|
+
className: cn("no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0", className),
|
|
2729
|
+
...props
|
|
2730
|
+
});
|
|
2731
|
+
}
|
|
2732
|
+
function ComboboxItem({ className, children, ...props }) {
|
|
2733
|
+
return /* @__PURE__ */ jsxs(Combobox$1.Item, {
|
|
2734
|
+
"data-slot": "combobox-item",
|
|
2735
|
+
className: cn("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
2736
|
+
...props,
|
|
2737
|
+
children: [children, /* @__PURE__ */ jsx(Combobox$1.ItemIndicator, {
|
|
2738
|
+
render: /* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center" }),
|
|
2739
|
+
children: /* @__PURE__ */ jsx(CheckIcon, { className: "pointer-events-none" })
|
|
2740
|
+
})]
|
|
2741
|
+
});
|
|
2742
|
+
}
|
|
2743
|
+
function ComboboxGroup({ className, ...props }) {
|
|
2744
|
+
return /* @__PURE__ */ jsx(Combobox$1.Group, {
|
|
2745
|
+
"data-slot": "combobox-group",
|
|
2746
|
+
className: cn(className),
|
|
2747
|
+
...props
|
|
2748
|
+
});
|
|
2749
|
+
}
|
|
2750
|
+
function ComboboxLabel({ className, ...props }) {
|
|
2751
|
+
return /* @__PURE__ */ jsx(Combobox$1.GroupLabel, {
|
|
2752
|
+
"data-slot": "combobox-label",
|
|
2753
|
+
className: cn("px-2 py-1.5 text-xs text-muted-foreground", className),
|
|
2754
|
+
...props
|
|
2755
|
+
});
|
|
2756
|
+
}
|
|
2757
|
+
function ComboboxCollection({ ...props }) {
|
|
2758
|
+
return /* @__PURE__ */ jsx(Combobox$1.Collection, {
|
|
2759
|
+
"data-slot": "combobox-collection",
|
|
2760
|
+
...props
|
|
2761
|
+
});
|
|
2762
|
+
}
|
|
2763
|
+
function ComboboxEmpty({ className, ...props }) {
|
|
2764
|
+
return /* @__PURE__ */ jsx(Combobox$1.Empty, {
|
|
2765
|
+
"data-slot": "combobox-empty",
|
|
2766
|
+
className: cn("hidden w-full justify-center py-2 text-center text-sm text-muted-foreground group-data-empty/combobox-content:flex", className),
|
|
2767
|
+
...props
|
|
2768
|
+
});
|
|
2769
|
+
}
|
|
2770
|
+
function ComboboxSeparator({ className, ...props }) {
|
|
2771
|
+
return /* @__PURE__ */ jsx(Combobox$1.Separator, {
|
|
2772
|
+
"data-slot": "combobox-separator",
|
|
2773
|
+
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
2774
|
+
...props
|
|
2775
|
+
});
|
|
2776
|
+
}
|
|
2777
|
+
function ComboboxChips({ className, ...props }) {
|
|
2778
|
+
return /* @__PURE__ */ jsx(Combobox$1.Chips, {
|
|
2779
|
+
"data-slot": "combobox-chips",
|
|
2780
|
+
className: cn("flex min-h-9 flex-wrap items-center gap-1.5 rounded-md border border-input bg-transparent bg-clip-padding px-2.5 py-1.5 text-sm shadow-xs transition-[color,box-shadow] focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 has-data-[slot=combobox-chip]:px-1.5 dark:bg-input/30 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:ring-destructive/40", className),
|
|
2781
|
+
...props
|
|
2782
|
+
});
|
|
2783
|
+
}
|
|
2784
|
+
function ComboboxChip({ className, children, showRemove = true, ...props }) {
|
|
2785
|
+
return /* @__PURE__ */ jsxs(Combobox$1.Chip, {
|
|
2786
|
+
"data-slot": "combobox-chip",
|
|
2787
|
+
className: cn("flex h-[calc(--spacing(5.5))] w-fit items-center justify-center gap-1 rounded-sm bg-muted px-1.5 text-xs font-medium whitespace-nowrap text-foreground has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pr-0", className),
|
|
2788
|
+
...props,
|
|
2789
|
+
children: [children, showRemove && /* @__PURE__ */ jsx(Combobox$1.ChipRemove, {
|
|
2790
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
2791
|
+
variant: "ghost",
|
|
2792
|
+
size: "icon-xs"
|
|
2793
|
+
}),
|
|
2794
|
+
className: "-ml-1 opacity-50 hover:opacity-100",
|
|
2795
|
+
"data-slot": "combobox-chip-remove",
|
|
2796
|
+
children: /* @__PURE__ */ jsx(XIcon, { className: "pointer-events-none" })
|
|
2797
|
+
})]
|
|
2798
|
+
});
|
|
2799
|
+
}
|
|
2800
|
+
function ComboboxChipsInput({ className, ...props }) {
|
|
2801
|
+
return /* @__PURE__ */ jsx(Combobox$1.Input, {
|
|
2802
|
+
"data-slot": "combobox-chip-input",
|
|
2803
|
+
className: cn("min-w-16 flex-1 outline-none", className),
|
|
2804
|
+
...props
|
|
2805
|
+
});
|
|
2806
|
+
}
|
|
2807
|
+
function useComboboxAnchor() {
|
|
2808
|
+
return React.useRef(null);
|
|
2809
|
+
}
|
|
2810
|
+
//#endregion
|
|
2811
|
+
//#region src/components/context-menu.tsx
|
|
2812
|
+
function ContextMenu({ ...props }) {
|
|
2813
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Root, {
|
|
2814
|
+
"data-slot": "context-menu",
|
|
2815
|
+
...props
|
|
2816
|
+
});
|
|
2817
|
+
}
|
|
2818
|
+
function ContextMenuTrigger({ className, ...props }) {
|
|
2819
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Trigger, {
|
|
2820
|
+
"data-slot": "context-menu-trigger",
|
|
2821
|
+
className: cn("select-none", className),
|
|
2822
|
+
...props
|
|
2823
|
+
});
|
|
2824
|
+
}
|
|
2825
|
+
function ContextMenuGroup({ ...props }) {
|
|
2826
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Group, {
|
|
2827
|
+
"data-slot": "context-menu-group",
|
|
2828
|
+
...props
|
|
2829
|
+
});
|
|
2830
|
+
}
|
|
2831
|
+
function ContextMenuPortal({ ...props }) {
|
|
2832
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Portal, {
|
|
2833
|
+
"data-slot": "context-menu-portal",
|
|
2834
|
+
...props
|
|
2835
|
+
});
|
|
2836
|
+
}
|
|
2837
|
+
function ContextMenuSub({ ...props }) {
|
|
2838
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Sub, {
|
|
2839
|
+
"data-slot": "context-menu-sub",
|
|
2840
|
+
...props
|
|
2841
|
+
});
|
|
2842
|
+
}
|
|
2843
|
+
function ContextMenuRadioGroup({ ...props }) {
|
|
2844
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.RadioGroup, {
|
|
2845
|
+
"data-slot": "context-menu-radio-group",
|
|
2846
|
+
...props
|
|
2847
|
+
});
|
|
2848
|
+
}
|
|
2849
|
+
function ContextMenuContent({ className, ...props }) {
|
|
2850
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Portal, { children: /* @__PURE__ */ jsx(ContextMenu$1.Content, {
|
|
2851
|
+
"data-slot": "context-menu-content",
|
|
2852
|
+
className: cn("z-50 max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 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-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", className),
|
|
2853
|
+
...props
|
|
2854
|
+
}) });
|
|
2855
|
+
}
|
|
2856
|
+
function ContextMenuItem({ className, inset, variant = "default", ...props }) {
|
|
2857
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Item, {
|
|
2858
|
+
"data-slot": "context-menu-item",
|
|
2859
|
+
"data-inset": inset,
|
|
2860
|
+
"data-variant": variant,
|
|
2861
|
+
className: cn("group/context-menu-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive", className),
|
|
2862
|
+
...props
|
|
2863
|
+
});
|
|
2864
|
+
}
|
|
2865
|
+
function ContextMenuSubTrigger({ className, inset, children, ...props }) {
|
|
2866
|
+
return /* @__PURE__ */ jsxs(ContextMenu$1.SubTrigger, {
|
|
2867
|
+
"data-slot": "context-menu-sub-trigger",
|
|
2868
|
+
"data-inset": inset,
|
|
2869
|
+
className: cn("flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-8 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
2870
|
+
...props,
|
|
2871
|
+
children: [children, /* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto" })]
|
|
2872
|
+
});
|
|
2873
|
+
}
|
|
2874
|
+
function ContextMenuSubContent({ className, ...props }) {
|
|
2875
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.SubContent, {
|
|
2876
|
+
"data-slot": "context-menu-sub-content",
|
|
2877
|
+
className: cn("z-50 min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg duration-100 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-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", className),
|
|
2878
|
+
...props
|
|
2879
|
+
});
|
|
2880
|
+
}
|
|
2881
|
+
function ContextMenuCheckboxItem({ className, children, checked, inset, ...props }) {
|
|
2882
|
+
return /* @__PURE__ */ jsxs(ContextMenu$1.CheckboxItem, {
|
|
2883
|
+
"data-slot": "context-menu-checkbox-item",
|
|
2884
|
+
"data-inset": inset,
|
|
2885
|
+
className: cn("relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-8 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
2886
|
+
checked,
|
|
2887
|
+
...props,
|
|
2888
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
2889
|
+
className: "pointer-events-none absolute right-2",
|
|
2890
|
+
children: /* @__PURE__ */ jsx(ContextMenu$1.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {}) })
|
|
2891
|
+
}), children]
|
|
2892
|
+
});
|
|
2893
|
+
}
|
|
2894
|
+
function ContextMenuRadioItem({ className, children, inset, ...props }) {
|
|
2895
|
+
return /* @__PURE__ */ jsxs(ContextMenu$1.RadioItem, {
|
|
2896
|
+
"data-slot": "context-menu-radio-item",
|
|
2897
|
+
"data-inset": inset,
|
|
2898
|
+
className: cn("relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-8 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
2899
|
+
...props,
|
|
2900
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
2901
|
+
className: "pointer-events-none absolute right-2",
|
|
2902
|
+
children: /* @__PURE__ */ jsx(ContextMenu$1.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {}) })
|
|
2903
|
+
}), children]
|
|
2904
|
+
});
|
|
2905
|
+
}
|
|
2906
|
+
function ContextMenuLabel({ className, inset, ...props }) {
|
|
2907
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Label, {
|
|
2908
|
+
"data-slot": "context-menu-label",
|
|
2909
|
+
"data-inset": inset,
|
|
2910
|
+
className: cn("px-2 py-1.5 text-xs font-medium text-muted-foreground data-inset:pl-8", className),
|
|
2911
|
+
...props
|
|
2912
|
+
});
|
|
2913
|
+
}
|
|
2914
|
+
function ContextMenuSeparator({ className, ...props }) {
|
|
2915
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Separator, {
|
|
2916
|
+
"data-slot": "context-menu-separator",
|
|
2917
|
+
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
2918
|
+
...props
|
|
2919
|
+
});
|
|
2920
|
+
}
|
|
2921
|
+
function ContextMenuShortcut({ className, ...props }) {
|
|
2922
|
+
return /* @__PURE__ */ jsx("span", {
|
|
2923
|
+
"data-slot": "context-menu-shortcut",
|
|
2924
|
+
className: cn("ml-auto text-xs tracking-widest text-muted-foreground group-focus/context-menu-item:text-accent-foreground", className),
|
|
2925
|
+
...props
|
|
2926
|
+
});
|
|
2927
|
+
}
|
|
2928
|
+
//#endregion
|
|
2929
|
+
//#region src/components/direction.tsx
|
|
2930
|
+
function DirectionProvider({ dir, direction, children }) {
|
|
2931
|
+
return /* @__PURE__ */ jsx(Direction.DirectionProvider, {
|
|
2932
|
+
dir: direction ?? dir,
|
|
2933
|
+
children
|
|
2934
|
+
});
|
|
2935
|
+
}
|
|
2936
|
+
const useDirection = Direction.useDirection;
|
|
2937
|
+
//#endregion
|
|
2938
|
+
//#region src/components/drawer.tsx
|
|
2939
|
+
function Drawer({ ...props }) {
|
|
2940
|
+
return /* @__PURE__ */ jsx(Drawer$1.Root, {
|
|
2941
|
+
"data-slot": "drawer",
|
|
2942
|
+
...props
|
|
2943
|
+
});
|
|
2944
|
+
}
|
|
2945
|
+
function DrawerTrigger({ ...props }) {
|
|
2946
|
+
return /* @__PURE__ */ jsx(Drawer$1.Trigger, {
|
|
2947
|
+
"data-slot": "drawer-trigger",
|
|
2948
|
+
...props
|
|
2949
|
+
});
|
|
2950
|
+
}
|
|
2951
|
+
function DrawerPortal({ ...props }) {
|
|
2952
|
+
return /* @__PURE__ */ jsx(Drawer$1.Portal, {
|
|
2953
|
+
"data-slot": "drawer-portal",
|
|
2954
|
+
...props
|
|
2955
|
+
});
|
|
2956
|
+
}
|
|
2957
|
+
function DrawerClose({ ...props }) {
|
|
2958
|
+
return /* @__PURE__ */ jsx(Drawer$1.Close, {
|
|
2959
|
+
"data-slot": "drawer-close",
|
|
2960
|
+
...props
|
|
2961
|
+
});
|
|
2962
|
+
}
|
|
2963
|
+
function DrawerOverlay({ className, ...props }) {
|
|
2964
|
+
return /* @__PURE__ */ jsx(Drawer$1.Overlay, {
|
|
2965
|
+
"data-slot": "drawer-overlay",
|
|
2966
|
+
className: cn("fixed inset-0 z-9999 bg-black/10 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0", className),
|
|
2967
|
+
...props
|
|
2968
|
+
});
|
|
2969
|
+
}
|
|
2970
|
+
function DrawerContent({ className, container, children, ...props }) {
|
|
2971
|
+
return /* @__PURE__ */ jsxs(DrawerPortal, {
|
|
2972
|
+
"data-slot": "drawer-portal",
|
|
2973
|
+
container,
|
|
2974
|
+
children: [/* @__PURE__ */ jsx(DrawerOverlay, {}), /* @__PURE__ */ jsxs(Drawer$1.Content, {
|
|
2975
|
+
"data-slot": "drawer-content",
|
|
2976
|
+
className: cn("group/drawer-content fixed z-9999 flex h-auto flex-col bg-popover text-sm text-popover-foreground data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-xl data-[vaul-drawer-direction=bottom]:border-t data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:rounded-r-xl data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:rounded-l-xl data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-xl data-[vaul-drawer-direction=top]:border-b data-[vaul-drawer-direction=left]:sm:max-w-sm data-[vaul-drawer-direction=right]:sm:max-w-sm", className),
|
|
2977
|
+
...props,
|
|
2978
|
+
children: [/* @__PURE__ */ jsx("div", { className: "mx-auto mt-4 hidden h-1.5 w-[100px] shrink-0 rounded-full bg-muted group-data-[vaul-drawer-direction=bottom]/drawer-content:block" }), children]
|
|
2979
|
+
})]
|
|
2980
|
+
});
|
|
2981
|
+
}
|
|
2982
|
+
function DrawerHeader({ className, ...props }) {
|
|
2983
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2984
|
+
"data-slot": "drawer-header",
|
|
2985
|
+
className: cn("flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left", className),
|
|
2986
|
+
...props
|
|
2987
|
+
});
|
|
2988
|
+
}
|
|
2989
|
+
function DrawerFooter({ className, ...props }) {
|
|
2990
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2991
|
+
"data-slot": "drawer-footer",
|
|
2992
|
+
className: cn("mt-auto flex flex-col gap-2 p-4", className),
|
|
2993
|
+
...props
|
|
2994
|
+
});
|
|
2995
|
+
}
|
|
2996
|
+
function DrawerTitle({ className, ...props }) {
|
|
2997
|
+
return /* @__PURE__ */ jsx(Drawer$1.Title, {
|
|
2998
|
+
"data-slot": "drawer-title",
|
|
2999
|
+
className: cn("font-medium text-foreground", className),
|
|
3000
|
+
...props
|
|
3001
|
+
});
|
|
3002
|
+
}
|
|
3003
|
+
function DrawerDescription({ className, ...props }) {
|
|
3004
|
+
return /* @__PURE__ */ jsx(Drawer$1.Description, {
|
|
3005
|
+
"data-slot": "drawer-description",
|
|
3006
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
3007
|
+
...props
|
|
3008
|
+
});
|
|
3009
|
+
}
|
|
3010
|
+
//#endregion
|
|
3011
|
+
//#region src/components/empty.tsx
|
|
3012
|
+
function Empty({ className, ...props }) {
|
|
3013
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3014
|
+
"data-slot": "empty",
|
|
3015
|
+
className: cn("flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-lg border-dashed p-12 text-center text-balance", className),
|
|
3016
|
+
...props
|
|
3017
|
+
});
|
|
3018
|
+
}
|
|
3019
|
+
function EmptyHeader({ className, ...props }) {
|
|
3020
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3021
|
+
"data-slot": "empty-header",
|
|
3022
|
+
className: cn("flex max-w-sm flex-col items-center gap-2", className),
|
|
3023
|
+
...props
|
|
3024
|
+
});
|
|
3025
|
+
}
|
|
3026
|
+
const emptyMediaVariants = cva("mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0", {
|
|
3027
|
+
variants: { variant: {
|
|
3028
|
+
default: "bg-transparent",
|
|
3029
|
+
icon: "flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-6"
|
|
3030
|
+
} },
|
|
3031
|
+
defaultVariants: { variant: "default" }
|
|
3032
|
+
});
|
|
3033
|
+
function EmptyMedia({ className, variant = "default", ...props }) {
|
|
3034
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3035
|
+
"data-slot": "empty-icon",
|
|
3036
|
+
"data-variant": variant,
|
|
3037
|
+
className: cn(emptyMediaVariants({
|
|
3038
|
+
variant,
|
|
3039
|
+
className
|
|
3040
|
+
})),
|
|
3041
|
+
...props
|
|
3042
|
+
});
|
|
3043
|
+
}
|
|
3044
|
+
function EmptyTitle({ className, ...props }) {
|
|
3045
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3046
|
+
"data-slot": "empty-title",
|
|
3047
|
+
className: cn("text-lg font-medium tracking-tight", className),
|
|
3048
|
+
...props
|
|
3049
|
+
});
|
|
3050
|
+
}
|
|
3051
|
+
function EmptyDescription({ className, ...props }) {
|
|
3052
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3053
|
+
"data-slot": "empty-description",
|
|
3054
|
+
className: cn("text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary", className),
|
|
3055
|
+
...props
|
|
3056
|
+
});
|
|
3057
|
+
}
|
|
3058
|
+
function EmptyContent({ className, ...props }) {
|
|
3059
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3060
|
+
"data-slot": "empty-content",
|
|
3061
|
+
className: cn("flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance", className),
|
|
3062
|
+
...props
|
|
3063
|
+
});
|
|
3064
|
+
}
|
|
3065
|
+
//#endregion
|
|
3066
|
+
//#region src/components/label.tsx
|
|
3067
|
+
function Label({ className, ...props }) {
|
|
3068
|
+
return /* @__PURE__ */ jsx(Label$1.Root, {
|
|
3069
|
+
"data-slot": "label",
|
|
3070
|
+
className: cn("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", className),
|
|
3071
|
+
...props
|
|
3072
|
+
});
|
|
3073
|
+
}
|
|
3074
|
+
//#endregion
|
|
3075
|
+
//#region src/components/field.tsx
|
|
3076
|
+
function FieldSet({ className, ...props }) {
|
|
3077
|
+
return /* @__PURE__ */ jsx("fieldset", {
|
|
3078
|
+
"data-slot": "field-set",
|
|
3079
|
+
className: cn("flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3", className),
|
|
3080
|
+
...props
|
|
3081
|
+
});
|
|
3082
|
+
}
|
|
3083
|
+
function FieldLegend({ className, variant = "legend", ...props }) {
|
|
3084
|
+
return /* @__PURE__ */ jsx("legend", {
|
|
3085
|
+
"data-slot": "field-legend",
|
|
3086
|
+
"data-variant": variant,
|
|
3087
|
+
className: cn("mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base", className),
|
|
3088
|
+
...props
|
|
3089
|
+
});
|
|
3090
|
+
}
|
|
3091
|
+
function FieldGroup({ className, ...props }) {
|
|
3092
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3093
|
+
"data-slot": "field-group",
|
|
3094
|
+
className: cn("group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4", className),
|
|
3095
|
+
...props
|
|
3096
|
+
});
|
|
3097
|
+
}
|
|
3098
|
+
const fieldVariants = cva("group/field flex w-full gap-3 data-[invalid=true]:text-destructive", {
|
|
3099
|
+
variants: { orientation: {
|
|
3100
|
+
vertical: "flex-col *:w-full [&>.sr-only]:w-auto",
|
|
3101
|
+
horizontal: "flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
|
|
3102
|
+
responsive: "flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
3103
|
+
} },
|
|
3104
|
+
defaultVariants: { orientation: "vertical" }
|
|
3105
|
+
});
|
|
3106
|
+
function Field({ className, orientation = "vertical", ...props }) {
|
|
3107
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3108
|
+
role: "group",
|
|
3109
|
+
"data-slot": "field",
|
|
3110
|
+
"data-orientation": orientation,
|
|
3111
|
+
className: cn(fieldVariants({ orientation }), className),
|
|
3112
|
+
...props
|
|
3113
|
+
});
|
|
3114
|
+
}
|
|
3115
|
+
function FieldContent({ className, ...props }) {
|
|
3116
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3117
|
+
"data-slot": "field-content",
|
|
3118
|
+
className: cn("group/field-content flex flex-1 flex-col gap-1 leading-snug", className),
|
|
3119
|
+
...props
|
|
3120
|
+
});
|
|
3121
|
+
}
|
|
3122
|
+
function FieldLabel({ className, ...props }) {
|
|
3123
|
+
return /* @__PURE__ */ jsx(Label, {
|
|
3124
|
+
"data-slot": "field-label",
|
|
3125
|
+
className: cn("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border *:data-[slot=field]:p-3 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10", "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col", className),
|
|
3126
|
+
...props
|
|
3127
|
+
});
|
|
3128
|
+
}
|
|
3129
|
+
function FieldTitle({ className, ...props }) {
|
|
3130
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3131
|
+
"data-slot": "field-label",
|
|
3132
|
+
className: cn("flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50", className),
|
|
3133
|
+
...props
|
|
3134
|
+
});
|
|
3135
|
+
}
|
|
3136
|
+
function FieldDescription({ className, ...props }) {
|
|
3137
|
+
return /* @__PURE__ */ jsx("p", {
|
|
3138
|
+
"data-slot": "field-description",
|
|
3139
|
+
className: cn("text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5", "last:mt-0 nth-last-2:-mt-1", "[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary", className),
|
|
3140
|
+
...props
|
|
3141
|
+
});
|
|
3142
|
+
}
|
|
3143
|
+
function FieldSeparator({ children, className, ...props }) {
|
|
3144
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3145
|
+
"data-slot": "field-separator",
|
|
3146
|
+
"data-content": !!children,
|
|
3147
|
+
className: cn("relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2", className),
|
|
3148
|
+
...props,
|
|
3149
|
+
children: [/* @__PURE__ */ jsx(Separator, { className: "absolute inset-0 top-1/2" }), children && /* @__PURE__ */ jsx("span", {
|
|
3150
|
+
className: "relative mx-auto block w-fit bg-background px-2 text-muted-foreground",
|
|
3151
|
+
"data-slot": "field-separator-content",
|
|
3152
|
+
children
|
|
3153
|
+
})]
|
|
3154
|
+
});
|
|
3155
|
+
}
|
|
3156
|
+
function FieldError({ className, children, errors, ...props }) {
|
|
3157
|
+
const content = useMemo(() => {
|
|
3158
|
+
if (children) return children;
|
|
3159
|
+
if (!errors?.length) return null;
|
|
3160
|
+
const uniqueErrors = [...new Map(errors.map((error) => [error?.message, error])).values()];
|
|
3161
|
+
if (uniqueErrors?.length == 1) return uniqueErrors[0]?.message;
|
|
3162
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
3163
|
+
className: "ml-4 flex list-disc flex-col gap-1",
|
|
3164
|
+
children: uniqueErrors.map((error, index) => error?.message && /* @__PURE__ */ jsx("li", { children: error.message }, index))
|
|
3165
|
+
});
|
|
3166
|
+
}, [children, errors]);
|
|
3167
|
+
if (!content) return null;
|
|
3168
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3169
|
+
role: "alert",
|
|
3170
|
+
"data-slot": "field-error",
|
|
3171
|
+
className: cn("text-sm font-normal text-destructive", className),
|
|
3172
|
+
...props,
|
|
3173
|
+
children: content
|
|
3174
|
+
});
|
|
3175
|
+
}
|
|
3176
|
+
//#endregion
|
|
3177
|
+
//#region src/components/input-otp.tsx
|
|
3178
|
+
function InputOTP({ className, containerClassName, ...props }) {
|
|
3179
|
+
return /* @__PURE__ */ jsx(OTPInput, {
|
|
3180
|
+
"data-slot": "input-otp",
|
|
3181
|
+
containerClassName: cn("cn-input-otp flex items-center has-disabled:opacity-50", containerClassName),
|
|
3182
|
+
spellCheck: false,
|
|
3183
|
+
className: cn("disabled:cursor-not-allowed", className),
|
|
3184
|
+
...props
|
|
3185
|
+
});
|
|
3186
|
+
}
|
|
3187
|
+
function InputOTPGroup({ className, ...props }) {
|
|
3188
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3189
|
+
"data-slot": "input-otp-group",
|
|
3190
|
+
className: cn("flex items-center rounded-md has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40", className),
|
|
3191
|
+
...props
|
|
3192
|
+
});
|
|
3193
|
+
}
|
|
3194
|
+
function InputOTPSlot({ index, className, ...props }) {
|
|
3195
|
+
const { char, hasFakeCaret, isActive } = React.useContext(OTPInputContext)?.slots[index] ?? {};
|
|
3196
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3197
|
+
"data-slot": "input-otp-slot",
|
|
3198
|
+
"data-active": isActive,
|
|
3199
|
+
className: cn("relative flex size-9 items-center justify-center border-y border-r border-input text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md aria-invalid:border-destructive data-[active=true]:z-10 data-[active=true]:border-ring data-[active=true]:ring-3 data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:border-destructive data-[active=true]:aria-invalid:ring-destructive/20 dark:bg-input/30 dark:data-[active=true]:aria-invalid:ring-destructive/40", className),
|
|
3200
|
+
...props,
|
|
3201
|
+
children: [char, hasFakeCaret && /* @__PURE__ */ jsx("div", {
|
|
3202
|
+
className: "pointer-events-none absolute inset-0 flex items-center justify-center",
|
|
3203
|
+
children: /* @__PURE__ */ jsx("div", { className: "h-4 w-px animate-caret-blink bg-foreground duration-1000" })
|
|
3204
|
+
})]
|
|
3205
|
+
});
|
|
3206
|
+
}
|
|
3207
|
+
function InputOTPSeparator({ ...props }) {
|
|
3208
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3209
|
+
"data-slot": "input-otp-separator",
|
|
3210
|
+
className: "flex items-center [&_svg:not([class*='size-'])]:size-4",
|
|
3211
|
+
role: "separator",
|
|
3212
|
+
...props,
|
|
3213
|
+
children: /* @__PURE__ */ jsx(MinusIcon, {})
|
|
3214
|
+
});
|
|
3215
|
+
}
|
|
3216
|
+
//#endregion
|
|
3217
|
+
//#region src/components/item.tsx
|
|
3218
|
+
function ItemGroup({ className, ...props }) {
|
|
3219
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3220
|
+
role: "list",
|
|
3221
|
+
"data-slot": "item-group",
|
|
3222
|
+
className: cn("group/item-group flex w-full flex-col gap-4 has-data-[size=sm]:gap-2.5 has-data-[size=xs]:gap-2", className),
|
|
3223
|
+
...props
|
|
3224
|
+
});
|
|
3225
|
+
}
|
|
3226
|
+
function ItemSeparator({ className, ...props }) {
|
|
3227
|
+
return /* @__PURE__ */ jsx(Separator, {
|
|
3228
|
+
"data-slot": "item-separator",
|
|
3229
|
+
orientation: "horizontal",
|
|
3230
|
+
className: cn("my-2", className),
|
|
3231
|
+
...props
|
|
3232
|
+
});
|
|
3233
|
+
}
|
|
3234
|
+
const itemVariants = cva("group/item flex w-full flex-wrap items-center rounded-md border text-sm transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-muted", {
|
|
3235
|
+
variants: {
|
|
3236
|
+
variant: {
|
|
3237
|
+
default: "border-transparent",
|
|
3238
|
+
outline: "border-border",
|
|
3239
|
+
muted: "border-transparent bg-muted/50"
|
|
3240
|
+
},
|
|
3241
|
+
size: {
|
|
3242
|
+
default: "gap-3.5 px-4 py-3.5",
|
|
3243
|
+
sm: "gap-2.5 px-3 py-2.5",
|
|
3244
|
+
xs: "gap-2 px-2.5 py-2 in-data-[slot=dropdown-menu-content]:p-0"
|
|
3245
|
+
}
|
|
3246
|
+
},
|
|
3247
|
+
defaultVariants: {
|
|
3248
|
+
variant: "default",
|
|
3249
|
+
size: "default"
|
|
3250
|
+
}
|
|
3251
|
+
});
|
|
3252
|
+
function Item({ className, variant = "default", size = "default", asChild = false, ...props }) {
|
|
3253
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "div", {
|
|
3254
|
+
"data-slot": "item",
|
|
3255
|
+
"data-variant": variant,
|
|
3256
|
+
"data-size": size,
|
|
3257
|
+
className: cn(itemVariants({
|
|
3258
|
+
variant,
|
|
3259
|
+
size,
|
|
3260
|
+
className
|
|
3261
|
+
})),
|
|
3262
|
+
...props
|
|
3263
|
+
});
|
|
3264
|
+
}
|
|
3265
|
+
const itemMediaVariants = cva("flex shrink-0 items-center justify-center gap-2 group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start [&_svg]:pointer-events-none", {
|
|
3266
|
+
variants: { variant: {
|
|
3267
|
+
default: "bg-transparent",
|
|
3268
|
+
icon: "[&_svg:not([class*='size-'])]:size-4",
|
|
3269
|
+
image: "size-10 overflow-hidden rounded-sm group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 [&_img]:size-full [&_img]:object-cover"
|
|
3270
|
+
} },
|
|
3271
|
+
defaultVariants: { variant: "default" }
|
|
3272
|
+
});
|
|
3273
|
+
function ItemMedia({ className, variant = "default", ...props }) {
|
|
3274
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3275
|
+
"data-slot": "item-media",
|
|
3276
|
+
"data-variant": variant,
|
|
3277
|
+
className: cn(itemMediaVariants({
|
|
3278
|
+
variant,
|
|
3279
|
+
className
|
|
3280
|
+
})),
|
|
3281
|
+
...props
|
|
3282
|
+
});
|
|
3283
|
+
}
|
|
3284
|
+
function ItemContent({ className, ...props }) {
|
|
3285
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3286
|
+
"data-slot": "item-content",
|
|
3287
|
+
className: cn("flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0 [&+[data-slot=item-content]]:flex-none", className),
|
|
3288
|
+
...props
|
|
3289
|
+
});
|
|
3290
|
+
}
|
|
3291
|
+
function ItemTitle({ className, ...props }) {
|
|
3292
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3293
|
+
"data-slot": "item-title",
|
|
3294
|
+
className: cn("line-clamp-1 flex w-fit items-center gap-2 text-sm leading-snug font-medium underline-offset-4", className),
|
|
3295
|
+
...props
|
|
3296
|
+
});
|
|
3297
|
+
}
|
|
3298
|
+
function ItemDescription({ className, ...props }) {
|
|
3299
|
+
return /* @__PURE__ */ jsx("p", {
|
|
3300
|
+
"data-slot": "item-description",
|
|
3301
|
+
className: cn("line-clamp-2 text-left text-sm leading-normal font-normal text-muted-foreground group-data-[size=xs]/item:text-xs [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary", className),
|
|
3302
|
+
...props
|
|
3303
|
+
});
|
|
3304
|
+
}
|
|
3305
|
+
function ItemActions({ className, ...props }) {
|
|
3306
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3307
|
+
"data-slot": "item-actions",
|
|
3308
|
+
className: cn("flex items-center gap-2", className),
|
|
3309
|
+
...props
|
|
3310
|
+
});
|
|
3311
|
+
}
|
|
3312
|
+
function ItemHeader({ className, ...props }) {
|
|
3313
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3314
|
+
"data-slot": "item-header",
|
|
3315
|
+
className: cn("flex basis-full items-center justify-between gap-2", className),
|
|
3316
|
+
...props
|
|
3317
|
+
});
|
|
3318
|
+
}
|
|
3319
|
+
function ItemFooter({ className, ...props }) {
|
|
3320
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3321
|
+
"data-slot": "item-footer",
|
|
3322
|
+
className: cn("flex basis-full items-center justify-between gap-2", className),
|
|
3323
|
+
...props
|
|
3324
|
+
});
|
|
3325
|
+
}
|
|
3326
|
+
//#endregion
|
|
3327
|
+
//#region src/components/kbd.tsx
|
|
3328
|
+
function Kbd({ className, ...props }) {
|
|
3329
|
+
return /* @__PURE__ */ jsx("kbd", {
|
|
3330
|
+
"data-slot": "kbd",
|
|
3331
|
+
className: cn("pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3", className),
|
|
3332
|
+
...props
|
|
3333
|
+
});
|
|
3334
|
+
}
|
|
3335
|
+
function KbdGroup({ className, ...props }) {
|
|
3336
|
+
return /* @__PURE__ */ jsx("kbd", {
|
|
3337
|
+
"data-slot": "kbd-group",
|
|
3338
|
+
className: cn("inline-flex items-center gap-1", className),
|
|
3339
|
+
...props
|
|
3340
|
+
});
|
|
3341
|
+
}
|
|
3342
|
+
//#endregion
|
|
3343
|
+
//#region src/components/menubar.tsx
|
|
3344
|
+
function Menubar({ className, ...props }) {
|
|
3345
|
+
return /* @__PURE__ */ jsx(Menubar$1.Root, {
|
|
3346
|
+
"data-slot": "menubar",
|
|
3347
|
+
className: cn("flex h-9 items-center gap-1 rounded-md border p-1 shadow-xs", className),
|
|
3348
|
+
...props
|
|
3349
|
+
});
|
|
3350
|
+
}
|
|
3351
|
+
function MenubarMenu({ ...props }) {
|
|
3352
|
+
return /* @__PURE__ */ jsx(Menubar$1.Menu, {
|
|
3353
|
+
"data-slot": "menubar-menu",
|
|
3354
|
+
...props
|
|
3355
|
+
});
|
|
3356
|
+
}
|
|
3357
|
+
function MenubarGroup({ ...props }) {
|
|
3358
|
+
return /* @__PURE__ */ jsx(Menubar$1.Group, {
|
|
3359
|
+
"data-slot": "menubar-group",
|
|
3360
|
+
...props
|
|
3361
|
+
});
|
|
3362
|
+
}
|
|
3363
|
+
function MenubarPortal({ ...props }) {
|
|
3364
|
+
return /* @__PURE__ */ jsx(Menubar$1.Portal, {
|
|
3365
|
+
"data-slot": "menubar-portal",
|
|
3366
|
+
...props
|
|
3367
|
+
});
|
|
3368
|
+
}
|
|
3369
|
+
function MenubarRadioGroup({ ...props }) {
|
|
3370
|
+
return /* @__PURE__ */ jsx(Menubar$1.RadioGroup, {
|
|
3371
|
+
"data-slot": "menubar-radio-group",
|
|
3372
|
+
...props
|
|
3373
|
+
});
|
|
3374
|
+
}
|
|
3375
|
+
function MenubarTrigger({ className, ...props }) {
|
|
3376
|
+
return /* @__PURE__ */ jsx(Menubar$1.Trigger, {
|
|
3377
|
+
"data-slot": "menubar-trigger",
|
|
3378
|
+
className: cn("flex items-center rounded-sm px-2 py-1 text-sm font-medium outline-hidden select-none hover:bg-muted aria-expanded:bg-muted", className),
|
|
3379
|
+
...props
|
|
3380
|
+
});
|
|
3381
|
+
}
|
|
3382
|
+
function MenubarContent({ className, align = "start", alignOffset = -4, sideOffset = 8, ...props }) {
|
|
3383
|
+
return /* @__PURE__ */ jsx(MenubarPortal, { children: /* @__PURE__ */ jsx(Menubar$1.Content, {
|
|
3384
|
+
"data-slot": "menubar-content",
|
|
3385
|
+
align,
|
|
3386
|
+
alignOffset,
|
|
3387
|
+
sideOffset,
|
|
3388
|
+
className: cn("z-50 min-w-36 origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-md bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 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-open:animate-in data-open:fade-in-0 data-open:zoom-in-95", className),
|
|
3389
|
+
...props
|
|
3390
|
+
}) });
|
|
3391
|
+
}
|
|
3392
|
+
function MenubarItem({ className, inset, variant = "default", ...props }) {
|
|
3393
|
+
return /* @__PURE__ */ jsx(Menubar$1.Item, {
|
|
3394
|
+
"data-slot": "menubar-item",
|
|
3395
|
+
"data-inset": inset,
|
|
3396
|
+
"data-variant": variant,
|
|
3397
|
+
className: cn("group/menubar-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive!", className),
|
|
3398
|
+
...props
|
|
3399
|
+
});
|
|
3400
|
+
}
|
|
3401
|
+
function MenubarCheckboxItem({ className, children, checked, inset, ...props }) {
|
|
3402
|
+
return /* @__PURE__ */ jsxs(Menubar$1.CheckboxItem, {
|
|
3403
|
+
"data-slot": "menubar-checkbox-item",
|
|
3404
|
+
"data-inset": inset,
|
|
3405
|
+
className: cn("relative flex cursor-default items-center gap-2 rounded-md py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-8 data-disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0", className),
|
|
3406
|
+
checked,
|
|
3407
|
+
...props,
|
|
3408
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
3409
|
+
className: "pointer-events-none absolute left-2 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4",
|
|
3410
|
+
children: /* @__PURE__ */ jsx(Menubar$1.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {}) })
|
|
3411
|
+
}), children]
|
|
3412
|
+
});
|
|
3413
|
+
}
|
|
3414
|
+
function MenubarRadioItem({ className, children, inset, ...props }) {
|
|
3415
|
+
return /* @__PURE__ */ jsxs(Menubar$1.RadioItem, {
|
|
3416
|
+
"data-slot": "menubar-radio-item",
|
|
3417
|
+
"data-inset": inset,
|
|
3418
|
+
className: cn("relative flex cursor-default items-center gap-2 rounded-md py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-8 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
3419
|
+
...props,
|
|
3420
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
3421
|
+
className: "pointer-events-none absolute left-2 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4",
|
|
3422
|
+
children: /* @__PURE__ */ jsx(Menubar$1.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {}) })
|
|
3423
|
+
}), children]
|
|
3424
|
+
});
|
|
3425
|
+
}
|
|
3426
|
+
function MenubarLabel({ className, inset, ...props }) {
|
|
3427
|
+
return /* @__PURE__ */ jsx(Menubar$1.Label, {
|
|
3428
|
+
"data-slot": "menubar-label",
|
|
3429
|
+
"data-inset": inset,
|
|
3430
|
+
className: cn("px-2 py-1.5 text-sm font-medium data-inset:pl-8", className),
|
|
3431
|
+
...props
|
|
3432
|
+
});
|
|
3433
|
+
}
|
|
3434
|
+
function MenubarSeparator({ className, ...props }) {
|
|
3435
|
+
return /* @__PURE__ */ jsx(Menubar$1.Separator, {
|
|
3436
|
+
"data-slot": "menubar-separator",
|
|
3437
|
+
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
3438
|
+
...props
|
|
3439
|
+
});
|
|
3440
|
+
}
|
|
3441
|
+
function MenubarShortcut({ className, ...props }) {
|
|
3442
|
+
return /* @__PURE__ */ jsx("span", {
|
|
3443
|
+
"data-slot": "menubar-shortcut",
|
|
3444
|
+
className: cn("ml-auto text-xs tracking-widest text-muted-foreground group-focus/menubar-item:text-accent-foreground", className),
|
|
3445
|
+
...props
|
|
3446
|
+
});
|
|
3447
|
+
}
|
|
3448
|
+
function MenubarSub({ ...props }) {
|
|
3449
|
+
return /* @__PURE__ */ jsx(Menubar$1.Sub, {
|
|
3450
|
+
"data-slot": "menubar-sub",
|
|
3451
|
+
...props
|
|
3452
|
+
});
|
|
3453
|
+
}
|
|
3454
|
+
function MenubarSubTrigger({ className, inset, children, ...props }) {
|
|
3455
|
+
return /* @__PURE__ */ jsxs(Menubar$1.SubTrigger, {
|
|
3456
|
+
"data-slot": "menubar-sub-trigger",
|
|
3457
|
+
"data-inset": inset,
|
|
3458
|
+
className: cn("flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-8 data-open:bg-accent data-open:text-accent-foreground [&_svg:not([class*='size-'])]:size-4", className),
|
|
3459
|
+
...props,
|
|
3460
|
+
children: [children, /* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto size-4" })]
|
|
3461
|
+
});
|
|
3462
|
+
}
|
|
3463
|
+
function MenubarSubContent({ className, ...props }) {
|
|
3464
|
+
return /* @__PURE__ */ jsx(Menubar$1.SubContent, {
|
|
3465
|
+
"data-slot": "menubar-sub-content",
|
|
3466
|
+
className: cn("z-50 min-w-32 origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-md bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 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-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", className),
|
|
3467
|
+
...props
|
|
3468
|
+
});
|
|
3469
|
+
}
|
|
3470
|
+
//#endregion
|
|
3471
|
+
//#region src/components/native-select.tsx
|
|
3472
|
+
function NativeSelect({ className, size = "default", ...props }) {
|
|
3473
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3474
|
+
className: cn("group/native-select relative w-fit has-[select:disabled]:opacity-50", className),
|
|
3475
|
+
"data-slot": "native-select-wrapper",
|
|
3476
|
+
"data-size": size,
|
|
3477
|
+
children: [/* @__PURE__ */ jsx("select", {
|
|
3478
|
+
"data-slot": "native-select",
|
|
3479
|
+
"data-size": size,
|
|
3480
|
+
className: "h-9 w-full min-w-0 appearance-none rounded-md border border-input bg-transparent py-1 pr-8 pl-2.5 text-sm shadow-xs transition-[color,box-shadow] outline-none select-none selection:bg-primary selection:text-primary-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 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=sm]:h-8 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
|
|
3481
|
+
...props
|
|
3482
|
+
}), /* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
3483
|
+
className: "pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground select-none",
|
|
3484
|
+
"aria-hidden": "true",
|
|
3485
|
+
"data-slot": "native-select-icon"
|
|
3486
|
+
})]
|
|
3487
|
+
});
|
|
3488
|
+
}
|
|
3489
|
+
function NativeSelectOption({ ...props }) {
|
|
3490
|
+
return /* @__PURE__ */ jsx("option", {
|
|
3491
|
+
"data-slot": "native-select-option",
|
|
3492
|
+
...props
|
|
3493
|
+
});
|
|
3494
|
+
}
|
|
3495
|
+
function NativeSelectOptGroup({ className, ...props }) {
|
|
3496
|
+
return /* @__PURE__ */ jsx("optgroup", {
|
|
3497
|
+
"data-slot": "native-select-optgroup",
|
|
3498
|
+
className: cn(className),
|
|
3499
|
+
...props
|
|
3500
|
+
});
|
|
3501
|
+
}
|
|
3502
|
+
//#endregion
|
|
3503
|
+
//#region src/components/navigation-menu.tsx
|
|
3504
|
+
function NavigationMenu({ className, children, viewport = true, ...props }) {
|
|
3505
|
+
return /* @__PURE__ */ jsxs(NavigationMenu$1.Root, {
|
|
3506
|
+
"data-slot": "navigation-menu",
|
|
3507
|
+
"data-viewport": viewport,
|
|
3508
|
+
className: cn("group/navigation-menu relative flex max-w-max flex-1 items-center justify-center", className),
|
|
3509
|
+
...props,
|
|
3510
|
+
children: [children, viewport && /* @__PURE__ */ jsx(NavigationMenuViewport, {})]
|
|
3511
|
+
});
|
|
3512
|
+
}
|
|
3513
|
+
function NavigationMenuList({ className, ...props }) {
|
|
3514
|
+
return /* @__PURE__ */ jsx(NavigationMenu$1.List, {
|
|
3515
|
+
"data-slot": "navigation-menu-list",
|
|
3516
|
+
className: cn("group flex flex-1 list-none items-center justify-center gap-0", className),
|
|
3517
|
+
...props
|
|
3518
|
+
});
|
|
3519
|
+
}
|
|
3520
|
+
function NavigationMenuItem({ className, ...props }) {
|
|
3521
|
+
return /* @__PURE__ */ jsx(NavigationMenu$1.Item, {
|
|
3522
|
+
"data-slot": "navigation-menu-item",
|
|
3523
|
+
className: cn("relative", className),
|
|
3524
|
+
...props
|
|
3525
|
+
});
|
|
3526
|
+
}
|
|
3527
|
+
const navigationMenuTriggerStyle = cva("group/navigation-menu-trigger inline-flex h-9 w-max items-center justify-center rounded-md px-4 py-2 text-sm font-medium transition-all outline-none hover:bg-muted focus:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-popup-open:bg-muted/50 data-popup-open:hover:bg-muted data-open:bg-muted/50 data-open:hover:bg-muted data-open:focus:bg-muted");
|
|
3528
|
+
function NavigationMenuTrigger({ className, children, ...props }) {
|
|
3529
|
+
return /* @__PURE__ */ jsxs(NavigationMenu$1.Trigger, {
|
|
3530
|
+
"data-slot": "navigation-menu-trigger",
|
|
3531
|
+
className: cn(navigationMenuTriggerStyle(), "group", className),
|
|
3532
|
+
...props,
|
|
3533
|
+
children: [
|
|
3534
|
+
children,
|
|
3535
|
+
" ",
|
|
3536
|
+
/* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
3537
|
+
className: "relative top-px ml-1 size-3 transition duration-300 group-data-popup-open/navigation-menu-trigger:rotate-180 group-data-open/navigation-menu-trigger:rotate-180",
|
|
3538
|
+
"aria-hidden": "true"
|
|
3539
|
+
})
|
|
3540
|
+
]
|
|
3541
|
+
});
|
|
3542
|
+
}
|
|
3543
|
+
function NavigationMenuContent({ className, ...props }) {
|
|
3544
|
+
return /* @__PURE__ */ jsx(NavigationMenu$1.Content, {
|
|
3545
|
+
"data-slot": "navigation-menu-content",
|
|
3546
|
+
className: cn("top-0 left-0 w-full p-2 pr-2.5 ease-[cubic-bezier(0.22,1,0.36,1)] group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-1.5 group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-md group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:ring-1 group-data-[viewport=false]/navigation-menu:ring-foreground/10 group-data-[viewport=false]/navigation-menu:duration-300 data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 data-[motion^=from-]:animate-in data-[motion^=from-]:fade-in data-[motion^=to-]:animate-out data-[motion^=to-]:fade-out **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none md:absolute md:w-auto group-data-[viewport=false]/navigation-menu:data-open:animate-in group-data-[viewport=false]/navigation-menu:data-open:fade-in-0 group-data-[viewport=false]/navigation-menu:data-open:zoom-in-95 group-data-[viewport=false]/navigation-menu:data-closed:animate-out group-data-[viewport=false]/navigation-menu:data-closed:fade-out-0 group-data-[viewport=false]/navigation-menu:data-closed:zoom-out-95", className),
|
|
3547
|
+
...props
|
|
3548
|
+
});
|
|
3549
|
+
}
|
|
3550
|
+
function NavigationMenuViewport({ className, ...props }) {
|
|
3551
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3552
|
+
className: cn("absolute top-full left-0 isolate z-50 flex justify-center"),
|
|
3553
|
+
children: /* @__PURE__ */ jsx(NavigationMenu$1.Viewport, {
|
|
3554
|
+
"data-slot": "navigation-menu-viewport",
|
|
3555
|
+
className: cn("origin-top-center relative mt-1.5 h-(--radix-navigation-menu-viewport-height) w-full overflow-hidden rounded-lg bg-popover text-popover-foreground shadow ring-1 ring-foreground/10 duration-100 md:w-(--radix-navigation-menu-viewport-width) data-open:animate-in data-open:zoom-in-90 data-closed:animate-out data-closed:zoom-out-90", className),
|
|
3556
|
+
...props
|
|
3557
|
+
})
|
|
3558
|
+
});
|
|
3559
|
+
}
|
|
3560
|
+
function NavigationMenuLink({ className, ...props }) {
|
|
3561
|
+
return /* @__PURE__ */ jsx(NavigationMenu$1.Link, {
|
|
3562
|
+
"data-slot": "navigation-menu-link",
|
|
3563
|
+
className: cn("flex items-center gap-1.5 rounded-md p-2 text-sm transition-all outline-none hover:bg-muted focus:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 in-data-[slot=navigation-menu-content]:rounded-sm data-[active=true]:bg-muted/50 data-[active=true]:hover:bg-muted data-[active=true]:focus:bg-muted [&_svg:not([class*='size-'])]:size-4", className),
|
|
3564
|
+
...props
|
|
3565
|
+
});
|
|
3566
|
+
}
|
|
3567
|
+
function NavigationMenuIndicator({ className, ...props }) {
|
|
3568
|
+
return /* @__PURE__ */ jsx(NavigationMenu$1.Indicator, {
|
|
3569
|
+
"data-slot": "navigation-menu-indicator",
|
|
3570
|
+
className: cn("top-full z-1 flex h-1.5 items-end justify-center overflow-hidden data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:animate-in data-[state=visible]:fade-in", className),
|
|
3571
|
+
...props,
|
|
3572
|
+
children: /* @__PURE__ */ jsx("div", { className: "relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md" })
|
|
3573
|
+
});
|
|
3574
|
+
}
|
|
3575
|
+
//#endregion
|
|
3576
|
+
//#region src/components/pagination.tsx
|
|
3577
|
+
function Pagination({ className, ...props }) {
|
|
3578
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
3579
|
+
role: "navigation",
|
|
3580
|
+
"aria-label": "pagination",
|
|
3581
|
+
"data-slot": "pagination",
|
|
3582
|
+
className: cn("mx-auto flex w-full justify-center", className),
|
|
3583
|
+
...props
|
|
3584
|
+
});
|
|
3585
|
+
}
|
|
3586
|
+
function PaginationContent({ className, ...props }) {
|
|
3587
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
3588
|
+
"data-slot": "pagination-content",
|
|
3589
|
+
className: cn("flex items-center gap-1", className),
|
|
3590
|
+
...props
|
|
3591
|
+
});
|
|
3592
|
+
}
|
|
3593
|
+
function PaginationItem({ ...props }) {
|
|
3594
|
+
return /* @__PURE__ */ jsx("li", {
|
|
3595
|
+
"data-slot": "pagination-item",
|
|
3596
|
+
...props
|
|
3597
|
+
});
|
|
3598
|
+
}
|
|
3599
|
+
function PaginationLink({ className, isActive, size = "icon", ...props }) {
|
|
3600
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
3601
|
+
asChild: true,
|
|
3602
|
+
variant: isActive ? "outline" : "ghost",
|
|
3603
|
+
size,
|
|
3604
|
+
className: cn(className),
|
|
3605
|
+
children: /* @__PURE__ */ jsx("a", {
|
|
3606
|
+
"aria-current": isActive ? "page" : void 0,
|
|
3607
|
+
"data-slot": "pagination-link",
|
|
3608
|
+
"data-active": isActive,
|
|
3609
|
+
...props
|
|
3610
|
+
})
|
|
3611
|
+
});
|
|
3612
|
+
}
|
|
3613
|
+
function PaginationPrevious({ className, text = "Previous", ...props }) {
|
|
3614
|
+
return /* @__PURE__ */ jsxs(PaginationLink, {
|
|
3615
|
+
"aria-label": "Go to previous page",
|
|
3616
|
+
size: "default",
|
|
3617
|
+
className: cn("pl-2!", className),
|
|
3618
|
+
...props,
|
|
3619
|
+
children: [/* @__PURE__ */ jsx(ChevronLeftIcon, { "data-icon": "inline-start" }), /* @__PURE__ */ jsx("span", {
|
|
3620
|
+
className: "hidden sm:block",
|
|
3621
|
+
children: text
|
|
3622
|
+
})]
|
|
3623
|
+
});
|
|
3624
|
+
}
|
|
3625
|
+
function PaginationNext({ className, text = "Next", ...props }) {
|
|
3626
|
+
return /* @__PURE__ */ jsxs(PaginationLink, {
|
|
3627
|
+
"aria-label": "Go to next page",
|
|
3628
|
+
size: "default",
|
|
3629
|
+
className: cn("pr-2!", className),
|
|
3630
|
+
...props,
|
|
3631
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
3632
|
+
className: "hidden sm:block",
|
|
3633
|
+
children: text
|
|
3634
|
+
}), /* @__PURE__ */ jsx(ChevronRightIcon, { "data-icon": "inline-end" })]
|
|
3635
|
+
});
|
|
3636
|
+
}
|
|
3637
|
+
function PaginationEllipsis({ className, ...props }) {
|
|
3638
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
3639
|
+
"aria-hidden": true,
|
|
3640
|
+
"data-slot": "pagination-ellipsis",
|
|
3641
|
+
className: cn("flex size-9 items-center justify-center [&_svg:not([class*='size-'])]:size-4", className),
|
|
3642
|
+
...props,
|
|
3643
|
+
children: [/* @__PURE__ */ jsx(MoreHorizontalIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
3644
|
+
className: "sr-only",
|
|
3645
|
+
children: "More pages"
|
|
3646
|
+
})]
|
|
3647
|
+
});
|
|
3648
|
+
}
|
|
3649
|
+
//#endregion
|
|
3650
|
+
//#region src/components/popover.tsx
|
|
3651
|
+
function Popover({ ...props }) {
|
|
3652
|
+
return /* @__PURE__ */ jsx(Popover$1.Root, {
|
|
3653
|
+
"data-slot": "popover",
|
|
3654
|
+
...props
|
|
3655
|
+
});
|
|
3656
|
+
}
|
|
3657
|
+
function PopoverTrigger({ ...props }) {
|
|
3658
|
+
return /* @__PURE__ */ jsx(Popover$1.Trigger, {
|
|
3659
|
+
"data-slot": "popover-trigger",
|
|
3660
|
+
...props
|
|
3661
|
+
});
|
|
3662
|
+
}
|
|
3663
|
+
function PopoverContent({ className, align = "center", sideOffset = 4, ...props }) {
|
|
3664
|
+
return /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(Popover$1.Content, {
|
|
3665
|
+
"data-slot": "popover-content",
|
|
3666
|
+
align,
|
|
3667
|
+
sideOffset,
|
|
3668
|
+
className: cn("z-50 flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-4 rounded-md bg-popover p-4 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 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-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", className),
|
|
3669
|
+
...props
|
|
3670
|
+
}) });
|
|
3671
|
+
}
|
|
3672
|
+
function PopoverAnchor({ ...props }) {
|
|
3673
|
+
return /* @__PURE__ */ jsx(Popover$1.Anchor, {
|
|
3674
|
+
"data-slot": "popover-anchor",
|
|
3675
|
+
...props
|
|
3676
|
+
});
|
|
3677
|
+
}
|
|
3678
|
+
function PopoverHeader({ className, ...props }) {
|
|
3679
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3680
|
+
"data-slot": "popover-header",
|
|
3681
|
+
className: cn("flex flex-col gap-1 text-sm", className),
|
|
3682
|
+
...props
|
|
3683
|
+
});
|
|
3684
|
+
}
|
|
3685
|
+
function PopoverTitle({ className, ...props }) {
|
|
3686
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3687
|
+
"data-slot": "popover-title",
|
|
3688
|
+
className: cn("font-medium", className),
|
|
3689
|
+
...props
|
|
3690
|
+
});
|
|
3691
|
+
}
|
|
3692
|
+
function PopoverDescription({ className, ...props }) {
|
|
3693
|
+
return /* @__PURE__ */ jsx("p", {
|
|
3694
|
+
"data-slot": "popover-description",
|
|
3695
|
+
className: cn("text-muted-foreground", className),
|
|
3696
|
+
...props
|
|
3697
|
+
});
|
|
3698
|
+
}
|
|
3699
|
+
//#endregion
|
|
3700
|
+
//#region src/components/progress.tsx
|
|
3701
|
+
function Progress({ className, value, ...props }) {
|
|
3702
|
+
return /* @__PURE__ */ jsx(Progress$1.Root, {
|
|
3703
|
+
"data-slot": "progress",
|
|
3704
|
+
className: cn("relative flex h-1.5 w-full items-center overflow-x-hidden rounded-full bg-muted", className),
|
|
3705
|
+
...props,
|
|
3706
|
+
children: /* @__PURE__ */ jsx(Progress$1.Indicator, {
|
|
3707
|
+
"data-slot": "progress-indicator",
|
|
3708
|
+
className: "size-full flex-1 bg-primary transition-all",
|
|
3709
|
+
style: { transform: `translateX(-${100 - (value || 0)}%)` }
|
|
3710
|
+
})
|
|
3711
|
+
});
|
|
3712
|
+
}
|
|
3713
|
+
//#endregion
|
|
3714
|
+
//#region src/components/radio-group.tsx
|
|
3715
|
+
function RadioGroup({ className, ...props }) {
|
|
3716
|
+
return /* @__PURE__ */ jsx(RadioGroup$1.Root, {
|
|
3717
|
+
"data-slot": "radio-group",
|
|
3718
|
+
className: cn("grid w-full gap-3", className),
|
|
3719
|
+
...props
|
|
3720
|
+
});
|
|
3721
|
+
}
|
|
3722
|
+
function RadioGroupItem({ className, ...props }) {
|
|
3723
|
+
return /* @__PURE__ */ jsx(RadioGroup$1.Item, {
|
|
3724
|
+
"data-slot": "radio-group-item",
|
|
3725
|
+
className: cn("group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary", className),
|
|
3726
|
+
...props,
|
|
3727
|
+
children: /* @__PURE__ */ jsx(RadioGroup$1.Indicator, {
|
|
3728
|
+
"data-slot": "radio-group-indicator",
|
|
3729
|
+
className: "flex size-4 items-center justify-center",
|
|
3730
|
+
children: /* @__PURE__ */ jsx("span", { className: "absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground" })
|
|
3731
|
+
})
|
|
3732
|
+
});
|
|
3733
|
+
}
|
|
3734
|
+
//#endregion
|
|
3735
|
+
//#region src/components/resizable.tsx
|
|
3736
|
+
function ResizablePanelGroup({ className, ...props }) {
|
|
3737
|
+
return /* @__PURE__ */ jsx(ResizablePrimitive.Group, {
|
|
3738
|
+
"data-slot": "resizable-panel-group",
|
|
3739
|
+
className: cn("flex h-full w-full aria-[orientation=vertical]:flex-col", className),
|
|
3740
|
+
...props
|
|
3741
|
+
});
|
|
3742
|
+
}
|
|
3743
|
+
function ResizablePanel({ ...props }) {
|
|
3744
|
+
return /* @__PURE__ */ jsx(ResizablePrimitive.Panel, {
|
|
3745
|
+
"data-slot": "resizable-panel",
|
|
3746
|
+
...props
|
|
3747
|
+
});
|
|
3748
|
+
}
|
|
3749
|
+
function ResizableHandle({ withHandle, className, ...props }) {
|
|
3750
|
+
return /* @__PURE__ */ jsx(ResizablePrimitive.Separator, {
|
|
3751
|
+
"data-slot": "resizable-handle",
|
|
3752
|
+
className: cn("relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90", className),
|
|
3753
|
+
...props,
|
|
3754
|
+
children: withHandle && /* @__PURE__ */ jsx("div", { className: "z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border" })
|
|
3755
|
+
});
|
|
3756
|
+
}
|
|
3757
|
+
//#endregion
|
|
3758
|
+
//#region src/components/scroll-area.tsx
|
|
3759
|
+
function ScrollArea({ className, children, ...props }) {
|
|
3760
|
+
return /* @__PURE__ */ jsxs(ScrollArea$1.Root, {
|
|
3761
|
+
"data-slot": "scroll-area",
|
|
3762
|
+
className: cn("relative", className),
|
|
3763
|
+
...props,
|
|
3764
|
+
children: [
|
|
3765
|
+
/* @__PURE__ */ jsx(ScrollArea$1.Viewport, {
|
|
3766
|
+
"data-slot": "scroll-area-viewport",
|
|
3767
|
+
className: "size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",
|
|
3768
|
+
children
|
|
3769
|
+
}),
|
|
3770
|
+
/* @__PURE__ */ jsx(ScrollBar, {}),
|
|
3771
|
+
/* @__PURE__ */ jsx(ScrollArea$1.Corner, {})
|
|
3772
|
+
]
|
|
3773
|
+
});
|
|
3774
|
+
}
|
|
3775
|
+
function ScrollBar({ className, orientation = "vertical", ...props }) {
|
|
3776
|
+
return /* @__PURE__ */ jsx(ScrollArea$1.ScrollAreaScrollbar, {
|
|
3777
|
+
"data-slot": "scroll-area-scrollbar",
|
|
3778
|
+
"data-orientation": orientation,
|
|
3779
|
+
orientation,
|
|
3780
|
+
className: cn("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", className),
|
|
3781
|
+
...props,
|
|
3782
|
+
children: /* @__PURE__ */ jsx(ScrollArea$1.ScrollAreaThumb, {
|
|
3783
|
+
"data-slot": "scroll-area-thumb",
|
|
3784
|
+
className: "relative flex-1 rounded-full bg-border"
|
|
3785
|
+
})
|
|
3786
|
+
});
|
|
3787
|
+
}
|
|
3788
|
+
//#endregion
|
|
3789
|
+
//#region src/components/sheet.tsx
|
|
3790
|
+
function Sheet({ ...props }) {
|
|
3791
|
+
return /* @__PURE__ */ jsx(Dialog$1.Root, {
|
|
3792
|
+
"data-slot": "sheet",
|
|
3793
|
+
...props
|
|
3794
|
+
});
|
|
3795
|
+
}
|
|
3796
|
+
function SheetTrigger({ ...props }) {
|
|
3797
|
+
return /* @__PURE__ */ jsx(Dialog$1.Trigger, {
|
|
3798
|
+
"data-slot": "sheet-trigger",
|
|
3799
|
+
...props
|
|
3800
|
+
});
|
|
3801
|
+
}
|
|
3802
|
+
function SheetClose({ ...props }) {
|
|
3803
|
+
return /* @__PURE__ */ jsx(Dialog$1.Close, {
|
|
3804
|
+
"data-slot": "sheet-close",
|
|
3805
|
+
...props
|
|
3806
|
+
});
|
|
3807
|
+
}
|
|
3808
|
+
function SheetPortal({ ...props }) {
|
|
3809
|
+
return /* @__PURE__ */ jsx(Dialog$1.Portal, {
|
|
3810
|
+
"data-slot": "sheet-portal",
|
|
3811
|
+
...props
|
|
3812
|
+
});
|
|
3813
|
+
}
|
|
3814
|
+
function SheetOverlay({ className, ...props }) {
|
|
3815
|
+
return /* @__PURE__ */ jsx(Dialog$1.Overlay, {
|
|
3816
|
+
"data-slot": "sheet-overlay",
|
|
3817
|
+
className: cn("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", className),
|
|
3818
|
+
...props
|
|
3819
|
+
});
|
|
3820
|
+
}
|
|
3821
|
+
function SheetContent({ className, children, side = "right", showCloseButton = true, ...props }) {
|
|
3822
|
+
return /* @__PURE__ */ jsxs(SheetPortal, { children: [/* @__PURE__ */ jsx(SheetOverlay, {}), /* @__PURE__ */ jsxs(Dialog$1.Content, {
|
|
3823
|
+
"data-slot": "sheet-content",
|
|
3824
|
+
"data-side": side,
|
|
3825
|
+
className: cn("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", className),
|
|
3826
|
+
...props,
|
|
3827
|
+
children: [children, showCloseButton && /* @__PURE__ */ jsx(Dialog$1.Close, {
|
|
3828
|
+
"data-slot": "sheet-close",
|
|
3829
|
+
asChild: true,
|
|
3830
|
+
children: /* @__PURE__ */ jsxs(Button, {
|
|
3831
|
+
variant: "ghost",
|
|
3832
|
+
className: "absolute top-4 right-4",
|
|
3833
|
+
size: "icon-sm",
|
|
3834
|
+
children: [/* @__PURE__ */ jsx(XIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
3835
|
+
className: "sr-only",
|
|
3836
|
+
children: "Close"
|
|
3837
|
+
})]
|
|
3838
|
+
})
|
|
3839
|
+
})]
|
|
3840
|
+
})] });
|
|
3841
|
+
}
|
|
3842
|
+
function SheetHeader({ className, ...props }) {
|
|
3843
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3844
|
+
"data-slot": "sheet-header",
|
|
3845
|
+
className: cn("flex flex-col gap-1.5 p-4", className),
|
|
3846
|
+
...props
|
|
3847
|
+
});
|
|
3848
|
+
}
|
|
3849
|
+
function SheetFooter({ className, ...props }) {
|
|
3850
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3851
|
+
"data-slot": "sheet-footer",
|
|
3852
|
+
className: cn("mt-auto flex flex-col gap-2 p-4", className),
|
|
3853
|
+
...props
|
|
3854
|
+
});
|
|
3855
|
+
}
|
|
3856
|
+
function SheetTitle({ className, ...props }) {
|
|
3857
|
+
return /* @__PURE__ */ jsx(Dialog$1.Title, {
|
|
3858
|
+
"data-slot": "sheet-title",
|
|
3859
|
+
className: cn("font-medium text-foreground", className),
|
|
3860
|
+
...props
|
|
3861
|
+
});
|
|
3862
|
+
}
|
|
3863
|
+
function SheetDescription({ className, ...props }) {
|
|
3864
|
+
return /* @__PURE__ */ jsx(Dialog$1.Description, {
|
|
3865
|
+
"data-slot": "sheet-description",
|
|
3866
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
3867
|
+
...props
|
|
3868
|
+
});
|
|
3869
|
+
}
|
|
3870
|
+
//#endregion
|
|
3871
|
+
//#region src/components/skeleton.tsx
|
|
3872
|
+
function Skeleton({ className, ...props }) {
|
|
3873
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3874
|
+
"data-slot": "skeleton",
|
|
3875
|
+
className: cn("animate-pulse rounded-md bg-muted", className),
|
|
3876
|
+
...props
|
|
3877
|
+
});
|
|
3878
|
+
}
|
|
3879
|
+
//#endregion
|
|
3880
|
+
//#region src/components/sidebar.tsx
|
|
3881
|
+
const SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
3882
|
+
const SIDEBAR_COOKIE_MAX_AGE = 3600 * 24 * 7;
|
|
3883
|
+
const SIDEBAR_WIDTH = "16rem";
|
|
3884
|
+
const SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
3885
|
+
const SIDEBAR_WIDTH_ICON = "3rem";
|
|
3886
|
+
const SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
3887
|
+
const SidebarContext = React.createContext(null);
|
|
3888
|
+
function useSidebar() {
|
|
3889
|
+
const context = React.useContext(SidebarContext);
|
|
3890
|
+
if (!context) throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
3891
|
+
return context;
|
|
3892
|
+
}
|
|
3893
|
+
function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props }) {
|
|
3894
|
+
const isMobile = useIsMobile();
|
|
3895
|
+
const [openMobile, setOpenMobile] = React.useState(false);
|
|
3896
|
+
const [_open, _setOpen] = React.useState(defaultOpen);
|
|
3897
|
+
const open = openProp ?? _open;
|
|
3898
|
+
const setOpen = React.useCallback((value) => {
|
|
3899
|
+
const openState = typeof value === "function" ? value(open) : value;
|
|
3900
|
+
if (setOpenProp) setOpenProp(openState);
|
|
3901
|
+
else _setOpen(openState);
|
|
3902
|
+
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
|
|
3903
|
+
}, [setOpenProp, open]);
|
|
3904
|
+
const toggleSidebar = React.useCallback(() => {
|
|
3905
|
+
return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
|
|
3906
|
+
}, [
|
|
3907
|
+
isMobile,
|
|
3908
|
+
setOpen,
|
|
3909
|
+
setOpenMobile
|
|
3910
|
+
]);
|
|
3911
|
+
React.useEffect(() => {
|
|
3912
|
+
const handleKeyDown = (event) => {
|
|
3913
|
+
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
3914
|
+
event.preventDefault();
|
|
3915
|
+
toggleSidebar();
|
|
3916
|
+
}
|
|
3917
|
+
};
|
|
3918
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
3919
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
3920
|
+
}, [toggleSidebar]);
|
|
3921
|
+
const state = open ? "expanded" : "collapsed";
|
|
3922
|
+
const contextValue = React.useMemo(() => ({
|
|
3923
|
+
state,
|
|
3924
|
+
open,
|
|
3925
|
+
setOpen,
|
|
3926
|
+
isMobile,
|
|
3927
|
+
openMobile,
|
|
3928
|
+
setOpenMobile,
|
|
3929
|
+
toggleSidebar
|
|
3930
|
+
}), [
|
|
3931
|
+
state,
|
|
3932
|
+
open,
|
|
3933
|
+
setOpen,
|
|
3934
|
+
isMobile,
|
|
3935
|
+
openMobile,
|
|
3936
|
+
setOpenMobile,
|
|
3937
|
+
toggleSidebar
|
|
3938
|
+
]);
|
|
3939
|
+
return /* @__PURE__ */ jsx(SidebarContext.Provider, {
|
|
3940
|
+
value: contextValue,
|
|
3941
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
3942
|
+
"data-slot": "sidebar-wrapper",
|
|
3943
|
+
style: {
|
|
3944
|
+
"--sidebar-width": SIDEBAR_WIDTH,
|
|
3945
|
+
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
3946
|
+
...style
|
|
3947
|
+
},
|
|
3948
|
+
className: cn("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar", className),
|
|
3949
|
+
...props,
|
|
3950
|
+
children
|
|
3951
|
+
})
|
|
3952
|
+
});
|
|
3953
|
+
}
|
|
3954
|
+
function Sidebar({ side = "left", variant = "sidebar", collapsible = "offcanvas", className, children, dir, ...props }) {
|
|
3955
|
+
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
3956
|
+
if (collapsible === "none") return /* @__PURE__ */ jsx("div", {
|
|
3957
|
+
"data-slot": "sidebar",
|
|
3958
|
+
className: cn("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground", className),
|
|
3959
|
+
...props,
|
|
3960
|
+
children
|
|
3961
|
+
});
|
|
3962
|
+
if (isMobile) return /* @__PURE__ */ jsx(Sheet, {
|
|
3963
|
+
open: openMobile,
|
|
3964
|
+
onOpenChange: setOpenMobile,
|
|
3965
|
+
...props,
|
|
3966
|
+
children: /* @__PURE__ */ jsxs(SheetContent, {
|
|
3967
|
+
dir,
|
|
3968
|
+
"data-sidebar": "sidebar",
|
|
3969
|
+
"data-slot": "sidebar",
|
|
3970
|
+
"data-mobile": "true",
|
|
3971
|
+
className: "w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",
|
|
3972
|
+
style: { "--sidebar-width": SIDEBAR_WIDTH_MOBILE },
|
|
3973
|
+
side,
|
|
3974
|
+
children: [/* @__PURE__ */ jsxs(SheetHeader, {
|
|
3975
|
+
className: "sr-only",
|
|
3976
|
+
children: [/* @__PURE__ */ jsx(SheetTitle, { children: "Sidebar" }), /* @__PURE__ */ jsx(SheetDescription, { children: "Displays the mobile sidebar." })]
|
|
3977
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
3978
|
+
className: "flex h-full w-full flex-col",
|
|
3979
|
+
children
|
|
3980
|
+
})]
|
|
3981
|
+
})
|
|
3982
|
+
});
|
|
3983
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3984
|
+
className: "group peer hidden text-sidebar-foreground md:block",
|
|
3985
|
+
"data-state": state,
|
|
3986
|
+
"data-collapsible": state === "collapsed" ? collapsible : "",
|
|
3987
|
+
"data-variant": variant,
|
|
3988
|
+
"data-side": side,
|
|
3989
|
+
"data-slot": "sidebar",
|
|
3990
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
3991
|
+
"data-slot": "sidebar-gap",
|
|
3992
|
+
className: cn("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear", "group-data-[collapsible=offcanvas]:w-0", "group-data-[side=right]:rotate-180", variant === "floating" || variant === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)")
|
|
3993
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
3994
|
+
"data-slot": "sidebar-container",
|
|
3995
|
+
"data-side": side,
|
|
3996
|
+
className: cn("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex", variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l", className),
|
|
3997
|
+
...props,
|
|
3998
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
3999
|
+
"data-sidebar": "sidebar",
|
|
4000
|
+
"data-slot": "sidebar-inner",
|
|
4001
|
+
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",
|
|
4002
|
+
children
|
|
4003
|
+
})
|
|
4004
|
+
})]
|
|
4005
|
+
});
|
|
4006
|
+
}
|
|
4007
|
+
function SidebarTrigger({ className, onClick, ...props }) {
|
|
4008
|
+
const { toggleSidebar } = useSidebar();
|
|
4009
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
4010
|
+
"data-sidebar": "trigger",
|
|
4011
|
+
"data-slot": "sidebar-trigger",
|
|
4012
|
+
variant: "ghost",
|
|
4013
|
+
size: "icon-sm",
|
|
4014
|
+
className: cn(className),
|
|
4015
|
+
onClick: (event) => {
|
|
4016
|
+
onClick?.(event);
|
|
4017
|
+
toggleSidebar();
|
|
4018
|
+
},
|
|
4019
|
+
...props,
|
|
4020
|
+
children: [/* @__PURE__ */ jsx(PanelLeftIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
4021
|
+
className: "sr-only",
|
|
4022
|
+
children: "Toggle Sidebar"
|
|
4023
|
+
})]
|
|
4024
|
+
});
|
|
4025
|
+
}
|
|
4026
|
+
function SidebarRail({ className, ...props }) {
|
|
4027
|
+
const { toggleSidebar } = useSidebar();
|
|
4028
|
+
return /* @__PURE__ */ jsx("button", {
|
|
4029
|
+
"data-sidebar": "rail",
|
|
4030
|
+
"data-slot": "sidebar-rail",
|
|
4031
|
+
"aria-label": "Toggle Sidebar",
|
|
4032
|
+
tabIndex: -1,
|
|
4033
|
+
onClick: toggleSidebar,
|
|
4034
|
+
title: "Toggle Sidebar",
|
|
4035
|
+
className: cn("absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2", "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize", "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize", "group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar", "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2", "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2", className),
|
|
4036
|
+
...props
|
|
4037
|
+
});
|
|
4038
|
+
}
|
|
4039
|
+
function SidebarInset({ className, ...props }) {
|
|
4040
|
+
return /* @__PURE__ */ jsx("main", {
|
|
4041
|
+
"data-slot": "sidebar-inset",
|
|
4042
|
+
className: cn("relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2", className),
|
|
4043
|
+
...props
|
|
4044
|
+
});
|
|
4045
|
+
}
|
|
4046
|
+
function SidebarInput({ className, ...props }) {
|
|
4047
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
4048
|
+
"data-slot": "sidebar-input",
|
|
4049
|
+
"data-sidebar": "input",
|
|
4050
|
+
className: cn("h-8 w-full bg-background shadow-none", className),
|
|
4051
|
+
...props
|
|
4052
|
+
});
|
|
4053
|
+
}
|
|
4054
|
+
function SidebarHeader({ className, ...props }) {
|
|
4055
|
+
return /* @__PURE__ */ jsx("div", {
|
|
4056
|
+
"data-slot": "sidebar-header",
|
|
4057
|
+
"data-sidebar": "header",
|
|
4058
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
4059
|
+
...props
|
|
4060
|
+
});
|
|
4061
|
+
}
|
|
4062
|
+
function SidebarFooter({ className, ...props }) {
|
|
4063
|
+
return /* @__PURE__ */ jsx("div", {
|
|
4064
|
+
"data-slot": "sidebar-footer",
|
|
4065
|
+
"data-sidebar": "footer",
|
|
4066
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
4067
|
+
...props
|
|
4068
|
+
});
|
|
4069
|
+
}
|
|
4070
|
+
function SidebarSeparator({ className, ...props }) {
|
|
4071
|
+
return /* @__PURE__ */ jsx(Separator, {
|
|
4072
|
+
"data-slot": "sidebar-separator",
|
|
4073
|
+
"data-sidebar": "separator",
|
|
4074
|
+
className: cn("mx-2 w-auto bg-sidebar-border", className),
|
|
4075
|
+
...props
|
|
4076
|
+
});
|
|
4077
|
+
}
|
|
4078
|
+
function SidebarContent({ className, ...props }) {
|
|
4079
|
+
return /* @__PURE__ */ jsx("div", {
|
|
4080
|
+
"data-slot": "sidebar-content",
|
|
4081
|
+
"data-sidebar": "content",
|
|
4082
|
+
className: cn("no-scrollbar flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden", className),
|
|
4083
|
+
...props
|
|
4084
|
+
});
|
|
4085
|
+
}
|
|
4086
|
+
function SidebarGroup({ className, ...props }) {
|
|
4087
|
+
return /* @__PURE__ */ jsx("div", {
|
|
4088
|
+
"data-slot": "sidebar-group",
|
|
4089
|
+
"data-sidebar": "group",
|
|
4090
|
+
className: cn("relative flex w-full min-w-0 flex-col p-2", className),
|
|
4091
|
+
...props
|
|
4092
|
+
});
|
|
4093
|
+
}
|
|
4094
|
+
function SidebarGroupLabel({ className, asChild = false, ...props }) {
|
|
4095
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "div", {
|
|
4096
|
+
"data-slot": "sidebar-group-label",
|
|
4097
|
+
"data-sidebar": "group-label",
|
|
4098
|
+
className: cn("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", className),
|
|
4099
|
+
...props
|
|
4100
|
+
});
|
|
4101
|
+
}
|
|
4102
|
+
function SidebarGroupAction({ className, asChild = false, ...props }) {
|
|
4103
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "button", {
|
|
4104
|
+
"data-slot": "sidebar-group-action",
|
|
4105
|
+
"data-sidebar": "group-action",
|
|
4106
|
+
className: cn("absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0", className),
|
|
4107
|
+
...props
|
|
4108
|
+
});
|
|
4109
|
+
}
|
|
4110
|
+
function SidebarGroupContent({ className, ...props }) {
|
|
4111
|
+
return /* @__PURE__ */ jsx("div", {
|
|
4112
|
+
"data-slot": "sidebar-group-content",
|
|
4113
|
+
"data-sidebar": "group-content",
|
|
4114
|
+
className: cn("w-full text-sm", className),
|
|
4115
|
+
...props
|
|
4116
|
+
});
|
|
4117
|
+
}
|
|
4118
|
+
function SidebarMenu({ className, ...props }) {
|
|
4119
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
4120
|
+
"data-slot": "sidebar-menu",
|
|
4121
|
+
"data-sidebar": "menu",
|
|
4122
|
+
className: cn("flex w-full min-w-0 flex-col gap-1", className),
|
|
4123
|
+
...props
|
|
4124
|
+
});
|
|
4125
|
+
}
|
|
4126
|
+
function SidebarMenuItem({ className, ...props }) {
|
|
4127
|
+
return /* @__PURE__ */ jsx("li", {
|
|
4128
|
+
"data-slot": "sidebar-menu-item",
|
|
4129
|
+
"data-sidebar": "menu-item",
|
|
4130
|
+
className: cn("group/menu-item relative", className),
|
|
4131
|
+
...props
|
|
4132
|
+
});
|
|
4133
|
+
}
|
|
4134
|
+
const sidebarMenuButtonVariants = cva("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate", {
|
|
4135
|
+
variants: {
|
|
4136
|
+
variant: {
|
|
4137
|
+
default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
4138
|
+
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))]"
|
|
4139
|
+
},
|
|
4140
|
+
size: {
|
|
4141
|
+
default: "h-8 text-sm",
|
|
4142
|
+
sm: "h-7 text-xs",
|
|
4143
|
+
lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!"
|
|
4144
|
+
}
|
|
4145
|
+
},
|
|
4146
|
+
defaultVariants: {
|
|
4147
|
+
variant: "default",
|
|
4148
|
+
size: "default"
|
|
4149
|
+
}
|
|
4150
|
+
});
|
|
4151
|
+
function SidebarMenuButton({ asChild = false, isActive = false, variant = "default", size = "default", tooltip, className, ...props }) {
|
|
4152
|
+
const Comp = asChild ? Slot.Root : "button";
|
|
4153
|
+
const { isMobile, state } = useSidebar();
|
|
4154
|
+
const button = /* @__PURE__ */ jsx(Comp, {
|
|
4155
|
+
"data-slot": "sidebar-menu-button",
|
|
4156
|
+
"data-sidebar": "menu-button",
|
|
4157
|
+
"data-size": size,
|
|
4158
|
+
"data-active": isActive,
|
|
4159
|
+
className: cn(sidebarMenuButtonVariants({
|
|
4160
|
+
variant,
|
|
4161
|
+
size
|
|
4162
|
+
}), className),
|
|
4163
|
+
...props
|
|
4164
|
+
});
|
|
4165
|
+
if (!tooltip) return button;
|
|
4166
|
+
if (typeof tooltip === "string") tooltip = { children: tooltip };
|
|
4167
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
4168
|
+
asChild: true,
|
|
4169
|
+
children: button
|
|
4170
|
+
}), /* @__PURE__ */ jsx(TooltipContent, {
|
|
4171
|
+
side: "right",
|
|
4172
|
+
align: "center",
|
|
4173
|
+
hidden: state !== "collapsed" || isMobile,
|
|
4174
|
+
...tooltip
|
|
4175
|
+
})] });
|
|
4176
|
+
}
|
|
4177
|
+
function SidebarMenuAction({ className, asChild = false, showOnHover = false, ...props }) {
|
|
4178
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "button", {
|
|
4179
|
+
"data-slot": "sidebar-menu-action",
|
|
4180
|
+
"data-sidebar": "menu-action",
|
|
4181
|
+
className: cn("absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0", showOnHover && "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0", className),
|
|
4182
|
+
...props
|
|
4183
|
+
});
|
|
4184
|
+
}
|
|
4185
|
+
function SidebarMenuBadge({ className, ...props }) {
|
|
4186
|
+
return /* @__PURE__ */ jsx("div", {
|
|
4187
|
+
"data-slot": "sidebar-menu-badge",
|
|
4188
|
+
"data-sidebar": "menu-badge",
|
|
4189
|
+
className: cn("pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 peer-data-active/menu-button:text-sidebar-accent-foreground", className),
|
|
4190
|
+
...props
|
|
4191
|
+
});
|
|
4192
|
+
}
|
|
4193
|
+
function SidebarMenuSkeleton({ className, showIcon = false, ...props }) {
|
|
4194
|
+
const [width] = React.useState(() => {
|
|
4195
|
+
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
4196
|
+
});
|
|
4197
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
4198
|
+
"data-slot": "sidebar-menu-skeleton",
|
|
4199
|
+
"data-sidebar": "menu-skeleton",
|
|
4200
|
+
className: cn("flex h-8 items-center gap-2 rounded-md px-2", className),
|
|
4201
|
+
...props,
|
|
4202
|
+
children: [showIcon && /* @__PURE__ */ jsx(Skeleton, {
|
|
4203
|
+
className: "size-4 rounded-md",
|
|
4204
|
+
"data-sidebar": "menu-skeleton-icon"
|
|
4205
|
+
}), /* @__PURE__ */ jsx(Skeleton, {
|
|
4206
|
+
className: "h-4 max-w-(--skeleton-width) flex-1",
|
|
4207
|
+
"data-sidebar": "menu-skeleton-text",
|
|
4208
|
+
style: { "--skeleton-width": width }
|
|
4209
|
+
})]
|
|
4210
|
+
});
|
|
4211
|
+
}
|
|
4212
|
+
function SidebarMenuSub({ className, ...props }) {
|
|
4213
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
4214
|
+
"data-slot": "sidebar-menu-sub",
|
|
4215
|
+
"data-sidebar": "menu-sub",
|
|
4216
|
+
className: cn("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden", className),
|
|
4217
|
+
...props
|
|
4218
|
+
});
|
|
4219
|
+
}
|
|
4220
|
+
function SidebarMenuSubItem({ className, ...props }) {
|
|
4221
|
+
return /* @__PURE__ */ jsx("li", {
|
|
4222
|
+
"data-slot": "sidebar-menu-sub-item",
|
|
4223
|
+
"data-sidebar": "menu-sub-item",
|
|
4224
|
+
className: cn("group/menu-sub-item relative", className),
|
|
4225
|
+
...props
|
|
4226
|
+
});
|
|
4227
|
+
}
|
|
4228
|
+
function SidebarMenuSubButton({ asChild = false, size = "md", isActive = false, className, ...props }) {
|
|
4229
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "a", {
|
|
4230
|
+
"data-slot": "sidebar-menu-sub-button",
|
|
4231
|
+
"data-sidebar": "menu-sub-button",
|
|
4232
|
+
"data-size": size,
|
|
4233
|
+
"data-active": isActive,
|
|
4234
|
+
className: cn("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[size=md]:text-sm data-[size=sm]:text-xs data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground", className),
|
|
4235
|
+
...props
|
|
4236
|
+
});
|
|
4237
|
+
}
|
|
4238
|
+
//#endregion
|
|
4239
|
+
//#region src/components/slider.tsx
|
|
4240
|
+
function Slider({ className, defaultValue, value, min = 0, max = 100, ...props }) {
|
|
4241
|
+
const _values = React.useMemo(() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max], [
|
|
4242
|
+
value,
|
|
4243
|
+
defaultValue,
|
|
4244
|
+
min,
|
|
4245
|
+
max
|
|
4246
|
+
]);
|
|
4247
|
+
return /* @__PURE__ */ jsxs(Slider$1.Root, {
|
|
4248
|
+
"data-slot": "slider",
|
|
4249
|
+
defaultValue,
|
|
4250
|
+
value,
|
|
4251
|
+
min,
|
|
4252
|
+
max,
|
|
4253
|
+
className: cn("relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col", className),
|
|
4254
|
+
...props,
|
|
4255
|
+
children: [/* @__PURE__ */ jsx(Slider$1.Track, {
|
|
4256
|
+
"data-slot": "slider-track",
|
|
4257
|
+
className: "relative grow overflow-hidden rounded-full bg-muted data-horizontal:h-1.5 data-horizontal:w-full data-vertical:h-full data-vertical:w-1.5",
|
|
4258
|
+
children: /* @__PURE__ */ jsx(Slider$1.Range, {
|
|
4259
|
+
"data-slot": "slider-range",
|
|
4260
|
+
className: "absolute bg-primary select-none data-horizontal:h-full data-vertical:w-full"
|
|
4261
|
+
})
|
|
4262
|
+
}), Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ jsx(Slider$1.Thumb, {
|
|
4263
|
+
"data-slot": "slider-thumb",
|
|
4264
|
+
className: "block size-4 shrink-0 rounded-full border border-primary bg-white shadow-sm ring-ring/50 transition-[color,box-shadow] select-none hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
|
|
4265
|
+
}, index))]
|
|
4266
|
+
});
|
|
4267
|
+
}
|
|
4268
|
+
//#endregion
|
|
4269
|
+
//#region src/components/sonner.tsx
|
|
4270
|
+
const Toaster = ({ ...props }) => {
|
|
4271
|
+
const { theme = "system" } = useTheme();
|
|
4272
|
+
return /* @__PURE__ */ jsx(Toaster$1, {
|
|
4273
|
+
theme,
|
|
4274
|
+
className: "toaster group",
|
|
4275
|
+
icons: {
|
|
4276
|
+
success: /* @__PURE__ */ jsx(CircleCheckIcon, { className: "size-4" }),
|
|
4277
|
+
info: /* @__PURE__ */ jsx(InfoIcon, { className: "size-4" }),
|
|
4278
|
+
warning: /* @__PURE__ */ jsx(TriangleAlertIcon, { className: "size-4" }),
|
|
4279
|
+
error: /* @__PURE__ */ jsx(OctagonXIcon, { className: "size-4" }),
|
|
4280
|
+
loading: /* @__PURE__ */ jsx(Loader2Icon, { className: "size-4 animate-spin" })
|
|
4281
|
+
},
|
|
4282
|
+
style: {
|
|
4283
|
+
"--normal-bg": "var(--popover)",
|
|
4284
|
+
"--normal-text": "var(--popover-foreground)",
|
|
4285
|
+
"--normal-border": "var(--border)",
|
|
4286
|
+
"--border-radius": "var(--radius)"
|
|
4287
|
+
},
|
|
4288
|
+
toastOptions: { classNames: { toast: "cn-toast" } },
|
|
4289
|
+
...props
|
|
4290
|
+
});
|
|
4291
|
+
};
|
|
4292
|
+
//#endregion
|
|
4293
|
+
//#region src/components/switch.tsx
|
|
4294
|
+
function Switch({ className, size = "default", ...props }) {
|
|
4295
|
+
return /* @__PURE__ */ jsx(Switch$1.Root, {
|
|
4296
|
+
"data-slot": "switch",
|
|
4297
|
+
"data-size": size,
|
|
4298
|
+
className: cn("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50", className),
|
|
4299
|
+
...props,
|
|
4300
|
+
children: /* @__PURE__ */ jsx(Switch$1.Thumb, {
|
|
4301
|
+
"data-slot": "switch-thumb",
|
|
4302
|
+
className: "pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"
|
|
4303
|
+
})
|
|
4304
|
+
});
|
|
4305
|
+
}
|
|
4306
|
+
//#endregion
|
|
4307
|
+
//#region src/components/table.tsx
|
|
4308
|
+
function Table({ className, ...props }) {
|
|
4309
|
+
return /* @__PURE__ */ jsx("div", {
|
|
4310
|
+
"data-slot": "table-container",
|
|
4311
|
+
className: "relative w-full overflow-x-auto",
|
|
4312
|
+
children: /* @__PURE__ */ jsx("table", {
|
|
4313
|
+
"data-slot": "table",
|
|
4314
|
+
className: cn("w-full caption-bottom text-sm", className),
|
|
4315
|
+
...props
|
|
4316
|
+
})
|
|
4317
|
+
});
|
|
4318
|
+
}
|
|
4319
|
+
function TableHeader({ className, ...props }) {
|
|
4320
|
+
return /* @__PURE__ */ jsx("thead", {
|
|
4321
|
+
"data-slot": "table-header",
|
|
4322
|
+
className: cn("[&_tr]:border-b", className),
|
|
4323
|
+
...props
|
|
4324
|
+
});
|
|
4325
|
+
}
|
|
4326
|
+
function TableBody({ className, ...props }) {
|
|
4327
|
+
return /* @__PURE__ */ jsx("tbody", {
|
|
4328
|
+
"data-slot": "table-body",
|
|
4329
|
+
className: cn("[&_tr:last-child]:border-0", className),
|
|
4330
|
+
...props
|
|
4331
|
+
});
|
|
4332
|
+
}
|
|
4333
|
+
function TableFooter({ className, ...props }) {
|
|
4334
|
+
return /* @__PURE__ */ jsx("tfoot", {
|
|
4335
|
+
"data-slot": "table-footer",
|
|
4336
|
+
className: cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className),
|
|
4337
|
+
...props
|
|
4338
|
+
});
|
|
4339
|
+
}
|
|
4340
|
+
function TableRow({ className, ...props }) {
|
|
4341
|
+
return /* @__PURE__ */ jsx("tr", {
|
|
4342
|
+
"data-slot": "table-row",
|
|
4343
|
+
className: cn("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted", className),
|
|
4344
|
+
...props
|
|
4345
|
+
});
|
|
4346
|
+
}
|
|
4347
|
+
function TableHead({ className, ...props }) {
|
|
4348
|
+
return /* @__PURE__ */ jsx("th", {
|
|
4349
|
+
"data-slot": "table-head",
|
|
4350
|
+
className: cn("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0", className),
|
|
4351
|
+
...props
|
|
4352
|
+
});
|
|
4353
|
+
}
|
|
4354
|
+
function TableCell({ className, ...props }) {
|
|
4355
|
+
return /* @__PURE__ */ jsx("td", {
|
|
4356
|
+
"data-slot": "table-cell",
|
|
4357
|
+
className: cn("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0", className),
|
|
4358
|
+
...props
|
|
4359
|
+
});
|
|
4360
|
+
}
|
|
4361
|
+
function TableCaption({ className, ...props }) {
|
|
4362
|
+
return /* @__PURE__ */ jsx("caption", {
|
|
4363
|
+
"data-slot": "table-caption",
|
|
4364
|
+
className: cn("mt-4 text-sm text-muted-foreground", className),
|
|
4365
|
+
...props
|
|
4366
|
+
});
|
|
4367
|
+
}
|
|
4368
|
+
//#endregion
|
|
4369
|
+
//#region src/components/tabs.tsx
|
|
4370
|
+
function Tabs({ className, orientation = "horizontal", ...props }) {
|
|
4371
|
+
return /* @__PURE__ */ jsx(Tabs$1.Root, {
|
|
4372
|
+
"data-slot": "tabs",
|
|
4373
|
+
"data-orientation": orientation,
|
|
4374
|
+
className: cn("group/tabs flex gap-2 data-horizontal:flex-col", className),
|
|
4375
|
+
...props
|
|
4376
|
+
});
|
|
4377
|
+
}
|
|
4378
|
+
const tabsListVariants = cva("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-9 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none", {
|
|
4379
|
+
variants: { variant: {
|
|
4380
|
+
default: "bg-muted",
|
|
4381
|
+
line: "gap-1 bg-transparent"
|
|
4382
|
+
} },
|
|
4383
|
+
defaultVariants: { variant: "default" }
|
|
4384
|
+
});
|
|
4385
|
+
function TabsList({ className, variant = "default", ...props }) {
|
|
4386
|
+
return /* @__PURE__ */ jsx(Tabs$1.List, {
|
|
4387
|
+
"data-slot": "tabs-list",
|
|
4388
|
+
"data-variant": variant,
|
|
4389
|
+
className: cn(tabsListVariants({ variant }), className),
|
|
4390
|
+
...props
|
|
4391
|
+
});
|
|
4392
|
+
}
|
|
4393
|
+
function TabsTrigger({ className, ...props }) {
|
|
4394
|
+
return /* @__PURE__ */ jsx(Tabs$1.Trigger, {
|
|
4395
|
+
"data-slot": "tabs-trigger",
|
|
4396
|
+
className: cn("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", "group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent", "data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground", "after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100", className),
|
|
4397
|
+
...props
|
|
4398
|
+
});
|
|
4399
|
+
}
|
|
4400
|
+
function TabsContent({ className, ...props }) {
|
|
4401
|
+
return /* @__PURE__ */ jsx(Tabs$1.Content, {
|
|
4402
|
+
"data-slot": "tabs-content",
|
|
4403
|
+
className: cn("flex-1 text-sm outline-none", className),
|
|
4404
|
+
...props
|
|
4405
|
+
});
|
|
4406
|
+
}
|
|
4407
|
+
//#endregion
|
|
4408
|
+
//#region src/components/toggle.tsx
|
|
4409
|
+
const toggleVariants = cva("group/toggle inline-flex items-center justify-center gap-1 rounded-md text-sm font-medium whitespace-nowrap transition-[color,box-shadow] outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
4410
|
+
variants: {
|
|
4411
|
+
variant: {
|
|
4412
|
+
default: "bg-transparent",
|
|
4413
|
+
outline: "border border-input bg-transparent shadow-xs hover:bg-muted"
|
|
4414
|
+
},
|
|
4415
|
+
size: {
|
|
4416
|
+
default: "h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
4417
|
+
sm: "h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
|
|
4418
|
+
lg: "h-10 min-w-10 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2"
|
|
4419
|
+
}
|
|
4420
|
+
},
|
|
4421
|
+
defaultVariants: {
|
|
4422
|
+
variant: "default",
|
|
4423
|
+
size: "default"
|
|
4424
|
+
}
|
|
4425
|
+
});
|
|
4426
|
+
function Toggle({ className, variant = "default", size = "default", ...props }) {
|
|
4427
|
+
return /* @__PURE__ */ jsx(Toggle$1.Root, {
|
|
4428
|
+
"data-slot": "toggle",
|
|
4429
|
+
className: cn(toggleVariants({
|
|
4430
|
+
variant,
|
|
4431
|
+
size,
|
|
4432
|
+
className
|
|
4433
|
+
})),
|
|
4434
|
+
...props
|
|
4435
|
+
});
|
|
4436
|
+
}
|
|
4437
|
+
//#endregion
|
|
4438
|
+
//#region src/components/toggle-group.tsx
|
|
4439
|
+
const ToggleGroupContext = React.createContext({
|
|
4440
|
+
size: "default",
|
|
4441
|
+
variant: "default",
|
|
4442
|
+
spacing: 0,
|
|
4443
|
+
orientation: "horizontal"
|
|
4444
|
+
});
|
|
4445
|
+
function ToggleGroup({ className, variant, size, spacing = 0, orientation = "horizontal", children, ...props }) {
|
|
4446
|
+
return /* @__PURE__ */ jsx(ToggleGroup$1.Root, {
|
|
4447
|
+
"data-slot": "toggle-group",
|
|
4448
|
+
"data-variant": variant,
|
|
4449
|
+
"data-size": size,
|
|
4450
|
+
"data-spacing": spacing,
|
|
4451
|
+
"data-orientation": orientation,
|
|
4452
|
+
style: { "--gap": spacing },
|
|
4453
|
+
className: cn("group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=0]:data-[variant=outline]:shadow-xs data-vertical:flex-col data-vertical:items-stretch", className),
|
|
4454
|
+
...props,
|
|
4455
|
+
children: /* @__PURE__ */ jsx(ToggleGroupContext.Provider, {
|
|
4456
|
+
value: {
|
|
4457
|
+
variant,
|
|
4458
|
+
size,
|
|
4459
|
+
spacing,
|
|
4460
|
+
orientation
|
|
4461
|
+
},
|
|
4462
|
+
children
|
|
4463
|
+
})
|
|
4464
|
+
});
|
|
4465
|
+
}
|
|
4466
|
+
function ToggleGroupItem({ className, children, variant = "default", size = "default", ...props }) {
|
|
4467
|
+
const context = React.useContext(ToggleGroupContext);
|
|
4468
|
+
return /* @__PURE__ */ jsx(ToggleGroup$1.Item, {
|
|
4469
|
+
"data-slot": "toggle-group-item",
|
|
4470
|
+
"data-variant": context.variant || variant,
|
|
4471
|
+
"data-size": context.size || size,
|
|
4472
|
+
"data-spacing": context.spacing,
|
|
4473
|
+
className: cn("shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 group-data-[spacing=0]/toggle-group:shadow-none focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-md group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-md group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-md group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-md data-[state=on]:bg-muted group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t", toggleVariants({
|
|
4474
|
+
variant: context.variant || variant,
|
|
4475
|
+
size: context.size || size
|
|
4476
|
+
}), className),
|
|
4477
|
+
...props,
|
|
4478
|
+
children
|
|
4479
|
+
});
|
|
4480
|
+
}
|
|
4481
|
+
//#endregion
|
|
4482
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertAction, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AspectRatio, Attachment, AttachmentEmpty, AttachmentHoverCard, AttachmentHoverCardContent, AttachmentHoverCardTrigger, AttachmentInfo, AttachmentPreview, AttachmentRemove, Attachments, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, Conversation, ConversationContent, ConversationDownload, ConversationEmptyState, ConversationScrollButton, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DirectionProvider, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Kbd, KbdGroup, Label, LocalReferencedSourcesContext, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, Message, MessageAction, MessageActions, MessageBranch, MessageBranchContent, MessageBranchNext, MessageBranchPage, MessageBranchPrevious, MessageBranchSelector, MessageContent, MessageResponse, MessageToolbar, NativeSelect, NativeSelectOptGroup, NativeSelectOption, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, PromptInput, PromptInputActionAddAttachments, PromptInputActionAddScreenshot, PromptInputActionMenu, PromptInputActionMenuContent, PromptInputActionMenuItem, PromptInputActionMenuTrigger, PromptInputBody, PromptInputButton, PromptInputCommand, PromptInputCommandEmpty, PromptInputCommandGroup, PromptInputCommandInput, PromptInputCommandItem, PromptInputCommandList, PromptInputCommandSeparator, PromptInputFooter, PromptInputHeader, PromptInputHoverCard, PromptInputHoverCardContent, PromptInputHoverCardTrigger, PromptInputProvider, PromptInputSelect, PromptInputSelectContent, PromptInputSelectItem, PromptInputSelectTrigger, PromptInputSelectValue, PromptInputSubmit, PromptInputTab, PromptInputTabBody, PromptInputTabItem, PromptInputTabLabel, PromptInputTabsList, PromptInputTextarea, PromptInputTools, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, 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, Slider, SpeechInput, Spinner, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonGroupVariants, buttonVariants, getAttachmentLabel, getMediaCategory, messagesToMarkdown, navigationMenuTriggerStyle, tabsListVariants, toggleVariants, useAttachmentContext, useAttachmentsContext, useCarousel, useComboboxAnchor, useDirection, usePromptInputAttachments, usePromptInputController, usePromptInputReferencedSources, useProviderAttachments, useSidebar };
|