@muhgholy/next-drive 2.1.0 → 2.2.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.
@@ -1 +1 @@
1
- {"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../../../src/client/components/drive/sidebar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAmRxC,eAAO,MAAM,YAAY,yBA8BxB,CAAC"}
1
+ {"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../../../src/client/components/drive/sidebar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AA8RxC,eAAO,MAAM,YAAY,yBAgCxB,CAAC"}
@@ -10,6 +10,7 @@ declare const sheetVariants: (props?: ({
10
10
  side?: "top" | "bottom" | "left" | "right" | null | undefined;
11
11
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
12
12
  interface SheetContentProps extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>, VariantProps<typeof sheetVariants> {
13
+ hideCloseButton?: boolean;
13
14
  }
14
15
  declare const SheetContent: React.ForwardRefExoticComponent<SheetContentProps & React.RefAttributes<HTMLDivElement>>;
15
16
  declare const SheetHeader: {
@@ -1 +1 @@
1
- {"version":3,"file":"sheet.d.ts","sourceRoot":"","sources":["../../../../src/client/components/ui/sheet.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,cAAc,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAKjE,QAAA,MAAM,KAAK,sCAAsB,CAAA;AAEjC,QAAA,MAAM,YAAY,6GAAyB,CAAA;AAE3C,QAAA,MAAM,UAAU,2GAAuB,CAAA;AAEvC,QAAA,MAAM,WAAW,4CAAwB,CAAA;AAEzC,QAAA,MAAM,YAAY,6JAYhB,CAAA;AAGF,QAAA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,CAAA;AAGF,QAAA,MAAM,WAAW;8BAGd,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;;CAQtC,CAAA;AAGD,QAAA,MAAM,WAAW;8BAGd,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;;CAQtC,CAAA;AAGD,QAAA,MAAM,UAAU,mKASd,CAAA;AAGF,QAAA,MAAM,gBAAgB,6KASpB,CAAA;AAGF,OAAO,EACH,KAAK,EACL,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,gBAAgB,GACnB,CAAA"}
@@ -634,7 +634,7 @@ var sheetVariants = cva(
634
634
  }
635
635
  }
636
636
  );
637
- var SheetContent = React3.forwardRef(({ side = "right", className, children, ...props }, ref) => /* @__PURE__ */ jsxs(SheetPortal, { children: [
637
+ var SheetContent = React3.forwardRef(({ side = "right", className, children, hideCloseButton, ...props }, ref) => /* @__PURE__ */ jsxs(SheetPortal, { children: [
638
638
  /* @__PURE__ */ jsx(SheetOverlay, {}),
639
639
  /* @__PURE__ */ jsxs(
640
640
  SheetPrimitive.Content,
@@ -644,7 +644,7 @@ var SheetContent = React3.forwardRef(({ side = "right", className, children, ...
644
644
  ...props,
645
645
  children: [
646
646
  children,
647
- /* @__PURE__ */ jsxs(SheetPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary", children: [
647
+ !hideCloseButton && /* @__PURE__ */ jsxs(SheetPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary", children: [
648
648
  /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
649
649
  /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
650
650
  ] })
@@ -2025,7 +2025,7 @@ var DriveUpload = (props) => {
2025
2025
  }, [handleFiles]);
2026
2026
  const hasUploadsInProgress = uploads.some((u) => ["uploading", "queued", "pending"].includes(u.status));
2027
2027
  const activeUploads = uploads.filter((u) => ["uploading", "queued", "pending"].includes(u.status));
2028
- const renderDialog = () => /* @__PURE__ */ jsx(Dialog, { open: showUploadsDialog, onOpenChange: setShowUploadsDialog, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-md p-0 gap-0", children: [
2028
+ const renderDialog = () => /* @__PURE__ */ jsx(Dialog, { open: showUploadsDialog, onOpenChange: setShowUploadsDialog, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-md p-0 gap-0", showCloseButton: false, children: [
2029
2029
  /* @__PURE__ */ jsxs(DialogHeader, { className: "px-4 py-3 border-b flex-row items-center justify-between space-y-0", children: [
2030
2030
  /* @__PURE__ */ jsx(DialogTitle, { className: "text-base", children: "Upload Status" }),
2031
2031
  hasUploadsInProgress && /* @__PURE__ */ jsx(
@@ -2540,7 +2540,7 @@ var DriveFileChooser = (props) => {
2540
2540
  ] }) })
2541
2541
  ] });
2542
2542
  };
2543
- var SidebarContent = () => {
2543
+ var SidebarContent = ({ onNavigate }) => {
2544
2544
  const {
2545
2545
  accounts,
2546
2546
  activeAccountId,
@@ -2548,7 +2548,8 @@ var SidebarContent = () => {
2548
2548
  callAPI,
2549
2549
  refreshAccounts,
2550
2550
  currentView,
2551
- setCurrentView
2551
+ setCurrentView,
2552
+ isLoading
2552
2553
  } = useDrive();
2553
2554
  const [renameDialog, setRenameDialog] = useState({
2554
2555
  open: false,
@@ -2611,6 +2612,14 @@ var SidebarContent = () => {
2611
2612
  window.addEventListener("storage", storageListener);
2612
2613
  };
2613
2614
  return /* @__PURE__ */ jsxs("div", { className: "w-full h-full flex flex-col bg-muted/5 dark:bg-muted/10", children: [
2615
+ /* @__PURE__ */ jsx("div", { className: "h-1 w-full", children: isLoading && /* @__PURE__ */ jsx(
2616
+ Progress,
2617
+ {
2618
+ value: void 0,
2619
+ className: "h-full rounded-none bg-transparent",
2620
+ indicatorClassName: "animate-pulse bg-primary/60"
2621
+ }
2622
+ ) }),
2614
2623
  /* @__PURE__ */ jsx("div", { className: "p-2 border-b border-border/50", children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [
2615
2624
  /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { variant: "ghost", className: "w-full justify-between px-2 h-11 hover:bg-muted/50 dark:hover:bg-muted/30", children: [
2616
2625
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5 text-left min-w-0 flex-1", children: [
@@ -2627,16 +2636,21 @@ var SidebarContent = () => {
2627
2636
  ] }) }),
2628
2637
  /* @__PURE__ */ jsxs(DropdownMenuContent, { className: "w-56", align: "start", children: [
2629
2638
  /* @__PURE__ */ jsx(DropdownMenuLabel, { className: "text-[11px] font-medium text-muted-foreground uppercase tracking-wide", children: "Storage" }),
2630
- /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => setActiveAccountId(null), className: "gap-2 py-2", children: [
2631
- /* @__PURE__ */ jsx("span", { className: "flex-1 text-sm", children: "Local Storage" }),
2632
- activeAccountId === null && /* @__PURE__ */ jsx(Check, { className: "size-3.5 text-primary" })
2633
- ] }),
2639
+ /* @__PURE__ */ jsx(DropdownMenuItem, { onClick: () => {
2640
+ setActiveAccountId(null);
2641
+ setCurrentView("BROWSE");
2642
+ onNavigate?.();
2643
+ }, className: "gap-2 py-2", children: activeAccountId === null && /* @__PURE__ */ jsx(Check, { className: "size-3.5 text-primary" }) }),
2634
2644
  accounts.length > 0 && /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
2635
2645
  accounts.map((account) => /* @__PURE__ */ jsxs("div", { className: "flex items-center group", children: [
2636
2646
  /* @__PURE__ */ jsxs(
2637
2647
  DropdownMenuItem,
2638
2648
  {
2639
- onClick: () => setActiveAccountId(account.id),
2649
+ onClick: () => {
2650
+ setActiveAccountId(account.id);
2651
+ setCurrentView("BROWSE");
2652
+ onNavigate?.();
2653
+ },
2640
2654
  className: "flex-1 gap-2 py-2 pr-1",
2641
2655
  children: [
2642
2656
  /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
@@ -2700,7 +2714,10 @@ var SidebarContent = () => {
2700
2714
  "w-full justify-start gap-2.5 h-9 px-2.5 font-medium",
2701
2715
  currentView !== "TRASH" ? "bg-primary/10 text-primary hover:bg-primary/15 dark:bg-primary/15 dark:hover:bg-primary/20" : "hover:bg-muted/50 dark:hover:bg-muted/30"
2702
2716
  ),
2703
- onClick: () => setCurrentView("BROWSE"),
2717
+ onClick: () => {
2718
+ setCurrentView("BROWSE");
2719
+ onNavigate?.();
2720
+ },
2704
2721
  children: [
2705
2722
  /* @__PURE__ */ jsx(FolderOpen, { className: "size-4" }),
2706
2723
  "My Files"
@@ -2715,7 +2732,10 @@ var SidebarContent = () => {
2715
2732
  "w-full justify-start gap-2.5 h-9 px-2.5 font-medium",
2716
2733
  currentView === "TRASH" ? "bg-destructive/10 text-destructive hover:bg-destructive/15 dark:bg-destructive/15" : "hover:bg-muted/50 dark:hover:bg-muted/30"
2717
2734
  ),
2718
- onClick: () => setCurrentView("TRASH"),
2735
+ onClick: () => {
2736
+ setCurrentView("TRASH");
2737
+ onNavigate?.();
2738
+ },
2719
2739
  children: [
2720
2740
  /* @__PURE__ */ jsx(Trash2, { className: "size-4" }),
2721
2741
  "Trash"
@@ -2756,8 +2776,9 @@ var SidebarContent = () => {
2756
2776
  ] });
2757
2777
  };
2758
2778
  var DriveSidebar = () => {
2779
+ const [sheetOpen, setSheetOpen] = useState(false);
2759
2780
  return /* @__PURE__ */ jsxs(Fragment, { children: [
2760
- /* @__PURE__ */ jsx("div", { className: "lg:hidden", children: /* @__PURE__ */ jsxs(Sheet, { children: [
2781
+ /* @__PURE__ */ jsx("div", { className: "lg:hidden", children: /* @__PURE__ */ jsxs(Sheet, { open: sheetOpen, onOpenChange: setSheetOpen, children: [
2761
2782
  /* @__PURE__ */ jsx(SheetTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
2762
2783
  Button,
2763
2784
  {
@@ -2768,10 +2789,10 @@ var DriveSidebar = () => {
2768
2789
  children: /* @__PURE__ */ jsx(Menu, { className: "h-5 w-5" })
2769
2790
  }
2770
2791
  ) }),
2771
- /* @__PURE__ */ jsxs(SheetContent, { side: "left", className: "w-70 sm:w-80 p-0", children: [
2792
+ /* @__PURE__ */ jsxs(SheetContent, { side: "left", className: "w-70 sm:w-80 p-0", hideCloseButton: true, children: [
2772
2793
  /* @__PURE__ */ jsx(SheetTitle, { className: "sr-only", children: "Navigation Menu" }),
2773
2794
  /* @__PURE__ */ jsx(SheetDescription, { className: "sr-only", children: "Storage accounts and navigation" }),
2774
- /* @__PURE__ */ jsx(SidebarContent, {})
2795
+ /* @__PURE__ */ jsx(SidebarContent, { onNavigate: () => setSheetOpen(false) })
2775
2796
  ] })
2776
2797
  ] }) }),
2777
2798
  /* @__PURE__ */ jsx("div", { className: "hidden lg:flex w-full h-full", children: /* @__PURE__ */ jsx(SidebarContent, {}) })