@saasflare/ui 2.0.0 → 3.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/README.md +51 -30
- package/dist/{button-B2DR7obe.d.mts → button-DUQJ0X7e.d.mts} +0 -23
- package/dist/{button-B2DR7obe.d.ts → button-DUQJ0X7e.d.ts} +0 -23
- package/dist/chunk-7UGPCRZ6.mjs +130 -0
- package/dist/chunk-CWW36RYE.js +59 -0
- package/dist/chunk-JOVJRQO3.js +0 -1
- package/dist/{chunk-TU6BBAA7.js → chunk-OYH6LQWR.js} +33 -65
- package/dist/{chunk-OT4ZNLTB.mjs → chunk-QWLQV6FS.mjs} +2 -24
- package/dist/chunk-S26666D6.mjs +0 -1
- package/dist/chunk-VQQ6MF5I.js +161 -0
- package/dist/chunk-W53NTFPB.mjs +28 -0
- package/dist/dialog-CwyBJeNl.d.mts +22 -0
- package/dist/dialog-CwyBJeNl.d.ts +22 -0
- package/dist/entries/calendar.d.mts +13 -0
- package/dist/entries/calendar.d.ts +13 -0
- package/dist/entries/calendar.js +211 -0
- package/dist/entries/calendar.mjs +188 -0
- package/dist/entries/carousel.d.mts +1 -1
- package/dist/entries/carousel.d.ts +1 -1
- package/dist/entries/carousel.js +4 -3
- package/dist/entries/carousel.mjs +2 -1
- package/dist/entries/command.d.mts +21 -0
- package/dist/entries/command.d.ts +21 -0
- package/dist/entries/command.js +172 -0
- package/dist/entries/command.mjs +162 -0
- package/dist/entries/drawer.d.mts +16 -0
- package/dist/entries/drawer.d.ts +16 -0
- package/dist/entries/drawer.js +124 -0
- package/dist/entries/drawer.mjs +113 -0
- package/dist/entries/input-otp.d.mts +14 -0
- package/dist/entries/input-otp.d.ts +14 -0
- package/dist/entries/input-otp.js +89 -0
- package/dist/entries/input-otp.mjs +64 -0
- package/dist/entries/resizable.d.mts +10 -0
- package/dist/entries/resizable.d.ts +10 -0
- package/dist/entries/resizable.js +69 -0
- package/dist/entries/resizable.mjs +45 -0
- package/dist/index.d.mts +12 -103
- package/dist/index.d.ts +12 -103
- package/dist/index.js +1265 -832
- package/dist/index.mjs +1172 -740
- package/package.json +36 -12
package/dist/index.mjs
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
export { Button, SaasflareProvider, SaasflareScript, SaasflareShell, SmoothScrollProvider, buttonVariants,
|
|
2
|
+
import { buttonVariants, Button, useSaasflareProps } from './chunk-QWLQV6FS.mjs';
|
|
3
|
+
export { Button, SaasflareProvider, SaasflareScript, SaasflareShell, SmoothScrollProvider, buttonVariants, useAnimation, useSaasflareProps, useSaasflareTheme } from './chunk-QWLQV6FS.mjs';
|
|
4
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from './chunk-7UGPCRZ6.mjs';
|
|
5
|
+
import { useReducedMotion, noMotion, springGentle, springBouncy, spring } from './chunk-W53NTFPB.mjs';
|
|
6
|
+
export { fadeIn, noMotion, scaleIn, slideDown, slideUp, spring, springBouncy, springGentle, springStiff, useReducedMotion } from './chunk-W53NTFPB.mjs';
|
|
4
7
|
import { cn } from './chunk-S26666D6.mjs';
|
|
5
8
|
export { cn } from './chunk-S26666D6.mjs';
|
|
6
|
-
import * as
|
|
7
|
-
import { useState, useCallback, useMemo, useRef, useEffect, Suspense } from 'react';
|
|
9
|
+
import * as React5 from 'react';
|
|
10
|
+
import React5__default, { useState, useCallback, useMemo, useRef, useEffect, Suspense } from 'react';
|
|
8
11
|
import { m, useMotionValue, useSpring, useTransform, AnimatePresence } from 'motion/react';
|
|
9
12
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
10
|
-
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
11
|
-
import { XIcon, ChevronDownIcon, CheckIcon, ChevronUpIcon, CircleIcon, ChevronRightIcon, ChevronLeftIcon, Loader2Icon, OctagonXIcon, TriangleAlertIcon, InfoIcon, CircleCheckIcon, ChevronRight, MoreHorizontal, SearchIcon, MinusIcon, MoreHorizontalIcon, GripVerticalIcon, PanelLeftIcon, ArrowUpIcon, Sun, Moon } from 'lucide-react';
|
|
12
13
|
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
|
|
14
|
+
import { ChevronDownIcon, CheckIcon, ChevronUpIcon, CircleIcon, ChevronRightIcon, XIcon, Loader2Icon, OctagonXIcon, TriangleAlertIcon, InfoIcon as InfoIcon$1, CircleCheckIcon, ChevronRight, MoreHorizontal, SearchIcon, ChevronLeftIcon, MoreHorizontalIcon, PanelLeftIcon, ArrowUpIcon, Sun, Moon } from 'lucide-react';
|
|
13
15
|
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
14
16
|
import { cva } from 'class-variance-authority';
|
|
15
17
|
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
@@ -22,7 +24,7 @@ import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
|
22
24
|
import * as HoverCardPrimitive from '@radix-ui/react-hover-card';
|
|
23
25
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
24
26
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
25
|
-
import
|
|
27
|
+
import * as SheetPrimitive from '@radix-ui/react-dialog';
|
|
26
28
|
import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
27
29
|
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
28
30
|
import * as ContextMenuPrimitive from '@radix-ui/react-context-menu';
|
|
@@ -30,27 +32,24 @@ import * as MenubarPrimitive from '@radix-ui/react-menubar';
|
|
|
30
32
|
import * as NavigationMenuPrimitive from '@radix-ui/react-navigation-menu';
|
|
31
33
|
import * as TogglePrimitive from '@radix-ui/react-toggle';
|
|
32
34
|
import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
|
|
33
|
-
import { getDefaultClassNames, DayPicker } from 'react-day-picker';
|
|
34
35
|
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
35
36
|
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
36
37
|
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
37
38
|
import { useTheme } from 'next-themes';
|
|
38
|
-
import
|
|
39
|
+
import ReactDOM from 'react-dom';
|
|
39
40
|
import * as AspectRatioPrimitive from '@radix-ui/react-aspect-ratio';
|
|
40
41
|
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
41
|
-
import { Command
|
|
42
|
+
import { Command } from 'cmdk';
|
|
42
43
|
import * as Direction from '@radix-ui/react-direction';
|
|
43
44
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
44
45
|
import { FormProvider, Controller, useFormContext, useFormState } from 'react-hook-form';
|
|
45
|
-
import { OTPInput, OTPInputContext } from 'input-otp';
|
|
46
|
-
import * as ResizablePrimitive from 'react-resizable-panels';
|
|
47
46
|
import Image2 from 'next/image';
|
|
48
47
|
import { usePathname, useSearchParams } from 'next/navigation';
|
|
49
48
|
|
|
50
49
|
var MOBILE_BREAKPOINT = 768;
|
|
51
50
|
function useIsMobile() {
|
|
52
|
-
const [isMobile, setIsMobile] =
|
|
53
|
-
|
|
51
|
+
const [isMobile, setIsMobile] = React5.useState(void 0);
|
|
52
|
+
React5.useEffect(() => {
|
|
54
53
|
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
55
54
|
const onChange = () => {
|
|
56
55
|
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
@@ -260,126 +259,6 @@ function CardFooter({ className, ...props }) {
|
|
|
260
259
|
}
|
|
261
260
|
);
|
|
262
261
|
}
|
|
263
|
-
function Dialog({
|
|
264
|
-
...props
|
|
265
|
-
}) {
|
|
266
|
-
return /* @__PURE__ */ jsx(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
267
|
-
}
|
|
268
|
-
function DialogTrigger({
|
|
269
|
-
...props
|
|
270
|
-
}) {
|
|
271
|
-
return /* @__PURE__ */ jsx(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
|
|
272
|
-
}
|
|
273
|
-
function DialogPortal({
|
|
274
|
-
...props
|
|
275
|
-
}) {
|
|
276
|
-
return /* @__PURE__ */ jsx(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
|
|
277
|
-
}
|
|
278
|
-
function DialogClose({
|
|
279
|
-
...props
|
|
280
|
-
}) {
|
|
281
|
-
return /* @__PURE__ */ jsx(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
|
|
282
|
-
}
|
|
283
|
-
function DialogOverlay({
|
|
284
|
-
className,
|
|
285
|
-
...props
|
|
286
|
-
}) {
|
|
287
|
-
return /* @__PURE__ */ jsx(
|
|
288
|
-
DialogPrimitive.Overlay,
|
|
289
|
-
{
|
|
290
|
-
"data-slot": "dialog-overlay",
|
|
291
|
-
className: cn(
|
|
292
|
-
"fixed inset-0 z-50 bg-black/50 backdrop-blur-[2px] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
293
|
-
className
|
|
294
|
-
),
|
|
295
|
-
...props
|
|
296
|
-
}
|
|
297
|
-
);
|
|
298
|
-
}
|
|
299
|
-
function DialogContent({
|
|
300
|
-
className,
|
|
301
|
-
children,
|
|
302
|
-
...props
|
|
303
|
-
}) {
|
|
304
|
-
const reduced = useReducedMotion();
|
|
305
|
-
return /* @__PURE__ */ jsxs(DialogPortal, { children: [
|
|
306
|
-
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
307
|
-
/* @__PURE__ */ jsx(
|
|
308
|
-
DialogPrimitive.Content,
|
|
309
|
-
{
|
|
310
|
-
"data-slot": "dialog-content",
|
|
311
|
-
asChild: true,
|
|
312
|
-
...props,
|
|
313
|
-
children: /* @__PURE__ */ jsxs(
|
|
314
|
-
m.div,
|
|
315
|
-
{
|
|
316
|
-
initial: reduced ? { opacity: 1 } : { opacity: 0, scale: 0.95, y: 10 },
|
|
317
|
-
animate: { opacity: 1, scale: 1, y: 0 },
|
|
318
|
-
exit: reduced ? { opacity: 0 } : { opacity: 0, scale: 0.95, y: 10 },
|
|
319
|
-
transition: reduced ? noMotion : springBouncy,
|
|
320
|
-
className: cn(
|
|
321
|
-
"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 bg-background p-6 shadow-lg sm:max-w-lg",
|
|
322
|
-
className
|
|
323
|
-
),
|
|
324
|
-
children: [
|
|
325
|
-
children,
|
|
326
|
-
/* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none cursor-pointer [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", children: [
|
|
327
|
-
/* @__PURE__ */ jsx(XIcon, {}),
|
|
328
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
329
|
-
] })
|
|
330
|
-
]
|
|
331
|
-
}
|
|
332
|
-
)
|
|
333
|
-
}
|
|
334
|
-
)
|
|
335
|
-
] });
|
|
336
|
-
}
|
|
337
|
-
function DialogHeader({ className, ...props }) {
|
|
338
|
-
return /* @__PURE__ */ jsx(
|
|
339
|
-
"div",
|
|
340
|
-
{
|
|
341
|
-
"data-slot": "dialog-header",
|
|
342
|
-
className: cn("flex flex-col gap-2 text-center sm:text-left", className),
|
|
343
|
-
...props
|
|
344
|
-
}
|
|
345
|
-
);
|
|
346
|
-
}
|
|
347
|
-
function DialogFooter({ className, ...props }) {
|
|
348
|
-
return /* @__PURE__ */ jsx(
|
|
349
|
-
"div",
|
|
350
|
-
{
|
|
351
|
-
"data-slot": "dialog-footer",
|
|
352
|
-
className: cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className),
|
|
353
|
-
...props
|
|
354
|
-
}
|
|
355
|
-
);
|
|
356
|
-
}
|
|
357
|
-
function DialogTitle({
|
|
358
|
-
className,
|
|
359
|
-
...props
|
|
360
|
-
}) {
|
|
361
|
-
return /* @__PURE__ */ jsx(
|
|
362
|
-
DialogPrimitive.Title,
|
|
363
|
-
{
|
|
364
|
-
"data-slot": "dialog-title",
|
|
365
|
-
className: cn("text-lg leading-none font-semibold", className),
|
|
366
|
-
...props
|
|
367
|
-
}
|
|
368
|
-
);
|
|
369
|
-
}
|
|
370
|
-
function DialogDescription({
|
|
371
|
-
className,
|
|
372
|
-
...props
|
|
373
|
-
}) {
|
|
374
|
-
return /* @__PURE__ */ jsx(
|
|
375
|
-
DialogPrimitive.Description,
|
|
376
|
-
{
|
|
377
|
-
"data-slot": "dialog-description",
|
|
378
|
-
className: cn("text-sm text-muted-foreground", className),
|
|
379
|
-
...props
|
|
380
|
-
}
|
|
381
|
-
);
|
|
382
|
-
}
|
|
383
262
|
function AlertDialog({
|
|
384
263
|
...props
|
|
385
264
|
}) {
|
|
@@ -627,10 +506,10 @@ function TabsList({
|
|
|
627
506
|
children,
|
|
628
507
|
...props
|
|
629
508
|
}) {
|
|
630
|
-
const listRef =
|
|
509
|
+
const listRef = React5.useRef(null);
|
|
631
510
|
const reduced = useReducedMotion();
|
|
632
|
-
const [pos, setPos] =
|
|
633
|
-
|
|
511
|
+
const [pos, setPos] = React5.useState(null);
|
|
512
|
+
React5.useLayoutEffect(() => {
|
|
634
513
|
const list = listRef.current;
|
|
635
514
|
if (!list) return;
|
|
636
515
|
const measure = () => {
|
|
@@ -1382,136 +1261,30 @@ function DropdownMenuSubContent({ className, ...props }) {
|
|
|
1382
1261
|
}
|
|
1383
1262
|
);
|
|
1384
1263
|
}
|
|
1385
|
-
function Drawer({
|
|
1386
|
-
...props
|
|
1387
|
-
}) {
|
|
1388
|
-
return /* @__PURE__ */ jsx(Drawer$1.Root, { "data-slot": "drawer", ...props });
|
|
1389
|
-
}
|
|
1390
|
-
function DrawerTrigger({
|
|
1391
|
-
...props
|
|
1392
|
-
}) {
|
|
1393
|
-
return /* @__PURE__ */ jsx(Drawer$1.Trigger, { "data-slot": "drawer-trigger", ...props });
|
|
1394
|
-
}
|
|
1395
|
-
function DrawerPortal({
|
|
1396
|
-
...props
|
|
1397
|
-
}) {
|
|
1398
|
-
return /* @__PURE__ */ jsx(Drawer$1.Portal, { "data-slot": "drawer-portal", ...props });
|
|
1399
|
-
}
|
|
1400
|
-
function DrawerClose({
|
|
1401
|
-
...props
|
|
1402
|
-
}) {
|
|
1403
|
-
return /* @__PURE__ */ jsx(Drawer$1.Close, { "data-slot": "drawer-close", ...props });
|
|
1404
|
-
}
|
|
1405
|
-
function DrawerOverlay({
|
|
1406
|
-
className,
|
|
1407
|
-
...props
|
|
1408
|
-
}) {
|
|
1409
|
-
return /* @__PURE__ */ jsx(
|
|
1410
|
-
Drawer$1.Overlay,
|
|
1411
|
-
{
|
|
1412
|
-
"data-slot": "drawer-overlay",
|
|
1413
|
-
className: cn(
|
|
1414
|
-
"fixed inset-0 z-50 bg-black/50 backdrop-blur-[2px]",
|
|
1415
|
-
className
|
|
1416
|
-
),
|
|
1417
|
-
...props
|
|
1418
|
-
}
|
|
1419
|
-
);
|
|
1420
|
-
}
|
|
1421
|
-
function DrawerContent({
|
|
1422
|
-
className,
|
|
1423
|
-
children,
|
|
1424
|
-
...props
|
|
1425
|
-
}) {
|
|
1426
|
-
return /* @__PURE__ */ jsxs(DrawerPortal, { children: [
|
|
1427
|
-
/* @__PURE__ */ jsx(DrawerOverlay, {}),
|
|
1428
|
-
/* @__PURE__ */ jsxs(
|
|
1429
|
-
Drawer$1.Content,
|
|
1430
|
-
{
|
|
1431
|
-
"data-slot": "drawer-content",
|
|
1432
|
-
className: cn(
|
|
1433
|
-
"group/drawer-content fixed inset-x-0 bottom-0 z-50 mt-24 flex max-h-[96dvh] flex-col rounded-t-lg border-t bg-background",
|
|
1434
|
-
className
|
|
1435
|
-
),
|
|
1436
|
-
...props,
|
|
1437
|
-
children: [
|
|
1438
|
-
/* @__PURE__ */ jsx("div", { className: "mx-auto mt-4 h-1.5 w-12 shrink-0 rounded-full bg-muted" }),
|
|
1439
|
-
children
|
|
1440
|
-
]
|
|
1441
|
-
}
|
|
1442
|
-
)
|
|
1443
|
-
] });
|
|
1444
|
-
}
|
|
1445
|
-
function DrawerHeader({ className, ...props }) {
|
|
1446
|
-
return /* @__PURE__ */ jsx(
|
|
1447
|
-
"div",
|
|
1448
|
-
{
|
|
1449
|
-
"data-slot": "drawer-header",
|
|
1450
|
-
className: cn("flex flex-col gap-1.5 p-4", className),
|
|
1451
|
-
...props
|
|
1452
|
-
}
|
|
1453
|
-
);
|
|
1454
|
-
}
|
|
1455
|
-
function DrawerFooter({ className, ...props }) {
|
|
1456
|
-
return /* @__PURE__ */ jsx(
|
|
1457
|
-
"div",
|
|
1458
|
-
{
|
|
1459
|
-
"data-slot": "drawer-footer",
|
|
1460
|
-
className: cn("mt-auto flex flex-col gap-2 p-4", className),
|
|
1461
|
-
...props
|
|
1462
|
-
}
|
|
1463
|
-
);
|
|
1464
|
-
}
|
|
1465
|
-
function DrawerTitle({
|
|
1466
|
-
className,
|
|
1467
|
-
...props
|
|
1468
|
-
}) {
|
|
1469
|
-
return /* @__PURE__ */ jsx(
|
|
1470
|
-
Drawer$1.Title,
|
|
1471
|
-
{
|
|
1472
|
-
"data-slot": "drawer-title",
|
|
1473
|
-
className: cn("text-lg leading-none font-semibold", className),
|
|
1474
|
-
...props
|
|
1475
|
-
}
|
|
1476
|
-
);
|
|
1477
|
-
}
|
|
1478
|
-
function DrawerDescription({
|
|
1479
|
-
className,
|
|
1480
|
-
...props
|
|
1481
|
-
}) {
|
|
1482
|
-
return /* @__PURE__ */ jsx(
|
|
1483
|
-
Drawer$1.Description,
|
|
1484
|
-
{
|
|
1485
|
-
"data-slot": "drawer-description",
|
|
1486
|
-
className: cn("text-sm text-muted-foreground", className),
|
|
1487
|
-
...props
|
|
1488
|
-
}
|
|
1489
|
-
);
|
|
1490
|
-
}
|
|
1491
1264
|
function Sheet({ ...props }) {
|
|
1492
|
-
return /* @__PURE__ */ jsx(
|
|
1265
|
+
return /* @__PURE__ */ jsx(SheetPrimitive.Root, { "data-slot": "sheet", ...props });
|
|
1493
1266
|
}
|
|
1494
1267
|
function SheetTrigger({
|
|
1495
1268
|
...props
|
|
1496
1269
|
}) {
|
|
1497
|
-
return /* @__PURE__ */ jsx(
|
|
1270
|
+
return /* @__PURE__ */ jsx(SheetPrimitive.Trigger, { "data-slot": "sheet-trigger", ...props });
|
|
1498
1271
|
}
|
|
1499
1272
|
function SheetClose({
|
|
1500
1273
|
...props
|
|
1501
1274
|
}) {
|
|
1502
|
-
return /* @__PURE__ */ jsx(
|
|
1275
|
+
return /* @__PURE__ */ jsx(SheetPrimitive.Close, { "data-slot": "sheet-close", ...props });
|
|
1503
1276
|
}
|
|
1504
1277
|
function SheetPortal({
|
|
1505
1278
|
...props
|
|
1506
1279
|
}) {
|
|
1507
|
-
return /* @__PURE__ */ jsx(
|
|
1280
|
+
return /* @__PURE__ */ jsx(SheetPrimitive.Portal, { "data-slot": "sheet-portal", ...props });
|
|
1508
1281
|
}
|
|
1509
1282
|
function SheetOverlay({
|
|
1510
1283
|
className,
|
|
1511
1284
|
...props
|
|
1512
1285
|
}) {
|
|
1513
1286
|
return /* @__PURE__ */ jsx(
|
|
1514
|
-
|
|
1287
|
+
SheetPrimitive.Overlay,
|
|
1515
1288
|
{
|
|
1516
1289
|
"data-slot": "sheet-overlay",
|
|
1517
1290
|
className: cn(
|
|
@@ -1532,7 +1305,7 @@ function SheetContent({
|
|
|
1532
1305
|
return /* @__PURE__ */ jsxs(SheetPortal, { children: [
|
|
1533
1306
|
/* @__PURE__ */ jsx(SheetOverlay, {}),
|
|
1534
1307
|
/* @__PURE__ */ jsxs(
|
|
1535
|
-
|
|
1308
|
+
SheetPrimitive.Content,
|
|
1536
1309
|
{
|
|
1537
1310
|
"data-slot": "sheet-content",
|
|
1538
1311
|
className: cn(
|
|
@@ -1546,7 +1319,7 @@ function SheetContent({
|
|
|
1546
1319
|
...props,
|
|
1547
1320
|
children: [
|
|
1548
1321
|
children,
|
|
1549
|
-
showCloseButton && /* @__PURE__ */ jsxs(
|
|
1322
|
+
showCloseButton && /* @__PURE__ */ jsxs(SheetPrimitive.Close, { className: "absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary", children: [
|
|
1550
1323
|
/* @__PURE__ */ jsx(XIcon, { className: "size-4" }),
|
|
1551
1324
|
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
1552
1325
|
] })
|
|
@@ -1580,7 +1353,7 @@ function SheetTitle({
|
|
|
1580
1353
|
...props
|
|
1581
1354
|
}) {
|
|
1582
1355
|
return /* @__PURE__ */ jsx(
|
|
1583
|
-
|
|
1356
|
+
SheetPrimitive.Title,
|
|
1584
1357
|
{
|
|
1585
1358
|
"data-slot": "sheet-title",
|
|
1586
1359
|
className: cn("font-semibold text-foreground", className),
|
|
@@ -1593,7 +1366,7 @@ function SheetDescription({
|
|
|
1593
1366
|
...props
|
|
1594
1367
|
}) {
|
|
1595
1368
|
return /* @__PURE__ */ jsx(
|
|
1596
|
-
|
|
1369
|
+
SheetPrimitive.Description,
|
|
1597
1370
|
{
|
|
1598
1371
|
"data-slot": "sheet-description",
|
|
1599
1372
|
className: cn("text-sm text-muted-foreground", className),
|
|
@@ -1609,7 +1382,7 @@ function Slider({
|
|
|
1609
1382
|
max = 100,
|
|
1610
1383
|
...props
|
|
1611
1384
|
}) {
|
|
1612
|
-
const _values =
|
|
1385
|
+
const _values = React5.useMemo(
|
|
1613
1386
|
() => value ?? defaultValue ?? [min],
|
|
1614
1387
|
[value, defaultValue, min]
|
|
1615
1388
|
);
|
|
@@ -2458,7 +2231,7 @@ function Toggle({
|
|
|
2458
2231
|
}
|
|
2459
2232
|
);
|
|
2460
2233
|
}
|
|
2461
|
-
var ToggleGroupContext =
|
|
2234
|
+
var ToggleGroupContext = React5.createContext({
|
|
2462
2235
|
size: "default",
|
|
2463
2236
|
variant: "default",
|
|
2464
2237
|
spacing: 0
|
|
@@ -2495,7 +2268,7 @@ function ToggleGroupItem({
|
|
|
2495
2268
|
size,
|
|
2496
2269
|
...props
|
|
2497
2270
|
}) {
|
|
2498
|
-
const context =
|
|
2271
|
+
const context = React5.useContext(ToggleGroupContext);
|
|
2499
2272
|
return /* @__PURE__ */ jsx(
|
|
2500
2273
|
ToggleGroupPrimitive.Item,
|
|
2501
2274
|
{
|
|
@@ -2517,183 +2290,6 @@ function ToggleGroupItem({
|
|
|
2517
2290
|
}
|
|
2518
2291
|
);
|
|
2519
2292
|
}
|
|
2520
|
-
function Calendar({
|
|
2521
|
-
className,
|
|
2522
|
-
classNames,
|
|
2523
|
-
showOutsideDays = true,
|
|
2524
|
-
captionLayout = "label",
|
|
2525
|
-
buttonVariant = "ghost",
|
|
2526
|
-
formatters,
|
|
2527
|
-
components,
|
|
2528
|
-
...props
|
|
2529
|
-
}) {
|
|
2530
|
-
const defaultClassNames = getDefaultClassNames();
|
|
2531
|
-
return /* @__PURE__ */ jsx(
|
|
2532
|
-
DayPicker,
|
|
2533
|
-
{
|
|
2534
|
-
showOutsideDays,
|
|
2535
|
-
className: cn(
|
|
2536
|
-
"group/calendar bg-background p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
|
|
2537
|
-
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
2538
|
-
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
2539
|
-
className
|
|
2540
|
-
),
|
|
2541
|
-
captionLayout,
|
|
2542
|
-
formatters: {
|
|
2543
|
-
formatMonthDropdown: (date) => date.toLocaleString("default", { month: "short" }),
|
|
2544
|
-
...formatters
|
|
2545
|
-
},
|
|
2546
|
-
classNames: {
|
|
2547
|
-
root: cn("w-fit", defaultClassNames.root),
|
|
2548
|
-
months: cn(
|
|
2549
|
-
"relative flex flex-col gap-4 md:flex-row",
|
|
2550
|
-
defaultClassNames.months
|
|
2551
|
-
),
|
|
2552
|
-
month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
|
|
2553
|
-
nav: cn(
|
|
2554
|
-
"absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",
|
|
2555
|
-
defaultClassNames.nav
|
|
2556
|
-
),
|
|
2557
|
-
button_previous: cn(
|
|
2558
|
-
buttonVariants({ variant: buttonVariant }),
|
|
2559
|
-
"size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
|
|
2560
|
-
defaultClassNames.button_previous
|
|
2561
|
-
),
|
|
2562
|
-
button_next: cn(
|
|
2563
|
-
buttonVariants({ variant: buttonVariant }),
|
|
2564
|
-
"size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
|
|
2565
|
-
defaultClassNames.button_next
|
|
2566
|
-
),
|
|
2567
|
-
month_caption: cn(
|
|
2568
|
-
"flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)",
|
|
2569
|
-
defaultClassNames.month_caption
|
|
2570
|
-
),
|
|
2571
|
-
dropdowns: cn(
|
|
2572
|
-
"flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium",
|
|
2573
|
-
defaultClassNames.dropdowns
|
|
2574
|
-
),
|
|
2575
|
-
dropdown_root: cn(
|
|
2576
|
-
"relative rounded-md border border-input shadow-xs has-focus:border-ring has-focus:ring-[3px] has-focus:ring-ring/50",
|
|
2577
|
-
defaultClassNames.dropdown_root
|
|
2578
|
-
),
|
|
2579
|
-
dropdown: cn(
|
|
2580
|
-
"absolute inset-0 bg-popover opacity-0",
|
|
2581
|
-
defaultClassNames.dropdown
|
|
2582
|
-
),
|
|
2583
|
-
caption_label: cn(
|
|
2584
|
-
"font-medium select-none",
|
|
2585
|
-
captionLayout === "label" ? "text-sm" : "flex h-8 items-center gap-1 rounded-md pr-1 pl-2 text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground",
|
|
2586
|
-
defaultClassNames.caption_label
|
|
2587
|
-
),
|
|
2588
|
-
table: "w-full border-collapse",
|
|
2589
|
-
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
2590
|
-
weekday: cn(
|
|
2591
|
-
"flex-1 rounded-md text-[0.8rem] font-normal text-muted-foreground select-none",
|
|
2592
|
-
defaultClassNames.weekday
|
|
2593
|
-
),
|
|
2594
|
-
week: cn("mt-2 flex w-full", defaultClassNames.week),
|
|
2595
|
-
week_number_header: cn(
|
|
2596
|
-
"w-(--cell-size) select-none",
|
|
2597
|
-
defaultClassNames.week_number_header
|
|
2598
|
-
),
|
|
2599
|
-
week_number: cn(
|
|
2600
|
-
"text-[0.8rem] text-muted-foreground select-none",
|
|
2601
|
-
defaultClassNames.week_number
|
|
2602
|
-
),
|
|
2603
|
-
day: cn(
|
|
2604
|
-
"group/day relative aspect-square h-full w-full p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-md",
|
|
2605
|
-
props.showWeekNumber ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-md" : "[&:first-child[data-selected=true]_button]:rounded-l-md",
|
|
2606
|
-
defaultClassNames.day
|
|
2607
|
-
),
|
|
2608
|
-
range_start: cn(
|
|
2609
|
-
"rounded-l-md bg-accent",
|
|
2610
|
-
defaultClassNames.range_start
|
|
2611
|
-
),
|
|
2612
|
-
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
2613
|
-
range_end: cn("rounded-r-md bg-accent", defaultClassNames.range_end),
|
|
2614
|
-
today: cn(
|
|
2615
|
-
"rounded-md bg-accent text-accent-foreground data-[selected=true]:rounded-none",
|
|
2616
|
-
defaultClassNames.today
|
|
2617
|
-
),
|
|
2618
|
-
outside: cn(
|
|
2619
|
-
"text-muted-foreground aria-selected:text-muted-foreground",
|
|
2620
|
-
defaultClassNames.outside
|
|
2621
|
-
),
|
|
2622
|
-
disabled: cn(
|
|
2623
|
-
"text-muted-foreground opacity-50",
|
|
2624
|
-
defaultClassNames.disabled
|
|
2625
|
-
),
|
|
2626
|
-
hidden: cn("invisible", defaultClassNames.hidden),
|
|
2627
|
-
...classNames
|
|
2628
|
-
},
|
|
2629
|
-
components: {
|
|
2630
|
-
Root: ({ className: className2, rootRef, ...props2 }) => {
|
|
2631
|
-
return /* @__PURE__ */ jsx(
|
|
2632
|
-
"div",
|
|
2633
|
-
{
|
|
2634
|
-
"data-slot": "calendar",
|
|
2635
|
-
ref: rootRef,
|
|
2636
|
-
className: cn(className2),
|
|
2637
|
-
...props2
|
|
2638
|
-
}
|
|
2639
|
-
);
|
|
2640
|
-
},
|
|
2641
|
-
Chevron: ({ className: className2, orientation, ...props2 }) => {
|
|
2642
|
-
if (orientation === "left") {
|
|
2643
|
-
return /* @__PURE__ */ jsx(ChevronLeftIcon, { className: cn("size-4", className2), ...props2 });
|
|
2644
|
-
}
|
|
2645
|
-
if (orientation === "right") {
|
|
2646
|
-
return /* @__PURE__ */ jsx(
|
|
2647
|
-
ChevronRightIcon,
|
|
2648
|
-
{
|
|
2649
|
-
className: cn("size-4", className2),
|
|
2650
|
-
...props2
|
|
2651
|
-
}
|
|
2652
|
-
);
|
|
2653
|
-
}
|
|
2654
|
-
return /* @__PURE__ */ jsx(ChevronDownIcon, { className: cn("size-4", className2), ...props2 });
|
|
2655
|
-
},
|
|
2656
|
-
DayButton: CalendarDayButton,
|
|
2657
|
-
WeekNumber: ({ children, ...props2 }) => {
|
|
2658
|
-
return /* @__PURE__ */ jsx("td", { ...props2, children: /* @__PURE__ */ jsx("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children }) });
|
|
2659
|
-
},
|
|
2660
|
-
...components
|
|
2661
|
-
},
|
|
2662
|
-
...props
|
|
2663
|
-
}
|
|
2664
|
-
);
|
|
2665
|
-
}
|
|
2666
|
-
function CalendarDayButton({
|
|
2667
|
-
className,
|
|
2668
|
-
day,
|
|
2669
|
-
modifiers,
|
|
2670
|
-
...props
|
|
2671
|
-
}) {
|
|
2672
|
-
const defaultClassNames = getDefaultClassNames();
|
|
2673
|
-
const ref = React9.useRef(null);
|
|
2674
|
-
React9.useEffect(() => {
|
|
2675
|
-
if (modifiers.focused) ref.current?.focus();
|
|
2676
|
-
}, [modifiers.focused]);
|
|
2677
|
-
return /* @__PURE__ */ jsx(
|
|
2678
|
-
Button,
|
|
2679
|
-
{
|
|
2680
|
-
ref,
|
|
2681
|
-
variant: "ghost",
|
|
2682
|
-
size: "icon",
|
|
2683
|
-
"data-day": day.date.toLocaleDateString(),
|
|
2684
|
-
"data-selected-single": modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle,
|
|
2685
|
-
"data-range-start": modifiers.range_start,
|
|
2686
|
-
"data-range-end": modifiers.range_end,
|
|
2687
|
-
"data-range-middle": modifiers.range_middle,
|
|
2688
|
-
className: cn(
|
|
2689
|
-
"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:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-accent-foreground [&>span]:text-xs [&>span]:opacity-70",
|
|
2690
|
-
defaultClassNames.day,
|
|
2691
|
-
className
|
|
2692
|
-
),
|
|
2693
|
-
...props
|
|
2694
|
-
}
|
|
2695
|
-
);
|
|
2696
|
-
}
|
|
2697
2293
|
function RadioGroup4({
|
|
2698
2294
|
className,
|
|
2699
2295
|
...props
|
|
@@ -2822,44 +2418,1124 @@ function ScrollBar({
|
|
|
2822
2418
|
}
|
|
2823
2419
|
);
|
|
2824
2420
|
}
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
}
|
|
2847
|
-
);
|
|
2421
|
+
function __insertCSS(code) {
|
|
2422
|
+
if (typeof document == "undefined") return;
|
|
2423
|
+
let head = document.head || document.getElementsByTagName("head")[0];
|
|
2424
|
+
let style = document.createElement("style");
|
|
2425
|
+
style.type = "text/css";
|
|
2426
|
+
head.appendChild(style);
|
|
2427
|
+
style.styleSheet ? style.styleSheet.cssText = code : style.appendChild(document.createTextNode(code));
|
|
2428
|
+
}
|
|
2429
|
+
var getAsset = (type) => {
|
|
2430
|
+
switch (type) {
|
|
2431
|
+
case "success":
|
|
2432
|
+
return SuccessIcon;
|
|
2433
|
+
case "info":
|
|
2434
|
+
return InfoIcon;
|
|
2435
|
+
case "warning":
|
|
2436
|
+
return WarningIcon;
|
|
2437
|
+
case "error":
|
|
2438
|
+
return ErrorIcon;
|
|
2439
|
+
default:
|
|
2440
|
+
return null;
|
|
2441
|
+
}
|
|
2848
2442
|
};
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2443
|
+
var bars = Array(12).fill(0);
|
|
2444
|
+
var Loader = ({ visible, className }) => {
|
|
2445
|
+
return /* @__PURE__ */ React5__default.createElement("div", {
|
|
2446
|
+
className: [
|
|
2447
|
+
"sonner-loading-wrapper",
|
|
2448
|
+
className
|
|
2449
|
+
].filter(Boolean).join(" "),
|
|
2450
|
+
"data-visible": visible
|
|
2451
|
+
}, /* @__PURE__ */ React5__default.createElement("div", {
|
|
2452
|
+
className: "sonner-spinner"
|
|
2453
|
+
}, bars.map((_, i) => /* @__PURE__ */ React5__default.createElement("div", {
|
|
2454
|
+
className: "sonner-loading-bar",
|
|
2455
|
+
key: `spinner-bar-${i}`
|
|
2456
|
+
}))));
|
|
2457
|
+
};
|
|
2458
|
+
var SuccessIcon = /* @__PURE__ */ React5__default.createElement("svg", {
|
|
2459
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2460
|
+
viewBox: "0 0 20 20",
|
|
2461
|
+
fill: "currentColor",
|
|
2462
|
+
height: "20",
|
|
2463
|
+
width: "20"
|
|
2464
|
+
}, /* @__PURE__ */ React5__default.createElement("path", {
|
|
2465
|
+
fillRule: "evenodd",
|
|
2466
|
+
d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",
|
|
2467
|
+
clipRule: "evenodd"
|
|
2468
|
+
}));
|
|
2469
|
+
var WarningIcon = /* @__PURE__ */ React5__default.createElement("svg", {
|
|
2470
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2471
|
+
viewBox: "0 0 24 24",
|
|
2472
|
+
fill: "currentColor",
|
|
2473
|
+
height: "20",
|
|
2474
|
+
width: "20"
|
|
2475
|
+
}, /* @__PURE__ */ React5__default.createElement("path", {
|
|
2476
|
+
fillRule: "evenodd",
|
|
2477
|
+
d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",
|
|
2478
|
+
clipRule: "evenodd"
|
|
2479
|
+
}));
|
|
2480
|
+
var InfoIcon = /* @__PURE__ */ React5__default.createElement("svg", {
|
|
2481
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2482
|
+
viewBox: "0 0 20 20",
|
|
2483
|
+
fill: "currentColor",
|
|
2484
|
+
height: "20",
|
|
2485
|
+
width: "20"
|
|
2486
|
+
}, /* @__PURE__ */ React5__default.createElement("path", {
|
|
2487
|
+
fillRule: "evenodd",
|
|
2488
|
+
d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",
|
|
2489
|
+
clipRule: "evenodd"
|
|
2490
|
+
}));
|
|
2491
|
+
var ErrorIcon = /* @__PURE__ */ React5__default.createElement("svg", {
|
|
2492
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2493
|
+
viewBox: "0 0 20 20",
|
|
2494
|
+
fill: "currentColor",
|
|
2495
|
+
height: "20",
|
|
2496
|
+
width: "20"
|
|
2497
|
+
}, /* @__PURE__ */ React5__default.createElement("path", {
|
|
2498
|
+
fillRule: "evenodd",
|
|
2499
|
+
d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",
|
|
2500
|
+
clipRule: "evenodd"
|
|
2501
|
+
}));
|
|
2502
|
+
var CloseIcon = /* @__PURE__ */ React5__default.createElement("svg", {
|
|
2503
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2504
|
+
width: "12",
|
|
2505
|
+
height: "12",
|
|
2506
|
+
viewBox: "0 0 24 24",
|
|
2507
|
+
fill: "none",
|
|
2508
|
+
stroke: "currentColor",
|
|
2509
|
+
strokeWidth: "1.5",
|
|
2510
|
+
strokeLinecap: "round",
|
|
2511
|
+
strokeLinejoin: "round"
|
|
2512
|
+
}, /* @__PURE__ */ React5__default.createElement("line", {
|
|
2513
|
+
x1: "18",
|
|
2514
|
+
y1: "6",
|
|
2515
|
+
x2: "6",
|
|
2516
|
+
y2: "18"
|
|
2517
|
+
}), /* @__PURE__ */ React5__default.createElement("line", {
|
|
2518
|
+
x1: "6",
|
|
2519
|
+
y1: "6",
|
|
2520
|
+
x2: "18",
|
|
2521
|
+
y2: "18"
|
|
2522
|
+
}));
|
|
2523
|
+
var useIsDocumentHidden = () => {
|
|
2524
|
+
const [isDocumentHidden, setIsDocumentHidden] = React5__default.useState(document.hidden);
|
|
2525
|
+
React5__default.useEffect(() => {
|
|
2526
|
+
const callback = () => {
|
|
2527
|
+
setIsDocumentHidden(document.hidden);
|
|
2528
|
+
};
|
|
2529
|
+
document.addEventListener("visibilitychange", callback);
|
|
2530
|
+
return () => window.removeEventListener("visibilitychange", callback);
|
|
2531
|
+
}, []);
|
|
2532
|
+
return isDocumentHidden;
|
|
2533
|
+
};
|
|
2534
|
+
var toastsCounter = 1;
|
|
2535
|
+
var Observer = class {
|
|
2536
|
+
constructor() {
|
|
2537
|
+
this.subscribe = (subscriber) => {
|
|
2538
|
+
this.subscribers.push(subscriber);
|
|
2539
|
+
return () => {
|
|
2540
|
+
const index = this.subscribers.indexOf(subscriber);
|
|
2541
|
+
this.subscribers.splice(index, 1);
|
|
2542
|
+
};
|
|
2543
|
+
};
|
|
2544
|
+
this.publish = (data) => {
|
|
2545
|
+
this.subscribers.forEach((subscriber) => subscriber(data));
|
|
2546
|
+
};
|
|
2547
|
+
this.addToast = (data) => {
|
|
2548
|
+
this.publish(data);
|
|
2549
|
+
this.toasts = [
|
|
2550
|
+
...this.toasts,
|
|
2551
|
+
data
|
|
2552
|
+
];
|
|
2553
|
+
};
|
|
2554
|
+
this.create = (data) => {
|
|
2555
|
+
var _data_id;
|
|
2556
|
+
const { message, ...rest } = data;
|
|
2557
|
+
const id = typeof (data == null ? void 0 : data.id) === "number" || ((_data_id = data.id) == null ? void 0 : _data_id.length) > 0 ? data.id : toastsCounter++;
|
|
2558
|
+
const alreadyExists = this.toasts.find((toast2) => {
|
|
2559
|
+
return toast2.id === id;
|
|
2560
|
+
});
|
|
2561
|
+
const dismissible = data.dismissible === void 0 ? true : data.dismissible;
|
|
2562
|
+
if (this.dismissedToasts.has(id)) {
|
|
2563
|
+
this.dismissedToasts.delete(id);
|
|
2564
|
+
}
|
|
2565
|
+
if (alreadyExists) {
|
|
2566
|
+
this.toasts = this.toasts.map((toast2) => {
|
|
2567
|
+
if (toast2.id === id) {
|
|
2568
|
+
this.publish({
|
|
2569
|
+
...toast2,
|
|
2570
|
+
...data,
|
|
2571
|
+
id,
|
|
2572
|
+
title: message
|
|
2573
|
+
});
|
|
2574
|
+
return {
|
|
2575
|
+
...toast2,
|
|
2576
|
+
...data,
|
|
2577
|
+
id,
|
|
2578
|
+
dismissible,
|
|
2579
|
+
title: message
|
|
2580
|
+
};
|
|
2581
|
+
}
|
|
2582
|
+
return toast2;
|
|
2583
|
+
});
|
|
2584
|
+
} else {
|
|
2585
|
+
this.addToast({
|
|
2586
|
+
title: message,
|
|
2587
|
+
...rest,
|
|
2588
|
+
dismissible,
|
|
2589
|
+
id
|
|
2590
|
+
});
|
|
2591
|
+
}
|
|
2592
|
+
return id;
|
|
2593
|
+
};
|
|
2594
|
+
this.dismiss = (id) => {
|
|
2595
|
+
if (id) {
|
|
2596
|
+
this.dismissedToasts.add(id);
|
|
2597
|
+
requestAnimationFrame(() => this.subscribers.forEach((subscriber) => subscriber({
|
|
2598
|
+
id,
|
|
2599
|
+
dismiss: true
|
|
2600
|
+
})));
|
|
2601
|
+
} else {
|
|
2602
|
+
this.toasts.forEach((toast2) => {
|
|
2603
|
+
this.subscribers.forEach((subscriber) => subscriber({
|
|
2604
|
+
id: toast2.id,
|
|
2605
|
+
dismiss: true
|
|
2606
|
+
}));
|
|
2607
|
+
});
|
|
2608
|
+
}
|
|
2609
|
+
return id;
|
|
2610
|
+
};
|
|
2611
|
+
this.message = (message, data) => {
|
|
2612
|
+
return this.create({
|
|
2613
|
+
...data,
|
|
2614
|
+
message
|
|
2615
|
+
});
|
|
2616
|
+
};
|
|
2617
|
+
this.error = (message, data) => {
|
|
2618
|
+
return this.create({
|
|
2619
|
+
...data,
|
|
2620
|
+
message,
|
|
2621
|
+
type: "error"
|
|
2622
|
+
});
|
|
2623
|
+
};
|
|
2624
|
+
this.success = (message, data) => {
|
|
2625
|
+
return this.create({
|
|
2626
|
+
...data,
|
|
2627
|
+
type: "success",
|
|
2628
|
+
message
|
|
2629
|
+
});
|
|
2630
|
+
};
|
|
2631
|
+
this.info = (message, data) => {
|
|
2632
|
+
return this.create({
|
|
2633
|
+
...data,
|
|
2634
|
+
type: "info",
|
|
2635
|
+
message
|
|
2636
|
+
});
|
|
2637
|
+
};
|
|
2638
|
+
this.warning = (message, data) => {
|
|
2639
|
+
return this.create({
|
|
2640
|
+
...data,
|
|
2641
|
+
type: "warning",
|
|
2642
|
+
message
|
|
2643
|
+
});
|
|
2644
|
+
};
|
|
2645
|
+
this.loading = (message, data) => {
|
|
2646
|
+
return this.create({
|
|
2647
|
+
...data,
|
|
2648
|
+
type: "loading",
|
|
2649
|
+
message
|
|
2650
|
+
});
|
|
2651
|
+
};
|
|
2652
|
+
this.promise = (promise, data) => {
|
|
2653
|
+
if (!data) {
|
|
2654
|
+
return;
|
|
2655
|
+
}
|
|
2656
|
+
let id = void 0;
|
|
2657
|
+
if (data.loading !== void 0) {
|
|
2658
|
+
id = this.create({
|
|
2659
|
+
...data,
|
|
2660
|
+
promise,
|
|
2661
|
+
type: "loading",
|
|
2662
|
+
message: data.loading,
|
|
2663
|
+
description: typeof data.description !== "function" ? data.description : void 0
|
|
2664
|
+
});
|
|
2665
|
+
}
|
|
2666
|
+
const p = Promise.resolve(promise instanceof Function ? promise() : promise);
|
|
2667
|
+
let shouldDismiss = id !== void 0;
|
|
2668
|
+
let result;
|
|
2669
|
+
const originalPromise = p.then(async (response) => {
|
|
2670
|
+
result = [
|
|
2671
|
+
"resolve",
|
|
2672
|
+
response
|
|
2673
|
+
];
|
|
2674
|
+
const isReactElementResponse = React5__default.isValidElement(response);
|
|
2675
|
+
if (isReactElementResponse) {
|
|
2676
|
+
shouldDismiss = false;
|
|
2677
|
+
this.create({
|
|
2678
|
+
id,
|
|
2679
|
+
type: "default",
|
|
2680
|
+
message: response
|
|
2681
|
+
});
|
|
2682
|
+
} else if (isHttpResponse(response) && !response.ok) {
|
|
2683
|
+
shouldDismiss = false;
|
|
2684
|
+
const promiseData = typeof data.error === "function" ? await data.error(`HTTP error! status: ${response.status}`) : data.error;
|
|
2685
|
+
const description = typeof data.description === "function" ? await data.description(`HTTP error! status: ${response.status}`) : data.description;
|
|
2686
|
+
const isExtendedResult = typeof promiseData === "object" && !React5__default.isValidElement(promiseData);
|
|
2687
|
+
const toastSettings = isExtendedResult ? promiseData : {
|
|
2688
|
+
message: promiseData
|
|
2689
|
+
};
|
|
2690
|
+
this.create({
|
|
2691
|
+
id,
|
|
2692
|
+
type: "error",
|
|
2693
|
+
description,
|
|
2694
|
+
...toastSettings
|
|
2695
|
+
});
|
|
2696
|
+
} else if (response instanceof Error) {
|
|
2697
|
+
shouldDismiss = false;
|
|
2698
|
+
const promiseData = typeof data.error === "function" ? await data.error(response) : data.error;
|
|
2699
|
+
const description = typeof data.description === "function" ? await data.description(response) : data.description;
|
|
2700
|
+
const isExtendedResult = typeof promiseData === "object" && !React5__default.isValidElement(promiseData);
|
|
2701
|
+
const toastSettings = isExtendedResult ? promiseData : {
|
|
2702
|
+
message: promiseData
|
|
2703
|
+
};
|
|
2704
|
+
this.create({
|
|
2705
|
+
id,
|
|
2706
|
+
type: "error",
|
|
2707
|
+
description,
|
|
2708
|
+
...toastSettings
|
|
2709
|
+
});
|
|
2710
|
+
} else if (data.success !== void 0) {
|
|
2711
|
+
shouldDismiss = false;
|
|
2712
|
+
const promiseData = typeof data.success === "function" ? await data.success(response) : data.success;
|
|
2713
|
+
const description = typeof data.description === "function" ? await data.description(response) : data.description;
|
|
2714
|
+
const isExtendedResult = typeof promiseData === "object" && !React5__default.isValidElement(promiseData);
|
|
2715
|
+
const toastSettings = isExtendedResult ? promiseData : {
|
|
2716
|
+
message: promiseData
|
|
2717
|
+
};
|
|
2718
|
+
this.create({
|
|
2719
|
+
id,
|
|
2720
|
+
type: "success",
|
|
2721
|
+
description,
|
|
2722
|
+
...toastSettings
|
|
2723
|
+
});
|
|
2724
|
+
}
|
|
2725
|
+
}).catch(async (error) => {
|
|
2726
|
+
result = [
|
|
2727
|
+
"reject",
|
|
2728
|
+
error
|
|
2729
|
+
];
|
|
2730
|
+
if (data.error !== void 0) {
|
|
2731
|
+
shouldDismiss = false;
|
|
2732
|
+
const promiseData = typeof data.error === "function" ? await data.error(error) : data.error;
|
|
2733
|
+
const description = typeof data.description === "function" ? await data.description(error) : data.description;
|
|
2734
|
+
const isExtendedResult = typeof promiseData === "object" && !React5__default.isValidElement(promiseData);
|
|
2735
|
+
const toastSettings = isExtendedResult ? promiseData : {
|
|
2736
|
+
message: promiseData
|
|
2737
|
+
};
|
|
2738
|
+
this.create({
|
|
2739
|
+
id,
|
|
2740
|
+
type: "error",
|
|
2741
|
+
description,
|
|
2742
|
+
...toastSettings
|
|
2743
|
+
});
|
|
2744
|
+
}
|
|
2745
|
+
}).finally(() => {
|
|
2746
|
+
if (shouldDismiss) {
|
|
2747
|
+
this.dismiss(id);
|
|
2748
|
+
id = void 0;
|
|
2749
|
+
}
|
|
2750
|
+
data.finally == null ? void 0 : data.finally.call(data);
|
|
2751
|
+
});
|
|
2752
|
+
const unwrap = () => new Promise((resolve, reject) => originalPromise.then(() => result[0] === "reject" ? reject(result[1]) : resolve(result[1])).catch(reject));
|
|
2753
|
+
if (typeof id !== "string" && typeof id !== "number") {
|
|
2754
|
+
return {
|
|
2755
|
+
unwrap
|
|
2756
|
+
};
|
|
2757
|
+
} else {
|
|
2758
|
+
return Object.assign(id, {
|
|
2759
|
+
unwrap
|
|
2760
|
+
});
|
|
2761
|
+
}
|
|
2762
|
+
};
|
|
2763
|
+
this.custom = (jsx65, data) => {
|
|
2764
|
+
const id = (data == null ? void 0 : data.id) || toastsCounter++;
|
|
2765
|
+
this.create({
|
|
2766
|
+
jsx: jsx65(id),
|
|
2767
|
+
id,
|
|
2768
|
+
...data
|
|
2769
|
+
});
|
|
2770
|
+
return id;
|
|
2771
|
+
};
|
|
2772
|
+
this.getActiveToasts = () => {
|
|
2773
|
+
return this.toasts.filter((toast2) => !this.dismissedToasts.has(toast2.id));
|
|
2774
|
+
};
|
|
2775
|
+
this.subscribers = [];
|
|
2776
|
+
this.toasts = [];
|
|
2777
|
+
this.dismissedToasts = /* @__PURE__ */ new Set();
|
|
2778
|
+
}
|
|
2779
|
+
};
|
|
2780
|
+
var ToastState = new Observer();
|
|
2781
|
+
var toastFunction = (message, data) => {
|
|
2782
|
+
const id = (data == null ? void 0 : data.id) || toastsCounter++;
|
|
2783
|
+
ToastState.addToast({
|
|
2784
|
+
title: message,
|
|
2785
|
+
...data,
|
|
2786
|
+
id
|
|
2787
|
+
});
|
|
2788
|
+
return id;
|
|
2789
|
+
};
|
|
2790
|
+
var isHttpResponse = (data) => {
|
|
2791
|
+
return data && typeof data === "object" && "ok" in data && typeof data.ok === "boolean" && "status" in data && typeof data.status === "number";
|
|
2792
|
+
};
|
|
2793
|
+
var basicToast = toastFunction;
|
|
2794
|
+
var getHistory = () => ToastState.toasts;
|
|
2795
|
+
var getToasts = () => ToastState.getActiveToasts();
|
|
2796
|
+
Object.assign(basicToast, {
|
|
2797
|
+
success: ToastState.success,
|
|
2798
|
+
info: ToastState.info,
|
|
2799
|
+
warning: ToastState.warning,
|
|
2800
|
+
error: ToastState.error,
|
|
2801
|
+
custom: ToastState.custom,
|
|
2802
|
+
message: ToastState.message,
|
|
2803
|
+
promise: ToastState.promise,
|
|
2804
|
+
dismiss: ToastState.dismiss,
|
|
2805
|
+
loading: ToastState.loading
|
|
2806
|
+
}, {
|
|
2807
|
+
getHistory,
|
|
2808
|
+
getToasts
|
|
2809
|
+
});
|
|
2810
|
+
__insertCSS("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");
|
|
2811
|
+
function isAction(action) {
|
|
2812
|
+
return action.label !== void 0;
|
|
2813
|
+
}
|
|
2814
|
+
var VISIBLE_TOASTS_AMOUNT = 3;
|
|
2815
|
+
var VIEWPORT_OFFSET = "24px";
|
|
2816
|
+
var MOBILE_VIEWPORT_OFFSET = "16px";
|
|
2817
|
+
var TOAST_LIFETIME = 4e3;
|
|
2818
|
+
var TOAST_WIDTH = 356;
|
|
2819
|
+
var GAP = 14;
|
|
2820
|
+
var SWIPE_THRESHOLD = 45;
|
|
2821
|
+
var TIME_BEFORE_UNMOUNT = 200;
|
|
2822
|
+
function cn2(...classes) {
|
|
2823
|
+
return classes.filter(Boolean).join(" ");
|
|
2824
|
+
}
|
|
2825
|
+
function getDefaultSwipeDirections(position) {
|
|
2826
|
+
const [y, x] = position.split("-");
|
|
2827
|
+
const directions = [];
|
|
2828
|
+
if (y) {
|
|
2829
|
+
directions.push(y);
|
|
2830
|
+
}
|
|
2831
|
+
if (x) {
|
|
2832
|
+
directions.push(x);
|
|
2833
|
+
}
|
|
2834
|
+
return directions;
|
|
2835
|
+
}
|
|
2836
|
+
var Toast = (props) => {
|
|
2837
|
+
var _toast_classNames, _toast_classNames1, _toast_classNames2, _toast_classNames3, _toast_classNames4, _toast_classNames5, _toast_classNames6, _toast_classNames7, _toast_classNames8;
|
|
2838
|
+
const { invert: ToasterInvert, toast: toast2, unstyled, interacting, setHeights, visibleToasts, heights, index, toasts, expanded, removeToast, defaultRichColors, closeButton: closeButtonFromToaster, style, cancelButtonStyle, actionButtonStyle, className = "", descriptionClassName = "", duration: durationFromToaster, position, gap, expandByDefault, classNames, icons, closeButtonAriaLabel = "Close toast" } = props;
|
|
2839
|
+
const [swipeDirection, setSwipeDirection] = React5__default.useState(null);
|
|
2840
|
+
const [swipeOutDirection, setSwipeOutDirection] = React5__default.useState(null);
|
|
2841
|
+
const [mounted, setMounted] = React5__default.useState(false);
|
|
2842
|
+
const [removed, setRemoved] = React5__default.useState(false);
|
|
2843
|
+
const [swiping, setSwiping] = React5__default.useState(false);
|
|
2844
|
+
const [swipeOut, setSwipeOut] = React5__default.useState(false);
|
|
2845
|
+
const [isSwiped, setIsSwiped] = React5__default.useState(false);
|
|
2846
|
+
const [offsetBeforeRemove, setOffsetBeforeRemove] = React5__default.useState(0);
|
|
2847
|
+
const [initialHeight, setInitialHeight] = React5__default.useState(0);
|
|
2848
|
+
const remainingTime = React5__default.useRef(toast2.duration || durationFromToaster || TOAST_LIFETIME);
|
|
2849
|
+
const dragStartTime = React5__default.useRef(null);
|
|
2850
|
+
const toastRef = React5__default.useRef(null);
|
|
2851
|
+
const isFront = index === 0;
|
|
2852
|
+
const isVisible = index + 1 <= visibleToasts;
|
|
2853
|
+
const toastType = toast2.type;
|
|
2854
|
+
const dismissible = toast2.dismissible !== false;
|
|
2855
|
+
const toastClassname = toast2.className || "";
|
|
2856
|
+
const toastDescriptionClassname = toast2.descriptionClassName || "";
|
|
2857
|
+
const heightIndex = React5__default.useMemo(() => heights.findIndex((height) => height.toastId === toast2.id) || 0, [
|
|
2858
|
+
heights,
|
|
2859
|
+
toast2.id
|
|
2860
|
+
]);
|
|
2861
|
+
const closeButton = React5__default.useMemo(() => {
|
|
2862
|
+
var _toast_closeButton;
|
|
2863
|
+
return (_toast_closeButton = toast2.closeButton) != null ? _toast_closeButton : closeButtonFromToaster;
|
|
2864
|
+
}, [
|
|
2865
|
+
toast2.closeButton,
|
|
2866
|
+
closeButtonFromToaster
|
|
2867
|
+
]);
|
|
2868
|
+
const duration = React5__default.useMemo(() => toast2.duration || durationFromToaster || TOAST_LIFETIME, [
|
|
2869
|
+
toast2.duration,
|
|
2870
|
+
durationFromToaster
|
|
2871
|
+
]);
|
|
2872
|
+
const closeTimerStartTimeRef = React5__default.useRef(0);
|
|
2873
|
+
const offset = React5__default.useRef(0);
|
|
2874
|
+
const lastCloseTimerStartTimeRef = React5__default.useRef(0);
|
|
2875
|
+
const pointerStartRef = React5__default.useRef(null);
|
|
2876
|
+
const [y, x] = position.split("-");
|
|
2877
|
+
const toastsHeightBefore = React5__default.useMemo(() => {
|
|
2878
|
+
return heights.reduce((prev, curr, reducerIndex) => {
|
|
2879
|
+
if (reducerIndex >= heightIndex) {
|
|
2880
|
+
return prev;
|
|
2881
|
+
}
|
|
2882
|
+
return prev + curr.height;
|
|
2883
|
+
}, 0);
|
|
2884
|
+
}, [
|
|
2885
|
+
heights,
|
|
2886
|
+
heightIndex
|
|
2887
|
+
]);
|
|
2888
|
+
const isDocumentHidden = useIsDocumentHidden();
|
|
2889
|
+
const invert = toast2.invert || ToasterInvert;
|
|
2890
|
+
const disabled = toastType === "loading";
|
|
2891
|
+
offset.current = React5__default.useMemo(() => heightIndex * gap + toastsHeightBefore, [
|
|
2892
|
+
heightIndex,
|
|
2893
|
+
toastsHeightBefore
|
|
2894
|
+
]);
|
|
2895
|
+
React5__default.useEffect(() => {
|
|
2896
|
+
remainingTime.current = duration;
|
|
2897
|
+
}, [
|
|
2898
|
+
duration
|
|
2899
|
+
]);
|
|
2900
|
+
React5__default.useEffect(() => {
|
|
2901
|
+
setMounted(true);
|
|
2902
|
+
}, []);
|
|
2903
|
+
React5__default.useEffect(() => {
|
|
2904
|
+
const toastNode = toastRef.current;
|
|
2905
|
+
if (toastNode) {
|
|
2906
|
+
const height = toastNode.getBoundingClientRect().height;
|
|
2907
|
+
setInitialHeight(height);
|
|
2908
|
+
setHeights((h) => [
|
|
2909
|
+
{
|
|
2910
|
+
toastId: toast2.id,
|
|
2911
|
+
height,
|
|
2912
|
+
position: toast2.position
|
|
2913
|
+
},
|
|
2914
|
+
...h
|
|
2915
|
+
]);
|
|
2916
|
+
return () => setHeights((h) => h.filter((height2) => height2.toastId !== toast2.id));
|
|
2917
|
+
}
|
|
2918
|
+
}, [
|
|
2919
|
+
setHeights,
|
|
2920
|
+
toast2.id
|
|
2921
|
+
]);
|
|
2922
|
+
React5__default.useLayoutEffect(() => {
|
|
2923
|
+
if (!mounted) return;
|
|
2924
|
+
const toastNode = toastRef.current;
|
|
2925
|
+
const originalHeight = toastNode.style.height;
|
|
2926
|
+
toastNode.style.height = "auto";
|
|
2927
|
+
const newHeight = toastNode.getBoundingClientRect().height;
|
|
2928
|
+
toastNode.style.height = originalHeight;
|
|
2929
|
+
setInitialHeight(newHeight);
|
|
2930
|
+
setHeights((heights2) => {
|
|
2931
|
+
const alreadyExists = heights2.find((height) => height.toastId === toast2.id);
|
|
2932
|
+
if (!alreadyExists) {
|
|
2933
|
+
return [
|
|
2934
|
+
{
|
|
2935
|
+
toastId: toast2.id,
|
|
2936
|
+
height: newHeight,
|
|
2937
|
+
position: toast2.position
|
|
2938
|
+
},
|
|
2939
|
+
...heights2
|
|
2940
|
+
];
|
|
2941
|
+
} else {
|
|
2942
|
+
return heights2.map((height) => height.toastId === toast2.id ? {
|
|
2943
|
+
...height,
|
|
2944
|
+
height: newHeight
|
|
2945
|
+
} : height);
|
|
2946
|
+
}
|
|
2947
|
+
});
|
|
2948
|
+
}, [
|
|
2949
|
+
mounted,
|
|
2950
|
+
toast2.title,
|
|
2951
|
+
toast2.description,
|
|
2952
|
+
setHeights,
|
|
2953
|
+
toast2.id,
|
|
2954
|
+
toast2.jsx,
|
|
2955
|
+
toast2.action,
|
|
2956
|
+
toast2.cancel
|
|
2957
|
+
]);
|
|
2958
|
+
const deleteToast = React5__default.useCallback(() => {
|
|
2959
|
+
setRemoved(true);
|
|
2960
|
+
setOffsetBeforeRemove(offset.current);
|
|
2961
|
+
setHeights((h) => h.filter((height) => height.toastId !== toast2.id));
|
|
2962
|
+
setTimeout(() => {
|
|
2963
|
+
removeToast(toast2);
|
|
2964
|
+
}, TIME_BEFORE_UNMOUNT);
|
|
2965
|
+
}, [
|
|
2966
|
+
toast2,
|
|
2967
|
+
removeToast,
|
|
2968
|
+
setHeights,
|
|
2969
|
+
offset
|
|
2970
|
+
]);
|
|
2971
|
+
React5__default.useEffect(() => {
|
|
2972
|
+
if (toast2.promise && toastType === "loading" || toast2.duration === Infinity || toast2.type === "loading") return;
|
|
2973
|
+
let timeoutId;
|
|
2974
|
+
const pauseTimer = () => {
|
|
2975
|
+
if (lastCloseTimerStartTimeRef.current < closeTimerStartTimeRef.current) {
|
|
2976
|
+
const elapsedTime = (/* @__PURE__ */ new Date()).getTime() - closeTimerStartTimeRef.current;
|
|
2977
|
+
remainingTime.current = remainingTime.current - elapsedTime;
|
|
2978
|
+
}
|
|
2979
|
+
lastCloseTimerStartTimeRef.current = (/* @__PURE__ */ new Date()).getTime();
|
|
2980
|
+
};
|
|
2981
|
+
const startTimer = () => {
|
|
2982
|
+
if (remainingTime.current === Infinity) return;
|
|
2983
|
+
closeTimerStartTimeRef.current = (/* @__PURE__ */ new Date()).getTime();
|
|
2984
|
+
timeoutId = setTimeout(() => {
|
|
2985
|
+
toast2.onAutoClose == null ? void 0 : toast2.onAutoClose.call(toast2, toast2);
|
|
2986
|
+
deleteToast();
|
|
2987
|
+
}, remainingTime.current);
|
|
2988
|
+
};
|
|
2989
|
+
if (expanded || interacting || isDocumentHidden) {
|
|
2990
|
+
pauseTimer();
|
|
2991
|
+
} else {
|
|
2992
|
+
startTimer();
|
|
2993
|
+
}
|
|
2994
|
+
return () => clearTimeout(timeoutId);
|
|
2995
|
+
}, [
|
|
2996
|
+
expanded,
|
|
2997
|
+
interacting,
|
|
2998
|
+
toast2,
|
|
2999
|
+
toastType,
|
|
3000
|
+
isDocumentHidden,
|
|
3001
|
+
deleteToast
|
|
3002
|
+
]);
|
|
3003
|
+
React5__default.useEffect(() => {
|
|
3004
|
+
if (toast2.delete) {
|
|
3005
|
+
deleteToast();
|
|
3006
|
+
toast2.onDismiss == null ? void 0 : toast2.onDismiss.call(toast2, toast2);
|
|
3007
|
+
}
|
|
3008
|
+
}, [
|
|
3009
|
+
deleteToast,
|
|
3010
|
+
toast2.delete
|
|
3011
|
+
]);
|
|
3012
|
+
function getLoadingIcon() {
|
|
3013
|
+
var _toast_classNames9;
|
|
3014
|
+
if (icons == null ? void 0 : icons.loading) {
|
|
3015
|
+
var _toast_classNames12;
|
|
3016
|
+
return /* @__PURE__ */ React5__default.createElement("div", {
|
|
3017
|
+
className: cn2(classNames == null ? void 0 : classNames.loader, toast2 == null ? void 0 : (_toast_classNames12 = toast2.classNames) == null ? void 0 : _toast_classNames12.loader, "sonner-loader"),
|
|
3018
|
+
"data-visible": toastType === "loading"
|
|
3019
|
+
}, icons.loading);
|
|
3020
|
+
}
|
|
3021
|
+
return /* @__PURE__ */ React5__default.createElement(Loader, {
|
|
3022
|
+
className: cn2(classNames == null ? void 0 : classNames.loader, toast2 == null ? void 0 : (_toast_classNames9 = toast2.classNames) == null ? void 0 : _toast_classNames9.loader),
|
|
3023
|
+
visible: toastType === "loading"
|
|
3024
|
+
});
|
|
3025
|
+
}
|
|
3026
|
+
const icon = toast2.icon || (icons == null ? void 0 : icons[toastType]) || getAsset(toastType);
|
|
3027
|
+
var _toast_richColors, _icons_close;
|
|
3028
|
+
return /* @__PURE__ */ React5__default.createElement("li", {
|
|
3029
|
+
tabIndex: 0,
|
|
3030
|
+
ref: toastRef,
|
|
3031
|
+
className: cn2(className, toastClassname, classNames == null ? void 0 : classNames.toast, toast2 == null ? void 0 : (_toast_classNames = toast2.classNames) == null ? void 0 : _toast_classNames.toast, classNames == null ? void 0 : classNames.default, classNames == null ? void 0 : classNames[toastType], toast2 == null ? void 0 : (_toast_classNames1 = toast2.classNames) == null ? void 0 : _toast_classNames1[toastType]),
|
|
3032
|
+
"data-sonner-toast": "",
|
|
3033
|
+
"data-rich-colors": (_toast_richColors = toast2.richColors) != null ? _toast_richColors : defaultRichColors,
|
|
3034
|
+
"data-styled": !Boolean(toast2.jsx || toast2.unstyled || unstyled),
|
|
3035
|
+
"data-mounted": mounted,
|
|
3036
|
+
"data-promise": Boolean(toast2.promise),
|
|
3037
|
+
"data-swiped": isSwiped,
|
|
3038
|
+
"data-removed": removed,
|
|
3039
|
+
"data-visible": isVisible,
|
|
3040
|
+
"data-y-position": y,
|
|
3041
|
+
"data-x-position": x,
|
|
3042
|
+
"data-index": index,
|
|
3043
|
+
"data-front": isFront,
|
|
3044
|
+
"data-swiping": swiping,
|
|
3045
|
+
"data-dismissible": dismissible,
|
|
3046
|
+
"data-type": toastType,
|
|
3047
|
+
"data-invert": invert,
|
|
3048
|
+
"data-swipe-out": swipeOut,
|
|
3049
|
+
"data-swipe-direction": swipeOutDirection,
|
|
3050
|
+
"data-expanded": Boolean(expanded || expandByDefault && mounted),
|
|
3051
|
+
"data-testid": toast2.testId,
|
|
3052
|
+
style: {
|
|
3053
|
+
"--index": index,
|
|
3054
|
+
"--toasts-before": index,
|
|
3055
|
+
"--z-index": toasts.length - index,
|
|
3056
|
+
"--offset": `${removed ? offsetBeforeRemove : offset.current}px`,
|
|
3057
|
+
"--initial-height": expandByDefault ? "auto" : `${initialHeight}px`,
|
|
3058
|
+
...style,
|
|
3059
|
+
...toast2.style
|
|
3060
|
+
},
|
|
3061
|
+
onDragEnd: () => {
|
|
3062
|
+
setSwiping(false);
|
|
3063
|
+
setSwipeDirection(null);
|
|
3064
|
+
pointerStartRef.current = null;
|
|
3065
|
+
},
|
|
3066
|
+
onPointerDown: (event) => {
|
|
3067
|
+
if (event.button === 2) return;
|
|
3068
|
+
if (disabled || !dismissible) return;
|
|
3069
|
+
dragStartTime.current = /* @__PURE__ */ new Date();
|
|
3070
|
+
setOffsetBeforeRemove(offset.current);
|
|
3071
|
+
event.target.setPointerCapture(event.pointerId);
|
|
3072
|
+
if (event.target.tagName === "BUTTON") return;
|
|
3073
|
+
setSwiping(true);
|
|
3074
|
+
pointerStartRef.current = {
|
|
3075
|
+
x: event.clientX,
|
|
3076
|
+
y: event.clientY
|
|
3077
|
+
};
|
|
3078
|
+
},
|
|
3079
|
+
onPointerUp: () => {
|
|
3080
|
+
var _toastRef_current, _toastRef_current1, _dragStartTime_current;
|
|
3081
|
+
if (swipeOut || !dismissible) return;
|
|
3082
|
+
pointerStartRef.current = null;
|
|
3083
|
+
const swipeAmountX = Number(((_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.getPropertyValue("--swipe-amount-x").replace("px", "")) || 0);
|
|
3084
|
+
const swipeAmountY = Number(((_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.getPropertyValue("--swipe-amount-y").replace("px", "")) || 0);
|
|
3085
|
+
const timeTaken = (/* @__PURE__ */ new Date()).getTime() - ((_dragStartTime_current = dragStartTime.current) == null ? void 0 : _dragStartTime_current.getTime());
|
|
3086
|
+
const swipeAmount = swipeDirection === "x" ? swipeAmountX : swipeAmountY;
|
|
3087
|
+
const velocity = Math.abs(swipeAmount) / timeTaken;
|
|
3088
|
+
if (Math.abs(swipeAmount) >= SWIPE_THRESHOLD || velocity > 0.11) {
|
|
3089
|
+
setOffsetBeforeRemove(offset.current);
|
|
3090
|
+
toast2.onDismiss == null ? void 0 : toast2.onDismiss.call(toast2, toast2);
|
|
3091
|
+
if (swipeDirection === "x") {
|
|
3092
|
+
setSwipeOutDirection(swipeAmountX > 0 ? "right" : "left");
|
|
3093
|
+
} else {
|
|
3094
|
+
setSwipeOutDirection(swipeAmountY > 0 ? "down" : "up");
|
|
3095
|
+
}
|
|
3096
|
+
deleteToast();
|
|
3097
|
+
setSwipeOut(true);
|
|
3098
|
+
return;
|
|
3099
|
+
} else {
|
|
3100
|
+
var _toastRef_current2, _toastRef_current3;
|
|
3101
|
+
(_toastRef_current2 = toastRef.current) == null ? void 0 : _toastRef_current2.style.setProperty("--swipe-amount-x", `0px`);
|
|
3102
|
+
(_toastRef_current3 = toastRef.current) == null ? void 0 : _toastRef_current3.style.setProperty("--swipe-amount-y", `0px`);
|
|
3103
|
+
}
|
|
3104
|
+
setIsSwiped(false);
|
|
3105
|
+
setSwiping(false);
|
|
3106
|
+
setSwipeDirection(null);
|
|
3107
|
+
},
|
|
3108
|
+
onPointerMove: (event) => {
|
|
3109
|
+
var _window_getSelection, _toastRef_current, _toastRef_current1;
|
|
3110
|
+
if (!pointerStartRef.current || !dismissible) return;
|
|
3111
|
+
const isHighlighted = ((_window_getSelection = window.getSelection()) == null ? void 0 : _window_getSelection.toString().length) > 0;
|
|
3112
|
+
if (isHighlighted) return;
|
|
3113
|
+
const yDelta = event.clientY - pointerStartRef.current.y;
|
|
3114
|
+
const xDelta = event.clientX - pointerStartRef.current.x;
|
|
3115
|
+
var _props_swipeDirections;
|
|
3116
|
+
const swipeDirections = (_props_swipeDirections = props.swipeDirections) != null ? _props_swipeDirections : getDefaultSwipeDirections(position);
|
|
3117
|
+
if (!swipeDirection && (Math.abs(xDelta) > 1 || Math.abs(yDelta) > 1)) {
|
|
3118
|
+
setSwipeDirection(Math.abs(xDelta) > Math.abs(yDelta) ? "x" : "y");
|
|
3119
|
+
}
|
|
3120
|
+
let swipeAmount = {
|
|
3121
|
+
x: 0,
|
|
3122
|
+
y: 0
|
|
3123
|
+
};
|
|
3124
|
+
const getDampening = (delta) => {
|
|
3125
|
+
const factor = Math.abs(delta) / 20;
|
|
3126
|
+
return 1 / (1.5 + factor);
|
|
3127
|
+
};
|
|
3128
|
+
if (swipeDirection === "y") {
|
|
3129
|
+
if (swipeDirections.includes("top") || swipeDirections.includes("bottom")) {
|
|
3130
|
+
if (swipeDirections.includes("top") && yDelta < 0 || swipeDirections.includes("bottom") && yDelta > 0) {
|
|
3131
|
+
swipeAmount.y = yDelta;
|
|
3132
|
+
} else {
|
|
3133
|
+
const dampenedDelta = yDelta * getDampening(yDelta);
|
|
3134
|
+
swipeAmount.y = Math.abs(dampenedDelta) < Math.abs(yDelta) ? dampenedDelta : yDelta;
|
|
3135
|
+
}
|
|
3136
|
+
}
|
|
3137
|
+
} else if (swipeDirection === "x") {
|
|
3138
|
+
if (swipeDirections.includes("left") || swipeDirections.includes("right")) {
|
|
3139
|
+
if (swipeDirections.includes("left") && xDelta < 0 || swipeDirections.includes("right") && xDelta > 0) {
|
|
3140
|
+
swipeAmount.x = xDelta;
|
|
3141
|
+
} else {
|
|
3142
|
+
const dampenedDelta = xDelta * getDampening(xDelta);
|
|
3143
|
+
swipeAmount.x = Math.abs(dampenedDelta) < Math.abs(xDelta) ? dampenedDelta : xDelta;
|
|
3144
|
+
}
|
|
3145
|
+
}
|
|
3146
|
+
}
|
|
3147
|
+
if (Math.abs(swipeAmount.x) > 0 || Math.abs(swipeAmount.y) > 0) {
|
|
3148
|
+
setIsSwiped(true);
|
|
3149
|
+
}
|
|
3150
|
+
(_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.setProperty("--swipe-amount-x", `${swipeAmount.x}px`);
|
|
3151
|
+
(_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.setProperty("--swipe-amount-y", `${swipeAmount.y}px`);
|
|
3152
|
+
}
|
|
3153
|
+
}, closeButton && !toast2.jsx && toastType !== "loading" ? /* @__PURE__ */ React5__default.createElement("button", {
|
|
3154
|
+
"aria-label": closeButtonAriaLabel,
|
|
3155
|
+
"data-disabled": disabled,
|
|
3156
|
+
"data-close-button": true,
|
|
3157
|
+
onClick: disabled || !dismissible ? () => {
|
|
3158
|
+
} : () => {
|
|
3159
|
+
deleteToast();
|
|
3160
|
+
toast2.onDismiss == null ? void 0 : toast2.onDismiss.call(toast2, toast2);
|
|
3161
|
+
},
|
|
3162
|
+
className: cn2(classNames == null ? void 0 : classNames.closeButton, toast2 == null ? void 0 : (_toast_classNames2 = toast2.classNames) == null ? void 0 : _toast_classNames2.closeButton)
|
|
3163
|
+
}, (_icons_close = icons == null ? void 0 : icons.close) != null ? _icons_close : CloseIcon) : null, (toastType || toast2.icon || toast2.promise) && toast2.icon !== null && ((icons == null ? void 0 : icons[toastType]) !== null || toast2.icon) ? /* @__PURE__ */ React5__default.createElement("div", {
|
|
3164
|
+
"data-icon": "",
|
|
3165
|
+
className: cn2(classNames == null ? void 0 : classNames.icon, toast2 == null ? void 0 : (_toast_classNames3 = toast2.classNames) == null ? void 0 : _toast_classNames3.icon)
|
|
3166
|
+
}, toast2.promise || toast2.type === "loading" && !toast2.icon ? toast2.icon || getLoadingIcon() : null, toast2.type !== "loading" ? icon : null) : null, /* @__PURE__ */ React5__default.createElement("div", {
|
|
3167
|
+
"data-content": "",
|
|
3168
|
+
className: cn2(classNames == null ? void 0 : classNames.content, toast2 == null ? void 0 : (_toast_classNames4 = toast2.classNames) == null ? void 0 : _toast_classNames4.content)
|
|
3169
|
+
}, /* @__PURE__ */ React5__default.createElement("div", {
|
|
3170
|
+
"data-title": "",
|
|
3171
|
+
className: cn2(classNames == null ? void 0 : classNames.title, toast2 == null ? void 0 : (_toast_classNames5 = toast2.classNames) == null ? void 0 : _toast_classNames5.title)
|
|
3172
|
+
}, toast2.jsx ? toast2.jsx : typeof toast2.title === "function" ? toast2.title() : toast2.title), toast2.description ? /* @__PURE__ */ React5__default.createElement("div", {
|
|
3173
|
+
"data-description": "",
|
|
3174
|
+
className: cn2(descriptionClassName, toastDescriptionClassname, classNames == null ? void 0 : classNames.description, toast2 == null ? void 0 : (_toast_classNames6 = toast2.classNames) == null ? void 0 : _toast_classNames6.description)
|
|
3175
|
+
}, typeof toast2.description === "function" ? toast2.description() : toast2.description) : null), /* @__PURE__ */ React5__default.isValidElement(toast2.cancel) ? toast2.cancel : toast2.cancel && isAction(toast2.cancel) ? /* @__PURE__ */ React5__default.createElement("button", {
|
|
3176
|
+
"data-button": true,
|
|
3177
|
+
"data-cancel": true,
|
|
3178
|
+
style: toast2.cancelButtonStyle || cancelButtonStyle,
|
|
3179
|
+
onClick: (event) => {
|
|
3180
|
+
if (!isAction(toast2.cancel)) return;
|
|
3181
|
+
if (!dismissible) return;
|
|
3182
|
+
toast2.cancel.onClick == null ? void 0 : toast2.cancel.onClick.call(toast2.cancel, event);
|
|
3183
|
+
deleteToast();
|
|
3184
|
+
},
|
|
3185
|
+
className: cn2(classNames == null ? void 0 : classNames.cancelButton, toast2 == null ? void 0 : (_toast_classNames7 = toast2.classNames) == null ? void 0 : _toast_classNames7.cancelButton)
|
|
3186
|
+
}, toast2.cancel.label) : null, /* @__PURE__ */ React5__default.isValidElement(toast2.action) ? toast2.action : toast2.action && isAction(toast2.action) ? /* @__PURE__ */ React5__default.createElement("button", {
|
|
3187
|
+
"data-button": true,
|
|
3188
|
+
"data-action": true,
|
|
3189
|
+
style: toast2.actionButtonStyle || actionButtonStyle,
|
|
3190
|
+
onClick: (event) => {
|
|
3191
|
+
if (!isAction(toast2.action)) return;
|
|
3192
|
+
toast2.action.onClick == null ? void 0 : toast2.action.onClick.call(toast2.action, event);
|
|
3193
|
+
if (event.defaultPrevented) return;
|
|
3194
|
+
deleteToast();
|
|
3195
|
+
},
|
|
3196
|
+
className: cn2(classNames == null ? void 0 : classNames.actionButton, toast2 == null ? void 0 : (_toast_classNames8 = toast2.classNames) == null ? void 0 : _toast_classNames8.actionButton)
|
|
3197
|
+
}, toast2.action.label) : null);
|
|
3198
|
+
};
|
|
3199
|
+
function getDocumentDirection() {
|
|
3200
|
+
if (typeof window === "undefined") return "ltr";
|
|
3201
|
+
if (typeof document === "undefined") return "ltr";
|
|
3202
|
+
const dirAttribute = document.documentElement.getAttribute("dir");
|
|
3203
|
+
if (dirAttribute === "auto" || !dirAttribute) {
|
|
3204
|
+
return window.getComputedStyle(document.documentElement).direction;
|
|
3205
|
+
}
|
|
3206
|
+
return dirAttribute;
|
|
3207
|
+
}
|
|
3208
|
+
function assignOffset(defaultOffset, mobileOffset) {
|
|
3209
|
+
const styles = {};
|
|
3210
|
+
[
|
|
3211
|
+
defaultOffset,
|
|
3212
|
+
mobileOffset
|
|
3213
|
+
].forEach((offset, index) => {
|
|
3214
|
+
const isMobile = index === 1;
|
|
3215
|
+
const prefix = isMobile ? "--mobile-offset" : "--offset";
|
|
3216
|
+
const defaultValue = isMobile ? MOBILE_VIEWPORT_OFFSET : VIEWPORT_OFFSET;
|
|
3217
|
+
function assignAll(offset2) {
|
|
3218
|
+
[
|
|
3219
|
+
"top",
|
|
3220
|
+
"right",
|
|
3221
|
+
"bottom",
|
|
3222
|
+
"left"
|
|
3223
|
+
].forEach((key) => {
|
|
3224
|
+
styles[`${prefix}-${key}`] = typeof offset2 === "number" ? `${offset2}px` : offset2;
|
|
3225
|
+
});
|
|
3226
|
+
}
|
|
3227
|
+
if (typeof offset === "number" || typeof offset === "string") {
|
|
3228
|
+
assignAll(offset);
|
|
3229
|
+
} else if (typeof offset === "object") {
|
|
3230
|
+
[
|
|
3231
|
+
"top",
|
|
3232
|
+
"right",
|
|
3233
|
+
"bottom",
|
|
3234
|
+
"left"
|
|
3235
|
+
].forEach((key) => {
|
|
3236
|
+
if (offset[key] === void 0) {
|
|
3237
|
+
styles[`${prefix}-${key}`] = defaultValue;
|
|
3238
|
+
} else {
|
|
3239
|
+
styles[`${prefix}-${key}`] = typeof offset[key] === "number" ? `${offset[key]}px` : offset[key];
|
|
3240
|
+
}
|
|
3241
|
+
});
|
|
3242
|
+
} else {
|
|
3243
|
+
assignAll(defaultValue);
|
|
3244
|
+
}
|
|
3245
|
+
});
|
|
3246
|
+
return styles;
|
|
3247
|
+
}
|
|
3248
|
+
var Toaster = /* @__PURE__ */ React5__default.forwardRef(function Toaster2(props, ref) {
|
|
3249
|
+
const { id, invert, position = "bottom-right", hotkey = [
|
|
3250
|
+
"altKey",
|
|
3251
|
+
"KeyT"
|
|
3252
|
+
], expand, closeButton, className, offset, mobileOffset, theme = "light", richColors, duration, style, visibleToasts = VISIBLE_TOASTS_AMOUNT, toastOptions, dir = getDocumentDirection(), gap = GAP, icons, containerAriaLabel = "Notifications" } = props;
|
|
3253
|
+
const [toasts, setToasts] = React5__default.useState([]);
|
|
3254
|
+
const filteredToasts = React5__default.useMemo(() => {
|
|
3255
|
+
if (id) {
|
|
3256
|
+
return toasts.filter((toast2) => toast2.toasterId === id);
|
|
3257
|
+
}
|
|
3258
|
+
return toasts.filter((toast2) => !toast2.toasterId);
|
|
3259
|
+
}, [
|
|
3260
|
+
toasts,
|
|
3261
|
+
id
|
|
3262
|
+
]);
|
|
3263
|
+
const possiblePositions = React5__default.useMemo(() => {
|
|
3264
|
+
return Array.from(new Set([
|
|
3265
|
+
position
|
|
3266
|
+
].concat(filteredToasts.filter((toast2) => toast2.position).map((toast2) => toast2.position))));
|
|
3267
|
+
}, [
|
|
3268
|
+
filteredToasts,
|
|
3269
|
+
position
|
|
3270
|
+
]);
|
|
3271
|
+
const [heights, setHeights] = React5__default.useState([]);
|
|
3272
|
+
const [expanded, setExpanded] = React5__default.useState(false);
|
|
3273
|
+
const [interacting, setInteracting] = React5__default.useState(false);
|
|
3274
|
+
const [actualTheme, setActualTheme] = React5__default.useState(theme !== "system" ? theme : typeof window !== "undefined" ? window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : "light");
|
|
3275
|
+
const listRef = React5__default.useRef(null);
|
|
3276
|
+
const hotkeyLabel = hotkey.join("+").replace(/Key/g, "").replace(/Digit/g, "");
|
|
3277
|
+
const lastFocusedElementRef = React5__default.useRef(null);
|
|
3278
|
+
const isFocusWithinRef = React5__default.useRef(false);
|
|
3279
|
+
const removeToast = React5__default.useCallback((toastToRemove) => {
|
|
3280
|
+
setToasts((toasts2) => {
|
|
3281
|
+
var _toasts_find;
|
|
3282
|
+
if (!((_toasts_find = toasts2.find((toast2) => toast2.id === toastToRemove.id)) == null ? void 0 : _toasts_find.delete)) {
|
|
3283
|
+
ToastState.dismiss(toastToRemove.id);
|
|
3284
|
+
}
|
|
3285
|
+
return toasts2.filter(({ id: id2 }) => id2 !== toastToRemove.id);
|
|
3286
|
+
});
|
|
3287
|
+
}, []);
|
|
3288
|
+
React5__default.useEffect(() => {
|
|
3289
|
+
return ToastState.subscribe((toast2) => {
|
|
3290
|
+
if (toast2.dismiss) {
|
|
3291
|
+
requestAnimationFrame(() => {
|
|
3292
|
+
setToasts((toasts2) => toasts2.map((t) => t.id === toast2.id ? {
|
|
3293
|
+
...t,
|
|
3294
|
+
delete: true
|
|
3295
|
+
} : t));
|
|
3296
|
+
});
|
|
3297
|
+
return;
|
|
3298
|
+
}
|
|
3299
|
+
setTimeout(() => {
|
|
3300
|
+
ReactDOM.flushSync(() => {
|
|
3301
|
+
setToasts((toasts2) => {
|
|
3302
|
+
const indexOfExistingToast = toasts2.findIndex((t) => t.id === toast2.id);
|
|
3303
|
+
if (indexOfExistingToast !== -1) {
|
|
3304
|
+
return [
|
|
3305
|
+
...toasts2.slice(0, indexOfExistingToast),
|
|
3306
|
+
{
|
|
3307
|
+
...toasts2[indexOfExistingToast],
|
|
3308
|
+
...toast2
|
|
3309
|
+
},
|
|
3310
|
+
...toasts2.slice(indexOfExistingToast + 1)
|
|
3311
|
+
];
|
|
3312
|
+
}
|
|
3313
|
+
return [
|
|
3314
|
+
toast2,
|
|
3315
|
+
...toasts2
|
|
3316
|
+
];
|
|
3317
|
+
});
|
|
3318
|
+
});
|
|
3319
|
+
});
|
|
3320
|
+
});
|
|
3321
|
+
}, [
|
|
3322
|
+
toasts
|
|
3323
|
+
]);
|
|
3324
|
+
React5__default.useEffect(() => {
|
|
3325
|
+
if (theme !== "system") {
|
|
3326
|
+
setActualTheme(theme);
|
|
3327
|
+
return;
|
|
3328
|
+
}
|
|
3329
|
+
if (theme === "system") {
|
|
3330
|
+
if (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) {
|
|
3331
|
+
setActualTheme("dark");
|
|
3332
|
+
} else {
|
|
3333
|
+
setActualTheme("light");
|
|
3334
|
+
}
|
|
3335
|
+
}
|
|
3336
|
+
if (typeof window === "undefined") return;
|
|
3337
|
+
const darkMediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
3338
|
+
try {
|
|
3339
|
+
darkMediaQuery.addEventListener("change", ({ matches }) => {
|
|
3340
|
+
if (matches) {
|
|
3341
|
+
setActualTheme("dark");
|
|
3342
|
+
} else {
|
|
3343
|
+
setActualTheme("light");
|
|
3344
|
+
}
|
|
3345
|
+
});
|
|
3346
|
+
} catch (error) {
|
|
3347
|
+
darkMediaQuery.addListener(({ matches }) => {
|
|
3348
|
+
try {
|
|
3349
|
+
if (matches) {
|
|
3350
|
+
setActualTheme("dark");
|
|
3351
|
+
} else {
|
|
3352
|
+
setActualTheme("light");
|
|
3353
|
+
}
|
|
3354
|
+
} catch (e) {
|
|
3355
|
+
console.error(e);
|
|
3356
|
+
}
|
|
3357
|
+
});
|
|
3358
|
+
}
|
|
3359
|
+
}, [
|
|
3360
|
+
theme
|
|
3361
|
+
]);
|
|
3362
|
+
React5__default.useEffect(() => {
|
|
3363
|
+
if (toasts.length <= 1) {
|
|
3364
|
+
setExpanded(false);
|
|
3365
|
+
}
|
|
3366
|
+
}, [
|
|
3367
|
+
toasts
|
|
3368
|
+
]);
|
|
3369
|
+
React5__default.useEffect(() => {
|
|
3370
|
+
const handleKeyDown = (event) => {
|
|
3371
|
+
var _listRef_current;
|
|
3372
|
+
const isHotkeyPressed = hotkey.every((key) => event[key] || event.code === key);
|
|
3373
|
+
if (isHotkeyPressed) {
|
|
3374
|
+
var _listRef_current1;
|
|
3375
|
+
setExpanded(true);
|
|
3376
|
+
(_listRef_current1 = listRef.current) == null ? void 0 : _listRef_current1.focus();
|
|
3377
|
+
}
|
|
3378
|
+
if (event.code === "Escape" && (document.activeElement === listRef.current || ((_listRef_current = listRef.current) == null ? void 0 : _listRef_current.contains(document.activeElement)))) {
|
|
3379
|
+
setExpanded(false);
|
|
3380
|
+
}
|
|
3381
|
+
};
|
|
3382
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
3383
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
3384
|
+
}, [
|
|
3385
|
+
hotkey
|
|
3386
|
+
]);
|
|
3387
|
+
React5__default.useEffect(() => {
|
|
3388
|
+
if (listRef.current) {
|
|
3389
|
+
return () => {
|
|
3390
|
+
if (lastFocusedElementRef.current) {
|
|
3391
|
+
lastFocusedElementRef.current.focus({
|
|
3392
|
+
preventScroll: true
|
|
3393
|
+
});
|
|
3394
|
+
lastFocusedElementRef.current = null;
|
|
3395
|
+
isFocusWithinRef.current = false;
|
|
3396
|
+
}
|
|
3397
|
+
};
|
|
3398
|
+
}
|
|
3399
|
+
}, [
|
|
3400
|
+
listRef.current
|
|
3401
|
+
]);
|
|
3402
|
+
return (
|
|
3403
|
+
// Remove item from normal navigation flow, only available via hotkey
|
|
3404
|
+
/* @__PURE__ */ React5__default.createElement("section", {
|
|
3405
|
+
ref,
|
|
3406
|
+
"aria-label": `${containerAriaLabel} ${hotkeyLabel}`,
|
|
3407
|
+
tabIndex: -1,
|
|
3408
|
+
"aria-live": "polite",
|
|
3409
|
+
"aria-relevant": "additions text",
|
|
3410
|
+
"aria-atomic": "false",
|
|
3411
|
+
suppressHydrationWarning: true
|
|
3412
|
+
}, possiblePositions.map((position2, index) => {
|
|
3413
|
+
var _heights_;
|
|
3414
|
+
const [y, x] = position2.split("-");
|
|
3415
|
+
if (!filteredToasts.length) return null;
|
|
3416
|
+
return /* @__PURE__ */ React5__default.createElement("ol", {
|
|
3417
|
+
key: position2,
|
|
3418
|
+
dir: dir === "auto" ? getDocumentDirection() : dir,
|
|
3419
|
+
tabIndex: -1,
|
|
3420
|
+
ref: listRef,
|
|
3421
|
+
className,
|
|
3422
|
+
"data-sonner-toaster": true,
|
|
3423
|
+
"data-sonner-theme": actualTheme,
|
|
3424
|
+
"data-y-position": y,
|
|
3425
|
+
"data-x-position": x,
|
|
3426
|
+
style: {
|
|
3427
|
+
"--front-toast-height": `${((_heights_ = heights[0]) == null ? void 0 : _heights_.height) || 0}px`,
|
|
3428
|
+
"--width": `${TOAST_WIDTH}px`,
|
|
3429
|
+
"--gap": `${gap}px`,
|
|
3430
|
+
...style,
|
|
3431
|
+
...assignOffset(offset, mobileOffset)
|
|
3432
|
+
},
|
|
3433
|
+
onBlur: (event) => {
|
|
3434
|
+
if (isFocusWithinRef.current && !event.currentTarget.contains(event.relatedTarget)) {
|
|
3435
|
+
isFocusWithinRef.current = false;
|
|
3436
|
+
if (lastFocusedElementRef.current) {
|
|
3437
|
+
lastFocusedElementRef.current.focus({
|
|
3438
|
+
preventScroll: true
|
|
3439
|
+
});
|
|
3440
|
+
lastFocusedElementRef.current = null;
|
|
3441
|
+
}
|
|
3442
|
+
}
|
|
3443
|
+
},
|
|
3444
|
+
onFocus: (event) => {
|
|
3445
|
+
const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === "false";
|
|
3446
|
+
if (isNotDismissible) return;
|
|
3447
|
+
if (!isFocusWithinRef.current) {
|
|
3448
|
+
isFocusWithinRef.current = true;
|
|
3449
|
+
lastFocusedElementRef.current = event.relatedTarget;
|
|
3450
|
+
}
|
|
3451
|
+
},
|
|
3452
|
+
onMouseEnter: () => setExpanded(true),
|
|
3453
|
+
onMouseMove: () => setExpanded(true),
|
|
3454
|
+
onMouseLeave: () => {
|
|
3455
|
+
if (!interacting) {
|
|
3456
|
+
setExpanded(false);
|
|
3457
|
+
}
|
|
3458
|
+
},
|
|
3459
|
+
onDragEnd: () => setExpanded(false),
|
|
3460
|
+
onPointerDown: (event) => {
|
|
3461
|
+
const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === "false";
|
|
3462
|
+
if (isNotDismissible) return;
|
|
3463
|
+
setInteracting(true);
|
|
3464
|
+
},
|
|
3465
|
+
onPointerUp: () => setInteracting(false)
|
|
3466
|
+
}, filteredToasts.filter((toast2) => !toast2.position && index === 0 || toast2.position === position2).map((toast2, index2) => {
|
|
3467
|
+
var _toastOptions_duration, _toastOptions_closeButton;
|
|
3468
|
+
return /* @__PURE__ */ React5__default.createElement(Toast, {
|
|
3469
|
+
key: toast2.id,
|
|
3470
|
+
icons,
|
|
3471
|
+
index: index2,
|
|
3472
|
+
toast: toast2,
|
|
3473
|
+
defaultRichColors: richColors,
|
|
3474
|
+
duration: (_toastOptions_duration = toastOptions == null ? void 0 : toastOptions.duration) != null ? _toastOptions_duration : duration,
|
|
3475
|
+
className: toastOptions == null ? void 0 : toastOptions.className,
|
|
3476
|
+
descriptionClassName: toastOptions == null ? void 0 : toastOptions.descriptionClassName,
|
|
3477
|
+
invert,
|
|
3478
|
+
visibleToasts,
|
|
3479
|
+
closeButton: (_toastOptions_closeButton = toastOptions == null ? void 0 : toastOptions.closeButton) != null ? _toastOptions_closeButton : closeButton,
|
|
3480
|
+
interacting,
|
|
3481
|
+
position: position2,
|
|
3482
|
+
style: toastOptions == null ? void 0 : toastOptions.style,
|
|
3483
|
+
unstyled: toastOptions == null ? void 0 : toastOptions.unstyled,
|
|
3484
|
+
classNames: toastOptions == null ? void 0 : toastOptions.classNames,
|
|
3485
|
+
cancelButtonStyle: toastOptions == null ? void 0 : toastOptions.cancelButtonStyle,
|
|
3486
|
+
actionButtonStyle: toastOptions == null ? void 0 : toastOptions.actionButtonStyle,
|
|
3487
|
+
closeButtonAriaLabel: toastOptions == null ? void 0 : toastOptions.closeButtonAriaLabel,
|
|
3488
|
+
removeToast,
|
|
3489
|
+
toasts: filteredToasts.filter((t) => t.position == toast2.position),
|
|
3490
|
+
heights: heights.filter((h) => h.position == toast2.position),
|
|
3491
|
+
setHeights,
|
|
3492
|
+
expandByDefault: expand,
|
|
3493
|
+
gap,
|
|
3494
|
+
expanded,
|
|
3495
|
+
swipeDirections: props.swipeDirections
|
|
3496
|
+
});
|
|
3497
|
+
}));
|
|
3498
|
+
}))
|
|
3499
|
+
);
|
|
3500
|
+
});
|
|
3501
|
+
var Toaster3 = ({ ...props }) => {
|
|
3502
|
+
const { theme = "system" } = useTheme();
|
|
3503
|
+
return /* @__PURE__ */ jsx(
|
|
3504
|
+
Toaster,
|
|
3505
|
+
{
|
|
3506
|
+
theme,
|
|
3507
|
+
className: "toaster group",
|
|
3508
|
+
icons: {
|
|
3509
|
+
success: /* @__PURE__ */ jsx(CircleCheckIcon, { className: "size-4" }),
|
|
3510
|
+
info: /* @__PURE__ */ jsx(InfoIcon$1, { className: "size-4" }),
|
|
3511
|
+
warning: /* @__PURE__ */ jsx(TriangleAlertIcon, { className: "size-4" }),
|
|
3512
|
+
error: /* @__PURE__ */ jsx(OctagonXIcon, { className: "size-4" }),
|
|
3513
|
+
loading: /* @__PURE__ */ jsx(Loader2Icon, { className: "size-4 animate-spin" })
|
|
3514
|
+
},
|
|
3515
|
+
style: {
|
|
3516
|
+
"--normal-bg": "var(--popover)",
|
|
3517
|
+
"--normal-text": "var(--popover-foreground)",
|
|
3518
|
+
"--normal-border": "var(--border)",
|
|
3519
|
+
"--border-radius": "var(--radius)"
|
|
3520
|
+
},
|
|
3521
|
+
...props
|
|
3522
|
+
}
|
|
3523
|
+
);
|
|
3524
|
+
};
|
|
3525
|
+
function AspectRatio({
|
|
3526
|
+
...props
|
|
3527
|
+
}) {
|
|
3528
|
+
return /* @__PURE__ */ jsx(AspectRatioPrimitive.Root, { "data-slot": "aspect-ratio", ...props });
|
|
3529
|
+
}
|
|
3530
|
+
function Breadcrumb({ ...props }) {
|
|
3531
|
+
return /* @__PURE__ */ jsx("nav", { "aria-label": "breadcrumb", "data-slot": "breadcrumb", ...props });
|
|
3532
|
+
}
|
|
3533
|
+
function BreadcrumbList({ className, ...props }) {
|
|
3534
|
+
return /* @__PURE__ */ jsx(
|
|
3535
|
+
"ol",
|
|
3536
|
+
{
|
|
3537
|
+
"data-slot": "breadcrumb-list",
|
|
3538
|
+
className: cn(
|
|
2863
3539
|
"flex flex-wrap items-center gap-1.5 text-sm break-words text-muted-foreground sm:gap-2.5",
|
|
2864
3540
|
className
|
|
2865
3541
|
),
|
|
@@ -3047,7 +3723,7 @@ function ComboboxContent({
|
|
|
3047
3723
|
),
|
|
3048
3724
|
...props,
|
|
3049
3725
|
children: /* @__PURE__ */ jsx(
|
|
3050
|
-
Command
|
|
3726
|
+
Command,
|
|
3051
3727
|
{
|
|
3052
3728
|
"data-slot": "combobox",
|
|
3053
3729
|
className: "flex w-full flex-col",
|
|
@@ -3069,7 +3745,7 @@ function ComboboxInput({
|
|
|
3069
3745
|
children: [
|
|
3070
3746
|
/* @__PURE__ */ jsx(SearchIcon, { className: "size-4 shrink-0 opacity-50" }),
|
|
3071
3747
|
/* @__PURE__ */ jsx(
|
|
3072
|
-
Command
|
|
3748
|
+
Command.Input,
|
|
3073
3749
|
{
|
|
3074
3750
|
"data-slot": "combobox-input",
|
|
3075
3751
|
className: cn(
|
|
@@ -3088,7 +3764,7 @@ function ComboboxList({
|
|
|
3088
3764
|
...props
|
|
3089
3765
|
}) {
|
|
3090
3766
|
return /* @__PURE__ */ jsx(
|
|
3091
|
-
Command
|
|
3767
|
+
Command.List,
|
|
3092
3768
|
{
|
|
3093
3769
|
"data-slot": "combobox-list",
|
|
3094
3770
|
className: cn(
|
|
@@ -3106,7 +3782,7 @@ function ComboboxItem({
|
|
|
3106
3782
|
...props
|
|
3107
3783
|
}) {
|
|
3108
3784
|
return /* @__PURE__ */ jsxs(
|
|
3109
|
-
Command
|
|
3785
|
+
Command.Item,
|
|
3110
3786
|
{
|
|
3111
3787
|
"data-slot": "combobox-item",
|
|
3112
3788
|
className: cn(
|
|
@@ -3132,7 +3808,7 @@ function ComboboxGroup({
|
|
|
3132
3808
|
...props
|
|
3133
3809
|
}) {
|
|
3134
3810
|
return /* @__PURE__ */ jsx(
|
|
3135
|
-
Command
|
|
3811
|
+
Command.Group,
|
|
3136
3812
|
{
|
|
3137
3813
|
"data-slot": "combobox-group",
|
|
3138
3814
|
className: cn(
|
|
@@ -3148,7 +3824,7 @@ function ComboboxEmpty({
|
|
|
3148
3824
|
...props
|
|
3149
3825
|
}) {
|
|
3150
3826
|
return /* @__PURE__ */ jsx(
|
|
3151
|
-
Command
|
|
3827
|
+
Command.Empty,
|
|
3152
3828
|
{
|
|
3153
3829
|
"data-slot": "combobox-empty",
|
|
3154
3830
|
className: cn("py-6 text-center text-sm text-muted-foreground", className),
|
|
@@ -3161,7 +3837,7 @@ function ComboboxSeparator({
|
|
|
3161
3837
|
...props
|
|
3162
3838
|
}) {
|
|
3163
3839
|
return /* @__PURE__ */ jsx(
|
|
3164
|
-
Command
|
|
3840
|
+
Command.Separator,
|
|
3165
3841
|
{
|
|
3166
3842
|
"data-slot": "combobox-separator",
|
|
3167
3843
|
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
@@ -3169,158 +3845,6 @@ function ComboboxSeparator({
|
|
|
3169
3845
|
}
|
|
3170
3846
|
);
|
|
3171
3847
|
}
|
|
3172
|
-
function Command({
|
|
3173
|
-
className,
|
|
3174
|
-
...props
|
|
3175
|
-
}) {
|
|
3176
|
-
return /* @__PURE__ */ jsx(
|
|
3177
|
-
Command$1,
|
|
3178
|
-
{
|
|
3179
|
-
"data-slot": "command",
|
|
3180
|
-
className: cn(
|
|
3181
|
-
"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
|
|
3182
|
-
className
|
|
3183
|
-
),
|
|
3184
|
-
...props
|
|
3185
|
-
}
|
|
3186
|
-
);
|
|
3187
|
-
}
|
|
3188
|
-
function CommandDialog({
|
|
3189
|
-
title = "Command Palette",
|
|
3190
|
-
description = "Search for a command to run...",
|
|
3191
|
-
children,
|
|
3192
|
-
className,
|
|
3193
|
-
...props
|
|
3194
|
-
}) {
|
|
3195
|
-
return /* @__PURE__ */ jsxs(Dialog, { ...props, children: [
|
|
3196
|
-
/* @__PURE__ */ jsxs(DialogHeader, { className: "sr-only", children: [
|
|
3197
|
-
/* @__PURE__ */ jsx(DialogTitle, { children: title }),
|
|
3198
|
-
/* @__PURE__ */ jsx(DialogDescription, { children: description })
|
|
3199
|
-
] }),
|
|
3200
|
-
/* @__PURE__ */ jsx(
|
|
3201
|
-
DialogContent,
|
|
3202
|
-
{
|
|
3203
|
-
className: cn("overflow-hidden p-0", className),
|
|
3204
|
-
children: /* @__PURE__ */ jsx(Command, { className: "**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[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", children })
|
|
3205
|
-
}
|
|
3206
|
-
)
|
|
3207
|
-
] });
|
|
3208
|
-
}
|
|
3209
|
-
function CommandInput({
|
|
3210
|
-
className,
|
|
3211
|
-
...props
|
|
3212
|
-
}) {
|
|
3213
|
-
return /* @__PURE__ */ jsxs(
|
|
3214
|
-
"div",
|
|
3215
|
-
{
|
|
3216
|
-
"data-slot": "command-input-wrapper",
|
|
3217
|
-
className: "flex h-9 items-center gap-2 border-b px-3",
|
|
3218
|
-
children: [
|
|
3219
|
-
/* @__PURE__ */ jsx(SearchIcon, { className: "size-4 shrink-0 opacity-50" }),
|
|
3220
|
-
/* @__PURE__ */ jsx(
|
|
3221
|
-
Command$1.Input,
|
|
3222
|
-
{
|
|
3223
|
-
"data-slot": "command-input",
|
|
3224
|
-
className: cn(
|
|
3225
|
-
"flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
3226
|
-
className
|
|
3227
|
-
),
|
|
3228
|
-
...props
|
|
3229
|
-
}
|
|
3230
|
-
)
|
|
3231
|
-
]
|
|
3232
|
-
}
|
|
3233
|
-
);
|
|
3234
|
-
}
|
|
3235
|
-
function CommandList({
|
|
3236
|
-
className,
|
|
3237
|
-
...props
|
|
3238
|
-
}) {
|
|
3239
|
-
return /* @__PURE__ */ jsx(
|
|
3240
|
-
Command$1.List,
|
|
3241
|
-
{
|
|
3242
|
-
"data-slot": "command-list",
|
|
3243
|
-
className: cn(
|
|
3244
|
-
"max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",
|
|
3245
|
-
className
|
|
3246
|
-
),
|
|
3247
|
-
...props
|
|
3248
|
-
}
|
|
3249
|
-
);
|
|
3250
|
-
}
|
|
3251
|
-
function CommandEmpty({
|
|
3252
|
-
...props
|
|
3253
|
-
}) {
|
|
3254
|
-
return /* @__PURE__ */ jsx(
|
|
3255
|
-
Command$1.Empty,
|
|
3256
|
-
{
|
|
3257
|
-
"data-slot": "command-empty",
|
|
3258
|
-
className: "py-6 text-center text-sm",
|
|
3259
|
-
...props
|
|
3260
|
-
}
|
|
3261
|
-
);
|
|
3262
|
-
}
|
|
3263
|
-
function CommandGroup({
|
|
3264
|
-
className,
|
|
3265
|
-
...props
|
|
3266
|
-
}) {
|
|
3267
|
-
return /* @__PURE__ */ jsx(
|
|
3268
|
-
Command$1.Group,
|
|
3269
|
-
{
|
|
3270
|
-
"data-slot": "command-group",
|
|
3271
|
-
className: cn(
|
|
3272
|
-
"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
|
|
3273
|
-
className
|
|
3274
|
-
),
|
|
3275
|
-
...props
|
|
3276
|
-
}
|
|
3277
|
-
);
|
|
3278
|
-
}
|
|
3279
|
-
function CommandSeparator({
|
|
3280
|
-
className,
|
|
3281
|
-
...props
|
|
3282
|
-
}) {
|
|
3283
|
-
return /* @__PURE__ */ jsx(
|
|
3284
|
-
Command$1.Separator,
|
|
3285
|
-
{
|
|
3286
|
-
"data-slot": "command-separator",
|
|
3287
|
-
className: cn("-mx-1 h-px bg-border", className),
|
|
3288
|
-
...props
|
|
3289
|
-
}
|
|
3290
|
-
);
|
|
3291
|
-
}
|
|
3292
|
-
function CommandItem({
|
|
3293
|
-
className,
|
|
3294
|
-
...props
|
|
3295
|
-
}) {
|
|
3296
|
-
return /* @__PURE__ */ jsx(
|
|
3297
|
-
Command$1.Item,
|
|
3298
|
-
{
|
|
3299
|
-
"data-slot": "command-item",
|
|
3300
|
-
className: cn(
|
|
3301
|
-
"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 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
|
|
3302
|
-
className
|
|
3303
|
-
),
|
|
3304
|
-
...props
|
|
3305
|
-
}
|
|
3306
|
-
);
|
|
3307
|
-
}
|
|
3308
|
-
function CommandShortcut({
|
|
3309
|
-
className,
|
|
3310
|
-
...props
|
|
3311
|
-
}) {
|
|
3312
|
-
return /* @__PURE__ */ jsx(
|
|
3313
|
-
"span",
|
|
3314
|
-
{
|
|
3315
|
-
"data-slot": "command-shortcut",
|
|
3316
|
-
className: cn(
|
|
3317
|
-
"ml-auto text-xs tracking-widest text-muted-foreground",
|
|
3318
|
-
className
|
|
3319
|
-
),
|
|
3320
|
-
...props
|
|
3321
|
-
}
|
|
3322
|
-
);
|
|
3323
|
-
}
|
|
3324
3848
|
function DirectionProvider2({
|
|
3325
3849
|
dir,
|
|
3326
3850
|
direction,
|
|
@@ -3648,7 +4172,7 @@ function FieldError({
|
|
|
3648
4172
|
);
|
|
3649
4173
|
}
|
|
3650
4174
|
var Form = FormProvider;
|
|
3651
|
-
var FormFieldContext =
|
|
4175
|
+
var FormFieldContext = React5.createContext(
|
|
3652
4176
|
{}
|
|
3653
4177
|
);
|
|
3654
4178
|
var FormField = ({
|
|
@@ -3657,8 +4181,8 @@ var FormField = ({
|
|
|
3657
4181
|
return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
|
|
3658
4182
|
};
|
|
3659
4183
|
var useFormField = () => {
|
|
3660
|
-
const fieldContext =
|
|
3661
|
-
const itemContext =
|
|
4184
|
+
const fieldContext = React5.useContext(FormFieldContext);
|
|
4185
|
+
const itemContext = React5.useContext(FormItemContext);
|
|
3662
4186
|
const { getFieldState } = useFormContext();
|
|
3663
4187
|
const formState = useFormState({ name: fieldContext.name });
|
|
3664
4188
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
@@ -3675,11 +4199,11 @@ var useFormField = () => {
|
|
|
3675
4199
|
...fieldState
|
|
3676
4200
|
};
|
|
3677
4201
|
};
|
|
3678
|
-
var FormItemContext =
|
|
4202
|
+
var FormItemContext = React5.createContext(
|
|
3679
4203
|
{}
|
|
3680
4204
|
);
|
|
3681
4205
|
function FormItem({ className, ...props }) {
|
|
3682
|
-
const id =
|
|
4206
|
+
const id = React5.useId();
|
|
3683
4207
|
return /* @__PURE__ */ jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx(
|
|
3684
4208
|
"div",
|
|
3685
4209
|
{
|
|
@@ -4059,61 +4583,6 @@ function InputGroupTextarea({
|
|
|
4059
4583
|
}
|
|
4060
4584
|
);
|
|
4061
4585
|
}
|
|
4062
|
-
function InputOTP({
|
|
4063
|
-
className,
|
|
4064
|
-
containerClassName,
|
|
4065
|
-
...props
|
|
4066
|
-
}) {
|
|
4067
|
-
return /* @__PURE__ */ jsx(
|
|
4068
|
-
OTPInput,
|
|
4069
|
-
{
|
|
4070
|
-
"data-slot": "input-otp",
|
|
4071
|
-
containerClassName: cn(
|
|
4072
|
-
"flex items-center gap-2 has-disabled:opacity-50",
|
|
4073
|
-
containerClassName
|
|
4074
|
-
),
|
|
4075
|
-
className: cn("disabled:cursor-not-allowed", className),
|
|
4076
|
-
...props
|
|
4077
|
-
}
|
|
4078
|
-
);
|
|
4079
|
-
}
|
|
4080
|
-
function InputOTPGroup({ className, ...props }) {
|
|
4081
|
-
return /* @__PURE__ */ jsx(
|
|
4082
|
-
"div",
|
|
4083
|
-
{
|
|
4084
|
-
"data-slot": "input-otp-group",
|
|
4085
|
-
className: cn("flex items-center", className),
|
|
4086
|
-
...props
|
|
4087
|
-
}
|
|
4088
|
-
);
|
|
4089
|
-
}
|
|
4090
|
-
function InputOTPSlot({
|
|
4091
|
-
index,
|
|
4092
|
-
className,
|
|
4093
|
-
...props
|
|
4094
|
-
}) {
|
|
4095
|
-
const inputOTPContext = React9.useContext(OTPInputContext);
|
|
4096
|
-
const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {};
|
|
4097
|
-
return /* @__PURE__ */ jsxs(
|
|
4098
|
-
"div",
|
|
4099
|
-
{
|
|
4100
|
-
"data-slot": "input-otp-slot",
|
|
4101
|
-
"data-active": isActive,
|
|
4102
|
-
className: cn(
|
|
4103
|
-
"relative flex h-9 w-9 items-center justify-center border-y border-r border-input text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md aria-invalid:border-destructive data-[active=true]:z-10 data-[active=true]:border-ring data-[active=true]:ring-[3px] data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:border-destructive data-[active=true]:aria-invalid:ring-destructive/20 dark:bg-input/30 dark:data-[active=true]:aria-invalid:ring-destructive/40",
|
|
4104
|
-
className
|
|
4105
|
-
),
|
|
4106
|
-
...props,
|
|
4107
|
-
children: [
|
|
4108
|
-
char,
|
|
4109
|
-
hasFakeCaret && /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "h-4 w-px animate-caret-blink bg-foreground duration-1000" }) })
|
|
4110
|
-
]
|
|
4111
|
-
}
|
|
4112
|
-
);
|
|
4113
|
-
}
|
|
4114
|
-
function InputOTPSeparator({ ...props }) {
|
|
4115
|
-
return /* @__PURE__ */ jsx("div", { "data-slot": "input-otp-separator", role: "separator", ...props, children: /* @__PURE__ */ jsx(MinusIcon, {}) });
|
|
4116
|
-
}
|
|
4117
4586
|
function ItemGroup({ className, ...props }) {
|
|
4118
4587
|
return /* @__PURE__ */ jsx(
|
|
4119
4588
|
"div",
|
|
@@ -4467,43 +4936,6 @@ function PaginationEllipsis({
|
|
|
4467
4936
|
}
|
|
4468
4937
|
);
|
|
4469
4938
|
}
|
|
4470
|
-
function ResizablePanelGroup({
|
|
4471
|
-
className,
|
|
4472
|
-
...props
|
|
4473
|
-
}) {
|
|
4474
|
-
return /* @__PURE__ */ jsx(
|
|
4475
|
-
ResizablePrimitive.Group,
|
|
4476
|
-
{
|
|
4477
|
-
"data-slot": "resizable-panel-group",
|
|
4478
|
-
className: cn(
|
|
4479
|
-
"flex h-full w-full aria-[orientation=vertical]:flex-col",
|
|
4480
|
-
className
|
|
4481
|
-
),
|
|
4482
|
-
...props
|
|
4483
|
-
}
|
|
4484
|
-
);
|
|
4485
|
-
}
|
|
4486
|
-
function ResizablePanel({ ...props }) {
|
|
4487
|
-
return /* @__PURE__ */ jsx(ResizablePrimitive.Panel, { "data-slot": "resizable-panel", ...props });
|
|
4488
|
-
}
|
|
4489
|
-
function ResizableHandle({
|
|
4490
|
-
withHandle,
|
|
4491
|
-
className,
|
|
4492
|
-
...props
|
|
4493
|
-
}) {
|
|
4494
|
-
return /* @__PURE__ */ jsx(
|
|
4495
|
-
ResizablePrimitive.Separator,
|
|
4496
|
-
{
|
|
4497
|
-
"data-slot": "resizable-handle",
|
|
4498
|
-
className: cn(
|
|
4499
|
-
"relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible: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",
|
|
4500
|
-
className
|
|
4501
|
-
),
|
|
4502
|
-
...props,
|
|
4503
|
-
children: withHandle && /* @__PURE__ */ jsx("div", { className: "z-10 flex h-4 w-3 items-center justify-center rounded-xs border bg-border", children: /* @__PURE__ */ jsx(GripVerticalIcon, { className: "size-2.5" }) })
|
|
4504
|
-
}
|
|
4505
|
-
);
|
|
4506
|
-
}
|
|
4507
4939
|
function Table({ className, ...props }) {
|
|
4508
4940
|
return /* @__PURE__ */ jsx(
|
|
4509
4941
|
"div",
|
|
@@ -4719,9 +5151,9 @@ var SIDEBAR_WIDTH = "16rem";
|
|
|
4719
5151
|
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
4720
5152
|
var SIDEBAR_WIDTH_ICON = "3rem";
|
|
4721
5153
|
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
4722
|
-
var SidebarContext =
|
|
5154
|
+
var SidebarContext = React5.createContext(null);
|
|
4723
5155
|
function useSidebar() {
|
|
4724
|
-
const context =
|
|
5156
|
+
const context = React5.useContext(SidebarContext);
|
|
4725
5157
|
if (!context) {
|
|
4726
5158
|
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
4727
5159
|
}
|
|
@@ -4737,10 +5169,10 @@ function SidebarProvider({
|
|
|
4737
5169
|
...props
|
|
4738
5170
|
}) {
|
|
4739
5171
|
const isMobile = useIsMobile();
|
|
4740
|
-
const [openMobile, setOpenMobile] =
|
|
4741
|
-
const [_open, _setOpen] =
|
|
4742
|
-
const [hasHydrated, setHasHydrated] =
|
|
4743
|
-
|
|
5172
|
+
const [openMobile, setOpenMobile] = React5.useState(false);
|
|
5173
|
+
const [_open, _setOpen] = React5.useState(defaultOpenProp ?? true);
|
|
5174
|
+
const [hasHydrated, setHasHydrated] = React5.useState(false);
|
|
5175
|
+
React5.useEffect(() => {
|
|
4744
5176
|
if (openProp !== void 0 || defaultOpenProp !== void 0) {
|
|
4745
5177
|
setHasHydrated(true);
|
|
4746
5178
|
return;
|
|
@@ -4751,7 +5183,7 @@ function SidebarProvider({
|
|
|
4751
5183
|
}
|
|
4752
5184
|
setHasHydrated(true);
|
|
4753
5185
|
}, [openProp, defaultOpenProp]);
|
|
4754
|
-
|
|
5186
|
+
React5.useEffect(() => {
|
|
4755
5187
|
if (!hasHydrated) return;
|
|
4756
5188
|
if (openProp !== void 0 || defaultOpenProp !== void 0) return;
|
|
4757
5189
|
const hasCookie = document.cookie.includes(SIDEBAR_COOKIE_NAME);
|
|
@@ -4760,7 +5192,7 @@ function SidebarProvider({
|
|
|
4760
5192
|
}
|
|
4761
5193
|
}, [hasHydrated, isMobile, openProp, defaultOpenProp]);
|
|
4762
5194
|
const open = openProp ?? _open;
|
|
4763
|
-
const setOpen =
|
|
5195
|
+
const setOpen = React5.useCallback(
|
|
4764
5196
|
(value) => {
|
|
4765
5197
|
const openState = typeof value === "function" ? value(open) : value;
|
|
4766
5198
|
if (setOpenProp) {
|
|
@@ -4772,10 +5204,10 @@ function SidebarProvider({
|
|
|
4772
5204
|
},
|
|
4773
5205
|
[setOpenProp, open]
|
|
4774
5206
|
);
|
|
4775
|
-
const toggleSidebar =
|
|
5207
|
+
const toggleSidebar = React5.useCallback(() => {
|
|
4776
5208
|
return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
|
|
4777
5209
|
}, [isMobile, setOpen, setOpenMobile]);
|
|
4778
|
-
|
|
5210
|
+
React5.useEffect(() => {
|
|
4779
5211
|
const handleKeyDown = (event) => {
|
|
4780
5212
|
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
4781
5213
|
event.preventDefault();
|
|
@@ -4786,7 +5218,7 @@ function SidebarProvider({
|
|
|
4786
5218
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
4787
5219
|
}, [toggleSidebar]);
|
|
4788
5220
|
const state = open || openMobile ? "expanded" : "collapsed";
|
|
4789
|
-
const contextValue =
|
|
5221
|
+
const contextValue = React5.useMemo(
|
|
4790
5222
|
() => ({
|
|
4791
5223
|
state,
|
|
4792
5224
|
open,
|
|
@@ -5244,7 +5676,7 @@ function SidebarMenuSkeleton({
|
|
|
5244
5676
|
showIcon = false,
|
|
5245
5677
|
...props
|
|
5246
5678
|
}) {
|
|
5247
|
-
const width =
|
|
5679
|
+
const width = React5.useMemo(() => {
|
|
5248
5680
|
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
5249
5681
|
}, []);
|
|
5250
5682
|
return /* @__PURE__ */ jsxs(
|
|
@@ -5711,8 +6143,8 @@ function ThemeModeToggle({
|
|
|
5711
6143
|
className
|
|
5712
6144
|
}) {
|
|
5713
6145
|
const { theme, setTheme } = useTheme();
|
|
5714
|
-
const [mounted, setMounted] =
|
|
5715
|
-
|
|
6146
|
+
const [mounted, setMounted] = React5.useState(false);
|
|
6147
|
+
React5.useEffect(() => {
|
|
5716
6148
|
setMounted(true);
|
|
5717
6149
|
}, []);
|
|
5718
6150
|
if (!mounted) {
|
|
@@ -5875,4 +6307,4 @@ function UserAvatar({ src, name, initials, size = "md", className }) {
|
|
|
5875
6307
|
] });
|
|
5876
6308
|
}
|
|
5877
6309
|
|
|
5878
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AnimatedTooltip, AspectRatio, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, ButtonGroup, ButtonGroupSeparator, ButtonGroupText,
|
|
6310
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AnimatedTooltip, AspectRatio, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, Combobox, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxList, ComboboxSeparator, ComboboxTrigger, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DataToolbar, DataToolbarActions, DataToolbarFilters, DataToolbarSearch, DirectionProvider2 as DirectionProvider, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, EmptyTitle, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, HoverCard, HoverCardContent, HoverCardTrigger, Icons, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Item9 as Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Kbd, KbdGroup, Label5 as Label, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, MetricCard, NativeSelect, NativeSelectOptGroup, NativeSelectOption, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, PALETTES, PageHeader, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PricingCard, Progress, RADII, RadioGroup4 as RadioGroup, RadioGroupItem, STYLES, ScrollArea, ScrollBar, ScrollToTopButton, SearchField, SectionCard, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator5 as Separator, SettingsSection, 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, ThemeModeToggle, Toaster3 as Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TopLoadingBar, TypewriterText, UserAvatar, badgeVariants, buttonGroupVariants, navigationMenuTriggerStyle, toggleVariants, useDirection2 as useDirection, useDisclosure, useFormField, useIsMobile, useMeasure, usePagination, useSidebar };
|