@burdenoff/microfe-files 2026.1115.1 → 2026.1119.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.
- package/dist/files/components/CopyDialog.d.ts +6 -0
- package/dist/files/components/CopyDialog.js +112 -101
- package/dist/files/components/CopyDialog.js.map +1 -1
- package/dist/files/components/FileBrowser.js +175 -165
- package/dist/files/components/FileBrowser.js.map +1 -1
- package/dist/files/components/FileInfoPanel.d.ts +7 -1
- package/dist/files/components/FileInfoPanel.js +225 -184
- package/dist/files/components/FileInfoPanel.js.map +1 -1
- package/dist/files/components/SearchBar.d.ts +7 -1
- package/dist/files/components/SearchBar.js +167 -160
- package/dist/files/components/SearchBar.js.map +1 -1
- package/dist/files/components/ShareAccessParts.d.ts +9 -1
- package/dist/files/components/ShareAccessParts.js +31 -23
- package/dist/files/components/ShareAccessParts.js.map +1 -1
- package/dist/files/components/ShareDialog.d.ts +5 -4
- package/dist/files/components/ShareDialog.js +54 -50
- package/dist/files/components/ShareDialog.js.map +1 -1
- package/dist/files/components/UploadVisibilitySelect.js +16 -15
- package/dist/files/components/UploadVisibilitySelect.js.map +1 -1
- package/dist/files/components/viewers/VideoPlayer.js +48 -47
- package/dist/files/components/viewers/VideoPlayer.js.map +1 -1
- package/dist/files/pages/BrowserPage.js +274 -271
- package/dist/files/pages/BrowserPage.js.map +1 -1
- package/dist/files/pages/ShareAccessPage.js +52 -51
- package/dist/files/pages/ShareAccessPage.js.map +1 -1
- package/dist/files/utils/fileKind.d.ts +16 -0
- package/dist/files/utils/fileKind.js +120 -0
- package/dist/files/utils/fileKind.js.map +1 -0
- package/dist/files/utils/infoTechnicalDetails.d.ts +12 -0
- package/dist/files/utils/infoTechnicalDetails.js +16 -0
- package/dist/files/utils/infoTechnicalDetails.js.map +1 -0
- package/dist/files/utils/shareAccess.d.ts +6 -0
- package/dist/files/utils/shareAccess.js +6 -1
- package/dist/files/utils/shareAccess.js.map +1 -1
- package/dist/translations/en.d.ts +29 -0
- package/dist/translations/en.js +32 -1
- package/dist/translations/en.js.map +1 -1
- package/package.json +2 -2
|
@@ -4,9 +4,9 @@ import { SharedFolderView as n } from "./SharedFolderView.js";
|
|
|
4
4
|
import { Download as r, Eye as i, FileText as a, Loader2 as o, Lock as s } from "lucide-react";
|
|
5
5
|
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
6
6
|
import { useI18n as u } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
7
|
-
import { Button as d, PagePurpose as f } from "@burdenoff/fe-libs/ui";
|
|
7
|
+
import { Button as d, PagePurpose as f, ShowTechnicalDetails as p } from "@burdenoff/fe-libs/ui";
|
|
8
8
|
// src/files/components/ShareAccessParts.tsx
|
|
9
|
-
function
|
|
9
|
+
function m({ isFolder: t }) {
|
|
10
10
|
let { t: n } = u();
|
|
11
11
|
return /* @__PURE__ */ l("div", {
|
|
12
12
|
className: "mb-6",
|
|
@@ -19,7 +19,7 @@ function p({ isFolder: t }) {
|
|
|
19
19
|
})]
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function h() {
|
|
23
23
|
let { t } = u();
|
|
24
24
|
return /* @__PURE__ */ l("div", {
|
|
25
25
|
role: "status",
|
|
@@ -27,7 +27,7 @@ function m() {
|
|
|
27
27
|
children: [/* @__PURE__ */ c(o, { className: "size-4 animate-spin text-action-primary-bg" }), e(t, "files.share.verifying", "Verifying share access…")]
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function g({ file: n, canDownload: o, onPreview: s, onDownload: f }) {
|
|
31
31
|
let { t: p } = u();
|
|
32
32
|
return /* @__PURE__ */ l("div", {
|
|
33
33
|
className: "space-y-4",
|
|
@@ -60,7 +60,7 @@ function h({ file: n, canDownload: o, onPreview: s, onDownload: f }) {
|
|
|
60
60
|
})]
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function _({ isFolder: t, invalid: n, password: r, onPasswordChange: i, onSubmit: a }) {
|
|
64
64
|
let { t: o } = u();
|
|
65
65
|
return /* @__PURE__ */ l("form", {
|
|
66
66
|
className: "space-y-4",
|
|
@@ -94,25 +94,32 @@ function g({ isFolder: t, invalid: n, password: r, onPasswordChange: i, onSubmit
|
|
|
94
94
|
]
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
let { t:
|
|
97
|
+
function v({ unavailable: t, technicalDetails: n = null, onRetry: r }) {
|
|
98
|
+
let { t: i } = u();
|
|
99
99
|
return /* @__PURE__ */ l("div", {
|
|
100
100
|
className: "space-y-4",
|
|
101
|
-
children: [
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
101
|
+
children: [
|
|
102
|
+
t && /* @__PURE__ */ c("div", {
|
|
103
|
+
role: "alert",
|
|
104
|
+
className: "rounded-lg border border-status-error-border bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text",
|
|
105
|
+
children: e(i, "files.share.errors.unavailable", "This link has expired or is no longer available.")
|
|
106
|
+
}),
|
|
107
|
+
t && n && /* @__PURE__ */ c(p, {
|
|
108
|
+
copyable: !0,
|
|
109
|
+
children: n
|
|
110
|
+
}),
|
|
111
|
+
/* @__PURE__ */ c("button", {
|
|
112
|
+
type: "button",
|
|
113
|
+
onClick: r,
|
|
114
|
+
className: "inline-flex w-full items-center justify-center gap-2 rounded-lg bg-action-primary-bg px-4 py-2.5 text-sm font-medium text-text-inverse transition-colors hover:bg-action-primary-bg-hover",
|
|
115
|
+
children: e(i, "files.share.retry", "Retry shared file access")
|
|
116
|
+
})
|
|
117
|
+
]
|
|
111
118
|
});
|
|
112
119
|
}
|
|
113
|
-
function
|
|
120
|
+
function y(e) {
|
|
114
121
|
let { loading: t, share: r, sharedFile: i, failure: a } = e;
|
|
115
|
-
return t ? /* @__PURE__ */ c(
|
|
122
|
+
return t ? /* @__PURE__ */ c(h, {}) : r?.kind === "folder" ? /* @__PURE__ */ c(n, {
|
|
116
123
|
folderName: r.folder.name,
|
|
117
124
|
files: r.files,
|
|
118
125
|
truncated: r.truncated,
|
|
@@ -120,22 +127,23 @@ function v(e) {
|
|
|
120
127
|
failedFileId: e.failedFileId,
|
|
121
128
|
onPreview: e.onFolderPreview,
|
|
122
129
|
onDownload: e.onFolderDownload
|
|
123
|
-
}) : i ? /* @__PURE__ */ c(
|
|
130
|
+
}) : i ? /* @__PURE__ */ c(g, {
|
|
124
131
|
file: i,
|
|
125
132
|
canDownload: !!(i.downloadUrl || i.url),
|
|
126
133
|
onPreview: e.onOpenPreview,
|
|
127
134
|
onDownload: e.onDownload
|
|
128
|
-
}) : a === "password-required" || a === "password-invalid" ? /* @__PURE__ */ c(
|
|
135
|
+
}) : a === "password-required" || a === "password-invalid" ? /* @__PURE__ */ c(_, {
|
|
129
136
|
isFolder: e.isFolder,
|
|
130
137
|
invalid: a === "password-invalid",
|
|
131
138
|
password: e.password,
|
|
132
139
|
onPasswordChange: e.onPasswordChange,
|
|
133
140
|
onSubmit: e.onPasswordSubmit
|
|
134
|
-
}) : /* @__PURE__ */ c(
|
|
141
|
+
}) : /* @__PURE__ */ c(v, {
|
|
135
142
|
unavailable: a === "unavailable",
|
|
143
|
+
technicalDetails: e.failureDetail ?? null,
|
|
136
144
|
onRetry: e.onRetry
|
|
137
145
|
});
|
|
138
146
|
}
|
|
139
|
-
export {
|
|
147
|
+
export { y as ShareAccessBody, m as ShareAccessHeader, h as ShareAccessVerifying, _ as SharePasswordForm, v as ShareUnavailable, g as SharedFileSummary };
|
|
140
148
|
|
|
141
149
|
//# sourceMappingURL=ShareAccessParts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShareAccessParts.js","names":["ShareAccessHeader","useI18n","isFolder","tWithFallback","t","PagePurpose","ShareAccessVerifying","Loader2","SharedFileSummary","FileText","file","formatFileSize","Button","onPreview","Eye","canDownload","onDownload","Download","SharePasswordForm","Lock","password","onPasswordChange","event","invalid","ShareUnavailable","unavailable","onRetry","ShareAccessBody","props","loading","share","SharedFolderView","sharedFile","failure"],"sources":["../../../src/files/components/ShareAccessParts.tsx"],"sourcesContent":["/**\n * Pieces of the public share page (`/files/share/:token`, BOFF-11865), split\n * out so the page itself only decides which one to show.\n */\nimport type { FormEvent } from \"react\";\nimport { Download, Eye, FileText, Loader2, Lock } from \"lucide-react\";\nimport { useI18n } from \"@burdenoff/fe-libs/shared/providers/shell/I18nProvider\";\nimport { Button, PagePurpose } from \"@burdenoff/fe-libs/ui\";\nimport { tWithFallback } from \"../utils/i18n\";\nimport { formatFileSize } from \"../utils\";\nimport type { ShareAccessFailure } from \"../utils/shareAccess\";\nimport type { PublicShareResult, SharedFolderFile } from \"../utils/publicShare\";\nimport { SharedFolderView } from \"./SharedFolderView\";\n\n/** The page title and purpose line, worded for a file or a folder link. */\nexport function ShareAccessHeader({ isFolder }: { isFolder: boolean }) {\n const { t } = useI18n();\n return (\n <div className=\"mb-6\">\n <h1 className=\"text-xl font-semibold text-text-primary\">\n {isFolder\n ? tWithFallback(t, \"files.share.folder.title\", \"Shared folder\")\n : tWithFallback(t, \"files.share.title\", \"Shared file access\")}\n </h1>\n <PagePurpose className=\"mt-2\">\n {isFolder\n ? tWithFallback(\n t,\n \"files.share.folder.subtitle\",\n \"Someone shared a folder with you via a link. Preview and download its files here — if the link is password-protected, enter the password the sender gave you to unlock it.\",\n )\n : tWithFallback(\n t,\n \"files.share.subtitle\",\n \"Someone shared a file with you via a link. Preview and download it here — if the link is password-protected, enter the password the sender gave you to unlock it.\",\n )}\n </PagePurpose>\n </div>\n );\n}\n\n/** Shown while the link is being checked. */\nexport function ShareAccessVerifying() {\n const { t } = useI18n();\n return (\n <div\n role=\"status\"\n className=\"flex items-center gap-3 rounded-lg border border-border-seam bg-bg-sunken px-4 py-3 text-sm text-text-secondary\"\n >\n <Loader2 className=\"size-4 animate-spin text-action-primary-bg\" />\n {tWithFallback(t, \"files.share.verifying\", \"Verifying share access…\")}\n </div>\n );\n}\n\n/** A shared file, with Open preview and (when allowed) Download. */\nexport function SharedFileSummary({\n file,\n canDownload,\n onPreview,\n onDownload,\n}: {\n file: { name: string; size: number };\n canDownload: boolean;\n onPreview: () => void;\n onDownload: () => void;\n}) {\n const { t } = useI18n();\n return (\n <div className=\"space-y-4\">\n <div className=\"flex items-center gap-3 rounded-lg border border-border-seam bg-bg-sunken px-4 py-3\">\n <FileText className=\"size-5 shrink-0 text-text-tertiary\" />\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm font-medium text-text-primary\">\n {file.name}\n </p>\n <p className=\"text-xs text-text-secondary\">\n {formatFileSize(file.size)}\n </p>\n </div>\n </div>\n <div className=\"flex flex-col gap-2 sm:flex-row\">\n <Button\n type=\"button\"\n variant=\"outline\"\n className=\"flex-1\"\n onClick={onPreview}\n >\n <Eye className=\"size-4\" />\n {tWithFallback(t, \"files.share.openPreview\", \"Open preview\")}\n </Button>\n {canDownload && (\n <Button type=\"button\" className=\"flex-1\" onClick={onDownload}>\n <Download className=\"size-4\" />\n {tWithFallback(t, \"files.share.download\", \"Download\")}\n </Button>\n )}\n </div>\n </div>\n );\n}\n\n/** Asks for the link's password; says so plainly when it was wrong. */\nexport function SharePasswordForm({\n isFolder,\n invalid,\n password,\n onPasswordChange,\n onSubmit,\n}: {\n isFolder: boolean;\n invalid: boolean;\n password: string;\n onPasswordChange: (value: string) => void;\n onSubmit: (event: FormEvent<HTMLFormElement>) => void;\n}) {\n const { t } = useI18n();\n return (\n <form className=\"space-y-4\" onSubmit={onSubmit}>\n <label className=\"block text-sm font-medium text-text-primary\">\n {tWithFallback(t, \"files.share.password.label\", \"Share password\")}\n <div className=\"mt-2 flex items-center gap-2 rounded-lg border border-border-seam px-3 py-2\">\n <Lock className=\"size-4 text-text-tertiary\" />\n <input\n type=\"password\"\n value={password}\n onChange={(event) => onPasswordChange(event.target.value)}\n aria-label={tWithFallback(\n t,\n \"files.share.password.label\",\n \"Share password\",\n )}\n className=\"w-full bg-transparent text-sm text-text-primary outline-none\"\n placeholder={tWithFallback(\n t,\n \"files.share.password.placeholder\",\n \"Enter the share password\",\n )}\n />\n </div>\n </label>\n\n {invalid && (\n <div\n role=\"alert\"\n className=\"rounded-lg border border-status-error-border bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text\"\n >\n {tWithFallback(\n t,\n \"files.share.errors.wrongPassword\",\n \"That password didn't work. Check it with the person who shared the link and try again.\",\n )}\n </div>\n )}\n\n <button\n type=\"submit\"\n disabled={!password.trim()}\n className=\"inline-flex w-full items-center justify-center gap-2 rounded-lg bg-action-primary-bg px-4 py-2.5 text-sm font-medium text-text-inverse transition-colors hover:bg-action-primary-bg-hover disabled:cursor-not-allowed disabled:bg-bg-sunken disabled:text-text-tertiary\"\n >\n {isFolder\n ? tWithFallback(\n t,\n \"files.share.folder.unlock\",\n \"Unlock shared folder\",\n )\n : tWithFallback(t, \"files.share.unlock\", \"Unlock shared file\")}\n </button>\n </form>\n );\n}\n\n/** One plain sentence when the link can't be opened, and a retry button. */\nexport function ShareUnavailable({\n unavailable,\n onRetry,\n}: {\n unavailable: boolean;\n onRetry: () => void;\n}) {\n const { t } = useI18n();\n return (\n <div className=\"space-y-4\">\n {unavailable && (\n <div\n role=\"alert\"\n className=\"rounded-lg border border-status-error-border bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text\"\n >\n {tWithFallback(\n t,\n \"files.share.errors.unavailable\",\n \"This link has expired or is no longer available.\",\n )}\n </div>\n )}\n <button\n type=\"button\"\n onClick={onRetry}\n className=\"inline-flex w-full items-center justify-center gap-2 rounded-lg bg-action-primary-bg px-4 py-2.5 text-sm font-medium text-text-inverse transition-colors hover:bg-action-primary-bg-hover\"\n >\n {tWithFallback(t, \"files.share.retry\", \"Retry shared file access\")}\n </button>\n </div>\n );\n}\n\nexport interface ShareAccessBodyProps {\n loading: boolean;\n share: PublicShareResult | null;\n /** The shared file, once a file link opened. */\n sharedFile: {\n name: string;\n size: number;\n downloadUrl?: string;\n url: string;\n } | null;\n failure: ShareAccessFailure | null;\n isFolder: boolean;\n password: string;\n busyFileId: string | null;\n failedFileId: string | null;\n onPasswordChange: (value: string) => void;\n onPasswordSubmit: (event: FormEvent<HTMLFormElement>) => void;\n onRetry: () => void;\n onOpenPreview: () => void;\n onDownload: () => void;\n onFolderPreview: (file: SharedFolderFile) => void;\n onFolderDownload: (file: SharedFolderFile) => void;\n}\n\n/** Picks what the share card shows: checking, folder, file, password or error. */\nexport function ShareAccessBody(props: ShareAccessBodyProps) {\n const { loading, share, sharedFile, failure } = props;\n if (loading) return <ShareAccessVerifying />;\n if (share?.kind === \"folder\") {\n return (\n <SharedFolderView\n folderName={share.folder.name}\n files={share.files}\n truncated={share.truncated}\n busyFileId={props.busyFileId}\n failedFileId={props.failedFileId}\n onPreview={props.onFolderPreview}\n onDownload={props.onFolderDownload}\n />\n );\n }\n if (sharedFile) {\n return (\n <SharedFileSummary\n file={sharedFile}\n canDownload={Boolean(sharedFile.downloadUrl || sharedFile.url)}\n onPreview={props.onOpenPreview}\n onDownload={props.onDownload}\n />\n );\n }\n if (failure === \"password-required\" || failure === \"password-invalid\") {\n return (\n <SharePasswordForm\n isFolder={props.isFolder}\n invalid={failure === \"password-invalid\"}\n password={props.password}\n onPasswordChange={props.onPasswordChange}\n onSubmit={props.onPasswordSubmit}\n />\n );\n }\n return (\n <ShareUnavailable\n unavailable={failure === \"unavailable\"}\n onRetry={props.onRetry}\n />\n );\n}\n"],"mappings":";;;;;;;;AAeA,SAAgBA,EAAkB,EAAE,eAAmC;CACrE,IAAM,EAAE,SAAMC,EAAQ;CACtB,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAAC,MAAD;GAAI,WAAU;GACX,UAAAC,IACGC,EAAcC,GAAG,4BAA4B,eAAe,IAC5DD,EAAcC,GAAG,qBAAqB,oBAAoB;EAC5D,CAAA,GACJ,k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,EAAM,OAAO;EACzB,OAAOA,EAAM;EACb,WAAWA,EAAM;EACjB,YAAYF,EAAM;EAClB,cAAcA,EAAM;EACpB,WAAWA,EAAM;EACjB,YAAYA,EAAM;CACnB,CAAA,IAGDI,IAEA,kBAACxB,GAAD;EACE,MAAMwB;EACN,aAAa,GAAQA,EAAW,eAAeA,EAAW;EAC1D,WAAWJ,EAAM;EACjB,YAAYA,EAAM;CACnB,CAAA,IAGDK,MAAY,uBAAuBA,MAAY,qBAE/C,kBAACf,GAAD;EACE,UAAUU,EAAM;EAChB,SAASK,MAAY;EACrB,UAAUL,EAAM;EAChB,kBAAkBA,EAAM;EACxB,UAAUA,EAAM;CACjB,CAAA,IAIH,kBAACJ,GAAD;EACE,aAAaS,MAAY;EACzB,SAASL,EAAM;CAChB,CAAA;AAEL"}
|
|
1
|
+
{"version":3,"file":"ShareAccessParts.js","names":["ShareAccessHeader","useI18n","isFolder","tWithFallback","t","PagePurpose","ShareAccessVerifying","Loader2","SharedFileSummary","FileText","file","formatFileSize","Button","onPreview","Eye","canDownload","onDownload","Download","SharePasswordForm","Lock","password","onPasswordChange","event","invalid","ShareUnavailable","unavailable","technicalDetails","ShowTechnicalDetails","onRetry","ShareAccessBody","props","loading","share","SharedFolderView","sharedFile","failure"],"sources":["../../../src/files/components/ShareAccessParts.tsx"],"sourcesContent":["/**\n * Pieces of the public share page (`/files/share/:token`, BOFF-11865), split\n * out so the page itself only decides which one to show.\n */\nimport type { FormEvent } from \"react\";\nimport { Download, Eye, FileText, Loader2, Lock } from \"lucide-react\";\nimport { useI18n } from \"@burdenoff/fe-libs/shared/providers/shell/I18nProvider\";\nimport {\n Button,\n PagePurpose,\n ShowTechnicalDetails,\n} from \"@burdenoff/fe-libs/ui\";\nimport { tWithFallback } from \"../utils/i18n\";\nimport { formatFileSize } from \"../utils\";\nimport type { ShareAccessFailure } from \"../utils/shareAccess\";\nimport type { PublicShareResult, SharedFolderFile } from \"../utils/publicShare\";\nimport { SharedFolderView } from \"./SharedFolderView\";\n\n/** The page title and purpose line, worded for a file or a folder link. */\nexport function ShareAccessHeader({ isFolder }: { isFolder: boolean }) {\n const { t } = useI18n();\n return (\n <div className=\"mb-6\">\n <h1 className=\"text-xl font-semibold text-text-primary\">\n {isFolder\n ? tWithFallback(t, \"files.share.folder.title\", \"Shared folder\")\n : tWithFallback(t, \"files.share.title\", \"Shared file access\")}\n </h1>\n <PagePurpose className=\"mt-2\">\n {isFolder\n ? tWithFallback(\n t,\n \"files.share.folder.subtitle\",\n \"Someone shared a folder with you via a link. Preview and download its files here — if the link is password-protected, enter the password the sender gave you to unlock it.\",\n )\n : tWithFallback(\n t,\n \"files.share.subtitle\",\n \"Someone shared a file with you via a link. Preview and download it here — if the link is password-protected, enter the password the sender gave you to unlock it.\",\n )}\n </PagePurpose>\n </div>\n );\n}\n\n/** Shown while the link is being checked. */\nexport function ShareAccessVerifying() {\n const { t } = useI18n();\n return (\n <div\n role=\"status\"\n className=\"flex items-center gap-3 rounded-lg border border-border-seam bg-bg-sunken px-4 py-3 text-sm text-text-secondary\"\n >\n <Loader2 className=\"size-4 animate-spin text-action-primary-bg\" />\n {tWithFallback(t, \"files.share.verifying\", \"Verifying share access…\")}\n </div>\n );\n}\n\n/** A shared file, with Open preview and (when allowed) Download. */\nexport function SharedFileSummary({\n file,\n canDownload,\n onPreview,\n onDownload,\n}: {\n file: { name: string; size: number };\n canDownload: boolean;\n onPreview: () => void;\n onDownload: () => void;\n}) {\n const { t } = useI18n();\n return (\n <div className=\"space-y-4\">\n <div className=\"flex items-center gap-3 rounded-lg border border-border-seam bg-bg-sunken px-4 py-3\">\n <FileText className=\"size-5 shrink-0 text-text-tertiary\" />\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm font-medium text-text-primary\">\n {file.name}\n </p>\n <p className=\"text-xs text-text-secondary\">\n {formatFileSize(file.size)}\n </p>\n </div>\n </div>\n <div className=\"flex flex-col gap-2 sm:flex-row\">\n <Button\n type=\"button\"\n variant=\"outline\"\n className=\"flex-1\"\n onClick={onPreview}\n >\n <Eye className=\"size-4\" />\n {tWithFallback(t, \"files.share.openPreview\", \"Open preview\")}\n </Button>\n {canDownload && (\n <Button type=\"button\" className=\"flex-1\" onClick={onDownload}>\n <Download className=\"size-4\" />\n {tWithFallback(t, \"files.share.download\", \"Download\")}\n </Button>\n )}\n </div>\n </div>\n );\n}\n\n/** Asks for the link's password; says so plainly when it was wrong. */\nexport function SharePasswordForm({\n isFolder,\n invalid,\n password,\n onPasswordChange,\n onSubmit,\n}: {\n isFolder: boolean;\n invalid: boolean;\n password: string;\n onPasswordChange: (value: string) => void;\n onSubmit: (event: FormEvent<HTMLFormElement>) => void;\n}) {\n const { t } = useI18n();\n return (\n <form className=\"space-y-4\" onSubmit={onSubmit}>\n <label className=\"block text-sm font-medium text-text-primary\">\n {tWithFallback(t, \"files.share.password.label\", \"Share password\")}\n <div className=\"mt-2 flex items-center gap-2 rounded-lg border border-border-seam px-3 py-2\">\n <Lock className=\"size-4 text-text-tertiary\" />\n <input\n type=\"password\"\n value={password}\n onChange={(event) => onPasswordChange(event.target.value)}\n aria-label={tWithFallback(\n t,\n \"files.share.password.label\",\n \"Share password\",\n )}\n className=\"w-full bg-transparent text-sm text-text-primary outline-none\"\n placeholder={tWithFallback(\n t,\n \"files.share.password.placeholder\",\n \"Enter the share password\",\n )}\n />\n </div>\n </label>\n\n {invalid && (\n <div\n role=\"alert\"\n className=\"rounded-lg border border-status-error-border bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text\"\n >\n {tWithFallback(\n t,\n \"files.share.errors.wrongPassword\",\n \"That password didn't work. Check it with the person who shared the link and try again.\",\n )}\n </div>\n )}\n\n <button\n type=\"submit\"\n disabled={!password.trim()}\n className=\"inline-flex w-full items-center justify-center gap-2 rounded-lg bg-action-primary-bg px-4 py-2.5 text-sm font-medium text-text-inverse transition-colors hover:bg-action-primary-bg-hover disabled:cursor-not-allowed disabled:bg-bg-sunken disabled:text-text-tertiary\"\n >\n {isFolder\n ? tWithFallback(\n t,\n \"files.share.folder.unlock\",\n \"Unlock shared folder\",\n )\n : tWithFallback(t, \"files.share.unlock\", \"Unlock shared file\")}\n </button>\n </form>\n );\n}\n\n/** One plain sentence when the link can't be opened, and a retry button. */\nexport function ShareUnavailable({\n unavailable,\n technicalDetails = null,\n onRetry,\n}: {\n unavailable: boolean;\n /** Raw failure text for \"Show technical details\" (Navigation v2 only). */\n technicalDetails?: string | null;\n onRetry: () => void;\n}) {\n const { t } = useI18n();\n return (\n <div className=\"space-y-4\">\n {unavailable && (\n <div\n role=\"alert\"\n className=\"rounded-lg border border-status-error-border bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text\"\n >\n {tWithFallback(\n t,\n \"files.share.errors.unavailable\",\n \"This link has expired or is no longer available.\",\n )}\n </div>\n )}\n {unavailable && technicalDetails && (\n <ShowTechnicalDetails copyable>{technicalDetails}</ShowTechnicalDetails>\n )}\n <button\n type=\"button\"\n onClick={onRetry}\n className=\"inline-flex w-full items-center justify-center gap-2 rounded-lg bg-action-primary-bg px-4 py-2.5 text-sm font-medium text-text-inverse transition-colors hover:bg-action-primary-bg-hover\"\n >\n {tWithFallback(t, \"files.share.retry\", \"Retry shared file access\")}\n </button>\n </div>\n );\n}\n\nexport interface ShareAccessBodyProps {\n loading: boolean;\n share: PublicShareResult | null;\n /** The shared file, once a file link opened. */\n sharedFile: {\n name: string;\n size: number;\n downloadUrl?: string;\n url: string;\n } | null;\n failure: ShareAccessFailure | null;\n /**\n * Raw text of the last failure, shown under \"Show technical details\" below\n * the plain sentence. Null keeps it out of the page (every app but\n * FluidGrids' Navigation v2).\n */\n failureDetail?: string | null;\n isFolder: boolean;\n password: string;\n busyFileId: string | null;\n failedFileId: string | null;\n onPasswordChange: (value: string) => void;\n onPasswordSubmit: (event: FormEvent<HTMLFormElement>) => void;\n onRetry: () => void;\n onOpenPreview: () => void;\n onDownload: () => void;\n onFolderPreview: (file: SharedFolderFile) => void;\n onFolderDownload: (file: SharedFolderFile) => void;\n}\n\n/** Picks what the share card shows: checking, folder, file, password or error. */\nexport function ShareAccessBody(props: ShareAccessBodyProps) {\n const { loading, share, sharedFile, failure } = props;\n if (loading) return <ShareAccessVerifying />;\n if (share?.kind === \"folder\") {\n return (\n <SharedFolderView\n folderName={share.folder.name}\n files={share.files}\n truncated={share.truncated}\n busyFileId={props.busyFileId}\n failedFileId={props.failedFileId}\n onPreview={props.onFolderPreview}\n onDownload={props.onFolderDownload}\n />\n );\n }\n if (sharedFile) {\n return (\n <SharedFileSummary\n file={sharedFile}\n canDownload={Boolean(sharedFile.downloadUrl || sharedFile.url)}\n onPreview={props.onOpenPreview}\n onDownload={props.onDownload}\n />\n );\n }\n if (failure === \"password-required\" || failure === \"password-invalid\") {\n return (\n <SharePasswordForm\n isFolder={props.isFolder}\n invalid={failure === \"password-invalid\"}\n password={props.password}\n onPasswordChange={props.onPasswordChange}\n onSubmit={props.onPasswordSubmit}\n />\n );\n }\n return (\n <ShareUnavailable\n unavailable={failure === \"unavailable\"}\n technicalDetails={props.failureDetail ?? null}\n onRetry={props.onRetry}\n />\n );\n}\n"],"mappings":";;;;;;;;AAmBA,SAAgBA,EAAkB,EAAE,eAAmC;CACrE,IAAM,EAAE,SAAMC,EAAQ;CACtB,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAAC,MAAD;GAAI,WAAU;GACX,UAAAC,IACGC,EAAcC,GAAG,4BAA4B,eAAe,IAC5DD,EAAcC,GAAG,qBAAqB,oBAAoB;EAC5D,CAAA,GACJ,kBAACC,GAAD;GAAa,WAAU;GACpB,UAAAH,IACGC,EACEC,GACA,+BACA,4KACF,IACAD,EACEC,GACA,wBACA,mKACF;EACO,CAAA,CACV;;AAET;AAGA,SAAgBE,IAAuB;CACrC,IAAM,EAAE,MAAML,EAAQ;CACtB,OACE,kBAAC,OAAD;EACE,MAAK;EACL,WAAU;EAFZ,UAAA,CAIE,kBAACM,GAAD,EAAS,WAAU,6CAA8C,CAAA,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Aa,GAAQA,EAAW,eAAeA,EAAW;EAC1D,WAAWJ,EAAM;EACjB,YAAYA,EAAM;CACnB,CAAA,IAGDK,MAAY,uBAAuBA,MAAY,qBAE/C,kBAACjB,GAAD;EACE,UAAUY,EAAM;EAChB,SAASK,MAAY;EACrB,UAAUL,EAAM;EAChB,kBAAkBA,EAAM;EACxB,UAAUA,EAAM;CACjB,CAAA,IAIH,kBAACN,GAAD;EACE,aAAaW,MAAY;EACzB,kBAAkBL,EAAM,iBAAiB;EACzC,SAASA,EAAM;CAChB,CAAA;AAEL"}
|
|
@@ -18,9 +18,10 @@ interface ShareDialogProps {
|
|
|
18
18
|
*/
|
|
19
19
|
knownPermission?: "denied";
|
|
20
20
|
/**
|
|
21
|
-
* Navigation v2 (BOFF-11865): state the reach of a link
|
|
22
|
-
* before it is created
|
|
21
|
+
* Navigation v2 (BOFF-11865), FluidGrids only: state the reach of a link
|
|
22
|
+
* under the title before it is created, and fold Maximum downloads and
|
|
23
|
+
* Password protection into the shared, remembered "More options".
|
|
23
24
|
*/
|
|
24
|
-
|
|
25
|
+
navigationV2?: boolean;
|
|
25
26
|
}
|
|
26
|
-
export declare function ShareDialog({ item, itemType, onClose, onCreateShare, isLoading, knownPermission,
|
|
27
|
+
export declare function ShareDialog({ item, itemType, onClose, onCreateShare, isLoading, knownPermission, navigationV2, }: ShareDialogProps): import('react').JSX.Element;
|
|
@@ -6,9 +6,9 @@ import { useEffect as s, useState as c } from "react";
|
|
|
6
6
|
import { Calendar as l, Check as u, Copy as d, Download as f, Link as p, Loader2 as m, Lock as h, Mail as g, ShieldAlert as _ } from "lucide-react";
|
|
7
7
|
import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
8
8
|
import { useI18n as x } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
9
|
-
import { Button as S, OptionalFields as C, ResponsiveDialog as w, ResponsiveDialogContent as T, ResponsiveDialogDescription as E, ResponsiveDialogFooter as D, ResponsiveDialogHeader as O, ResponsiveDialogTitle as k } from "@burdenoff/fe-libs/ui";
|
|
9
|
+
import { Button as S, OptionalFields as C, ResponsiveDialog as w, ResponsiveDialogContent as T, ResponsiveDialogDescription as E, ResponsiveDialogFooter as D, ResponsiveDialogHeader as O, ResponsiveDialogTitle as k, ThemedSelect as A } from "@burdenoff/fe-libs/ui";
|
|
10
10
|
// src/files/components/ShareDialog.tsx
|
|
11
|
-
function
|
|
11
|
+
function j({ item: t, itemType: n, onClose: i, onCreateShare: a, isLoading: o, knownPermission: s, navigationV2: l = !1 }) {
|
|
12
12
|
let { t: u } = x(), [d, f] = c(null), { permission: p, denialCause: m, recordRefusal: h } = r({
|
|
13
13
|
item: t,
|
|
14
14
|
itemType: n,
|
|
@@ -22,7 +22,7 @@ function A({ item: t, itemType: n, onClose: i, onCreateShare: a, isLoading: o, k
|
|
|
22
22
|
children: /* @__PURE__ */ b(T, { children: [/* @__PURE__ */ b(O, { children: [/* @__PURE__ */ y(k, { children: e(u, "files.shareDialog.title", "Share {{itemType}} \"{{name}}\"", {
|
|
23
23
|
itemType: g,
|
|
24
24
|
name: t.name
|
|
25
|
-
}) }), l && d === null && /* @__PURE__ */ y(E, { children: e(u, "files.shareDialog.reach", "Anyone with the link can view and download until it expires.") })] }), /* @__PURE__ */ y(
|
|
25
|
+
}) }), l && d === null && /* @__PURE__ */ y(E, { children: e(u, "files.shareDialog.reach", "Anyone with the link can view and download until it expires.") })] }), /* @__PURE__ */ y(M, {
|
|
26
26
|
item: t,
|
|
27
27
|
itemType: n,
|
|
28
28
|
itemTypeLabel: g,
|
|
@@ -33,29 +33,31 @@ function A({ item: t, itemType: n, onClose: i, onCreateShare: a, isLoading: o, k
|
|
|
33
33
|
onClose: i,
|
|
34
34
|
onCreateShare: a,
|
|
35
35
|
onCreated: f,
|
|
36
|
-
onRefused: h
|
|
36
|
+
onRefused: h,
|
|
37
|
+
navigationV2: l
|
|
37
38
|
})] })
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
-
return i === null ? r === "checking" ? /* @__PURE__ */ y(
|
|
41
|
+
function M({ item: e, itemType: t, itemTypeLabel: n, permission: r, denialCause: i, created: a, isLoading: o, onClose: s, onCreateShare: c, onCreated: l, onRefused: u, navigationV2: d }) {
|
|
42
|
+
return i === null ? r === "checking" ? /* @__PURE__ */ y(P, { onClose: s }) : a === null ? /* @__PURE__ */ y(I, {
|
|
42
43
|
item: e,
|
|
43
44
|
itemType: t,
|
|
44
45
|
isLoading: o,
|
|
45
46
|
onClose: s,
|
|
46
47
|
onCreateShare: c,
|
|
47
48
|
onCreated: l,
|
|
48
|
-
onRefused: u
|
|
49
|
-
|
|
49
|
+
onRefused: u,
|
|
50
|
+
navigationV2: d
|
|
51
|
+
}) : /* @__PURE__ */ y(U, {
|
|
50
52
|
created: a,
|
|
51
53
|
onClose: s
|
|
52
|
-
}) : /* @__PURE__ */ y(
|
|
54
|
+
}) : /* @__PURE__ */ y(N, {
|
|
53
55
|
cause: i,
|
|
54
56
|
itemTypeLabel: n,
|
|
55
57
|
onClose: s
|
|
56
58
|
});
|
|
57
59
|
}
|
|
58
|
-
function
|
|
60
|
+
function N({ cause: t, itemTypeLabel: n, onClose: r }) {
|
|
59
61
|
let { t: i } = x(), o = a(i, t, n);
|
|
60
62
|
return /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ b("div", {
|
|
61
63
|
role: "alert",
|
|
@@ -76,7 +78,7 @@ function M({ cause: t, itemTypeLabel: n, onClose: r }) {
|
|
|
76
78
|
children: e(i, "files.common.actions.close", "Close")
|
|
77
79
|
}) })] });
|
|
78
80
|
}
|
|
79
|
-
function
|
|
81
|
+
function P({ onClose: t }) {
|
|
80
82
|
let { t: n } = x();
|
|
81
83
|
return /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ b("div", {
|
|
82
84
|
role: "status",
|
|
@@ -90,33 +92,34 @@ function N({ onClose: t }) {
|
|
|
90
92
|
children: e(n, "files.common.actions.cancel", "Cancel")
|
|
91
93
|
}) })] });
|
|
92
94
|
}
|
|
93
|
-
function
|
|
95
|
+
function F(t, n) {
|
|
94
96
|
return n instanceof Error ? n.message : e(t, "files.shareDialog.errors.createFailed", "Failed to create share");
|
|
95
97
|
}
|
|
96
|
-
function
|
|
97
|
-
let { t:
|
|
98
|
+
function I({ item: r, itemType: a, isLoading: o, onClose: s, onCreateShare: l, onCreated: u, onRefused: d, navigationV2: f }) {
|
|
99
|
+
let { t: p } = x(), [m, h] = c(t), [g, _] = c(null), C = (e) => h((t) => ({
|
|
98
100
|
...t,
|
|
99
101
|
...e
|
|
100
102
|
}));
|
|
101
103
|
return /* @__PURE__ */ b(v, { children: [
|
|
102
|
-
|
|
104
|
+
g && /* @__PURE__ */ y("div", {
|
|
103
105
|
className: "mb-4 rounded-lg border border-status-error-border bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text",
|
|
104
|
-
children:
|
|
106
|
+
children: g
|
|
105
107
|
}),
|
|
106
108
|
/* @__PURE__ */ b("div", {
|
|
107
109
|
className: "space-y-4",
|
|
108
110
|
children: [
|
|
109
|
-
/* @__PURE__ */ y(R, {
|
|
110
|
-
value: p.expiryDays,
|
|
111
|
-
onChange: (e) => _({ expiryDays: e })
|
|
112
|
-
}),
|
|
113
111
|
/* @__PURE__ */ y(z, {
|
|
114
|
-
value:
|
|
115
|
-
onChange: (e) =>
|
|
112
|
+
value: m.expiryDays,
|
|
113
|
+
onChange: (e) => C({ expiryDays: e })
|
|
116
114
|
}),
|
|
117
115
|
/* @__PURE__ */ y(B, {
|
|
118
|
-
|
|
119
|
-
onChange:
|
|
116
|
+
value: m.invitedEmail,
|
|
117
|
+
onChange: (e) => C({ invitedEmail: e })
|
|
118
|
+
}),
|
|
119
|
+
/* @__PURE__ */ y(V, {
|
|
120
|
+
values: m,
|
|
121
|
+
onChange: C,
|
|
122
|
+
navigationV2: f
|
|
120
123
|
})
|
|
121
124
|
]
|
|
122
125
|
}),
|
|
@@ -124,18 +127,18 @@ function F({ item: r, itemType: a, isLoading: o, onClose: s, onCreateShare: l, o
|
|
|
124
127
|
type: "button",
|
|
125
128
|
variant: "outline",
|
|
126
129
|
onClick: s,
|
|
127
|
-
children: e(
|
|
130
|
+
children: e(p, "files.common.actions.cancel", "Cancel")
|
|
128
131
|
}), /* @__PURE__ */ y(S, {
|
|
129
132
|
type: "button",
|
|
130
133
|
onClick: async () => {
|
|
131
|
-
|
|
132
|
-
let e = n(r.id, a,
|
|
134
|
+
_(null);
|
|
135
|
+
let e = n(r.id, a, m);
|
|
133
136
|
try {
|
|
134
137
|
let t = await l(e);
|
|
135
138
|
u({
|
|
136
139
|
shareType: e.shareType,
|
|
137
140
|
shareUrl: t.publicUrl || "",
|
|
138
|
-
invitedEmail:
|
|
141
|
+
invitedEmail: m.invitedEmail
|
|
139
142
|
});
|
|
140
143
|
} catch (e) {
|
|
141
144
|
let t = i(e);
|
|
@@ -143,19 +146,19 @@ function F({ item: r, itemType: a, isLoading: o, onClose: s, onCreateShare: l, o
|
|
|
143
146
|
d(t);
|
|
144
147
|
return;
|
|
145
148
|
}
|
|
146
|
-
|
|
149
|
+
_(F(p, e));
|
|
147
150
|
}
|
|
148
151
|
},
|
|
149
|
-
disabled: o ||
|
|
150
|
-
children: /* @__PURE__ */ y(
|
|
152
|
+
disabled: o || m.hasPassword && !m.password,
|
|
153
|
+
children: /* @__PURE__ */ y(L, { isLoading: o })
|
|
151
154
|
})] })
|
|
152
155
|
] });
|
|
153
156
|
}
|
|
154
|
-
function
|
|
157
|
+
function L({ isLoading: t }) {
|
|
155
158
|
let { t: n } = x();
|
|
156
159
|
return t ? /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(m, { className: "size-4 animate-spin" }), e(n, "files.shareDialog.actions.creating", "Creating...")] }) : /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(p, { className: "size-4" }), e(n, "files.shareDialog.actions.createLink", "Create share link")] });
|
|
157
160
|
}
|
|
158
|
-
var
|
|
161
|
+
var R = [
|
|
159
162
|
{
|
|
160
163
|
days: 0,
|
|
161
164
|
key: "files.shareDialog.expiry.options.never",
|
|
@@ -182,25 +185,25 @@ var L = [
|
|
|
182
185
|
fallback: "90 days"
|
|
183
186
|
}
|
|
184
187
|
];
|
|
185
|
-
function
|
|
188
|
+
function z({ value: t, onChange: n }) {
|
|
186
189
|
let { t: r } = x(), i = e(r, "files.shareDialog.expiry.label", "Link expires in");
|
|
187
190
|
return /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ b("label", {
|
|
188
191
|
htmlFor: "share-dialog-expiry-select",
|
|
189
192
|
className: "flex items-center gap-2 text-sm font-medium text-text-primary mb-2",
|
|
190
193
|
children: [/* @__PURE__ */ y(l, { className: "size-4" }), i]
|
|
191
|
-
}), /* @__PURE__ */ y(
|
|
194
|
+
}), /* @__PURE__ */ y(A, {
|
|
192
195
|
id: "share-dialog-expiry-select",
|
|
193
196
|
"aria-label": i,
|
|
194
197
|
value: t,
|
|
195
198
|
onChange: (e) => n(Number(e.target.value)),
|
|
196
199
|
className: "w-full min-h-11 px-3 py-2 border border-border-default rounded-lg bg-bg-surface text-text-primary scheme-normal dark:scheme-dark focus:outline-none focus:border-action-primary-border text-sm transition-colors duration-200 [&_option]:bg-bg-surface [&_option]:text-text-primary",
|
|
197
|
-
children:
|
|
200
|
+
children: R.map((t) => /* @__PURE__ */ y("option", {
|
|
198
201
|
value: t.days,
|
|
199
202
|
children: e(r, t.key, t.fallback)
|
|
200
203
|
}, t.days))
|
|
201
204
|
})] });
|
|
202
205
|
}
|
|
203
|
-
function
|
|
206
|
+
function B({ value: t, onChange: n }) {
|
|
204
207
|
let { t: r } = x(), i = e(r, "files.shareDialog.invite.label", "Invite specific person (optional)");
|
|
205
208
|
return /* @__PURE__ */ b("div", { children: [
|
|
206
209
|
/* @__PURE__ */ b("label", {
|
|
@@ -223,17 +226,18 @@ function z({ value: t, onChange: n }) {
|
|
|
223
226
|
})
|
|
224
227
|
] });
|
|
225
228
|
}
|
|
226
|
-
function
|
|
227
|
-
let { t:
|
|
229
|
+
function V({ values: t, onChange: n, navigationV2: r }) {
|
|
230
|
+
let { t: i } = x(), a = e(i, "files.shareDialog.downloads.label", "Maximum downloads");
|
|
228
231
|
return /* @__PURE__ */ y(C, {
|
|
229
|
-
|
|
230
|
-
|
|
232
|
+
storageKey: r ? "files.shareDialog" : void 0,
|
|
233
|
+
title: r ? void 0 : e(i, "files.shareDialog.advanced.title", "Advanced"),
|
|
234
|
+
description: e(i, "files.shareDialog.advanced.description", "Download limits and password protection"),
|
|
231
235
|
children: /* @__PURE__ */ b("div", {
|
|
232
236
|
className: "space-y-4",
|
|
233
237
|
children: [/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ b("label", {
|
|
234
238
|
htmlFor: "share-dialog-max-downloads",
|
|
235
239
|
className: "flex items-center gap-2 text-sm font-medium text-text-primary mb-2",
|
|
236
|
-
children: [/* @__PURE__ */ y(f, { className: "size-4" }),
|
|
240
|
+
children: [/* @__PURE__ */ y(f, { className: "size-4" }), a]
|
|
237
241
|
}), /* @__PURE__ */ y("input", {
|
|
238
242
|
id: "share-dialog-max-downloads",
|
|
239
243
|
type: "number",
|
|
@@ -243,17 +247,17 @@ function B({ values: t, onChange: n }) {
|
|
|
243
247
|
let { valueAsNumber: t } = e.target;
|
|
244
248
|
n({ maxDownloads: Number.isNaN(t) ? 0 : t });
|
|
245
249
|
},
|
|
246
|
-
"aria-label":
|
|
247
|
-
placeholder: e(
|
|
250
|
+
"aria-label": a,
|
|
251
|
+
placeholder: e(i, "files.shareDialog.downloads.placeholder", "Unlimited"),
|
|
248
252
|
className: "w-full min-h-11 px-3 py-2 border border-border-default rounded-lg focus:outline-none focus:border-action-primary-border text-sm transition-colors duration-200"
|
|
249
|
-
})] }), /* @__PURE__ */ y(
|
|
253
|
+
})] }), /* @__PURE__ */ y(H, {
|
|
250
254
|
values: t,
|
|
251
255
|
onChange: n
|
|
252
256
|
})]
|
|
253
257
|
})
|
|
254
258
|
});
|
|
255
259
|
}
|
|
256
|
-
function
|
|
260
|
+
function H({ values: t, onChange: n }) {
|
|
257
261
|
let { t: r } = x(), i = e(r, "files.shareDialog.password.label", "Password protection"), a = e(r, "files.shareDialog.password.require", "Require password");
|
|
258
262
|
return /* @__PURE__ */ b("div", { children: [
|
|
259
263
|
/* @__PURE__ */ b("label", {
|
|
@@ -288,7 +292,7 @@ function V({ values: t, onChange: n }) {
|
|
|
288
292
|
})] })
|
|
289
293
|
] });
|
|
290
294
|
}
|
|
291
|
-
function
|
|
295
|
+
function U({ created: t, onClose: n }) {
|
|
292
296
|
let { t: r } = x();
|
|
293
297
|
return /* @__PURE__ */ b("div", {
|
|
294
298
|
className: "space-y-4",
|
|
@@ -300,7 +304,7 @@ function H({ created: t, onClose: n }) {
|
|
|
300
304
|
}), /* @__PURE__ */ y("p", {
|
|
301
305
|
className: "text-sm text-text-secondary",
|
|
302
306
|
children: e(r, "files.shareDialog.success.invitationSentTo", "An invitation has been sent to {{email}}", { email: t.invitedEmail })
|
|
303
|
-
})] }) : /* @__PURE__ */ y(
|
|
307
|
+
})] }) : /* @__PURE__ */ y(W, { shareUrl: t.shareUrl })
|
|
304
308
|
}), /* @__PURE__ */ y(D, { children: /* @__PURE__ */ y(S, {
|
|
305
309
|
type: "button",
|
|
306
310
|
onClick: n,
|
|
@@ -309,7 +313,7 @@ function H({ created: t, onClose: n }) {
|
|
|
309
313
|
}) })]
|
|
310
314
|
});
|
|
311
315
|
}
|
|
312
|
-
function
|
|
316
|
+
function W({ shareUrl: t }) {
|
|
313
317
|
let { t: n } = x(), [r, i] = c(!1);
|
|
314
318
|
return s(() => {
|
|
315
319
|
if (r) {
|
|
@@ -336,6 +340,6 @@ function U({ shareUrl: t }) {
|
|
|
336
340
|
})]
|
|
337
341
|
})] });
|
|
338
342
|
}
|
|
339
|
-
export {
|
|
343
|
+
export { j as ShareDialog };
|
|
340
344
|
|
|
341
345
|
//# sourceMappingURL=ShareDialog.js.map
|