@burdenoff/microfe-files 2026.1124.1 → 2026.1126.1

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.
Files changed (35) hide show
  1. package/dist/files/FilesRoutes.js +32 -27
  2. package/dist/files/FilesRoutes.js.map +1 -1
  3. package/dist/files/components/ConfirmDialog.js +20 -15
  4. package/dist/files/components/ConfirmDialog.js.map +1 -1
  5. package/dist/files/components/CopyDialog.js +99 -81
  6. package/dist/files/components/CopyDialog.js.map +1 -1
  7. package/dist/files/components/FileBrowser.js +124 -123
  8. package/dist/files/components/FileBrowser.js.map +1 -1
  9. package/dist/files/components/FileInfoPanel.js +109 -101
  10. package/dist/files/components/FileInfoPanel.js.map +1 -1
  11. package/dist/files/components/FileVersionPanel.js +113 -109
  12. package/dist/files/components/FileVersionPanel.js.map +1 -1
  13. package/dist/files/components/MoveDialog.js +75 -65
  14. package/dist/files/components/MoveDialog.js.map +1 -1
  15. package/dist/files/components/ShareAccessParts.js +8 -7
  16. package/dist/files/components/ShareAccessParts.js.map +1 -1
  17. package/dist/files/components/ShareDialog.js +17 -16
  18. package/dist/files/components/ShareDialog.js.map +1 -1
  19. package/dist/files/components/SharedFolderView.js +29 -26
  20. package/dist/files/components/SharedFolderView.js.map +1 -1
  21. package/dist/files/components/UploadQueue.js +1 -0
  22. package/dist/files/components/UploadQueue.js.map +1 -1
  23. package/dist/files/components/loadingSystem.d.ts +64 -0
  24. package/dist/files/components/loadingSystem.js +56 -0
  25. package/dist/files/components/loadingSystem.js.map +1 -0
  26. package/dist/files/pages/BrowserPage.js +495 -475
  27. package/dist/files/pages/BrowserPage.js.map +1 -1
  28. package/dist/files/pages/FilePreviewPage.d.ts +2 -0
  29. package/dist/files/pages/FilePreviewPage.js +47 -0
  30. package/dist/files/pages/FilePreviewPage.js.map +1 -0
  31. package/dist/files/v2/FilesPage.js +10 -9
  32. package/dist/files/v2/FilesPage.js.map +1 -1
  33. package/dist/generated/wspace-operations.js +792 -13
  34. package/dist/generated/wspace-operations.js.map +1 -1
  35. package/package.json +2 -2
@@ -1,50 +1,55 @@
1
1
  import { BrowserPage as e } from "./pages/BrowserPage.js";
2
2
  import { ShareAccessPage as t } from "./pages/ShareAccessPage.js";
3
- import { useFilesContext as n } from "./providers/FilesProvider.js";
4
- import { Suspense as r, lazy as i } from "react";
5
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
6
- import { Navigate as s, Route as c, Routes as l, useLocation as u } from "react-router";
7
- import { useWorkspacePagesV2 as d } from "@burdenoff/fe-libs/ui";
3
+ import { FilePreviewPage as n } from "./pages/FilePreviewPage.js";
4
+ import { useFilesContext as r } from "./providers/FilesProvider.js";
5
+ import { Suspense as i, lazy as a } from "react";
6
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
7
+ import { Navigate as c, Route as l, Routes as u, useLocation as d } from "react-router";
8
+ import { useWorkspacePagesV2 as f } from "@burdenoff/fe-libs/ui";
8
9
  // src/files/FilesRoutes.tsx
9
- var f = i(() => import("./v2/FilesV2Routes.js").then((e) => ({ default: e.FilesV2Routes })));
10
- function p() {
11
- let { basePath: i } = n(), p = u(), m = d(), h = i.replace(/\/+$/, "") || "/", g = `${h === "/" ? "" : h}/share/:token`, _ = `${h === "/" ? "" : h}/share/`, v = `${h === "/" ? "" : h}/browse`;
12
- return p.pathname.startsWith(_) ? /* @__PURE__ */ a(t, {}) : m ? /* @__PURE__ */ a(r, {
10
+ var p = a(() => import("./v2/FilesV2Routes.js").then((e) => ({ default: e.FilesV2Routes })));
11
+ function m() {
12
+ let { basePath: a, workspaceId: m, currentUser: h } = r(), g = d(), _ = f(), v = a.replace(/\/+$/, "") || "/", y = `${v === "/" ? "" : v}/share/:token`, b = `${v === "/" ? "" : v}/share/`, x = `${v === "/" ? "" : v}/browse`;
13
+ return g.pathname.startsWith(b) ? /* @__PURE__ */ o(t, {}) : _ ? /* @__PURE__ */ o(i, {
13
14
  fallback: null,
14
- children: /* @__PURE__ */ a(f, {})
15
- }) : /* @__PURE__ */ o(l, { children: [
16
- /* @__PURE__ */ a(c, {
15
+ children: /* @__PURE__ */ o(p, {})
16
+ }) : /* @__PURE__ */ s(u, { children: [
17
+ /* @__PURE__ */ o(l, {
17
18
  index: !0,
18
- element: /* @__PURE__ */ a(s, {
19
- to: v,
19
+ element: /* @__PURE__ */ o(c, {
20
+ to: x,
20
21
  replace: !0
21
22
  })
22
23
  }),
23
- /* @__PURE__ */ a(c, {
24
+ /* @__PURE__ */ o(l, {
24
25
  path: "browse",
25
- element: /* @__PURE__ */ a(e, {})
26
+ element: /* @__PURE__ */ o(e, {})
26
27
  }),
27
- /* @__PURE__ */ a(c, {
28
+ /* @__PURE__ */ o(l, {
28
29
  path: "browse/:folderId",
29
- element: /* @__PURE__ */ a(e, {})
30
+ element: /* @__PURE__ */ o(e, {})
30
31
  }),
31
- /* @__PURE__ */ a(c, {
32
+ /* @__PURE__ */ o(l, {
33
+ path: "preview/:fileId",
34
+ element: /* @__PURE__ */ o(n, {}, `${m}:${h?.id}`)
35
+ }),
36
+ /* @__PURE__ */ o(l, {
32
37
  path: "share/:token",
33
- element: /* @__PURE__ */ a(t, {})
38
+ element: /* @__PURE__ */ o(t, {})
34
39
  }),
35
- /* @__PURE__ */ a(c, {
36
- path: g,
37
- element: /* @__PURE__ */ a(t, {})
40
+ /* @__PURE__ */ o(l, {
41
+ path: y,
42
+ element: /* @__PURE__ */ o(t, {})
38
43
  }),
39
- /* @__PURE__ */ a(c, {
44
+ /* @__PURE__ */ o(l, {
40
45
  path: "*",
41
- element: /* @__PURE__ */ a(s, {
42
- to: v,
46
+ element: /* @__PURE__ */ o(c, {
47
+ to: x,
43
48
  replace: !0
44
49
  })
45
50
  })
46
51
  ] });
47
52
  }
48
- export { p as FilesRoutes };
53
+ export { m as FilesRoutes };
49
54
 
50
55
  //# sourceMappingURL=FilesRoutes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FilesRoutes.js","names":["FilesV2Routes","lazy","m","FilesRoutes","useFilesContext","location","useLocation","workspacePagesV2","useWorkspacePagesV2","normalizedBasePath","basePath","absoluteSharePath","absoluteSharePrefix","absoluteBrowsePath","ShareAccessPage","Suspense","Routes","Route","Navigate","BrowserPage"],"sources":["../../src/files/FilesRoutes.tsx"],"sourcesContent":["import { lazy, Suspense } from \"react\";\nimport { Navigate, Route, Routes, useLocation } from \"react-router\";\nimport { useWorkspacePagesV2 } from \"@burdenoff/fe-libs/ui\";\nimport { BrowserPage } from \"./pages/BrowserPage\";\nimport { ShareAccessPage } from \"./pages/ShareAccessPage\";\nimport { useFilesContext } from \"./providers/FilesProvider\";\n\n// Workspace pages v2 (BOFF-15821): the redesigned Files page, for hosts that opt in.\nconst FilesV2Routes = lazy(() =>\n import(\"./v2/FilesV2Routes\").then((m) => ({ default: m.FilesV2Routes })),\n);\n\n/**\n * Internal router for the Files microfrontend.\n * This component handles routing within the microfrontend using React Router v7.\n *\n * Routes:\n * - / → Redirect to browse\n * - /browse → File browser page (root folder) - eager loaded\n * - /browse/:folderId → File browser page (specific folder) - eager loaded\n * - /* → Catch-all redirects to browse\n */\nexport function FilesRoutes() {\n const { basePath } = useFilesContext();\n const location = useLocation();\n // Off everywhere but FluidGrids (AppShellConfig.workspacePagesV2): the routes below, unchanged.\n const workspacePagesV2 = useWorkspacePagesV2();\n const normalizedBasePath = basePath.replace(/\\/+$/, \"\") || \"/\";\n const absoluteSharePath = `${normalizedBasePath === \"/\" ? \"\" : normalizedBasePath}/share/:token`;\n const absoluteSharePrefix = `${normalizedBasePath === \"/\" ? \"\" : normalizedBasePath}/share/`;\n // Absolute target for default + catch-all redirects. Using a relative `to=\"browse\"`\n // here causes an infinite path-compounding loop when a splat (`path=\"*\"`) matches a\n // host-shell sibling route (e.g. `/files/shared`): React Router resolves the\n // relative path against the splat-matched URL, so each render appends another\n // `/browse` segment (`/files/shared/browse/browse/...`).\n const absoluteBrowsePath = `${normalizedBasePath === \"/\" ? \"\" : normalizedBasePath}/browse`;\n\n if (location.pathname.startsWith(absoluteSharePrefix)) {\n return <ShareAccessPage />;\n }\n\n if (workspacePagesV2) {\n return (\n <Suspense fallback={null}>\n <FilesV2Routes />\n </Suspense>\n );\n }\n\n return (\n <Routes>\n {/* Default route - redirect to browse */}\n <Route index element={<Navigate to={absoluteBrowsePath} replace />} />\n\n {/* Main pages - BrowserPage is eager loaded (primary entry point) */}\n <Route path=\"browse\" element={<BrowserPage />} />\n <Route path=\"browse/:folderId\" element={<BrowserPage />} />\n <Route path=\"share/:token\" element={<ShareAccessPage />} />\n <Route path={absoluteSharePath} element={<ShareAccessPage />} />\n\n {/* Catch-all route - redirect to browse (absolute to avoid splat-relative compounding) */}\n <Route path=\"*\" element={<Navigate to={absoluteBrowsePath} replace />} />\n </Routes>\n );\n}\n"],"mappings":";;;;;;;;AAQA,IAAMA,IAAgBC,QACpB,OAAO,wBAAqB,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,cAAc,EAAE,CACzE;AAYA,SAAgBC,IAAc;CAC5B,IAAM,EAAE,gBAAaC,EAAgB,GAC/BC,IAAWC,EAAY,GAEvBC,IAAmBC,EAAoB,GACvCC,IAAqBC,EAAS,QAAQ,QAAQ,EAAE,KAAK,KACrDC,IAAoB,GAAGF,MAAuB,MAAM,KAAKA,EAAmB,gBAC5EG,IAAsB,GAAGH,MAAuB,MAAM,KAAKA,EAAmB,UAM9EI,IAAqB,GAAGJ,MAAuB,MAAM,KAAKA,EAAmB;CAcnF,OAZIJ,EAAS,SAAS,WAAWO,CAAmB,IAC3C,kBAACE,GAAD,CAAkB,CAAA,IAGvBP,IAEA,kBAACQ,GAAD;EAAU,UAAU;EAClB,UAAA,kBAACf,GAAD,CAAgB,CAAA;CACR,CAAA,IAKZ,kBAACgB,GAAD,EAAA,UAAA;EAEE,kBAACC,GAAD;GAAO,OAAA;GAAM,SAAS,kBAACC,GAAD;IAAU,IAAIL;IAAoB,SAAA;GAAS,CAAA;EAAI,CAAA;EAGrE,kBAACI,GAAD;GAAO,MAAK;GAAS,SAAS,kBAACE,GAAD,CAAc,CAAA;EAAI,CAAA;EAChD,kBAACF,GAAD;GAAO,MAAK;GAAmB,SAAS,kBAACE,GAAD,CAAc,CAAA;EAAI,CAAA;EAC1D,kBAACF,GAAD;GAAO,MAAK;GAAe,SAAS,kBAACH,GAAD,CAAkB,CAAA;EAAI,CAAA;EAC1D,kBAACG,GAAD;GAAO,MAAMN;GAAmB,SAAS,kBAACG,GAAD,CAAkB,CAAA;EAAI,CAAA;EAG/D,kBAACG,GAAD;GAAO,MAAK;GAAI,SAAS,kBAACC,GAAD;IAAU,IAAIL;IAAoB,SAAA;GAAS,CAAA;EAAI,CAAA;CAClE,EAAA,CAAA;AAEZ"}
1
+ {"version":3,"file":"FilesRoutes.js","names":["FilesV2Routes","lazy","m","FilesRoutes","useFilesContext","location","useLocation","workspacePagesV2","useWorkspacePagesV2","normalizedBasePath","basePath","absoluteSharePath","absoluteSharePrefix","absoluteBrowsePath","ShareAccessPage","Suspense","Routes","Route","Navigate","BrowserPage","FilePreviewPage","workspaceId","currentUser"],"sources":["../../src/files/FilesRoutes.tsx"],"sourcesContent":["import { lazy, Suspense } from \"react\";\nimport { Navigate, Route, Routes, useLocation } from \"react-router\";\nimport { useWorkspacePagesV2 } from \"@burdenoff/fe-libs/ui\";\nimport { BrowserPage } from \"./pages/BrowserPage\";\nimport { ShareAccessPage } from \"./pages/ShareAccessPage\";\nimport { FilePreviewPage } from \"./pages/FilePreviewPage\";\nimport { useFilesContext } from \"./providers/FilesProvider\";\n\n// Workspace pages v2 (BOFF-15821): the redesigned Files page, for hosts that opt in.\nconst FilesV2Routes = lazy(() =>\n import(\"./v2/FilesV2Routes\").then((m) => ({ default: m.FilesV2Routes })),\n);\n\n/**\n * Internal router for the Files microfrontend.\n * This component handles routing within the microfrontend using React Router v7.\n *\n * Routes:\n * - / → Redirect to browse\n * - /browse → File browser page (root folder) - eager loaded\n * - /browse/:folderId → File browser page (specific folder) - eager loaded\n * - /* → Catch-all redirects to browse\n */\nexport function FilesRoutes() {\n const { basePath, workspaceId, currentUser } = useFilesContext();\n const location = useLocation();\n // Off everywhere but FluidGrids (AppShellConfig.workspacePagesV2): the routes below, unchanged.\n const workspacePagesV2 = useWorkspacePagesV2();\n const normalizedBasePath = basePath.replace(/\\/+$/, \"\") || \"/\";\n const absoluteSharePath = `${normalizedBasePath === \"/\" ? \"\" : normalizedBasePath}/share/:token`;\n const absoluteSharePrefix = `${normalizedBasePath === \"/\" ? \"\" : normalizedBasePath}/share/`;\n // Absolute target for default + catch-all redirects. Using a relative `to=\"browse\"`\n // here causes an infinite path-compounding loop when a splat (`path=\"*\"`) matches a\n // host-shell sibling route (e.g. `/files/shared`): React Router resolves the\n // relative path against the splat-matched URL, so each render appends another\n // `/browse` segment (`/files/shared/browse/browse/...`).\n const absoluteBrowsePath = `${normalizedBasePath === \"/\" ? \"\" : normalizedBasePath}/browse`;\n\n if (location.pathname.startsWith(absoluteSharePrefix)) {\n return <ShareAccessPage />;\n }\n\n if (workspacePagesV2) {\n return (\n <Suspense fallback={null}>\n <FilesV2Routes />\n </Suspense>\n );\n }\n\n return (\n <Routes>\n {/* Default route - redirect to browse */}\n <Route index element={<Navigate to={absoluteBrowsePath} replace />} />\n\n {/* Main pages - BrowserPage is eager loaded (primary entry point) */}\n <Route path=\"browse\" element={<BrowserPage />} />\n <Route path=\"browse/:folderId\" element={<BrowserPage />} />\n <Route\n path=\"preview/:fileId\"\n element={<FilePreviewPage key={`${workspaceId}:${currentUser?.id}`} />}\n />\n <Route path=\"share/:token\" element={<ShareAccessPage />} />\n <Route path={absoluteSharePath} element={<ShareAccessPage />} />\n\n {/* Catch-all route - redirect to browse (absolute to avoid splat-relative compounding) */}\n <Route path=\"*\" element={<Navigate to={absoluteBrowsePath} replace />} />\n </Routes>\n );\n}\n"],"mappings":";;;;;;;;;AASA,IAAMA,IAAgBC,QACpB,OAAO,wBAAqB,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,cAAc,EAAE,CACzE;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riangle as e, Loader2 as t } from "lucide-react";
1
+ import { SpinnerIcon as e } from "./loadingSystem.js";
2
+ import { AlertTriangle as t } from "lucide-react";
2
3
  import { jsx as n, jsxs as r } from "react/jsx-runtime";
3
4
  import { Button as i, ResponsiveDialog as a, ResponsiveDialogContent as o, ResponsiveDialogDescription as s, ResponsiveDialogFooter as c, ResponsiveDialogHeader as l, ResponsiveDialogTitle as u } from "@burdenoff/fe-libs/ui";
5
+ import { useLoadingSystem as d } from "@burdenoff/fe-libs/ui/loading/LoadingSystemProvider";
4
6
  // src/files/components/ConfirmDialog.tsx
5
- function d({ title: d, description: f, confirmLabel: p, cancelLabel: m, variant: h = "default", loading: g = !1, onConfirm: _, onCancel: v }) {
7
+ function f({ title: f, description: p, confirmLabel: m, cancelLabel: h, variant: g = "default", loading: _ = !1, onConfirm: v, onCancel: y }) {
8
+ let b = d();
6
9
  return /* @__PURE__ */ n(a, {
7
10
  open: !0,
8
11
  onOpenChange: (e) => {
9
- !e && !g && v();
12
+ !e && !_ && y();
10
13
  },
11
14
  children: /* @__PURE__ */ r(o, { children: [/* @__PURE__ */ n(l, { children: /* @__PURE__ */ r("div", {
12
15
  className: "flex items-start gap-3",
13
16
  children: [/* @__PURE__ */ n("div", {
14
17
  className: "rounded-full bg-status-warning-bg-subtle p-2 text-status-warning-text",
15
- children: /* @__PURE__ */ n(e, {
18
+ children: /* @__PURE__ */ n(t, {
16
19
  className: "size-5",
17
20
  "aria-hidden": "true"
18
21
  })
19
22
  }), /* @__PURE__ */ r("div", {
20
23
  className: "min-w-0 flex-1",
21
- children: [/* @__PURE__ */ n(u, { children: d }), /* @__PURE__ */ n(s, {
24
+ children: [/* @__PURE__ */ n(u, { children: f }), /* @__PURE__ */ n(s, {
22
25
  asChild: !0,
23
26
  children: /* @__PURE__ */ n("div", {
24
27
  className: "mt-2 text-sm leading-6 text-text-secondary",
25
- children: f
28
+ children: p
26
29
  })
27
30
  })]
28
31
  })]
29
32
  }) }), /* @__PURE__ */ r(c, { children: [/* @__PURE__ */ n(i, {
30
33
  type: "button",
31
34
  variant: "outline",
32
- onClick: v,
33
- disabled: g,
34
- children: m
35
+ onClick: y,
36
+ disabled: _,
37
+ children: h
35
38
  }), /* @__PURE__ */ r(i, {
39
+ busy: b && _,
36
40
  type: "button",
37
- onClick: _,
38
- disabled: g,
39
- variant: h === "danger" ? "destructive" : "default",
40
- children: [g && /* @__PURE__ */ n(t, {
41
+ onClick: v,
42
+ disabled: !b && _,
43
+ variant: g === "danger" ? "destructive" : "default",
44
+ children: [!b && _ && /* @__PURE__ */ n(e, {
45
+ tone: "current",
41
46
  className: "size-4 animate-spin",
42
47
  "aria-hidden": "true"
43
- }), p]
48
+ }), m]
44
49
  })] })] })
45
50
  });
46
51
  }
47
- export { d as ConfirmDialog };
52
+ export { f as ConfirmDialog };
48
53
 
49
54
  //# sourceMappingURL=ConfirmDialog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConfirmDialog.js","names":["ConfirmDialog","ResponsiveDialog","next","loading","onCancel","ResponsiveDialogContent","ResponsiveDialogHeader","AlertTriangle","ResponsiveDialogTitle","title","ResponsiveDialogDescription","description","ResponsiveDialogFooter","Button","cancelLabel","onConfirm","variant","Loader2","confirmLabel"],"sources":["../../../src/files/components/ConfirmDialog.tsx"],"sourcesContent":["import { type ReactNode } from \"react\";\nimport { AlertTriangle, Loader2 } from \"lucide-react\";\nimport {\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n ResponsiveDialogDescription,\n ResponsiveDialogFooter,\n Button,\n} from \"@burdenoff/fe-libs/ui\";\n\ninterface ConfirmDialogProps {\n title: string;\n description: ReactNode;\n confirmLabel: string;\n cancelLabel: string;\n variant?: \"danger\" | \"default\";\n loading?: boolean;\n onConfirm: () => void;\n onCancel: () => void;\n}\n\n/**\n * Confirm/alert dialog. Delegates layout + dismissal to\n * `<ResponsiveDialog>` from `@burdenoff/fe-libs/ui` (bottom-sheet on\n * mobile, centred modal on tablet/desktop). Existing call sites that\n * mount this conditionally (`{open && <ConfirmDialog ... />}`) continue\n * to work because we drive `open={true}` and forward dismissal via\n * `onOpenChange` → `onCancel`.\n */\nexport function ConfirmDialog({\n title,\n description,\n confirmLabel,\n cancelLabel,\n variant = \"default\",\n loading = false,\n onConfirm,\n onCancel,\n}: ConfirmDialogProps) {\n return (\n <ResponsiveDialog\n open\n onOpenChange={(next: boolean) => {\n if (!next && !loading) {\n onCancel();\n }\n }}\n >\n <ResponsiveDialogContent>\n <ResponsiveDialogHeader>\n <div className=\"flex items-start gap-3\">\n <div className=\"rounded-full bg-status-warning-bg-subtle p-2 text-status-warning-text\">\n <AlertTriangle className=\"size-5\" aria-hidden=\"true\" />\n </div>\n <div className=\"min-w-0 flex-1\">\n <ResponsiveDialogTitle>{title}</ResponsiveDialogTitle>\n <ResponsiveDialogDescription asChild>\n <div className=\"mt-2 text-sm leading-6 text-text-secondary\">\n {description}\n </div>\n </ResponsiveDialogDescription>\n </div>\n </div>\n </ResponsiveDialogHeader>\n\n <ResponsiveDialogFooter>\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={onCancel}\n disabled={loading}\n >\n {cancelLabel}\n </Button>\n <Button\n type=\"button\"\n onClick={onConfirm}\n disabled={loading}\n variant={variant === \"danger\" ? \"destructive\" : \"default\"}\n >\n {loading && (\n <Loader2 className=\"size-4 animate-spin\" aria-hidden=\"true\" />\n )}\n {confirmLabel}\n </Button>\n </ResponsiveDialogFooter>\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n );\n}\n"],"mappings":";;;;AA+BA,SAAgBA,EAAc,EAC5B,UACA,gBACA,iBACA,gBACA,aAAU,WACV,aAAU,IACV,cACA,eACqB;CACrB,OACE,kBAACC,GAAD;EACE,MAAA;EACA,eAAe,MAAkB;GAC/B,AAAI,CAACC,KAAQ,CAACC,KACZC,EAAS;EAEb;EAEA,UAAA,kBAACC,GAAD,EAAA,UAAA,CACE,kBAACC,GAAD,EAAA,UACE,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAAC,OAAD;IAAK,WAAU;IACb,UAAA,kBAACC,GAAD;KAAe,WAAU;KAAS,eAAY;IAAQ,CAAA;GACnD,CAAA,GACL,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAACC,GAAD,EAAA,UAAwBC,EAA6B,CAAA,GACrD,kBAACC,GAAD;KAA6B,SAAA;KAC3B,UAAA,kBAAC,OAAD;MAAK,WAAU;MACZ,UAAAC;KACE,CAAA;IACsB,CAAA,CAC1B;GACF,CAAA,CAAA;EACiB,CAAA,EAAA,CAAA,GAExB,kBAACC,GAAD,EAAA,UAAA,CACE,kBAACC,GAAD;GACE,MAAK;GACL,SAAQ;GACR,SAAST;GACT,UAAUD;GAET,UAAAW;EACK,CAAA,GACR,kBAACD,GAAD;GACE,MAAK;GACL,SAASE;GACT,UAAUZ;GACV,SAASa,MAAY,WAAW,gBAAgB;GAJlD,UAAA,CAMGb,KACC,kBAACc,GAAD;IAAS,WAAU;IAAsB,eAAY;GAAQ,CAAA,GAE9DC,CACK;EACc,CAAA,CAAA,EAAA,CAAA,CACD,EAAA,CAAA;CACT,CAAA;AAEtB"}
1
+ {"version":3,"file":"ConfirmDialog.js","names":["ConfirmDialog","loadingSystem","useLoadingSystem","ResponsiveDialog","next","loading","onCancel","ResponsiveDialogContent","ResponsiveDialogHeader","AlertTriangle","ResponsiveDialogTitle","title","ResponsiveDialogDescription","description","ResponsiveDialogFooter","Button","cancelLabel","onConfirm","variant","SpinnerIcon","confirmLabel"],"sources":["../../../src/files/components/ConfirmDialog.tsx"],"sourcesContent":["import { type ReactNode } from \"react\";\nimport { AlertTriangle } from \"lucide-react\";\nimport {\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n ResponsiveDialogDescription,\n ResponsiveDialogFooter,\n Button,\n} from \"@burdenoff/fe-libs/ui\";\nimport { useLoadingSystem } from \"@burdenoff/fe-libs/ui/loading/LoadingSystemProvider\";\nimport { SpinnerIcon } from \"./loadingSystem\";\n\ninterface ConfirmDialogProps {\n title: string;\n description: ReactNode;\n confirmLabel: string;\n cancelLabel: string;\n variant?: \"danger\" | \"default\";\n loading?: boolean;\n onConfirm: () => void;\n onCancel: () => void;\n}\n\n/**\n * Confirm/alert dialog. Delegates layout + dismissal to\n * `<ResponsiveDialog>` from `@burdenoff/fe-libs/ui` (bottom-sheet on\n * mobile, centred modal on tablet/desktop). Existing call sites that\n * mount this conditionally (`{open && <ConfirmDialog ... />}`) continue\n * to work because we drive `open={true}` and forward dismissal via\n * `onOpenChange` → `onCancel`.\n */\nexport function ConfirmDialog({\n title,\n description,\n confirmLabel,\n cancelLabel,\n variant = \"default\",\n loading = false,\n onConfirm,\n onCancel,\n}: ConfirmDialogProps) {\n const loadingSystem = useLoadingSystem();\n return (\n <ResponsiveDialog\n open\n onOpenChange={(next: boolean) => {\n if (!next && !loading) {\n onCancel();\n }\n }}\n >\n <ResponsiveDialogContent>\n <ResponsiveDialogHeader>\n <div className=\"flex items-start gap-3\">\n <div className=\"rounded-full bg-status-warning-bg-subtle p-2 text-status-warning-text\">\n <AlertTriangle className=\"size-5\" aria-hidden=\"true\" />\n </div>\n <div className=\"min-w-0 flex-1\">\n <ResponsiveDialogTitle>{title}</ResponsiveDialogTitle>\n <ResponsiveDialogDescription asChild>\n <div className=\"mt-2 text-sm leading-6 text-text-secondary\">\n {description}\n </div>\n </ResponsiveDialogDescription>\n </div>\n </div>\n </ResponsiveDialogHeader>\n\n <ResponsiveDialogFooter>\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={onCancel}\n disabled={loading}\n >\n {cancelLabel}\n </Button>\n <Button\n busy={loadingSystem && loading}\n type=\"button\"\n onClick={onConfirm}\n disabled={!loadingSystem && loading}\n variant={variant === \"danger\" ? \"destructive\" : \"default\"}\n >\n {!loadingSystem && loading && (\n <SpinnerIcon\n tone=\"current\"\n className=\"size-4 animate-spin\"\n aria-hidden=\"true\"\n />\n )}\n {confirmLabel}\n </Button>\n </ResponsiveDialogFooter>\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n );\n}\n"],"mappings":";;;;;;AAiCA,SAAgBA,EAAc,EAC5B,UACA,gBACA,iBACA,gBACA,aAAU,WACV,aAAU,IACV,cACA,eACqB;CACrB,IAAMC,IAAgBC,EAAiB;CACvC,OACE,kBAACC,GAAD;EACE,MAAA;EACA,eAAe,MAAkB;GAC/B,AAAI,CAACC,KAAQ,CAACC,KACZC,EAAS;EAEb;EAEA,UAAA,kBAACC,GAAD,EAAA,UAAA,CACE,kBAACC,GAAD,EAAA,UACE,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAAC,OAAD;IAAK,WAAU;IACb,UAAA,kBAACC,GAAD;KAAe,WAAU;KAAS,eAAY;IAAQ,CAAA;GACnD,CAAA,GACL,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAACC,GAAD,EAAA,UAAwBC,EAA6B,CAAA,GACrD,kBAACC,GAAD;KAA6B,SAAA;KAC3B,UAAA,kBAAC,OAAD;MAAK,WAAU;MACZ,UAAAC;KACE,CAAA;IACsB,CAAA,CAC1B;GACF,CAAA,CAAA;EACiB,CAAA,EAAA,CAAA,GAExB,kBAACC,GAAD,EAAA,UAAA,CACE,kBAACC,GAAD;GACE,MAAK;GACL,SAAQ;GACR,SAAST;GACT,UAAUD;GAET,UAAAW;EACK,CAAA,GACR,kBAACD,GAAD;GACE,MAAMd,KAAiBI;GACvB,MAAK;GACL,SAASY;GACT,UAAU,CAAChB,KAAiBI;GAC5B,SAASa,MAAY,WAAW,gBAAgB;GALlD,UAAA,CAOG,CAACjB,KAAiBI,KACjB,kBAACc,GAAD;IACE,MAAK;IACL,WAAU;IACV,eAAY;GACb,CAAA,GAEFC,CACK;EACc,CAAA,CAAA,EAAA,CAAA,CACD,EAAA,CAAA;CACT,CAAA;AAEtB"}
@@ -1,149 +1,167 @@
1
1
  import { useFoldersQuery as e } from "../hooks/useFoldersQuery.js";
2
2
  import { tWithFallback as t } from "../utils/i18n.js";
3
3
  import { copySubmission as n } from "../utils/copyForm.js";
4
- import { useState as r } from "react";
5
- import { ChevronRight as i, Folder as a, Home as o, Loader2 as s } from "lucide-react";
6
- import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
7
- import { Button as d, Input as f, OptionalFields as p, ResponsiveDialog as m, ResponsiveDialogContent as h, ResponsiveDialogFooter as g, ResponsiveDialogHeader as _, ResponsiveDialogTitle as v } from "@burdenoff/fe-libs/ui";
8
- import { useI18n as y } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
4
+ import { SectionLoaderOr as r, SpinnerIcon as i } from "./loadingSystem.js";
5
+ import { useState as a } from "react";
6
+ import { ChevronRight as o, Folder as s, Home as c } from "lucide-react";
7
+ import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
8
+ import { Button as f, Input as p, OptionalFields as m, ResponsiveDialog as h, ResponsiveDialogContent as g, ResponsiveDialogFooter as _, ResponsiveDialogHeader as v, ResponsiveDialogTitle as y } from "@burdenoff/fe-libs/ui";
9
+ import { useI18n as b } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
10
+ import { useLoadingSystem as x } from "@burdenoff/fe-libs/ui/loading/LoadingSystemProvider";
9
11
  // src/files/components/CopyDialog.tsx
10
- var b = ({ item: b, type: x, onClose: S, onCopy: C, isLoading: w = !1, initialFolderId: T = null, initialBreadcrumbs: E = [], navigationV2: D = !1 }) => {
11
- let { t: O } = y(), [k, A] = r(T), [j, M] = r(() => T ? [...E] : []), [N, P] = r(T), [F, I] = r(() => T ? E.find((e) => e.id === T)?.name ?? null : null), L = (e, t) => {
12
- P(e), I(e === null ? null : t);
13
- }, R = t(O, "files.copyDialog.myDrive", "My Drive"), [z, B] = r(`${t(O, "files.copyDialog.copyOf", "Copy of")} ${b.name}`), { data: V, loading: H } = e(k || void 0), U = V?.getFolders?.folders || [], W = (e) => {
14
- A(e.id), M([...j, {
12
+ var S = ({ item: x, type: S, onClose: w, onCopy: T, isLoading: E = !1, initialFolderId: D = null, initialBreadcrumbs: O = [], navigationV2: k = !1 }) => {
13
+ let { t: A } = b(), [j, M] = a(D), [N, P] = a(() => D ? [...O] : []), [F, I] = a(D), [L, R] = a(() => D ? O.find((e) => e.id === D)?.name ?? null : null), z = (e, t) => {
14
+ I(e), R(e === null ? null : t);
15
+ }, B = t(A, "files.copyDialog.myDrive", "My Drive"), [V, H] = a(`${t(A, "files.copyDialog.copyOf", "Copy of")} ${x.name}`), { data: U, loading: W } = e(j || void 0), G = U?.getFolders?.folders || [], K = (e) => {
16
+ M(e.id), P([...N, {
15
17
  id: e.id,
16
18
  name: e.name
17
19
  }]);
18
- }, G = (e) => {
19
- if (e === -1) A(null), M([]);
20
+ }, q = (e) => {
21
+ if (e === -1) M(null), P([]);
20
22
  else {
21
- let t = j[e];
22
- A(t.id), M(j.slice(0, e + 1));
23
+ let t = N[e];
24
+ M(t.id), P(N.slice(0, e + 1));
23
25
  }
24
- }, K = async () => {
25
- let e = n(N, z);
26
- await C(e.destinationFolderId, e.name), S();
27
- }, q = D ? "px-4 py-3 border-b border-border-default bg-bg-sunken" : "px-6 py-3 border-b border-border-default bg-bg-sunken", J = D ? "max-h-64 overflow-y-auto px-4 py-4" : "flex-1 overflow-y-auto px-6 py-4", Y = /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("div", {
28
- className: q,
29
- children: /* @__PURE__ */ u("div", {
26
+ }, J = async () => {
27
+ let e = n(F, V);
28
+ await T(e.destinationFolderId, e.name), w();
29
+ }, Y = k ? "px-4 py-3 border-b border-border-default bg-bg-sunken" : "px-6 py-3 border-b border-border-default bg-bg-sunken", X = k ? "max-h-64 overflow-y-auto px-4 py-4" : "flex-1 overflow-y-auto px-6 py-4", Z = /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("div", {
30
+ className: Y,
31
+ children: /* @__PURE__ */ d("div", {
30
32
  className: "flex items-center gap-2 text-sm overflow-x-auto",
31
- children: [/* @__PURE__ */ u("button", {
33
+ children: [/* @__PURE__ */ d("button", {
32
34
  type: "button",
33
- onClick: () => G(-1),
35
+ onClick: () => q(-1),
34
36
  className: "flex items-center gap-1.5 text-text-primary hover:bg-action-ghost-bg-hover px-2 py-1 rounded transition-colors duration-200 whitespace-nowrap",
35
- children: [/* @__PURE__ */ l(o, { className: "size-4" }), /* @__PURE__ */ l("span", { children: R })]
36
- }), j.map((e, t) => /* @__PURE__ */ u("div", {
37
+ children: [/* @__PURE__ */ u(c, { className: "size-4" }), /* @__PURE__ */ u("span", { children: B })]
38
+ }), N.map((e, t) => /* @__PURE__ */ d("div", {
37
39
  className: "flex items-center gap-2 whitespace-nowrap",
38
- children: [/* @__PURE__ */ l(i, { className: "size-4 text-text-tertiary" }), /* @__PURE__ */ l("button", {
40
+ children: [/* @__PURE__ */ u(o, { className: "size-4 text-text-tertiary" }), /* @__PURE__ */ u("button", {
39
41
  type: "button",
40
- onClick: () => G(t),
41
- className: `hover:bg-action-ghost-bg-hover px-2 py-1 rounded transition-colors duration-200 ${t === j.length - 1 ? "text-text-primary font-medium" : "text-text-secondary"}`,
42
+ onClick: () => q(t),
43
+ className: `hover:bg-action-ghost-bg-hover px-2 py-1 rounded transition-colors duration-200 ${t === N.length - 1 ? "text-text-primary font-medium" : "text-text-secondary"}`,
42
44
  children: e.name
43
45
  })]
44
46
  }, e.id))]
45
47
  })
46
- }), /* @__PURE__ */ l("div", {
47
- className: J,
48
- children: H ? /* @__PURE__ */ l("div", {
49
- className: "flex items-center justify-center py-8",
50
- children: /* @__PURE__ */ l(s, { className: "size-6 text-text-tertiary animate-spin" })
51
- }) : /* @__PURE__ */ u("div", {
48
+ }), /* @__PURE__ */ u("div", {
49
+ className: X,
50
+ children: W ? /* @__PURE__ */ u(r, {
51
+ minHeight: "6rem",
52
+ today: /* @__PURE__ */ u("div", {
53
+ className: "flex items-center justify-center py-8",
54
+ children: /* @__PURE__ */ u(i, { className: "size-6 text-text-tertiary animate-spin" })
55
+ })
56
+ }) : /* @__PURE__ */ d("div", {
52
57
  className: "space-y-1",
53
58
  children: [
54
- /* @__PURE__ */ u("button", {
59
+ /* @__PURE__ */ d("button", {
55
60
  type: "button",
56
- onClick: () => L(k, j.at(-1)?.name ?? null),
57
- "aria-pressed": N === k,
58
- className: `w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-left transition-all duration-200 ${N === k ? "bg-bg-accent border-2 border-action-primary-border" : "hover:bg-action-ghost-bg-hover border-2 border-transparent"}`,
59
- children: [/* @__PURE__ */ l(a, { className: "size-5 text-text-link" }), /* @__PURE__ */ l("span", {
61
+ onClick: () => z(j, N.at(-1)?.name ?? null),
62
+ "aria-pressed": F === j,
63
+ className: `w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-left transition-all duration-200 ${F === j ? "bg-bg-accent border-2 border-action-primary-border" : "hover:bg-action-ghost-bg-hover border-2 border-transparent"}`,
64
+ children: [/* @__PURE__ */ u(s, { className: "size-5 text-text-link" }), /* @__PURE__ */ u("span", {
60
65
  className: "font-medium text-text-primary",
61
- children: t(O, "files.copyDialog.copyHere", "Copy here")
66
+ children: t(A, "files.copyDialog.copyHere", "Copy here")
62
67
  })]
63
68
  }),
64
- U.length === 0 && /* @__PURE__ */ l("p", {
69
+ G.length === 0 && /* @__PURE__ */ u("p", {
65
70
  className: "py-4 text-center text-sm text-text-secondary",
66
- children: t(O, "files.copyDialog.noFolders", "No folders here")
71
+ children: t(A, "files.copyDialog.noFolders", "No folders here")
67
72
  }),
68
- U.map((e) => /* @__PURE__ */ u("div", {
69
- className: `flex items-center justify-between gap-3 px-3 py-2.5 rounded-lg transition-all duration-200 ${N === e.id ? "bg-bg-accent border-2 border-action-primary-border" : "hover:bg-action-ghost-bg-hover border-2 border-transparent"}`,
70
- children: [/* @__PURE__ */ u("button", {
73
+ G.map((e) => /* @__PURE__ */ d("div", {
74
+ className: `flex items-center justify-between gap-3 px-3 py-2.5 rounded-lg transition-all duration-200 ${F === e.id ? "bg-bg-accent border-2 border-action-primary-border" : "hover:bg-action-ghost-bg-hover border-2 border-transparent"}`,
75
+ children: [/* @__PURE__ */ d("button", {
71
76
  type: "button",
72
- onClick: () => L(e.id, e.name),
77
+ onClick: () => z(e.id, e.name),
73
78
  className: "flex items-center gap-3 flex-1 min-w-0",
74
- children: [/* @__PURE__ */ l(a, { className: "size-5 text-text-link flex-shrink-0" }), /* @__PURE__ */ l("span", {
79
+ children: [/* @__PURE__ */ u(s, { className: "size-5 text-text-link flex-shrink-0" }), /* @__PURE__ */ u("span", {
75
80
  className: "font-medium text-text-primary truncate",
76
81
  children: e.name
77
82
  })]
78
- }), /* @__PURE__ */ l("button", {
83
+ }), /* @__PURE__ */ u("button", {
79
84
  type: "button",
80
- onClick: () => W(e),
85
+ onClick: () => K(e),
81
86
  className: "p-1.5 text-text-tertiary hover:text-text-secondary hover:bg-action-ghost-bg-hover rounded transition-colors duration-200 flex-shrink-0",
82
- title: t(O, "files.copyDialog.openFolder", "Open folder"),
83
- "aria-label": t(O, "files.copyDialog.openFolderNamed", "Open {{name}}", { name: e.name }),
84
- children: /* @__PURE__ */ l(i, { className: "size-4" })
87
+ title: t(A, "files.copyDialog.openFolder", "Open folder"),
88
+ "aria-label": t(A, "files.copyDialog.openFolderNamed", "Open {{name}}", { name: e.name }),
89
+ children: /* @__PURE__ */ u(o, { className: "size-4" })
85
90
  })]
86
91
  }, e.id))
87
92
  ]
88
93
  })
89
94
  })] });
90
- return /* @__PURE__ */ l(m, {
95
+ return /* @__PURE__ */ u(h, {
91
96
  open: !0,
92
97
  onOpenChange: (e) => {
93
- !e && !w && S();
98
+ !e && !E && w();
94
99
  },
95
- children: /* @__PURE__ */ u(h, {
100
+ children: /* @__PURE__ */ d(g, {
96
101
  className: "flex max-h-[80vh] w-full max-w-md flex-col gap-0 p-0",
97
102
  children: [
98
- /* @__PURE__ */ l(_, {
103
+ /* @__PURE__ */ u(v, {
99
104
  className: "px-6 py-4 border-b border-border-default text-left",
100
- children: /* @__PURE__ */ l(v, {
105
+ children: /* @__PURE__ */ u(y, {
101
106
  className: "text-lg font-semibold text-text-primary",
102
- children: t(O, "files.copyDialog.makeCopyOf", "Make a copy of \"{{name}}\"", { name: b.name })
107
+ children: t(A, "files.copyDialog.makeCopyOf", "Make a copy of \"{{name}}\"", { name: x.name })
103
108
  })
104
109
  }),
105
- /* @__PURE__ */ u("div", {
110
+ /* @__PURE__ */ d("div", {
106
111
  className: "px-6 py-4 border-b border-border-default",
107
- children: [/* @__PURE__ */ l("label", {
112
+ children: [/* @__PURE__ */ u("label", {
108
113
  className: "block text-sm font-medium text-text-primary mb-2",
109
- children: t(O, "files.copyDialog.name", "Name")
110
- }), /* @__PURE__ */ l(f, {
114
+ children: t(A, "files.copyDialog.name", "Name")
115
+ }), /* @__PURE__ */ u(p, {
111
116
  type: "text",
112
- value: z,
113
- onChange: (e) => B(e.target.value),
114
- "aria-label": t(O, "files.copyDialog.name", "Name"),
115
- placeholder: t(O, "files.copyDialog.enterName", "Enter name for the copy")
117
+ value: V,
118
+ onChange: (e) => H(e.target.value),
119
+ "aria-label": t(A, "files.copyDialog.name", "Name"),
120
+ placeholder: t(A, "files.copyDialog.enterName", "Enter name for the copy")
116
121
  })]
117
122
  }),
118
- D ? /* @__PURE__ */ u("div", {
123
+ k ? /* @__PURE__ */ d("div", {
119
124
  className: "flex-1 overflow-y-auto px-6 py-4 space-y-4",
120
- children: [/* @__PURE__ */ l("p", {
125
+ children: [/* @__PURE__ */ u("p", {
121
126
  className: "text-sm text-text-secondary",
122
- children: t(O, "files.copyDialog.destination", "Copy to: {{folder}}", { folder: F ?? R })
123
- }), /* @__PURE__ */ l(p, {
127
+ children: t(A, "files.copyDialog.destination", "Copy to: {{folder}}", { folder: L ?? B })
128
+ }), /* @__PURE__ */ u(m, {
124
129
  storageKey: "files.copyDialog",
125
130
  contentClassName: "px-0 py-0 space-y-0",
126
- children: Y
131
+ children: Z
127
132
  })]
128
- }) : Y,
129
- /* @__PURE__ */ u(g, {
133
+ }) : Z,
134
+ /* @__PURE__ */ d(_, {
130
135
  className: "px-6 py-4 border-t border-border-default",
131
- children: [/* @__PURE__ */ l(d, {
136
+ children: [/* @__PURE__ */ u(f, {
132
137
  type: "button",
133
138
  variant: "outline",
134
- onClick: S,
135
- children: t(O, "files.common.actions.cancel", "Cancel")
136
- }), /* @__PURE__ */ u(d, {
137
- type: "button",
138
- onClick: K,
139
- disabled: w || N === void 0 || !z.trim(),
140
- children: [w && /* @__PURE__ */ l(s, { className: "size-4 animate-spin" }), w ? t(O, "files.copyDialog.copying", "Copying...") : t(O, "files.copyDialog.copy", "Copy")]
139
+ onClick: w,
140
+ children: t(A, "files.common.actions.cancel", "Cancel")
141
+ }), /* @__PURE__ */ u(C, {
142
+ copying: E,
143
+ canCopy: F !== void 0 && !!V.trim(),
144
+ onCopy: J
141
145
  })]
142
146
  })
143
147
  ]
144
148
  })
145
149
  });
146
150
  };
147
- export { b as CopyDialog };
151
+ function C({ copying: e, canCopy: n, onCopy: r }) {
152
+ let a = x(), { t: o } = b(), s = !a && e;
153
+ return /* @__PURE__ */ d(f, {
154
+ busy: a && e,
155
+ busyLabel: a ? t(o, "files.copyDialog.copying", "Copying...") : void 0,
156
+ type: "button",
157
+ onClick: r,
158
+ disabled: s || !n,
159
+ children: [s && /* @__PURE__ */ u(i, {
160
+ tone: "current",
161
+ className: "size-4 animate-spin"
162
+ }), s ? t(o, "files.copyDialog.copying", "Copying...") : t(o, "files.copyDialog.copy", "Copy")]
163
+ });
164
+ }
165
+ export { S as CopyDialog };
148
166
 
149
167
  //# sourceMappingURL=CopyDialog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CopyDialog.js","names":["_Fragment","CopyDialog","useI18n","currentFolderId","setCurrentFolderId","useState","initialFolderId","breadcrumbs","setBreadcrumbs","initialBreadcrumbs","selectedDestination","setSelectedDestination","destinationName","setDestinationName","crumb","selectDestination","id","name","rootLabel","tWithFallback","t","newName","setNewName","item","loadingFolders","useFoldersQuery","folders","data","handleFolderClick","folder","handleBreadcrumbClick","index","handleCopy","submission","copySubmission","onCopy","onClose","breadcrumbClassName","navigationV2","folderListClassName","folderPicker","Fragment","Home","ChevronRight","Loader2","Folder","ResponsiveDialog","next","isLoading","ResponsiveDialogContent","ResponsiveDialogHeader","ResponsiveDialogTitle","Input","OptionalFields","ResponsiveDialogFooter","Button"],"sources":["../../../src/files/components/CopyDialog.tsx"],"sourcesContent":["import { type FC, useState } from \"react\";\nimport { Folder, Home, ChevronRight, Loader2 } from \"lucide-react\";\nimport { useI18n } from \"@burdenoff/fe-libs/shared/providers/shell/I18nProvider\";\nimport {\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n ResponsiveDialogFooter,\n Button,\n Input,\n OptionalFields,\n} from \"@burdenoff/fe-libs/ui\";\nimport type { FileItem, FolderItem } from \"../types\";\nimport { useFoldersQuery } from \"../hooks/useFoldersQuery\";\nimport { tWithFallback } from \"../utils/i18n\";\nimport { copySubmission } from \"../utils/copyForm\";\n\ninterface CopyDialogProps {\n item: FileItem | FolderItem;\n type: \"file\" | \"folder\";\n onClose: () => void;\n onCopy: (\n destinationFolderId: string | null,\n newName?: string,\n ) => Promise<void>;\n isLoading?: boolean;\n /**\n * Folder the dialog opens in and preselects as the destination (null is the\n * root). Navigation v2 passes the folder being browsed (BOFF-11865).\n */\n initialFolderId?: string | null;\n /** Path to `initialFolderId`, root first, for the dialog's breadcrumb. */\n initialBreadcrumbs?: ReadonlyArray<{ id: string; name: string }>;\n /**\n * Navigation v2 (BOFF-11865), FluidGrids only: the prefilled destination is\n * named on level 1 and the folder picker folds into the shared, remembered\n * \"More options\".\n */\n navigationV2?: boolean;\n}\n\nexport const CopyDialog: FC<CopyDialogProps> = ({\n item,\n type,\n onClose,\n onCopy,\n isLoading = false,\n initialFolderId = null,\n initialBreadcrumbs = [],\n navigationV2 = false,\n}) => {\n const { t } = useI18n();\n const [currentFolderId, setCurrentFolderId] = useState<string | null>(\n initialFolderId,\n );\n const [breadcrumbs, setBreadcrumbs] = useState<\n Array<{ id: string; name: string }>\n >(() => (initialFolderId ? [...initialBreadcrumbs] : []));\n const [selectedDestination, setSelectedDestination] = useState<string | null>(\n initialFolderId,\n );\n // Name of the selected destination, kept with it so it stays right after\n // the picker moves to another folder. Null is the root.\n const [destinationName, setDestinationName] = useState<string | null>(() =>\n initialFolderId\n ? (initialBreadcrumbs.find((crumb) => crumb.id === initialFolderId)\n ?.name ?? null)\n : null,\n );\n const selectDestination = (id: string | null, name: string | null) => {\n setSelectedDestination(id);\n setDestinationName(id === null ? null : name);\n };\n const rootLabel = tWithFallback(t, \"files.copyDialog.myDrive\", \"My Drive\");\n const [newName, setNewName] = useState(\n `${tWithFallback(t, \"files.copyDialog.copyOf\", \"Copy of\")} ${item.name}`,\n );\n\n // Fetch folders in current location\n const { data, loading: loadingFolders } = useFoldersQuery(\n currentFolderId || undefined,\n );\n const folders = (data?.getFolders?.folders || []) as FolderItem[];\n\n const handleFolderClick = (folder: FolderItem) => {\n setCurrentFolderId(folder.id);\n setBreadcrumbs([...breadcrumbs, { id: folder.id, name: folder.name }]);\n };\n\n const handleBreadcrumbClick = (index: number) => {\n if (index === -1) {\n // Go to root\n setCurrentFolderId(null);\n setBreadcrumbs([]);\n } else {\n const crumb = breadcrumbs[index];\n setCurrentFolderId(crumb.id);\n setBreadcrumbs(breadcrumbs.slice(0, index + 1));\n }\n };\n\n const handleCopy = async () => {\n const submission = copySubmission(selectedDestination, newName);\n await onCopy(submission.destinationFolderId, submission.name);\n onClose();\n };\n\n // The breadcrumb and folder list. Navigation v2 folds them into \"More\n // options\" with the destination already chosen; other apps show them open.\n const breadcrumbClassName = navigationV2\n ? \"px-4 py-3 border-b border-border-default bg-bg-sunken\"\n : \"px-6 py-3 border-b border-border-default bg-bg-sunken\";\n const folderListClassName = navigationV2\n ? \"max-h-64 overflow-y-auto px-4 py-4\"\n : \"flex-1 overflow-y-auto px-6 py-4\";\n const folderPicker = (\n <>\n <div className={breadcrumbClassName}>\n <div className=\"flex items-center gap-2 text-sm overflow-x-auto\">\n <button\n type=\"button\"\n onClick={() => handleBreadcrumbClick(-1)}\n className=\"flex items-center gap-1.5 text-text-primary hover:bg-action-ghost-bg-hover px-2 py-1 rounded transition-colors duration-200 whitespace-nowrap\"\n >\n <Home className=\"size-4\" />\n <span>{rootLabel}</span>\n </button>\n {breadcrumbs.map((crumb, index) => (\n <div\n key={crumb.id}\n className=\"flex items-center gap-2 whitespace-nowrap\"\n >\n <ChevronRight className=\"size-4 text-text-tertiary\" />\n <button\n type=\"button\"\n onClick={() => handleBreadcrumbClick(index)}\n className={`hover:bg-action-ghost-bg-hover px-2 py-1 rounded transition-colors duration-200 ${\n index === breadcrumbs.length - 1\n ? \"text-text-primary font-medium\"\n : \"text-text-secondary\"\n }`}\n >\n {crumb.name}\n </button>\n </div>\n ))}\n </div>\n </div>\n\n <div className={folderListClassName}>\n {loadingFolders ? (\n <div className=\"flex items-center justify-center py-8\">\n <Loader2 className=\"size-6 text-text-tertiary animate-spin\" />\n </div>\n ) : (\n <div className=\"space-y-1\">\n {/* Option to copy to current folder. Always offered, so an empty\n folder can still be the destination. */}\n <button\n type=\"button\"\n onClick={() =>\n selectDestination(\n currentFolderId,\n breadcrumbs.at(-1)?.name ?? null,\n )\n }\n aria-pressed={selectedDestination === currentFolderId}\n className={`w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-left transition-all duration-200 ${\n selectedDestination === currentFolderId\n ? \"bg-bg-accent border-2 border-action-primary-border\"\n : \"hover:bg-action-ghost-bg-hover border-2 border-transparent\"\n }`}\n >\n <Folder className=\"size-5 text-text-link\" />\n <span className=\"font-medium text-text-primary\">\n {tWithFallback(t, \"files.copyDialog.copyHere\", \"Copy here\")}\n </span>\n </button>\n\n {folders.length === 0 && (\n <p className=\"py-4 text-center text-sm text-text-secondary\">\n {tWithFallback(\n t,\n \"files.copyDialog.noFolders\",\n \"No folders here\",\n )}\n </p>\n )}\n\n {/* List of subfolders */}\n {folders.map((folder) => (\n <div\n key={folder.id}\n className={`flex items-center justify-between gap-3 px-3 py-2.5 rounded-lg transition-all duration-200 ${\n selectedDestination === folder.id\n ? \"bg-bg-accent border-2 border-action-primary-border\"\n : \"hover:bg-action-ghost-bg-hover border-2 border-transparent\"\n }`}\n >\n <button\n type=\"button\"\n onClick={() => selectDestination(folder.id, folder.name)}\n className=\"flex items-center gap-3 flex-1 min-w-0\"\n >\n <Folder className=\"size-5 text-text-link flex-shrink-0\" />\n <span className=\"font-medium text-text-primary truncate\">\n {folder.name}\n </span>\n </button>\n <button\n type=\"button\"\n onClick={() => handleFolderClick(folder)}\n className=\"p-1.5 text-text-tertiary hover:text-text-secondary hover:bg-action-ghost-bg-hover rounded transition-colors duration-200 flex-shrink-0\"\n title={tWithFallback(\n t,\n \"files.copyDialog.openFolder\",\n \"Open folder\",\n )}\n aria-label={tWithFallback(\n t,\n \"files.copyDialog.openFolderNamed\",\n \"Open {{name}}\",\n { name: folder.name },\n )}\n >\n <ChevronRight className=\"size-4\" />\n </button>\n </div>\n ))}\n </div>\n )}\n </div>\n </>\n );\n\n return (\n <ResponsiveDialog\n open\n onOpenChange={(next: boolean) => {\n if (!next && !isLoading) {\n onClose();\n }\n }}\n >\n <ResponsiveDialogContent className=\"flex max-h-[80vh] w-full max-w-md flex-col gap-0 p-0\">\n {/* Header */}\n <ResponsiveDialogHeader className=\"px-6 py-4 border-b border-border-default text-left\">\n <ResponsiveDialogTitle className=\"text-lg font-semibold text-text-primary\">\n {tWithFallback(\n t,\n \"files.copyDialog.makeCopyOf\",\n 'Make a copy of \"{{name}}\"',\n { name: item.name },\n )}\n </ResponsiveDialogTitle>\n </ResponsiveDialogHeader>\n\n {/* Name input */}\n <div className=\"px-6 py-4 border-b border-border-default\">\n <label className=\"block text-sm font-medium text-text-primary mb-2\">\n {tWithFallback(t, \"files.copyDialog.name\", \"Name\")}\n </label>\n <Input\n type=\"text\"\n value={newName}\n onChange={(e) => setNewName(e.target.value)}\n aria-label={tWithFallback(t, \"files.copyDialog.name\", \"Name\")}\n placeholder={tWithFallback(\n t,\n \"files.copyDialog.enterName\",\n \"Enter name for the copy\",\n )}\n />\n </div>\n\n {navigationV2 ? (\n <div className=\"flex-1 overflow-y-auto px-6 py-4 space-y-4\">\n <p className=\"text-sm text-text-secondary\">\n {tWithFallback(\n t,\n \"files.copyDialog.destination\",\n \"Copy to: {{folder}}\",\n { folder: destinationName ?? rootLabel },\n )}\n </p>\n <OptionalFields\n storageKey=\"files.copyDialog\"\n contentClassName=\"px-0 py-0 space-y-0\"\n >\n {folderPicker}\n </OptionalFields>\n </div>\n ) : (\n folderPicker\n )}\n\n {/* Footer */}\n <ResponsiveDialogFooter className=\"px-6 py-4 border-t border-border-default\">\n <Button type=\"button\" variant=\"outline\" onClick={onClose}>\n {tWithFallback(t, \"files.common.actions.cancel\", \"Cancel\")}\n </Button>\n <Button\n type=\"button\"\n onClick={handleCopy}\n disabled={\n isLoading || selectedDestination === undefined || !newName.trim()\n }\n >\n {isLoading && <Loader2 className=\"size-4 animate-spin\" />}\n {isLoading\n ? tWithFallback(t, \"files.copyDialog.copying\", \"Copying...\")\n : tWithFallback(t, \"files.copyDialog.copy\", \"Copy\")}\n </Button>\n </ResponsiveDialogFooter>\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n );\n};\n"],"mappings":";;;;;;;;;AA0CA,IAAaC,KAAmC,EAC9C,SACA,SACA,YACA,WACA,eAAY,IACZ,qBAAkB,MAClB,wBAAqB,CAAC,GACtB,kBAAe,SACX;CACJ,IAAM,EAAE,SAAMC,EAAQ,GAChB,CAACC,GAAiBC,KAAsBC,EAC5CC,CACF,GACM,CAACC,GAAaC,KAAkBH,QAE7BC,IAAkB,CAAC,GAAGG,CAAkB,IAAI,CAAC,CAAE,GAClD,CAACC,GAAqBC,KAA0BN,EACpDC,CACF,GAGM,CAACM,GAAiBC,KAAsBR,QAC5CC,IACKG,EAAmB,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AEL,CAAA,IAAAA;IAIF,kBAACc,GAAD;KAAwB,WAAU;KAAlC,UAAA,CACE,kBAACC,GAAD;MAAQ,MAAK;MAAS,SAAQ;MAAU,SAASnB;MAC9C,UAAAjB,EAAcC,GAAG,+BAA+B,QAAQ;KACnD,CAAA,GACR,kBAACmC,GAAD;MACE,MAAK;MACL,SAASvB;MACT,UACEgB,KAAatC,MAAwB,KAAA,KAAa,CAACW,EAAQ,KAAK;MAJpE,UAAA,CAOG2B,KAAa,kBAACJ,GAAD,EAAS,WAAU,sBAAuB,CAAA,GACvDI,IACG7B,EAAcC,GAAG,4BAA4B,YAAY,IACzDD,EAAcC,GAAG,yBAAyB,MAAM,CAC9C;KACc,CAAA,CAAA;;GACD;;CACT,CAAA;AAEtB"}
1
+ {"version":3,"file":"CopyDialog.js","names":["_Fragment","CopyDialog","useI18n","currentFolderId","setCurrentFolderId","useState","initialFolderId","breadcrumbs","setBreadcrumbs","initialBreadcrumbs","selectedDestination","setSelectedDestination","destinationName","setDestinationName","crumb","selectDestination","id","name","rootLabel","tWithFallback","t","newName","setNewName","item","loadingFolders","useFoldersQuery","folders","data","handleFolderClick","folder","handleBreadcrumbClick","index","handleCopy","submission","copySubmission","onCopy","onClose","breadcrumbClassName","navigationV2","folderListClassName","folderPicker","Fragment","Home","ChevronRight","SectionLoaderOr","SpinnerIcon","Folder","ResponsiveDialog","next","isLoading","ResponsiveDialogContent","ResponsiveDialogHeader","ResponsiveDialogTitle","Input","OptionalFields","ResponsiveDialogFooter","Button","CopySubmitButton","loadingSystem","useLoadingSystem","spinning","copying","canCopy"],"sources":["../../../src/files/components/CopyDialog.tsx"],"sourcesContent":["import { type FC, useState } from \"react\";\nimport { Folder, Home, ChevronRight } from \"lucide-react\";\nimport { useI18n } from \"@burdenoff/fe-libs/shared/providers/shell/I18nProvider\";\nimport {\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n ResponsiveDialogFooter,\n Button,\n Input,\n OptionalFields,\n} from \"@burdenoff/fe-libs/ui\";\nimport type { FileItem, FolderItem } from \"../types\";\nimport { useFoldersQuery } from \"../hooks/useFoldersQuery\";\nimport { tWithFallback } from \"../utils/i18n\";\nimport { copySubmission } from \"../utils/copyForm\";\nimport { useLoadingSystem } from \"@burdenoff/fe-libs/ui/loading/LoadingSystemProvider\";\nimport { SectionLoaderOr, SpinnerIcon } from \"./loadingSystem\";\n\ninterface CopyDialogProps {\n item: FileItem | FolderItem;\n type: \"file\" | \"folder\";\n onClose: () => void;\n onCopy: (\n destinationFolderId: string | null,\n newName?: string,\n ) => Promise<void>;\n isLoading?: boolean;\n /**\n * Folder the dialog opens in and preselects as the destination (null is the\n * root). Navigation v2 passes the folder being browsed (BOFF-11865).\n */\n initialFolderId?: string | null;\n /** Path to `initialFolderId`, root first, for the dialog's breadcrumb. */\n initialBreadcrumbs?: ReadonlyArray<{ id: string; name: string }>;\n /**\n * Navigation v2 (BOFF-11865), FluidGrids only: the prefilled destination is\n * named on level 1 and the folder picker folds into the shared, remembered\n * \"More options\".\n */\n navigationV2?: boolean;\n}\n\nexport const CopyDialog: FC<CopyDialogProps> = ({\n item,\n type,\n onClose,\n onCopy,\n isLoading = false,\n initialFolderId = null,\n initialBreadcrumbs = [],\n navigationV2 = false,\n}) => {\n const { t } = useI18n();\n const [currentFolderId, setCurrentFolderId] = useState<string | null>(\n initialFolderId,\n );\n const [breadcrumbs, setBreadcrumbs] = useState<\n Array<{ id: string; name: string }>\n >(() => (initialFolderId ? [...initialBreadcrumbs] : []));\n const [selectedDestination, setSelectedDestination] = useState<string | null>(\n initialFolderId,\n );\n // Name of the selected destination, kept with it so it stays right after\n // the picker moves to another folder. Null is the root.\n const [destinationName, setDestinationName] = useState<string | null>(() =>\n initialFolderId\n ? (initialBreadcrumbs.find((crumb) => crumb.id === initialFolderId)\n ?.name ?? null)\n : null,\n );\n const selectDestination = (id: string | null, name: string | null) => {\n setSelectedDestination(id);\n setDestinationName(id === null ? null : name);\n };\n const rootLabel = tWithFallback(t, \"files.copyDialog.myDrive\", \"My Drive\");\n const [newName, setNewName] = useState(\n `${tWithFallback(t, \"files.copyDialog.copyOf\", \"Copy of\")} ${item.name}`,\n );\n\n // Fetch folders in current location\n const { data, loading: loadingFolders } = useFoldersQuery(\n currentFolderId || undefined,\n );\n const folders = (data?.getFolders?.folders || []) as FolderItem[];\n\n const handleFolderClick = (folder: FolderItem) => {\n setCurrentFolderId(folder.id);\n setBreadcrumbs([...breadcrumbs, { id: folder.id, name: folder.name }]);\n };\n\n const handleBreadcrumbClick = (index: number) => {\n if (index === -1) {\n // Go to root\n setCurrentFolderId(null);\n setBreadcrumbs([]);\n } else {\n const crumb = breadcrumbs[index];\n setCurrentFolderId(crumb.id);\n setBreadcrumbs(breadcrumbs.slice(0, index + 1));\n }\n };\n\n const handleCopy = async () => {\n const submission = copySubmission(selectedDestination, newName);\n await onCopy(submission.destinationFolderId, submission.name);\n onClose();\n };\n\n // The breadcrumb and folder list. Navigation v2 folds them into \"More\n // options\" with the destination already chosen; other apps show them open.\n const breadcrumbClassName = navigationV2\n ? \"px-4 py-3 border-b border-border-default bg-bg-sunken\"\n : \"px-6 py-3 border-b border-border-default bg-bg-sunken\";\n const folderListClassName = navigationV2\n ? \"max-h-64 overflow-y-auto px-4 py-4\"\n : \"flex-1 overflow-y-auto px-6 py-4\";\n const folderPicker = (\n <>\n <div className={breadcrumbClassName}>\n <div className=\"flex items-center gap-2 text-sm overflow-x-auto\">\n <button\n type=\"button\"\n onClick={() => handleBreadcrumbClick(-1)}\n className=\"flex items-center gap-1.5 text-text-primary hover:bg-action-ghost-bg-hover px-2 py-1 rounded transition-colors duration-200 whitespace-nowrap\"\n >\n <Home className=\"size-4\" />\n <span>{rootLabel}</span>\n </button>\n {breadcrumbs.map((crumb, index) => (\n <div\n key={crumb.id}\n className=\"flex items-center gap-2 whitespace-nowrap\"\n >\n <ChevronRight className=\"size-4 text-text-tertiary\" />\n <button\n type=\"button\"\n onClick={() => handleBreadcrumbClick(index)}\n className={`hover:bg-action-ghost-bg-hover px-2 py-1 rounded transition-colors duration-200 ${\n index === breadcrumbs.length - 1\n ? \"text-text-primary font-medium\"\n : \"text-text-secondary\"\n }`}\n >\n {crumb.name}\n </button>\n </div>\n ))}\n </div>\n </div>\n\n <div className={folderListClassName}>\n {loadingFolders ? (\n <SectionLoaderOr\n minHeight=\"6rem\"\n today={\n <div className=\"flex items-center justify-center py-8\">\n <SpinnerIcon className=\"size-6 text-text-tertiary animate-spin\" />\n </div>\n }\n />\n ) : (\n <div className=\"space-y-1\">\n {/* Option to copy to current folder. Always offered, so an empty\n folder can still be the destination. */}\n <button\n type=\"button\"\n onClick={() =>\n selectDestination(\n currentFolderId,\n breadcrumbs.at(-1)?.name ?? null,\n )\n }\n aria-pressed={selectedDestination === currentFolderId}\n className={`w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-left transition-all duration-200 ${\n selectedDestination === currentFolderId\n ? \"bg-bg-accent border-2 border-action-primary-border\"\n : \"hover:bg-action-ghost-bg-hover border-2 border-transparent\"\n }`}\n >\n <Folder className=\"size-5 text-text-link\" />\n <span className=\"font-medium text-text-primary\">\n {tWithFallback(t, \"files.copyDialog.copyHere\", \"Copy here\")}\n </span>\n </button>\n\n {folders.length === 0 && (\n <p className=\"py-4 text-center text-sm text-text-secondary\">\n {tWithFallback(\n t,\n \"files.copyDialog.noFolders\",\n \"No folders here\",\n )}\n </p>\n )}\n\n {/* List of subfolders */}\n {folders.map((folder) => (\n <div\n key={folder.id}\n className={`flex items-center justify-between gap-3 px-3 py-2.5 rounded-lg transition-all duration-200 ${\n selectedDestination === folder.id\n ? \"bg-bg-accent border-2 border-action-primary-border\"\n : \"hover:bg-action-ghost-bg-hover border-2 border-transparent\"\n }`}\n >\n <button\n type=\"button\"\n onClick={() => selectDestination(folder.id, folder.name)}\n className=\"flex items-center gap-3 flex-1 min-w-0\"\n >\n <Folder className=\"size-5 text-text-link flex-shrink-0\" />\n <span className=\"font-medium text-text-primary truncate\">\n {folder.name}\n </span>\n </button>\n <button\n type=\"button\"\n onClick={() => handleFolderClick(folder)}\n className=\"p-1.5 text-text-tertiary hover:text-text-secondary hover:bg-action-ghost-bg-hover rounded transition-colors duration-200 flex-shrink-0\"\n title={tWithFallback(\n t,\n \"files.copyDialog.openFolder\",\n \"Open folder\",\n )}\n aria-label={tWithFallback(\n t,\n \"files.copyDialog.openFolderNamed\",\n \"Open {{name}}\",\n { name: folder.name },\n )}\n >\n <ChevronRight className=\"size-4\" />\n </button>\n </div>\n ))}\n </div>\n )}\n </div>\n </>\n );\n\n return (\n <ResponsiveDialog\n open\n onOpenChange={(next: boolean) => {\n if (!next && !isLoading) {\n onClose();\n }\n }}\n >\n <ResponsiveDialogContent className=\"flex max-h-[80vh] w-full max-w-md flex-col gap-0 p-0\">\n {/* Header */}\n <ResponsiveDialogHeader className=\"px-6 py-4 border-b border-border-default text-left\">\n <ResponsiveDialogTitle className=\"text-lg font-semibold text-text-primary\">\n {tWithFallback(\n t,\n \"files.copyDialog.makeCopyOf\",\n 'Make a copy of \"{{name}}\"',\n { name: item.name },\n )}\n </ResponsiveDialogTitle>\n </ResponsiveDialogHeader>\n\n {/* Name input */}\n <div className=\"px-6 py-4 border-b border-border-default\">\n <label className=\"block text-sm font-medium text-text-primary mb-2\">\n {tWithFallback(t, \"files.copyDialog.name\", \"Name\")}\n </label>\n <Input\n type=\"text\"\n value={newName}\n onChange={(e) => setNewName(e.target.value)}\n aria-label={tWithFallback(t, \"files.copyDialog.name\", \"Name\")}\n placeholder={tWithFallback(\n t,\n \"files.copyDialog.enterName\",\n \"Enter name for the copy\",\n )}\n />\n </div>\n\n {navigationV2 ? (\n <div className=\"flex-1 overflow-y-auto px-6 py-4 space-y-4\">\n <p className=\"text-sm text-text-secondary\">\n {tWithFallback(\n t,\n \"files.copyDialog.destination\",\n \"Copy to: {{folder}}\",\n { folder: destinationName ?? rootLabel },\n )}\n </p>\n <OptionalFields\n storageKey=\"files.copyDialog\"\n contentClassName=\"px-0 py-0 space-y-0\"\n >\n {folderPicker}\n </OptionalFields>\n </div>\n ) : (\n folderPicker\n )}\n\n {/* Footer */}\n <ResponsiveDialogFooter className=\"px-6 py-4 border-t border-border-default\">\n <Button type=\"button\" variant=\"outline\" onClick={onClose}>\n {tWithFallback(t, \"files.common.actions.cancel\", \"Cancel\")}\n </Button>\n <CopySubmitButton\n copying={isLoading}\n canCopy={\n selectedDestination !== undefined && Boolean(newName.trim())\n }\n onCopy={handleCopy}\n />\n </ResponsiveDialogFooter>\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n );\n};\n\n/**\n * The dialog's Copy button. Under the loading system's opt-in it is `busy` while the copy runs;\n * without it, today's disabled button with its spinner and \"Copying...\" label.\n */\nfunction CopySubmitButton({\n copying,\n canCopy,\n onCopy,\n}: {\n copying: boolean;\n /** A destination is chosen and the copy has a name. */\n canCopy: boolean;\n onCopy: () => void | Promise<void>;\n}) {\n const loadingSystem = useLoadingSystem();\n const { t } = useI18n();\n const spinning = !loadingSystem && copying;\n return (\n <Button\n busy={loadingSystem && copying}\n busyLabel={\n loadingSystem\n ? tWithFallback(t, \"files.copyDialog.copying\", \"Copying...\")\n : undefined\n }\n type=\"button\"\n onClick={onCopy}\n disabled={spinning || !canCopy}\n >\n {spinning && (\n <SpinnerIcon tone=\"current\" className=\"size-4 animate-spin\" />\n )}\n {spinning\n ? tWithFallback(t, \"files.copyDialog.copying\", \"Copying...\")\n : tWithFallback(t, \"files.copyDialog.copy\", \"Copy\")}\n </Button>\n );\n}\n"],"mappings":";;;;;;;;;;;AA4CA,IAAaC,KAAmC,EAC9C,SACA,SACA,YACA,WACA,eAAY,IACZ,qBAAkB,MAClB,wBAAqB,CAAC,GACtB,kBAAe,SACX;CACJ,IAAM,EAAE,SAAMC,EAAQ,GAChB,CAACC,GAAiBC,KAAsBC,EAC5CC,CACF,GACM,CAACC,GAAaC,KAAkBH,QAE7BC,IAAkB,CAAC,GAAGG,CAAkB,IAAI,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