@livo-tv/blocks 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +306 -134
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -1
- package/dist/index.d.ts +41 -1
- package/dist/index.js +305 -136
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -9,9 +9,9 @@ var classVarianceAuthority = require('class-variance-authority');
|
|
|
9
9
|
var jsxRuntime = require('react/jsx-runtime');
|
|
10
10
|
var AlertDialogPrimitive = require('@radix-ui/react-alert-dialog');
|
|
11
11
|
var reactSlot = require('@radix-ui/react-slot');
|
|
12
|
+
var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
|
|
12
13
|
var nextThemes = require('next-themes');
|
|
13
14
|
var framerMotion = require('framer-motion');
|
|
14
|
-
var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
|
|
15
15
|
var SliderPrimitive = require('@radix-ui/react-slider');
|
|
16
16
|
var TogglePrimitive = require('@radix-ui/react-toggle');
|
|
17
17
|
var DialogPrimitive = require('@radix-ui/react-dialog');
|
|
@@ -443,6 +443,179 @@ function ConfirmDestructiveDialog({
|
|
|
443
443
|
] })
|
|
444
444
|
] }) });
|
|
445
445
|
}
|
|
446
|
+
var miniMenuContentClassName = "max-h-none overflow-x-visible overflow-y-visible";
|
|
447
|
+
var miniMenuContentDefaults = {
|
|
448
|
+
sideOffset: 8,
|
|
449
|
+
collisionPadding: 12
|
|
450
|
+
};
|
|
451
|
+
function DropdownMenu({
|
|
452
|
+
...props
|
|
453
|
+
}) {
|
|
454
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Root, { "data-slot": "dropdown-menu", ...props });
|
|
455
|
+
}
|
|
456
|
+
function DropdownMenuTrigger({
|
|
457
|
+
...props
|
|
458
|
+
}) {
|
|
459
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
460
|
+
DropdownMenuPrimitive__namespace.Trigger,
|
|
461
|
+
{
|
|
462
|
+
"data-slot": "dropdown-menu-trigger",
|
|
463
|
+
...props
|
|
464
|
+
}
|
|
465
|
+
);
|
|
466
|
+
}
|
|
467
|
+
function DropdownMenuContent({
|
|
468
|
+
className,
|
|
469
|
+
sideOffset = 4,
|
|
470
|
+
...props
|
|
471
|
+
}) {
|
|
472
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
473
|
+
DropdownMenuPrimitive__namespace.Content,
|
|
474
|
+
{
|
|
475
|
+
"data-slot": "dropdown-menu-content",
|
|
476
|
+
sideOffset,
|
|
477
|
+
className: cn(
|
|
478
|
+
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-[200] max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
|
|
479
|
+
className
|
|
480
|
+
),
|
|
481
|
+
...props
|
|
482
|
+
}
|
|
483
|
+
) });
|
|
484
|
+
}
|
|
485
|
+
function DropdownMenuItem({
|
|
486
|
+
className,
|
|
487
|
+
inset,
|
|
488
|
+
variant = "default",
|
|
489
|
+
...props
|
|
490
|
+
}) {
|
|
491
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
492
|
+
DropdownMenuPrimitive__namespace.Item,
|
|
493
|
+
{
|
|
494
|
+
"data-slot": "dropdown-menu-item",
|
|
495
|
+
"data-inset": inset,
|
|
496
|
+
"data-variant": variant,
|
|
497
|
+
className: cn(
|
|
498
|
+
"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[highlighted]:[&_svg:not([class*='text-'])]:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:[&_svg:not([class*='text-'])]:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:data-[highlighted]:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 dark:data-[variant=destructive]:data-[highlighted]:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:data-[highlighted]:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
499
|
+
className
|
|
500
|
+
),
|
|
501
|
+
...props
|
|
502
|
+
}
|
|
503
|
+
);
|
|
504
|
+
}
|
|
505
|
+
var DEFAULT_NOTIFICATION_BELL_LABELS = {
|
|
506
|
+
title: "Notifications",
|
|
507
|
+
empty: "You're all caught up.",
|
|
508
|
+
viewAll: "View all"
|
|
509
|
+
};
|
|
510
|
+
function formatUnreadBadge(count) {
|
|
511
|
+
return count > 9 ? "9+" : String(count);
|
|
512
|
+
}
|
|
513
|
+
function defaultFormatTime(iso) {
|
|
514
|
+
const date = new Date(iso);
|
|
515
|
+
if (Number.isNaN(date.getTime())) return iso;
|
|
516
|
+
return date.toLocaleString(void 0, {
|
|
517
|
+
dateStyle: "short",
|
|
518
|
+
timeStyle: "short"
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
function NotificationListSkeleton({ rows = 3 }) {
|
|
522
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col", "aria-hidden": "true", children: Array.from({ length: rows }, (_, index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
523
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2 px-4 py-3", children: [
|
|
524
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
525
|
+
"div",
|
|
526
|
+
{
|
|
527
|
+
"data-slot": "skeleton",
|
|
528
|
+
className: "bg-muted h-4 w-36 animate-pulse rounded-md motion-reduce:animate-none"
|
|
529
|
+
}
|
|
530
|
+
),
|
|
531
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
532
|
+
"div",
|
|
533
|
+
{
|
|
534
|
+
"data-slot": "skeleton",
|
|
535
|
+
className: "bg-muted h-3 w-full animate-pulse rounded-md motion-reduce:animate-none"
|
|
536
|
+
}
|
|
537
|
+
),
|
|
538
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
539
|
+
"div",
|
|
540
|
+
{
|
|
541
|
+
"data-slot": "skeleton",
|
|
542
|
+
className: "bg-muted h-3 w-20 animate-pulse rounded-md motion-reduce:animate-none"
|
|
543
|
+
}
|
|
544
|
+
)
|
|
545
|
+
] }),
|
|
546
|
+
index < rows - 1 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-border h-px" }) : null
|
|
547
|
+
] }, index)) });
|
|
548
|
+
}
|
|
549
|
+
function NotificationBell({
|
|
550
|
+
items,
|
|
551
|
+
unreadCount,
|
|
552
|
+
isLoading = false,
|
|
553
|
+
labels: labelOverrides,
|
|
554
|
+
viewAllHref,
|
|
555
|
+
formatTime: formatTime2 = defaultFormatTime,
|
|
556
|
+
onOpenChange,
|
|
557
|
+
align = "end",
|
|
558
|
+
className
|
|
559
|
+
}) {
|
|
560
|
+
const labels = { ...DEFAULT_NOTIFICATION_BELL_LABELS, ...labelOverrides };
|
|
561
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { modal: false, onOpenChange, children: [
|
|
562
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
563
|
+
Button,
|
|
564
|
+
{
|
|
565
|
+
type: "button",
|
|
566
|
+
variant: "ghost",
|
|
567
|
+
size: "icon",
|
|
568
|
+
className: cn("relative size-9", className),
|
|
569
|
+
"aria-label": labels.title,
|
|
570
|
+
children: [
|
|
571
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Bell, { className: "size-4" }),
|
|
572
|
+
unreadCount > 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-destructive text-destructive-foreground absolute -top-0.5 -right-0.5 flex size-4 items-center justify-center rounded-full text-[10px] leading-none font-medium tabular-nums", children: formatUnreadBadge(unreadCount) }) : null
|
|
573
|
+
]
|
|
574
|
+
}
|
|
575
|
+
) }),
|
|
576
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuContent, { align, className: "w-80 p-0", children: [
|
|
577
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-between border-b px-4 py-3", children: /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "font-semibold", children: labels.title }) }),
|
|
578
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-h-80 overflow-y-auto", children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(NotificationListSkeleton, {}) : items.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground px-4 py-8 text-center text-sm", children: labels.empty }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col", children: items.map((item, index) => {
|
|
579
|
+
const body = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 space-y-1", children: [
|
|
580
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm leading-none font-medium", children: item.title }),
|
|
581
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground line-clamp-2 text-xs", children: item.message }),
|
|
582
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground/70 text-xs", children: formatTime2(item.createdAt) })
|
|
583
|
+
] });
|
|
584
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
585
|
+
item.href ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
586
|
+
"a",
|
|
587
|
+
{
|
|
588
|
+
href: item.href,
|
|
589
|
+
className: cn(
|
|
590
|
+
"hover:bg-muted/50 flex gap-3 px-4 py-3 motion-safe:transition-colors",
|
|
591
|
+
!item.read && "bg-muted/30"
|
|
592
|
+
),
|
|
593
|
+
children: body
|
|
594
|
+
}
|
|
595
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
596
|
+
"div",
|
|
597
|
+
{
|
|
598
|
+
className: cn(
|
|
599
|
+
"flex gap-3 px-4 py-3",
|
|
600
|
+
!item.read && "bg-muted/30"
|
|
601
|
+
),
|
|
602
|
+
children: body
|
|
603
|
+
}
|
|
604
|
+
),
|
|
605
|
+
index < items.length - 1 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-border h-px" }) : null
|
|
606
|
+
] }, item.id);
|
|
607
|
+
}) }) }),
|
|
608
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t px-4 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
609
|
+
"a",
|
|
610
|
+
{
|
|
611
|
+
href: viewAllHref,
|
|
612
|
+
className: "text-primary block text-center text-sm font-medium hover:underline",
|
|
613
|
+
children: labels.viewAll
|
|
614
|
+
}
|
|
615
|
+
) })
|
|
616
|
+
] })
|
|
617
|
+
] });
|
|
618
|
+
}
|
|
446
619
|
|
|
447
620
|
// src/components/editable/types.ts
|
|
448
621
|
var DEFAULT_EDITABLE_SECTION_LABELS = {
|
|
@@ -824,65 +997,6 @@ function SafeImage({
|
|
|
824
997
|
}
|
|
825
998
|
);
|
|
826
999
|
}
|
|
827
|
-
var miniMenuContentClassName = "max-h-none overflow-x-visible overflow-y-visible";
|
|
828
|
-
var miniMenuContentDefaults = {
|
|
829
|
-
sideOffset: 8,
|
|
830
|
-
collisionPadding: 12
|
|
831
|
-
};
|
|
832
|
-
function DropdownMenu({
|
|
833
|
-
...props
|
|
834
|
-
}) {
|
|
835
|
-
return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Root, { "data-slot": "dropdown-menu", ...props });
|
|
836
|
-
}
|
|
837
|
-
function DropdownMenuTrigger({
|
|
838
|
-
...props
|
|
839
|
-
}) {
|
|
840
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
841
|
-
DropdownMenuPrimitive__namespace.Trigger,
|
|
842
|
-
{
|
|
843
|
-
"data-slot": "dropdown-menu-trigger",
|
|
844
|
-
...props
|
|
845
|
-
}
|
|
846
|
-
);
|
|
847
|
-
}
|
|
848
|
-
function DropdownMenuContent({
|
|
849
|
-
className,
|
|
850
|
-
sideOffset = 4,
|
|
851
|
-
...props
|
|
852
|
-
}) {
|
|
853
|
-
return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
854
|
-
DropdownMenuPrimitive__namespace.Content,
|
|
855
|
-
{
|
|
856
|
-
"data-slot": "dropdown-menu-content",
|
|
857
|
-
sideOffset,
|
|
858
|
-
className: cn(
|
|
859
|
-
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-[200] max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
|
|
860
|
-
className
|
|
861
|
-
),
|
|
862
|
-
...props
|
|
863
|
-
}
|
|
864
|
-
) });
|
|
865
|
-
}
|
|
866
|
-
function DropdownMenuItem({
|
|
867
|
-
className,
|
|
868
|
-
inset,
|
|
869
|
-
variant = "default",
|
|
870
|
-
...props
|
|
871
|
-
}) {
|
|
872
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
873
|
-
DropdownMenuPrimitive__namespace.Item,
|
|
874
|
-
{
|
|
875
|
-
"data-slot": "dropdown-menu-item",
|
|
876
|
-
"data-inset": inset,
|
|
877
|
-
"data-variant": variant,
|
|
878
|
-
className: cn(
|
|
879
|
-
"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[highlighted]:[&_svg:not([class*='text-'])]:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:[&_svg:not([class*='text-'])]:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:data-[highlighted]:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 dark:data-[variant=destructive]:data-[highlighted]:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:data-[highlighted]:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
880
|
-
className
|
|
881
|
-
),
|
|
882
|
-
...props
|
|
883
|
-
}
|
|
884
|
-
);
|
|
885
|
-
}
|
|
886
1000
|
var defaultLabels = {
|
|
887
1001
|
theme: "Theme",
|
|
888
1002
|
system: "System",
|
|
@@ -4606,83 +4720,138 @@ function FileUploadTray({
|
|
|
4606
4720
|
const labels = { ...DEFAULT_FILE_UPLOAD_TRAY_LABELS, ...labelOverrides };
|
|
4607
4721
|
const visible = jobs.filter((job) => job.status !== "cancelled");
|
|
4608
4722
|
if (visible.length === 0) return null;
|
|
4723
|
+
return /* @__PURE__ */ jsxRuntime.jsx("section", { "aria-label": labels.title, className: cn("grid gap-3", className), children: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "grid gap-3", children: visible.map((job) => {
|
|
4724
|
+
const active = job.status === "uploading" || job.status === "completing";
|
|
4725
|
+
const canPause = job.status === "uploading";
|
|
4726
|
+
const canResume = job.status === "paused";
|
|
4727
|
+
const canCancel = job.status === "uploading" || job.status === "paused" || job.status === "error";
|
|
4728
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "grid gap-1.5", children: [
|
|
4729
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
4730
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "min-w-0 flex-1 truncate text-sm font-medium", children: job.name }),
|
|
4731
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-xs", children: statusLabel(job.status, labels) }),
|
|
4732
|
+
canPause ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4733
|
+
Button,
|
|
4734
|
+
{
|
|
4735
|
+
type: "button",
|
|
4736
|
+
variant: "ghost",
|
|
4737
|
+
size: "icon-sm",
|
|
4738
|
+
"aria-label": `${labels.pause} ${job.name}`,
|
|
4739
|
+
onClick: () => onPause(job.id),
|
|
4740
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pause, {})
|
|
4741
|
+
}
|
|
4742
|
+
) : null,
|
|
4743
|
+
canResume ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4744
|
+
Button,
|
|
4745
|
+
{
|
|
4746
|
+
type: "button",
|
|
4747
|
+
variant: "ghost",
|
|
4748
|
+
size: "icon-sm",
|
|
4749
|
+
"aria-label": `${labels.resume} ${job.name}`,
|
|
4750
|
+
onClick: () => onResume(job.id),
|
|
4751
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Play, {})
|
|
4752
|
+
}
|
|
4753
|
+
) : null,
|
|
4754
|
+
canCancel ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4755
|
+
Button,
|
|
4756
|
+
{
|
|
4757
|
+
type: "button",
|
|
4758
|
+
variant: "ghost",
|
|
4759
|
+
size: "icon-sm",
|
|
4760
|
+
"aria-label": `${labels.cancel} ${job.name}`,
|
|
4761
|
+
onClick: () => onCancel(job.id),
|
|
4762
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {})
|
|
4763
|
+
}
|
|
4764
|
+
) : null
|
|
4765
|
+
] }),
|
|
4766
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4767
|
+
"div",
|
|
4768
|
+
{
|
|
4769
|
+
role: "progressbar",
|
|
4770
|
+
"aria-valuemin": 0,
|
|
4771
|
+
"aria-valuemax": 100,
|
|
4772
|
+
"aria-valuenow": job.percent,
|
|
4773
|
+
"aria-label": job.name,
|
|
4774
|
+
className: "bg-muted h-2 overflow-hidden rounded-full",
|
|
4775
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4776
|
+
"div",
|
|
4777
|
+
{
|
|
4778
|
+
className: cn(
|
|
4779
|
+
"bg-primary h-full",
|
|
4780
|
+
active && "motion-safe:transition-[width]"
|
|
4781
|
+
),
|
|
4782
|
+
style: { width: `${job.percent}%` }
|
|
4783
|
+
}
|
|
4784
|
+
)
|
|
4785
|
+
}
|
|
4786
|
+
),
|
|
4787
|
+
job.error ? /* @__PURE__ */ jsxRuntime.jsx("p", { role: "alert", className: "text-destructive text-xs", children: job.error }) : null
|
|
4788
|
+
] }, job.id);
|
|
4789
|
+
}) }) });
|
|
4790
|
+
}
|
|
4791
|
+
function formatActiveBadge(count) {
|
|
4792
|
+
return count > 9 ? "9+" : String(count);
|
|
4793
|
+
}
|
|
4794
|
+
function isActiveStatus(status) {
|
|
4795
|
+
return status === "uploading" || status === "paused" || status === "completing";
|
|
4796
|
+
}
|
|
4797
|
+
function FileUploadMenu({
|
|
4798
|
+
jobs,
|
|
4799
|
+
labels: labelOverrides,
|
|
4800
|
+
onPause,
|
|
4801
|
+
onResume,
|
|
4802
|
+
onCancel,
|
|
4803
|
+
open,
|
|
4804
|
+
onOpenChange,
|
|
4805
|
+
align = "end",
|
|
4806
|
+
className
|
|
4807
|
+
}) {
|
|
4808
|
+
const labels = { ...DEFAULT_FILE_UPLOAD_TRAY_LABELS, ...labelOverrides };
|
|
4809
|
+
const visible = jobs.filter((job) => job.status !== "cancelled");
|
|
4810
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React7.useState(false);
|
|
4811
|
+
const isControlled = open !== void 0;
|
|
4812
|
+
const resolvedOpen = isControlled ? open : uncontrolledOpen;
|
|
4813
|
+
function setResolvedOpen(next) {
|
|
4814
|
+
if (!isControlled) setUncontrolledOpen(next);
|
|
4815
|
+
onOpenChange?.(next);
|
|
4816
|
+
}
|
|
4817
|
+
if (visible.length === 0) return null;
|
|
4818
|
+
const activeCount = visible.filter(
|
|
4819
|
+
(job) => isActiveStatus(job.status)
|
|
4820
|
+
).length;
|
|
4609
4821
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4610
|
-
|
|
4822
|
+
DropdownMenu,
|
|
4611
4823
|
{
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
className
|
|
4616
|
-
),
|
|
4824
|
+
modal: false,
|
|
4825
|
+
open: resolvedOpen,
|
|
4826
|
+
onOpenChange: setResolvedOpen,
|
|
4617
4827
|
children: [
|
|
4618
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
"aria-label": `${labels.resume} ${job.name}`,
|
|
4646
|
-
onClick: () => onResume(job.id),
|
|
4647
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Play, {})
|
|
4648
|
-
}
|
|
4649
|
-
) : null,
|
|
4650
|
-
canCancel ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4651
|
-
Button,
|
|
4652
|
-
{
|
|
4653
|
-
type: "button",
|
|
4654
|
-
variant: "ghost",
|
|
4655
|
-
size: "icon-sm",
|
|
4656
|
-
"aria-label": `${labels.cancel} ${job.name}`,
|
|
4657
|
-
onClick: () => onCancel(job.id),
|
|
4658
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {})
|
|
4659
|
-
}
|
|
4660
|
-
) : null
|
|
4661
|
-
] }),
|
|
4662
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4663
|
-
"div",
|
|
4664
|
-
{
|
|
4665
|
-
role: "progressbar",
|
|
4666
|
-
"aria-valuemin": 0,
|
|
4667
|
-
"aria-valuemax": 100,
|
|
4668
|
-
"aria-valuenow": job.percent,
|
|
4669
|
-
"aria-label": job.name,
|
|
4670
|
-
className: "bg-muted h-2 overflow-hidden rounded-full",
|
|
4671
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4672
|
-
"div",
|
|
4673
|
-
{
|
|
4674
|
-
className: cn(
|
|
4675
|
-
"bg-primary h-full",
|
|
4676
|
-
active && "motion-safe:transition-[width]"
|
|
4677
|
-
),
|
|
4678
|
-
style: { width: `${job.percent}%` }
|
|
4679
|
-
}
|
|
4680
|
-
)
|
|
4681
|
-
}
|
|
4682
|
-
),
|
|
4683
|
-
job.error ? /* @__PURE__ */ jsxRuntime.jsx("p", { role: "alert", className: "text-destructive text-xs", children: job.error }) : null
|
|
4684
|
-
] }, job.id);
|
|
4685
|
-
}) })
|
|
4828
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4829
|
+
Button,
|
|
4830
|
+
{
|
|
4831
|
+
type: "button",
|
|
4832
|
+
variant: "ghost",
|
|
4833
|
+
size: "icon",
|
|
4834
|
+
className: cn("relative size-9", className),
|
|
4835
|
+
"aria-label": labels.title,
|
|
4836
|
+
children: [
|
|
4837
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Upload, { className: "size-4" }),
|
|
4838
|
+
activeCount > 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-destructive text-destructive-foreground absolute -top-0.5 -right-0.5 flex size-4 items-center justify-center rounded-full text-[10px] leading-none font-medium tabular-nums", children: formatActiveBadge(activeCount) }) : null
|
|
4839
|
+
]
|
|
4840
|
+
}
|
|
4841
|
+
) }),
|
|
4842
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuContent, { align, className: "w-80 p-0", children: [
|
|
4843
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-between border-b px-4 py-3", children: /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "font-semibold", children: labels.title }) }),
|
|
4844
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-h-80 overflow-y-auto p-3", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4845
|
+
FileUploadTray,
|
|
4846
|
+
{
|
|
4847
|
+
jobs: visible,
|
|
4848
|
+
labels,
|
|
4849
|
+
onPause,
|
|
4850
|
+
onResume,
|
|
4851
|
+
onCancel
|
|
4852
|
+
}
|
|
4853
|
+
) })
|
|
4854
|
+
] })
|
|
4686
4855
|
]
|
|
4687
4856
|
}
|
|
4688
4857
|
);
|
|
@@ -4916,6 +5085,7 @@ exports.DEFAULT_EDITABLE_SECTION_LABELS = DEFAULT_EDITABLE_SECTION_LABELS;
|
|
|
4916
5085
|
exports.DEFAULT_FILE_DROPZONE_LABELS = DEFAULT_FILE_DROPZONE_LABELS;
|
|
4917
5086
|
exports.DEFAULT_FILE_UPLOAD_LABELS = DEFAULT_FILE_UPLOAD_LABELS;
|
|
4918
5087
|
exports.DEFAULT_FILE_UPLOAD_TRAY_LABELS = DEFAULT_FILE_UPLOAD_TRAY_LABELS;
|
|
5088
|
+
exports.DEFAULT_NOTIFICATION_BELL_LABELS = DEFAULT_NOTIFICATION_BELL_LABELS;
|
|
4919
5089
|
exports.DataList = DataList;
|
|
4920
5090
|
exports.DataListItem = DataListItem;
|
|
4921
5091
|
exports.EditableSection = EditableSection;
|
|
@@ -4930,10 +5100,12 @@ exports.ErrorState = ErrorState;
|
|
|
4930
5100
|
exports.FeedVideoPlayer = FeedVideoPlayer;
|
|
4931
5101
|
exports.FieldMessage = FieldMessage;
|
|
4932
5102
|
exports.FileDropzone = FileDropzone;
|
|
5103
|
+
exports.FileUploadMenu = FileUploadMenu;
|
|
4933
5104
|
exports.FileUploadTray = FileUploadTray;
|
|
4934
5105
|
exports.LanguageContext = LanguageContext;
|
|
4935
5106
|
exports.LanguageSwitcher = LanguageSwitcher;
|
|
4936
5107
|
exports.LoadingState = LoadingState;
|
|
5108
|
+
exports.NotificationBell = NotificationBell;
|
|
4937
5109
|
exports.SafeImage = SafeImage;
|
|
4938
5110
|
exports.ThemeSwitcher = ThemeSwitcher;
|
|
4939
5111
|
exports.VideoPlayer = VideoPlayer;
|