@burdenoff/microfe-files 2026.1119.2 → 2026.1123.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 (98) hide show
  1. package/dist/files/FilesRoutes.js +27 -21
  2. package/dist/files/FilesRoutes.js.map +1 -1
  3. package/dist/files/components/CopyDialog.js +12 -12
  4. package/dist/files/components/EmptyState.js +6 -6
  5. package/dist/files/components/EmptyState.js.map +1 -1
  6. package/dist/files/components/FileBrowser.js +4 -4
  7. package/dist/files/components/FileBrowser.js.map +1 -1
  8. package/dist/files/components/FileCard.js +4 -4
  9. package/dist/files/components/FileCard.js.map +1 -1
  10. package/dist/files/components/FileInfoPanel.js +18 -18
  11. package/dist/files/components/FileVersionPanel.js +7 -5
  12. package/dist/files/components/FileVersionPanel.js.map +1 -1
  13. package/dist/files/components/FolderCard.js +4 -4
  14. package/dist/files/components/FolderCard.js.map +1 -1
  15. package/dist/files/components/MoveDialog.js +10 -10
  16. package/dist/files/components/SearchBar.js +7 -7
  17. package/dist/files/components/ShareAccessParts.js +15 -15
  18. package/dist/files/components/ShareDialog.js +27 -27
  19. package/dist/files/components/SharedFolderView.js +9 -9
  20. package/dist/files/components/ToolbarMoreMenu.js +9 -9
  21. package/dist/files/components/UploadQueue.js +30 -30
  22. package/dist/files/components/UploadVisibilitySelect.js +4 -4
  23. package/dist/files/hooks/useCreateFolderShare.d.ts +2 -0
  24. package/dist/files/hooks/useCreateFolderShare.js +1 -1
  25. package/dist/files/hooks/useCreateFolderShare.js.map +1 -1
  26. package/dist/files/hooks/useCreateShare.d.ts +2 -0
  27. package/dist/files/hooks/useCreateShare.js +1 -1
  28. package/dist/files/hooks/useCreateShare.js.map +1 -1
  29. package/dist/files/pages/BrowserPage.js +24 -23
  30. package/dist/files/pages/BrowserPage.js.map +1 -1
  31. package/dist/files/pages/ShareAccessPage.js +4 -4
  32. package/dist/files/pages/ShareAccessPage.js.map +1 -1
  33. package/dist/files/types.d.ts +22 -0
  34. package/dist/files/utils/fileKind.d.ts +6 -0
  35. package/dist/files/utils/fileKind.js +49 -10
  36. package/dist/files/utils/fileKind.js.map +1 -1
  37. package/dist/files/v2/DialogShell.d.ts +28 -0
  38. package/dist/files/v2/DialogShell.js +47 -0
  39. package/dist/files/v2/DialogShell.js.map +1 -0
  40. package/dist/files/v2/FilesDialogs.d.ts +35 -0
  41. package/dist/files/v2/FilesDialogs.js +104 -0
  42. package/dist/files/v2/FilesDialogs.js.map +1 -0
  43. package/dist/files/v2/FilesListParts.d.ts +45 -0
  44. package/dist/files/v2/FilesListParts.js +344 -0
  45. package/dist/files/v2/FilesListParts.js.map +1 -0
  46. package/dist/files/v2/FilesPage.d.ts +15 -0
  47. package/dist/files/v2/FilesPage.js +340 -0
  48. package/dist/files/v2/FilesPage.js.map +1 -0
  49. package/dist/files/v2/FilesPageParts.d.ts +41 -0
  50. package/dist/files/v2/FilesPageParts.js +147 -0
  51. package/dist/files/v2/FilesPageParts.js.map +1 -0
  52. package/dist/files/v2/FilesV2Routes.d.ts +8 -0
  53. package/dist/files/v2/FilesV2Routes.js +41 -0
  54. package/dist/files/v2/FilesV2Routes.js.map +1 -0
  55. package/dist/files/v2/ShareDialogV2.d.ts +10 -0
  56. package/dist/files/v2/ShareDialogV2.js +401 -0
  57. package/dist/files/v2/ShareDialogV2.js.map +1 -0
  58. package/dist/files/v2/UploadDialog.d.ts +14 -0
  59. package/dist/files/v2/UploadDialog.js +171 -0
  60. package/dist/files/v2/UploadDialog.js.map +1 -0
  61. package/dist/files/v2/filesModel.d.ts +164 -0
  62. package/dist/files/v2/filesModel.js +247 -0
  63. package/dist/files/v2/filesModel.js.map +1 -0
  64. package/dist/files/v2/uploadLine.d.ts +36 -0
  65. package/dist/files/v2/uploadLine.js +33 -0
  66. package/dist/files/v2/uploadLine.js.map +1 -0
  67. package/dist/files/v2/useFilesPage.d.ts +28 -0
  68. package/dist/files/v2/useFilesPage.js +118 -0
  69. package/dist/files/v2/useFilesPage.js.map +1 -0
  70. package/dist/files/v2/useFilesV2Actions.d.ts +24 -0
  71. package/dist/files/v2/useFilesV2Actions.js +243 -0
  72. package/dist/files/v2/useFilesV2Actions.js.map +1 -0
  73. package/dist/files/v2/useFilesV2List.d.ts +24 -0
  74. package/dist/files/v2/useFilesV2List.js +159 -0
  75. package/dist/files/v2/useFilesV2List.js.map +1 -0
  76. package/dist/files/v2/useFilesV2Uploads.d.ts +87 -0
  77. package/dist/files/v2/useFilesV2Uploads.js +279 -0
  78. package/dist/files/v2/useFilesV2Uploads.js.map +1 -0
  79. package/dist/files/v2/useNow.d.ts +6 -0
  80. package/dist/files/v2/useNow.js +13 -0
  81. package/dist/files/v2/useNow.js.map +1 -0
  82. package/dist/files/v2/useShareV2.d.ts +39 -0
  83. package/dist/files/v2/useShareV2.js +89 -0
  84. package/dist/files/v2/useShareV2.js.map +1 -0
  85. package/dist/files/v2/whoCanSee.d.ts +9 -0
  86. package/dist/files/v2/whoCanSee.js +48 -0
  87. package/dist/files/v2/whoCanSee.js.map +1 -0
  88. package/dist/generated/global-types.d.ts +450 -6
  89. package/dist/generated/wspace-operations.d.ts +249 -0
  90. package/dist/generated/wspace-operations.js +4631 -1
  91. package/dist/generated/wspace-operations.js.map +1 -1
  92. package/dist/generated/wspace-types.d.ts +6866 -105
  93. package/dist/generated/wspace-types.js +9 -3
  94. package/dist/generated/wspace-types.js.map +1 -1
  95. package/dist/translations/en.d.ts +277 -0
  96. package/dist/translations/en.js +265 -0
  97. package/dist/translations/en.js.map +1 -1
  98. package/package.json +2 -2
@@ -0,0 +1,171 @@
1
+ import { FileVisibility as e } from "../../generated/wspace-types.js";
2
+ import { useTr as t } from "../../shared/hooks/useTr.js";
3
+ import { isDesktopFileDrag as n } from "../utils/desktopDrop.js";
4
+ import { DialogShell as r } from "./DialogShell.js";
5
+ import { folderPathOf as i } from "./useFilesV2Uploads.js";
6
+ import { useWhoCanSeeWords as a } from "./whoCanSee.js";
7
+ import { useState as o } from "react";
8
+ import { FileUp as s, FolderUp as c, Upload as l, X as u } from "lucide-react";
9
+ import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
10
+ import { Button as m, Segmented as h } from "@burdenoff/fe-libs/ui";
11
+ import { formatBytes as g } from "@burdenoff/fe-libs/shared/utils";
12
+ // src/files/v2/UploadDialog.tsx
13
+ var _ = 8;
14
+ function v(e, t) {
15
+ let n = document.createElement("input");
16
+ n.type = "file", e ? n.webkitdirectory = !0 : n.multiple = !0, n.onchange = () => {
17
+ t(Array.from(n.files ?? []).map((e) => ({
18
+ file: e,
19
+ folderPath: i(e)
20
+ })));
21
+ }, n.click();
22
+ }
23
+ var y = (e) => `${e.folderPath}/${e.file.name}:${e.file.size}:${e.file.lastModified}`;
24
+ function b({ open: i, onOpenChange: b, initial: x, inFolder: S, folderName: C, onUpload: w }) {
25
+ let T = t(), E = a(), [D, O] = o(() => [...x]), [k, A] = o(e.Private), [j, M] = o(!1), N = (e) => O((t) => {
26
+ let n = new Set(t.map(y));
27
+ return [...t, ...e.filter((e) => !n.has(y(e)))];
28
+ }), P = (e) => O((t) => t.filter((t) => y(t) !== e)), F = (e) => {
29
+ n(e.dataTransfer) && (e.preventDefault(), e.dataTransfer.dropEffect = "copy", M(!0));
30
+ }, I = (e) => {
31
+ n(e.dataTransfer) && (e.preventDefault(), M(!1), N(Array.from(e.dataTransfer.files).map((e) => ({
32
+ file: e,
33
+ folderPath: ""
34
+ }))));
35
+ }, L = D.reduce((e, t) => e + t.file.size, 0), R = D.length === 0 ? T("files.v2.upload.nothingYet", "No files picked yet") : D.length === 1 ? T("files.v2.upload.oneFile", "1 file · {{size}}", { size: g(L) }) : T("files.v2.upload.manyFiles", "{{count}} files · {{size}}", {
36
+ count: D.length,
37
+ size: g(L)
38
+ }), z = [{
39
+ value: e.Private,
40
+ label: E.label("private")
41
+ }, {
42
+ value: e.Workspace,
43
+ label: T("files.v2.upload.everyone", "Everyone in the workspace")
44
+ }];
45
+ return /* @__PURE__ */ f(r, {
46
+ open: i,
47
+ onOpenChange: b,
48
+ title: T("files.v2.upload.title", "Upload files"),
49
+ description: S ? C ? T("files.v2.upload.into", "They go into {{folder}}.", { folder: C }) : T("files.v2.upload.intoFolder", "They go into this folder.") : T("files.v2.upload.intoAll", "They go into All files."),
50
+ icon: l,
51
+ width: "medium",
52
+ footer: /* @__PURE__ */ p(d, { children: [
53
+ /* @__PURE__ */ f("span", {
54
+ className: "me-auto truncate text-xs text-text-secondary",
55
+ "aria-live": "polite",
56
+ children: R
57
+ }),
58
+ /* @__PURE__ */ f(m, {
59
+ type: "button",
60
+ variant: "outline",
61
+ onClick: () => b(!1),
62
+ children: T("files.v2.common.cancel", "Cancel")
63
+ }),
64
+ /* @__PURE__ */ p(m, {
65
+ type: "button",
66
+ disabled: D.length === 0,
67
+ onClick: () => w(D, k),
68
+ children: [/* @__PURE__ */ f(l, { "aria-hidden": "true" }), D.length > 1 ? T("files.v2.upload.submitMany", "Upload {{count}} files", { count: D.length }) : T("files.v2.upload.submit", "Upload")]
69
+ })
70
+ ] }),
71
+ children: /* @__PURE__ */ p("div", {
72
+ className: "flex flex-col gap-5",
73
+ children: [
74
+ /* @__PURE__ */ p("div", {
75
+ onDragOver: F,
76
+ onDragLeave: () => M(!1),
77
+ onDrop: I,
78
+ "data-dropping": j || void 0,
79
+ className: "flex flex-col items-center gap-3 rounded-lg border border-dashed border-border-default bg-bg-sunken px-4 py-6 text-center data-[dropping]:border-action-primary-bg data-[dropping]:bg-accent-soft",
80
+ children: [
81
+ /* @__PURE__ */ f("span", {
82
+ "aria-hidden": "true",
83
+ className: "grid size-10 place-items-center rounded-lg border border-border-subtle bg-bg-surface text-action-primary-bg",
84
+ children: /* @__PURE__ */ f(s, {
85
+ className: "size-5",
86
+ "aria-hidden": "true"
87
+ })
88
+ }),
89
+ /* @__PURE__ */ f("p", {
90
+ className: "text-sm text-text-primary",
91
+ children: T("files.v2.upload.dropHere", "Drop files here, or choose them")
92
+ }),
93
+ /* @__PURE__ */ p("div", {
94
+ className: "flex flex-wrap justify-center gap-2",
95
+ children: [/* @__PURE__ */ p(m, {
96
+ type: "button",
97
+ size: "sm",
98
+ variant: "outline",
99
+ onClick: () => v(!1, N),
100
+ children: [/* @__PURE__ */ f(s, { "aria-hidden": "true" }), T("files.v2.upload.chooseFiles", "Choose files")]
101
+ }), /* @__PURE__ */ p(m, {
102
+ type: "button",
103
+ size: "sm",
104
+ variant: "outline",
105
+ onClick: () => v(!0, N),
106
+ children: [/* @__PURE__ */ f(c, { "aria-hidden": "true" }), T("files.v2.upload.chooseFolder", "Choose a folder")]
107
+ })]
108
+ })
109
+ ]
110
+ }),
111
+ D.length > 0 ? /* @__PURE__ */ p("ul", {
112
+ "aria-label": T("files.v2.upload.picked", "Files to upload"),
113
+ className: "flex flex-col divide-y divide-border-subtle rounded-lg border border-border-subtle",
114
+ children: [D.slice(0, _).map((e) => {
115
+ let t = y(e), n = e.folderPath ? `${e.folderPath}/${e.file.name}` : e.file.name;
116
+ return /* @__PURE__ */ p("li", {
117
+ className: "flex min-w-0 items-center gap-3 px-3 py-2",
118
+ children: [
119
+ /* @__PURE__ */ f("span", {
120
+ className: "min-w-0 flex-1 truncate text-sm text-text-primary",
121
+ children: n
122
+ }),
123
+ /* @__PURE__ */ f("span", {
124
+ className: "shrink-0 text-xs text-text-secondary tabular-nums",
125
+ children: g(e.file.size)
126
+ }),
127
+ /* @__PURE__ */ f(m, {
128
+ type: "button",
129
+ size: "icon",
130
+ variant: "ghost",
131
+ className: "size-7 shrink-0",
132
+ "aria-label": T("files.v2.upload.remove", "Remove {{name}}", { name: n }),
133
+ onClick: () => P(t),
134
+ children: /* @__PURE__ */ f(u, { "aria-hidden": "true" })
135
+ })
136
+ ]
137
+ }, t);
138
+ }), D.length > _ ? /* @__PURE__ */ f("li", {
139
+ className: "px-3 py-2 text-xs text-text-secondary",
140
+ children: T("files.v2.upload.andMore", "and {{count}} more", { count: D.length - _ })
141
+ }) : null]
142
+ }) : null,
143
+ /* @__PURE__ */ p("div", {
144
+ className: "flex flex-col gap-2",
145
+ children: [
146
+ /* @__PURE__ */ f("span", {
147
+ id: "files-v2-upload-who",
148
+ className: "text-sm font-medium text-text-primary",
149
+ children: T("files.v2.upload.whoCanSee", "Who can see them")
150
+ }),
151
+ /* @__PURE__ */ f(h, {
152
+ "aria-labelledby": "files-v2-upload-who",
153
+ "aria-describedby": "files-v2-upload-who-hint",
154
+ options: z,
155
+ value: k,
156
+ onValueChange: (e) => A(e)
157
+ }),
158
+ /* @__PURE__ */ f("p", {
159
+ id: "files-v2-upload-who-hint",
160
+ className: "text-xs text-text-secondary",
161
+ children: k === e.Workspace ? E.hint("workspace") : T("files.v2.upload.privateHint", "Only you, and the people you share them with later")
162
+ })
163
+ ]
164
+ })
165
+ ]
166
+ })
167
+ });
168
+ }
169
+ export { b as UploadDialog };
170
+
171
+ //# sourceMappingURL=UploadDialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UploadDialog.js","names":["_Fragment","LISTED","pick","input","folder","folderPathOf","file","pickedKey","entry","UploadDialog","tr","useTr","who","useWhoCanSeeWords","picked","setPicked","useState","initial","visibility","setVisibility","FileVisibility","dropping","setDropping","add","seen","current","more","remove","key","onDragOver","isDesktopFileDrag","event","onDrop","bytes","sum","summary","formatBytes","visibilityOptions","DialogShell","inFolder","folderName","Upload","Fragment","Button","onOpenChange","onUpload","FileUp","FolderUp","name","X","Segmented","value"],"sources":["../../../src/files/v2/UploadDialog.tsx"],"sourcesContent":["/**\n * Upload files (Workspace pages v2, BOFF-15821): pick files or a folder (or\n * drop them), then choose who can see them for this upload. Replaces the old\n * page's \"Upload visibility\" select, whose choice every later upload inherited.\n *\n * Uploads never make public links or guess a team, so the choice is Private or\n * Everyone in the workspace (`UploadVisibility`).\n */\n\nimport { useState, type DragEvent } from \"react\";\nimport { FileUp, FolderUp, Upload, X } from \"lucide-react\";\nimport { formatBytes } from \"@burdenoff/fe-libs/shared/utils\";\nimport { Button, Segmented } from \"@burdenoff/fe-libs/ui\";\nimport { FileVisibility } from \"../../generated/wspace-types\";\nimport { useTr } from \"../../shared/hooks/useTr\";\nimport { isDesktopFileDrag } from \"../utils/desktopDrop\";\nimport type { UploadVisibility } from \"../utils/uploadVisibility\";\nimport { DialogShell } from \"./DialogShell\";\nimport { folderPathOf, type PickedFile } from \"./useFilesV2Uploads\";\nimport { useWhoCanSeeWords } from \"./whoCanSee\";\n\n/** How many picked files the dialog lists before \"and N more\". */\nconst LISTED = 8;\n\nexport interface UploadDialogProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** Files dropped on the page before the dialog opened. */\n initial: readonly PickedFile[];\n /** They go into the folder being browsed (else the top level, All files). */\n inFolder: boolean;\n /** That folder's name, once known. */\n folderName: string | null;\n onUpload: (picked: PickedFile[], visibility: UploadVisibility) => void;\n}\n\n/** A browser picker for files, or for a whole folder. */\nfunction pick(folder: boolean, onPicked: (picked: PickedFile[]) => void) {\n const input = document.createElement(\"input\");\n input.type = \"file\";\n if (folder) input.webkitdirectory = true;\n else input.multiple = true;\n input.onchange = () => {\n const files = Array.from(input.files ?? []);\n onPicked(files.map((file) => ({ file, folderPath: folderPathOf(file) })));\n };\n input.click();\n}\n\nconst pickedKey = (entry: PickedFile) =>\n `${entry.folderPath}/${entry.file.name}:${entry.file.size}:${entry.file.lastModified}`;\n\nexport function UploadDialog({\n open,\n onOpenChange,\n initial,\n inFolder,\n folderName,\n onUpload,\n}: UploadDialogProps) {\n const tr = useTr();\n const who = useWhoCanSeeWords();\n const [picked, setPicked] = useState<PickedFile[]>(() => [...initial]);\n const [visibility, setVisibility] = useState<UploadVisibility>(\n FileVisibility.Private,\n );\n const [dropping, setDropping] = useState(false);\n\n const add = (more: PickedFile[]) =>\n setPicked((current) => {\n const seen = new Set(current.map(pickedKey));\n return [\n ...current,\n ...more.filter((entry) => !seen.has(pickedKey(entry))),\n ];\n });\n const remove = (key: string) =>\n setPicked((current) => current.filter((entry) => pickedKey(entry) !== key));\n\n const onDragOver = (event: DragEvent<HTMLDivElement>) => {\n if (!isDesktopFileDrag(event.dataTransfer)) return;\n event.preventDefault();\n event.dataTransfer.dropEffect = \"copy\";\n setDropping(true);\n };\n const onDrop = (event: DragEvent<HTMLDivElement>) => {\n if (!isDesktopFileDrag(event.dataTransfer)) return;\n event.preventDefault();\n setDropping(false);\n add(\n Array.from(event.dataTransfer.files).map((file) => ({\n file,\n folderPath: \"\",\n })),\n );\n };\n\n const bytes = picked.reduce((sum, entry) => sum + entry.file.size, 0);\n const summary =\n picked.length === 0\n ? tr(\"files.v2.upload.nothingYet\", \"No files picked yet\")\n : picked.length === 1\n ? tr(\"files.v2.upload.oneFile\", \"1 file · {{size}}\", {\n size: formatBytes(bytes),\n })\n : tr(\"files.v2.upload.manyFiles\", \"{{count}} files · {{size}}\", {\n count: picked.length,\n size: formatBytes(bytes),\n });\n const visibilityOptions = [\n {\n value: FileVisibility.Private,\n label: who.label(\"private\"),\n },\n {\n value: FileVisibility.Workspace,\n label: tr(\"files.v2.upload.everyone\", \"Everyone in the workspace\"),\n },\n ] as const;\n\n return (\n <DialogShell\n open={open}\n onOpenChange={onOpenChange}\n title={tr(\"files.v2.upload.title\", \"Upload files\")}\n description={\n !inFolder\n ? tr(\"files.v2.upload.intoAll\", \"They go into All files.\")\n : folderName\n ? tr(\"files.v2.upload.into\", \"They go into {{folder}}.\", {\n folder: folderName,\n })\n : tr(\"files.v2.upload.intoFolder\", \"They go into this folder.\")\n }\n icon={Upload}\n width=\"medium\"\n footer={\n <>\n <span\n className=\"me-auto truncate text-xs text-text-secondary\"\n aria-live=\"polite\"\n >\n {summary}\n </span>\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => onOpenChange(false)}\n >\n {tr(\"files.v2.common.cancel\", \"Cancel\")}\n </Button>\n <Button\n type=\"button\"\n disabled={picked.length === 0}\n onClick={() => onUpload(picked, visibility)}\n >\n <Upload aria-hidden=\"true\" />\n {picked.length > 1\n ? tr(\"files.v2.upload.submitMany\", \"Upload {{count}} files\", {\n count: picked.length,\n })\n : tr(\"files.v2.upload.submit\", \"Upload\")}\n </Button>\n </>\n }\n >\n <div className=\"flex flex-col gap-5\">\n <div\n onDragOver={onDragOver}\n onDragLeave={() => setDropping(false)}\n onDrop={onDrop}\n data-dropping={dropping || undefined}\n className=\"flex flex-col items-center gap-3 rounded-lg border border-dashed border-border-default bg-bg-sunken px-4 py-6 text-center data-[dropping]:border-action-primary-bg data-[dropping]:bg-accent-soft\"\n >\n <span\n aria-hidden=\"true\"\n className=\"grid size-10 place-items-center rounded-lg border border-border-subtle bg-bg-surface text-action-primary-bg\"\n >\n <FileUp className=\"size-5\" aria-hidden=\"true\" />\n </span>\n <p className=\"text-sm text-text-primary\">\n {tr(\"files.v2.upload.dropHere\", \"Drop files here, or choose them\")}\n </p>\n <div className=\"flex flex-wrap justify-center gap-2\">\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n onClick={() => pick(false, add)}\n >\n <FileUp aria-hidden=\"true\" />\n {tr(\"files.v2.upload.chooseFiles\", \"Choose files\")}\n </Button>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n onClick={() => pick(true, add)}\n >\n <FolderUp aria-hidden=\"true\" />\n {tr(\"files.v2.upload.chooseFolder\", \"Choose a folder\")}\n </Button>\n </div>\n </div>\n\n {picked.length > 0 ? (\n <ul\n aria-label={tr(\"files.v2.upload.picked\", \"Files to upload\")}\n className=\"flex flex-col divide-y divide-border-subtle rounded-lg border border-border-subtle\"\n >\n {picked.slice(0, LISTED).map((entry) => {\n const key = pickedKey(entry);\n const name = entry.folderPath\n ? `${entry.folderPath}/${entry.file.name}`\n : entry.file.name;\n return (\n <li\n key={key}\n className=\"flex min-w-0 items-center gap-3 px-3 py-2\"\n >\n <span className=\"min-w-0 flex-1 truncate text-sm text-text-primary\">\n {name}\n </span>\n <span className=\"shrink-0 text-xs text-text-secondary tabular-nums\">\n {formatBytes(entry.file.size)}\n </span>\n <Button\n type=\"button\"\n size=\"icon\"\n variant=\"ghost\"\n className=\"size-7 shrink-0\"\n aria-label={tr(\n \"files.v2.upload.remove\",\n \"Remove {{name}}\",\n {\n name,\n },\n )}\n onClick={() => remove(key)}\n >\n <X aria-hidden=\"true\" />\n </Button>\n </li>\n );\n })}\n {picked.length > LISTED ? (\n <li className=\"px-3 py-2 text-xs text-text-secondary\">\n {tr(\"files.v2.upload.andMore\", \"and {{count}} more\", {\n count: picked.length - LISTED,\n })}\n </li>\n ) : null}\n </ul>\n ) : null}\n\n <div className=\"flex flex-col gap-2\">\n <span\n id=\"files-v2-upload-who\"\n className=\"text-sm font-medium text-text-primary\"\n >\n {tr(\"files.v2.upload.whoCanSee\", \"Who can see them\")}\n </span>\n <Segmented\n aria-labelledby=\"files-v2-upload-who\"\n aria-describedby=\"files-v2-upload-who-hint\"\n options={visibilityOptions}\n value={visibility}\n onValueChange={(value) => setVisibility(value)}\n />\n <p\n id=\"files-v2-upload-who-hint\"\n className=\"text-xs text-text-secondary\"\n >\n {visibility === FileVisibility.Workspace\n ? who.hint(\"workspace\")\n : tr(\n \"files.v2.upload.privateHint\",\n \"Only you, and the people you share them with later\",\n )}\n </p>\n </div>\n </div>\n </DialogShell>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAsBA,IAAMC,IAAS;AAef,SAASC,EAAK,GAAiB,GAA0C;CACvE,IAAMC,IAAQ,SAAS,cAAc,OAAO;CAQ5C,AAPA,EAAM,OAAO,QACTC,IAAQ,EAAM,kBAAkB,KAC/B,EAAM,WAAW,IACtB,EAAM,iBAAiB;EAErB,EADc,MAAM,KAAKD,EAAM,SAAS,CAAC,CAChC,CAAA,CAAM,KAAK,OAAU;GAAE;GAAM,YAAYE,EAAaC,CAAI;EAAE,EAAE,CAAC;CAC1E,GACAH,EAAM,MAAM;AACd;AAEA,IAAMI,KAAa,MACjB,GAAGC,EAAM,WAAW,GAAGA,EAAM,KAAK,KAAK,GAAGA,EAAM,KAAK,KAAK,GAAGA,EAAM,KAAK;AAE1E,SA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AAA,IACF,IACF;IACF,CAAA,IAAA;IAEJ,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA;MACE,kBAAC,QAAD;OACE,IAAG;OACH,WAAU;OAET,UAAAS,EAAG,6BAA6B,kBAAkB;MAC/C,CAAA;MACN,kBAACwC,GAAD;OACE,mBAAgB;OAChB,oBAAiB;OACjB,SAASb;OACT,OAAOnB;OACP,gBAAgB,MAAUC,EAAcgC,CAAK;MAC9C,CAAA;MACD,kBAAC,KAAD;OACE,IAAG;OACH,WAAU;OAET,UAAAjC,MAAeE,EAAe,YAC3BR,EAAI,KAAK,WAAW,IACpBF,EACE,+BACA,oDACF;MACH,CAAA;KACA;;GACF;;CACM,CAAA;AAEjB"}
@@ -0,0 +1,164 @@
1
+ import { FileVisibility, FileFilterInput, FileSortInput, FolderFilterInput, FolderSortInput } from '../../generated/wspace-types';
2
+ import { FileItem, FolderItem } from '../types';
3
+ /** Rows per page, as on every Workspace list (fe-libs `LIST_PAGE_SIZE`). */
4
+ export declare const FILES_PAGE_SIZE = 20;
5
+ export type FilesTab = "all" | "recent" | "starred" | "trash";
6
+ export declare const FILES_TABS: readonly FilesTab[];
7
+ /** `?tab=`: All files unless it names another tab (`bin` is the old Trash). */
8
+ export declare function filesTabFromParam(value: string | null | undefined): FilesTab;
9
+ /** One row of the list: a folder or a file. */
10
+ export type FilesRow = {
11
+ kind: "folder";
12
+ key: string;
13
+ item: FolderItem;
14
+ } | {
15
+ kind: "file";
16
+ key: string;
17
+ item: FileItem;
18
+ };
19
+ /**
20
+ * What opening a row (its name, or its card) does: into a folder the person
21
+ * may read; a file's preview when it has one; otherwise the details, which is
22
+ * also what a folder they may not read shows, as its locked Open says.
23
+ */
24
+ export declare function openTarget(row: FilesRow): "folder" | "preview" | "details";
25
+ /** True when the person may move the row to the Trash (its ⋯ locks it otherwise). */
26
+ export declare function canTrash(row: FilesRow): boolean;
27
+ /** Folder and file ids come from different tables: the row key keeps them apart. */
28
+ export declare const folderRow: (item: FolderItem) => FilesRow;
29
+ export declare const fileRow: (item: FileItem) => FilesRow;
30
+ export interface SlicePlan {
31
+ offset: number;
32
+ limit: number;
33
+ }
34
+ export interface CombinedPagePlan {
35
+ /** What to ask `getFolders` for; null when the page shows no folders. */
36
+ folders: SlicePlan | null;
37
+ /** What to ask `getFiles` for; null when the page shows no files. */
38
+ files: SlicePlan | null;
39
+ /**
40
+ * The files' offset needs the folder count, which is not known yet (an
41
+ * address opened at page 3): ask for the folders first.
42
+ */
43
+ waitForFolderTotal: boolean;
44
+ }
45
+ export interface CombinedPageInput {
46
+ /** 1-based. */
47
+ page: number;
48
+ pageSize: number;
49
+ includeFolders: boolean;
50
+ includeFiles: boolean;
51
+ /** How many folders match, once the server said; undefined before. */
52
+ folderTotal: number | undefined;
53
+ }
54
+ /**
55
+ * What to ask the server for one page of "folders, then files".
56
+ *
57
+ * Folders fill the page from `(page - 1) * pageSize` (an offset past the last
58
+ * folder returns none, and still the total). Files continue where the folders
59
+ * end, so their offset is the page's start less the folder count; on page 1
60
+ * that is 0 whatever the count, so page 1 asks for both at once. A full page
61
+ * of files is always asked for (a stable request, cached per page); the page
62
+ * keeps only the rows that fit after its folders (`joinCombinedPage`).
63
+ */
64
+ export declare function planCombinedPage({ page, pageSize, includeFolders, includeFiles, folderTotal, }: CombinedPageInput): CombinedPagePlan;
65
+ export interface JoinedPage<F, G> {
66
+ folders: F[];
67
+ files: G[];
68
+ }
69
+ /**
70
+ * The page's rows from the two answers: its folders, then as many files as
71
+ * still fit. Folders from a stale answer (more than a page) are cut too.
72
+ */
73
+ export declare function joinCombinedPage<F, G>({ page, pageSize, folders, folderTotal, files, }: {
74
+ page: number;
75
+ pageSize: number;
76
+ folders: readonly F[] | undefined;
77
+ folderTotal: number | undefined;
78
+ files: readonly G[] | undefined;
79
+ }): JoinedPage<F, G>;
80
+ /** The Type filter's choices, in menu order. */
81
+ export type KindFilter = "folder" | "document" | "pdf" | "spreadsheet" | "image" | "video" | "audio" | "archive";
82
+ export declare const KIND_FILTERS: readonly KindFilter[];
83
+ export interface KindQuery {
84
+ includeFolders: boolean;
85
+ includeFiles: boolean;
86
+ /** The server matches MIME types exactly, so a kind is its list of types. */
87
+ mimeTypes: string[] | undefined;
88
+ }
89
+ /** What the server is asked for a Type choice (none: folders and every file). */
90
+ export declare function kindQuery(value: string | undefined): KindQuery;
91
+ /** Who can see a file or folder, as a row's pill says it. */
92
+ export type WhoCanSee = "private" | "team" | "workspace" | "public";
93
+ export declare const WHO_CAN_SEE: readonly WhoCanSee[];
94
+ /** The pill for a visibility; anything unknown reads as Private (the strictest). */
95
+ export declare function whoCanSee(visibility: string | null | undefined): WhoCanSee;
96
+ /** The server's visibility for a Who can see choice; undefined for none. */
97
+ export declare function visibilityFromFilter(value: string | undefined): FileVisibility | undefined;
98
+ export type FilesSort = "changed" | "name";
99
+ export declare const FILES_SORTS: readonly FilesSort[];
100
+ /** What `getFolders` and `getFiles` are asked to order by. */
101
+ export declare function serverSort(sort: string | undefined): {
102
+ folder: FolderSortInput;
103
+ file: FileSortInput;
104
+ };
105
+ export interface FilesListQuery {
106
+ tab: FilesTab;
107
+ /** The folder being browsed (All files only). */
108
+ folderId: string | undefined;
109
+ /** The search, once it is long enough to send (2 characters). */
110
+ search: string;
111
+ kind: string | undefined;
112
+ visibility: string | undefined;
113
+ sort: string | undefined;
114
+ }
115
+ /** Where each half of the list comes from. */
116
+ export type FilesSource = "list" | "starred" | "search";
117
+ export interface FilesListRequest {
118
+ source: FilesSource;
119
+ includeFolders: boolean;
120
+ includeFiles: boolean;
121
+ folderFilter: FolderFilterInput | undefined;
122
+ fileFilter: FileFilterInput | undefined;
123
+ folderSort: FolderSortInput | undefined;
124
+ fileSort: FileSortInput | undefined;
125
+ /**
126
+ * `getFiles(folderId)`: the browsed folder, or null for the top level (All
127
+ * files). Not sent (undefined) for Recent and Trash, which are not about one
128
+ * folder, as on the old pages. (Today's files service reads a missing one as
129
+ * the top level too; the PR notes that gap.)
130
+ */
131
+ folderId: string | null | undefined;
132
+ }
133
+ /** Searches of one character are not sent (the old page's rule, too). */
134
+ export declare const MIN_SEARCH_LENGTH = 2;
135
+ export declare function searchToSend(search: string): string;
136
+ /**
137
+ * The server requests behind a tab, its filters, its sort and the search.
138
+ *
139
+ * - All files: the browsed folder's folders and files, filtered and sorted on
140
+ * the server. A search looks in every folder (`searchFolders` /
141
+ * `searchFiles`; they order by name).
142
+ * - Recent: files only, the latest change first.
143
+ * - Starred: starred folders and files; a search keeps to starred ones.
144
+ * `getStarredFiles` takes no filters, so this tab shows none.
145
+ * - Trash: deleted folders and files.
146
+ */
147
+ export declare function filesListRequest(query: FilesListQuery): FilesListRequest;
148
+ /** The module's translator: a key, its English, and `{{name}}` values. */
149
+ export type Translate = (key: string, fallback: string, params?: Record<string, string | number>) => string;
150
+ /** How the list shows: the Trash's rows, cards, or the list. */
151
+ export type FilesLayout = "trash" | "grid" | "list";
152
+ export declare function filesLayout(tab: FilesTab, view: string | undefined): FilesLayout;
153
+ /** Starred, Recent and a search have their own order: no sort menu. */
154
+ export declare function filesSortable(tab: FilesTab, searching: boolean): boolean;
155
+ /** The error state's title: name the thing. */
156
+ export declare function filesErrorTitle(tr: Translate, tab: FilesTab): string;
157
+ /** "20 items", "3 items in the Trash", "12 results from every folder". */
158
+ export declare function filesCountWords(tr: Translate, count: number, searching: boolean, tab: FilesTab): string;
159
+ /** "45 minutes ago", "yesterday" in the person's language; null for no date. */
160
+ export declare function relativeTime(value: string | null | undefined, now: Date, locale: string): string | null;
161
+ /** How many things a folder holds, from its two counts; null when unknown. */
162
+ export declare function folderItemCount(folder: FolderItem): number | null;
163
+ /** The id of the person who made a row's item (a file's uploader). */
164
+ export declare function ownerIdOf(row: FilesRow): string | undefined;
@@ -0,0 +1,247 @@
1
+ import { FileSortField as e, FileStatus as t, FileVisibility as n, FolderSortField as r, FolderStatus as i, SortOrder as a } from "../../generated/wspace-types.js";
2
+ import { mimeTypesForKind as o } from "../utils/fileKind.js";
3
+ import { fileCapabilities as s, folderCapabilities as c } from "../utils/itemCapabilities.js";
4
+ // src/files/v2/filesModel.ts
5
+ var l = [
6
+ "all",
7
+ "recent",
8
+ "starred",
9
+ "trash"
10
+ ];
11
+ function u(e) {
12
+ return e === "bin" ? "trash" : l.find((t) => t === e) ?? "all";
13
+ }
14
+ function d(e) {
15
+ return e.kind === "folder" ? c(e.item).canOpen ? "folder" : "details" : s(e.item).canPreview ? "preview" : "details";
16
+ }
17
+ function f(e) {
18
+ return e.kind === "folder" ? c(e.item).canDelete : s(e.item).canDelete;
19
+ }
20
+ var p = (e) => ({
21
+ kind: "folder",
22
+ key: `folder:${e.id}`,
23
+ item: e
24
+ }), m = (e) => ({
25
+ kind: "file",
26
+ key: `file:${e.id}`,
27
+ item: e
28
+ });
29
+ function h({ page: e, pageSize: t, includeFolders: n, includeFiles: r, folderTotal: i }) {
30
+ let a = Math.max(1, Math.floor(t)), o = (Math.max(1, Math.floor(e)) - 1) * a, s = n ? {
31
+ offset: o,
32
+ limit: a
33
+ } : null;
34
+ return r ? n ? o === 0 ? {
35
+ folders: s,
36
+ files: {
37
+ offset: 0,
38
+ limit: a
39
+ },
40
+ waitForFolderTotal: !1
41
+ } : i === void 0 ? {
42
+ folders: s,
43
+ files: null,
44
+ waitForFolderTotal: !0
45
+ } : {
46
+ folders: s,
47
+ files: {
48
+ offset: Math.max(0, o - i),
49
+ limit: a
50
+ },
51
+ waitForFolderTotal: !1
52
+ } : {
53
+ folders: null,
54
+ files: {
55
+ offset: o,
56
+ limit: a
57
+ },
58
+ waitForFolderTotal: !1
59
+ } : {
60
+ folders: s,
61
+ files: null,
62
+ waitForFolderTotal: !1
63
+ };
64
+ }
65
+ function g({ page: e, pageSize: t, folders: n, folderTotal: r, files: i }) {
66
+ let a = Math.max(1, Math.floor(t)), o = (Math.max(1, Math.floor(e)) - 1) * a, s = (n ?? []).slice(0, a), c = r === void 0 ? s.length : Math.min(Math.max(r - o, 0), a), l = Math.max(0, a - c);
67
+ return {
68
+ folders: s,
69
+ files: (i ?? []).slice(0, l)
70
+ };
71
+ }
72
+ var _ = [
73
+ "folder",
74
+ "document",
75
+ "pdf",
76
+ "spreadsheet",
77
+ "image",
78
+ "video",
79
+ "audio",
80
+ "archive"
81
+ ], v = {
82
+ document: [
83
+ "word",
84
+ "presentation",
85
+ "text"
86
+ ],
87
+ pdf: ["pdf"],
88
+ spreadsheet: ["spreadsheet"],
89
+ image: ["image"],
90
+ video: ["video"],
91
+ audio: ["audio"],
92
+ archive: ["archive"]
93
+ };
94
+ function y(e) {
95
+ let t = _.find((t) => t === e);
96
+ return t === void 0 ? {
97
+ includeFolders: !0,
98
+ includeFiles: !0,
99
+ mimeTypes: void 0
100
+ } : t === "folder" ? {
101
+ includeFolders: !0,
102
+ includeFiles: !1,
103
+ mimeTypes: void 0
104
+ } : {
105
+ includeFolders: !1,
106
+ includeFiles: !0,
107
+ mimeTypes: [...new Set(v[t].flatMap(o))]
108
+ };
109
+ }
110
+ var b = [
111
+ "private",
112
+ "team",
113
+ "workspace",
114
+ "public"
115
+ ], x = {
116
+ private: n.Private,
117
+ team: n.Team,
118
+ workspace: n.Workspace,
119
+ public: n.Public
120
+ };
121
+ function S(e) {
122
+ switch (e) {
123
+ case n.Team: return "team";
124
+ case n.Workspace: return "workspace";
125
+ case n.Public: return "public";
126
+ default: return "private";
127
+ }
128
+ }
129
+ function C(e) {
130
+ let t = b.find((t) => t === e);
131
+ return t ? x[t] : void 0;
132
+ }
133
+ var w = ["changed", "name"];
134
+ function T(t) {
135
+ return t === "name" ? {
136
+ folder: {
137
+ field: r.Name,
138
+ order: a.Asc
139
+ },
140
+ file: {
141
+ field: e.Name,
142
+ order: a.Asc
143
+ }
144
+ } : {
145
+ folder: {
146
+ field: r.UpdatedAt,
147
+ order: a.Desc
148
+ },
149
+ file: {
150
+ field: e.UpdatedAt,
151
+ order: a.Desc
152
+ }
153
+ };
154
+ }
155
+ function E(e) {
156
+ let t = e.trim();
157
+ return t.length >= 2 ? t : "";
158
+ }
159
+ function D(e) {
160
+ let n = e.tab === "starred" ? y(void 0) : y(e.kind), r = e.tab === "starred" ? void 0 : C(e.visibility), a = T(e.tab === "recent" ? "changed" : e.sort), o = E(e.search), s = e.tab !== "recent" && n.includeFolders, c = n.includeFiles, l = e.tab === "trash", u = e.tab === "starred", d = {
161
+ ...n.mimeTypes ? { mimeTypes: n.mimeTypes } : {},
162
+ ...r ? { visibility: r } : {},
163
+ ...l ? { status: t.Deleted } : {},
164
+ ...u && o ? { starred: !0 } : {}
165
+ }, f = {
166
+ ...r ? { visibility: r } : {},
167
+ ...l ? { status: i.Deleted } : {},
168
+ ...u && o ? { starred: !0 } : {},
169
+ ...e.tab === "all" && !o ? { parentFolderId: e.folderId ?? null } : {}
170
+ }, p = (e) => Object.keys(e).length > 0 ? e : void 0;
171
+ return o ? {
172
+ source: "search",
173
+ includeFolders: s,
174
+ includeFiles: c,
175
+ folderFilter: p(f),
176
+ fileFilter: p(d),
177
+ folderSort: void 0,
178
+ fileSort: void 0,
179
+ folderId: void 0
180
+ } : u ? {
181
+ source: "starred",
182
+ includeFolders: s,
183
+ includeFiles: c,
184
+ folderFilter: void 0,
185
+ fileFilter: void 0,
186
+ folderSort: void 0,
187
+ fileSort: void 0,
188
+ folderId: void 0
189
+ } : {
190
+ source: "list",
191
+ includeFolders: s,
192
+ includeFiles: c,
193
+ folderFilter: p(f),
194
+ fileFilter: p(d),
195
+ folderSort: a.folder,
196
+ fileSort: a.file,
197
+ folderId: e.tab === "all" ? e.folderId ?? null : void 0
198
+ };
199
+ }
200
+ function O(e, t) {
201
+ return e === "trash" ? "trash" : t === "grid" ? "grid" : "list";
202
+ }
203
+ function k(e, t) {
204
+ return e !== "starred" && e !== "recent" && !t;
205
+ }
206
+ function A(e, t) {
207
+ return t === "trash" ? e("files.v2.loadFailedTrash", "Couldn’t load the Trash") : e("files.v2.loadFailed", "Couldn’t load your files");
208
+ }
209
+ function j(e, t, n, r) {
210
+ return n ? t === 1 ? e("files.v2.count.resultOne", "1 result from every folder") : e("files.v2.count.results", "{{count}} results from every folder", { count: t }) : r === "trash" ? t === 1 ? e("files.v2.count.trashOne", "1 item in the Trash") : e("files.v2.count.trash", "{{count}} items in the Trash", { count: t }) : t === 1 ? e("files.v2.count.one", "1 item") : e("files.v2.count.many", "{{count}} items", { count: t });
211
+ }
212
+ var M = [
213
+ ["year", 31536e3],
214
+ ["month", 2592e3],
215
+ ["week", 604800],
216
+ ["day", 86400],
217
+ ["hour", 3600],
218
+ ["minute", 60]
219
+ ], N = new Intl.RelativeTimeFormat("en", { numeric: "auto" }), P = /* @__PURE__ */ new Map([["en", N]]);
220
+ function F(e) {
221
+ let t = P.get(e);
222
+ if (t) return t;
223
+ let n = N;
224
+ try {
225
+ n = new Intl.RelativeTimeFormat(e, { numeric: "auto" });
226
+ } catch {}
227
+ return P.set(e, n), n;
228
+ }
229
+ function I(e, t, n) {
230
+ if (!e) return null;
231
+ let r = new Date(e).getTime();
232
+ if (Number.isNaN(r)) return null;
233
+ let i = Math.round((r - t.getTime()) / 1e3), a = F(n || "en");
234
+ if (Math.abs(i) < 45) return a.format(0, "second");
235
+ for (let [e, t] of M) if (Math.abs(i) >= t) return a.format(Math.round(i / t), e);
236
+ return a.format(Math.round(i / 60), "minute");
237
+ }
238
+ function L(e) {
239
+ let t = e.filesCount ?? e.fileCount, n = e.subfoldersCount;
240
+ return t === void 0 && n === void 0 ? null : (t ?? 0) + (n ?? 0);
241
+ }
242
+ function R(e) {
243
+ return e.kind === "file" ? e.item.uploadedById ?? e.item.createdById : e.item.createdById;
244
+ }
245
+ export { w as FILES_SORTS, l as FILES_TABS, _ as KIND_FILTERS, b as WHO_CAN_SEE, f as canTrash, m as fileRow, j as filesCountWords, A as filesErrorTitle, O as filesLayout, D as filesListRequest, k as filesSortable, u as filesTabFromParam, L as folderItemCount, p as folderRow, g as joinCombinedPage, y as kindQuery, d as openTarget, R as ownerIdOf, h as planCombinedPage, I as relativeTime, E as searchToSend, T as serverSort, C as visibilityFromFilter, S as whoCanSee };
246
+
247
+ //# sourceMappingURL=filesModel.js.map