@melv1c/ui-core 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base.css +54 -0
- package/dist/index.d.mts +1865 -0
- package/dist/index.mjs +4247 -0
- package/dist/locales/index.d.mts +187 -0
- package/dist/locales/index.mjs +14 -0
- package/dist/nl-CCT3Xhp8.mjs +204 -0
- package/dist/themes/claude.css +117 -0
- package/dist/themes/default.css +70 -0
- package/dist/themes/doom64.css +107 -0
- package/dist/themes/t3chat.css +117 -0
- package/dist/themes/twitter.css +127 -0
- package/dist/themes/vercel.css +107 -0
- package/package.json +108 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,4247 @@
|
|
|
1
|
+
import { t as locales_exports } from "./locales/index.mjs";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { forwardRef, useEffect, useMemo, useState } from "react";
|
|
4
|
+
import { ArrowLeft, ArrowRight, CalendarIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRight, ChevronRightIcon, ChevronUpIcon, CircleAlert, CircleCheckIcon, CircleIcon, Eye, EyeOff, GripVerticalIcon, InfoIcon, Loader2Icon, MinusIcon, MoreHorizontal, MoreHorizontalIcon, OctagonXIcon, PanelLeftIcon, SearchIcon, TriangleAlertIcon, X, XIcon } from "lucide-react";
|
|
5
|
+
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";
|
|
6
|
+
import { clsx } from "clsx";
|
|
7
|
+
import { twMerge } from "tailwind-merge";
|
|
8
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { cva } from "class-variance-authority";
|
|
10
|
+
import { DayPicker, getDefaultClassNames } from "react-day-picker";
|
|
11
|
+
import useEmblaCarousel from "embla-carousel-react";
|
|
12
|
+
import * as RechartsPrimitive from "recharts";
|
|
13
|
+
import { Combobox as Combobox$1 } from "@base-ui/react";
|
|
14
|
+
import { Command as Command$1, useCommandState } from "cmdk";
|
|
15
|
+
import { Drawer as Drawer$1 } from "vaul";
|
|
16
|
+
import { OTPInput, OTPInputContext } from "input-otp";
|
|
17
|
+
import * as ResizablePrimitive from "react-resizable-panels";
|
|
18
|
+
import { useTheme } from "next-themes";
|
|
19
|
+
import { Toaster as Toaster$1 } from "sonner";
|
|
20
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
21
|
+
import { Controller, useForm } from "react-hook-form";
|
|
22
|
+
import { I18nextProvider, initReactI18next, useTranslation } from "react-i18next";
|
|
23
|
+
import * as z from "zod";
|
|
24
|
+
import i18n from "i18next";
|
|
25
|
+
|
|
26
|
+
//#region src/lib/utils.ts
|
|
27
|
+
function cn(...inputs) {
|
|
28
|
+
return twMerge(clsx(inputs));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/components/base/accordion.tsx
|
|
33
|
+
function Accordion({ ...props }) {
|
|
34
|
+
return /* @__PURE__ */ jsx(Accordion$1.Root, {
|
|
35
|
+
"data-slot": "accordion",
|
|
36
|
+
...props
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function AccordionItem({ className, ...props }) {
|
|
40
|
+
return /* @__PURE__ */ jsx(Accordion$1.Item, {
|
|
41
|
+
"data-slot": "accordion-item",
|
|
42
|
+
className: cn("border-b last:border-b-0", className),
|
|
43
|
+
...props
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function AccordionTrigger({ className, children, ...props }) {
|
|
47
|
+
return /* @__PURE__ */ jsx(Accordion$1.Header, {
|
|
48
|
+
className: "flex",
|
|
49
|
+
children: /* @__PURE__ */ jsxs(Accordion$1.Trigger, {
|
|
50
|
+
"data-slot": "accordion-trigger",
|
|
51
|
+
className: cn("focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180", className),
|
|
52
|
+
...props,
|
|
53
|
+
children: [children, /* @__PURE__ */ jsx(ChevronDownIcon, { className: "text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" })]
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function AccordionContent({ className, children, ...props }) {
|
|
58
|
+
return /* @__PURE__ */ jsx(Accordion$1.Content, {
|
|
59
|
+
"data-slot": "accordion-content",
|
|
60
|
+
className: "data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",
|
|
61
|
+
...props,
|
|
62
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
63
|
+
className: cn("pt-0 pb-4", className),
|
|
64
|
+
children
|
|
65
|
+
})
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/components/base/alert.tsx
|
|
71
|
+
const alertVariants = cva("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current", {
|
|
72
|
+
variants: { variant: {
|
|
73
|
+
default: "bg-card text-card-foreground",
|
|
74
|
+
destructive: "text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"
|
|
75
|
+
} },
|
|
76
|
+
defaultVariants: { variant: "default" }
|
|
77
|
+
});
|
|
78
|
+
function Alert({ className, variant, ...props }) {
|
|
79
|
+
return /* @__PURE__ */ jsx("div", {
|
|
80
|
+
"data-slot": "alert",
|
|
81
|
+
role: "alert",
|
|
82
|
+
className: cn(alertVariants({ variant }), className),
|
|
83
|
+
...props
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function AlertTitle({ className, ...props }) {
|
|
87
|
+
return /* @__PURE__ */ jsx("div", {
|
|
88
|
+
"data-slot": "alert-title",
|
|
89
|
+
className: cn("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight", className),
|
|
90
|
+
...props
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
function AlertDescription({ className, ...props }) {
|
|
94
|
+
return /* @__PURE__ */ jsx("div", {
|
|
95
|
+
"data-slot": "alert-description",
|
|
96
|
+
className: cn("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed", className),
|
|
97
|
+
...props
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/components/base/button.tsx
|
|
103
|
+
const buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", {
|
|
104
|
+
variants: {
|
|
105
|
+
variant: {
|
|
106
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
107
|
+
destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
108
|
+
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
109
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
110
|
+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
111
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
112
|
+
},
|
|
113
|
+
size: {
|
|
114
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
115
|
+
xs: "h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
116
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
117
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
118
|
+
icon: "size-9",
|
|
119
|
+
"icon-xs": "size-6 rounded-md [&_svg:not([class*='size-'])]:size-3",
|
|
120
|
+
"icon-sm": "size-8",
|
|
121
|
+
"icon-lg": "size-10"
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
defaultVariants: {
|
|
125
|
+
variant: "default",
|
|
126
|
+
size: "default"
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
function Button({ className, variant = "default", size = "default", asChild = false, ...props }) {
|
|
130
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "button", {
|
|
131
|
+
"data-slot": "button",
|
|
132
|
+
"data-variant": variant,
|
|
133
|
+
"data-size": size,
|
|
134
|
+
className: cn(buttonVariants({
|
|
135
|
+
variant,
|
|
136
|
+
size,
|
|
137
|
+
className
|
|
138
|
+
})),
|
|
139
|
+
...props
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region src/components/base/alert-dialog.tsx
|
|
145
|
+
function AlertDialog({ ...props }) {
|
|
146
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Root, {
|
|
147
|
+
"data-slot": "alert-dialog",
|
|
148
|
+
...props
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
function AlertDialogTrigger({ ...props }) {
|
|
152
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Trigger, {
|
|
153
|
+
"data-slot": "alert-dialog-trigger",
|
|
154
|
+
...props
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
function AlertDialogPortal({ ...props }) {
|
|
158
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Portal, {
|
|
159
|
+
"data-slot": "alert-dialog-portal",
|
|
160
|
+
...props
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
function AlertDialogOverlay({ className, ...props }) {
|
|
164
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Overlay, {
|
|
165
|
+
"data-slot": "alert-dialog-overlay",
|
|
166
|
+
className: cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50", className),
|
|
167
|
+
...props
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
function AlertDialogContent({ className, size = "default", ...props }) {
|
|
171
|
+
return /* @__PURE__ */ jsxs(AlertDialogPortal, { children: [/* @__PURE__ */ jsx(AlertDialogOverlay, {}), /* @__PURE__ */ jsx(AlertDialog$1.Content, {
|
|
172
|
+
"data-slot": "alert-dialog-content",
|
|
173
|
+
"data-size": size,
|
|
174
|
+
className: cn("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 group/alert-dialog-content fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-lg", className),
|
|
175
|
+
...props
|
|
176
|
+
})] });
|
|
177
|
+
}
|
|
178
|
+
function AlertDialogHeader({ className, ...props }) {
|
|
179
|
+
return /* @__PURE__ */ jsx("div", {
|
|
180
|
+
"data-slot": "alert-dialog-header",
|
|
181
|
+
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),
|
|
182
|
+
...props
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
function AlertDialogFooter({ className, ...props }) {
|
|
186
|
+
return /* @__PURE__ */ jsx("div", {
|
|
187
|
+
"data-slot": "alert-dialog-footer",
|
|
188
|
+
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),
|
|
189
|
+
...props
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
function AlertDialogTitle({ className, ...props }) {
|
|
193
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Title, {
|
|
194
|
+
"data-slot": "alert-dialog-title",
|
|
195
|
+
className: cn("text-lg font-semibold sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2", className),
|
|
196
|
+
...props
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
function AlertDialogDescription({ className, ...props }) {
|
|
200
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Description, {
|
|
201
|
+
"data-slot": "alert-dialog-description",
|
|
202
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
203
|
+
...props
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
function AlertDialogMedia({ className, ...props }) {
|
|
207
|
+
return /* @__PURE__ */ jsx("div", {
|
|
208
|
+
"data-slot": "alert-dialog-media",
|
|
209
|
+
className: cn("bg-muted mb-2 inline-flex size-16 items-center justify-center rounded-md sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-8", className),
|
|
210
|
+
...props
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
function AlertDialogAction({ className, variant = "default", size = "default", ...props }) {
|
|
214
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
215
|
+
variant,
|
|
216
|
+
size,
|
|
217
|
+
asChild: true,
|
|
218
|
+
children: /* @__PURE__ */ jsx(AlertDialog$1.Action, {
|
|
219
|
+
"data-slot": "alert-dialog-action",
|
|
220
|
+
className: cn(className),
|
|
221
|
+
...props
|
|
222
|
+
})
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
function AlertDialogCancel({ className, variant = "outline", size = "default", ...props }) {
|
|
226
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
227
|
+
variant,
|
|
228
|
+
size,
|
|
229
|
+
asChild: true,
|
|
230
|
+
children: /* @__PURE__ */ jsx(AlertDialog$1.Cancel, {
|
|
231
|
+
"data-slot": "alert-dialog-cancel",
|
|
232
|
+
className: cn(className),
|
|
233
|
+
...props
|
|
234
|
+
})
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
//#endregion
|
|
239
|
+
//#region src/components/base/aspect-ratio.tsx
|
|
240
|
+
function AspectRatio({ ...props }) {
|
|
241
|
+
return /* @__PURE__ */ jsx(AspectRatio$1.Root, {
|
|
242
|
+
"data-slot": "aspect-ratio",
|
|
243
|
+
...props
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
//#endregion
|
|
248
|
+
//#region src/components/base/avatar.tsx
|
|
249
|
+
function Avatar({ className, size = "default", ...props }) {
|
|
250
|
+
return /* @__PURE__ */ jsx(Avatar$1.Root, {
|
|
251
|
+
"data-slot": "avatar",
|
|
252
|
+
"data-size": size,
|
|
253
|
+
className: cn("group/avatar relative flex size-8 shrink-0 overflow-hidden rounded-full select-none data-[size=lg]:size-10 data-[size=sm]:size-6", className),
|
|
254
|
+
...props
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
function AvatarImage({ className, ...props }) {
|
|
258
|
+
return /* @__PURE__ */ jsx(Avatar$1.Image, {
|
|
259
|
+
"data-slot": "avatar-image",
|
|
260
|
+
className: cn("aspect-square size-full", className),
|
|
261
|
+
...props
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
function AvatarFallback({ className, ...props }) {
|
|
265
|
+
return /* @__PURE__ */ jsx(Avatar$1.Fallback, {
|
|
266
|
+
"data-slot": "avatar-fallback",
|
|
267
|
+
className: cn("bg-muted text-muted-foreground flex size-full items-center justify-center rounded-full text-sm group-data-[size=sm]/avatar:text-xs", className),
|
|
268
|
+
...props
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
function AvatarBadge({ className, ...props }) {
|
|
272
|
+
return /* @__PURE__ */ jsx("span", {
|
|
273
|
+
"data-slot": "avatar-badge",
|
|
274
|
+
className: cn("bg-primary text-primary-foreground ring-background absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full ring-2 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),
|
|
275
|
+
...props
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
function AvatarGroup({ className, ...props }) {
|
|
279
|
+
return /* @__PURE__ */ jsx("div", {
|
|
280
|
+
"data-slot": "avatar-group",
|
|
281
|
+
className: cn("*:data-[slot=avatar]:ring-background group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2", className),
|
|
282
|
+
...props
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
function AvatarGroupCount({ className, ...props }) {
|
|
286
|
+
return /* @__PURE__ */ jsx("div", {
|
|
287
|
+
"data-slot": "avatar-group-count",
|
|
288
|
+
className: cn("bg-muted text-muted-foreground ring-background relative flex size-8 shrink-0 items-center justify-center rounded-full text-sm ring-2 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),
|
|
289
|
+
...props
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
//#endregion
|
|
294
|
+
//#region src/components/base/badge.tsx
|
|
295
|
+
const badgeVariants = cva("inline-flex items-center justify-center rounded-full border border-transparent px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden", {
|
|
296
|
+
variants: { variant: {
|
|
297
|
+
default: "bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
|
|
298
|
+
secondary: "bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
|
|
299
|
+
destructive: "bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
300
|
+
outline: "border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
|
|
301
|
+
ghost: "[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
|
|
302
|
+
link: "text-primary underline-offset-4 [a&]:hover:underline"
|
|
303
|
+
} },
|
|
304
|
+
defaultVariants: { variant: "default" }
|
|
305
|
+
});
|
|
306
|
+
function Badge({ className, variant = "default", asChild = false, ...props }) {
|
|
307
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "span", {
|
|
308
|
+
"data-slot": "badge",
|
|
309
|
+
"data-variant": variant,
|
|
310
|
+
className: cn(badgeVariants({ variant }), className),
|
|
311
|
+
...props
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
//#endregion
|
|
316
|
+
//#region src/components/base/breadcrumb.tsx
|
|
317
|
+
function Breadcrumb({ ...props }) {
|
|
318
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
319
|
+
"aria-label": "breadcrumb",
|
|
320
|
+
"data-slot": "breadcrumb",
|
|
321
|
+
...props
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
function BreadcrumbList({ className, ...props }) {
|
|
325
|
+
return /* @__PURE__ */ jsx("ol", {
|
|
326
|
+
"data-slot": "breadcrumb-list",
|
|
327
|
+
className: cn("text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5", className),
|
|
328
|
+
...props
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
function BreadcrumbItem({ className, ...props }) {
|
|
332
|
+
return /* @__PURE__ */ jsx("li", {
|
|
333
|
+
"data-slot": "breadcrumb-item",
|
|
334
|
+
className: cn("inline-flex items-center gap-1.5", className),
|
|
335
|
+
...props
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
function BreadcrumbLink({ asChild, className, ...props }) {
|
|
339
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "a", {
|
|
340
|
+
"data-slot": "breadcrumb-link",
|
|
341
|
+
className: cn("hover:text-foreground transition-colors", className),
|
|
342
|
+
...props
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
function BreadcrumbPage({ className, ...props }) {
|
|
346
|
+
return /* @__PURE__ */ jsx("span", {
|
|
347
|
+
"data-slot": "breadcrumb-page",
|
|
348
|
+
role: "link",
|
|
349
|
+
"aria-disabled": "true",
|
|
350
|
+
"aria-current": "page",
|
|
351
|
+
className: cn("text-foreground font-normal", className),
|
|
352
|
+
...props
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
function BreadcrumbSeparator({ children, className, ...props }) {
|
|
356
|
+
return /* @__PURE__ */ jsx("li", {
|
|
357
|
+
"data-slot": "breadcrumb-separator",
|
|
358
|
+
role: "presentation",
|
|
359
|
+
"aria-hidden": "true",
|
|
360
|
+
className: cn("[&>svg]:size-3.5", className),
|
|
361
|
+
...props,
|
|
362
|
+
children: children ?? /* @__PURE__ */ jsx(ChevronRight, {})
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
function BreadcrumbEllipsis({ className, ...props }) {
|
|
366
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
367
|
+
"data-slot": "breadcrumb-ellipsis",
|
|
368
|
+
role: "presentation",
|
|
369
|
+
"aria-hidden": "true",
|
|
370
|
+
className: cn("flex size-9 items-center justify-center", className),
|
|
371
|
+
...props,
|
|
372
|
+
children: [/* @__PURE__ */ jsx(MoreHorizontal, { className: "size-4" }), /* @__PURE__ */ jsx("span", {
|
|
373
|
+
className: "sr-only",
|
|
374
|
+
children: "More"
|
|
375
|
+
})]
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
//#endregion
|
|
380
|
+
//#region src/components/base/separator.tsx
|
|
381
|
+
function Separator({ className, orientation = "horizontal", decorative = true, ...props }) {
|
|
382
|
+
return /* @__PURE__ */ jsx(Separator$1.Root, {
|
|
383
|
+
"data-slot": "separator",
|
|
384
|
+
decorative,
|
|
385
|
+
orientation,
|
|
386
|
+
className: cn("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px", className),
|
|
387
|
+
...props
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
//#endregion
|
|
392
|
+
//#region src/components/base/button-group.tsx
|
|
393
|
+
const buttonGroupVariants = cva("flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2", {
|
|
394
|
+
variants: { orientation: {
|
|
395
|
+
horizontal: "[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",
|
|
396
|
+
vertical: "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"
|
|
397
|
+
} },
|
|
398
|
+
defaultVariants: { orientation: "horizontal" }
|
|
399
|
+
});
|
|
400
|
+
function ButtonGroup({ className, orientation, ...props }) {
|
|
401
|
+
return /* @__PURE__ */ jsx("div", {
|
|
402
|
+
role: "group",
|
|
403
|
+
"data-slot": "button-group",
|
|
404
|
+
"data-orientation": orientation,
|
|
405
|
+
className: cn(buttonGroupVariants({ orientation }), className),
|
|
406
|
+
...props
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
function ButtonGroupText({ className, asChild = false, ...props }) {
|
|
410
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "div", {
|
|
411
|
+
className: cn("bg-muted flex items-center gap-2 rounded-md border px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4", className),
|
|
412
|
+
...props
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
function ButtonGroupSeparator({ className, orientation = "vertical", ...props }) {
|
|
416
|
+
return /* @__PURE__ */ jsx(Separator, {
|
|
417
|
+
"data-slot": "button-group-separator",
|
|
418
|
+
orientation,
|
|
419
|
+
className: cn("bg-input relative !m-0 self-stretch data-[orientation=vertical]:h-auto", className),
|
|
420
|
+
...props
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
//#endregion
|
|
425
|
+
//#region src/components/base/calendar.tsx
|
|
426
|
+
function Calendar({ className, classNames, showOutsideDays = true, captionLayout = "label", buttonVariant = "ghost", formatters, components, ...props }) {
|
|
427
|
+
const defaultClassNames = getDefaultClassNames();
|
|
428
|
+
return /* @__PURE__ */ jsx(DayPicker, {
|
|
429
|
+
showOutsideDays,
|
|
430
|
+
className: cn("bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[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),
|
|
431
|
+
captionLayout,
|
|
432
|
+
formatters: {
|
|
433
|
+
formatMonthDropdown: (date) => date.toLocaleString("default", { month: "short" }),
|
|
434
|
+
...formatters
|
|
435
|
+
},
|
|
436
|
+
classNames: {
|
|
437
|
+
root: cn("w-fit", defaultClassNames.root),
|
|
438
|
+
months: cn("flex gap-4 flex-col md:flex-row relative", defaultClassNames.months),
|
|
439
|
+
month: cn("flex flex-col w-full gap-4", defaultClassNames.month),
|
|
440
|
+
nav: cn("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between", defaultClassNames.nav),
|
|
441
|
+
button_previous: cn(buttonVariants({ variant: buttonVariant }), "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none", defaultClassNames.button_previous),
|
|
442
|
+
button_next: cn(buttonVariants({ variant: buttonVariant }), "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none", defaultClassNames.button_next),
|
|
443
|
+
month_caption: cn("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)", defaultClassNames.month_caption),
|
|
444
|
+
dropdowns: cn("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5", defaultClassNames.dropdowns),
|
|
445
|
+
dropdown_root: cn("relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md", defaultClassNames.dropdown_root),
|
|
446
|
+
dropdown: cn("absolute bg-popover inset-0 opacity-0", defaultClassNames.dropdown),
|
|
447
|
+
caption_label: cn("select-none font-medium", captionLayout === "label" ? "text-sm" : "rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5", defaultClassNames.caption_label),
|
|
448
|
+
table: "w-full border-collapse",
|
|
449
|
+
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
450
|
+
weekday: cn("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none", defaultClassNames.weekday),
|
|
451
|
+
week: cn("flex w-full mt-2", defaultClassNames.week),
|
|
452
|
+
week_number_header: cn("select-none w-(--cell-size)", defaultClassNames.week_number_header),
|
|
453
|
+
week_number: cn("text-[0.8rem] select-none text-muted-foreground", defaultClassNames.week_number),
|
|
454
|
+
day: cn("relative w-full h-full p-0 text-center [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none", props.showWeekNumber ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-md" : "[&:first-child[data-selected=true]_button]:rounded-l-md", defaultClassNames.day),
|
|
455
|
+
range_start: cn("rounded-l-md bg-accent", defaultClassNames.range_start),
|
|
456
|
+
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
457
|
+
range_end: cn("rounded-r-md bg-accent", defaultClassNames.range_end),
|
|
458
|
+
today: cn("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none", defaultClassNames.today),
|
|
459
|
+
outside: cn("text-muted-foreground aria-selected:text-muted-foreground", defaultClassNames.outside),
|
|
460
|
+
disabled: cn("text-muted-foreground opacity-50", defaultClassNames.disabled),
|
|
461
|
+
hidden: cn("invisible", defaultClassNames.hidden),
|
|
462
|
+
...classNames
|
|
463
|
+
},
|
|
464
|
+
components: {
|
|
465
|
+
Root: ({ className, rootRef, ...props }) => {
|
|
466
|
+
return /* @__PURE__ */ jsx("div", {
|
|
467
|
+
"data-slot": "calendar",
|
|
468
|
+
ref: rootRef,
|
|
469
|
+
className: cn(className),
|
|
470
|
+
...props
|
|
471
|
+
});
|
|
472
|
+
},
|
|
473
|
+
Chevron: ({ className, orientation, ...props }) => {
|
|
474
|
+
if (orientation === "left") return /* @__PURE__ */ jsx(ChevronLeftIcon, {
|
|
475
|
+
className: cn("size-4", className),
|
|
476
|
+
...props
|
|
477
|
+
});
|
|
478
|
+
if (orientation === "right") return /* @__PURE__ */ jsx(ChevronRightIcon, {
|
|
479
|
+
className: cn("size-4", className),
|
|
480
|
+
...props
|
|
481
|
+
});
|
|
482
|
+
return /* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
483
|
+
className: cn("size-4", className),
|
|
484
|
+
...props
|
|
485
|
+
});
|
|
486
|
+
},
|
|
487
|
+
DayButton: CalendarDayButton,
|
|
488
|
+
WeekNumber: ({ children, ...props }) => {
|
|
489
|
+
return /* @__PURE__ */ jsx("td", {
|
|
490
|
+
...props,
|
|
491
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
492
|
+
className: "flex size-(--cell-size) items-center justify-center text-center",
|
|
493
|
+
children
|
|
494
|
+
})
|
|
495
|
+
});
|
|
496
|
+
},
|
|
497
|
+
...components
|
|
498
|
+
},
|
|
499
|
+
...props
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
function CalendarDayButton({ className, day, modifiers, ...props }) {
|
|
503
|
+
const defaultClassNames = getDefaultClassNames();
|
|
504
|
+
const ref = React.useRef(null);
|
|
505
|
+
React.useEffect(() => {
|
|
506
|
+
if (modifiers.focused) ref.current?.focus();
|
|
507
|
+
}, [modifiers.focused]);
|
|
508
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
509
|
+
ref,
|
|
510
|
+
variant: "ghost",
|
|
511
|
+
size: "icon",
|
|
512
|
+
"data-day": day.date.toLocaleDateString(),
|
|
513
|
+
"data-selected-single": modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle,
|
|
514
|
+
"data-range-start": modifiers.range_start,
|
|
515
|
+
"data-range-end": modifiers.range_end,
|
|
516
|
+
"data-range-middle": modifiers.range_middle,
|
|
517
|
+
className: cn("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70", defaultClassNames.day, className),
|
|
518
|
+
...props
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
//#endregion
|
|
523
|
+
//#region src/components/base/card.tsx
|
|
524
|
+
function Card({ className, ...props }) {
|
|
525
|
+
return /* @__PURE__ */ jsx("div", {
|
|
526
|
+
"data-slot": "card",
|
|
527
|
+
className: cn("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm", className),
|
|
528
|
+
...props
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
function CardHeader({ className, ...props }) {
|
|
532
|
+
return /* @__PURE__ */ jsx("div", {
|
|
533
|
+
"data-slot": "card-header",
|
|
534
|
+
className: cn("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6", className),
|
|
535
|
+
...props
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
function CardTitle({ className, ...props }) {
|
|
539
|
+
return /* @__PURE__ */ jsx("div", {
|
|
540
|
+
"data-slot": "card-title",
|
|
541
|
+
className: cn("leading-none font-semibold", className),
|
|
542
|
+
...props
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
function CardDescription({ className, ...props }) {
|
|
546
|
+
return /* @__PURE__ */ jsx("div", {
|
|
547
|
+
"data-slot": "card-description",
|
|
548
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
549
|
+
...props
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
function CardAction({ className, ...props }) {
|
|
553
|
+
return /* @__PURE__ */ jsx("div", {
|
|
554
|
+
"data-slot": "card-action",
|
|
555
|
+
className: cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className),
|
|
556
|
+
...props
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
function CardContent({ className, ...props }) {
|
|
560
|
+
return /* @__PURE__ */ jsx("div", {
|
|
561
|
+
"data-slot": "card-content",
|
|
562
|
+
className: cn("px-6", className),
|
|
563
|
+
...props
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
function CardFooter({ className, ...props }) {
|
|
567
|
+
return /* @__PURE__ */ jsx("div", {
|
|
568
|
+
"data-slot": "card-footer",
|
|
569
|
+
className: cn("flex items-center px-6 [.border-t]:pt-6", className),
|
|
570
|
+
...props
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
//#endregion
|
|
575
|
+
//#region src/components/base/carousel.tsx
|
|
576
|
+
const CarouselContext = React.createContext(null);
|
|
577
|
+
function useCarousel() {
|
|
578
|
+
const context = React.useContext(CarouselContext);
|
|
579
|
+
if (!context) throw new Error("useCarousel must be used within a <Carousel />");
|
|
580
|
+
return context;
|
|
581
|
+
}
|
|
582
|
+
function Carousel({ orientation = "horizontal", opts, setApi, plugins, className, children, ...props }) {
|
|
583
|
+
const [carouselRef, api] = useEmblaCarousel({
|
|
584
|
+
...opts,
|
|
585
|
+
axis: orientation === "horizontal" ? "x" : "y"
|
|
586
|
+
}, plugins);
|
|
587
|
+
const [canScrollPrev, setCanScrollPrev] = React.useState(false);
|
|
588
|
+
const [canScrollNext, setCanScrollNext] = React.useState(false);
|
|
589
|
+
const onSelect = React.useCallback((api) => {
|
|
590
|
+
if (!api) return;
|
|
591
|
+
setCanScrollPrev(api.canScrollPrev());
|
|
592
|
+
setCanScrollNext(api.canScrollNext());
|
|
593
|
+
}, []);
|
|
594
|
+
const scrollPrev = React.useCallback(() => {
|
|
595
|
+
api?.scrollPrev();
|
|
596
|
+
}, [api]);
|
|
597
|
+
const scrollNext = React.useCallback(() => {
|
|
598
|
+
api?.scrollNext();
|
|
599
|
+
}, [api]);
|
|
600
|
+
const handleKeyDown = React.useCallback((event) => {
|
|
601
|
+
if (event.key === "ArrowLeft") {
|
|
602
|
+
event.preventDefault();
|
|
603
|
+
scrollPrev();
|
|
604
|
+
} else if (event.key === "ArrowRight") {
|
|
605
|
+
event.preventDefault();
|
|
606
|
+
scrollNext();
|
|
607
|
+
}
|
|
608
|
+
}, [scrollPrev, scrollNext]);
|
|
609
|
+
React.useEffect(() => {
|
|
610
|
+
if (!api || !setApi) return;
|
|
611
|
+
setApi(api);
|
|
612
|
+
}, [api, setApi]);
|
|
613
|
+
React.useEffect(() => {
|
|
614
|
+
if (!api) return;
|
|
615
|
+
onSelect(api);
|
|
616
|
+
api.on("reInit", onSelect);
|
|
617
|
+
api.on("select", onSelect);
|
|
618
|
+
return () => {
|
|
619
|
+
api?.off("select", onSelect);
|
|
620
|
+
};
|
|
621
|
+
}, [api, onSelect]);
|
|
622
|
+
return /* @__PURE__ */ jsx(CarouselContext.Provider, {
|
|
623
|
+
value: {
|
|
624
|
+
carouselRef,
|
|
625
|
+
api,
|
|
626
|
+
opts,
|
|
627
|
+
orientation: orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
|
|
628
|
+
scrollPrev,
|
|
629
|
+
scrollNext,
|
|
630
|
+
canScrollPrev,
|
|
631
|
+
canScrollNext
|
|
632
|
+
},
|
|
633
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
634
|
+
onKeyDownCapture: handleKeyDown,
|
|
635
|
+
className: cn("relative", className),
|
|
636
|
+
role: "region",
|
|
637
|
+
"aria-roledescription": "carousel",
|
|
638
|
+
"data-slot": "carousel",
|
|
639
|
+
...props,
|
|
640
|
+
children
|
|
641
|
+
})
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
function CarouselContent({ className, ...props }) {
|
|
645
|
+
const { carouselRef, orientation } = useCarousel();
|
|
646
|
+
return /* @__PURE__ */ jsx("div", {
|
|
647
|
+
ref: carouselRef,
|
|
648
|
+
className: "overflow-hidden",
|
|
649
|
+
"data-slot": "carousel-content",
|
|
650
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
651
|
+
className: cn("flex", orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col", className),
|
|
652
|
+
...props
|
|
653
|
+
})
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
function CarouselItem({ className, ...props }) {
|
|
657
|
+
const { orientation } = useCarousel();
|
|
658
|
+
return /* @__PURE__ */ jsx("div", {
|
|
659
|
+
role: "group",
|
|
660
|
+
"aria-roledescription": "slide",
|
|
661
|
+
"data-slot": "carousel-item",
|
|
662
|
+
className: cn("min-w-0 shrink-0 grow-0 basis-full", orientation === "horizontal" ? "pl-4" : "pt-4", className),
|
|
663
|
+
...props
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
function CarouselPrevious({ className, variant = "outline", size = "icon", ...props }) {
|
|
667
|
+
const { orientation, scrollPrev, canScrollPrev } = useCarousel();
|
|
668
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
669
|
+
"data-slot": "carousel-previous",
|
|
670
|
+
variant,
|
|
671
|
+
size,
|
|
672
|
+
className: cn("absolute size-8 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),
|
|
673
|
+
disabled: !canScrollPrev,
|
|
674
|
+
onClick: scrollPrev,
|
|
675
|
+
...props,
|
|
676
|
+
children: [/* @__PURE__ */ jsx(ArrowLeft, {}), /* @__PURE__ */ jsx("span", {
|
|
677
|
+
className: "sr-only",
|
|
678
|
+
children: "Previous slide"
|
|
679
|
+
})]
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
function CarouselNext({ className, variant = "outline", size = "icon", ...props }) {
|
|
683
|
+
const { orientation, scrollNext, canScrollNext } = useCarousel();
|
|
684
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
685
|
+
"data-slot": "carousel-next",
|
|
686
|
+
variant,
|
|
687
|
+
size,
|
|
688
|
+
className: cn("absolute size-8 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),
|
|
689
|
+
disabled: !canScrollNext,
|
|
690
|
+
onClick: scrollNext,
|
|
691
|
+
...props,
|
|
692
|
+
children: [/* @__PURE__ */ jsx(ArrowRight, {}), /* @__PURE__ */ jsx("span", {
|
|
693
|
+
className: "sr-only",
|
|
694
|
+
children: "Next slide"
|
|
695
|
+
})]
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
//#endregion
|
|
700
|
+
//#region src/components/base/chart.tsx
|
|
701
|
+
const THEMES = {
|
|
702
|
+
light: "",
|
|
703
|
+
dark: ".dark"
|
|
704
|
+
};
|
|
705
|
+
const ChartContext = React.createContext(null);
|
|
706
|
+
function useChart() {
|
|
707
|
+
const context = React.useContext(ChartContext);
|
|
708
|
+
if (!context) throw new Error("useChart must be used within a <ChartContainer />");
|
|
709
|
+
return context;
|
|
710
|
+
}
|
|
711
|
+
function ChartContainer({ id, className, children, config, ...props }) {
|
|
712
|
+
const uniqueId = React.useId();
|
|
713
|
+
const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
|
|
714
|
+
return /* @__PURE__ */ jsx(ChartContext.Provider, {
|
|
715
|
+
value: { config },
|
|
716
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
717
|
+
"data-slot": "chart",
|
|
718
|
+
"data-chart": chartId,
|
|
719
|
+
className: cn("[&_.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-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 flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden", className),
|
|
720
|
+
...props,
|
|
721
|
+
children: [/* @__PURE__ */ jsx(ChartStyle, {
|
|
722
|
+
id: chartId,
|
|
723
|
+
config
|
|
724
|
+
}), /* @__PURE__ */ jsx(RechartsPrimitive.ResponsiveContainer, { children })]
|
|
725
|
+
})
|
|
726
|
+
});
|
|
727
|
+
}
|
|
728
|
+
const ChartStyle = ({ id, config }) => {
|
|
729
|
+
const colorConfig = Object.entries(config).filter(([, config]) => config.theme || config.color);
|
|
730
|
+
if (!colorConfig.length) return null;
|
|
731
|
+
return /* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: Object.entries(THEMES).map(([theme, prefix]) => `
|
|
732
|
+
${prefix} [data-chart=${id}] {
|
|
733
|
+
${colorConfig.map(([key, itemConfig]) => {
|
|
734
|
+
const color = itemConfig.theme?.[theme] || itemConfig.color;
|
|
735
|
+
return color ? ` --color-${key}: ${color};` : null;
|
|
736
|
+
}).join("\n")}
|
|
737
|
+
}
|
|
738
|
+
`).join("\n") } });
|
|
739
|
+
};
|
|
740
|
+
const ChartTooltip = RechartsPrimitive.Tooltip;
|
|
741
|
+
function ChartTooltipContent({ active, payload, className, indicator = "dot", hideLabel = false, hideIndicator = false, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey }) {
|
|
742
|
+
const { config } = useChart();
|
|
743
|
+
const tooltipLabel = React.useMemo(() => {
|
|
744
|
+
if (hideLabel || !payload?.length) return null;
|
|
745
|
+
const [item] = payload;
|
|
746
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, `${labelKey || item?.dataKey || item?.name || "value"}`);
|
|
747
|
+
const value = !labelKey && typeof label === "string" ? config[label]?.label || label : itemConfig?.label;
|
|
748
|
+
if (labelFormatter) return /* @__PURE__ */ jsx("div", {
|
|
749
|
+
className: cn("font-medium", labelClassName),
|
|
750
|
+
children: labelFormatter(value, payload)
|
|
751
|
+
});
|
|
752
|
+
if (!value) return null;
|
|
753
|
+
return /* @__PURE__ */ jsx("div", {
|
|
754
|
+
className: cn("font-medium", labelClassName),
|
|
755
|
+
children: value
|
|
756
|
+
});
|
|
757
|
+
}, [
|
|
758
|
+
label,
|
|
759
|
+
labelFormatter,
|
|
760
|
+
payload,
|
|
761
|
+
hideLabel,
|
|
762
|
+
labelClassName,
|
|
763
|
+
config,
|
|
764
|
+
labelKey
|
|
765
|
+
]);
|
|
766
|
+
if (!active || !payload?.length) return null;
|
|
767
|
+
const nestLabel = payload.length === 1 && indicator !== "dot";
|
|
768
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
769
|
+
className: cn("border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl", className),
|
|
770
|
+
children: [!nestLabel ? tooltipLabel : null, /* @__PURE__ */ jsx("div", {
|
|
771
|
+
className: "grid gap-1.5",
|
|
772
|
+
children: payload.filter((item) => item.type !== "none").map((item, index) => {
|
|
773
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, `${nameKey || item.name || item.dataKey || "value"}`);
|
|
774
|
+
const indicatorColor = color || item.payload.fill || item.color;
|
|
775
|
+
return /* @__PURE__ */ jsx("div", {
|
|
776
|
+
className: cn("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5", indicator === "dot" && "items-center"),
|
|
777
|
+
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", {
|
|
778
|
+
className: cn("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)", {
|
|
779
|
+
"h-2.5 w-2.5": indicator === "dot",
|
|
780
|
+
"w-1": indicator === "line",
|
|
781
|
+
"w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
|
|
782
|
+
"my-0.5": nestLabel && indicator === "dashed"
|
|
783
|
+
}),
|
|
784
|
+
style: {
|
|
785
|
+
"--color-bg": indicatorColor,
|
|
786
|
+
"--color-border": indicatorColor
|
|
787
|
+
}
|
|
788
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
789
|
+
className: cn("flex flex-1 justify-between leading-none", nestLabel ? "items-end" : "items-center"),
|
|
790
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
791
|
+
className: "grid gap-1.5",
|
|
792
|
+
children: [nestLabel ? tooltipLabel : null, /* @__PURE__ */ jsx("span", {
|
|
793
|
+
className: "text-muted-foreground",
|
|
794
|
+
children: itemConfig?.label || item.name
|
|
795
|
+
})]
|
|
796
|
+
}), item.value && /* @__PURE__ */ jsx("span", {
|
|
797
|
+
className: "text-foreground font-mono font-medium tabular-nums",
|
|
798
|
+
children: item.value.toLocaleString()
|
|
799
|
+
})]
|
|
800
|
+
})] })
|
|
801
|
+
}, item.dataKey);
|
|
802
|
+
})
|
|
803
|
+
})]
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
const ChartLegend = RechartsPrimitive.Legend;
|
|
807
|
+
function ChartLegendContent({ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey }) {
|
|
808
|
+
const { config } = useChart();
|
|
809
|
+
if (!payload?.length) return null;
|
|
810
|
+
return /* @__PURE__ */ jsx("div", {
|
|
811
|
+
className: cn("flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className),
|
|
812
|
+
children: payload.filter((item) => item.type !== "none").map((item) => {
|
|
813
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, `${nameKey || item.dataKey || "value"}`);
|
|
814
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
815
|
+
className: cn("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),
|
|
816
|
+
children: [itemConfig?.icon && !hideIcon ? /* @__PURE__ */ jsx(itemConfig.icon, {}) : /* @__PURE__ */ jsx("div", {
|
|
817
|
+
className: "h-2 w-2 shrink-0 rounded-[2px]",
|
|
818
|
+
style: { backgroundColor: item.color }
|
|
819
|
+
}), itemConfig?.label]
|
|
820
|
+
}, item.value);
|
|
821
|
+
})
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
function getPayloadConfigFromPayload(config, payload, key) {
|
|
825
|
+
if (typeof payload !== "object" || payload === null) return;
|
|
826
|
+
const payloadPayload = "payload" in payload && typeof payload.payload === "object" && payload.payload !== null ? payload.payload : void 0;
|
|
827
|
+
let configLabelKey = key;
|
|
828
|
+
if (key in payload && typeof payload[key] === "string") configLabelKey = payload[key];
|
|
829
|
+
else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === "string") configLabelKey = payloadPayload[key];
|
|
830
|
+
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
//#endregion
|
|
834
|
+
//#region src/components/base/checkbox.tsx
|
|
835
|
+
function Checkbox({ className, ...props }) {
|
|
836
|
+
return /* @__PURE__ */ jsx(Checkbox$1.Root, {
|
|
837
|
+
"data-slot": "checkbox",
|
|
838
|
+
className: cn("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
839
|
+
...props,
|
|
840
|
+
children: /* @__PURE__ */ jsx(Checkbox$1.Indicator, {
|
|
841
|
+
"data-slot": "checkbox-indicator",
|
|
842
|
+
className: "grid place-content-center text-current transition-none",
|
|
843
|
+
children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-3.5" })
|
|
844
|
+
})
|
|
845
|
+
});
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
//#endregion
|
|
849
|
+
//#region src/components/base/collapsible.tsx
|
|
850
|
+
function Collapsible({ ...props }) {
|
|
851
|
+
return /* @__PURE__ */ jsx(Collapsible$1.Root, {
|
|
852
|
+
"data-slot": "collapsible",
|
|
853
|
+
...props
|
|
854
|
+
});
|
|
855
|
+
}
|
|
856
|
+
function CollapsibleTrigger({ ...props }) {
|
|
857
|
+
return /* @__PURE__ */ jsx(Collapsible$1.CollapsibleTrigger, {
|
|
858
|
+
"data-slot": "collapsible-trigger",
|
|
859
|
+
...props
|
|
860
|
+
});
|
|
861
|
+
}
|
|
862
|
+
function CollapsibleContent({ ...props }) {
|
|
863
|
+
return /* @__PURE__ */ jsx(Collapsible$1.CollapsibleContent, {
|
|
864
|
+
"data-slot": "collapsible-content",
|
|
865
|
+
...props
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
//#endregion
|
|
870
|
+
//#region src/components/base/input.tsx
|
|
871
|
+
function Input({ className, type, ...props }) {
|
|
872
|
+
return /* @__PURE__ */ jsx("input", {
|
|
873
|
+
type,
|
|
874
|
+
"data-slot": "input",
|
|
875
|
+
className: cn("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]", "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", className),
|
|
876
|
+
...props
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
//#endregion
|
|
881
|
+
//#region src/components/base/textarea.tsx
|
|
882
|
+
function Textarea({ className, ...props }) {
|
|
883
|
+
return /* @__PURE__ */ jsx("textarea", {
|
|
884
|
+
"data-slot": "textarea",
|
|
885
|
+
className: cn("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", className),
|
|
886
|
+
...props
|
|
887
|
+
});
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
//#endregion
|
|
891
|
+
//#region src/components/base/input-group.tsx
|
|
892
|
+
function InputGroup({ className, ...props }) {
|
|
893
|
+
return /* @__PURE__ */ jsx("div", {
|
|
894
|
+
"data-slot": "input-group",
|
|
895
|
+
role: "group",
|
|
896
|
+
className: cn("group/input-group border-input dark:bg-input/30 relative flex w-full items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none", "h-9 min-w-0 has-[>textarea]:h-auto", "has-[>[data-align=inline-start]]:[&>input]:pl-2", "has-[>[data-align=inline-end]]:[&>input]:pr-2", "has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3", "has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3", "has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-[3px]", "has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40", className),
|
|
897
|
+
...props
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
const inputGroupAddonVariants = cva("text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none [&>svg:not([class*='size-'])]:size-4 [&>kbd]:rounded-[calc(var(--radius)-5px)] group-data-[disabled=true]/input-group:opacity-50", {
|
|
901
|
+
variants: { align: {
|
|
902
|
+
"inline-start": "order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",
|
|
903
|
+
"inline-end": "order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]",
|
|
904
|
+
"block-start": "order-first w-full justify-start px-3 pt-3 [.border-b]:pb-3 group-has-[>input]/input-group:pt-2.5",
|
|
905
|
+
"block-end": "order-last w-full justify-start px-3 pb-3 [.border-t]:pt-3 group-has-[>input]/input-group:pb-2.5"
|
|
906
|
+
} },
|
|
907
|
+
defaultVariants: { align: "inline-start" }
|
|
908
|
+
});
|
|
909
|
+
function InputGroupAddon({ className, align = "inline-start", ...props }) {
|
|
910
|
+
return /* @__PURE__ */ jsx("div", {
|
|
911
|
+
role: "group",
|
|
912
|
+
"data-slot": "input-group-addon",
|
|
913
|
+
"data-align": align,
|
|
914
|
+
className: cn(inputGroupAddonVariants({ align }), className),
|
|
915
|
+
onClick: (e) => {
|
|
916
|
+
if (e.target.closest("button")) return;
|
|
917
|
+
e.currentTarget.parentElement?.querySelector("input")?.focus();
|
|
918
|
+
},
|
|
919
|
+
...props
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
const inputGroupButtonVariants = cva("text-sm shadow-none flex gap-2 items-center", {
|
|
923
|
+
variants: { size: {
|
|
924
|
+
xs: "h-6 gap-1 px-2 rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-3.5 has-[>svg]:px-2",
|
|
925
|
+
sm: "h-8 px-2.5 gap-1.5 rounded-md has-[>svg]:px-2.5",
|
|
926
|
+
"icon-xs": "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
|
|
927
|
+
"icon-sm": "size-8 p-0 has-[>svg]:p-0"
|
|
928
|
+
} },
|
|
929
|
+
defaultVariants: { size: "xs" }
|
|
930
|
+
});
|
|
931
|
+
function InputGroupButton({ className, type = "button", variant = "ghost", size = "xs", ...props }) {
|
|
932
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
933
|
+
type,
|
|
934
|
+
"data-size": size,
|
|
935
|
+
variant,
|
|
936
|
+
className: cn(inputGroupButtonVariants({ size }), className),
|
|
937
|
+
...props
|
|
938
|
+
});
|
|
939
|
+
}
|
|
940
|
+
function InputGroupText({ className, ...props }) {
|
|
941
|
+
return /* @__PURE__ */ jsx("span", {
|
|
942
|
+
className: cn("text-muted-foreground flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4", className),
|
|
943
|
+
...props
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
function InputGroupInput({ className, ...props }) {
|
|
947
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
948
|
+
"data-slot": "input-group-control",
|
|
949
|
+
className: cn("flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent", className),
|
|
950
|
+
...props
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
function InputGroupTextarea({ className, ...props }) {
|
|
954
|
+
return /* @__PURE__ */ jsx(Textarea, {
|
|
955
|
+
"data-slot": "input-group-control",
|
|
956
|
+
className: cn("flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent", className),
|
|
957
|
+
...props
|
|
958
|
+
});
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
//#endregion
|
|
962
|
+
//#region src/components/base/combobox.tsx
|
|
963
|
+
const Combobox = Combobox$1.Root;
|
|
964
|
+
function ComboboxValue({ ...props }) {
|
|
965
|
+
return /* @__PURE__ */ jsx(Combobox$1.Value, {
|
|
966
|
+
"data-slot": "combobox-value",
|
|
967
|
+
...props
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
function ComboboxTrigger({ className, children, ...props }) {
|
|
971
|
+
return /* @__PURE__ */ jsxs(Combobox$1.Trigger, {
|
|
972
|
+
"data-slot": "combobox-trigger",
|
|
973
|
+
className: cn("[&_svg:not([class*='size-'])]:size-4", className),
|
|
974
|
+
...props,
|
|
975
|
+
children: [children, /* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
976
|
+
"data-slot": "combobox-trigger-icon",
|
|
977
|
+
className: "text-muted-foreground pointer-events-none size-4"
|
|
978
|
+
})]
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
function ComboboxClear({ className, ...props }) {
|
|
982
|
+
return /* @__PURE__ */ jsx(Combobox$1.Clear, {
|
|
983
|
+
"data-slot": "combobox-clear",
|
|
984
|
+
render: /* @__PURE__ */ jsx(InputGroupButton, {
|
|
985
|
+
variant: "ghost",
|
|
986
|
+
size: "icon-xs"
|
|
987
|
+
}),
|
|
988
|
+
className: cn(className),
|
|
989
|
+
...props,
|
|
990
|
+
children: /* @__PURE__ */ jsx(XIcon, { className: "pointer-events-none" })
|
|
991
|
+
});
|
|
992
|
+
}
|
|
993
|
+
function ComboboxInput({ className, children, disabled = false, showTrigger = true, showClear = false, ...props }) {
|
|
994
|
+
return /* @__PURE__ */ jsxs(InputGroup, {
|
|
995
|
+
className: cn("w-auto", className),
|
|
996
|
+
children: [
|
|
997
|
+
/* @__PURE__ */ jsx(Combobox$1.Input, {
|
|
998
|
+
render: /* @__PURE__ */ jsx(InputGroupInput, { disabled }),
|
|
999
|
+
...props
|
|
1000
|
+
}),
|
|
1001
|
+
/* @__PURE__ */ jsxs(InputGroupAddon, {
|
|
1002
|
+
align: "inline-end",
|
|
1003
|
+
children: [showTrigger && /* @__PURE__ */ jsx(InputGroupButton, {
|
|
1004
|
+
size: "icon-xs",
|
|
1005
|
+
variant: "ghost",
|
|
1006
|
+
asChild: true,
|
|
1007
|
+
"data-slot": "input-group-button",
|
|
1008
|
+
className: "group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent",
|
|
1009
|
+
disabled,
|
|
1010
|
+
children: /* @__PURE__ */ jsx(ComboboxTrigger, {})
|
|
1011
|
+
}), showClear && /* @__PURE__ */ jsx(ComboboxClear, { disabled })]
|
|
1012
|
+
}),
|
|
1013
|
+
children
|
|
1014
|
+
]
|
|
1015
|
+
});
|
|
1016
|
+
}
|
|
1017
|
+
function ComboboxContent({ className, side = "bottom", sideOffset = 6, align = "start", alignOffset = 0, anchor, ...props }) {
|
|
1018
|
+
return /* @__PURE__ */ jsx(Combobox$1.Portal, { children: /* @__PURE__ */ jsx(Combobox$1.Positioner, {
|
|
1019
|
+
side,
|
|
1020
|
+
sideOffset,
|
|
1021
|
+
align,
|
|
1022
|
+
alignOffset,
|
|
1023
|
+
anchor,
|
|
1024
|
+
className: "isolate z-50",
|
|
1025
|
+
children: /* @__PURE__ */ jsx(Combobox$1.Popup, {
|
|
1026
|
+
"data-slot": "combobox-content",
|
|
1027
|
+
"data-chips": !!anchor,
|
|
1028
|
+
className: cn("bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:border-input/30 group/combobox-content relative max-h-96 w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-md shadow-md ring-1 duration-100 data-[chips=true]:min-w-(--anchor-width) *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:shadow-none", className),
|
|
1029
|
+
...props
|
|
1030
|
+
})
|
|
1031
|
+
}) });
|
|
1032
|
+
}
|
|
1033
|
+
function ComboboxList({ className, ...props }) {
|
|
1034
|
+
return /* @__PURE__ */ jsx(Combobox$1.List, {
|
|
1035
|
+
"data-slot": "combobox-list",
|
|
1036
|
+
className: cn("max-h-[min(calc(--spacing(96)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto p-1 data-empty:p-0", className),
|
|
1037
|
+
...props
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
1040
|
+
function ComboboxItem({ className, children, ...props }) {
|
|
1041
|
+
return /* @__PURE__ */ jsxs(Combobox$1.Item, {
|
|
1042
|
+
"data-slot": "combobox-item",
|
|
1043
|
+
className: cn("data-highlighted:bg-accent data-highlighted:text-accent-foreground 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-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
1044
|
+
...props,
|
|
1045
|
+
children: [children, /* @__PURE__ */ jsx(Combobox$1.ItemIndicator, {
|
|
1046
|
+
"data-slot": "combobox-item-indicator",
|
|
1047
|
+
render: /* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center" }),
|
|
1048
|
+
children: /* @__PURE__ */ jsx(CheckIcon, { className: "pointer-events-none size-4 pointer-coarse:size-5" })
|
|
1049
|
+
})]
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1052
|
+
function ComboboxGroup({ className, ...props }) {
|
|
1053
|
+
return /* @__PURE__ */ jsx(Combobox$1.Group, {
|
|
1054
|
+
"data-slot": "combobox-group",
|
|
1055
|
+
className: cn(className),
|
|
1056
|
+
...props
|
|
1057
|
+
});
|
|
1058
|
+
}
|
|
1059
|
+
function ComboboxLabel({ className, ...props }) {
|
|
1060
|
+
return /* @__PURE__ */ jsx(Combobox$1.GroupLabel, {
|
|
1061
|
+
"data-slot": "combobox-label",
|
|
1062
|
+
className: cn("text-muted-foreground px-2 py-1.5 text-xs pointer-coarse:px-3 pointer-coarse:py-2 pointer-coarse:text-sm", className),
|
|
1063
|
+
...props
|
|
1064
|
+
});
|
|
1065
|
+
}
|
|
1066
|
+
function ComboboxCollection({ ...props }) {
|
|
1067
|
+
return /* @__PURE__ */ jsx(Combobox$1.Collection, {
|
|
1068
|
+
"data-slot": "combobox-collection",
|
|
1069
|
+
...props
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
function ComboboxEmpty({ className, ...props }) {
|
|
1073
|
+
return /* @__PURE__ */ jsx(Combobox$1.Empty, {
|
|
1074
|
+
"data-slot": "combobox-empty",
|
|
1075
|
+
className: cn("text-muted-foreground hidden w-full justify-center py-2 text-center text-sm group-data-empty/combobox-content:flex", className),
|
|
1076
|
+
...props
|
|
1077
|
+
});
|
|
1078
|
+
}
|
|
1079
|
+
function ComboboxSeparator({ className, ...props }) {
|
|
1080
|
+
return /* @__PURE__ */ jsx(Combobox$1.Separator, {
|
|
1081
|
+
"data-slot": "combobox-separator",
|
|
1082
|
+
className: cn("bg-border -mx-1 my-1 h-px", className),
|
|
1083
|
+
...props
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1086
|
+
function ComboboxChips({ className, ...props }) {
|
|
1087
|
+
return /* @__PURE__ */ jsx(Combobox$1.Chips, {
|
|
1088
|
+
"data-slot": "combobox-chips",
|
|
1089
|
+
className: cn("dark:bg-input/30 border-input focus-within:border-ring focus-within:ring-ring/50 has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40 has-aria-invalid:border-destructive dark:has-aria-invalid:border-destructive/50 flex min-h-9 flex-wrap items-center gap-1.5 rounded-md border bg-transparent bg-clip-padding px-2.5 py-1.5 text-sm shadow-xs transition-[color,box-shadow] focus-within:ring-[3px] has-aria-invalid:ring-[3px] has-data-[slot=combobox-chip]:px-1.5", className),
|
|
1090
|
+
...props
|
|
1091
|
+
});
|
|
1092
|
+
}
|
|
1093
|
+
function ComboboxChip({ className, children, showRemove = true, ...props }) {
|
|
1094
|
+
return /* @__PURE__ */ jsxs(Combobox$1.Chip, {
|
|
1095
|
+
"data-slot": "combobox-chip",
|
|
1096
|
+
className: cn("bg-muted text-foreground flex h-[calc(--spacing(5.5))] w-fit items-center justify-center gap-1 rounded-sm px-1.5 text-xs font-medium whitespace-nowrap has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pr-0", className),
|
|
1097
|
+
...props,
|
|
1098
|
+
children: [children, showRemove && /* @__PURE__ */ jsx(Combobox$1.ChipRemove, {
|
|
1099
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
1100
|
+
variant: "ghost",
|
|
1101
|
+
size: "icon-xs"
|
|
1102
|
+
}),
|
|
1103
|
+
className: "-ml-1 opacity-50 hover:opacity-100",
|
|
1104
|
+
"data-slot": "combobox-chip-remove",
|
|
1105
|
+
children: /* @__PURE__ */ jsx(XIcon, { className: "pointer-events-none" })
|
|
1106
|
+
})]
|
|
1107
|
+
});
|
|
1108
|
+
}
|
|
1109
|
+
function ComboboxChipsInput({ className, children, ...props }) {
|
|
1110
|
+
return /* @__PURE__ */ jsx(Combobox$1.Input, {
|
|
1111
|
+
"data-slot": "combobox-chip-input",
|
|
1112
|
+
className: cn("min-w-16 flex-1 outline-none", className),
|
|
1113
|
+
...props
|
|
1114
|
+
});
|
|
1115
|
+
}
|
|
1116
|
+
function useComboboxAnchor() {
|
|
1117
|
+
return React.useRef(null);
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
//#endregion
|
|
1121
|
+
//#region src/components/base/dialog.tsx
|
|
1122
|
+
function Dialog({ ...props }) {
|
|
1123
|
+
return /* @__PURE__ */ jsx(Dialog$1.Root, {
|
|
1124
|
+
"data-slot": "dialog",
|
|
1125
|
+
...props
|
|
1126
|
+
});
|
|
1127
|
+
}
|
|
1128
|
+
function DialogTrigger({ ...props }) {
|
|
1129
|
+
return /* @__PURE__ */ jsx(Dialog$1.Trigger, {
|
|
1130
|
+
"data-slot": "dialog-trigger",
|
|
1131
|
+
...props
|
|
1132
|
+
});
|
|
1133
|
+
}
|
|
1134
|
+
function DialogPortal({ ...props }) {
|
|
1135
|
+
return /* @__PURE__ */ jsx(Dialog$1.Portal, {
|
|
1136
|
+
"data-slot": "dialog-portal",
|
|
1137
|
+
...props
|
|
1138
|
+
});
|
|
1139
|
+
}
|
|
1140
|
+
function DialogClose({ ...props }) {
|
|
1141
|
+
return /* @__PURE__ */ jsx(Dialog$1.Close, {
|
|
1142
|
+
"data-slot": "dialog-close",
|
|
1143
|
+
...props
|
|
1144
|
+
});
|
|
1145
|
+
}
|
|
1146
|
+
function DialogOverlay({ className, ...props }) {
|
|
1147
|
+
return /* @__PURE__ */ jsx(Dialog$1.Overlay, {
|
|
1148
|
+
"data-slot": "dialog-overlay",
|
|
1149
|
+
className: cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50", className),
|
|
1150
|
+
...props
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
1153
|
+
function DialogContent({ className, children, showCloseButton = true, ...props }) {
|
|
1154
|
+
return /* @__PURE__ */ jsxs(DialogPortal, {
|
|
1155
|
+
"data-slot": "dialog-portal",
|
|
1156
|
+
children: [/* @__PURE__ */ jsx(DialogOverlay, {}), /* @__PURE__ */ jsxs(Dialog$1.Content, {
|
|
1157
|
+
"data-slot": "dialog-content",
|
|
1158
|
+
className: cn("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 outline-none sm:max-w-lg", className),
|
|
1159
|
+
...props,
|
|
1160
|
+
children: [children, showCloseButton && /* @__PURE__ */ jsxs(Dialog$1.Close, {
|
|
1161
|
+
"data-slot": "dialog-close",
|
|
1162
|
+
className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
1163
|
+
children: [/* @__PURE__ */ jsx(XIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
1164
|
+
className: "sr-only",
|
|
1165
|
+
children: "Close"
|
|
1166
|
+
})]
|
|
1167
|
+
})]
|
|
1168
|
+
})]
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1171
|
+
function DialogHeader({ className, ...props }) {
|
|
1172
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1173
|
+
"data-slot": "dialog-header",
|
|
1174
|
+
className: cn("flex flex-col gap-2 text-center sm:text-left", className),
|
|
1175
|
+
...props
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
function DialogFooter({ className, showCloseButton = false, children, ...props }) {
|
|
1179
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1180
|
+
"data-slot": "dialog-footer",
|
|
1181
|
+
className: cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className),
|
|
1182
|
+
...props,
|
|
1183
|
+
children: [children, showCloseButton && /* @__PURE__ */ jsx(Dialog$1.Close, {
|
|
1184
|
+
asChild: true,
|
|
1185
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
1186
|
+
variant: "outline",
|
|
1187
|
+
children: "Close"
|
|
1188
|
+
})
|
|
1189
|
+
})]
|
|
1190
|
+
});
|
|
1191
|
+
}
|
|
1192
|
+
function DialogTitle({ className, ...props }) {
|
|
1193
|
+
return /* @__PURE__ */ jsx(Dialog$1.Title, {
|
|
1194
|
+
"data-slot": "dialog-title",
|
|
1195
|
+
className: cn("text-lg leading-none font-semibold", className),
|
|
1196
|
+
...props
|
|
1197
|
+
});
|
|
1198
|
+
}
|
|
1199
|
+
function DialogDescription({ className, ...props }) {
|
|
1200
|
+
return /* @__PURE__ */ jsx(Dialog$1.Description, {
|
|
1201
|
+
"data-slot": "dialog-description",
|
|
1202
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
1203
|
+
...props
|
|
1204
|
+
});
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
//#endregion
|
|
1208
|
+
//#region src/components/base/command.tsx
|
|
1209
|
+
function Command({ className, ...props }) {
|
|
1210
|
+
return /* @__PURE__ */ jsx(Command$1, {
|
|
1211
|
+
"data-slot": "command",
|
|
1212
|
+
className: cn("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md", className),
|
|
1213
|
+
...props
|
|
1214
|
+
});
|
|
1215
|
+
}
|
|
1216
|
+
function CommandDialog({ title = "Command Palette", description = "Search for a command to run...", children, className, showCloseButton = true, ...props }) {
|
|
1217
|
+
return /* @__PURE__ */ jsxs(Dialog, {
|
|
1218
|
+
...props,
|
|
1219
|
+
children: [/* @__PURE__ */ jsxs(DialogHeader, {
|
|
1220
|
+
className: "sr-only",
|
|
1221
|
+
children: [/* @__PURE__ */ jsx(DialogTitle, { children: title }), /* @__PURE__ */ jsx(DialogDescription, { children: description })]
|
|
1222
|
+
}), /* @__PURE__ */ jsx(DialogContent, {
|
|
1223
|
+
className: cn("overflow-hidden p-0", className),
|
|
1224
|
+
showCloseButton,
|
|
1225
|
+
children: /* @__PURE__ */ jsx(Command, {
|
|
1226
|
+
className: "[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",
|
|
1227
|
+
children
|
|
1228
|
+
})
|
|
1229
|
+
})]
|
|
1230
|
+
});
|
|
1231
|
+
}
|
|
1232
|
+
function CommandInput({ className, ...props }) {
|
|
1233
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1234
|
+
"data-slot": "command-input-wrapper",
|
|
1235
|
+
className: "flex h-9 items-center gap-2 border-b px-3",
|
|
1236
|
+
children: [/* @__PURE__ */ jsx(SearchIcon, { className: "size-4 shrink-0 opacity-50" }), /* @__PURE__ */ jsx(Command$1.Input, {
|
|
1237
|
+
"data-slot": "command-input",
|
|
1238
|
+
className: cn("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
1239
|
+
...props
|
|
1240
|
+
})]
|
|
1241
|
+
});
|
|
1242
|
+
}
|
|
1243
|
+
function CommandList({ className, ...props }) {
|
|
1244
|
+
return /* @__PURE__ */ jsx(Command$1.List, {
|
|
1245
|
+
"data-slot": "command-list",
|
|
1246
|
+
className: cn("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto", className),
|
|
1247
|
+
...props
|
|
1248
|
+
});
|
|
1249
|
+
}
|
|
1250
|
+
function CommandEmpty({ ...props }) {
|
|
1251
|
+
return /* @__PURE__ */ jsx(Command$1.Empty, {
|
|
1252
|
+
"data-slot": "command-empty",
|
|
1253
|
+
className: "py-6 text-center text-sm",
|
|
1254
|
+
...props
|
|
1255
|
+
});
|
|
1256
|
+
}
|
|
1257
|
+
function CommandGroup({ className, ...props }) {
|
|
1258
|
+
return /* @__PURE__ */ jsx(Command$1.Group, {
|
|
1259
|
+
"data-slot": "command-group",
|
|
1260
|
+
className: cn("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium", className),
|
|
1261
|
+
...props
|
|
1262
|
+
});
|
|
1263
|
+
}
|
|
1264
|
+
function CommandSeparator({ className, ...props }) {
|
|
1265
|
+
return /* @__PURE__ */ jsx(Command$1.Separator, {
|
|
1266
|
+
"data-slot": "command-separator",
|
|
1267
|
+
className: cn("bg-border -mx-1 h-px", className),
|
|
1268
|
+
...props
|
|
1269
|
+
});
|
|
1270
|
+
}
|
|
1271
|
+
function CommandItem({ className, ...props }) {
|
|
1272
|
+
return /* @__PURE__ */ jsx(Command$1.Item, {
|
|
1273
|
+
"data-slot": "command-item",
|
|
1274
|
+
className: cn("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
1275
|
+
...props
|
|
1276
|
+
});
|
|
1277
|
+
}
|
|
1278
|
+
function CommandShortcut({ className, ...props }) {
|
|
1279
|
+
return /* @__PURE__ */ jsx("span", {
|
|
1280
|
+
"data-slot": "command-shortcut",
|
|
1281
|
+
className: cn("text-muted-foreground ml-auto text-xs tracking-widest", className),
|
|
1282
|
+
...props
|
|
1283
|
+
});
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
//#endregion
|
|
1287
|
+
//#region src/components/base/context-menu.tsx
|
|
1288
|
+
function ContextMenu({ ...props }) {
|
|
1289
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Root, {
|
|
1290
|
+
"data-slot": "context-menu",
|
|
1291
|
+
...props
|
|
1292
|
+
});
|
|
1293
|
+
}
|
|
1294
|
+
function ContextMenuTrigger({ ...props }) {
|
|
1295
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Trigger, {
|
|
1296
|
+
"data-slot": "context-menu-trigger",
|
|
1297
|
+
...props
|
|
1298
|
+
});
|
|
1299
|
+
}
|
|
1300
|
+
function ContextMenuGroup({ ...props }) {
|
|
1301
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Group, {
|
|
1302
|
+
"data-slot": "context-menu-group",
|
|
1303
|
+
...props
|
|
1304
|
+
});
|
|
1305
|
+
}
|
|
1306
|
+
function ContextMenuPortal({ ...props }) {
|
|
1307
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Portal, {
|
|
1308
|
+
"data-slot": "context-menu-portal",
|
|
1309
|
+
...props
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1312
|
+
function ContextMenuSub({ ...props }) {
|
|
1313
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Sub, {
|
|
1314
|
+
"data-slot": "context-menu-sub",
|
|
1315
|
+
...props
|
|
1316
|
+
});
|
|
1317
|
+
}
|
|
1318
|
+
function ContextMenuRadioGroup({ ...props }) {
|
|
1319
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.RadioGroup, {
|
|
1320
|
+
"data-slot": "context-menu-radio-group",
|
|
1321
|
+
...props
|
|
1322
|
+
});
|
|
1323
|
+
}
|
|
1324
|
+
function ContextMenuSubTrigger({ className, inset, children, ...props }) {
|
|
1325
|
+
return /* @__PURE__ */ jsxs(ContextMenu$1.SubTrigger, {
|
|
1326
|
+
"data-slot": "context-menu-sub-trigger",
|
|
1327
|
+
"data-inset": inset,
|
|
1328
|
+
className: cn("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
1329
|
+
...props,
|
|
1330
|
+
children: [children, /* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto" })]
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1333
|
+
function ContextMenuSubContent({ className, ...props }) {
|
|
1334
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.SubContent, {
|
|
1335
|
+
"data-slot": "context-menu-sub-content",
|
|
1336
|
+
className: cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg", className),
|
|
1337
|
+
...props
|
|
1338
|
+
});
|
|
1339
|
+
}
|
|
1340
|
+
function ContextMenuContent({ className, ...props }) {
|
|
1341
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Portal, { children: /* @__PURE__ */ jsx(ContextMenu$1.Content, {
|
|
1342
|
+
"data-slot": "context-menu-content",
|
|
1343
|
+
className: cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md", className),
|
|
1344
|
+
...props
|
|
1345
|
+
}) });
|
|
1346
|
+
}
|
|
1347
|
+
function ContextMenuItem({ className, inset, variant = "default", ...props }) {
|
|
1348
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Item, {
|
|
1349
|
+
"data-slot": "context-menu-item",
|
|
1350
|
+
"data-inset": inset,
|
|
1351
|
+
"data-variant": variant,
|
|
1352
|
+
className: cn("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
1353
|
+
...props
|
|
1354
|
+
});
|
|
1355
|
+
}
|
|
1356
|
+
function ContextMenuCheckboxItem({ className, children, checked, ...props }) {
|
|
1357
|
+
return /* @__PURE__ */ jsxs(ContextMenu$1.CheckboxItem, {
|
|
1358
|
+
"data-slot": "context-menu-checkbox-item",
|
|
1359
|
+
className: cn("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
1360
|
+
checked,
|
|
1361
|
+
...props,
|
|
1362
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1363
|
+
className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",
|
|
1364
|
+
children: /* @__PURE__ */ jsx(ContextMenu$1.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4" }) })
|
|
1365
|
+
}), children]
|
|
1366
|
+
});
|
|
1367
|
+
}
|
|
1368
|
+
function ContextMenuRadioItem({ className, children, ...props }) {
|
|
1369
|
+
return /* @__PURE__ */ jsxs(ContextMenu$1.RadioItem, {
|
|
1370
|
+
"data-slot": "context-menu-radio-item",
|
|
1371
|
+
className: cn("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
1372
|
+
...props,
|
|
1373
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1374
|
+
className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",
|
|
1375
|
+
children: /* @__PURE__ */ jsx(ContextMenu$1.ItemIndicator, { children: /* @__PURE__ */ jsx(CircleIcon, { className: "size-2 fill-current" }) })
|
|
1376
|
+
}), children]
|
|
1377
|
+
});
|
|
1378
|
+
}
|
|
1379
|
+
function ContextMenuLabel({ className, inset, ...props }) {
|
|
1380
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Label, {
|
|
1381
|
+
"data-slot": "context-menu-label",
|
|
1382
|
+
"data-inset": inset,
|
|
1383
|
+
className: cn("text-foreground px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", className),
|
|
1384
|
+
...props
|
|
1385
|
+
});
|
|
1386
|
+
}
|
|
1387
|
+
function ContextMenuSeparator({ className, ...props }) {
|
|
1388
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Separator, {
|
|
1389
|
+
"data-slot": "context-menu-separator",
|
|
1390
|
+
className: cn("bg-border -mx-1 my-1 h-px", className),
|
|
1391
|
+
...props
|
|
1392
|
+
});
|
|
1393
|
+
}
|
|
1394
|
+
function ContextMenuShortcut({ className, ...props }) {
|
|
1395
|
+
return /* @__PURE__ */ jsx("span", {
|
|
1396
|
+
"data-slot": "context-menu-shortcut",
|
|
1397
|
+
className: cn("text-muted-foreground ml-auto text-xs tracking-widest", className),
|
|
1398
|
+
...props
|
|
1399
|
+
});
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1402
|
+
//#endregion
|
|
1403
|
+
//#region src/components/base/direction.tsx
|
|
1404
|
+
function DirectionProvider({ dir, direction, children }) {
|
|
1405
|
+
return /* @__PURE__ */ jsx(Direction.DirectionProvider, {
|
|
1406
|
+
dir: direction ?? dir,
|
|
1407
|
+
children
|
|
1408
|
+
});
|
|
1409
|
+
}
|
|
1410
|
+
const useDirection = Direction.useDirection;
|
|
1411
|
+
|
|
1412
|
+
//#endregion
|
|
1413
|
+
//#region src/components/base/drawer.tsx
|
|
1414
|
+
function Drawer({ ...props }) {
|
|
1415
|
+
return /* @__PURE__ */ jsx(Drawer$1.Root, {
|
|
1416
|
+
"data-slot": "drawer",
|
|
1417
|
+
...props
|
|
1418
|
+
});
|
|
1419
|
+
}
|
|
1420
|
+
function DrawerTrigger({ ...props }) {
|
|
1421
|
+
return /* @__PURE__ */ jsx(Drawer$1.Trigger, {
|
|
1422
|
+
"data-slot": "drawer-trigger",
|
|
1423
|
+
...props
|
|
1424
|
+
});
|
|
1425
|
+
}
|
|
1426
|
+
function DrawerPortal({ ...props }) {
|
|
1427
|
+
return /* @__PURE__ */ jsx(Drawer$1.Portal, {
|
|
1428
|
+
"data-slot": "drawer-portal",
|
|
1429
|
+
...props
|
|
1430
|
+
});
|
|
1431
|
+
}
|
|
1432
|
+
function DrawerClose({ ...props }) {
|
|
1433
|
+
return /* @__PURE__ */ jsx(Drawer$1.Close, {
|
|
1434
|
+
"data-slot": "drawer-close",
|
|
1435
|
+
...props
|
|
1436
|
+
});
|
|
1437
|
+
}
|
|
1438
|
+
function DrawerOverlay({ className, ...props }) {
|
|
1439
|
+
return /* @__PURE__ */ jsx(Drawer$1.Overlay, {
|
|
1440
|
+
"data-slot": "drawer-overlay",
|
|
1441
|
+
className: cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50", className),
|
|
1442
|
+
...props
|
|
1443
|
+
});
|
|
1444
|
+
}
|
|
1445
|
+
function DrawerContent({ className, children, ...props }) {
|
|
1446
|
+
return /* @__PURE__ */ jsxs(DrawerPortal, {
|
|
1447
|
+
"data-slot": "drawer-portal",
|
|
1448
|
+
children: [/* @__PURE__ */ jsx(DrawerOverlay, {}), /* @__PURE__ */ jsxs(Drawer$1.Content, {
|
|
1449
|
+
"data-slot": "drawer-content",
|
|
1450
|
+
className: cn("group/drawer-content bg-background fixed z-50 flex h-auto flex-col", "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-lg data-[vaul-drawer-direction=top]:border-b", "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-lg data-[vaul-drawer-direction=bottom]:border-t", "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]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm", "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]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm", className),
|
|
1451
|
+
...props,
|
|
1452
|
+
children: [/* @__PURE__ */ jsx("div", { className: "bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block" }), children]
|
|
1453
|
+
})]
|
|
1454
|
+
});
|
|
1455
|
+
}
|
|
1456
|
+
function DrawerHeader({ className, ...props }) {
|
|
1457
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1458
|
+
"data-slot": "drawer-header",
|
|
1459
|
+
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),
|
|
1460
|
+
...props
|
|
1461
|
+
});
|
|
1462
|
+
}
|
|
1463
|
+
function DrawerFooter({ className, ...props }) {
|
|
1464
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1465
|
+
"data-slot": "drawer-footer",
|
|
1466
|
+
className: cn("mt-auto flex flex-col gap-2 p-4", className),
|
|
1467
|
+
...props
|
|
1468
|
+
});
|
|
1469
|
+
}
|
|
1470
|
+
function DrawerTitle({ className, ...props }) {
|
|
1471
|
+
return /* @__PURE__ */ jsx(Drawer$1.Title, {
|
|
1472
|
+
"data-slot": "drawer-title",
|
|
1473
|
+
className: cn("text-foreground font-semibold", className),
|
|
1474
|
+
...props
|
|
1475
|
+
});
|
|
1476
|
+
}
|
|
1477
|
+
function DrawerDescription({ className, ...props }) {
|
|
1478
|
+
return /* @__PURE__ */ jsx(Drawer$1.Description, {
|
|
1479
|
+
"data-slot": "drawer-description",
|
|
1480
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
1481
|
+
...props
|
|
1482
|
+
});
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
//#endregion
|
|
1486
|
+
//#region src/components/base/dropdown-menu.tsx
|
|
1487
|
+
function DropdownMenu({ ...props }) {
|
|
1488
|
+
return /* @__PURE__ */ jsx(DropdownMenu$1.Root, {
|
|
1489
|
+
"data-slot": "dropdown-menu",
|
|
1490
|
+
...props
|
|
1491
|
+
});
|
|
1492
|
+
}
|
|
1493
|
+
function DropdownMenuPortal({ ...props }) {
|
|
1494
|
+
return /* @__PURE__ */ jsx(DropdownMenu$1.Portal, {
|
|
1495
|
+
"data-slot": "dropdown-menu-portal",
|
|
1496
|
+
...props
|
|
1497
|
+
});
|
|
1498
|
+
}
|
|
1499
|
+
function DropdownMenuTrigger({ ...props }) {
|
|
1500
|
+
return /* @__PURE__ */ jsx(DropdownMenu$1.Trigger, {
|
|
1501
|
+
"data-slot": "dropdown-menu-trigger",
|
|
1502
|
+
...props
|
|
1503
|
+
});
|
|
1504
|
+
}
|
|
1505
|
+
function DropdownMenuContent({ className, sideOffset = 4, ...props }) {
|
|
1506
|
+
return /* @__PURE__ */ jsx(DropdownMenu$1.Portal, { children: /* @__PURE__ */ jsx(DropdownMenu$1.Content, {
|
|
1507
|
+
"data-slot": "dropdown-menu-content",
|
|
1508
|
+
sideOffset,
|
|
1509
|
+
className: cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md", className),
|
|
1510
|
+
...props
|
|
1511
|
+
}) });
|
|
1512
|
+
}
|
|
1513
|
+
function DropdownMenuGroup({ ...props }) {
|
|
1514
|
+
return /* @__PURE__ */ jsx(DropdownMenu$1.Group, {
|
|
1515
|
+
"data-slot": "dropdown-menu-group",
|
|
1516
|
+
...props
|
|
1517
|
+
});
|
|
1518
|
+
}
|
|
1519
|
+
function DropdownMenuItem({ className, inset, variant = "default", ...props }) {
|
|
1520
|
+
return /* @__PURE__ */ jsx(DropdownMenu$1.Item, {
|
|
1521
|
+
"data-slot": "dropdown-menu-item",
|
|
1522
|
+
"data-inset": inset,
|
|
1523
|
+
"data-variant": variant,
|
|
1524
|
+
className: cn("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
1525
|
+
...props
|
|
1526
|
+
});
|
|
1527
|
+
}
|
|
1528
|
+
function DropdownMenuCheckboxItem({ className, children, checked, ...props }) {
|
|
1529
|
+
return /* @__PURE__ */ jsxs(DropdownMenu$1.CheckboxItem, {
|
|
1530
|
+
"data-slot": "dropdown-menu-checkbox-item",
|
|
1531
|
+
className: cn("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
1532
|
+
checked,
|
|
1533
|
+
...props,
|
|
1534
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1535
|
+
className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",
|
|
1536
|
+
children: /* @__PURE__ */ jsx(DropdownMenu$1.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4" }) })
|
|
1537
|
+
}), children]
|
|
1538
|
+
});
|
|
1539
|
+
}
|
|
1540
|
+
function DropdownMenuRadioGroup({ ...props }) {
|
|
1541
|
+
return /* @__PURE__ */ jsx(DropdownMenu$1.RadioGroup, {
|
|
1542
|
+
"data-slot": "dropdown-menu-radio-group",
|
|
1543
|
+
...props
|
|
1544
|
+
});
|
|
1545
|
+
}
|
|
1546
|
+
function DropdownMenuRadioItem({ className, children, ...props }) {
|
|
1547
|
+
return /* @__PURE__ */ jsxs(DropdownMenu$1.RadioItem, {
|
|
1548
|
+
"data-slot": "dropdown-menu-radio-item",
|
|
1549
|
+
className: cn("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
1550
|
+
...props,
|
|
1551
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1552
|
+
className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",
|
|
1553
|
+
children: /* @__PURE__ */ jsx(DropdownMenu$1.ItemIndicator, { children: /* @__PURE__ */ jsx(CircleIcon, { className: "size-2 fill-current" }) })
|
|
1554
|
+
}), children]
|
|
1555
|
+
});
|
|
1556
|
+
}
|
|
1557
|
+
function DropdownMenuLabel({ className, inset, ...props }) {
|
|
1558
|
+
return /* @__PURE__ */ jsx(DropdownMenu$1.Label, {
|
|
1559
|
+
"data-slot": "dropdown-menu-label",
|
|
1560
|
+
"data-inset": inset,
|
|
1561
|
+
className: cn("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", className),
|
|
1562
|
+
...props
|
|
1563
|
+
});
|
|
1564
|
+
}
|
|
1565
|
+
function DropdownMenuSeparator({ className, ...props }) {
|
|
1566
|
+
return /* @__PURE__ */ jsx(DropdownMenu$1.Separator, {
|
|
1567
|
+
"data-slot": "dropdown-menu-separator",
|
|
1568
|
+
className: cn("bg-border -mx-1 my-1 h-px", className),
|
|
1569
|
+
...props
|
|
1570
|
+
});
|
|
1571
|
+
}
|
|
1572
|
+
function DropdownMenuShortcut({ className, ...props }) {
|
|
1573
|
+
return /* @__PURE__ */ jsx("span", {
|
|
1574
|
+
"data-slot": "dropdown-menu-shortcut",
|
|
1575
|
+
className: cn("text-muted-foreground ml-auto text-xs tracking-widest", className),
|
|
1576
|
+
...props
|
|
1577
|
+
});
|
|
1578
|
+
}
|
|
1579
|
+
function DropdownMenuSub({ ...props }) {
|
|
1580
|
+
return /* @__PURE__ */ jsx(DropdownMenu$1.Sub, {
|
|
1581
|
+
"data-slot": "dropdown-menu-sub",
|
|
1582
|
+
...props
|
|
1583
|
+
});
|
|
1584
|
+
}
|
|
1585
|
+
function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
|
|
1586
|
+
return /* @__PURE__ */ jsxs(DropdownMenu$1.SubTrigger, {
|
|
1587
|
+
"data-slot": "dropdown-menu-sub-trigger",
|
|
1588
|
+
"data-inset": inset,
|
|
1589
|
+
className: cn("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
1590
|
+
...props,
|
|
1591
|
+
children: [children, /* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto size-4" })]
|
|
1592
|
+
});
|
|
1593
|
+
}
|
|
1594
|
+
function DropdownMenuSubContent({ className, ...props }) {
|
|
1595
|
+
return /* @__PURE__ */ jsx(DropdownMenu$1.SubContent, {
|
|
1596
|
+
"data-slot": "dropdown-menu-sub-content",
|
|
1597
|
+
className: cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg", className),
|
|
1598
|
+
...props
|
|
1599
|
+
});
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
//#endregion
|
|
1603
|
+
//#region src/components/base/empty.tsx
|
|
1604
|
+
function Empty({ className, ...props }) {
|
|
1605
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1606
|
+
"data-slot": "empty",
|
|
1607
|
+
className: cn("flex min-w-0 flex-1 flex-col items-center justify-center gap-6 rounded-lg border-dashed p-6 text-center text-balance md:p-12", className),
|
|
1608
|
+
...props
|
|
1609
|
+
});
|
|
1610
|
+
}
|
|
1611
|
+
function EmptyHeader({ className, ...props }) {
|
|
1612
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1613
|
+
"data-slot": "empty-header",
|
|
1614
|
+
className: cn("flex max-w-sm flex-col items-center gap-2 text-center", className),
|
|
1615
|
+
...props
|
|
1616
|
+
});
|
|
1617
|
+
}
|
|
1618
|
+
const emptyMediaVariants = cva("flex shrink-0 items-center justify-center mb-2 [&_svg]:pointer-events-none [&_svg]:shrink-0", {
|
|
1619
|
+
variants: { variant: {
|
|
1620
|
+
default: "bg-transparent",
|
|
1621
|
+
icon: "bg-muted text-foreground flex size-10 shrink-0 items-center justify-center rounded-lg [&_svg:not([class*='size-'])]:size-6"
|
|
1622
|
+
} },
|
|
1623
|
+
defaultVariants: { variant: "default" }
|
|
1624
|
+
});
|
|
1625
|
+
function EmptyMedia({ className, variant = "default", ...props }) {
|
|
1626
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1627
|
+
"data-slot": "empty-icon",
|
|
1628
|
+
"data-variant": variant,
|
|
1629
|
+
className: cn(emptyMediaVariants({
|
|
1630
|
+
variant,
|
|
1631
|
+
className
|
|
1632
|
+
})),
|
|
1633
|
+
...props
|
|
1634
|
+
});
|
|
1635
|
+
}
|
|
1636
|
+
function EmptyTitle({ className, ...props }) {
|
|
1637
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1638
|
+
"data-slot": "empty-title",
|
|
1639
|
+
className: cn("text-lg font-medium tracking-tight", className),
|
|
1640
|
+
...props
|
|
1641
|
+
});
|
|
1642
|
+
}
|
|
1643
|
+
function EmptyDescription({ className, ...props }) {
|
|
1644
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1645
|
+
"data-slot": "empty-description",
|
|
1646
|
+
className: cn("text-muted-foreground [&>a:hover]:text-primary text-sm/relaxed [&>a]:underline [&>a]:underline-offset-4", className),
|
|
1647
|
+
...props
|
|
1648
|
+
});
|
|
1649
|
+
}
|
|
1650
|
+
function EmptyContent({ className, ...props }) {
|
|
1651
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1652
|
+
"data-slot": "empty-content",
|
|
1653
|
+
className: cn("flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance", className),
|
|
1654
|
+
...props
|
|
1655
|
+
});
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
//#endregion
|
|
1659
|
+
//#region src/components/base/label.tsx
|
|
1660
|
+
function Label({ className, ...props }) {
|
|
1661
|
+
return /* @__PURE__ */ jsx(Label$1.Root, {
|
|
1662
|
+
"data-slot": "label",
|
|
1663
|
+
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),
|
|
1664
|
+
...props
|
|
1665
|
+
});
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
//#endregion
|
|
1669
|
+
//#region src/components/base/field.tsx
|
|
1670
|
+
function FieldSet({ className, ...props }) {
|
|
1671
|
+
return /* @__PURE__ */ jsx("fieldset", {
|
|
1672
|
+
"data-slot": "field-set",
|
|
1673
|
+
className: cn("flex flex-col gap-6", "has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3", className),
|
|
1674
|
+
...props
|
|
1675
|
+
});
|
|
1676
|
+
}
|
|
1677
|
+
function FieldLegend({ className, variant = "legend", ...props }) {
|
|
1678
|
+
return /* @__PURE__ */ jsx("legend", {
|
|
1679
|
+
"data-slot": "field-legend",
|
|
1680
|
+
"data-variant": variant,
|
|
1681
|
+
className: cn("mb-3 font-medium", "data-[variant=legend]:text-base", "data-[variant=label]:text-sm", className),
|
|
1682
|
+
...props
|
|
1683
|
+
});
|
|
1684
|
+
}
|
|
1685
|
+
function FieldGroup({ className, ...props }) {
|
|
1686
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1687
|
+
"data-slot": "field-group",
|
|
1688
|
+
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),
|
|
1689
|
+
...props
|
|
1690
|
+
});
|
|
1691
|
+
}
|
|
1692
|
+
const fieldVariants = cva("group/field flex w-full gap-3 data-[invalid=true]:text-destructive", {
|
|
1693
|
+
variants: { orientation: {
|
|
1694
|
+
vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],
|
|
1695
|
+
horizontal: [
|
|
1696
|
+
"flex-row items-center",
|
|
1697
|
+
"[&>[data-slot=field-label]]:flex-auto",
|
|
1698
|
+
"has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
1699
|
+
],
|
|
1700
|
+
responsive: [
|
|
1701
|
+
"flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto",
|
|
1702
|
+
"@md/field-group:[&>[data-slot=field-label]]:flex-auto",
|
|
1703
|
+
"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
1704
|
+
]
|
|
1705
|
+
} },
|
|
1706
|
+
defaultVariants: { orientation: "vertical" }
|
|
1707
|
+
});
|
|
1708
|
+
function Field({ className, orientation = "vertical", ...props }) {
|
|
1709
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1710
|
+
role: "group",
|
|
1711
|
+
"data-slot": "field",
|
|
1712
|
+
"data-orientation": orientation,
|
|
1713
|
+
className: cn(fieldVariants({ orientation }), className),
|
|
1714
|
+
...props
|
|
1715
|
+
});
|
|
1716
|
+
}
|
|
1717
|
+
function FieldContent({ className, ...props }) {
|
|
1718
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1719
|
+
"data-slot": "field-content",
|
|
1720
|
+
className: cn("group/field-content flex flex-1 flex-col gap-1.5 leading-snug", className),
|
|
1721
|
+
...props
|
|
1722
|
+
});
|
|
1723
|
+
}
|
|
1724
|
+
function FieldLabel({ className, ...props }) {
|
|
1725
|
+
return /* @__PURE__ */ jsx(Label, {
|
|
1726
|
+
"data-slot": "field-label",
|
|
1727
|
+
className: cn("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50", "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4", "has-data-[state=checked]:bg-primary/5 has-data-[state=checked]:border-primary dark:has-data-[state=checked]:bg-primary/10", className),
|
|
1728
|
+
...props
|
|
1729
|
+
});
|
|
1730
|
+
}
|
|
1731
|
+
function FieldTitle({ className, ...props }) {
|
|
1732
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1733
|
+
"data-slot": "field-label",
|
|
1734
|
+
className: cn("flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50", className),
|
|
1735
|
+
...props
|
|
1736
|
+
});
|
|
1737
|
+
}
|
|
1738
|
+
function FieldDescription({ className, ...props }) {
|
|
1739
|
+
return /* @__PURE__ */ jsx("p", {
|
|
1740
|
+
"data-slot": "field-description",
|
|
1741
|
+
className: cn("text-muted-foreground text-sm leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance", "last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5", "[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4", className),
|
|
1742
|
+
...props
|
|
1743
|
+
});
|
|
1744
|
+
}
|
|
1745
|
+
function FieldSeparator({ children, className, ...props }) {
|
|
1746
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1747
|
+
"data-slot": "field-separator",
|
|
1748
|
+
"data-content": !!children,
|
|
1749
|
+
className: cn("relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2", className),
|
|
1750
|
+
...props,
|
|
1751
|
+
children: [/* @__PURE__ */ jsx(Separator, { className: "absolute inset-0 top-1/2" }), children && /* @__PURE__ */ jsx("span", {
|
|
1752
|
+
className: "bg-background text-muted-foreground relative mx-auto block w-fit px-2",
|
|
1753
|
+
"data-slot": "field-separator-content",
|
|
1754
|
+
children
|
|
1755
|
+
})]
|
|
1756
|
+
});
|
|
1757
|
+
}
|
|
1758
|
+
function FieldError({ className, children, errors, ...props }) {
|
|
1759
|
+
const content = useMemo(() => {
|
|
1760
|
+
if (children) return children;
|
|
1761
|
+
if (!errors?.length) return null;
|
|
1762
|
+
const uniqueErrors = [...new Map(errors.map((error) => [error?.message, error])).values()];
|
|
1763
|
+
if (uniqueErrors?.length == 1) return uniqueErrors[0]?.message;
|
|
1764
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
1765
|
+
className: "ml-4 flex list-disc flex-col gap-1",
|
|
1766
|
+
children: uniqueErrors.map((error, index) => error?.message && /* @__PURE__ */ jsx("li", { children: error.message }, index))
|
|
1767
|
+
});
|
|
1768
|
+
}, [children, errors]);
|
|
1769
|
+
if (!content) return null;
|
|
1770
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1771
|
+
role: "alert",
|
|
1772
|
+
"data-slot": "field-error",
|
|
1773
|
+
className: cn("text-destructive text-sm font-normal", className),
|
|
1774
|
+
...props,
|
|
1775
|
+
children: content
|
|
1776
|
+
});
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
//#endregion
|
|
1780
|
+
//#region src/components/base/hover-card.tsx
|
|
1781
|
+
function HoverCard({ ...props }) {
|
|
1782
|
+
return /* @__PURE__ */ jsx(HoverCard$1.Root, {
|
|
1783
|
+
"data-slot": "hover-card",
|
|
1784
|
+
...props
|
|
1785
|
+
});
|
|
1786
|
+
}
|
|
1787
|
+
function HoverCardTrigger({ ...props }) {
|
|
1788
|
+
return /* @__PURE__ */ jsx(HoverCard$1.Trigger, {
|
|
1789
|
+
"data-slot": "hover-card-trigger",
|
|
1790
|
+
...props
|
|
1791
|
+
});
|
|
1792
|
+
}
|
|
1793
|
+
function HoverCardContent({ className, align = "center", sideOffset = 4, ...props }) {
|
|
1794
|
+
return /* @__PURE__ */ jsx(HoverCard$1.Portal, {
|
|
1795
|
+
"data-slot": "hover-card-portal",
|
|
1796
|
+
children: /* @__PURE__ */ jsx(HoverCard$1.Content, {
|
|
1797
|
+
"data-slot": "hover-card-content",
|
|
1798
|
+
align,
|
|
1799
|
+
sideOffset,
|
|
1800
|
+
className: cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden", className),
|
|
1801
|
+
...props
|
|
1802
|
+
})
|
|
1803
|
+
});
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
//#endregion
|
|
1807
|
+
//#region src/components/base/input-otp.tsx
|
|
1808
|
+
function InputOTP({ className, containerClassName, ...props }) {
|
|
1809
|
+
return /* @__PURE__ */ jsx(OTPInput, {
|
|
1810
|
+
"data-slot": "input-otp",
|
|
1811
|
+
containerClassName: cn("flex items-center gap-2 has-disabled:opacity-50", containerClassName),
|
|
1812
|
+
className: cn("disabled:cursor-not-allowed", className),
|
|
1813
|
+
...props
|
|
1814
|
+
});
|
|
1815
|
+
}
|
|
1816
|
+
function InputOTPGroup({ className, ...props }) {
|
|
1817
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1818
|
+
"data-slot": "input-otp-group",
|
|
1819
|
+
className: cn("flex items-center", className),
|
|
1820
|
+
...props
|
|
1821
|
+
});
|
|
1822
|
+
}
|
|
1823
|
+
function InputOTPSlot({ index, className, ...props }) {
|
|
1824
|
+
const { char, hasFakeCaret, isActive } = React.useContext(OTPInputContext)?.slots[index] ?? {};
|
|
1825
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1826
|
+
"data-slot": "input-otp-slot",
|
|
1827
|
+
"data-active": isActive,
|
|
1828
|
+
className: cn("data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]", className),
|
|
1829
|
+
...props,
|
|
1830
|
+
children: [char, hasFakeCaret && /* @__PURE__ */ jsx("div", {
|
|
1831
|
+
className: "pointer-events-none absolute inset-0 flex items-center justify-center",
|
|
1832
|
+
children: /* @__PURE__ */ jsx("div", { className: "animate-caret-blink bg-foreground h-4 w-px duration-1000" })
|
|
1833
|
+
})]
|
|
1834
|
+
});
|
|
1835
|
+
}
|
|
1836
|
+
function InputOTPSeparator({ ...props }) {
|
|
1837
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1838
|
+
"data-slot": "input-otp-separator",
|
|
1839
|
+
role: "separator",
|
|
1840
|
+
...props,
|
|
1841
|
+
children: /* @__PURE__ */ jsx(MinusIcon, {})
|
|
1842
|
+
});
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1845
|
+
//#endregion
|
|
1846
|
+
//#region src/components/base/item.tsx
|
|
1847
|
+
function ItemGroup({ className, ...props }) {
|
|
1848
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1849
|
+
role: "list",
|
|
1850
|
+
"data-slot": "item-group",
|
|
1851
|
+
className: cn("group/item-group flex flex-col", className),
|
|
1852
|
+
...props
|
|
1853
|
+
});
|
|
1854
|
+
}
|
|
1855
|
+
function ItemSeparator({ className, ...props }) {
|
|
1856
|
+
return /* @__PURE__ */ jsx(Separator, {
|
|
1857
|
+
"data-slot": "item-separator",
|
|
1858
|
+
orientation: "horizontal",
|
|
1859
|
+
className: cn("my-0", className),
|
|
1860
|
+
...props
|
|
1861
|
+
});
|
|
1862
|
+
}
|
|
1863
|
+
const itemVariants = cva("group/item flex items-center border border-transparent text-sm rounded-md transition-colors [a]:hover:bg-accent/50 [a]:transition-colors duration-100 flex-wrap outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]", {
|
|
1864
|
+
variants: {
|
|
1865
|
+
variant: {
|
|
1866
|
+
default: "bg-transparent",
|
|
1867
|
+
outline: "border-border",
|
|
1868
|
+
muted: "bg-muted/50"
|
|
1869
|
+
},
|
|
1870
|
+
size: {
|
|
1871
|
+
default: "p-4 gap-4 ",
|
|
1872
|
+
sm: "py-3 px-4 gap-2.5"
|
|
1873
|
+
}
|
|
1874
|
+
},
|
|
1875
|
+
defaultVariants: {
|
|
1876
|
+
variant: "default",
|
|
1877
|
+
size: "default"
|
|
1878
|
+
}
|
|
1879
|
+
});
|
|
1880
|
+
function Item({ className, variant = "default", size = "default", asChild = false, ...props }) {
|
|
1881
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "div", {
|
|
1882
|
+
"data-slot": "item",
|
|
1883
|
+
"data-variant": variant,
|
|
1884
|
+
"data-size": size,
|
|
1885
|
+
className: cn(itemVariants({
|
|
1886
|
+
variant,
|
|
1887
|
+
size,
|
|
1888
|
+
className
|
|
1889
|
+
})),
|
|
1890
|
+
...props
|
|
1891
|
+
});
|
|
1892
|
+
}
|
|
1893
|
+
const itemMediaVariants = cva("flex shrink-0 items-center justify-center gap-2 group-has-[[data-slot=item-description]]/item:self-start [&_svg]:pointer-events-none group-has-[[data-slot=item-description]]/item:translate-y-0.5", {
|
|
1894
|
+
variants: { variant: {
|
|
1895
|
+
default: "bg-transparent",
|
|
1896
|
+
icon: "size-8 border rounded-sm bg-muted [&_svg:not([class*='size-'])]:size-4",
|
|
1897
|
+
image: "size-10 rounded-sm overflow-hidden [&_img]:size-full [&_img]:object-cover"
|
|
1898
|
+
} },
|
|
1899
|
+
defaultVariants: { variant: "default" }
|
|
1900
|
+
});
|
|
1901
|
+
function ItemMedia({ className, variant = "default", ...props }) {
|
|
1902
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1903
|
+
"data-slot": "item-media",
|
|
1904
|
+
"data-variant": variant,
|
|
1905
|
+
className: cn(itemMediaVariants({
|
|
1906
|
+
variant,
|
|
1907
|
+
className
|
|
1908
|
+
})),
|
|
1909
|
+
...props
|
|
1910
|
+
});
|
|
1911
|
+
}
|
|
1912
|
+
function ItemContent({ className, ...props }) {
|
|
1913
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1914
|
+
"data-slot": "item-content",
|
|
1915
|
+
className: cn("flex flex-1 flex-col gap-1 [&+[data-slot=item-content]]:flex-none", className),
|
|
1916
|
+
...props
|
|
1917
|
+
});
|
|
1918
|
+
}
|
|
1919
|
+
function ItemTitle({ className, ...props }) {
|
|
1920
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1921
|
+
"data-slot": "item-title",
|
|
1922
|
+
className: cn("flex w-fit items-center gap-2 text-sm leading-snug font-medium", className),
|
|
1923
|
+
...props
|
|
1924
|
+
});
|
|
1925
|
+
}
|
|
1926
|
+
function ItemDescription({ className, ...props }) {
|
|
1927
|
+
return /* @__PURE__ */ jsx("p", {
|
|
1928
|
+
"data-slot": "item-description",
|
|
1929
|
+
className: cn("text-muted-foreground line-clamp-2 text-sm leading-normal font-normal text-balance", "[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4", className),
|
|
1930
|
+
...props
|
|
1931
|
+
});
|
|
1932
|
+
}
|
|
1933
|
+
function ItemActions({ className, ...props }) {
|
|
1934
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1935
|
+
"data-slot": "item-actions",
|
|
1936
|
+
className: cn("flex items-center gap-2", className),
|
|
1937
|
+
...props
|
|
1938
|
+
});
|
|
1939
|
+
}
|
|
1940
|
+
function ItemHeader({ className, ...props }) {
|
|
1941
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1942
|
+
"data-slot": "item-header",
|
|
1943
|
+
className: cn("flex basis-full items-center justify-between gap-2", className),
|
|
1944
|
+
...props
|
|
1945
|
+
});
|
|
1946
|
+
}
|
|
1947
|
+
function ItemFooter({ className, ...props }) {
|
|
1948
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1949
|
+
"data-slot": "item-footer",
|
|
1950
|
+
className: cn("flex basis-full items-center justify-between gap-2", className),
|
|
1951
|
+
...props
|
|
1952
|
+
});
|
|
1953
|
+
}
|
|
1954
|
+
|
|
1955
|
+
//#endregion
|
|
1956
|
+
//#region src/components/base/kbd.tsx
|
|
1957
|
+
function Kbd({ className, ...props }) {
|
|
1958
|
+
return /* @__PURE__ */ jsx("kbd", {
|
|
1959
|
+
"data-slot": "kbd",
|
|
1960
|
+
className: cn("bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none", "[&_svg:not([class*='size-'])]:size-3", "[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10", className),
|
|
1961
|
+
...props
|
|
1962
|
+
});
|
|
1963
|
+
}
|
|
1964
|
+
function KbdGroup({ className, ...props }) {
|
|
1965
|
+
return /* @__PURE__ */ jsx("kbd", {
|
|
1966
|
+
"data-slot": "kbd-group",
|
|
1967
|
+
className: cn("inline-flex items-center gap-1", className),
|
|
1968
|
+
...props
|
|
1969
|
+
});
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1972
|
+
//#endregion
|
|
1973
|
+
//#region src/components/base/menubar.tsx
|
|
1974
|
+
function Menubar({ className, ...props }) {
|
|
1975
|
+
return /* @__PURE__ */ jsx(Menubar$1.Root, {
|
|
1976
|
+
"data-slot": "menubar",
|
|
1977
|
+
className: cn("bg-background flex h-9 items-center gap-1 rounded-md border p-1 shadow-xs", className),
|
|
1978
|
+
...props
|
|
1979
|
+
});
|
|
1980
|
+
}
|
|
1981
|
+
function MenubarMenu({ ...props }) {
|
|
1982
|
+
return /* @__PURE__ */ jsx(Menubar$1.Menu, {
|
|
1983
|
+
"data-slot": "menubar-menu",
|
|
1984
|
+
...props
|
|
1985
|
+
});
|
|
1986
|
+
}
|
|
1987
|
+
function MenubarGroup({ ...props }) {
|
|
1988
|
+
return /* @__PURE__ */ jsx(Menubar$1.Group, {
|
|
1989
|
+
"data-slot": "menubar-group",
|
|
1990
|
+
...props
|
|
1991
|
+
});
|
|
1992
|
+
}
|
|
1993
|
+
function MenubarPortal({ ...props }) {
|
|
1994
|
+
return /* @__PURE__ */ jsx(Menubar$1.Portal, {
|
|
1995
|
+
"data-slot": "menubar-portal",
|
|
1996
|
+
...props
|
|
1997
|
+
});
|
|
1998
|
+
}
|
|
1999
|
+
function MenubarRadioGroup({ ...props }) {
|
|
2000
|
+
return /* @__PURE__ */ jsx(Menubar$1.RadioGroup, {
|
|
2001
|
+
"data-slot": "menubar-radio-group",
|
|
2002
|
+
...props
|
|
2003
|
+
});
|
|
2004
|
+
}
|
|
2005
|
+
function MenubarTrigger({ className, ...props }) {
|
|
2006
|
+
return /* @__PURE__ */ jsx(Menubar$1.Trigger, {
|
|
2007
|
+
"data-slot": "menubar-trigger",
|
|
2008
|
+
className: cn("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex items-center rounded-sm px-2 py-1 text-sm font-medium outline-hidden select-none", className),
|
|
2009
|
+
...props
|
|
2010
|
+
});
|
|
2011
|
+
}
|
|
2012
|
+
function MenubarContent({ className, align = "start", alignOffset = -4, sideOffset = 8, ...props }) {
|
|
2013
|
+
return /* @__PURE__ */ jsx(MenubarPortal, { children: /* @__PURE__ */ jsx(Menubar$1.Content, {
|
|
2014
|
+
"data-slot": "menubar-content",
|
|
2015
|
+
align,
|
|
2016
|
+
alignOffset,
|
|
2017
|
+
sideOffset,
|
|
2018
|
+
className: cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[12rem] origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-md", className),
|
|
2019
|
+
...props
|
|
2020
|
+
}) });
|
|
2021
|
+
}
|
|
2022
|
+
function MenubarItem({ className, inset, variant = "default", ...props }) {
|
|
2023
|
+
return /* @__PURE__ */ jsx(Menubar$1.Item, {
|
|
2024
|
+
"data-slot": "menubar-item",
|
|
2025
|
+
"data-inset": inset,
|
|
2026
|
+
"data-variant": variant,
|
|
2027
|
+
className: cn("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
2028
|
+
...props
|
|
2029
|
+
});
|
|
2030
|
+
}
|
|
2031
|
+
function MenubarCheckboxItem({ className, children, checked, ...props }) {
|
|
2032
|
+
return /* @__PURE__ */ jsxs(Menubar$1.CheckboxItem, {
|
|
2033
|
+
"data-slot": "menubar-checkbox-item",
|
|
2034
|
+
className: cn("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-xs py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
2035
|
+
checked,
|
|
2036
|
+
...props,
|
|
2037
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
2038
|
+
className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",
|
|
2039
|
+
children: /* @__PURE__ */ jsx(Menubar$1.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4" }) })
|
|
2040
|
+
}), children]
|
|
2041
|
+
});
|
|
2042
|
+
}
|
|
2043
|
+
function MenubarRadioItem({ className, children, ...props }) {
|
|
2044
|
+
return /* @__PURE__ */ jsxs(Menubar$1.RadioItem, {
|
|
2045
|
+
"data-slot": "menubar-radio-item",
|
|
2046
|
+
className: cn("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-xs py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
2047
|
+
...props,
|
|
2048
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
2049
|
+
className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",
|
|
2050
|
+
children: /* @__PURE__ */ jsx(Menubar$1.ItemIndicator, { children: /* @__PURE__ */ jsx(CircleIcon, { className: "size-2 fill-current" }) })
|
|
2051
|
+
}), children]
|
|
2052
|
+
});
|
|
2053
|
+
}
|
|
2054
|
+
function MenubarLabel({ className, inset, ...props }) {
|
|
2055
|
+
return /* @__PURE__ */ jsx(Menubar$1.Label, {
|
|
2056
|
+
"data-slot": "menubar-label",
|
|
2057
|
+
"data-inset": inset,
|
|
2058
|
+
className: cn("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", className),
|
|
2059
|
+
...props
|
|
2060
|
+
});
|
|
2061
|
+
}
|
|
2062
|
+
function MenubarSeparator({ className, ...props }) {
|
|
2063
|
+
return /* @__PURE__ */ jsx(Menubar$1.Separator, {
|
|
2064
|
+
"data-slot": "menubar-separator",
|
|
2065
|
+
className: cn("bg-border -mx-1 my-1 h-px", className),
|
|
2066
|
+
...props
|
|
2067
|
+
});
|
|
2068
|
+
}
|
|
2069
|
+
function MenubarShortcut({ className, ...props }) {
|
|
2070
|
+
return /* @__PURE__ */ jsx("span", {
|
|
2071
|
+
"data-slot": "menubar-shortcut",
|
|
2072
|
+
className: cn("text-muted-foreground ml-auto text-xs tracking-widest", className),
|
|
2073
|
+
...props
|
|
2074
|
+
});
|
|
2075
|
+
}
|
|
2076
|
+
function MenubarSub({ ...props }) {
|
|
2077
|
+
return /* @__PURE__ */ jsx(Menubar$1.Sub, {
|
|
2078
|
+
"data-slot": "menubar-sub",
|
|
2079
|
+
...props
|
|
2080
|
+
});
|
|
2081
|
+
}
|
|
2082
|
+
function MenubarSubTrigger({ className, inset, children, ...props }) {
|
|
2083
|
+
return /* @__PURE__ */ jsxs(Menubar$1.SubTrigger, {
|
|
2084
|
+
"data-slot": "menubar-sub-trigger",
|
|
2085
|
+
"data-inset": inset,
|
|
2086
|
+
className: cn("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[inset]:pl-8", className),
|
|
2087
|
+
...props,
|
|
2088
|
+
children: [children, /* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto h-4 w-4" })]
|
|
2089
|
+
});
|
|
2090
|
+
}
|
|
2091
|
+
function MenubarSubContent({ className, ...props }) {
|
|
2092
|
+
return /* @__PURE__ */ jsx(Menubar$1.SubContent, {
|
|
2093
|
+
"data-slot": "menubar-sub-content",
|
|
2094
|
+
className: cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg", className),
|
|
2095
|
+
...props
|
|
2096
|
+
});
|
|
2097
|
+
}
|
|
2098
|
+
|
|
2099
|
+
//#endregion
|
|
2100
|
+
//#region src/components/base/multiselect.tsx
|
|
2101
|
+
function useDebounce(value, delay) {
|
|
2102
|
+
const [debouncedValue, setDebouncedValue] = React.useState(value);
|
|
2103
|
+
useEffect(() => {
|
|
2104
|
+
const timer = setTimeout(() => setDebouncedValue(value), delay || 500);
|
|
2105
|
+
return () => {
|
|
2106
|
+
clearTimeout(timer);
|
|
2107
|
+
};
|
|
2108
|
+
}, [value, delay]);
|
|
2109
|
+
return debouncedValue;
|
|
2110
|
+
}
|
|
2111
|
+
function transToGroupOption(options, groupBy) {
|
|
2112
|
+
if (options.length === 0) return {};
|
|
2113
|
+
if (!groupBy) return { "": options };
|
|
2114
|
+
const groupOption = {};
|
|
2115
|
+
options.forEach((option) => {
|
|
2116
|
+
const key = option[groupBy] || "";
|
|
2117
|
+
if (!groupOption[key]) groupOption[key] = [];
|
|
2118
|
+
groupOption[key].push(option);
|
|
2119
|
+
});
|
|
2120
|
+
return groupOption;
|
|
2121
|
+
}
|
|
2122
|
+
function removePickedOption(groupOption, picked) {
|
|
2123
|
+
const cloneOption = JSON.parse(JSON.stringify(groupOption));
|
|
2124
|
+
for (const [key, value] of Object.entries(cloneOption)) cloneOption[key] = value.filter((val) => !picked.find((p) => p.value === val.value));
|
|
2125
|
+
return cloneOption;
|
|
2126
|
+
}
|
|
2127
|
+
function isOptionsExist(groupOption, targetOption) {
|
|
2128
|
+
for (const [, value] of Object.entries(groupOption)) if (value.some((option) => targetOption.find((p) => p.value === option.value))) return true;
|
|
2129
|
+
return false;
|
|
2130
|
+
}
|
|
2131
|
+
/**
|
|
2132
|
+
* The `CommandEmpty` of shadcn/ui will cause the cmdk empty not rendering correctly.
|
|
2133
|
+
* So we create one and copy the `Empty` implementation from `cmdk`.
|
|
2134
|
+
*
|
|
2135
|
+
* @reference: https://github.com/hsuanyi-chou/shadcn-ui-expansions/issues/34#issuecomment-1949561607
|
|
2136
|
+
**/
|
|
2137
|
+
const CommandEmpty$1 = forwardRef(({ className, ...props }, forwardedRef) => {
|
|
2138
|
+
if (!useCommandState((state) => state.filtered.count === 0)) return null;
|
|
2139
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2140
|
+
ref: forwardedRef,
|
|
2141
|
+
className: cn("px-2 py-4 text-center text-sm", className),
|
|
2142
|
+
"cmdk-empty": "",
|
|
2143
|
+
role: "presentation",
|
|
2144
|
+
...props
|
|
2145
|
+
});
|
|
2146
|
+
});
|
|
2147
|
+
CommandEmpty$1.displayName = "CommandEmpty";
|
|
2148
|
+
const MultipleSelector = React.forwardRef(({ value, onChange, placeholder, defaultOptions: arrayDefaultOptions = [], options: arrayOptions, delay, onSearch, onSearchSync, loadingIndicator, emptyIndicator, maxSelected = Number.MAX_SAFE_INTEGER, onMaxSelected, hidePlaceholderWhenSelected, disabled, groupBy, className, badgeClassName, selectFirstItem = true, creatable = false, triggerSearchOnFocus = false, commandProps, inputProps, hideClearAllButton = false }, ref) => {
|
|
2149
|
+
const inputRef = React.useRef(null);
|
|
2150
|
+
const [open, setOpen] = React.useState(false);
|
|
2151
|
+
const [onScrollbar, setOnScrollbar] = React.useState(false);
|
|
2152
|
+
const [isLoading, setIsLoading] = React.useState(false);
|
|
2153
|
+
const dropdownRef = React.useRef(null);
|
|
2154
|
+
const [selected, setSelected] = React.useState(value || []);
|
|
2155
|
+
const [options, setOptions] = React.useState(transToGroupOption(arrayDefaultOptions, groupBy));
|
|
2156
|
+
const [inputValue, setInputValue] = React.useState("");
|
|
2157
|
+
const debouncedSearchTerm = useDebounce(inputValue, delay || 500);
|
|
2158
|
+
React.useImperativeHandle(ref, () => ({
|
|
2159
|
+
selectedValue: [...selected],
|
|
2160
|
+
input: inputRef.current,
|
|
2161
|
+
focus: () => inputRef?.current?.focus(),
|
|
2162
|
+
reset: () => setSelected([])
|
|
2163
|
+
}), [selected]);
|
|
2164
|
+
const handleClickOutside = (event) => {
|
|
2165
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target) && inputRef.current && !inputRef.current.contains(event.target)) {
|
|
2166
|
+
setOpen(false);
|
|
2167
|
+
inputRef.current.blur();
|
|
2168
|
+
}
|
|
2169
|
+
};
|
|
2170
|
+
const handleUnselect = React.useCallback((option) => {
|
|
2171
|
+
const newOptions = selected.filter((s) => s.value !== option.value);
|
|
2172
|
+
setSelected(newOptions);
|
|
2173
|
+
onChange?.(newOptions);
|
|
2174
|
+
}, [onChange, selected]);
|
|
2175
|
+
const handleKeyDown = React.useCallback((e) => {
|
|
2176
|
+
const input = inputRef.current;
|
|
2177
|
+
if (input) {
|
|
2178
|
+
if (e.key === "Delete" || e.key === "Backspace") {
|
|
2179
|
+
if (input.value === "" && selected.length > 0) {
|
|
2180
|
+
const lastSelectOption = selected[selected.length - 1];
|
|
2181
|
+
if (lastSelectOption && !lastSelectOption.fixed) handleUnselect(lastSelectOption);
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
if (e.key === "Escape") input.blur();
|
|
2185
|
+
}
|
|
2186
|
+
}, [handleUnselect, selected]);
|
|
2187
|
+
useEffect(() => {
|
|
2188
|
+
if (open) {
|
|
2189
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
2190
|
+
document.addEventListener("touchend", handleClickOutside);
|
|
2191
|
+
} else {
|
|
2192
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
2193
|
+
document.removeEventListener("touchend", handleClickOutside);
|
|
2194
|
+
}
|
|
2195
|
+
return () => {
|
|
2196
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
2197
|
+
document.removeEventListener("touchend", handleClickOutside);
|
|
2198
|
+
};
|
|
2199
|
+
}, [open]);
|
|
2200
|
+
useEffect(() => {
|
|
2201
|
+
if (value) setSelected(value);
|
|
2202
|
+
}, [value]);
|
|
2203
|
+
useEffect(() => {
|
|
2204
|
+
/** If `onSearch` is provided, do not trigger options updated. */
|
|
2205
|
+
if (!arrayOptions || onSearch) return;
|
|
2206
|
+
const newOption = transToGroupOption(arrayOptions || [], groupBy);
|
|
2207
|
+
if (JSON.stringify(newOption) !== JSON.stringify(options)) setOptions(newOption);
|
|
2208
|
+
}, [
|
|
2209
|
+
arrayDefaultOptions,
|
|
2210
|
+
arrayOptions,
|
|
2211
|
+
groupBy,
|
|
2212
|
+
onSearch,
|
|
2213
|
+
options
|
|
2214
|
+
]);
|
|
2215
|
+
useEffect(() => {
|
|
2216
|
+
/** sync search */
|
|
2217
|
+
const doSearchSync = () => {
|
|
2218
|
+
const res = onSearchSync?.(debouncedSearchTerm);
|
|
2219
|
+
setOptions(transToGroupOption(res || [], groupBy));
|
|
2220
|
+
};
|
|
2221
|
+
const exec = async () => {
|
|
2222
|
+
if (!onSearchSync || !open) return;
|
|
2223
|
+
if (triggerSearchOnFocus) doSearchSync();
|
|
2224
|
+
if (debouncedSearchTerm) doSearchSync();
|
|
2225
|
+
};
|
|
2226
|
+
exec();
|
|
2227
|
+
}, [
|
|
2228
|
+
debouncedSearchTerm,
|
|
2229
|
+
groupBy,
|
|
2230
|
+
open,
|
|
2231
|
+
triggerSearchOnFocus
|
|
2232
|
+
]);
|
|
2233
|
+
useEffect(() => {
|
|
2234
|
+
/** async search */
|
|
2235
|
+
const doSearch = async () => {
|
|
2236
|
+
setIsLoading(true);
|
|
2237
|
+
setOptions(transToGroupOption(await onSearch?.(debouncedSearchTerm) || [], groupBy));
|
|
2238
|
+
setIsLoading(false);
|
|
2239
|
+
};
|
|
2240
|
+
const exec = async () => {
|
|
2241
|
+
if (!onSearch || !open) return;
|
|
2242
|
+
if (triggerSearchOnFocus) await doSearch();
|
|
2243
|
+
if (debouncedSearchTerm) await doSearch();
|
|
2244
|
+
};
|
|
2245
|
+
exec();
|
|
2246
|
+
}, [
|
|
2247
|
+
debouncedSearchTerm,
|
|
2248
|
+
groupBy,
|
|
2249
|
+
open,
|
|
2250
|
+
triggerSearchOnFocus
|
|
2251
|
+
]);
|
|
2252
|
+
const CreatableItem = () => {
|
|
2253
|
+
if (!creatable) return void 0;
|
|
2254
|
+
if (isOptionsExist(options, [{
|
|
2255
|
+
value: inputValue,
|
|
2256
|
+
label: inputValue
|
|
2257
|
+
}]) || selected.find((s) => s.value === inputValue)) return;
|
|
2258
|
+
const Item = /* @__PURE__ */ jsx(CommandItem, {
|
|
2259
|
+
value: inputValue,
|
|
2260
|
+
className: "cursor-pointe mx-1 mb-1",
|
|
2261
|
+
onMouseDown: (e) => {
|
|
2262
|
+
e.preventDefault();
|
|
2263
|
+
e.stopPropagation();
|
|
2264
|
+
},
|
|
2265
|
+
onSelect: (value) => {
|
|
2266
|
+
if (selected.length >= maxSelected) {
|
|
2267
|
+
onMaxSelected?.(selected.length);
|
|
2268
|
+
return;
|
|
2269
|
+
}
|
|
2270
|
+
setInputValue("");
|
|
2271
|
+
const newOptions = [...selected, {
|
|
2272
|
+
value,
|
|
2273
|
+
label: value
|
|
2274
|
+
}];
|
|
2275
|
+
setSelected(newOptions);
|
|
2276
|
+
onChange?.(newOptions);
|
|
2277
|
+
},
|
|
2278
|
+
children: `Create "${inputValue}"`
|
|
2279
|
+
});
|
|
2280
|
+
if (!onSearch && inputValue.length > 0) return Item;
|
|
2281
|
+
if (onSearch && debouncedSearchTerm.length > 0 && !isLoading) return Item;
|
|
2282
|
+
};
|
|
2283
|
+
const EmptyItem = React.useCallback(() => {
|
|
2284
|
+
if (!emptyIndicator) return void 0;
|
|
2285
|
+
if (onSearch && !creatable && Object.keys(options).length === 0) return /* @__PURE__ */ jsx(CommandItem, {
|
|
2286
|
+
value: "-",
|
|
2287
|
+
disabled: true,
|
|
2288
|
+
children: emptyIndicator
|
|
2289
|
+
});
|
|
2290
|
+
return /* @__PURE__ */ jsx(CommandEmpty$1, { children: emptyIndicator });
|
|
2291
|
+
}, [
|
|
2292
|
+
creatable,
|
|
2293
|
+
emptyIndicator,
|
|
2294
|
+
onSearch,
|
|
2295
|
+
options
|
|
2296
|
+
]);
|
|
2297
|
+
const selectables = React.useMemo(() => removePickedOption(options, selected), [options, selected]);
|
|
2298
|
+
/** Avoid Creatable Selector freezing or lagging when paste a long string. */
|
|
2299
|
+
const commandFilter = React.useCallback(() => {
|
|
2300
|
+
if (commandProps?.filter) return commandProps.filter;
|
|
2301
|
+
if (creatable) return (value, search) => {
|
|
2302
|
+
return value.toLowerCase().includes(search.toLowerCase()) ? 1 : -1;
|
|
2303
|
+
};
|
|
2304
|
+
}, [creatable, commandProps?.filter]);
|
|
2305
|
+
return /* @__PURE__ */ jsxs(Command, {
|
|
2306
|
+
ref: dropdownRef,
|
|
2307
|
+
...commandProps,
|
|
2308
|
+
onKeyDown: (e) => {
|
|
2309
|
+
handleKeyDown(e);
|
|
2310
|
+
commandProps?.onKeyDown?.(e);
|
|
2311
|
+
},
|
|
2312
|
+
className: cn("h-auto overflow-visible bg-transparent", commandProps?.className),
|
|
2313
|
+
shouldFilter: commandProps?.shouldFilter !== void 0 ? commandProps.shouldFilter : !onSearch,
|
|
2314
|
+
filter: commandFilter(),
|
|
2315
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
2316
|
+
className: cn("relative min-h-[38px] rounded-lg border border-input text-sm transition-shadow focus-within:border-ring focus-within:outline-none focus-within:ring-[3px] focus-within:ring-ring/20 has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-50", {
|
|
2317
|
+
"p-1": selected.length !== 0,
|
|
2318
|
+
"cursor-text": !disabled && selected.length !== 0
|
|
2319
|
+
}, !hideClearAllButton && "pe-9", className),
|
|
2320
|
+
onClick: () => {
|
|
2321
|
+
if (disabled) return;
|
|
2322
|
+
inputRef?.current?.focus();
|
|
2323
|
+
},
|
|
2324
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
2325
|
+
className: "flex flex-wrap gap-1",
|
|
2326
|
+
children: [
|
|
2327
|
+
selected.map((option) => {
|
|
2328
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2329
|
+
className: cn("animate-fadeIn relative inline-flex h-7 cursor-default items-center rounded-md border border-solid bg-background pe-7 pl-2 ps-2 text-xs font-medium text-secondary-foreground transition-all hover:bg-background disabled:cursor-not-allowed disabled:opacity-50 data-[fixed]:pe-2", badgeClassName),
|
|
2330
|
+
"data-fixed": option.fixed,
|
|
2331
|
+
"data-disabled": disabled || void 0,
|
|
2332
|
+
children: [option.label, /* @__PURE__ */ jsx("button", {
|
|
2333
|
+
className: "absolute -inset-y-px -end-px flex size-7 items-center justify-center rounded-e-lg border border-transparent p-0 text-muted-foreground/80 outline-0 transition-colors hover:text-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring/70",
|
|
2334
|
+
onKeyDown: (e) => {
|
|
2335
|
+
if (e.key === "Enter") handleUnselect(option);
|
|
2336
|
+
},
|
|
2337
|
+
onMouseDown: (e) => {
|
|
2338
|
+
e.preventDefault();
|
|
2339
|
+
e.stopPropagation();
|
|
2340
|
+
},
|
|
2341
|
+
onClick: () => handleUnselect(option),
|
|
2342
|
+
"aria-label": "Remove",
|
|
2343
|
+
children: /* @__PURE__ */ jsx(X, {
|
|
2344
|
+
width: 16,
|
|
2345
|
+
height: 16,
|
|
2346
|
+
strokeWidth: 2,
|
|
2347
|
+
"aria-hidden": "true"
|
|
2348
|
+
})
|
|
2349
|
+
})]
|
|
2350
|
+
}, option.value);
|
|
2351
|
+
}),
|
|
2352
|
+
/* @__PURE__ */ jsx(Command$1.Input, {
|
|
2353
|
+
...inputProps,
|
|
2354
|
+
ref: inputRef,
|
|
2355
|
+
value: inputValue,
|
|
2356
|
+
disabled,
|
|
2357
|
+
onValueChange: (value) => {
|
|
2358
|
+
setInputValue(value);
|
|
2359
|
+
inputProps?.onValueChange?.(value);
|
|
2360
|
+
},
|
|
2361
|
+
onBlur: (event) => {
|
|
2362
|
+
if (!onScrollbar) setOpen(false);
|
|
2363
|
+
inputProps?.onBlur?.(event);
|
|
2364
|
+
},
|
|
2365
|
+
onFocus: (event) => {
|
|
2366
|
+
setOpen(true);
|
|
2367
|
+
if (triggerSearchOnFocus) onSearch?.(debouncedSearchTerm);
|
|
2368
|
+
inputProps?.onFocus?.(event);
|
|
2369
|
+
},
|
|
2370
|
+
placeholder: hidePlaceholderWhenSelected && selected.length !== 0 ? "" : placeholder,
|
|
2371
|
+
className: cn("flex-1 bg-transparent outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed", {
|
|
2372
|
+
"w-full": hidePlaceholderWhenSelected,
|
|
2373
|
+
"px-3 py-2": selected.length === 0,
|
|
2374
|
+
"ml-1": selected.length !== 0
|
|
2375
|
+
}, inputProps?.className)
|
|
2376
|
+
}),
|
|
2377
|
+
/* @__PURE__ */ jsx("button", {
|
|
2378
|
+
type: "button",
|
|
2379
|
+
onClick: () => {
|
|
2380
|
+
setSelected(selected.filter((s) => s.fixed));
|
|
2381
|
+
onChange?.(selected.filter((s) => s.fixed));
|
|
2382
|
+
},
|
|
2383
|
+
className: cn("absolute end-0 top-0 flex size-9 items-center justify-center rounded-lg border border-transparent text-muted-foreground/80 transition-colors hover:text-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring/70", (hideClearAllButton || disabled || selected.length < 1 || selected.filter((s) => s.fixed).length === selected.length) && "hidden"),
|
|
2384
|
+
"aria-label": "Clear all",
|
|
2385
|
+
children: /* @__PURE__ */ jsx(X, {
|
|
2386
|
+
width: 16,
|
|
2387
|
+
height: 16,
|
|
2388
|
+
strokeWidth: 2,
|
|
2389
|
+
"aria-hidden": "true"
|
|
2390
|
+
})
|
|
2391
|
+
})
|
|
2392
|
+
]
|
|
2393
|
+
})
|
|
2394
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
2395
|
+
className: "relative",
|
|
2396
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
2397
|
+
className: cn("absolute top-2 z-10 w-full overflow-hidden rounded-lg border border-input", "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95", !open && "hidden"),
|
|
2398
|
+
"data-state": open ? "open" : "closed",
|
|
2399
|
+
children: open && /* @__PURE__ */ jsx(CommandList, {
|
|
2400
|
+
className: "bg-popover text-popover-foreground shadow-lg shadow-black/5 outline-none",
|
|
2401
|
+
onMouseLeave: () => {
|
|
2402
|
+
setOnScrollbar(false);
|
|
2403
|
+
},
|
|
2404
|
+
onMouseEnter: () => {
|
|
2405
|
+
setOnScrollbar(true);
|
|
2406
|
+
},
|
|
2407
|
+
onMouseUp: () => {
|
|
2408
|
+
inputRef?.current?.focus();
|
|
2409
|
+
},
|
|
2410
|
+
children: isLoading ? /* @__PURE__ */ jsx(Fragment, { children: loadingIndicator }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2411
|
+
EmptyItem(),
|
|
2412
|
+
CreatableItem(),
|
|
2413
|
+
!selectFirstItem && /* @__PURE__ */ jsx(CommandItem, {
|
|
2414
|
+
value: "-",
|
|
2415
|
+
className: "hidden"
|
|
2416
|
+
}),
|
|
2417
|
+
Object.entries(selectables).map(([key, dropdowns]) => /* @__PURE__ */ jsx(CommandGroup, {
|
|
2418
|
+
heading: key,
|
|
2419
|
+
className: "h-full overflow-auto",
|
|
2420
|
+
children: /* @__PURE__ */ jsx(Fragment, { children: dropdowns.map((option) => {
|
|
2421
|
+
return /* @__PURE__ */ jsx(CommandItem, {
|
|
2422
|
+
value: option.value,
|
|
2423
|
+
disabled: option.disable,
|
|
2424
|
+
onMouseDown: (e) => {
|
|
2425
|
+
e.preventDefault();
|
|
2426
|
+
e.stopPropagation();
|
|
2427
|
+
},
|
|
2428
|
+
onSelect: () => {
|
|
2429
|
+
if (selected.length >= maxSelected) {
|
|
2430
|
+
onMaxSelected?.(selected.length);
|
|
2431
|
+
return;
|
|
2432
|
+
}
|
|
2433
|
+
setInputValue("");
|
|
2434
|
+
const newOptions = [...selected, option];
|
|
2435
|
+
setSelected(newOptions);
|
|
2436
|
+
onChange?.(newOptions);
|
|
2437
|
+
},
|
|
2438
|
+
className: cn("cursor-pointer", option.disable && "cursor-not-allowed opacity-50"),
|
|
2439
|
+
children: option.label
|
|
2440
|
+
}, option.value);
|
|
2441
|
+
}) })
|
|
2442
|
+
}, key))
|
|
2443
|
+
] })
|
|
2444
|
+
})
|
|
2445
|
+
})
|
|
2446
|
+
})]
|
|
2447
|
+
});
|
|
2448
|
+
});
|
|
2449
|
+
MultipleSelector.displayName = "MultipleSelector";
|
|
2450
|
+
|
|
2451
|
+
//#endregion
|
|
2452
|
+
//#region src/components/base/native-select.tsx
|
|
2453
|
+
function NativeSelect({ className, size = "default", ...props }) {
|
|
2454
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2455
|
+
className: "group/native-select relative w-fit has-[select:disabled]:opacity-50",
|
|
2456
|
+
"data-slot": "native-select-wrapper",
|
|
2457
|
+
children: [/* @__PURE__ */ jsx("select", {
|
|
2458
|
+
"data-slot": "native-select",
|
|
2459
|
+
"data-size": size,
|
|
2460
|
+
className: cn("border-input placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 dark:hover:bg-input/50 h-9 w-full min-w-0 appearance-none rounded-md border bg-transparent px-3 py-2 pr-9 text-sm shadow-xs transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed data-[size=sm]:h-8 data-[size=sm]:py-1", "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]", "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", className),
|
|
2461
|
+
...props
|
|
2462
|
+
}), /* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
2463
|
+
className: "text-muted-foreground pointer-events-none absolute top-1/2 right-3.5 size-4 -translate-y-1/2 opacity-50 select-none",
|
|
2464
|
+
"aria-hidden": "true",
|
|
2465
|
+
"data-slot": "native-select-icon"
|
|
2466
|
+
})]
|
|
2467
|
+
});
|
|
2468
|
+
}
|
|
2469
|
+
function NativeSelectOption({ ...props }) {
|
|
2470
|
+
return /* @__PURE__ */ jsx("option", {
|
|
2471
|
+
"data-slot": "native-select-option",
|
|
2472
|
+
...props
|
|
2473
|
+
});
|
|
2474
|
+
}
|
|
2475
|
+
function NativeSelectOptGroup({ className, ...props }) {
|
|
2476
|
+
return /* @__PURE__ */ jsx("optgroup", {
|
|
2477
|
+
"data-slot": "native-select-optgroup",
|
|
2478
|
+
className: cn(className),
|
|
2479
|
+
...props
|
|
2480
|
+
});
|
|
2481
|
+
}
|
|
2482
|
+
|
|
2483
|
+
//#endregion
|
|
2484
|
+
//#region src/components/base/navigation-menu.tsx
|
|
2485
|
+
function NavigationMenu({ className, children, viewport = true, ...props }) {
|
|
2486
|
+
return /* @__PURE__ */ jsxs(NavigationMenu$1.Root, {
|
|
2487
|
+
"data-slot": "navigation-menu",
|
|
2488
|
+
"data-viewport": viewport,
|
|
2489
|
+
className: cn("group/navigation-menu relative flex max-w-max flex-1 items-center justify-center", className),
|
|
2490
|
+
...props,
|
|
2491
|
+
children: [children, viewport && /* @__PURE__ */ jsx(NavigationMenuViewport, {})]
|
|
2492
|
+
});
|
|
2493
|
+
}
|
|
2494
|
+
function NavigationMenuList({ className, ...props }) {
|
|
2495
|
+
return /* @__PURE__ */ jsx(NavigationMenu$1.List, {
|
|
2496
|
+
"data-slot": "navigation-menu-list",
|
|
2497
|
+
className: cn("group flex flex-1 list-none items-center justify-center gap-1", className),
|
|
2498
|
+
...props
|
|
2499
|
+
});
|
|
2500
|
+
}
|
|
2501
|
+
function NavigationMenuItem({ className, ...props }) {
|
|
2502
|
+
return /* @__PURE__ */ jsx(NavigationMenu$1.Item, {
|
|
2503
|
+
"data-slot": "navigation-menu-item",
|
|
2504
|
+
className: cn("relative", className),
|
|
2505
|
+
...props
|
|
2506
|
+
});
|
|
2507
|
+
}
|
|
2508
|
+
const navigationMenuTriggerStyle = cva("group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=open]:hover:bg-accent data-[state=open]:text-accent-foreground data-[state=open]:focus:bg-accent data-[state=open]:bg-accent/50 focus-visible:ring-ring/50 outline-none transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1");
|
|
2509
|
+
function NavigationMenuTrigger({ className, children, ...props }) {
|
|
2510
|
+
return /* @__PURE__ */ jsxs(NavigationMenu$1.Trigger, {
|
|
2511
|
+
"data-slot": "navigation-menu-trigger",
|
|
2512
|
+
className: cn(navigationMenuTriggerStyle(), "group", className),
|
|
2513
|
+
...props,
|
|
2514
|
+
children: [
|
|
2515
|
+
children,
|
|
2516
|
+
" ",
|
|
2517
|
+
/* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
2518
|
+
className: "relative top-[1px] ml-1 size-3 transition duration-300 group-data-[state=open]:rotate-180",
|
|
2519
|
+
"aria-hidden": "true"
|
|
2520
|
+
})
|
|
2521
|
+
]
|
|
2522
|
+
});
|
|
2523
|
+
}
|
|
2524
|
+
function NavigationMenuContent({ className, ...props }) {
|
|
2525
|
+
return /* @__PURE__ */ jsx(NavigationMenu$1.Content, {
|
|
2526
|
+
"data-slot": "navigation-menu-content",
|
|
2527
|
+
className: cn("data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out 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 top-0 left-0 w-full p-2 pr-2.5 md:absolute md:w-auto", "group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:data-[state=open]:animate-in group-data-[viewport=false]/navigation-menu:data-[state=closed]:animate-out group-data-[viewport=false]/navigation-menu:data-[state=closed]:zoom-out-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:zoom-in-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:fade-in-0 group-data-[viewport=false]/navigation-menu:data-[state=closed]:fade-out-0 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:border group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:duration-200 **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none", className),
|
|
2528
|
+
...props
|
|
2529
|
+
});
|
|
2530
|
+
}
|
|
2531
|
+
function NavigationMenuViewport({ className, ...props }) {
|
|
2532
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2533
|
+
className: cn("absolute top-full left-0 isolate z-50 flex justify-center"),
|
|
2534
|
+
children: /* @__PURE__ */ jsx(NavigationMenu$1.Viewport, {
|
|
2535
|
+
"data-slot": "navigation-menu-viewport",
|
|
2536
|
+
className: cn("origin-top-center bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border shadow md:w-[var(--radix-navigation-menu-viewport-width)]", className),
|
|
2537
|
+
...props
|
|
2538
|
+
})
|
|
2539
|
+
});
|
|
2540
|
+
}
|
|
2541
|
+
function NavigationMenuLink({ className, ...props }) {
|
|
2542
|
+
return /* @__PURE__ */ jsx(NavigationMenu$1.Link, {
|
|
2543
|
+
"data-slot": "navigation-menu-link",
|
|
2544
|
+
className: cn("data-[active=true]:focus:bg-accent data-[active=true]:hover:bg-accent data-[active=true]:bg-accent/50 data-[active=true]:text-accent-foreground hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus-visible:ring-ring/50 [&_svg:not([class*='text-'])]:text-muted-foreground flex flex-col gap-1 rounded-sm p-2 text-sm transition-all outline-none focus-visible:ring-[3px] focus-visible:outline-1 [&_svg:not([class*='size-'])]:size-4", className),
|
|
2545
|
+
...props
|
|
2546
|
+
});
|
|
2547
|
+
}
|
|
2548
|
+
function NavigationMenuIndicator({ className, ...props }) {
|
|
2549
|
+
return /* @__PURE__ */ jsx(NavigationMenu$1.Indicator, {
|
|
2550
|
+
"data-slot": "navigation-menu-indicator",
|
|
2551
|
+
className: cn("data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden", className),
|
|
2552
|
+
...props,
|
|
2553
|
+
children: /* @__PURE__ */ jsx("div", { className: "bg-border relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm shadow-md" })
|
|
2554
|
+
});
|
|
2555
|
+
}
|
|
2556
|
+
|
|
2557
|
+
//#endregion
|
|
2558
|
+
//#region src/components/base/pagination.tsx
|
|
2559
|
+
function Pagination({ className, ...props }) {
|
|
2560
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
2561
|
+
role: "navigation",
|
|
2562
|
+
"aria-label": "pagination",
|
|
2563
|
+
"data-slot": "pagination",
|
|
2564
|
+
className: cn("mx-auto flex w-full justify-center", className),
|
|
2565
|
+
...props
|
|
2566
|
+
});
|
|
2567
|
+
}
|
|
2568
|
+
function PaginationContent({ className, ...props }) {
|
|
2569
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
2570
|
+
"data-slot": "pagination-content",
|
|
2571
|
+
className: cn("flex flex-row items-center gap-1", className),
|
|
2572
|
+
...props
|
|
2573
|
+
});
|
|
2574
|
+
}
|
|
2575
|
+
function PaginationItem({ ...props }) {
|
|
2576
|
+
return /* @__PURE__ */ jsx("li", {
|
|
2577
|
+
"data-slot": "pagination-item",
|
|
2578
|
+
...props
|
|
2579
|
+
});
|
|
2580
|
+
}
|
|
2581
|
+
function PaginationLink({ className, isActive, size = "icon", ...props }) {
|
|
2582
|
+
return /* @__PURE__ */ jsx("a", {
|
|
2583
|
+
"aria-current": isActive ? "page" : void 0,
|
|
2584
|
+
"data-slot": "pagination-link",
|
|
2585
|
+
"data-active": isActive,
|
|
2586
|
+
className: cn(buttonVariants({
|
|
2587
|
+
variant: isActive ? "outline" : "ghost",
|
|
2588
|
+
size
|
|
2589
|
+
}), className),
|
|
2590
|
+
...props
|
|
2591
|
+
});
|
|
2592
|
+
}
|
|
2593
|
+
function PaginationPrevious({ className, ...props }) {
|
|
2594
|
+
return /* @__PURE__ */ jsxs(PaginationLink, {
|
|
2595
|
+
"aria-label": "Go to previous page",
|
|
2596
|
+
size: "default",
|
|
2597
|
+
className: cn("gap-1 px-2.5 sm:pl-2.5", className),
|
|
2598
|
+
...props,
|
|
2599
|
+
children: [/* @__PURE__ */ jsx(ChevronLeftIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
2600
|
+
className: "hidden sm:block",
|
|
2601
|
+
children: "Previous"
|
|
2602
|
+
})]
|
|
2603
|
+
});
|
|
2604
|
+
}
|
|
2605
|
+
function PaginationNext({ className, ...props }) {
|
|
2606
|
+
return /* @__PURE__ */ jsxs(PaginationLink, {
|
|
2607
|
+
"aria-label": "Go to next page",
|
|
2608
|
+
size: "default",
|
|
2609
|
+
className: cn("gap-1 px-2.5 sm:pr-2.5", className),
|
|
2610
|
+
...props,
|
|
2611
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
2612
|
+
className: "hidden sm:block",
|
|
2613
|
+
children: "Next"
|
|
2614
|
+
}), /* @__PURE__ */ jsx(ChevronRightIcon, {})]
|
|
2615
|
+
});
|
|
2616
|
+
}
|
|
2617
|
+
function PaginationEllipsis({ className, ...props }) {
|
|
2618
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
2619
|
+
"aria-hidden": true,
|
|
2620
|
+
"data-slot": "pagination-ellipsis",
|
|
2621
|
+
className: cn("flex size-9 items-center justify-center", className),
|
|
2622
|
+
...props,
|
|
2623
|
+
children: [/* @__PURE__ */ jsx(MoreHorizontalIcon, { className: "size-4" }), /* @__PURE__ */ jsx("span", {
|
|
2624
|
+
className: "sr-only",
|
|
2625
|
+
children: "More pages"
|
|
2626
|
+
})]
|
|
2627
|
+
});
|
|
2628
|
+
}
|
|
2629
|
+
|
|
2630
|
+
//#endregion
|
|
2631
|
+
//#region src/components/base/popover.tsx
|
|
2632
|
+
function Popover({ ...props }) {
|
|
2633
|
+
return /* @__PURE__ */ jsx(Popover$1.Root, {
|
|
2634
|
+
"data-slot": "popover",
|
|
2635
|
+
...props
|
|
2636
|
+
});
|
|
2637
|
+
}
|
|
2638
|
+
function PopoverTrigger({ ...props }) {
|
|
2639
|
+
return /* @__PURE__ */ jsx(Popover$1.Trigger, {
|
|
2640
|
+
"data-slot": "popover-trigger",
|
|
2641
|
+
...props
|
|
2642
|
+
});
|
|
2643
|
+
}
|
|
2644
|
+
function PopoverContent({ className, align = "center", sideOffset = 4, ...props }) {
|
|
2645
|
+
return /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(Popover$1.Content, {
|
|
2646
|
+
"data-slot": "popover-content",
|
|
2647
|
+
align,
|
|
2648
|
+
sideOffset,
|
|
2649
|
+
className: cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden", className),
|
|
2650
|
+
...props
|
|
2651
|
+
}) });
|
|
2652
|
+
}
|
|
2653
|
+
function PopoverAnchor({ ...props }) {
|
|
2654
|
+
return /* @__PURE__ */ jsx(Popover$1.Anchor, {
|
|
2655
|
+
"data-slot": "popover-anchor",
|
|
2656
|
+
...props
|
|
2657
|
+
});
|
|
2658
|
+
}
|
|
2659
|
+
function PopoverHeader({ className, ...props }) {
|
|
2660
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2661
|
+
"data-slot": "popover-header",
|
|
2662
|
+
className: cn("flex flex-col gap-1 text-sm", className),
|
|
2663
|
+
...props
|
|
2664
|
+
});
|
|
2665
|
+
}
|
|
2666
|
+
function PopoverTitle({ className, ...props }) {
|
|
2667
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2668
|
+
"data-slot": "popover-title",
|
|
2669
|
+
className: cn("font-medium", className),
|
|
2670
|
+
...props
|
|
2671
|
+
});
|
|
2672
|
+
}
|
|
2673
|
+
function PopoverDescription({ className, ...props }) {
|
|
2674
|
+
return /* @__PURE__ */ jsx("p", {
|
|
2675
|
+
"data-slot": "popover-description",
|
|
2676
|
+
className: cn("text-muted-foreground", className),
|
|
2677
|
+
...props
|
|
2678
|
+
});
|
|
2679
|
+
}
|
|
2680
|
+
|
|
2681
|
+
//#endregion
|
|
2682
|
+
//#region src/components/base/progress.tsx
|
|
2683
|
+
function Progress({ className, value, ...props }) {
|
|
2684
|
+
return /* @__PURE__ */ jsx(Progress$1.Root, {
|
|
2685
|
+
"data-slot": "progress",
|
|
2686
|
+
className: cn("bg-primary/20 relative h-2 w-full overflow-hidden rounded-full", className),
|
|
2687
|
+
...props,
|
|
2688
|
+
children: /* @__PURE__ */ jsx(Progress$1.Indicator, {
|
|
2689
|
+
"data-slot": "progress-indicator",
|
|
2690
|
+
className: "bg-primary h-full w-full flex-1 transition-all",
|
|
2691
|
+
style: { transform: `translateX(-${100 - (value || 0)}%)` }
|
|
2692
|
+
})
|
|
2693
|
+
});
|
|
2694
|
+
}
|
|
2695
|
+
|
|
2696
|
+
//#endregion
|
|
2697
|
+
//#region src/components/base/radio-group.tsx
|
|
2698
|
+
function RadioGroup({ className, ...props }) {
|
|
2699
|
+
return /* @__PURE__ */ jsx(RadioGroup$1.Root, {
|
|
2700
|
+
"data-slot": "radio-group",
|
|
2701
|
+
className: cn("grid gap-3", className),
|
|
2702
|
+
...props
|
|
2703
|
+
});
|
|
2704
|
+
}
|
|
2705
|
+
function RadioGroupItem({ className, ...props }) {
|
|
2706
|
+
return /* @__PURE__ */ jsx(RadioGroup$1.Item, {
|
|
2707
|
+
"data-slot": "radio-group-item",
|
|
2708
|
+
className: cn("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
2709
|
+
...props,
|
|
2710
|
+
children: /* @__PURE__ */ jsx(RadioGroup$1.Indicator, {
|
|
2711
|
+
"data-slot": "radio-group-indicator",
|
|
2712
|
+
className: "relative flex items-center justify-center",
|
|
2713
|
+
children: /* @__PURE__ */ jsx(CircleIcon, { className: "fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2" })
|
|
2714
|
+
})
|
|
2715
|
+
});
|
|
2716
|
+
}
|
|
2717
|
+
|
|
2718
|
+
//#endregion
|
|
2719
|
+
//#region src/components/base/resizable.tsx
|
|
2720
|
+
function ResizablePanelGroup({ className, ...props }) {
|
|
2721
|
+
return /* @__PURE__ */ jsx(ResizablePrimitive.Group, {
|
|
2722
|
+
"data-slot": "resizable-panel-group",
|
|
2723
|
+
className: cn("flex h-full w-full aria-[orientation=vertical]:flex-col", className),
|
|
2724
|
+
...props
|
|
2725
|
+
});
|
|
2726
|
+
}
|
|
2727
|
+
function ResizablePanel({ ...props }) {
|
|
2728
|
+
return /* @__PURE__ */ jsx(ResizablePrimitive.Panel, {
|
|
2729
|
+
"data-slot": "resizable-panel",
|
|
2730
|
+
...props
|
|
2731
|
+
});
|
|
2732
|
+
}
|
|
2733
|
+
function ResizableHandle({ withHandle, className, ...props }) {
|
|
2734
|
+
return /* @__PURE__ */ jsx(ResizablePrimitive.Separator, {
|
|
2735
|
+
"data-slot": "resizable-handle",
|
|
2736
|
+
className: cn("bg-border focus-visible:ring-ring relative flex w-px items-center justify-center 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-offset-1 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),
|
|
2737
|
+
...props,
|
|
2738
|
+
children: withHandle && /* @__PURE__ */ jsx("div", {
|
|
2739
|
+
className: "bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",
|
|
2740
|
+
children: /* @__PURE__ */ jsx(GripVerticalIcon, { className: "size-2.5" })
|
|
2741
|
+
})
|
|
2742
|
+
});
|
|
2743
|
+
}
|
|
2744
|
+
|
|
2745
|
+
//#endregion
|
|
2746
|
+
//#region src/components/base/scroll-area.tsx
|
|
2747
|
+
function ScrollArea({ className, children, ...props }) {
|
|
2748
|
+
return /* @__PURE__ */ jsxs(ScrollArea$1.Root, {
|
|
2749
|
+
"data-slot": "scroll-area",
|
|
2750
|
+
className: cn("relative", className),
|
|
2751
|
+
...props,
|
|
2752
|
+
children: [
|
|
2753
|
+
/* @__PURE__ */ jsx(ScrollArea$1.Viewport, {
|
|
2754
|
+
"data-slot": "scroll-area-viewport",
|
|
2755
|
+
className: "focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",
|
|
2756
|
+
children
|
|
2757
|
+
}),
|
|
2758
|
+
/* @__PURE__ */ jsx(ScrollBar, {}),
|
|
2759
|
+
/* @__PURE__ */ jsx(ScrollArea$1.Corner, {})
|
|
2760
|
+
]
|
|
2761
|
+
});
|
|
2762
|
+
}
|
|
2763
|
+
function ScrollBar({ className, orientation = "vertical", ...props }) {
|
|
2764
|
+
return /* @__PURE__ */ jsx(ScrollArea$1.ScrollAreaScrollbar, {
|
|
2765
|
+
"data-slot": "scroll-area-scrollbar",
|
|
2766
|
+
orientation,
|
|
2767
|
+
className: cn("flex touch-none p-px transition-colors select-none", orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent", orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent", className),
|
|
2768
|
+
...props,
|
|
2769
|
+
children: /* @__PURE__ */ jsx(ScrollArea$1.ScrollAreaThumb, {
|
|
2770
|
+
"data-slot": "scroll-area-thumb",
|
|
2771
|
+
className: "bg-border relative flex-1 rounded-full"
|
|
2772
|
+
})
|
|
2773
|
+
});
|
|
2774
|
+
}
|
|
2775
|
+
|
|
2776
|
+
//#endregion
|
|
2777
|
+
//#region src/components/base/select.tsx
|
|
2778
|
+
function Select({ ...props }) {
|
|
2779
|
+
return /* @__PURE__ */ jsx(Select$1.Root, {
|
|
2780
|
+
"data-slot": "select",
|
|
2781
|
+
...props
|
|
2782
|
+
});
|
|
2783
|
+
}
|
|
2784
|
+
function SelectGroup({ ...props }) {
|
|
2785
|
+
return /* @__PURE__ */ jsx(Select$1.Group, {
|
|
2786
|
+
"data-slot": "select-group",
|
|
2787
|
+
...props
|
|
2788
|
+
});
|
|
2789
|
+
}
|
|
2790
|
+
function SelectValue({ ...props }) {
|
|
2791
|
+
return /* @__PURE__ */ jsx(Select$1.Value, {
|
|
2792
|
+
"data-slot": "select-value",
|
|
2793
|
+
...props
|
|
2794
|
+
});
|
|
2795
|
+
}
|
|
2796
|
+
function SelectTrigger({ className, size = "default", children, ...props }) {
|
|
2797
|
+
return /* @__PURE__ */ jsxs(Select$1.Trigger, {
|
|
2798
|
+
"data-slot": "select-trigger",
|
|
2799
|
+
"data-size": size,
|
|
2800
|
+
className: cn("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 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-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
2801
|
+
...props,
|
|
2802
|
+
children: [children, /* @__PURE__ */ jsx(Select$1.Icon, {
|
|
2803
|
+
asChild: true,
|
|
2804
|
+
children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4 opacity-50" })
|
|
2805
|
+
})]
|
|
2806
|
+
});
|
|
2807
|
+
}
|
|
2808
|
+
function SelectContent({ className, children, position = "item-aligned", align = "center", ...props }) {
|
|
2809
|
+
return /* @__PURE__ */ jsx(Select$1.Portal, { children: /* @__PURE__ */ jsxs(Select$1.Content, {
|
|
2810
|
+
"data-slot": "select-content",
|
|
2811
|
+
className: cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md", 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),
|
|
2812
|
+
position,
|
|
2813
|
+
align,
|
|
2814
|
+
...props,
|
|
2815
|
+
children: [
|
|
2816
|
+
/* @__PURE__ */ jsx(SelectScrollUpButton, {}),
|
|
2817
|
+
/* @__PURE__ */ jsx(Select$1.Viewport, {
|
|
2818
|
+
className: cn("p-1", position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),
|
|
2819
|
+
children
|
|
2820
|
+
}),
|
|
2821
|
+
/* @__PURE__ */ jsx(SelectScrollDownButton, {})
|
|
2822
|
+
]
|
|
2823
|
+
}) });
|
|
2824
|
+
}
|
|
2825
|
+
function SelectLabel({ className, ...props }) {
|
|
2826
|
+
return /* @__PURE__ */ jsx(Select$1.Label, {
|
|
2827
|
+
"data-slot": "select-label",
|
|
2828
|
+
className: cn("text-muted-foreground px-2 py-1.5 text-xs", className),
|
|
2829
|
+
...props
|
|
2830
|
+
});
|
|
2831
|
+
}
|
|
2832
|
+
function SelectItem({ className, children, ...props }) {
|
|
2833
|
+
return /* @__PURE__ */ jsxs(Select$1.Item, {
|
|
2834
|
+
"data-slot": "select-item",
|
|
2835
|
+
className: cn("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground 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-[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),
|
|
2836
|
+
...props,
|
|
2837
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
2838
|
+
"data-slot": "select-item-indicator",
|
|
2839
|
+
className: "absolute right-2 flex size-3.5 items-center justify-center",
|
|
2840
|
+
children: /* @__PURE__ */ jsx(Select$1.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4" }) })
|
|
2841
|
+
}), /* @__PURE__ */ jsx(Select$1.ItemText, { children })]
|
|
2842
|
+
});
|
|
2843
|
+
}
|
|
2844
|
+
function SelectSeparator({ className, ...props }) {
|
|
2845
|
+
return /* @__PURE__ */ jsx(Select$1.Separator, {
|
|
2846
|
+
"data-slot": "select-separator",
|
|
2847
|
+
className: cn("bg-border pointer-events-none -mx-1 my-1 h-px", className),
|
|
2848
|
+
...props
|
|
2849
|
+
});
|
|
2850
|
+
}
|
|
2851
|
+
function SelectScrollUpButton({ className, ...props }) {
|
|
2852
|
+
return /* @__PURE__ */ jsx(Select$1.ScrollUpButton, {
|
|
2853
|
+
"data-slot": "select-scroll-up-button",
|
|
2854
|
+
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
2855
|
+
...props,
|
|
2856
|
+
children: /* @__PURE__ */ jsx(ChevronUpIcon, { className: "size-4" })
|
|
2857
|
+
});
|
|
2858
|
+
}
|
|
2859
|
+
function SelectScrollDownButton({ className, ...props }) {
|
|
2860
|
+
return /* @__PURE__ */ jsx(Select$1.ScrollDownButton, {
|
|
2861
|
+
"data-slot": "select-scroll-down-button",
|
|
2862
|
+
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
2863
|
+
...props,
|
|
2864
|
+
children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4" })
|
|
2865
|
+
});
|
|
2866
|
+
}
|
|
2867
|
+
|
|
2868
|
+
//#endregion
|
|
2869
|
+
//#region src/components/base/sheet.tsx
|
|
2870
|
+
function Sheet({ ...props }) {
|
|
2871
|
+
return /* @__PURE__ */ jsx(Dialog$1.Root, {
|
|
2872
|
+
"data-slot": "sheet",
|
|
2873
|
+
...props
|
|
2874
|
+
});
|
|
2875
|
+
}
|
|
2876
|
+
function SheetTrigger({ ...props }) {
|
|
2877
|
+
return /* @__PURE__ */ jsx(Dialog$1.Trigger, {
|
|
2878
|
+
"data-slot": "sheet-trigger",
|
|
2879
|
+
...props
|
|
2880
|
+
});
|
|
2881
|
+
}
|
|
2882
|
+
function SheetClose({ ...props }) {
|
|
2883
|
+
return /* @__PURE__ */ jsx(Dialog$1.Close, {
|
|
2884
|
+
"data-slot": "sheet-close",
|
|
2885
|
+
...props
|
|
2886
|
+
});
|
|
2887
|
+
}
|
|
2888
|
+
function SheetPortal({ ...props }) {
|
|
2889
|
+
return /* @__PURE__ */ jsx(Dialog$1.Portal, {
|
|
2890
|
+
"data-slot": "sheet-portal",
|
|
2891
|
+
...props
|
|
2892
|
+
});
|
|
2893
|
+
}
|
|
2894
|
+
function SheetOverlay({ className, ...props }) {
|
|
2895
|
+
return /* @__PURE__ */ jsx(Dialog$1.Overlay, {
|
|
2896
|
+
"data-slot": "sheet-overlay",
|
|
2897
|
+
className: cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50", className),
|
|
2898
|
+
...props
|
|
2899
|
+
});
|
|
2900
|
+
}
|
|
2901
|
+
function SheetContent({ className, children, side = "right", showCloseButton = true, ...props }) {
|
|
2902
|
+
return /* @__PURE__ */ jsxs(SheetPortal, { children: [/* @__PURE__ */ jsx(SheetOverlay, {}), /* @__PURE__ */ jsxs(Dialog$1.Content, {
|
|
2903
|
+
"data-slot": "sheet-content",
|
|
2904
|
+
className: cn("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500", side === "right" && "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm", side === "left" && "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm", side === "top" && "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b", side === "bottom" && "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t", className),
|
|
2905
|
+
...props,
|
|
2906
|
+
children: [children, showCloseButton && /* @__PURE__ */ jsxs(Dialog$1.Close, {
|
|
2907
|
+
className: "ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",
|
|
2908
|
+
children: [/* @__PURE__ */ jsx(XIcon, { className: "size-4" }), /* @__PURE__ */ jsx("span", {
|
|
2909
|
+
className: "sr-only",
|
|
2910
|
+
children: "Close"
|
|
2911
|
+
})]
|
|
2912
|
+
})]
|
|
2913
|
+
})] });
|
|
2914
|
+
}
|
|
2915
|
+
function SheetHeader({ className, ...props }) {
|
|
2916
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2917
|
+
"data-slot": "sheet-header",
|
|
2918
|
+
className: cn("flex flex-col gap-1.5 p-4", className),
|
|
2919
|
+
...props
|
|
2920
|
+
});
|
|
2921
|
+
}
|
|
2922
|
+
function SheetFooter({ className, ...props }) {
|
|
2923
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2924
|
+
"data-slot": "sheet-footer",
|
|
2925
|
+
className: cn("mt-auto flex flex-col gap-2 p-4", className),
|
|
2926
|
+
...props
|
|
2927
|
+
});
|
|
2928
|
+
}
|
|
2929
|
+
function SheetTitle({ className, ...props }) {
|
|
2930
|
+
return /* @__PURE__ */ jsx(Dialog$1.Title, {
|
|
2931
|
+
"data-slot": "sheet-title",
|
|
2932
|
+
className: cn("text-foreground font-semibold", className),
|
|
2933
|
+
...props
|
|
2934
|
+
});
|
|
2935
|
+
}
|
|
2936
|
+
function SheetDescription({ className, ...props }) {
|
|
2937
|
+
return /* @__PURE__ */ jsx(Dialog$1.Description, {
|
|
2938
|
+
"data-slot": "sheet-description",
|
|
2939
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
2940
|
+
...props
|
|
2941
|
+
});
|
|
2942
|
+
}
|
|
2943
|
+
|
|
2944
|
+
//#endregion
|
|
2945
|
+
//#region src/hooks/use-mobile.ts
|
|
2946
|
+
const MOBILE_BREAKPOINT = 768;
|
|
2947
|
+
function useIsMobile() {
|
|
2948
|
+
const [isMobile, setIsMobile] = React.useState(void 0);
|
|
2949
|
+
React.useEffect(() => {
|
|
2950
|
+
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
2951
|
+
const onChange = () => {
|
|
2952
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
2953
|
+
};
|
|
2954
|
+
mql.addEventListener("change", onChange);
|
|
2955
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
2956
|
+
return () => mql.removeEventListener("change", onChange);
|
|
2957
|
+
}, []);
|
|
2958
|
+
return !!isMobile;
|
|
2959
|
+
}
|
|
2960
|
+
|
|
2961
|
+
//#endregion
|
|
2962
|
+
//#region src/components/base/skeleton.tsx
|
|
2963
|
+
function Skeleton({ className, ...props }) {
|
|
2964
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2965
|
+
"data-slot": "skeleton",
|
|
2966
|
+
className: cn("bg-accent animate-pulse rounded-md", className),
|
|
2967
|
+
...props
|
|
2968
|
+
});
|
|
2969
|
+
}
|
|
2970
|
+
|
|
2971
|
+
//#endregion
|
|
2972
|
+
//#region src/components/base/tooltip.tsx
|
|
2973
|
+
function TooltipProvider({ delayDuration = 0, ...props }) {
|
|
2974
|
+
return /* @__PURE__ */ jsx(Tooltip$1.Provider, {
|
|
2975
|
+
"data-slot": "tooltip-provider",
|
|
2976
|
+
delayDuration,
|
|
2977
|
+
...props
|
|
2978
|
+
});
|
|
2979
|
+
}
|
|
2980
|
+
function Tooltip({ ...props }) {
|
|
2981
|
+
return /* @__PURE__ */ jsx(Tooltip$1.Root, {
|
|
2982
|
+
"data-slot": "tooltip",
|
|
2983
|
+
...props
|
|
2984
|
+
});
|
|
2985
|
+
}
|
|
2986
|
+
function TooltipTrigger({ ...props }) {
|
|
2987
|
+
return /* @__PURE__ */ jsx(Tooltip$1.Trigger, {
|
|
2988
|
+
"data-slot": "tooltip-trigger",
|
|
2989
|
+
...props
|
|
2990
|
+
});
|
|
2991
|
+
}
|
|
2992
|
+
function TooltipContent({ className, sideOffset = 0, children, ...props }) {
|
|
2993
|
+
return /* @__PURE__ */ jsx(Tooltip$1.Portal, { children: /* @__PURE__ */ jsxs(Tooltip$1.Content, {
|
|
2994
|
+
"data-slot": "tooltip-content",
|
|
2995
|
+
sideOffset,
|
|
2996
|
+
className: cn("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance", className),
|
|
2997
|
+
...props,
|
|
2998
|
+
children: [children, /* @__PURE__ */ jsx(Tooltip$1.Arrow, { className: "bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })]
|
|
2999
|
+
}) });
|
|
3000
|
+
}
|
|
3001
|
+
|
|
3002
|
+
//#endregion
|
|
3003
|
+
//#region src/components/base/sidebar.tsx
|
|
3004
|
+
const SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
3005
|
+
const SIDEBAR_COOKIE_MAX_AGE = 3600 * 24 * 7;
|
|
3006
|
+
const SIDEBAR_WIDTH = "16rem";
|
|
3007
|
+
const SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
3008
|
+
const SIDEBAR_WIDTH_ICON = "3rem";
|
|
3009
|
+
const SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
3010
|
+
const SidebarContext = React.createContext(null);
|
|
3011
|
+
function useSidebar() {
|
|
3012
|
+
const context = React.useContext(SidebarContext);
|
|
3013
|
+
if (!context) throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
3014
|
+
return context;
|
|
3015
|
+
}
|
|
3016
|
+
function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props }) {
|
|
3017
|
+
const isMobile = useIsMobile();
|
|
3018
|
+
const [openMobile, setOpenMobile] = React.useState(false);
|
|
3019
|
+
const [_open, _setOpen] = React.useState(defaultOpen);
|
|
3020
|
+
const open = openProp ?? _open;
|
|
3021
|
+
const setOpen = React.useCallback((value) => {
|
|
3022
|
+
const openState = typeof value === "function" ? value(open) : value;
|
|
3023
|
+
if (setOpenProp) setOpenProp(openState);
|
|
3024
|
+
else _setOpen(openState);
|
|
3025
|
+
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
|
|
3026
|
+
}, [setOpenProp, open]);
|
|
3027
|
+
const toggleSidebar = React.useCallback(() => {
|
|
3028
|
+
return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
|
|
3029
|
+
}, [
|
|
3030
|
+
isMobile,
|
|
3031
|
+
setOpen,
|
|
3032
|
+
setOpenMobile
|
|
3033
|
+
]);
|
|
3034
|
+
React.useEffect(() => {
|
|
3035
|
+
const handleKeyDown = (event) => {
|
|
3036
|
+
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
3037
|
+
event.preventDefault();
|
|
3038
|
+
toggleSidebar();
|
|
3039
|
+
}
|
|
3040
|
+
};
|
|
3041
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
3042
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
3043
|
+
}, [toggleSidebar]);
|
|
3044
|
+
const state = open ? "expanded" : "collapsed";
|
|
3045
|
+
const contextValue = React.useMemo(() => ({
|
|
3046
|
+
state,
|
|
3047
|
+
open,
|
|
3048
|
+
setOpen,
|
|
3049
|
+
isMobile,
|
|
3050
|
+
openMobile,
|
|
3051
|
+
setOpenMobile,
|
|
3052
|
+
toggleSidebar
|
|
3053
|
+
}), [
|
|
3054
|
+
state,
|
|
3055
|
+
open,
|
|
3056
|
+
setOpen,
|
|
3057
|
+
isMobile,
|
|
3058
|
+
openMobile,
|
|
3059
|
+
setOpenMobile,
|
|
3060
|
+
toggleSidebar
|
|
3061
|
+
]);
|
|
3062
|
+
return /* @__PURE__ */ jsx(SidebarContext.Provider, {
|
|
3063
|
+
value: contextValue,
|
|
3064
|
+
children: /* @__PURE__ */ jsx(TooltipProvider, {
|
|
3065
|
+
delayDuration: 0,
|
|
3066
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
3067
|
+
"data-slot": "sidebar-wrapper",
|
|
3068
|
+
style: {
|
|
3069
|
+
"--sidebar-width": SIDEBAR_WIDTH,
|
|
3070
|
+
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
3071
|
+
...style
|
|
3072
|
+
},
|
|
3073
|
+
className: cn("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full", className),
|
|
3074
|
+
...props,
|
|
3075
|
+
children
|
|
3076
|
+
})
|
|
3077
|
+
})
|
|
3078
|
+
});
|
|
3079
|
+
}
|
|
3080
|
+
function Sidebar({ side = "left", variant = "sidebar", collapsible = "offcanvas", className, children, ...props }) {
|
|
3081
|
+
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
3082
|
+
if (collapsible === "none") return /* @__PURE__ */ jsx("div", {
|
|
3083
|
+
"data-slot": "sidebar",
|
|
3084
|
+
className: cn("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col", className),
|
|
3085
|
+
...props,
|
|
3086
|
+
children
|
|
3087
|
+
});
|
|
3088
|
+
if (isMobile) return /* @__PURE__ */ jsx(Sheet, {
|
|
3089
|
+
open: openMobile,
|
|
3090
|
+
onOpenChange: setOpenMobile,
|
|
3091
|
+
...props,
|
|
3092
|
+
children: /* @__PURE__ */ jsxs(SheetContent, {
|
|
3093
|
+
"data-sidebar": "sidebar",
|
|
3094
|
+
"data-slot": "sidebar",
|
|
3095
|
+
"data-mobile": "true",
|
|
3096
|
+
className: "bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",
|
|
3097
|
+
style: { "--sidebar-width": SIDEBAR_WIDTH_MOBILE },
|
|
3098
|
+
side,
|
|
3099
|
+
children: [/* @__PURE__ */ jsxs(SheetHeader, {
|
|
3100
|
+
className: "sr-only",
|
|
3101
|
+
children: [/* @__PURE__ */ jsx(SheetTitle, { children: "Sidebar" }), /* @__PURE__ */ jsx(SheetDescription, { children: "Displays the mobile sidebar." })]
|
|
3102
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
3103
|
+
className: "flex h-full w-full flex-col",
|
|
3104
|
+
children
|
|
3105
|
+
})]
|
|
3106
|
+
})
|
|
3107
|
+
});
|
|
3108
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3109
|
+
className: "group peer text-sidebar-foreground hidden md:block",
|
|
3110
|
+
"data-state": state,
|
|
3111
|
+
"data-collapsible": state === "collapsed" ? collapsible : "",
|
|
3112
|
+
"data-variant": variant,
|
|
3113
|
+
"data-side": side,
|
|
3114
|
+
"data-slot": "sidebar",
|
|
3115
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
3116
|
+
"data-slot": "sidebar-gap",
|
|
3117
|
+
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)")
|
|
3118
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
3119
|
+
"data-slot": "sidebar-container",
|
|
3120
|
+
className: cn("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex", side === "left" ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]" : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]", 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),
|
|
3121
|
+
...props,
|
|
3122
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
3123
|
+
"data-sidebar": "sidebar",
|
|
3124
|
+
"data-slot": "sidebar-inner",
|
|
3125
|
+
className: "bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",
|
|
3126
|
+
children
|
|
3127
|
+
})
|
|
3128
|
+
})]
|
|
3129
|
+
});
|
|
3130
|
+
}
|
|
3131
|
+
function SidebarTrigger({ className, onClick, ...props }) {
|
|
3132
|
+
const { toggleSidebar } = useSidebar();
|
|
3133
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
3134
|
+
"data-sidebar": "trigger",
|
|
3135
|
+
"data-slot": "sidebar-trigger",
|
|
3136
|
+
variant: "ghost",
|
|
3137
|
+
size: "icon",
|
|
3138
|
+
className: cn("size-7", className),
|
|
3139
|
+
onClick: (event) => {
|
|
3140
|
+
onClick?.(event);
|
|
3141
|
+
toggleSidebar();
|
|
3142
|
+
},
|
|
3143
|
+
...props,
|
|
3144
|
+
children: [/* @__PURE__ */ jsx(PanelLeftIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
3145
|
+
className: "sr-only",
|
|
3146
|
+
children: "Toggle Sidebar"
|
|
3147
|
+
})]
|
|
3148
|
+
});
|
|
3149
|
+
}
|
|
3150
|
+
function SidebarRail({ className, ...props }) {
|
|
3151
|
+
const { toggleSidebar } = useSidebar();
|
|
3152
|
+
return /* @__PURE__ */ jsx("button", {
|
|
3153
|
+
"data-sidebar": "rail",
|
|
3154
|
+
"data-slot": "sidebar-rail",
|
|
3155
|
+
"aria-label": "Toggle Sidebar",
|
|
3156
|
+
tabIndex: -1,
|
|
3157
|
+
onClick: toggleSidebar,
|
|
3158
|
+
title: "Toggle Sidebar",
|
|
3159
|
+
className: cn("hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex", "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", "hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full", "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2", "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2", className),
|
|
3160
|
+
...props
|
|
3161
|
+
});
|
|
3162
|
+
}
|
|
3163
|
+
function SidebarInset({ className, ...props }) {
|
|
3164
|
+
return /* @__PURE__ */ jsx("main", {
|
|
3165
|
+
"data-slot": "sidebar-inset",
|
|
3166
|
+
className: cn("bg-background relative flex w-full flex-1 flex-col", "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),
|
|
3167
|
+
...props
|
|
3168
|
+
});
|
|
3169
|
+
}
|
|
3170
|
+
function SidebarInput({ className, ...props }) {
|
|
3171
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
3172
|
+
"data-slot": "sidebar-input",
|
|
3173
|
+
"data-sidebar": "input",
|
|
3174
|
+
className: cn("bg-background h-8 w-full shadow-none", className),
|
|
3175
|
+
...props
|
|
3176
|
+
});
|
|
3177
|
+
}
|
|
3178
|
+
function SidebarHeader({ className, ...props }) {
|
|
3179
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3180
|
+
"data-slot": "sidebar-header",
|
|
3181
|
+
"data-sidebar": "header",
|
|
3182
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
3183
|
+
...props
|
|
3184
|
+
});
|
|
3185
|
+
}
|
|
3186
|
+
function SidebarFooter({ className, ...props }) {
|
|
3187
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3188
|
+
"data-slot": "sidebar-footer",
|
|
3189
|
+
"data-sidebar": "footer",
|
|
3190
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
3191
|
+
...props
|
|
3192
|
+
});
|
|
3193
|
+
}
|
|
3194
|
+
function SidebarSeparator({ className, ...props }) {
|
|
3195
|
+
return /* @__PURE__ */ jsx(Separator, {
|
|
3196
|
+
"data-slot": "sidebar-separator",
|
|
3197
|
+
"data-sidebar": "separator",
|
|
3198
|
+
className: cn("bg-sidebar-border mx-2 w-auto", className),
|
|
3199
|
+
...props
|
|
3200
|
+
});
|
|
3201
|
+
}
|
|
3202
|
+
function SidebarContent({ className, ...props }) {
|
|
3203
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3204
|
+
"data-slot": "sidebar-content",
|
|
3205
|
+
"data-sidebar": "content",
|
|
3206
|
+
className: cn("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden", className),
|
|
3207
|
+
...props
|
|
3208
|
+
});
|
|
3209
|
+
}
|
|
3210
|
+
function SidebarGroup({ className, ...props }) {
|
|
3211
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3212
|
+
"data-slot": "sidebar-group",
|
|
3213
|
+
"data-sidebar": "group",
|
|
3214
|
+
className: cn("relative flex w-full min-w-0 flex-col p-2", className),
|
|
3215
|
+
...props
|
|
3216
|
+
});
|
|
3217
|
+
}
|
|
3218
|
+
function SidebarGroupLabel({ className, asChild = false, ...props }) {
|
|
3219
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "div", {
|
|
3220
|
+
"data-slot": "sidebar-group-label",
|
|
3221
|
+
"data-sidebar": "group-label",
|
|
3222
|
+
className: cn("text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0", className),
|
|
3223
|
+
...props
|
|
3224
|
+
});
|
|
3225
|
+
}
|
|
3226
|
+
function SidebarGroupAction({ className, asChild = false, ...props }) {
|
|
3227
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "button", {
|
|
3228
|
+
"data-slot": "sidebar-group-action",
|
|
3229
|
+
"data-sidebar": "group-action",
|
|
3230
|
+
className: cn("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", "after:absolute after:-inset-2 md:after:hidden", "group-data-[collapsible=icon]:hidden", className),
|
|
3231
|
+
...props
|
|
3232
|
+
});
|
|
3233
|
+
}
|
|
3234
|
+
function SidebarGroupContent({ className, ...props }) {
|
|
3235
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3236
|
+
"data-slot": "sidebar-group-content",
|
|
3237
|
+
"data-sidebar": "group-content",
|
|
3238
|
+
className: cn("w-full text-sm", className),
|
|
3239
|
+
...props
|
|
3240
|
+
});
|
|
3241
|
+
}
|
|
3242
|
+
function SidebarMenu({ className, ...props }) {
|
|
3243
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
3244
|
+
"data-slot": "sidebar-menu",
|
|
3245
|
+
"data-sidebar": "menu",
|
|
3246
|
+
className: cn("flex w-full min-w-0 flex-col gap-1", className),
|
|
3247
|
+
...props
|
|
3248
|
+
});
|
|
3249
|
+
}
|
|
3250
|
+
function SidebarMenuItem({ className, ...props }) {
|
|
3251
|
+
return /* @__PURE__ */ jsx("li", {
|
|
3252
|
+
"data-slot": "sidebar-menu-item",
|
|
3253
|
+
"data-sidebar": "menu-item",
|
|
3254
|
+
className: cn("group/menu-item relative", className),
|
|
3255
|
+
...props
|
|
3256
|
+
});
|
|
3257
|
+
}
|
|
3258
|
+
const sidebarMenuButtonVariants = cva("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0", {
|
|
3259
|
+
variants: {
|
|
3260
|
+
variant: {
|
|
3261
|
+
default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
3262
|
+
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))]"
|
|
3263
|
+
},
|
|
3264
|
+
size: {
|
|
3265
|
+
default: "h-8 text-sm",
|
|
3266
|
+
sm: "h-7 text-xs",
|
|
3267
|
+
lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!"
|
|
3268
|
+
}
|
|
3269
|
+
},
|
|
3270
|
+
defaultVariants: {
|
|
3271
|
+
variant: "default",
|
|
3272
|
+
size: "default"
|
|
3273
|
+
}
|
|
3274
|
+
});
|
|
3275
|
+
function SidebarMenuButton({ asChild = false, isActive = false, variant = "default", size = "default", tooltip, className, ...props }) {
|
|
3276
|
+
const Comp = asChild ? Slot.Root : "button";
|
|
3277
|
+
const { isMobile, state } = useSidebar();
|
|
3278
|
+
const button = /* @__PURE__ */ jsx(Comp, {
|
|
3279
|
+
"data-slot": "sidebar-menu-button",
|
|
3280
|
+
"data-sidebar": "menu-button",
|
|
3281
|
+
"data-size": size,
|
|
3282
|
+
"data-active": isActive,
|
|
3283
|
+
className: cn(sidebarMenuButtonVariants({
|
|
3284
|
+
variant,
|
|
3285
|
+
size
|
|
3286
|
+
}), className),
|
|
3287
|
+
...props
|
|
3288
|
+
});
|
|
3289
|
+
if (!tooltip) return button;
|
|
3290
|
+
if (typeof tooltip === "string") tooltip = { children: tooltip };
|
|
3291
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
3292
|
+
asChild: true,
|
|
3293
|
+
children: button
|
|
3294
|
+
}), /* @__PURE__ */ jsx(TooltipContent, {
|
|
3295
|
+
side: "right",
|
|
3296
|
+
align: "center",
|
|
3297
|
+
hidden: state !== "collapsed" || isMobile,
|
|
3298
|
+
...tooltip
|
|
3299
|
+
})] });
|
|
3300
|
+
}
|
|
3301
|
+
function SidebarMenuAction({ className, asChild = false, showOnHover = false, ...props }) {
|
|
3302
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "button", {
|
|
3303
|
+
"data-slot": "sidebar-menu-action",
|
|
3304
|
+
"data-sidebar": "menu-action",
|
|
3305
|
+
className: cn("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", "after:absolute after:-inset-2 md:after:hidden", "peer-data-[size=sm]/menu-button:top-1", "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5", "group-data-[collapsible=icon]:hidden", showOnHover && "peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0", className),
|
|
3306
|
+
...props
|
|
3307
|
+
});
|
|
3308
|
+
}
|
|
3309
|
+
function SidebarMenuBadge({ className, ...props }) {
|
|
3310
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3311
|
+
"data-slot": "sidebar-menu-badge",
|
|
3312
|
+
"data-sidebar": "menu-badge",
|
|
3313
|
+
className: cn("text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none", "peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground", "peer-data-[size=sm]/menu-button:top-1", "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5", "group-data-[collapsible=icon]:hidden", className),
|
|
3314
|
+
...props
|
|
3315
|
+
});
|
|
3316
|
+
}
|
|
3317
|
+
function SidebarMenuSkeleton({ className, showIcon = false, ...props }) {
|
|
3318
|
+
const width = React.useMemo(() => {
|
|
3319
|
+
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
3320
|
+
}, []);
|
|
3321
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3322
|
+
"data-slot": "sidebar-menu-skeleton",
|
|
3323
|
+
"data-sidebar": "menu-skeleton",
|
|
3324
|
+
className: cn("flex h-8 items-center gap-2 rounded-md px-2", className),
|
|
3325
|
+
...props,
|
|
3326
|
+
children: [showIcon && /* @__PURE__ */ jsx(Skeleton, {
|
|
3327
|
+
className: "size-4 rounded-md",
|
|
3328
|
+
"data-sidebar": "menu-skeleton-icon"
|
|
3329
|
+
}), /* @__PURE__ */ jsx(Skeleton, {
|
|
3330
|
+
className: "h-4 max-w-(--skeleton-width) flex-1",
|
|
3331
|
+
"data-sidebar": "menu-skeleton-text",
|
|
3332
|
+
style: { "--skeleton-width": width }
|
|
3333
|
+
})]
|
|
3334
|
+
});
|
|
3335
|
+
}
|
|
3336
|
+
function SidebarMenuSub({ className, ...props }) {
|
|
3337
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
3338
|
+
"data-slot": "sidebar-menu-sub",
|
|
3339
|
+
"data-sidebar": "menu-sub",
|
|
3340
|
+
className: cn("border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5", "group-data-[collapsible=icon]:hidden", className),
|
|
3341
|
+
...props
|
|
3342
|
+
});
|
|
3343
|
+
}
|
|
3344
|
+
function SidebarMenuSubItem({ className, ...props }) {
|
|
3345
|
+
return /* @__PURE__ */ jsx("li", {
|
|
3346
|
+
"data-slot": "sidebar-menu-sub-item",
|
|
3347
|
+
"data-sidebar": "menu-sub-item",
|
|
3348
|
+
className: cn("group/menu-sub-item relative", className),
|
|
3349
|
+
...props
|
|
3350
|
+
});
|
|
3351
|
+
}
|
|
3352
|
+
function SidebarMenuSubButton({ asChild = false, size = "md", isActive = false, className, ...props }) {
|
|
3353
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "a", {
|
|
3354
|
+
"data-slot": "sidebar-menu-sub-button",
|
|
3355
|
+
"data-sidebar": "menu-sub-button",
|
|
3356
|
+
"data-size": size,
|
|
3357
|
+
"data-active": isActive,
|
|
3358
|
+
className: cn("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0", "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground", size === "sm" && "text-xs", size === "md" && "text-sm", "group-data-[collapsible=icon]:hidden", className),
|
|
3359
|
+
...props
|
|
3360
|
+
});
|
|
3361
|
+
}
|
|
3362
|
+
|
|
3363
|
+
//#endregion
|
|
3364
|
+
//#region src/components/base/slider.tsx
|
|
3365
|
+
function Slider({ className, defaultValue, value, min = 0, max = 100, ...props }) {
|
|
3366
|
+
const _values = React.useMemo(() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max], [
|
|
3367
|
+
value,
|
|
3368
|
+
defaultValue,
|
|
3369
|
+
min,
|
|
3370
|
+
max
|
|
3371
|
+
]);
|
|
3372
|
+
return /* @__PURE__ */ jsxs(Slider$1.Root, {
|
|
3373
|
+
"data-slot": "slider",
|
|
3374
|
+
defaultValue,
|
|
3375
|
+
value,
|
|
3376
|
+
min,
|
|
3377
|
+
max,
|
|
3378
|
+
className: cn("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col", className),
|
|
3379
|
+
...props,
|
|
3380
|
+
children: [/* @__PURE__ */ jsx(Slider$1.Track, {
|
|
3381
|
+
"data-slot": "slider-track",
|
|
3382
|
+
className: cn("bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"),
|
|
3383
|
+
children: /* @__PURE__ */ jsx(Slider$1.Range, {
|
|
3384
|
+
"data-slot": "slider-range",
|
|
3385
|
+
className: cn("bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full")
|
|
3386
|
+
})
|
|
3387
|
+
}), Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ jsx(Slider$1.Thumb, {
|
|
3388
|
+
"data-slot": "slider-thumb",
|
|
3389
|
+
className: "border-primary ring-ring/50 block size-4 shrink-0 rounded-full border bg-white shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
|
|
3390
|
+
}, index))]
|
|
3391
|
+
});
|
|
3392
|
+
}
|
|
3393
|
+
|
|
3394
|
+
//#endregion
|
|
3395
|
+
//#region src/components/base/sonner.tsx
|
|
3396
|
+
const Toaster = ({ ...props }) => {
|
|
3397
|
+
const { theme = "system" } = useTheme();
|
|
3398
|
+
return /* @__PURE__ */ jsx(Toaster$1, {
|
|
3399
|
+
theme,
|
|
3400
|
+
className: "toaster group",
|
|
3401
|
+
icons: {
|
|
3402
|
+
success: /* @__PURE__ */ jsx(CircleCheckIcon, { className: "size-4" }),
|
|
3403
|
+
info: /* @__PURE__ */ jsx(InfoIcon, { className: "size-4" }),
|
|
3404
|
+
warning: /* @__PURE__ */ jsx(TriangleAlertIcon, { className: "size-4" }),
|
|
3405
|
+
error: /* @__PURE__ */ jsx(OctagonXIcon, { className: "size-4" }),
|
|
3406
|
+
loading: /* @__PURE__ */ jsx(Loader2Icon, { className: "size-4 animate-spin" })
|
|
3407
|
+
},
|
|
3408
|
+
style: {
|
|
3409
|
+
"--normal-bg": "var(--popover)",
|
|
3410
|
+
"--normal-text": "var(--popover-foreground)",
|
|
3411
|
+
"--normal-border": "var(--border)",
|
|
3412
|
+
"--border-radius": "var(--radius)"
|
|
3413
|
+
},
|
|
3414
|
+
...props
|
|
3415
|
+
});
|
|
3416
|
+
};
|
|
3417
|
+
|
|
3418
|
+
//#endregion
|
|
3419
|
+
//#region src/components/base/spinner.tsx
|
|
3420
|
+
function Spinner({ className, ...props }) {
|
|
3421
|
+
return /* @__PURE__ */ jsx(Loader2Icon, {
|
|
3422
|
+
role: "status",
|
|
3423
|
+
"aria-label": "Loading",
|
|
3424
|
+
className: cn("size-4 animate-spin", className),
|
|
3425
|
+
...props
|
|
3426
|
+
});
|
|
3427
|
+
}
|
|
3428
|
+
|
|
3429
|
+
//#endregion
|
|
3430
|
+
//#region src/components/base/switch.tsx
|
|
3431
|
+
function Switch({ className, size = "default", ...props }) {
|
|
3432
|
+
return /* @__PURE__ */ jsx(Switch$1.Root, {
|
|
3433
|
+
"data-slot": "switch",
|
|
3434
|
+
"data-size": size,
|
|
3435
|
+
className: cn("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6", className),
|
|
3436
|
+
...props,
|
|
3437
|
+
children: /* @__PURE__ */ jsx(Switch$1.Thumb, {
|
|
3438
|
+
"data-slot": "switch-thumb",
|
|
3439
|
+
className: cn("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")
|
|
3440
|
+
})
|
|
3441
|
+
});
|
|
3442
|
+
}
|
|
3443
|
+
|
|
3444
|
+
//#endregion
|
|
3445
|
+
//#region src/components/base/table.tsx
|
|
3446
|
+
function Table({ className, ...props }) {
|
|
3447
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3448
|
+
"data-slot": "table-container",
|
|
3449
|
+
className: "relative w-full overflow-x-auto",
|
|
3450
|
+
children: /* @__PURE__ */ jsx("table", {
|
|
3451
|
+
"data-slot": "table",
|
|
3452
|
+
className: cn("w-full caption-bottom text-sm", className),
|
|
3453
|
+
...props
|
|
3454
|
+
})
|
|
3455
|
+
});
|
|
3456
|
+
}
|
|
3457
|
+
function TableHeader({ className, ...props }) {
|
|
3458
|
+
return /* @__PURE__ */ jsx("thead", {
|
|
3459
|
+
"data-slot": "table-header",
|
|
3460
|
+
className: cn("[&_tr]:border-b", className),
|
|
3461
|
+
...props
|
|
3462
|
+
});
|
|
3463
|
+
}
|
|
3464
|
+
function TableBody({ className, ...props }) {
|
|
3465
|
+
return /* @__PURE__ */ jsx("tbody", {
|
|
3466
|
+
"data-slot": "table-body",
|
|
3467
|
+
className: cn("[&_tr:last-child]:border-0", className),
|
|
3468
|
+
...props
|
|
3469
|
+
});
|
|
3470
|
+
}
|
|
3471
|
+
function TableFooter({ className, ...props }) {
|
|
3472
|
+
return /* @__PURE__ */ jsx("tfoot", {
|
|
3473
|
+
"data-slot": "table-footer",
|
|
3474
|
+
className: cn("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0", className),
|
|
3475
|
+
...props
|
|
3476
|
+
});
|
|
3477
|
+
}
|
|
3478
|
+
function TableRow({ className, ...props }) {
|
|
3479
|
+
return /* @__PURE__ */ jsx("tr", {
|
|
3480
|
+
"data-slot": "table-row",
|
|
3481
|
+
className: cn("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors", className),
|
|
3482
|
+
...props
|
|
3483
|
+
});
|
|
3484
|
+
}
|
|
3485
|
+
function TableHead({ className, ...props }) {
|
|
3486
|
+
return /* @__PURE__ */ jsx("th", {
|
|
3487
|
+
"data-slot": "table-head",
|
|
3488
|
+
className: cn("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className),
|
|
3489
|
+
...props
|
|
3490
|
+
});
|
|
3491
|
+
}
|
|
3492
|
+
function TableCell({ className, ...props }) {
|
|
3493
|
+
return /* @__PURE__ */ jsx("td", {
|
|
3494
|
+
"data-slot": "table-cell",
|
|
3495
|
+
className: cn("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className),
|
|
3496
|
+
...props
|
|
3497
|
+
});
|
|
3498
|
+
}
|
|
3499
|
+
function TableCaption({ className, ...props }) {
|
|
3500
|
+
return /* @__PURE__ */ jsx("caption", {
|
|
3501
|
+
"data-slot": "table-caption",
|
|
3502
|
+
className: cn("text-muted-foreground mt-4 text-sm", className),
|
|
3503
|
+
...props
|
|
3504
|
+
});
|
|
3505
|
+
}
|
|
3506
|
+
|
|
3507
|
+
//#endregion
|
|
3508
|
+
//#region src/components/base/tabs.tsx
|
|
3509
|
+
function Tabs({ className, orientation = "horizontal", ...props }) {
|
|
3510
|
+
return /* @__PURE__ */ jsx(Tabs$1.Root, {
|
|
3511
|
+
"data-slot": "tabs",
|
|
3512
|
+
"data-orientation": orientation,
|
|
3513
|
+
orientation,
|
|
3514
|
+
className: cn("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col", className),
|
|
3515
|
+
...props
|
|
3516
|
+
});
|
|
3517
|
+
}
|
|
3518
|
+
const tabsListVariants = cva("rounded-lg p-[3px] group-data-[orientation=horizontal]/tabs:h-9 data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col", {
|
|
3519
|
+
variants: { variant: {
|
|
3520
|
+
default: "bg-muted",
|
|
3521
|
+
line: "gap-1 bg-transparent"
|
|
3522
|
+
} },
|
|
3523
|
+
defaultVariants: { variant: "default" }
|
|
3524
|
+
});
|
|
3525
|
+
function TabsList({ className, variant = "default", ...props }) {
|
|
3526
|
+
return /* @__PURE__ */ jsx(Tabs$1.List, {
|
|
3527
|
+
"data-slot": "tabs-list",
|
|
3528
|
+
"data-variant": variant,
|
|
3529
|
+
className: cn(tabsListVariants({ variant }), className),
|
|
3530
|
+
...props
|
|
3531
|
+
});
|
|
3532
|
+
}
|
|
3533
|
+
function TabsTrigger({ className, ...props }) {
|
|
3534
|
+
return /* @__PURE__ */ jsx(Tabs$1.Trigger, {
|
|
3535
|
+
"data-slot": "tabs-trigger",
|
|
3536
|
+
className: cn("focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground 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 transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=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-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent", "data-[state=active]:bg-background dark:data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 data-[state=active]:text-foreground", "after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100", className),
|
|
3537
|
+
...props
|
|
3538
|
+
});
|
|
3539
|
+
}
|
|
3540
|
+
function TabsContent({ className, ...props }) {
|
|
3541
|
+
return /* @__PURE__ */ jsx(Tabs$1.Content, {
|
|
3542
|
+
"data-slot": "tabs-content",
|
|
3543
|
+
className: cn("flex-1 outline-none", className),
|
|
3544
|
+
...props
|
|
3545
|
+
});
|
|
3546
|
+
}
|
|
3547
|
+
|
|
3548
|
+
//#endregion
|
|
3549
|
+
//#region src/components/base/toggle.tsx
|
|
3550
|
+
const toggleVariants = cva("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap", {
|
|
3551
|
+
variants: {
|
|
3552
|
+
variant: {
|
|
3553
|
+
default: "bg-transparent",
|
|
3554
|
+
outline: "border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"
|
|
3555
|
+
},
|
|
3556
|
+
size: {
|
|
3557
|
+
default: "h-9 px-2 min-w-9",
|
|
3558
|
+
sm: "h-8 px-1.5 min-w-8",
|
|
3559
|
+
lg: "h-10 px-2.5 min-w-10"
|
|
3560
|
+
}
|
|
3561
|
+
},
|
|
3562
|
+
defaultVariants: {
|
|
3563
|
+
variant: "default",
|
|
3564
|
+
size: "default"
|
|
3565
|
+
}
|
|
3566
|
+
});
|
|
3567
|
+
function Toggle({ className, variant, size, ...props }) {
|
|
3568
|
+
return /* @__PURE__ */ jsx(Toggle$1.Root, {
|
|
3569
|
+
"data-slot": "toggle",
|
|
3570
|
+
className: cn(toggleVariants({
|
|
3571
|
+
variant,
|
|
3572
|
+
size,
|
|
3573
|
+
className
|
|
3574
|
+
})),
|
|
3575
|
+
...props
|
|
3576
|
+
});
|
|
3577
|
+
}
|
|
3578
|
+
|
|
3579
|
+
//#endregion
|
|
3580
|
+
//#region src/components/base/toggle-group.tsx
|
|
3581
|
+
const ToggleGroupContext = React.createContext({
|
|
3582
|
+
size: "default",
|
|
3583
|
+
variant: "default",
|
|
3584
|
+
spacing: 0
|
|
3585
|
+
});
|
|
3586
|
+
function ToggleGroup({ className, variant, size, spacing = 0, children, ...props }) {
|
|
3587
|
+
return /* @__PURE__ */ jsx(ToggleGroup$1.Root, {
|
|
3588
|
+
"data-slot": "toggle-group",
|
|
3589
|
+
"data-variant": variant,
|
|
3590
|
+
"data-size": size,
|
|
3591
|
+
"data-spacing": spacing,
|
|
3592
|
+
style: { "--gap": spacing },
|
|
3593
|
+
className: cn("group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs", className),
|
|
3594
|
+
...props,
|
|
3595
|
+
children: /* @__PURE__ */ jsx(ToggleGroupContext.Provider, {
|
|
3596
|
+
value: {
|
|
3597
|
+
variant,
|
|
3598
|
+
size,
|
|
3599
|
+
spacing
|
|
3600
|
+
},
|
|
3601
|
+
children
|
|
3602
|
+
})
|
|
3603
|
+
});
|
|
3604
|
+
}
|
|
3605
|
+
function ToggleGroupItem({ className, children, variant, size, ...props }) {
|
|
3606
|
+
const context = React.useContext(ToggleGroupContext);
|
|
3607
|
+
return /* @__PURE__ */ jsx(ToggleGroup$1.Item, {
|
|
3608
|
+
"data-slot": "toggle-group-item",
|
|
3609
|
+
"data-variant": context.variant || variant,
|
|
3610
|
+
"data-size": context.size || size,
|
|
3611
|
+
"data-spacing": context.spacing,
|
|
3612
|
+
className: cn(toggleVariants({
|
|
3613
|
+
variant: context.variant || variant,
|
|
3614
|
+
size: context.size || size
|
|
3615
|
+
}), "w-auto min-w-0 shrink-0 px-3 focus:z-10 focus-visible:z-10", "data-[spacing=0]:rounded-none data-[spacing=0]:shadow-none data-[spacing=0]:first:rounded-l-md data-[spacing=0]:last:rounded-r-md data-[spacing=0]:data-[variant=outline]:border-l-0 data-[spacing=0]:data-[variant=outline]:first:border-l", className),
|
|
3616
|
+
...props,
|
|
3617
|
+
children
|
|
3618
|
+
});
|
|
3619
|
+
}
|
|
3620
|
+
|
|
3621
|
+
//#endregion
|
|
3622
|
+
//#region src/components/icons/apple-icon.tsx
|
|
3623
|
+
const appleIconVariants = cva("shrink-0 transition-all", {
|
|
3624
|
+
variants: {
|
|
3625
|
+
variant: {
|
|
3626
|
+
default: "",
|
|
3627
|
+
light: "bg-white",
|
|
3628
|
+
dark: "bg-gray-900",
|
|
3629
|
+
transparent: "bg-transparent"
|
|
3630
|
+
},
|
|
3631
|
+
shape: {
|
|
3632
|
+
default: "rounded",
|
|
3633
|
+
square: "rounded-none",
|
|
3634
|
+
rounded: "rounded-full"
|
|
3635
|
+
},
|
|
3636
|
+
size: {
|
|
3637
|
+
sm: "size-6 p-1",
|
|
3638
|
+
default: "size-10 p-2",
|
|
3639
|
+
lg: "size-14 p-3",
|
|
3640
|
+
xl: "size-20 p-4"
|
|
3641
|
+
}
|
|
3642
|
+
},
|
|
3643
|
+
defaultVariants: {
|
|
3644
|
+
variant: "default",
|
|
3645
|
+
shape: "default",
|
|
3646
|
+
size: "default"
|
|
3647
|
+
}
|
|
3648
|
+
});
|
|
3649
|
+
function AppleIcon({ className, variant = "default", shape = "default", size = "default", ...props }) {
|
|
3650
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3651
|
+
className: cn(appleIconVariants({
|
|
3652
|
+
variant,
|
|
3653
|
+
shape,
|
|
3654
|
+
size,
|
|
3655
|
+
className
|
|
3656
|
+
})),
|
|
3657
|
+
...props,
|
|
3658
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
3659
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3660
|
+
viewBox: "0 0 24 24",
|
|
3661
|
+
className: "size-full",
|
|
3662
|
+
fill: "currentColor",
|
|
3663
|
+
"aria-label": "Apple",
|
|
3664
|
+
children: /* @__PURE__ */ jsx("path", { d: "M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701" })
|
|
3665
|
+
})
|
|
3666
|
+
});
|
|
3667
|
+
}
|
|
3668
|
+
|
|
3669
|
+
//#endregion
|
|
3670
|
+
//#region src/components/icons/facebook-icon.tsx
|
|
3671
|
+
const facebookIconVariants = cva("shrink-0 transition-all", {
|
|
3672
|
+
variants: {
|
|
3673
|
+
variant: {
|
|
3674
|
+
default: "",
|
|
3675
|
+
light: "bg-white",
|
|
3676
|
+
dark: "bg-gray-900",
|
|
3677
|
+
transparent: "bg-transparent"
|
|
3678
|
+
},
|
|
3679
|
+
shape: {
|
|
3680
|
+
default: "rounded",
|
|
3681
|
+
square: "rounded-none",
|
|
3682
|
+
rounded: "rounded-full"
|
|
3683
|
+
},
|
|
3684
|
+
size: {
|
|
3685
|
+
sm: "size-6 p-1",
|
|
3686
|
+
default: "size-10 p-2",
|
|
3687
|
+
lg: "size-14 p-3",
|
|
3688
|
+
xl: "size-20 p-4"
|
|
3689
|
+
}
|
|
3690
|
+
},
|
|
3691
|
+
defaultVariants: {
|
|
3692
|
+
variant: "default",
|
|
3693
|
+
shape: "default",
|
|
3694
|
+
size: "default"
|
|
3695
|
+
}
|
|
3696
|
+
});
|
|
3697
|
+
function FacebookIcon({ className, variant = "default", shape = "default", size = "default", ...props }) {
|
|
3698
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3699
|
+
className: cn(facebookIconVariants({
|
|
3700
|
+
variant,
|
|
3701
|
+
shape,
|
|
3702
|
+
size,
|
|
3703
|
+
className
|
|
3704
|
+
})),
|
|
3705
|
+
...props,
|
|
3706
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
3707
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3708
|
+
viewBox: "0 0 24 24",
|
|
3709
|
+
className: "size-full",
|
|
3710
|
+
fill: "#1877F2",
|
|
3711
|
+
"aria-label": "Facebook",
|
|
3712
|
+
children: /* @__PURE__ */ jsx("path", { d: "M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z" })
|
|
3713
|
+
})
|
|
3714
|
+
});
|
|
3715
|
+
}
|
|
3716
|
+
|
|
3717
|
+
//#endregion
|
|
3718
|
+
//#region src/components/icons/github-icon.tsx
|
|
3719
|
+
const githubIconVariants = cva("shrink-0 transition-all", {
|
|
3720
|
+
variants: {
|
|
3721
|
+
variant: {
|
|
3722
|
+
default: "",
|
|
3723
|
+
light: "bg-white",
|
|
3724
|
+
dark: "bg-gray-900",
|
|
3725
|
+
transparent: "bg-transparent"
|
|
3726
|
+
},
|
|
3727
|
+
shape: {
|
|
3728
|
+
default: "rounded",
|
|
3729
|
+
square: "rounded-none",
|
|
3730
|
+
rounded: "rounded-full"
|
|
3731
|
+
},
|
|
3732
|
+
size: {
|
|
3733
|
+
sm: "size-6 p-1",
|
|
3734
|
+
default: "size-10 p-2",
|
|
3735
|
+
lg: "size-14 p-3",
|
|
3736
|
+
xl: "size-20 p-4"
|
|
3737
|
+
}
|
|
3738
|
+
},
|
|
3739
|
+
defaultVariants: {
|
|
3740
|
+
variant: "default",
|
|
3741
|
+
shape: "default",
|
|
3742
|
+
size: "default"
|
|
3743
|
+
}
|
|
3744
|
+
});
|
|
3745
|
+
function GithubIcon({ className, variant = "default", shape = "default", size = "default", ...props }) {
|
|
3746
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3747
|
+
className: cn(githubIconVariants({
|
|
3748
|
+
variant,
|
|
3749
|
+
shape,
|
|
3750
|
+
size,
|
|
3751
|
+
className
|
|
3752
|
+
})),
|
|
3753
|
+
...props,
|
|
3754
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
3755
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3756
|
+
viewBox: "0 0 24 24",
|
|
3757
|
+
className: "size-full",
|
|
3758
|
+
fill: "currentColor",
|
|
3759
|
+
"aria-label": "GitHub",
|
|
3760
|
+
children: /* @__PURE__ */ jsx("path", { d: "M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" })
|
|
3761
|
+
})
|
|
3762
|
+
});
|
|
3763
|
+
}
|
|
3764
|
+
|
|
3765
|
+
//#endregion
|
|
3766
|
+
//#region src/components/icons/google-icon.tsx
|
|
3767
|
+
const googleIconVariants = cva("shrink-0 transition-all", {
|
|
3768
|
+
variants: {
|
|
3769
|
+
variant: {
|
|
3770
|
+
default: "",
|
|
3771
|
+
light: "bg-white",
|
|
3772
|
+
dark: "bg-gray-900",
|
|
3773
|
+
transparent: "bg-transparent"
|
|
3774
|
+
},
|
|
3775
|
+
shape: {
|
|
3776
|
+
default: "rounded",
|
|
3777
|
+
square: "rounded-none",
|
|
3778
|
+
rounded: "rounded-full"
|
|
3779
|
+
},
|
|
3780
|
+
size: {
|
|
3781
|
+
sm: "size-6 p-1",
|
|
3782
|
+
default: "size-10 p-2",
|
|
3783
|
+
lg: "size-14 p-3",
|
|
3784
|
+
xl: "size-20 p-4"
|
|
3785
|
+
}
|
|
3786
|
+
},
|
|
3787
|
+
defaultVariants: {
|
|
3788
|
+
variant: "default",
|
|
3789
|
+
shape: "default",
|
|
3790
|
+
size: "default"
|
|
3791
|
+
}
|
|
3792
|
+
});
|
|
3793
|
+
function GoogleIcon({ className, variant = "default", shape = "default", size = "default", ...props }) {
|
|
3794
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3795
|
+
className: cn(googleIconVariants({
|
|
3796
|
+
variant,
|
|
3797
|
+
shape,
|
|
3798
|
+
size,
|
|
3799
|
+
className
|
|
3800
|
+
})),
|
|
3801
|
+
...props,
|
|
3802
|
+
children: /* @__PURE__ */ jsxs("svg", {
|
|
3803
|
+
version: "1.1",
|
|
3804
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3805
|
+
viewBox: "0 0 48 48",
|
|
3806
|
+
className: "size-full",
|
|
3807
|
+
"aria-label": "Google",
|
|
3808
|
+
children: [
|
|
3809
|
+
/* @__PURE__ */ jsx("path", {
|
|
3810
|
+
fill: "#EA4335",
|
|
3811
|
+
d: "M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z"
|
|
3812
|
+
}),
|
|
3813
|
+
/* @__PURE__ */ jsx("path", {
|
|
3814
|
+
fill: "#4285F4",
|
|
3815
|
+
d: "M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z"
|
|
3816
|
+
}),
|
|
3817
|
+
/* @__PURE__ */ jsx("path", {
|
|
3818
|
+
fill: "#FBBC05",
|
|
3819
|
+
d: "M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z"
|
|
3820
|
+
}),
|
|
3821
|
+
/* @__PURE__ */ jsx("path", {
|
|
3822
|
+
fill: "#34A853",
|
|
3823
|
+
d: "M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z"
|
|
3824
|
+
}),
|
|
3825
|
+
/* @__PURE__ */ jsx("path", {
|
|
3826
|
+
fill: "none",
|
|
3827
|
+
d: "M0 0h48v48H0z"
|
|
3828
|
+
})
|
|
3829
|
+
]
|
|
3830
|
+
})
|
|
3831
|
+
});
|
|
3832
|
+
}
|
|
3833
|
+
|
|
3834
|
+
//#endregion
|
|
3835
|
+
//#region src/components/icons/microsoft-icon.tsx
|
|
3836
|
+
const microsoftIconVariants = cva("shrink-0 transition-all", {
|
|
3837
|
+
variants: {
|
|
3838
|
+
variant: {
|
|
3839
|
+
default: "",
|
|
3840
|
+
light: "bg-white",
|
|
3841
|
+
dark: "bg-gray-900",
|
|
3842
|
+
transparent: "bg-transparent"
|
|
3843
|
+
},
|
|
3844
|
+
shape: {
|
|
3845
|
+
default: "rounded",
|
|
3846
|
+
square: "rounded-none",
|
|
3847
|
+
rounded: "rounded-full"
|
|
3848
|
+
},
|
|
3849
|
+
size: {
|
|
3850
|
+
sm: "size-6 p-1",
|
|
3851
|
+
default: "size-10 p-2",
|
|
3852
|
+
lg: "size-14 p-3",
|
|
3853
|
+
xl: "size-20 p-4"
|
|
3854
|
+
}
|
|
3855
|
+
},
|
|
3856
|
+
defaultVariants: {
|
|
3857
|
+
variant: "default",
|
|
3858
|
+
shape: "default",
|
|
3859
|
+
size: "default"
|
|
3860
|
+
}
|
|
3861
|
+
});
|
|
3862
|
+
function MicrosoftIcon({ className, variant = "default", shape = "default", size = "default", ...props }) {
|
|
3863
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3864
|
+
className: cn(microsoftIconVariants({
|
|
3865
|
+
variant,
|
|
3866
|
+
shape,
|
|
3867
|
+
size,
|
|
3868
|
+
className
|
|
3869
|
+
})),
|
|
3870
|
+
...props,
|
|
3871
|
+
children: /* @__PURE__ */ jsxs("svg", {
|
|
3872
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3873
|
+
viewBox: "0 0 24 24",
|
|
3874
|
+
className: "size-full",
|
|
3875
|
+
"aria-label": "Microsoft",
|
|
3876
|
+
children: [
|
|
3877
|
+
/* @__PURE__ */ jsx("path", {
|
|
3878
|
+
fill: "#F25022",
|
|
3879
|
+
d: "M1 1h10v10H1z"
|
|
3880
|
+
}),
|
|
3881
|
+
/* @__PURE__ */ jsx("path", {
|
|
3882
|
+
fill: "#00A4EF",
|
|
3883
|
+
d: "M1 13h10v10H1z"
|
|
3884
|
+
}),
|
|
3885
|
+
/* @__PURE__ */ jsx("path", {
|
|
3886
|
+
fill: "#7FBA00",
|
|
3887
|
+
d: "M13 1h10v10H13z"
|
|
3888
|
+
}),
|
|
3889
|
+
/* @__PURE__ */ jsx("path", {
|
|
3890
|
+
fill: "#FFB900",
|
|
3891
|
+
d: "M13 13h10v10H13z"
|
|
3892
|
+
})
|
|
3893
|
+
]
|
|
3894
|
+
})
|
|
3895
|
+
});
|
|
3896
|
+
}
|
|
3897
|
+
|
|
3898
|
+
//#endregion
|
|
3899
|
+
//#region src/components/blocks/login-form.tsx
|
|
3900
|
+
const createLoginFormSchema = (t) => z.object({
|
|
3901
|
+
email: z.email(t("loginForm.errors.invalidEmail")),
|
|
3902
|
+
password: z.string().min(1, t("loginForm.errors.passwordRequired"))
|
|
3903
|
+
});
|
|
3904
|
+
const providerIcons = {
|
|
3905
|
+
google: /* @__PURE__ */ jsx(GoogleIcon, { className: "size-4 p-0" }),
|
|
3906
|
+
github: /* @__PURE__ */ jsx(GithubIcon, { className: "size-4 p-0" }),
|
|
3907
|
+
apple: /* @__PURE__ */ jsx(AppleIcon, { className: "size-4 p-0" }),
|
|
3908
|
+
microsoft: /* @__PURE__ */ jsx(MicrosoftIcon, { className: "size-4 p-0" }),
|
|
3909
|
+
facebook: /* @__PURE__ */ jsx(FacebookIcon, { className: "size-4 p-0" })
|
|
3910
|
+
};
|
|
3911
|
+
function LoginForm({ onSubmit, onProviderLogin, onForgotPassword, onSignUp, providers = [], showForgotPassword = true, showSignUp = true, title, description, schema, className }) {
|
|
3912
|
+
const { t } = useTranslation("ui");
|
|
3913
|
+
const [error, setError] = useState(null);
|
|
3914
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
3915
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
3916
|
+
const translatedSchema = createLoginFormSchema(t);
|
|
3917
|
+
const form = useForm({
|
|
3918
|
+
resolver: zodResolver(schema ?? translatedSchema),
|
|
3919
|
+
defaultValues: {
|
|
3920
|
+
email: "",
|
|
3921
|
+
password: ""
|
|
3922
|
+
}
|
|
3923
|
+
});
|
|
3924
|
+
const handleFormSubmit = async (data) => {
|
|
3925
|
+
try {
|
|
3926
|
+
setError(null);
|
|
3927
|
+
setIsLoading(true);
|
|
3928
|
+
await onSubmit?.(data.email, data.password);
|
|
3929
|
+
} catch (err) {
|
|
3930
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
3931
|
+
} finally {
|
|
3932
|
+
setIsLoading(false);
|
|
3933
|
+
}
|
|
3934
|
+
};
|
|
3935
|
+
const displayTitle = title ?? t("loginForm.title");
|
|
3936
|
+
const displayDescription = description ?? t("loginForm.description");
|
|
3937
|
+
return /* @__PURE__ */ jsxs(Card, {
|
|
3938
|
+
className: cn("w-full max-w-md", className),
|
|
3939
|
+
children: [
|
|
3940
|
+
/* @__PURE__ */ jsxs(CardHeader, {
|
|
3941
|
+
className: "text-center",
|
|
3942
|
+
children: [/* @__PURE__ */ jsx(CardTitle, {
|
|
3943
|
+
className: "text-xl",
|
|
3944
|
+
children: displayTitle
|
|
3945
|
+
}), /* @__PURE__ */ jsx(CardDescription, { children: displayDescription })]
|
|
3946
|
+
}),
|
|
3947
|
+
/* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("form", {
|
|
3948
|
+
id: "login-form",
|
|
3949
|
+
onSubmit: form.handleSubmit(handleFormSubmit),
|
|
3950
|
+
children: /* @__PURE__ */ jsxs(FieldGroup, {
|
|
3951
|
+
className: "gap-6",
|
|
3952
|
+
children: [
|
|
3953
|
+
error && /* @__PURE__ */ jsxs(Alert, {
|
|
3954
|
+
variant: "destructive",
|
|
3955
|
+
children: [/* @__PURE__ */ jsx(CircleAlert, {}), /* @__PURE__ */ jsx(AlertDescription, { children: error })]
|
|
3956
|
+
}),
|
|
3957
|
+
/* @__PURE__ */ jsx(Controller, {
|
|
3958
|
+
name: "email",
|
|
3959
|
+
control: form.control,
|
|
3960
|
+
render: ({ field, fieldState }) => /* @__PURE__ */ jsxs(Field, {
|
|
3961
|
+
"data-invalid": fieldState.invalid,
|
|
3962
|
+
children: [
|
|
3963
|
+
/* @__PURE__ */ jsx(FieldLabel, {
|
|
3964
|
+
htmlFor: "login-email",
|
|
3965
|
+
children: t("loginForm.email")
|
|
3966
|
+
}),
|
|
3967
|
+
/* @__PURE__ */ jsx(Input, {
|
|
3968
|
+
...field,
|
|
3969
|
+
id: "login-email",
|
|
3970
|
+
type: "email",
|
|
3971
|
+
placeholder: t("loginForm.emailPlaceholder"),
|
|
3972
|
+
disabled: isLoading,
|
|
3973
|
+
autoComplete: "email",
|
|
3974
|
+
"aria-invalid": fieldState.invalid
|
|
3975
|
+
}),
|
|
3976
|
+
fieldState.invalid && /* @__PURE__ */ jsx(FieldError, { errors: [fieldState.error] })
|
|
3977
|
+
]
|
|
3978
|
+
})
|
|
3979
|
+
}),
|
|
3980
|
+
/* @__PURE__ */ jsx(Controller, {
|
|
3981
|
+
name: "password",
|
|
3982
|
+
control: form.control,
|
|
3983
|
+
render: ({ field, fieldState }) => /* @__PURE__ */ jsxs(Field, {
|
|
3984
|
+
"data-invalid": fieldState.invalid,
|
|
3985
|
+
children: [
|
|
3986
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3987
|
+
className: "flex items-center",
|
|
3988
|
+
children: [/* @__PURE__ */ jsx(FieldLabel, {
|
|
3989
|
+
htmlFor: "login-password",
|
|
3990
|
+
children: t("loginForm.password")
|
|
3991
|
+
}), showForgotPassword && /* @__PURE__ */ jsx("button", {
|
|
3992
|
+
type: "button",
|
|
3993
|
+
onClick: onForgotPassword,
|
|
3994
|
+
className: "text-muted-foreground hover:text-primary ml-auto text-sm underline-offset-4 hover:underline",
|
|
3995
|
+
disabled: isLoading,
|
|
3996
|
+
children: t("loginForm.forgotPassword")
|
|
3997
|
+
})]
|
|
3998
|
+
}),
|
|
3999
|
+
/* @__PURE__ */ jsxs("div", {
|
|
4000
|
+
className: "relative",
|
|
4001
|
+
children: [/* @__PURE__ */ jsx(Input, {
|
|
4002
|
+
...field,
|
|
4003
|
+
id: "login-password",
|
|
4004
|
+
type: showPassword ? "text" : "password",
|
|
4005
|
+
disabled: isLoading,
|
|
4006
|
+
autoComplete: "current-password",
|
|
4007
|
+
"aria-invalid": fieldState.invalid,
|
|
4008
|
+
className: "pr-10"
|
|
4009
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
4010
|
+
type: "button",
|
|
4011
|
+
onClick: () => setShowPassword(!showPassword),
|
|
4012
|
+
className: "text-muted-foreground hover:text-foreground absolute top-1/2 right-3 -translate-y-1/2",
|
|
4013
|
+
disabled: isLoading,
|
|
4014
|
+
"aria-label": showPassword ? "Hide password" : "Show password",
|
|
4015
|
+
children: showPassword ? /* @__PURE__ */ jsx(EyeOff, { className: "size-4" }) : /* @__PURE__ */ jsx(Eye, { className: "size-4" })
|
|
4016
|
+
})]
|
|
4017
|
+
}),
|
|
4018
|
+
fieldState.invalid && /* @__PURE__ */ jsx(FieldError, { errors: [fieldState.error] })
|
|
4019
|
+
]
|
|
4020
|
+
})
|
|
4021
|
+
}),
|
|
4022
|
+
/* @__PURE__ */ jsx(Button, {
|
|
4023
|
+
type: "submit",
|
|
4024
|
+
className: "w-full",
|
|
4025
|
+
disabled: isLoading,
|
|
4026
|
+
children: isLoading ? t("loginForm.loggingIn") : t("loginForm.login")
|
|
4027
|
+
}),
|
|
4028
|
+
providers.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
|
|
4029
|
+
className: "relative",
|
|
4030
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
4031
|
+
className: "absolute inset-0 flex items-center",
|
|
4032
|
+
children: /* @__PURE__ */ jsx(Separator, { className: "w-full" })
|
|
4033
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
4034
|
+
className: "relative flex justify-center text-xs uppercase",
|
|
4035
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
4036
|
+
className: "bg-card text-muted-foreground px-2",
|
|
4037
|
+
children: t("loginForm.orContinueWith")
|
|
4038
|
+
})
|
|
4039
|
+
})]
|
|
4040
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
4041
|
+
className: "flex flex-col gap-3",
|
|
4042
|
+
children: providers.map((provider) => /* @__PURE__ */ jsxs(Button, {
|
|
4043
|
+
type: "button",
|
|
4044
|
+
variant: "outline",
|
|
4045
|
+
className: "w-full",
|
|
4046
|
+
onClick: () => onProviderLogin?.(provider),
|
|
4047
|
+
disabled: isLoading,
|
|
4048
|
+
children: [providerIcons[provider], t(`loginForm.providers.${provider}`)]
|
|
4049
|
+
}, provider))
|
|
4050
|
+
})] })
|
|
4051
|
+
]
|
|
4052
|
+
})
|
|
4053
|
+
}) }),
|
|
4054
|
+
showSignUp && /* @__PURE__ */ jsx(CardFooter, {
|
|
4055
|
+
className: "justify-center",
|
|
4056
|
+
children: /* @__PURE__ */ jsxs("p", {
|
|
4057
|
+
className: "text-muted-foreground text-sm",
|
|
4058
|
+
children: [
|
|
4059
|
+
t("loginForm.noAccount"),
|
|
4060
|
+
" ",
|
|
4061
|
+
/* @__PURE__ */ jsx("button", {
|
|
4062
|
+
type: "button",
|
|
4063
|
+
onClick: onSignUp,
|
|
4064
|
+
className: "text-primary underline-offset-4 hover:underline",
|
|
4065
|
+
disabled: isLoading,
|
|
4066
|
+
children: t("loginForm.signUp")
|
|
4067
|
+
})
|
|
4068
|
+
]
|
|
4069
|
+
})
|
|
4070
|
+
})
|
|
4071
|
+
]
|
|
4072
|
+
});
|
|
4073
|
+
}
|
|
4074
|
+
|
|
4075
|
+
//#endregion
|
|
4076
|
+
//#region src/components/custom/datetime-picker.tsx
|
|
4077
|
+
function DateTimePicker({ value, onChange, label, placeholder = "Select date and time", showClear = true, disabled = false, disabledDates, className, formatDateTime }) {
|
|
4078
|
+
const [open, setOpen] = useState(false);
|
|
4079
|
+
const [date, setDate] = useState(value);
|
|
4080
|
+
const handleClear = () => {
|
|
4081
|
+
setDate(void 0);
|
|
4082
|
+
onChange?.(void 0);
|
|
4083
|
+
};
|
|
4084
|
+
const handleDateChange = (newDate) => {
|
|
4085
|
+
if (!newDate) {
|
|
4086
|
+
setDate(void 0);
|
|
4087
|
+
onChange?.(void 0);
|
|
4088
|
+
return;
|
|
4089
|
+
}
|
|
4090
|
+
let updatedDate = newDate;
|
|
4091
|
+
if (date) {
|
|
4092
|
+
updatedDate = new Date(newDate);
|
|
4093
|
+
updatedDate.setHours(date.getHours());
|
|
4094
|
+
updatedDate.setMinutes(date.getMinutes());
|
|
4095
|
+
updatedDate.setSeconds(date.getSeconds());
|
|
4096
|
+
}
|
|
4097
|
+
setDate(updatedDate);
|
|
4098
|
+
onChange?.(updatedDate);
|
|
4099
|
+
};
|
|
4100
|
+
const handleTimeChange = (event) => {
|
|
4101
|
+
const timeValue = event.target.value;
|
|
4102
|
+
if (!timeValue) return;
|
|
4103
|
+
const [hours, minutes, seconds = "0"] = timeValue.split(":");
|
|
4104
|
+
const updatedDate = date ? new Date(date) : /* @__PURE__ */ new Date();
|
|
4105
|
+
updatedDate.setHours(parseInt(hours, 10));
|
|
4106
|
+
updatedDate.setMinutes(parseInt(minutes, 10));
|
|
4107
|
+
updatedDate.setSeconds(parseInt(seconds, 10));
|
|
4108
|
+
setDate(updatedDate);
|
|
4109
|
+
onChange?.(updatedDate);
|
|
4110
|
+
};
|
|
4111
|
+
const formatTimeValue = (date) => {
|
|
4112
|
+
if (!date) return "";
|
|
4113
|
+
return `${date.getHours().toString().padStart(2, "0")}:${date.getMinutes().toString().padStart(2, "0")}`;
|
|
4114
|
+
};
|
|
4115
|
+
const defaultFormatDateTime = (date) => {
|
|
4116
|
+
return `${date.toLocaleDateString()} ${date.toLocaleTimeString(void 0, {
|
|
4117
|
+
hour: "2-digit",
|
|
4118
|
+
minute: "2-digit"
|
|
4119
|
+
})}`;
|
|
4120
|
+
};
|
|
4121
|
+
useEffect(() => {
|
|
4122
|
+
setDate(value);
|
|
4123
|
+
}, [value]);
|
|
4124
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
4125
|
+
className: cn("flex flex-col gap-3", className),
|
|
4126
|
+
children: [label && /* @__PURE__ */ jsx(Label, {
|
|
4127
|
+
htmlFor: "datetime-picker",
|
|
4128
|
+
className: "px-1",
|
|
4129
|
+
children: label
|
|
4130
|
+
}), /* @__PURE__ */ jsxs(Popover, {
|
|
4131
|
+
open,
|
|
4132
|
+
onOpenChange: setOpen,
|
|
4133
|
+
children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
4134
|
+
asChild: true,
|
|
4135
|
+
children: /* @__PURE__ */ jsxs(Button, {
|
|
4136
|
+
variant: "outline",
|
|
4137
|
+
id: "datetime-picker",
|
|
4138
|
+
className: cn("w-full justify-start font-normal", !date && "text-muted-foreground"),
|
|
4139
|
+
disabled,
|
|
4140
|
+
children: [
|
|
4141
|
+
/* @__PURE__ */ jsx(CalendarIcon, { className: "mr-2 size-4" }),
|
|
4142
|
+
date ? formatDateTime ? formatDateTime(date) : defaultFormatDateTime(date) : placeholder,
|
|
4143
|
+
showClear && date && /* @__PURE__ */ jsx("button", {
|
|
4144
|
+
type: "button",
|
|
4145
|
+
onClick: (e) => {
|
|
4146
|
+
e.stopPropagation();
|
|
4147
|
+
handleClear();
|
|
4148
|
+
},
|
|
4149
|
+
className: "hover:bg-accent -mr-1 ml-auto rounded-sm p-1",
|
|
4150
|
+
children: /* @__PURE__ */ jsx(XIcon, { className: "size-3.5" })
|
|
4151
|
+
})
|
|
4152
|
+
]
|
|
4153
|
+
})
|
|
4154
|
+
}), /* @__PURE__ */ jsxs(PopoverContent, {
|
|
4155
|
+
className: "w-auto p-0",
|
|
4156
|
+
align: "start",
|
|
4157
|
+
children: [/* @__PURE__ */ jsx(Calendar, {
|
|
4158
|
+
mode: "single",
|
|
4159
|
+
selected: date,
|
|
4160
|
+
captionLayout: "dropdown",
|
|
4161
|
+
onSelect: handleDateChange,
|
|
4162
|
+
disabled: disabledDates
|
|
4163
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
4164
|
+
className: "border-t p-3",
|
|
4165
|
+
children: [/* @__PURE__ */ jsx(Label, {
|
|
4166
|
+
htmlFor: "time-input",
|
|
4167
|
+
className: "mb-2 block text-xs",
|
|
4168
|
+
children: "Time"
|
|
4169
|
+
}), /* @__PURE__ */ jsx(Input, {
|
|
4170
|
+
type: "time",
|
|
4171
|
+
id: "time-input",
|
|
4172
|
+
step: "60",
|
|
4173
|
+
value: formatTimeValue(date),
|
|
4174
|
+
onChange: handleTimeChange,
|
|
4175
|
+
disabled: !date || disabled,
|
|
4176
|
+
className: "bg-background h-8 appearance-none [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none"
|
|
4177
|
+
})]
|
|
4178
|
+
})]
|
|
4179
|
+
})]
|
|
4180
|
+
})]
|
|
4181
|
+
});
|
|
4182
|
+
}
|
|
4183
|
+
|
|
4184
|
+
//#endregion
|
|
4185
|
+
//#region src/components/providers/ui-kit-provider.tsx
|
|
4186
|
+
/**
|
|
4187
|
+
* Provider for UI kit components.
|
|
4188
|
+
*
|
|
4189
|
+
* @example
|
|
4190
|
+
* ```tsx
|
|
4191
|
+
* <UIKitProvider>
|
|
4192
|
+
* <App />
|
|
4193
|
+
* </UIKitProvider>
|
|
4194
|
+
* ```
|
|
4195
|
+
*/
|
|
4196
|
+
function UIKitProvider({ children, hasToaster = true, i18nConfig = { locale: "en" }, loadingComponent = null }) {
|
|
4197
|
+
const [localInstance] = useState(() => !i18nConfig.instance ? i18n.createInstance() : null);
|
|
4198
|
+
const instance = i18nConfig.instance || localInstance;
|
|
4199
|
+
const [isReady, setIsReady] = useState(() => !(i18nConfig.locale && !instance.isInitialized));
|
|
4200
|
+
useEffect(() => {
|
|
4201
|
+
if (i18nConfig.locale && !instance.isInitialized) instance.use(initReactI18next).init({
|
|
4202
|
+
lng: i18nConfig.locale,
|
|
4203
|
+
fallbackLng: i18nConfig.locale,
|
|
4204
|
+
defaultNS: "ui",
|
|
4205
|
+
resources: {},
|
|
4206
|
+
interpolation: { escapeValue: false }
|
|
4207
|
+
}).then(() => {
|
|
4208
|
+
setIsReady(true);
|
|
4209
|
+
});
|
|
4210
|
+
}, [i18nConfig, instance]);
|
|
4211
|
+
useEffect(() => {
|
|
4212
|
+
if (i18nConfig.locale) {
|
|
4213
|
+
const baseTranslations = locales_exports[i18nConfig.locale] ?? {};
|
|
4214
|
+
const mergedTranslations = i18nConfig.overrides ? {
|
|
4215
|
+
...baseTranslations,
|
|
4216
|
+
...i18nConfig.overrides
|
|
4217
|
+
} : baseTranslations;
|
|
4218
|
+
instance.addResourceBundle(i18nConfig.locale, "ui", mergedTranslations, true, true);
|
|
4219
|
+
instance.changeLanguage(i18nConfig.locale);
|
|
4220
|
+
} else if (i18nConfig.instance) {
|
|
4221
|
+
for (const [lng, resources] of Object.entries(locales_exports)) {
|
|
4222
|
+
const languageOverrides = i18nConfig.overrides?.[lng];
|
|
4223
|
+
if (instance.hasResourceBundle(lng, "ui") && !languageOverrides) continue;
|
|
4224
|
+
const mergedResources = languageOverrides ? {
|
|
4225
|
+
...resources,
|
|
4226
|
+
...languageOverrides
|
|
4227
|
+
} : resources;
|
|
4228
|
+
instance.addResourceBundle(lng, "ui", mergedResources, true, true);
|
|
4229
|
+
}
|
|
4230
|
+
if (i18nConfig.overrides) {
|
|
4231
|
+
const supportedLanguages = Object.keys(locales_exports);
|
|
4232
|
+
for (const [lng, resources] of Object.entries(i18nConfig.overrides)) {
|
|
4233
|
+
if (supportedLanguages.includes(lng)) continue;
|
|
4234
|
+
instance.addResourceBundle(lng, "ui", resources, true, true);
|
|
4235
|
+
}
|
|
4236
|
+
}
|
|
4237
|
+
}
|
|
4238
|
+
}, [i18nConfig, instance]);
|
|
4239
|
+
if (!isReady || !instance.isInitialized) return loadingComponent;
|
|
4240
|
+
return /* @__PURE__ */ jsx(I18nextProvider, {
|
|
4241
|
+
i18n: instance,
|
|
4242
|
+
children: /* @__PURE__ */ jsxs(TooltipProvider, { children: [children, hasToaster && /* @__PURE__ */ jsx(Toaster, {})] })
|
|
4243
|
+
});
|
|
4244
|
+
}
|
|
4245
|
+
|
|
4246
|
+
//#endregion
|
|
4247
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AppleIcon, AspectRatio, 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, DateTimePicker, 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, FacebookIcon, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, GithubIcon, GoogleIcon, 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, LoginForm, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, MicrosoftIcon, 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, 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, Spinner, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UIKitProvider, appleIconVariants, badgeVariants, buttonGroupVariants, buttonVariants, cn, facebookIconVariants, githubIconVariants, googleIconVariants, microsoftIconVariants, navigationMenuTriggerStyle, tabsListVariants, toggleVariants, useComboboxAnchor, useDebounce, useDirection, useSidebar };
|