@muhgholy/next-drive 4.23.7 → 4.23.8

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 (81) hide show
  1. package/dist/{chunk-LAKT7IJJ.cjs → chunk-OU5TKLHV.cjs} +885 -788
  2. package/dist/chunk-OU5TKLHV.cjs.map +1 -0
  3. package/dist/{chunk-MVYNW56R.js → chunk-RBSFEEJJ.js} +882 -785
  4. package/dist/chunk-RBSFEEJJ.js.map +1 -0
  5. package/dist/client/components/drive/{RenameAccountDialog.d.ts → account/rename.d.ts} +2 -2
  6. package/dist/client/components/drive/account/rename.d.ts.map +1 -0
  7. package/dist/client/components/drive/{dnd-provider.d.ts → dnd/context.d.ts} +1 -1
  8. package/dist/client/components/drive/dnd/context.d.ts.map +1 -0
  9. package/dist/client/components/drive/{CreateFolderDialog.d.ts → folder/create.d.ts} +2 -2
  10. package/dist/client/components/drive/folder/create.d.ts.map +1 -0
  11. package/dist/client/components/drive/{RenameDialog.d.ts → item/rename.d.ts} +3 -3
  12. package/dist/client/components/drive/item/rename.d.ts.map +1 -0
  13. package/dist/client/components/{dialog.d.ts → shared/confirm.d.ts} +2 -2
  14. package/dist/client/components/shared/confirm.d.ts.map +1 -0
  15. package/dist/client/components/ui/{alert-dialog.d.ts → alert-modal.d.ts} +1 -1
  16. package/dist/client/components/ui/alert-modal.d.ts.map +1 -0
  17. package/dist/client/components/ui/{dialog-fullscreen.d.ts → fullscreen.d.ts} +1 -1
  18. package/dist/client/components/ui/fullscreen.d.ts.map +1 -0
  19. package/dist/client/components/ui/{dialog.d.ts → modal.d.ts} +1 -1
  20. package/dist/client/components/ui/modal.d.ts.map +1 -0
  21. package/dist/client/context.d.ts.map +1 -1
  22. package/dist/client/hooks/{useUpload.d.ts → use-upload.d.ts} +1 -1
  23. package/dist/client/hooks/use-upload.d.ts.map +1 -0
  24. package/dist/client/index.cjs +227 -164
  25. package/dist/client/index.cjs.map +1 -1
  26. package/dist/client/index.d.ts +12 -11
  27. package/dist/client/index.d.ts.map +1 -1
  28. package/dist/client/index.js +227 -164
  29. package/dist/client/index.js.map +1 -1
  30. package/dist/server/actions/auth.d.ts +4 -0
  31. package/dist/server/actions/auth.d.ts.map +1 -0
  32. package/dist/server/actions/cors.d.ts +4 -0
  33. package/dist/server/actions/cors.d.ts.map +1 -0
  34. package/dist/server/actions/drive.d.ts +18 -0
  35. package/dist/server/actions/drive.d.ts.map +1 -0
  36. package/dist/server/actions/public.d.ts +4 -0
  37. package/dist/server/actions/public.d.ts.map +1 -0
  38. package/dist/server/actions/shared.d.ts +14 -0
  39. package/dist/server/actions/shared.d.ts.map +1 -0
  40. package/dist/server/express.cjs +11 -11
  41. package/dist/server/express.js +2 -2
  42. package/dist/server/hono.cjs +11 -11
  43. package/dist/server/hono.js +2 -2
  44. package/dist/server/index.cjs +16 -16
  45. package/dist/server/index.d.ts +1 -1
  46. package/dist/server/index.d.ts.map +1 -1
  47. package/dist/server/index.js +1 -1
  48. package/dist/server/security/{cryptoUtils.d.ts → crypto-utils.d.ts} +1 -1
  49. package/dist/server/security/crypto-utils.d.ts.map +1 -0
  50. package/dist/server/security/{mimeFilter.d.ts → mime-filter.d.ts} +1 -1
  51. package/dist/server/security/mime-filter.d.ts.map +1 -0
  52. package/dist/server/storage-adapters/google.d.ts.map +1 -0
  53. package/dist/server/storage-adapters/local.d.ts.map +1 -0
  54. package/dist/server/utils/{folderValidation.d.ts → folder-validation.d.ts} +1 -1
  55. package/dist/server/utils/folder-validation.d.ts.map +1 -0
  56. package/dist/server/utils/{imageConvert.d.ts → image-convert.d.ts} +1 -1
  57. package/dist/server/utils/image-convert.d.ts.map +1 -0
  58. package/dist/types/lib/database/index.d.ts +2 -2
  59. package/dist/types/lib/database/index.d.ts.map +1 -1
  60. package/dist/types/server/index.d.ts +5 -5
  61. package/dist/types/server/index.d.ts.map +1 -1
  62. package/package.json +1 -1
  63. package/dist/chunk-LAKT7IJJ.cjs.map +0 -1
  64. package/dist/chunk-MVYNW56R.js.map +0 -1
  65. package/dist/client/components/dialog.d.ts.map +0 -1
  66. package/dist/client/components/drive/CreateFolderDialog.d.ts.map +0 -1
  67. package/dist/client/components/drive/RenameAccountDialog.d.ts.map +0 -1
  68. package/dist/client/components/drive/RenameDialog.d.ts.map +0 -1
  69. package/dist/client/components/drive/dnd-provider.d.ts.map +0 -1
  70. package/dist/client/components/ui/alert-dialog.d.ts.map +0 -1
  71. package/dist/client/components/ui/dialog-fullscreen.d.ts.map +0 -1
  72. package/dist/client/components/ui/dialog.d.ts.map +0 -1
  73. package/dist/client/hooks/useUpload.d.ts.map +0 -1
  74. package/dist/server/providers/google.d.ts.map +0 -1
  75. package/dist/server/providers/local.d.ts.map +0 -1
  76. package/dist/server/security/cryptoUtils.d.ts.map +0 -1
  77. package/dist/server/security/mimeFilter.d.ts.map +0 -1
  78. package/dist/server/utils/folderValidation.d.ts.map +0 -1
  79. package/dist/server/utils/imageConvert.d.ts.map +0 -1
  80. /package/dist/server/{providers → storage-adapters}/google.d.ts +0 -0
  81. /package/dist/server/{providers → storage-adapters}/local.d.ts +0 -0
@@ -1,14 +1,15 @@
1
- export * from './context';
2
- export * from './hooks/useUpload';
3
- export * from '../client/file-chooser';
4
- export * from '../client/components/drive/explorer';
5
- export * from '../client/components/drive/file-grid';
6
- export * from '../client/components/drive/dnd-provider';
7
- export * from '../client/components/drive/path-bar';
8
- export * from '../client/components/drive/upload';
9
- export * from '../client/components/drive/storage/indicator';
10
- export * from '../client/components/drive/header';
11
- export * from '../client/components/drive/sidebar';
1
+ export { DriveProvider, useDrive } from './context';
2
+ export type { TDriveContext } from './context';
3
+ export { useUpload } from './hooks/use-upload';
4
+ export { DriveFileChooser } from '../client/file-chooser';
5
+ export { DriveExplorer } from '../client/components/drive/explorer';
6
+ export { DriveFileGrid } from '../client/components/drive/file-grid';
7
+ export { DriveDndProvider, useDriveDnd } from '../client/components/drive/dnd/context';
8
+ export { DrivePathBar } from '../client/components/drive/path-bar';
9
+ export { DriveUpload } from '../client/components/drive/upload';
10
+ export { DriveStorageIndicator } from '../client/components/drive/storage/indicator';
11
+ export { DriveHeader, DriveContentProgress } from '../client/components/drive/header';
12
+ export { DriveSidebar } from '../client/components/drive/sidebar';
12
13
  export type { TDriveFile, TDriveInformation } from '../types/client';
13
14
  export { driveFileSchemaZod } from '../types/client';
14
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,wCAAwC,CAAC;AACvD,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACpD,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -66,9 +66,15 @@ var DriveProvider = (props) => {
66
66
  headers,
67
67
  credentials: withCredentials ? "include" : "same-origin"
68
68
  });
69
- return await res.json();
69
+ try {
70
+ return await res.json();
71
+ } catch (parseErr) {
72
+ const detail = parseErr instanceof Error ? parseErr.message : String(parseErr);
73
+ return { status: res.status || 0, message: `Could not read the server response for "${action}" (${detail})` };
74
+ }
70
75
  } catch (err) {
71
- return { status: 0, message: err instanceof Error ? err.message : "Network error \u2014 please check your connection" };
76
+ const detail = err instanceof Error ? err.message : String(err);
77
+ return { status: 0, message: `Network request failed for "${action}" (${detail})` };
72
78
  }
73
79
  }, [apiEndpoint, activeAccountId, withCredentials]);
74
80
  const fetchItems = useCallback(async () => {
@@ -343,9 +349,9 @@ var useUpload = (apiEndpoint, activeAccountId, withCredentials = false, onUpload
343
349
  addLog(uploadId, "success", `Chunk uploaded successfully`);
344
350
  return [true, data.data, false];
345
351
  } catch (error) {
346
- const errorMsg = error instanceof Error ? error.message : "Network error during upload";
347
- addLog(uploadId, "error", `Network/Fetch error: ${errorMsg}`);
348
- return [false, errorMsg, true];
352
+ const detail = error instanceof Error ? error.message : String(error);
353
+ addLog(uploadId, "error", `Network/Fetch error: ${detail}`);
354
+ return [false, `Upload connection failed: ${detail}`, true];
349
355
  }
350
356
  };
351
357
  const processItem = async (item, file, folderId) => {
@@ -1031,7 +1037,7 @@ function Label2({
1031
1037
  }
1032
1038
  );
1033
1039
  }
1034
- var DialogConfirmation = (props) => {
1040
+ var DriveConfirm = (props) => {
1035
1041
  const { title, description, onConfirm, disableEscapeKeyDown, inputs, onClose, open } = props;
1036
1042
  const [error, setError] = useState(null);
1037
1043
  const [isLoading, setIsLoading] = useState(false);
@@ -1128,11 +1134,29 @@ var DialogConfirmation = (props) => {
1128
1134
  )
1129
1135
  ] }, input.id)) }),
1130
1136
  /* @__PURE__ */ jsxs(DialogFooter, { children: [
1131
- /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: handleClose, disabled: isLoading, children: "Cancel" }),
1132
1137
  /* @__PURE__ */ jsx(
1133
1138
  Button,
1134
1139
  {
1135
- onClick: handleConfirm,
1140
+ type: "button",
1141
+ variant: "outline",
1142
+ onClick: (e) => {
1143
+ e.preventDefault();
1144
+ e.stopPropagation();
1145
+ handleClose();
1146
+ },
1147
+ disabled: isLoading,
1148
+ children: "Cancel"
1149
+ }
1150
+ ),
1151
+ /* @__PURE__ */ jsx(
1152
+ Button,
1153
+ {
1154
+ type: "button",
1155
+ onClick: (e) => {
1156
+ e.preventDefault();
1157
+ e.stopPropagation();
1158
+ void handleConfirm();
1159
+ },
1136
1160
  disabled: isLoading || !isFormValid(),
1137
1161
  children: "Confirm"
1138
1162
  }
@@ -1142,7 +1166,7 @@ var DialogConfirmation = (props) => {
1142
1166
  }
1143
1167
  ) });
1144
1168
  };
1145
- var RenameAccountDialog = (props) => {
1169
+ var DriveAccountRename = (props) => {
1146
1170
  const { open, onClose, account, onConfirm } = props;
1147
1171
  const {
1148
1172
  register,
@@ -1203,52 +1227,65 @@ var RenameAccountDialog = (props) => {
1203
1227
  e.preventDefault();
1204
1228
  }
1205
1229
  },
1206
- children: /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit(handleFormSubmit), children: [
1207
- /* @__PURE__ */ jsxs(DialogHeader, { children: [
1208
- /* @__PURE__ */ jsx(DialogTitle, { children: "Rename Account" }),
1209
- /* @__PURE__ */ jsx(DialogDescription, { children: "Enter a new display name for this storage account." })
1210
- ] }),
1211
- errors.name && /* @__PURE__ */ jsxs(Alert, { variant: "destructive", children: [
1212
- /* @__PURE__ */ jsx(AlertCircle, { className: "nd:h-4 nd:w-4" }),
1213
- /* @__PURE__ */ jsx(AlertTitle, { children: "Error" }),
1214
- /* @__PURE__ */ jsx(AlertDescription, { children: errors.name.message })
1215
- ] }),
1216
- /* @__PURE__ */ jsx("div", { className: "nd:grid nd:gap-4 nd:py-4", children: /* @__PURE__ */ jsxs("div", { className: "nd:grid nd:gap-2", children: [
1217
- /* @__PURE__ */ jsx(Label2, { htmlFor: "rename-account-input", children: "Account name" }),
1218
- /* @__PURE__ */ jsx(
1219
- Input,
1220
- {
1221
- id: "rename-account-input",
1222
- ...register("name", {
1223
- required: "Account name is required",
1224
- validate: (value) => {
1225
- const trimmed = value.trim();
1226
- if (!trimmed) return "Account name cannot be empty";
1227
- if (trimmed.length > 255)
1228
- return "Account name is too long";
1229
- return true;
1230
+ children: /* @__PURE__ */ jsxs(
1231
+ "form",
1232
+ {
1233
+ onSubmit: (e) => {
1234
+ e.stopPropagation();
1235
+ void handleSubmit(handleFormSubmit)(e);
1236
+ },
1237
+ children: [
1238
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [
1239
+ /* @__PURE__ */ jsx(DialogTitle, { children: "Rename Account" }),
1240
+ /* @__PURE__ */ jsx(DialogDescription, { children: "Enter a new display name for this storage account." })
1241
+ ] }),
1242
+ errors.name && /* @__PURE__ */ jsxs(Alert, { variant: "destructive", children: [
1243
+ /* @__PURE__ */ jsx(AlertCircle, { className: "nd:h-4 nd:w-4" }),
1244
+ /* @__PURE__ */ jsx(AlertTitle, { children: "Error" }),
1245
+ /* @__PURE__ */ jsx(AlertDescription, { children: errors.name.message })
1246
+ ] }),
1247
+ /* @__PURE__ */ jsx("div", { className: "nd:grid nd:gap-4 nd:py-4", children: /* @__PURE__ */ jsxs("div", { className: "nd:grid nd:gap-2", children: [
1248
+ /* @__PURE__ */ jsx(Label2, { htmlFor: "rename-account-input", children: "Account name" }),
1249
+ /* @__PURE__ */ jsx(
1250
+ Input,
1251
+ {
1252
+ id: "rename-account-input",
1253
+ ...register("name", {
1254
+ required: "Account name is required",
1255
+ validate: (value) => {
1256
+ const trimmed = value.trim();
1257
+ if (!trimmed) return "Account name cannot be empty";
1258
+ if (trimmed.length > 255)
1259
+ return "Account name is too long";
1260
+ return true;
1261
+ }
1262
+ }),
1263
+ placeholder: "Enter account name",
1264
+ disabled: isSubmitting,
1265
+ autoComplete: "off"
1230
1266
  }
1231
- }),
1232
- placeholder: "Enter account name",
1233
- disabled: isSubmitting,
1234
- autoComplete: "off"
1235
- }
1236
- )
1237
- ] }) }),
1238
- /* @__PURE__ */ jsxs(DialogFooter, { children: [
1239
- /* @__PURE__ */ jsx(
1240
- Button,
1241
- {
1242
- type: "button",
1243
- variant: "outline",
1244
- onClick: handleClose,
1245
- disabled: isSubmitting,
1246
- children: "Cancel"
1247
- }
1248
- ),
1249
- /* @__PURE__ */ jsx(Button, { type: "submit", disabled: isSubmitting, children: isSubmitting ? "Saving..." : "Save" })
1250
- ] })
1251
- ] })
1267
+ )
1268
+ ] }) }),
1269
+ /* @__PURE__ */ jsxs(DialogFooter, { children: [
1270
+ /* @__PURE__ */ jsx(
1271
+ Button,
1272
+ {
1273
+ type: "button",
1274
+ variant: "outline",
1275
+ onClick: (e) => {
1276
+ e.preventDefault();
1277
+ e.stopPropagation();
1278
+ handleClose();
1279
+ },
1280
+ disabled: isSubmitting,
1281
+ children: "Cancel"
1282
+ }
1283
+ ),
1284
+ /* @__PURE__ */ jsx(Button, { type: "submit", disabled: isSubmitting, children: isSubmitting ? "Saving..." : "Save" })
1285
+ ] })
1286
+ ]
1287
+ }
1288
+ )
1252
1289
  }
1253
1290
  ) });
1254
1291
  };
@@ -1469,7 +1506,7 @@ var ContextMenuSeparator = React3.forwardRef(({ className, ...props }, ref) => /
1469
1506
  }
1470
1507
  ));
1471
1508
  ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;
1472
- var CreateFolderDialog = (props) => {
1509
+ var DriveFolderCreate = (props) => {
1473
1510
  const { open, onClose, onConfirm } = props;
1474
1511
  const {
1475
1512
  register,
@@ -1521,56 +1558,69 @@ var CreateFolderDialog = (props) => {
1521
1558
  e.preventDefault();
1522
1559
  }
1523
1560
  },
1524
- children: /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit(handleFormSubmit), children: [
1525
- /* @__PURE__ */ jsxs(DialogHeader, { children: [
1526
- /* @__PURE__ */ jsx(DialogTitle, { children: "Create New Folder" }),
1527
- /* @__PURE__ */ jsx(DialogDescription, { children: "Enter a name for the new folder" })
1528
- ] }),
1529
- errors.name && /* @__PURE__ */ jsxs(Alert, { variant: "destructive", children: [
1530
- /* @__PURE__ */ jsx(AlertCircle, { className: "nd:h-4 nd:w-4" }),
1531
- /* @__PURE__ */ jsx(AlertTitle, { children: "Error" }),
1532
- /* @__PURE__ */ jsx(AlertDescription, { children: errors.name.message })
1533
- ] }),
1534
- /* @__PURE__ */ jsx("div", { className: "nd:grid nd:gap-4 nd:py-4", children: /* @__PURE__ */ jsxs("div", { className: "nd:grid nd:gap-2", children: [
1535
- /* @__PURE__ */ jsx(Label2, { htmlFor: "folder-name", children: "Folder name" }),
1536
- /* @__PURE__ */ jsx(
1537
- Input,
1538
- {
1539
- id: "folder-name",
1540
- ...register("name", {
1541
- required: "Folder name is required",
1542
- validate: (value) => {
1543
- const trimmed = value.trim();
1544
- if (!trimmed) return "Folder name cannot be empty";
1545
- if (trimmed.length > 255)
1546
- return "Folder name is too long";
1547
- return true;
1561
+ children: /* @__PURE__ */ jsxs(
1562
+ "form",
1563
+ {
1564
+ onSubmit: (e) => {
1565
+ e.stopPropagation();
1566
+ void handleSubmit(handleFormSubmit)(e);
1567
+ },
1568
+ children: [
1569
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [
1570
+ /* @__PURE__ */ jsx(DialogTitle, { children: "Create New Folder" }),
1571
+ /* @__PURE__ */ jsx(DialogDescription, { children: "Enter a name for the new folder" })
1572
+ ] }),
1573
+ errors.name && /* @__PURE__ */ jsxs(Alert, { variant: "destructive", children: [
1574
+ /* @__PURE__ */ jsx(AlertCircle, { className: "nd:h-4 nd:w-4" }),
1575
+ /* @__PURE__ */ jsx(AlertTitle, { children: "Error" }),
1576
+ /* @__PURE__ */ jsx(AlertDescription, { children: errors.name.message })
1577
+ ] }),
1578
+ /* @__PURE__ */ jsx("div", { className: "nd:grid nd:gap-4 nd:py-4", children: /* @__PURE__ */ jsxs("div", { className: "nd:grid nd:gap-2", children: [
1579
+ /* @__PURE__ */ jsx(Label2, { htmlFor: "folder-name", children: "Folder name" }),
1580
+ /* @__PURE__ */ jsx(
1581
+ Input,
1582
+ {
1583
+ id: "folder-name",
1584
+ ...register("name", {
1585
+ required: "Folder name is required",
1586
+ validate: (value) => {
1587
+ const trimmed = value.trim();
1588
+ if (!trimmed) return "Folder name cannot be empty";
1589
+ if (trimmed.length > 255)
1590
+ return "Folder name is too long";
1591
+ return true;
1592
+ }
1593
+ }),
1594
+ placeholder: "Enter folder name",
1595
+ disabled: isSubmitting,
1596
+ autoComplete: "off"
1548
1597
  }
1549
- }),
1550
- placeholder: "Enter folder name",
1551
- disabled: isSubmitting,
1552
- autoComplete: "off"
1553
- }
1554
- )
1555
- ] }) }),
1556
- /* @__PURE__ */ jsxs(DialogFooter, { children: [
1557
- /* @__PURE__ */ jsx(
1558
- Button,
1559
- {
1560
- type: "button",
1561
- variant: "outline",
1562
- onClick: handleClose,
1563
- disabled: isSubmitting,
1564
- children: "Cancel"
1565
- }
1566
- ),
1567
- /* @__PURE__ */ jsx(Button, { type: "submit", disabled: isSubmitting, children: isSubmitting ? "Creating..." : "Create" })
1568
- ] })
1569
- ] })
1598
+ )
1599
+ ] }) }),
1600
+ /* @__PURE__ */ jsxs(DialogFooter, { children: [
1601
+ /* @__PURE__ */ jsx(
1602
+ Button,
1603
+ {
1604
+ type: "button",
1605
+ variant: "outline",
1606
+ onClick: (e) => {
1607
+ e.preventDefault();
1608
+ e.stopPropagation();
1609
+ handleClose();
1610
+ },
1611
+ disabled: isSubmitting,
1612
+ children: "Cancel"
1613
+ }
1614
+ ),
1615
+ /* @__PURE__ */ jsx(Button, { type: "submit", disabled: isSubmitting, children: isSubmitting ? "Creating..." : "Create" })
1616
+ ] })
1617
+ ]
1618
+ }
1619
+ )
1570
1620
  }
1571
1621
  ) });
1572
1622
  };
1573
- var RenameDialog = (props) => {
1623
+ var DriveItemRename = (props) => {
1574
1624
  const { open, onClose, item, onConfirm } = props;
1575
1625
  const {
1576
1626
  register,
@@ -1630,57 +1680,70 @@ var RenameDialog = (props) => {
1630
1680
  e.preventDefault();
1631
1681
  }
1632
1682
  },
1633
- children: /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit(handleFormSubmit), children: [
1634
- /* @__PURE__ */ jsxs(DialogHeader, { children: [
1635
- /* @__PURE__ */ jsxs(DialogTitle, { children: [
1636
- "Rename ",
1637
- itemType
1638
- ] }),
1639
- /* @__PURE__ */ jsxs(DialogDescription, { children: [
1640
- "Enter a new name for this ",
1641
- itemType.toLowerCase()
1642
- ] })
1643
- ] }),
1644
- errors.name && /* @__PURE__ */ jsxs(Alert, { variant: "destructive", children: [
1645
- /* @__PURE__ */ jsx(AlertCircle, { className: "nd:h-4 nd:w-4" }),
1646
- /* @__PURE__ */ jsx(AlertTitle, { children: "Error" }),
1647
- /* @__PURE__ */ jsx(AlertDescription, { children: errors.name.message })
1648
- ] }),
1649
- /* @__PURE__ */ jsx("div", { className: "nd:grid nd:gap-4 nd:py-4", children: /* @__PURE__ */ jsxs("div", { className: "nd:grid nd:gap-2", children: [
1650
- /* @__PURE__ */ jsx(Label2, { htmlFor: "rename-input", children: "Name" }),
1651
- /* @__PURE__ */ jsx(
1652
- Input,
1653
- {
1654
- id: "rename-input",
1655
- ...register("name", {
1656
- required: "Name is required",
1657
- validate: (value) => {
1658
- const trimmed = value.trim();
1659
- if (!trimmed) return "Name cannot be empty";
1660
- if (trimmed.length > 255) return "Name is too long";
1661
- return true;
1683
+ children: /* @__PURE__ */ jsxs(
1684
+ "form",
1685
+ {
1686
+ onSubmit: (e) => {
1687
+ e.stopPropagation();
1688
+ void handleSubmit(handleFormSubmit)(e);
1689
+ },
1690
+ children: [
1691
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [
1692
+ /* @__PURE__ */ jsxs(DialogTitle, { children: [
1693
+ "Rename ",
1694
+ itemType
1695
+ ] }),
1696
+ /* @__PURE__ */ jsxs(DialogDescription, { children: [
1697
+ "Enter a new name for this ",
1698
+ itemType.toLowerCase()
1699
+ ] })
1700
+ ] }),
1701
+ errors.name && /* @__PURE__ */ jsxs(Alert, { variant: "destructive", children: [
1702
+ /* @__PURE__ */ jsx(AlertCircle, { className: "nd:h-4 nd:w-4" }),
1703
+ /* @__PURE__ */ jsx(AlertTitle, { children: "Error" }),
1704
+ /* @__PURE__ */ jsx(AlertDescription, { children: errors.name.message })
1705
+ ] }),
1706
+ /* @__PURE__ */ jsx("div", { className: "nd:grid nd:gap-4 nd:py-4", children: /* @__PURE__ */ jsxs("div", { className: "nd:grid nd:gap-2", children: [
1707
+ /* @__PURE__ */ jsx(Label2, { htmlFor: "rename-input", children: "Name" }),
1708
+ /* @__PURE__ */ jsx(
1709
+ Input,
1710
+ {
1711
+ id: "rename-input",
1712
+ ...register("name", {
1713
+ required: "Name is required",
1714
+ validate: (value) => {
1715
+ const trimmed = value.trim();
1716
+ if (!trimmed) return "Name cannot be empty";
1717
+ if (trimmed.length > 255) return "Name is too long";
1718
+ return true;
1719
+ }
1720
+ }),
1721
+ placeholder: "Enter name",
1722
+ disabled: isSubmitting,
1723
+ autoComplete: "off"
1662
1724
  }
1663
- }),
1664
- placeholder: "Enter name",
1665
- disabled: isSubmitting,
1666
- autoComplete: "off"
1667
- }
1668
- )
1669
- ] }) }),
1670
- /* @__PURE__ */ jsxs(DialogFooter, { children: [
1671
- /* @__PURE__ */ jsx(
1672
- Button,
1673
- {
1674
- type: "button",
1675
- variant: "outline",
1676
- onClick: handleClose,
1677
- disabled: isSubmitting,
1678
- children: "Cancel"
1679
- }
1680
- ),
1681
- /* @__PURE__ */ jsx(Button, { type: "submit", disabled: isSubmitting, children: isSubmitting ? "Renaming..." : "Rename" })
1682
- ] })
1683
- ] })
1725
+ )
1726
+ ] }) }),
1727
+ /* @__PURE__ */ jsxs(DialogFooter, { children: [
1728
+ /* @__PURE__ */ jsx(
1729
+ Button,
1730
+ {
1731
+ type: "button",
1732
+ variant: "outline",
1733
+ onClick: (e) => {
1734
+ e.preventDefault();
1735
+ e.stopPropagation();
1736
+ handleClose();
1737
+ },
1738
+ disabled: isSubmitting,
1739
+ children: "Cancel"
1740
+ }
1741
+ ),
1742
+ /* @__PURE__ */ jsx(Button, { type: "submit", disabled: isSubmitting, children: isSubmitting ? "Renaming..." : "Rename" })
1743
+ ] })
1744
+ ]
1745
+ }
1746
+ )
1684
1747
  }
1685
1748
  ) });
1686
1749
  };
@@ -1962,7 +2025,7 @@ var DriveFileGrid = (props) => {
1962
2025
  hasMore && /* @__PURE__ */ jsx("div", { ref: observerTarget, className: "nd:flex nd:justify-center nd:py-6", children: isLoadingMore && /* @__PURE__ */ jsx(Loader2, { className: "nd:size-6 nd:animate-spin nd:text-muted-foreground" }) })
1963
2026
  ] }),
1964
2027
  /* @__PURE__ */ jsx(
1965
- CreateFolderDialog,
2028
+ DriveFolderCreate,
1966
2029
  {
1967
2030
  open: dialogs.newFolder,
1968
2031
  onClose: () => setDialogs((prev) => ({ ...prev, newFolder: false })),
@@ -1972,7 +2035,7 @@ var DriveFileGrid = (props) => {
1972
2035
  }
1973
2036
  ),
1974
2037
  /* @__PURE__ */ jsx(
1975
- RenameDialog,
2038
+ DriveItemRename,
1976
2039
  {
1977
2040
  open: dialogs.rename,
1978
2041
  onClose: () => {
@@ -1987,7 +2050,7 @@ var DriveFileGrid = (props) => {
1987
2050
  }
1988
2051
  ),
1989
2052
  /* @__PURE__ */ jsx(
1990
- DialogConfirmation,
2053
+ DriveConfirm,
1991
2054
  {
1992
2055
  open: dialogs.delete,
1993
2056
  onClose: () => {
@@ -2248,7 +2311,7 @@ var DriveHeader = ({ className }) => {
2248
2311
  )
2249
2312
  ] }),
2250
2313
  /* @__PURE__ */ jsx(
2251
- DialogConfirmation,
2314
+ DriveConfirm,
2252
2315
  {
2253
2316
  open: dialogs.delete,
2254
2317
  onClose: () => setDialogs((prev) => ({ ...prev, delete: false })),
@@ -2264,7 +2327,7 @@ var DriveHeader = ({ className }) => {
2264
2327
  }
2265
2328
  ),
2266
2329
  /* @__PURE__ */ jsx(
2267
- DialogConfirmation,
2330
+ DriveConfirm,
2268
2331
  {
2269
2332
  open: dialogs.emptyTrash,
2270
2333
  onClose: () => setDialogs((prev) => ({ ...prev, emptyTrash: false })),
@@ -2278,7 +2341,7 @@ var DriveHeader = ({ className }) => {
2278
2341
  }
2279
2342
  ),
2280
2343
  /* @__PURE__ */ jsx(
2281
- CreateFolderDialog,
2344
+ DriveFolderCreate,
2282
2345
  {
2283
2346
  open: dialogs.newFolder,
2284
2347
  onClose: () => setDialogs((prev) => ({ ...prev, newFolder: false })),
@@ -2988,7 +3051,7 @@ var ChooserSidebar = (props) => {
2988
3051
  ] }),
2989
3052
  /* @__PURE__ */ jsx("div", { className: "nd:p-2.5 nd:border-t nd:border-border/50 nd:bg-background/50 nd:dark:bg-background/30", children: /* @__PURE__ */ jsx(DriveStorageIndicator, {}) }),
2990
3053
  /* @__PURE__ */ jsx(
2991
- RenameAccountDialog,
3054
+ DriveAccountRename,
2992
3055
  {
2993
3056
  open: renameDialog.open,
2994
3057
  onClose: () => setRenameDialog({ open: false, account: null }),
@@ -2997,7 +3060,7 @@ var ChooserSidebar = (props) => {
2997
3060
  }
2998
3061
  ),
2999
3062
  /* @__PURE__ */ jsx(
3000
- DialogConfirmation,
3063
+ DriveConfirm,
3001
3064
  {
3002
3065
  open: deleteDialog.open,
3003
3066
  onClose: () => setDeleteDialog({ open: false, account: null }),
@@ -3425,7 +3488,7 @@ var SidebarContent = (props) => {
3425
3488
  ] }),
3426
3489
  /* @__PURE__ */ jsx("div", { className: "nd:p-2.5 nd:border-t nd:border-border/50 nd:bg-background/50 nd:dark:bg-background/30", children: /* @__PURE__ */ jsx(DriveStorageIndicator, {}) }),
3427
3490
  /* @__PURE__ */ jsx(
3428
- RenameAccountDialog,
3491
+ DriveAccountRename,
3429
3492
  {
3430
3493
  open: renameDialog.open,
3431
3494
  onClose: () => setRenameDialog({ open: false, account: null }),
@@ -3434,7 +3497,7 @@ var SidebarContent = (props) => {
3434
3497
  }
3435
3498
  ),
3436
3499
  /* @__PURE__ */ jsx(
3437
- DialogConfirmation,
3500
+ DriveConfirm,
3438
3501
  {
3439
3502
  open: deleteDialog.open,
3440
3503
  onClose: () => setDeleteDialog({ open: false, account: null }),
@@ -3794,7 +3857,7 @@ var DriveExplorer = (props) => {
3794
3857
  ] }) : /* @__PURE__ */ jsx("div", { className: "nd:px-2 nd:py-6 nd:text-center", children: /* @__PURE__ */ jsx("p", { className: "nd:text-xs nd:text-muted-foreground", children: "No actions available" }) }) })
3795
3858
  ] }),
3796
3859
  /* @__PURE__ */ jsx(
3797
- CreateFolderDialog,
3860
+ DriveFolderCreate,
3798
3861
  {
3799
3862
  open: dialogs.newFolder,
3800
3863
  onClose: () => setDialogs((prev) => ({ ...prev, newFolder: false })),
@@ -3804,7 +3867,7 @@ var DriveExplorer = (props) => {
3804
3867
  }
3805
3868
  ),
3806
3869
  /* @__PURE__ */ jsx(
3807
- RenameDialog,
3870
+ DriveItemRename,
3808
3871
  {
3809
3872
  open: dialogs.rename,
3810
3873
  onClose: () => {
@@ -3819,7 +3882,7 @@ var DriveExplorer = (props) => {
3819
3882
  }
3820
3883
  ),
3821
3884
  /* @__PURE__ */ jsx(
3822
- DialogConfirmation,
3885
+ DriveConfirm,
3823
3886
  {
3824
3887
  open: dialogs.delete,
3825
3888
  onClose: () => {