@squadbase/vantage 0.7.0 → 0.7.1-dev1.0d13f9a
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 +1 -1
- package/dist/add-AU3EDPNW.js +6 -0
- package/dist/add-AU3EDPNW.js.map +1 -0
- package/dist/{chunk-AABMKHEU.js → chunk-35B3YIBF.js} +16 -7
- package/dist/chunk-35B3YIBF.js.map +1 -0
- package/dist/{chunk-QNOX7WLZ.js → chunk-5HBUBVQ3.js} +94 -8
- package/dist/chunk-5HBUBVQ3.js.map +1 -0
- package/dist/{chunk-EG4PX726.js → chunk-GWXKENNH.js} +122 -5
- package/dist/chunk-GWXKENNH.js.map +1 -0
- package/dist/{chunk-77CISBMG.js → chunk-I2GWIPTD.js} +3685 -350
- package/dist/chunk-I2GWIPTD.js.map +1 -0
- package/dist/{chunk-TRMHNMMZ.js → chunk-LYUGDHSF.js} +3 -3
- package/dist/{chunk-TRMHNMMZ.js.map → chunk-LYUGDHSF.js.map} +1 -1
- package/dist/{chunk-2IAPIOPS.js → chunk-U6MWBCM6.js} +28 -7
- package/dist/chunk-U6MWBCM6.js.map +1 -0
- package/dist/{chunk-3RJEOP3J.js → chunk-XRKSIC5Z.js} +5 -3
- package/dist/chunk-XRKSIC5Z.js.map +1 -0
- package/dist/cli.js +2 -2
- package/dist/components/index.d.ts +849 -12
- package/dist/components/index.js +5 -5
- package/dist/{delta-text-CbrOaW83.d.ts → delta-text-tav2Lh5d.d.ts} +1 -1
- package/dist/doc/index.d.ts +2 -2
- package/dist/doc/index.js +4 -4
- package/dist/{format-DihQkL1N.d.ts → format-D34piCei.d.ts} +2 -1
- package/dist/geo-japan-7BMSOJRX.js +8 -0
- package/dist/geo-japan-7BMSOJRX.js.map +1 -0
- package/dist/geo-us-GVOG7VXH.js +8 -0
- package/dist/geo-us-GVOG7VXH.js.map +1 -0
- package/dist/geo-world-35HL56UU.js +8 -0
- package/dist/geo-world-35HL56UU.js.map +1 -0
- package/dist/slide/index.d.ts +2 -2
- package/dist/slide/index.js +4 -4
- package/dist/table/index.js +5 -6
- package/dist/table/index.js.map +1 -1
- package/dist/ui/index.d.ts +35 -4
- package/dist/ui/index.js +174 -11
- package/dist/ui/index.js.map +1 -1
- package/dist/{upgrade-6DT7ADRP.js → upgrade-MCHMELWC.js} +3 -3
- package/dist/{upgrade-6DT7ADRP.js.map → upgrade-MCHMELWC.js.map} +1 -1
- package/docs/en/agent-skills.md +13 -14
- package/docs/en/changelog.md +8 -0
- package/docs/en/parts/draft-chart.md +42 -0
- package/docs/en/parts/page-shell.md +1 -1
- package/docs/index.json +70 -50
- package/docs/ja/agent-skills.md +14 -14
- package/docs/ja/changelog.md +8 -0
- package/docs/ja/parts/draft-chart.md +40 -0
- package/docs/ja/parts/page-shell.md +1 -1
- package/package.json +2 -2
- package/registry/parts.json +5319 -0
- package/registry/ui/area-chart.tsx +43 -8
- package/registry/ui/bar-chart.tsx +43 -8
- package/registry/ui/bar-list.tsx +43 -8
- package/registry/ui/box-plot-chart.tsx +42 -7
- package/registry/ui/category-bar.tsx +25 -5
- package/registry/ui/chart-frame.tsx +55 -14
- package/registry/ui/checkbox.tsx +4 -3
- package/registry/ui/code-block.tsx +44 -0
- package/registry/ui/combo-chart.tsx +1869 -0
- package/registry/ui/combobox.tsx +7 -0
- package/registry/ui/context-menu.tsx +71 -0
- package/registry/ui/dashboard-card.tsx +23 -10
- package/registry/ui/data-table.tsx +10 -2
- package/registry/ui/date-range-picker.tsx +51 -4
- package/registry/ui/delta.tsx +39 -12
- package/registry/ui/donut-chart.tsx +43 -8
- package/registry/ui/echart.tsx +167 -7
- package/registry/ui/file-dropzone.tsx +143 -0
- package/registry/ui/filter-bar.tsx +77 -2
- package/registry/ui/forecast-chart.tsx +4769 -0
- package/registry/ui/funnel-steps.tsx +23 -5
- package/registry/ui/heatmap.tsx +20 -3
- package/registry/ui/histogram-chart.tsx +42 -7
- package/registry/ui/kpi-card.tsx +15 -9
- package/registry/ui/legend.tsx +73 -15
- package/registry/ui/line-chart.tsx +43 -8
- package/registry/ui/metric-value.tsx +2 -2
- package/registry/ui/page-shell.tsx +27 -4
- package/registry/ui/paired-chart.tsx +44 -9
- package/registry/ui/pivot-table.tsx +1260 -0
- package/registry/ui/progress-circle.tsx +2 -2
- package/registry/ui/progress.tsx +1 -1
- package/registry/ui/scatter-chart.tsx +50 -12
- package/registry/ui/sparkline.tsx +44 -9
- package/registry/ui/states.tsx +34 -1
- package/registry/ui/status-badge.tsx +7 -7
- package/registry/ui/tabs.tsx +1 -0
- package/registry/ui/treemap.tsx +1934 -0
- package/registry/ui/waterfall-chart.tsx +64 -11
- package/templates/AGENTS.md +3 -3
- package/templates/agents/page.md +5 -4
- package/dist/add-4GHF2TX2.js +0 -6
- package/dist/add-4GHF2TX2.js.map +0 -1
- package/dist/chunk-2IAPIOPS.js.map +0 -1
- package/dist/chunk-3RJEOP3J.js.map +0 -1
- package/dist/chunk-77CISBMG.js.map +0 -1
- package/dist/chunk-AABMKHEU.js.map +0 -1
- package/dist/chunk-EG4PX726.js.map +0 -1
- package/dist/chunk-NZ5QIIG4.js +0 -74
- package/dist/chunk-NZ5QIIG4.js.map +0 -1
- package/dist/chunk-QNOX7WLZ.js.map +0 -1
package/dist/ui/index.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { Badge, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Textarea, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, toggleVariants, useIsMobile, useSidebar } from '../chunk-QNOX7WLZ.js';
|
|
1
|
+
import { InputGroup, InputGroupInput, InputGroupAddon, InputGroupButton, Separator, DropdownMenuContent } from '../chunk-5HBUBVQ3.js';
|
|
2
|
+
export { Badge, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, DropdownMenuCheckboxItem as ContextMenuCheckboxItem, DropdownMenuGroup as ContextMenuGroup, DropdownMenuItem as ContextMenuItem, DropdownMenuLabel as ContextMenuLabel, DropdownMenuRadioGroup as ContextMenuRadioGroup, DropdownMenuRadioItem as ContextMenuRadioItem, DropdownMenuSeparator as ContextMenuSeparator, DropdownMenuShortcut as ContextMenuShortcut, DropdownMenuSub as ContextMenuSub, DropdownMenuSubContent as ContextMenuSubContent, DropdownMenuSubTrigger as ContextMenuSubTrigger, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, ErrorState, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Loading, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Textarea, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, toggleVariants, useIsMobile, useSidebar } from '../chunk-5HBUBVQ3.js';
|
|
4
3
|
import { Button } from '../chunk-ROHNXP7J.js';
|
|
5
4
|
export { Button, buttonVariants } from '../chunk-ROHNXP7J.js';
|
|
6
5
|
import { cn } from '../chunk-U736PVHY.js';
|
|
7
6
|
export { cn } from '../chunk-U736PVHY.js';
|
|
8
7
|
import { Accordion as Accordion$1 } from '@base-ui/react/accordion';
|
|
9
|
-
import { ChevronDownIcon, ChevronUpIcon, ChevronRightIcon, MoreHorizontalIcon, CheckIcon, XIcon, ChevronLeftIcon, Loader2Icon, CircleCheckIcon, InfoIcon, TriangleAlertIcon, OctagonXIcon } from 'lucide-react';
|
|
8
|
+
import { ChevronDownIcon, ChevronUpIcon, ChevronRightIcon, MoreHorizontalIcon, CheckIcon, XIcon, ChevronLeftIcon, Loader2Icon, CopyIcon, UploadIcon, CircleCheckIcon, InfoIcon, TriangleAlertIcon, OctagonXIcon } from 'lucide-react';
|
|
10
9
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
11
|
-
import * as
|
|
10
|
+
import * as React12 from 'react';
|
|
12
11
|
import { useMemo } from 'react';
|
|
13
12
|
import { cva } from 'class-variance-authority';
|
|
14
13
|
import { AlertDialog as AlertDialog$1 } from '@base-ui/react/alert-dialog';
|
|
@@ -26,6 +25,7 @@ import { Slider as Slider$1 } from '@base-ui/react/slider';
|
|
|
26
25
|
import { Switch as Switch$1 } from '@base-ui/react/switch';
|
|
27
26
|
import { Tabs as Tabs$1 } from '@base-ui/react/tabs';
|
|
28
27
|
import { Toast as Toast$1 } from '@base-ui/react/toast';
|
|
28
|
+
import { ContextMenu as ContextMenu$1 } from '@base-ui/react/context-menu';
|
|
29
29
|
|
|
30
30
|
// @squadbase/vantage — generated build. Do not edit.
|
|
31
31
|
function Accordion({ className, ...props }) {
|
|
@@ -527,6 +527,7 @@ function ComboboxTrigger({
|
|
|
527
527
|
Combobox$1.Trigger,
|
|
528
528
|
{
|
|
529
529
|
"data-slot": "combobox-trigger",
|
|
530
|
+
"aria-label": "Toggle options",
|
|
530
531
|
className: cn("[&_svg:not([class*='size-'])]:size-4", className),
|
|
531
532
|
...props,
|
|
532
533
|
children: [
|
|
@@ -546,6 +547,7 @@ function ComboboxClear({ className, ...props }) {
|
|
|
546
547
|
Combobox$1.Clear,
|
|
547
548
|
{
|
|
548
549
|
"data-slot": "combobox-clear",
|
|
550
|
+
"aria-label": "Clear",
|
|
549
551
|
render: /* @__PURE__ */ jsx(InputGroupButton, { variant: "ghost", size: "icon-xs" }),
|
|
550
552
|
className: cn(className),
|
|
551
553
|
...props,
|
|
@@ -760,6 +762,7 @@ function ComboboxChip({
|
|
|
760
762
|
render: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon-xs" }),
|
|
761
763
|
className: "-ml-1 opacity-50 hover:opacity-100",
|
|
762
764
|
"data-slot": "combobox-chip-remove",
|
|
765
|
+
"aria-label": typeof children === "string" || typeof children === "number" ? `Remove ${children}` : "Remove",
|
|
763
766
|
children: /* @__PURE__ */ jsx(
|
|
764
767
|
XIcon,
|
|
765
768
|
{
|
|
@@ -786,11 +789,11 @@ function ComboboxChipsInput({
|
|
|
786
789
|
);
|
|
787
790
|
}
|
|
788
791
|
function useComboboxAnchor() {
|
|
789
|
-
return
|
|
792
|
+
return React12.useRef(null);
|
|
790
793
|
}
|
|
791
|
-
var DrawerContext =
|
|
794
|
+
var DrawerContext = React12.createContext(null);
|
|
792
795
|
function useDrawer() {
|
|
793
|
-
const context =
|
|
796
|
+
const context = React12.useContext(DrawerContext);
|
|
794
797
|
if (!context) {
|
|
795
798
|
throw new Error("useDrawer must be used within a Drawer.");
|
|
796
799
|
}
|
|
@@ -804,7 +807,7 @@ function Drawer({
|
|
|
804
807
|
...props
|
|
805
808
|
}) {
|
|
806
809
|
const hasSnapPoints = snapPoints != null && snapPoints.length > 0;
|
|
807
|
-
const contextValue =
|
|
810
|
+
const contextValue = React12.useMemo(
|
|
808
811
|
() => ({ hasSnapPoints, modal, showSwipeHandle, swipeDirection }),
|
|
809
812
|
[hasSnapPoints, modal, showSwipeHandle, swipeDirection]
|
|
810
813
|
);
|
|
@@ -1401,7 +1404,7 @@ function ProgressTrack({ className, ...props }) {
|
|
|
1401
1404
|
Progress$1.Track,
|
|
1402
1405
|
{
|
|
1403
1406
|
className: cn(
|
|
1404
|
-
"relative flex h-1 w-full items-center overflow-x-hidden rounded-full bg-
|
|
1407
|
+
"relative flex h-1 w-full items-center overflow-x-hidden rounded-full bg-border",
|
|
1405
1408
|
className
|
|
1406
1409
|
),
|
|
1407
1410
|
"data-slot": "progress-track",
|
|
@@ -1659,6 +1662,7 @@ function TabsTrigger({ className, ...props }) {
|
|
|
1659
1662
|
"relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-[color,background-color,border-color,box-shadow] group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
1660
1663
|
"group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent",
|
|
1661
1664
|
"data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground",
|
|
1665
|
+
"[&_[data-slot=badge]]:h-4 [&_[data-slot=badge]]:min-w-4 [&_[data-slot=badge]]:px-1.5 [&_[data-slot=badge]]:tabular-nums [&_[data-slot=badge][data-variant=secondary]]:bg-foreground/10 [&_[data-slot=badge][data-variant=secondary]]:text-current",
|
|
1662
1666
|
"after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",
|
|
1663
1667
|
className
|
|
1664
1668
|
),
|
|
@@ -1880,7 +1884,166 @@ function Toaster({
|
|
|
1880
1884
|
}
|
|
1881
1885
|
var createToastManager = Toast$1.createToastManager;
|
|
1882
1886
|
var useToastManager = Toast$1.useToastManager;
|
|
1887
|
+
function CodeBlock({ code, title, className, ...props }) {
|
|
1888
|
+
const [copied, setCopied] = React12.useState(false);
|
|
1889
|
+
const copy = async () => {
|
|
1890
|
+
await navigator.clipboard.writeText(code);
|
|
1891
|
+
setCopied(true);
|
|
1892
|
+
setTimeout(() => setCopied(false), 1500);
|
|
1893
|
+
};
|
|
1894
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "code-block", className: cn("rounded-lg bg-muted", className), ...props, children: [
|
|
1895
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 border-b border-border px-3 py-1.5", children: [
|
|
1896
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-xs text-muted-foreground", children: title }),
|
|
1897
|
+
/* @__PURE__ */ jsxs(Button, { type: "button", variant: "ghost", size: "xs", onClick: copy, "aria-label": "Copy code", children: [
|
|
1898
|
+
copied ? /* @__PURE__ */ jsx(CheckIcon, {}) : /* @__PURE__ */ jsx(CopyIcon, {}),
|
|
1899
|
+
copied ? "Copied" : "Copy"
|
|
1900
|
+
] })
|
|
1901
|
+
] }),
|
|
1902
|
+
/* @__PURE__ */ jsx("pre", { className: "overflow-x-auto p-3 font-mono text-sm text-foreground", children: /* @__PURE__ */ jsx("code", { children: code }) })
|
|
1903
|
+
] });
|
|
1904
|
+
}
|
|
1905
|
+
function ContextMenu({ ...props }) {
|
|
1906
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Root, { "data-slot": "context-menu", ...props });
|
|
1907
|
+
}
|
|
1908
|
+
function ContextMenuTrigger({ className, ...props }) {
|
|
1909
|
+
return /* @__PURE__ */ jsx(
|
|
1910
|
+
ContextMenu$1.Trigger,
|
|
1911
|
+
{
|
|
1912
|
+
"data-slot": "context-menu-trigger",
|
|
1913
|
+
className: cn("select-none", className),
|
|
1914
|
+
...props
|
|
1915
|
+
}
|
|
1916
|
+
);
|
|
1917
|
+
}
|
|
1918
|
+
function ContextMenuContent({
|
|
1919
|
+
className,
|
|
1920
|
+
...props
|
|
1921
|
+
}) {
|
|
1922
|
+
return /* @__PURE__ */ jsx(
|
|
1923
|
+
DropdownMenuContent,
|
|
1924
|
+
{
|
|
1925
|
+
"data-slot": "context-menu-content",
|
|
1926
|
+
align: "start",
|
|
1927
|
+
side: "right",
|
|
1928
|
+
sideOffset: 0,
|
|
1929
|
+
className: cn("w-auto", className),
|
|
1930
|
+
...props
|
|
1931
|
+
}
|
|
1932
|
+
);
|
|
1933
|
+
}
|
|
1934
|
+
function matchesAccept(file, accept) {
|
|
1935
|
+
if (!accept) return true;
|
|
1936
|
+
const name = file.name.toLowerCase();
|
|
1937
|
+
return accept.split(",").some((raw) => {
|
|
1938
|
+
const t = raw.trim().toLowerCase();
|
|
1939
|
+
if (!t) return false;
|
|
1940
|
+
if (t.startsWith(".")) return name.endsWith(t);
|
|
1941
|
+
if (t.endsWith("/*")) return file.type.toLowerCase().startsWith(t.slice(0, -1));
|
|
1942
|
+
return file.type.toLowerCase() === t;
|
|
1943
|
+
});
|
|
1944
|
+
}
|
|
1945
|
+
function formatSize(bytes) {
|
|
1946
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
1947
|
+
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
1948
|
+
return `${(bytes / 1024 / 1024).toFixed(1)} MB`;
|
|
1949
|
+
}
|
|
1950
|
+
function FileDropzone({
|
|
1951
|
+
accept,
|
|
1952
|
+
maxSize,
|
|
1953
|
+
multiple = false,
|
|
1954
|
+
disabled = false,
|
|
1955
|
+
onFilesChange,
|
|
1956
|
+
className,
|
|
1957
|
+
...props
|
|
1958
|
+
}) {
|
|
1959
|
+
const inputRef = React12.useRef(null);
|
|
1960
|
+
const [files, setFiles] = React12.useState([]);
|
|
1961
|
+
const [error, setError] = React12.useState(null);
|
|
1962
|
+
const [dragOver, setDragOver] = React12.useState(false);
|
|
1963
|
+
const commit = (next) => {
|
|
1964
|
+
setFiles(next);
|
|
1965
|
+
onFilesChange?.(next);
|
|
1966
|
+
};
|
|
1967
|
+
const accepting = (incoming) => {
|
|
1968
|
+
const list = multiple ? incoming : incoming.slice(0, 1);
|
|
1969
|
+
const badType = list.find((f) => !matchesAccept(f, accept));
|
|
1970
|
+
if (badType) return setError(`${badType.name}: this file type isn't accepted${accept ? ` (${accept})` : ""}.`);
|
|
1971
|
+
const tooBig = maxSize === void 0 ? void 0 : list.find((f) => f.size > maxSize);
|
|
1972
|
+
if (tooBig) return setError(`${tooBig.name}: larger than ${formatSize(maxSize)}.`);
|
|
1973
|
+
setError(null);
|
|
1974
|
+
commit(multiple ? [...files, ...list] : list);
|
|
1975
|
+
};
|
|
1976
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "file-dropzone", className: cn("flex flex-col gap-2", className), ...props, children: [
|
|
1977
|
+
/* @__PURE__ */ jsxs(
|
|
1978
|
+
"button",
|
|
1979
|
+
{
|
|
1980
|
+
type: "button",
|
|
1981
|
+
disabled,
|
|
1982
|
+
"data-state": error ? "error" : dragOver ? "drag-over" : "idle",
|
|
1983
|
+
onClick: () => inputRef.current?.click(),
|
|
1984
|
+
onDragOver: (e) => {
|
|
1985
|
+
e.preventDefault();
|
|
1986
|
+
if (!disabled) setDragOver(true);
|
|
1987
|
+
},
|
|
1988
|
+
onDragLeave: () => setDragOver(false),
|
|
1989
|
+
onDrop: (e) => {
|
|
1990
|
+
e.preventDefault();
|
|
1991
|
+
setDragOver(false);
|
|
1992
|
+
if (!disabled) accepting(Array.from(e.dataTransfer.files));
|
|
1993
|
+
},
|
|
1994
|
+
className: cn(
|
|
1995
|
+
"flex flex-col items-center gap-1 rounded-lg border border-dashed border-border bg-card px-6 py-8 text-sm text-muted-foreground outline-none transition-colors hover:bg-muted focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50",
|
|
1996
|
+
"data-[state=drag-over]:border-primary data-[state=drag-over]:bg-muted data-[state=error]:border-destructive"
|
|
1997
|
+
),
|
|
1998
|
+
children: [
|
|
1999
|
+
/* @__PURE__ */ jsx(UploadIcon, { className: "size-5", "aria-hidden": true }),
|
|
2000
|
+
/* @__PURE__ */ jsxs("span", { className: "font-medium text-foreground", children: [
|
|
2001
|
+
"Drop ",
|
|
2002
|
+
multiple ? "files" : "a file",
|
|
2003
|
+
" here, or click to browse"
|
|
2004
|
+
] }),
|
|
2005
|
+
(accept || maxSize !== void 0) && /* @__PURE__ */ jsx("span", { className: "text-xs", children: [accept, maxSize !== void 0 && `up to ${formatSize(maxSize)}`].filter(Boolean).join(" \xB7 ") })
|
|
2006
|
+
]
|
|
2007
|
+
}
|
|
2008
|
+
),
|
|
2009
|
+
/* @__PURE__ */ jsx(
|
|
2010
|
+
"input",
|
|
2011
|
+
{
|
|
2012
|
+
ref: inputRef,
|
|
2013
|
+
type: "file",
|
|
2014
|
+
hidden: true,
|
|
2015
|
+
accept,
|
|
2016
|
+
multiple,
|
|
2017
|
+
disabled,
|
|
2018
|
+
"data-slot": "file-dropzone-input",
|
|
2019
|
+
onChange: (e) => {
|
|
2020
|
+
accepting(Array.from(e.target.files ?? []));
|
|
2021
|
+
e.target.value = "";
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
),
|
|
2025
|
+
error && /* @__PURE__ */ jsx("p", { role: "alert", className: "text-sm text-destructive", children: error }),
|
|
2026
|
+
files.length > 0 && /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-1 text-sm", children: files.map((f, i) => /* @__PURE__ */ jsxs("li", { className: "flex items-center justify-between gap-2 rounded-md bg-muted px-2 py-1", children: [
|
|
2027
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: f.name }),
|
|
2028
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1 text-xs text-muted-foreground tabular-nums", children: [
|
|
2029
|
+
formatSize(f.size),
|
|
2030
|
+
/* @__PURE__ */ jsx(
|
|
2031
|
+
Button,
|
|
2032
|
+
{
|
|
2033
|
+
type: "button",
|
|
2034
|
+
variant: "ghost",
|
|
2035
|
+
size: "icon",
|
|
2036
|
+
className: "size-6",
|
|
2037
|
+
"aria-label": `Remove ${f.name}`,
|
|
2038
|
+
onClick: () => commit(files.filter((_, j) => j !== i)),
|
|
2039
|
+
children: /* @__PURE__ */ jsx(XIcon, {})
|
|
2040
|
+
}
|
|
2041
|
+
)
|
|
2042
|
+
] })
|
|
2043
|
+
] }, `${f.name}-${i}`)) })
|
|
2044
|
+
] });
|
|
2045
|
+
}
|
|
1883
2046
|
|
|
1884
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertAction, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerSwipeHandle, DrawerTitle, DrawerTrigger, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, HoverCard, HoverCardContent, HoverCardTrigger, Kbd, KbdGroup, Label, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, RadioGroup, RadioGroupItem, ScrollArea, ScrollBar, Slider, Spinner, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Toast, ToastAction, ToastClose, ToastContent, ToastDescription, ToastPortal, ToastProvider, ToastTitle, ToastViewport, Toaster, createToastManager, tabsListVariants, toast, useComboboxAnchor, useToastManager };
|
|
2047
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertAction, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, CodeBlock, Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue, ContextMenu, ContextMenuContent, ContextMenuTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerSwipeHandle, DrawerTitle, DrawerTrigger, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, FileDropzone, HoverCard, HoverCardContent, HoverCardTrigger, Kbd, KbdGroup, Label, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, RadioGroup, RadioGroupItem, ScrollArea, ScrollBar, Slider, Spinner, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Toast, ToastAction, ToastClose, ToastContent, ToastDescription, ToastPortal, ToastProvider, ToastTitle, ToastViewport, Toaster, createToastManager, tabsListVariants, toast, useComboboxAnchor, useToastManager };
|
|
1885
2048
|
//# sourceMappingURL=index.js.map
|
|
1886
2049
|
//# sourceMappingURL=index.js.map
|