@burdenoff/microfe-files 2026.1123.2 → 2026.1125.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 (28) hide show
  1. package/dist/files/components/ConfirmDialog.js +20 -15
  2. package/dist/files/components/ConfirmDialog.js.map +1 -1
  3. package/dist/files/components/CopyDialog.js +99 -81
  4. package/dist/files/components/CopyDialog.js.map +1 -1
  5. package/dist/files/components/FileBrowser.js +124 -123
  6. package/dist/files/components/FileBrowser.js.map +1 -1
  7. package/dist/files/components/FileInfoPanel.js +109 -101
  8. package/dist/files/components/FileInfoPanel.js.map +1 -1
  9. package/dist/files/components/FileVersionPanel.js +113 -109
  10. package/dist/files/components/FileVersionPanel.js.map +1 -1
  11. package/dist/files/components/MoveDialog.js +75 -65
  12. package/dist/files/components/MoveDialog.js.map +1 -1
  13. package/dist/files/components/ShareAccessParts.js +8 -7
  14. package/dist/files/components/ShareAccessParts.js.map +1 -1
  15. package/dist/files/components/ShareDialog.js +17 -16
  16. package/dist/files/components/ShareDialog.js.map +1 -1
  17. package/dist/files/components/SharedFolderView.js +29 -26
  18. package/dist/files/components/SharedFolderView.js.map +1 -1
  19. package/dist/files/components/UploadQueue.js +1 -0
  20. package/dist/files/components/UploadQueue.js.map +1 -1
  21. package/dist/files/components/loadingSystem.d.ts +64 -0
  22. package/dist/files/components/loadingSystem.js +56 -0
  23. package/dist/files/components/loadingSystem.js.map +1 -0
  24. package/dist/files/pages/BrowserPage.js +495 -475
  25. package/dist/files/pages/BrowserPage.js.map +1 -1
  26. package/dist/files/v2/FilesPage.js +10 -9
  27. package/dist/files/v2/FilesPage.js.map +1 -1
  28. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"ShareDialog.js","names":["_Fragment","ShareDialog","useI18n","created","setCreated","useState","useShareDialogPermission","itemTypeLabel","tWithFallback","t","itemType","ResponsiveDialog","next","onClose","ResponsiveDialogContent","ResponsiveDialogHeader","ResponsiveDialogTitle","item","navigationV2","ResponsiveDialogDescription","ShareDialogBody","recordRefusal","denialCause","permission","ShareCheckingPanel","ShareForm","ShareSuccessPanel","ShareDeniedPanel","copy","shareDenialCopy","cause","Fragment","ShieldAlert","ResponsiveDialogFooter","Button","Loader2","sharePermissionMessages","shareErrorMessage","error","values","setValues","DEFAULT_SHARE_FORM_VALUES","errorMessage","setErrorMessage","update","current","patch","ShareExpiryField","ShareInviteField","ShareAdvancedFields","shareInput","buildShareInput","result","onCreateShare","source","classifyShareRefusal","isLoading","ShareSubmitLabel","Link","EXPIRY_OPTIONS","label","Calendar","ThemedSelect","onChange","option","Mail","downloadsLabel","OptionalFields","Download","valueAsNumber","SharePasswordField","requireLabel","Lock","ShareLinkResult","copied","setCopied","useEffect","timer","shareUrl","Check","Copy"],"sources":["../../../src/files/components/ShareDialog.tsx"],"sourcesContent":["import { useEffect, useState } from \"react\";\nimport {\n Link,\n Mail,\n Calendar,\n Download,\n Lock,\n Copy,\n Check,\n Loader2,\n ShieldAlert,\n} from \"lucide-react\";\nimport {\n useI18n,\n type I18nContextValue,\n} from \"@burdenoff/fe-libs/shared/providers/shell/I18nProvider\";\nimport {\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n ResponsiveDialogDescription,\n ResponsiveDialogFooter,\n OptionalFields,\n Button,\n ThemedSelect,\n} from \"@burdenoff/fe-libs/ui\";\nimport type { FileItem, FolderItem } from \"../types\";\nimport { tWithFallback } from \"../utils/i18n\";\nimport {\n DEFAULT_SHARE_FORM_VALUES,\n type ShareDialogInput,\n type ShareFormValues,\n buildShareInput,\n} from \"../utils/shareForm\";\n\nexport type { ShareDialogInput } from \"../utils/shareForm\";\nimport { useShareDialogPermission } from \"../hooks/useShareDialogPermission\";\nimport {\n classifyShareRefusal,\n shareDenialCopy,\n sharePermissionMessages,\n type ShareDenialCause,\n type ShareRefusalSource,\n} from \"../utils/sharePermission\";\n\ntype CreateShare = (\n input: ShareDialogInput,\n) => Promise<{ publicUrl: string; token: string }>;\n\ntype Translate = I18nContextValue[\"t\"];\n\ninterface ShareDialogProps {\n item: FileItem | FolderItem;\n itemType: \"file\" | \"folder\";\n onClose: () => void;\n onCreateShare: CreateShare;\n isLoading?: boolean;\n /**\n * A denial the caller recorded recently (within its TTL). The dialog shows\n * the denied state at once instead of a spinner, and still re-checks: if the\n * re-check allows sharing, the form replaces the denial.\n */\n knownPermission?: \"denied\";\n /**\n * Navigation v2 (BOFF-11865), FluidGrids only: state the reach of a link\n * under the title before it is created, and fold Maximum downloads and\n * Password protection into the shared, remembered \"More options\".\n */\n navigationV2?: boolean;\n}\n\n/** A share the dialog created, shown in the success panel. */\ninterface CreatedShare {\n shareType: ShareDialogInput[\"shareType\"];\n shareUrl: string;\n invitedEmail: string;\n}\n\nexport function ShareDialog({\n item,\n itemType,\n onClose,\n onCreateShare,\n isLoading,\n knownPermission,\n navigationV2 = false,\n}: ShareDialogProps) {\n const { t } = useI18n();\n const [created, setCreated] = useState<CreatedShare | null>(null);\n const { permission, denialCause, recordRefusal } = useShareDialogPermission({\n item,\n itemType,\n knownPermission,\n });\n const itemTypeLabel = tWithFallback(\n t,\n itemType === \"folder\"\n ? \"files.shareDialog.itemType.folder\"\n : \"files.shareDialog.itemType.file\",\n itemType === \"folder\" ? \"folder\" : \"file\",\n );\n\n return (\n <ResponsiveDialog\n open\n onOpenChange={(next: boolean) => {\n if (!next) onClose();\n }}\n >\n <ResponsiveDialogContent>\n <ResponsiveDialogHeader>\n <ResponsiveDialogTitle>\n {tWithFallback(\n t,\n \"files.shareDialog.title\",\n 'Share {{itemType}} \"{{name}}\"',\n { itemType: itemTypeLabel, name: item.name },\n )}\n </ResponsiveDialogTitle>\n {navigationV2 && created === null && (\n <ResponsiveDialogDescription>\n {tWithFallback(\n t,\n \"files.shareDialog.reach\",\n \"Anyone with the link can view and download until it expires.\",\n )}\n </ResponsiveDialogDescription>\n )}\n </ResponsiveDialogHeader>\n\n <ShareDialogBody\n item={item}\n itemType={itemType}\n itemTypeLabel={itemTypeLabel}\n permission={permission}\n denialCause={denialCause}\n created={created}\n isLoading={isLoading}\n onClose={onClose}\n onCreateShare={onCreateShare}\n onCreated={setCreated}\n onRefused={recordRefusal}\n navigationV2={navigationV2}\n />\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n );\n}\n\ninterface ShareDialogBodyProps {\n item: FileItem | FolderItem;\n itemType: \"file\" | \"folder\";\n itemTypeLabel: string;\n permission: ReturnType<typeof useShareDialogPermission>[\"permission\"];\n denialCause: ShareDenialCause | null;\n created: CreatedShare | null;\n isLoading?: boolean;\n onClose: () => void;\n onCreateShare: CreateShare;\n onCreated: (created: CreatedShare) => void;\n onRefused: (source: ShareRefusalSource) => void;\n navigationV2: boolean;\n}\n\n/** Picks the dialog body: denial, permission check, share form or result. */\nfunction ShareDialogBody({\n item,\n itemType,\n itemTypeLabel,\n permission,\n denialCause,\n created,\n isLoading,\n onClose,\n onCreateShare,\n onCreated,\n onRefused,\n navigationV2,\n}: ShareDialogBodyProps) {\n if (denialCause !== null) {\n return (\n <ShareDeniedPanel\n cause={denialCause}\n itemTypeLabel={itemTypeLabel}\n onClose={onClose}\n />\n );\n }\n if (permission === \"checking\") {\n return <ShareCheckingPanel onClose={onClose} />;\n }\n if (created === null) {\n return (\n <ShareForm\n item={item}\n itemType={itemType}\n isLoading={isLoading}\n onClose={onClose}\n onCreateShare={onCreateShare}\n onCreated={onCreated}\n onRefused={onRefused}\n navigationV2={navigationV2}\n />\n );\n }\n return <ShareSuccessPanel created={created} onClose={onClose} />;\n}\n\nfunction ShareDeniedPanel({\n cause,\n itemTypeLabel,\n onClose,\n}: {\n cause: ShareDenialCause;\n itemTypeLabel: string;\n onClose: () => void;\n}) {\n const { t } = useI18n();\n const copy = shareDenialCopy(t, cause, itemTypeLabel);\n return (\n <>\n <div\n role=\"alert\"\n className=\"flex items-start gap-3 rounded-lg border border-status-warning-border bg-status-warning-bg-subtle px-4 py-3\"\n >\n <ShieldAlert className=\"mt-0.5 size-5 flex-shrink-0 text-status-warning-text\" />\n <div className=\"space-y-1\">\n <p className=\"text-sm font-medium text-text-primary\">{copy.title}</p>\n <p className=\"text-sm text-text-secondary\">{copy.description}</p>\n </div>\n </div>\n <ResponsiveDialogFooter>\n <Button type=\"button\" onClick={onClose}>\n {tWithFallback(t, \"files.common.actions.close\", \"Close\")}\n </Button>\n </ResponsiveDialogFooter>\n </>\n );\n}\n\nfunction ShareCheckingPanel({ onClose }: { onClose: () => void }) {\n const { t } = useI18n();\n return (\n <>\n <div\n role=\"status\"\n aria-live=\"polite\"\n className=\"flex items-center gap-3 py-6 text-sm text-text-secondary\"\n >\n <Loader2 className=\"size-4 animate-spin\" />\n {sharePermissionMessages(t).checking}\n </div>\n <ResponsiveDialogFooter>\n <Button type=\"button\" variant=\"outline\" onClick={onClose}>\n {tWithFallback(t, \"files.common.actions.cancel\", \"Cancel\")}\n </Button>\n </ResponsiveDialogFooter>\n </>\n );\n}\n\ninterface ShareFormProps {\n item: FileItem | FolderItem;\n itemType: \"file\" | \"folder\";\n isLoading?: boolean;\n onClose: () => void;\n onCreateShare: CreateShare;\n onCreated: (created: CreatedShare) => void;\n onRefused: (source: ShareRefusalSource) => void;\n navigationV2: boolean;\n}\n\nfunction shareErrorMessage(t: Translate, error: unknown): string {\n return error instanceof Error\n ? error.message\n : tWithFallback(\n t,\n \"files.shareDialog.errors.createFailed\",\n \"Failed to create share\",\n );\n}\n\nfunction ShareForm({\n item,\n itemType,\n isLoading,\n onClose,\n onCreateShare,\n onCreated,\n onRefused,\n navigationV2,\n}: ShareFormProps) {\n const { t } = useI18n();\n const [values, setValues] = useState<ShareFormValues>(\n DEFAULT_SHARE_FORM_VALUES,\n );\n const [errorMessage, setErrorMessage] = useState<string | null>(null);\n const update = (patch: Partial<ShareFormValues>) =>\n setValues((current) => ({ ...current, ...patch }));\n\n const handleCreateShare = async () => {\n setErrorMessage(null);\n const shareInput = buildShareInput(item.id, itemType, values);\n try {\n const result = await onCreateShare(shareInput);\n onCreated({\n shareType: shareInput.shareType,\n shareUrl: result.publicUrl || \"\",\n invitedEmail: values.invitedEmail,\n });\n } catch (error) {\n const source = classifyShareRefusal(error);\n if (source !== null) {\n onRefused(source);\n return;\n }\n setErrorMessage(shareErrorMessage(t, error));\n }\n };\n\n return (\n <>\n {errorMessage && (\n <div 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\">\n {errorMessage}\n </div>\n )}\n\n <div className=\"space-y-4\">\n <ShareExpiryField\n value={values.expiryDays}\n onChange={(expiryDays) => update({ expiryDays })}\n />\n <ShareInviteField\n value={values.invitedEmail}\n onChange={(invitedEmail) => update({ invitedEmail })}\n />\n <ShareAdvancedFields\n values={values}\n onChange={update}\n navigationV2={navigationV2}\n />\n </div>\n\n <ResponsiveDialogFooter>\n <Button type=\"button\" variant=\"outline\" onClick={onClose}>\n {tWithFallback(t, \"files.common.actions.cancel\", \"Cancel\")}\n </Button>\n <Button\n type=\"button\"\n onClick={handleCreateShare}\n disabled={isLoading || (values.hasPassword && !values.password)}\n >\n <ShareSubmitLabel isLoading={isLoading} />\n </Button>\n </ResponsiveDialogFooter>\n </>\n );\n}\n\nfunction ShareSubmitLabel({ isLoading }: { isLoading?: boolean }) {\n const { t } = useI18n();\n if (isLoading) {\n return (\n <>\n <Loader2 className=\"size-4 animate-spin\" />\n {tWithFallback(t, \"files.shareDialog.actions.creating\", \"Creating...\")}\n </>\n );\n }\n return (\n <>\n <Link className=\"size-4\" />\n {tWithFallback(\n t,\n \"files.shareDialog.actions.createLink\",\n \"Create share link\",\n )}\n </>\n );\n}\n\nconst EXPIRY_OPTIONS: ReadonlyArray<{\n days: number;\n key: string;\n fallback: string;\n}> = [\n { days: 0, key: \"files.shareDialog.expiry.options.never\", fallback: \"Never\" },\n {\n days: 1,\n key: \"files.shareDialog.expiry.options.oneDay\",\n fallback: \"1 day\",\n },\n {\n days: 7,\n key: \"files.shareDialog.expiry.options.sevenDays\",\n fallback: \"7 days\",\n },\n {\n days: 30,\n key: \"files.shareDialog.expiry.options.thirtyDays\",\n fallback: \"30 days\",\n },\n {\n days: 90,\n key: \"files.shareDialog.expiry.options.ninetyDays\",\n fallback: \"90 days\",\n },\n];\n\n/** Expiry: smart-default field, visible above the fold. */\nfunction ShareExpiryField({\n value,\n onChange,\n}: {\n value: number;\n onChange: (days: number) => void;\n}) {\n const { t } = useI18n();\n const label = tWithFallback(\n t,\n \"files.shareDialog.expiry.label\",\n \"Link expires in\",\n );\n return (\n <div>\n <label\n htmlFor=\"share-dialog-expiry-select\"\n className=\"flex items-center gap-2 text-sm font-medium text-text-primary mb-2\"\n >\n <Calendar className=\"size-4\" />\n {label}\n </label>\n <ThemedSelect\n id=\"share-dialog-expiry-select\"\n aria-label={label}\n value={value}\n onChange={(e) => onChange(Number(e.target.value))}\n 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\"\n >\n {EXPIRY_OPTIONS.map((option) => (\n <option key={option.days} value={option.days}>\n {tWithFallback(t, option.key, option.fallback)}\n </option>\n ))}\n </ThemedSelect>\n </div>\n );\n}\n\n/** Invited email: smart-default; leave empty for a public link. */\nfunction ShareInviteField({\n value,\n onChange,\n}: {\n value: string;\n onChange: (email: string) => void;\n}) {\n const { t } = useI18n();\n const label = tWithFallback(\n t,\n \"files.shareDialog.invite.label\",\n \"Invite specific person (optional)\",\n );\n return (\n <div>\n <label\n htmlFor=\"share-dialog-invite-email\"\n className=\"flex items-center gap-2 text-sm font-medium text-text-primary mb-2\"\n >\n <Mail className=\"size-4\" />\n {label}\n </label>\n <input\n id=\"share-dialog-invite-email\"\n type=\"email\"\n value={value}\n onChange={(e) => onChange(e.target.value)}\n aria-label={label}\n placeholder=\"user@example.com\"\n 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\"\n />\n <p className=\"mt-1 text-xs text-text-secondary\">\n {tWithFallback(\n t,\n \"files.shareDialog.invite.help\",\n \"Leave empty for public link\",\n )}\n </p>\n </div>\n );\n}\n\n/**\n * Download limits and password protection. Navigation v2 uses the shared\n * \"More options\" fold (BOFF-11841): closed on a first visit, remembered per\n * profile, fields kept mounted so they still submit while it reads closed.\n * Every other app keeps the \"Advanced\" accordion.\n */\nfunction ShareAdvancedFields({\n values,\n onChange,\n navigationV2,\n}: {\n values: ShareFormValues;\n onChange: (patch: Partial<ShareFormValues>) => void;\n navigationV2: boolean;\n}) {\n const { t } = useI18n();\n const downloadsLabel = tWithFallback(\n t,\n \"files.shareDialog.downloads.label\",\n \"Maximum downloads\",\n );\n return (\n <OptionalFields\n // With a storageKey the trigger reads the shared \"More options\" label,\n // so the \"Advanced\" title is only passed to the old accordion.\n storageKey={navigationV2 ? \"files.shareDialog\" : undefined}\n title={\n navigationV2\n ? undefined\n : tWithFallback(t, \"files.shareDialog.advanced.title\", \"Advanced\")\n }\n description={tWithFallback(\n t,\n \"files.shareDialog.advanced.description\",\n \"Download limits and password protection\",\n )}\n >\n <div className=\"space-y-4\">\n <div>\n <label\n htmlFor=\"share-dialog-max-downloads\"\n className=\"flex items-center gap-2 text-sm font-medium text-text-primary mb-2\"\n >\n <Download className=\"size-4\" />\n {downloadsLabel}\n </label>\n <input\n id=\"share-dialog-max-downloads\"\n type=\"number\"\n min=\"0\"\n value={values.maxDownloads}\n onChange={(e) => {\n // An empty or partial entry (NaN) means \"unlimited\" (0).\n const { valueAsNumber } = e.target;\n onChange({\n maxDownloads: Number.isNaN(valueAsNumber) ? 0 : valueAsNumber,\n });\n }}\n aria-label={downloadsLabel}\n placeholder={tWithFallback(\n t,\n \"files.shareDialog.downloads.placeholder\",\n \"Unlimited\",\n )}\n 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\"\n />\n </div>\n\n <SharePasswordField values={values} onChange={onChange} />\n </div>\n </OptionalFields>\n );\n}\n\nfunction SharePasswordField({\n values,\n onChange,\n}: {\n values: ShareFormValues;\n onChange: (patch: Partial<ShareFormValues>) => void;\n}) {\n const { t } = useI18n();\n const label = tWithFallback(\n t,\n \"files.shareDialog.password.label\",\n \"Password protection\",\n );\n const requireLabel = tWithFallback(\n t,\n \"files.shareDialog.password.require\",\n \"Require password\",\n );\n return (\n <div>\n <label\n htmlFor=\"share-dialog-password-required\"\n className=\"flex items-center gap-2 text-sm font-medium text-text-primary mb-2\"\n >\n <Lock className=\"size-4\" />\n {label}\n </label>\n <div className=\"flex items-center gap-2\">\n <input\n id=\"share-dialog-password-required\"\n type=\"checkbox\"\n checked={values.hasPassword}\n onChange={(e) => onChange({ hasPassword: e.target.checked })}\n aria-label={requireLabel}\n className=\"rounded transition-colors duration-200\"\n />\n <span className=\"text-sm text-text-secondary\">{requireLabel}</span>\n </div>\n {values.hasPassword && (\n <>\n <input\n type=\"password\"\n value={values.password}\n onChange={(e) => onChange({ password: e.target.value })}\n aria-label={label}\n placeholder={tWithFallback(\n t,\n \"files.shareDialog.password.placeholder\",\n \"Enter password\",\n )}\n className=\"w-full min-h-11 mt-2 px-3 py-2 border border-border-default rounded-lg focus:outline-none focus:border-action-primary-border text-sm transition-colors duration-200\"\n />\n <p className=\"mt-1 text-xs text-text-tertiary\">\n {tWithFallback(\n t,\n \"files.shareDialog.password.help\",\n \"Password must be at least 8 characters and contain uppercase, lowercase, and number\",\n )}\n </p>\n </>\n )}\n </div>\n );\n}\n\nfunction ShareSuccessPanel({\n created,\n onClose,\n}: {\n created: CreatedShare;\n onClose: () => void;\n}) {\n const { t } = useI18n();\n return (\n <div className=\"space-y-4\">\n <div className=\"bg-status-success-bg-subtle border border-status-success-border rounded-lg p-4\">\n {created.shareType === \"EMAIL_INVITE\" ? (\n <>\n <p className=\"text-sm font-medium text-status-success-text mb-2\">\n {tWithFallback(\n t,\n \"files.shareDialog.success.invitationSent\",\n \"Invitation sent successfully!\",\n )}\n </p>\n <p className=\"text-sm text-text-secondary\">\n {tWithFallback(\n t,\n \"files.shareDialog.success.invitationSentTo\",\n \"An invitation has been sent to {{email}}\",\n { email: created.invitedEmail },\n )}\n </p>\n </>\n ) : (\n <ShareLinkResult shareUrl={created.shareUrl} />\n )}\n </div>\n\n <ResponsiveDialogFooter>\n <Button type=\"button\" onClick={onClose} className=\"w-full\">\n {tWithFallback(t, \"files.common.actions.done\", \"Done\")}\n </Button>\n </ResponsiveDialogFooter>\n </div>\n );\n}\n\nfunction ShareLinkResult({ shareUrl }: { shareUrl: string }) {\n const { t } = useI18n();\n const [copied, setCopied] = useState(false);\n\n const handleCopyLink = async () => {\n if (shareUrl) {\n await navigator.clipboard.writeText(shareUrl);\n setCopied(true);\n }\n };\n\n useEffect(() => {\n if (copied) {\n const timer = setTimeout(() => setCopied(false), 2000);\n return () => clearTimeout(timer);\n }\n return undefined;\n }, [copied]);\n\n return (\n <>\n <p className=\"text-sm font-medium text-status-success-text mb-2\">\n {tWithFallback(\n t,\n \"files.shareDialog.success.linkCreated\",\n \"Share link created successfully!\",\n )}\n </p>\n <div className=\"flex flex-col sm:flex-row items-stretch sm:items-center gap-2\">\n <input\n type=\"text\"\n value={shareUrl}\n readOnly\n aria-label={tWithFallback(\n t,\n \"files.shareDialog.success.linkCreated\",\n \"Share link\",\n )}\n className=\"flex-1 min-h-11 px-3 py-2 bg-bg-surface border border-status-success-border rounded-lg text-sm\"\n />\n <Button type=\"button\" onClick={handleCopyLink}>\n {copied ? (\n <>\n <Check className=\"size-4\" />\n {tWithFallback(t, \"files.shareDialog.actions.copied\", \"Copied!\")}\n </>\n ) : (\n <>\n <Copy className=\"size-4\" />\n {tWithFallback(t, \"files.common.actions.copy\", \"Copy\")}\n </>\n )}\n </Button>\n </div>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;AA+EA,SAAgBC,EAAY,EAC1B,SACA,aACA,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,CAAA;EAEE,CAAA,CACL;CACL,CAAA,CAAA,EAAA,CAAA;AAEN"}
1
+ {"version":3,"file":"ShareDialog.js","names":["_Fragment","ShareDialog","useI18n","created","setCreated","useState","useShareDialogPermission","itemTypeLabel","tWithFallback","t","itemType","ResponsiveDialog","next","onClose","ResponsiveDialogContent","ResponsiveDialogHeader","ResponsiveDialogTitle","item","navigationV2","ResponsiveDialogDescription","ShareDialogBody","recordRefusal","denialCause","permission","ShareCheckingPanel","ShareForm","ShareSuccessPanel","ShareDeniedPanel","copy","shareDenialCopy","cause","Fragment","ShieldAlert","ResponsiveDialogFooter","Button","SpinnerIcon","sharePermissionMessages","shareErrorMessage","error","values","setValues","DEFAULT_SHARE_FORM_VALUES","errorMessage","setErrorMessage","update","current","patch","ShareExpiryField","ShareInviteField","ShareAdvancedFields","shareInput","buildShareInput","result","onCreateShare","source","classifyShareRefusal","isLoading","ShareSubmitLabel","Link","EXPIRY_OPTIONS","label","Calendar","ThemedSelect","onChange","option","Mail","downloadsLabel","OptionalFields","Download","valueAsNumber","SharePasswordField","requireLabel","Lock","ShareLinkResult","copied","setCopied","useEffect","timer","shareUrl","Check","Copy"],"sources":["../../../src/files/components/ShareDialog.tsx"],"sourcesContent":["import { useEffect, useState } from \"react\";\nimport {\n Link,\n Mail,\n Calendar,\n Download,\n Lock,\n Copy,\n Check,\n ShieldAlert,\n} from \"lucide-react\";\nimport {\n useI18n,\n type I18nContextValue,\n} from \"@burdenoff/fe-libs/shared/providers/shell/I18nProvider\";\nimport {\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n ResponsiveDialogDescription,\n ResponsiveDialogFooter,\n OptionalFields,\n Button,\n ThemedSelect,\n} from \"@burdenoff/fe-libs/ui\";\nimport type { FileItem, FolderItem } from \"../types\";\nimport { tWithFallback } from \"../utils/i18n\";\nimport {\n DEFAULT_SHARE_FORM_VALUES,\n type ShareDialogInput,\n type ShareFormValues,\n buildShareInput,\n} from \"../utils/shareForm\";\n\nexport type { ShareDialogInput } from \"../utils/shareForm\";\nimport { useShareDialogPermission } from \"../hooks/useShareDialogPermission\";\nimport {\n classifyShareRefusal,\n shareDenialCopy,\n sharePermissionMessages,\n type ShareDenialCause,\n type ShareRefusalSource,\n} from \"../utils/sharePermission\";\nimport { SpinnerIcon } from \"./loadingSystem\";\n\ntype CreateShare = (\n input: ShareDialogInput,\n) => Promise<{ publicUrl: string; token: string }>;\n\ntype Translate = I18nContextValue[\"t\"];\n\ninterface ShareDialogProps {\n item: FileItem | FolderItem;\n itemType: \"file\" | \"folder\";\n onClose: () => void;\n onCreateShare: CreateShare;\n isLoading?: boolean;\n /**\n * A denial the caller recorded recently (within its TTL). The dialog shows\n * the denied state at once instead of a spinner, and still re-checks: if the\n * re-check allows sharing, the form replaces the denial.\n */\n knownPermission?: \"denied\";\n /**\n * Navigation v2 (BOFF-11865), FluidGrids only: state the reach of a link\n * under the title before it is created, and fold Maximum downloads and\n * Password protection into the shared, remembered \"More options\".\n */\n navigationV2?: boolean;\n}\n\n/** A share the dialog created, shown in the success panel. */\ninterface CreatedShare {\n shareType: ShareDialogInput[\"shareType\"];\n shareUrl: string;\n invitedEmail: string;\n}\n\nexport function ShareDialog({\n item,\n itemType,\n onClose,\n onCreateShare,\n isLoading,\n knownPermission,\n navigationV2 = false,\n}: ShareDialogProps) {\n const { t } = useI18n();\n const [created, setCreated] = useState<CreatedShare | null>(null);\n const { permission, denialCause, recordRefusal } = useShareDialogPermission({\n item,\n itemType,\n knownPermission,\n });\n const itemTypeLabel = tWithFallback(\n t,\n itemType === \"folder\"\n ? \"files.shareDialog.itemType.folder\"\n : \"files.shareDialog.itemType.file\",\n itemType === \"folder\" ? \"folder\" : \"file\",\n );\n\n return (\n <ResponsiveDialog\n open\n onOpenChange={(next: boolean) => {\n if (!next) onClose();\n }}\n >\n <ResponsiveDialogContent>\n <ResponsiveDialogHeader>\n <ResponsiveDialogTitle>\n {tWithFallback(\n t,\n \"files.shareDialog.title\",\n 'Share {{itemType}} \"{{name}}\"',\n { itemType: itemTypeLabel, name: item.name },\n )}\n </ResponsiveDialogTitle>\n {navigationV2 && created === null && (\n <ResponsiveDialogDescription>\n {tWithFallback(\n t,\n \"files.shareDialog.reach\",\n \"Anyone with the link can view and download until it expires.\",\n )}\n </ResponsiveDialogDescription>\n )}\n </ResponsiveDialogHeader>\n\n <ShareDialogBody\n item={item}\n itemType={itemType}\n itemTypeLabel={itemTypeLabel}\n permission={permission}\n denialCause={denialCause}\n created={created}\n isLoading={isLoading}\n onClose={onClose}\n onCreateShare={onCreateShare}\n onCreated={setCreated}\n onRefused={recordRefusal}\n navigationV2={navigationV2}\n />\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n );\n}\n\ninterface ShareDialogBodyProps {\n item: FileItem | FolderItem;\n itemType: \"file\" | \"folder\";\n itemTypeLabel: string;\n permission: ReturnType<typeof useShareDialogPermission>[\"permission\"];\n denialCause: ShareDenialCause | null;\n created: CreatedShare | null;\n isLoading?: boolean;\n onClose: () => void;\n onCreateShare: CreateShare;\n onCreated: (created: CreatedShare) => void;\n onRefused: (source: ShareRefusalSource) => void;\n navigationV2: boolean;\n}\n\n/** Picks the dialog body: denial, permission check, share form or result. */\nfunction ShareDialogBody({\n item,\n itemType,\n itemTypeLabel,\n permission,\n denialCause,\n created,\n isLoading,\n onClose,\n onCreateShare,\n onCreated,\n onRefused,\n navigationV2,\n}: ShareDialogBodyProps) {\n if (denialCause !== null) {\n return (\n <ShareDeniedPanel\n cause={denialCause}\n itemTypeLabel={itemTypeLabel}\n onClose={onClose}\n />\n );\n }\n if (permission === \"checking\") {\n return <ShareCheckingPanel onClose={onClose} />;\n }\n if (created === null) {\n return (\n <ShareForm\n item={item}\n itemType={itemType}\n isLoading={isLoading}\n onClose={onClose}\n onCreateShare={onCreateShare}\n onCreated={onCreated}\n onRefused={onRefused}\n navigationV2={navigationV2}\n />\n );\n }\n return <ShareSuccessPanel created={created} onClose={onClose} />;\n}\n\nfunction ShareDeniedPanel({\n cause,\n itemTypeLabel,\n onClose,\n}: {\n cause: ShareDenialCause;\n itemTypeLabel: string;\n onClose: () => void;\n}) {\n const { t } = useI18n();\n const copy = shareDenialCopy(t, cause, itemTypeLabel);\n return (\n <>\n <div\n role=\"alert\"\n className=\"flex items-start gap-3 rounded-lg border border-status-warning-border bg-status-warning-bg-subtle px-4 py-3\"\n >\n <ShieldAlert className=\"mt-0.5 size-5 flex-shrink-0 text-status-warning-text\" />\n <div className=\"space-y-1\">\n <p className=\"text-sm font-medium text-text-primary\">{copy.title}</p>\n <p className=\"text-sm text-text-secondary\">{copy.description}</p>\n </div>\n </div>\n <ResponsiveDialogFooter>\n <Button type=\"button\" onClick={onClose}>\n {tWithFallback(t, \"files.common.actions.close\", \"Close\")}\n </Button>\n </ResponsiveDialogFooter>\n </>\n );\n}\n\nfunction ShareCheckingPanel({ onClose }: { onClose: () => void }) {\n const { t } = useI18n();\n return (\n <>\n <div\n role=\"status\"\n aria-live=\"polite\"\n className=\"flex items-center gap-3 py-6 text-sm text-text-secondary\"\n >\n <SpinnerIcon className=\"size-4 animate-spin\" />\n {sharePermissionMessages(t).checking}\n </div>\n <ResponsiveDialogFooter>\n <Button type=\"button\" variant=\"outline\" onClick={onClose}>\n {tWithFallback(t, \"files.common.actions.cancel\", \"Cancel\")}\n </Button>\n </ResponsiveDialogFooter>\n </>\n );\n}\n\ninterface ShareFormProps {\n item: FileItem | FolderItem;\n itemType: \"file\" | \"folder\";\n isLoading?: boolean;\n onClose: () => void;\n onCreateShare: CreateShare;\n onCreated: (created: CreatedShare) => void;\n onRefused: (source: ShareRefusalSource) => void;\n navigationV2: boolean;\n}\n\nfunction shareErrorMessage(t: Translate, error: unknown): string {\n return error instanceof Error\n ? error.message\n : tWithFallback(\n t,\n \"files.shareDialog.errors.createFailed\",\n \"Failed to create share\",\n );\n}\n\nfunction ShareForm({\n item,\n itemType,\n isLoading,\n onClose,\n onCreateShare,\n onCreated,\n onRefused,\n navigationV2,\n}: ShareFormProps) {\n const { t } = useI18n();\n const [values, setValues] = useState<ShareFormValues>(\n DEFAULT_SHARE_FORM_VALUES,\n );\n const [errorMessage, setErrorMessage] = useState<string | null>(null);\n const update = (patch: Partial<ShareFormValues>) =>\n setValues((current) => ({ ...current, ...patch }));\n\n const handleCreateShare = async () => {\n setErrorMessage(null);\n const shareInput = buildShareInput(item.id, itemType, values);\n try {\n const result = await onCreateShare(shareInput);\n onCreated({\n shareType: shareInput.shareType,\n shareUrl: result.publicUrl || \"\",\n invitedEmail: values.invitedEmail,\n });\n } catch (error) {\n const source = classifyShareRefusal(error);\n if (source !== null) {\n onRefused(source);\n return;\n }\n setErrorMessage(shareErrorMessage(t, error));\n }\n };\n\n return (\n <>\n {errorMessage && (\n <div 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\">\n {errorMessage}\n </div>\n )}\n\n <div className=\"space-y-4\">\n <ShareExpiryField\n value={values.expiryDays}\n onChange={(expiryDays) => update({ expiryDays })}\n />\n <ShareInviteField\n value={values.invitedEmail}\n onChange={(invitedEmail) => update({ invitedEmail })}\n />\n <ShareAdvancedFields\n values={values}\n onChange={update}\n navigationV2={navigationV2}\n />\n </div>\n\n <ResponsiveDialogFooter>\n <Button type=\"button\" variant=\"outline\" onClick={onClose}>\n {tWithFallback(t, \"files.common.actions.cancel\", \"Cancel\")}\n </Button>\n <Button\n type=\"button\"\n onClick={handleCreateShare}\n disabled={isLoading || (values.hasPassword && !values.password)}\n >\n <ShareSubmitLabel isLoading={isLoading} />\n </Button>\n </ResponsiveDialogFooter>\n </>\n );\n}\n\nfunction ShareSubmitLabel({ isLoading }: { isLoading?: boolean }) {\n const { t } = useI18n();\n if (isLoading) {\n return (\n <>\n <SpinnerIcon className=\"size-4 animate-spin\" />\n {tWithFallback(t, \"files.shareDialog.actions.creating\", \"Creating...\")}\n </>\n );\n }\n return (\n <>\n <Link className=\"size-4\" />\n {tWithFallback(\n t,\n \"files.shareDialog.actions.createLink\",\n \"Create share link\",\n )}\n </>\n );\n}\n\nconst EXPIRY_OPTIONS: ReadonlyArray<{\n days: number;\n key: string;\n fallback: string;\n}> = [\n { days: 0, key: \"files.shareDialog.expiry.options.never\", fallback: \"Never\" },\n {\n days: 1,\n key: \"files.shareDialog.expiry.options.oneDay\",\n fallback: \"1 day\",\n },\n {\n days: 7,\n key: \"files.shareDialog.expiry.options.sevenDays\",\n fallback: \"7 days\",\n },\n {\n days: 30,\n key: \"files.shareDialog.expiry.options.thirtyDays\",\n fallback: \"30 days\",\n },\n {\n days: 90,\n key: \"files.shareDialog.expiry.options.ninetyDays\",\n fallback: \"90 days\",\n },\n];\n\n/** Expiry: smart-default field, visible above the fold. */\nfunction ShareExpiryField({\n value,\n onChange,\n}: {\n value: number;\n onChange: (days: number) => void;\n}) {\n const { t } = useI18n();\n const label = tWithFallback(\n t,\n \"files.shareDialog.expiry.label\",\n \"Link expires in\",\n );\n return (\n <div>\n <label\n htmlFor=\"share-dialog-expiry-select\"\n className=\"flex items-center gap-2 text-sm font-medium text-text-primary mb-2\"\n >\n <Calendar className=\"size-4\" />\n {label}\n </label>\n <ThemedSelect\n id=\"share-dialog-expiry-select\"\n aria-label={label}\n value={value}\n onChange={(e) => onChange(Number(e.target.value))}\n 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\"\n >\n {EXPIRY_OPTIONS.map((option) => (\n <option key={option.days} value={option.days}>\n {tWithFallback(t, option.key, option.fallback)}\n </option>\n ))}\n </ThemedSelect>\n </div>\n );\n}\n\n/** Invited email: smart-default; leave empty for a public link. */\nfunction ShareInviteField({\n value,\n onChange,\n}: {\n value: string;\n onChange: (email: string) => void;\n}) {\n const { t } = useI18n();\n const label = tWithFallback(\n t,\n \"files.shareDialog.invite.label\",\n \"Invite specific person (optional)\",\n );\n return (\n <div>\n <label\n htmlFor=\"share-dialog-invite-email\"\n className=\"flex items-center gap-2 text-sm font-medium text-text-primary mb-2\"\n >\n <Mail className=\"size-4\" />\n {label}\n </label>\n <input\n id=\"share-dialog-invite-email\"\n type=\"email\"\n value={value}\n onChange={(e) => onChange(e.target.value)}\n aria-label={label}\n placeholder=\"user@example.com\"\n 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\"\n />\n <p className=\"mt-1 text-xs text-text-secondary\">\n {tWithFallback(\n t,\n \"files.shareDialog.invite.help\",\n \"Leave empty for public link\",\n )}\n </p>\n </div>\n );\n}\n\n/**\n * Download limits and password protection. Navigation v2 uses the shared\n * \"More options\" fold (BOFF-11841): closed on a first visit, remembered per\n * profile, fields kept mounted so they still submit while it reads closed.\n * Every other app keeps the \"Advanced\" accordion.\n */\nfunction ShareAdvancedFields({\n values,\n onChange,\n navigationV2,\n}: {\n values: ShareFormValues;\n onChange: (patch: Partial<ShareFormValues>) => void;\n navigationV2: boolean;\n}) {\n const { t } = useI18n();\n const downloadsLabel = tWithFallback(\n t,\n \"files.shareDialog.downloads.label\",\n \"Maximum downloads\",\n );\n return (\n <OptionalFields\n // With a storageKey the trigger reads the shared \"More options\" label,\n // so the \"Advanced\" title is only passed to the old accordion.\n storageKey={navigationV2 ? \"files.shareDialog\" : undefined}\n title={\n navigationV2\n ? undefined\n : tWithFallback(t, \"files.shareDialog.advanced.title\", \"Advanced\")\n }\n description={tWithFallback(\n t,\n \"files.shareDialog.advanced.description\",\n \"Download limits and password protection\",\n )}\n >\n <div className=\"space-y-4\">\n <div>\n <label\n htmlFor=\"share-dialog-max-downloads\"\n className=\"flex items-center gap-2 text-sm font-medium text-text-primary mb-2\"\n >\n <Download className=\"size-4\" />\n {downloadsLabel}\n </label>\n <input\n id=\"share-dialog-max-downloads\"\n type=\"number\"\n min=\"0\"\n value={values.maxDownloads}\n onChange={(e) => {\n // An empty or partial entry (NaN) means \"unlimited\" (0).\n const { valueAsNumber } = e.target;\n onChange({\n maxDownloads: Number.isNaN(valueAsNumber) ? 0 : valueAsNumber,\n });\n }}\n aria-label={downloadsLabel}\n placeholder={tWithFallback(\n t,\n \"files.shareDialog.downloads.placeholder\",\n \"Unlimited\",\n )}\n 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\"\n />\n </div>\n\n <SharePasswordField values={values} onChange={onChange} />\n </div>\n </OptionalFields>\n );\n}\n\nfunction SharePasswordField({\n values,\n onChange,\n}: {\n values: ShareFormValues;\n onChange: (patch: Partial<ShareFormValues>) => void;\n}) {\n const { t } = useI18n();\n const label = tWithFallback(\n t,\n \"files.shareDialog.password.label\",\n \"Password protection\",\n );\n const requireLabel = tWithFallback(\n t,\n \"files.shareDialog.password.require\",\n \"Require password\",\n );\n return (\n <div>\n <label\n htmlFor=\"share-dialog-password-required\"\n className=\"flex items-center gap-2 text-sm font-medium text-text-primary mb-2\"\n >\n <Lock className=\"size-4\" />\n {label}\n </label>\n <div className=\"flex items-center gap-2\">\n <input\n id=\"share-dialog-password-required\"\n type=\"checkbox\"\n checked={values.hasPassword}\n onChange={(e) => onChange({ hasPassword: e.target.checked })}\n aria-label={requireLabel}\n className=\"rounded transition-colors duration-200\"\n />\n <span className=\"text-sm text-text-secondary\">{requireLabel}</span>\n </div>\n {values.hasPassword && (\n <>\n <input\n type=\"password\"\n value={values.password}\n onChange={(e) => onChange({ password: e.target.value })}\n aria-label={label}\n placeholder={tWithFallback(\n t,\n \"files.shareDialog.password.placeholder\",\n \"Enter password\",\n )}\n className=\"w-full min-h-11 mt-2 px-3 py-2 border border-border-default rounded-lg focus:outline-none focus:border-action-primary-border text-sm transition-colors duration-200\"\n />\n <p className=\"mt-1 text-xs text-text-tertiary\">\n {tWithFallback(\n t,\n \"files.shareDialog.password.help\",\n \"Password must be at least 8 characters and contain uppercase, lowercase, and number\",\n )}\n </p>\n </>\n )}\n </div>\n );\n}\n\nfunction ShareSuccessPanel({\n created,\n onClose,\n}: {\n created: CreatedShare;\n onClose: () => void;\n}) {\n const { t } = useI18n();\n return (\n <div className=\"space-y-4\">\n <div className=\"bg-status-success-bg-subtle border border-status-success-border rounded-lg p-4\">\n {created.shareType === \"EMAIL_INVITE\" ? (\n <>\n <p className=\"text-sm font-medium text-status-success-text mb-2\">\n {tWithFallback(\n t,\n \"files.shareDialog.success.invitationSent\",\n \"Invitation sent successfully!\",\n )}\n </p>\n <p className=\"text-sm text-text-secondary\">\n {tWithFallback(\n t,\n \"files.shareDialog.success.invitationSentTo\",\n \"An invitation has been sent to {{email}}\",\n { email: created.invitedEmail },\n )}\n </p>\n </>\n ) : (\n <ShareLinkResult shareUrl={created.shareUrl} />\n )}\n </div>\n\n <ResponsiveDialogFooter>\n <Button type=\"button\" onClick={onClose} className=\"w-full\">\n {tWithFallback(t, \"files.common.actions.done\", \"Done\")}\n </Button>\n </ResponsiveDialogFooter>\n </div>\n );\n}\n\nfunction ShareLinkResult({ shareUrl }: { shareUrl: string }) {\n const { t } = useI18n();\n const [copied, setCopied] = useState(false);\n\n const handleCopyLink = async () => {\n if (shareUrl) {\n await navigator.clipboard.writeText(shareUrl);\n setCopied(true);\n }\n };\n\n useEffect(() => {\n if (copied) {\n const timer = setTimeout(() => setCopied(false), 2000);\n return () => clearTimeout(timer);\n }\n return undefined;\n }, [copied]);\n\n return (\n <>\n <p className=\"text-sm font-medium text-status-success-text mb-2\">\n {tWithFallback(\n t,\n \"files.shareDialog.success.linkCreated\",\n \"Share link created successfully!\",\n )}\n </p>\n <div className=\"flex flex-col sm:flex-row items-stretch sm:items-center gap-2\">\n <input\n type=\"text\"\n value={shareUrl}\n readOnly\n aria-label={tWithFallback(\n t,\n \"files.shareDialog.success.linkCreated\",\n \"Share link\",\n )}\n className=\"flex-1 min-h-11 px-3 py-2 bg-bg-surface border border-status-success-border rounded-lg text-sm\"\n />\n <Button type=\"button\" onClick={handleCopyLink}>\n {copied ? (\n <>\n <Check className=\"size-4\" />\n {tWithFallback(t, \"files.shareDialog.actions.copied\", \"Copied!\")}\n </>\n ) : (\n <>\n <Copy className=\"size-4\" />\n {tWithFallback(t, \"files.common.actions.copy\", \"Copy\")}\n </>\n )}\n </Button>\n </div>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;AA+EA,SAAgBC,EAAY,EAC1B,SACA,aACA,YACA,kBACA,cACA,oBACA,kBAAe,MACI;CACnB,IAAM,EAAE,SAAMC,EAAQ,GAChB,CAACC,GAASC,KAAcC,EAA8B,IAAI,GAC1D,EAAE,eAAY,gBAAa,qBAAkBC,EAAyB;EAC1E;EACA;EACA;CACF,CAAC,GACKC,IAAgBC,EACpBC,GACAC,MAAa,WACT,sCACA,mCACJA,MAAa,WAAW,WAAW,MACrC;CAEA,OACE,kBAACC,GAAD;EACE,MAAA;EACA,eAAe,MAAkB;GAC/B,AAAKC,KAAMC,EAAQ;EACrB;EAEA,UAAA,kBAACC,GAAD,EAAA,UAAA,CACE,kBAACC,GAAD,EAAA,UAAA,CACE,kBAACC,GAAD,EAAA,UACGR,EACCC,GACA,2BACA,mCACA;GAAE,UAAUF;GAAe,MAAMU,EAAK;EAAK,CAC7C,EACqB,CAAA,GACtBC,KAAgBf,MAAY,QAC3B,kBAACgB,GAAD,EAAA,UACGX,EACCC,GACA,2BACA,8DACF,EAC2B,CAAA,CAET,EAAA,CAAA,GAExB,kBAACW,GAAD;GACQ;GACI;GACK;GACH;GACC;GACJ;GACE;GACF;GACM;GACf,WAAWhB;GACX,WAAWiB;GACG;EACf,CAAA,CACsB,EAAA,CAAA;CACT,CAAA;AAEtB;AAkBA,SAASD,EAAgB,EACvB,SACA,aACA,kBACA,eACA,gBACA,YACA,cACA,YACA,kBACA,cACA,cACA,mBACuB;CA2BvB,OA1BIE,MAAgB,OAShBC,MAAe,aACV,kBAACC,GAAD,EAA6B,WAAU,CAAA,IAE5CrB,MAAY,OAEZ,kBAACsB,GAAD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,UAAAD,IACC,kBAAA1E,GAAA,EAAA,UAAA,CACE,kBAAC+E,GAAD,EAAO,WAAU,SAAU,CAAA,GAC1BvE,EAAcC,GAAG,oCAAoC,SAAS,CAC/D,EAAA,CAAA,IAEF,kBAAAT,GAAA,EAAA,UAAA,CACE,kBAACgF,GAAD,EAAM,WAAU,SAAU,CAAA,GACzBxE,EAAcC,GAAG,6BAA6B,MAAM,CACrD,EAAA,CAAA;EAEE,CAAA,CACL;CACL,CAAA,CAAA,EAAA,CAAA;AAEN"}
@@ -1,44 +1,46 @@
1
1
  import { tWithFallback as e } from "../utils/i18n.js";
2
2
  import { formatFileSize as t } from "../utils/index.js";
3
- import { Download as n, Eye as r, FileText as i, Folder as a, Loader2 as o } from "lucide-react";
3
+ import { SpinnerIcon as n } from "./loadingSystem.js";
4
+ import { Download as r, Eye as i, FileText as a, Folder as o } from "lucide-react";
4
5
  import { jsx as s, jsxs as c } from "react/jsx-runtime";
5
6
  import { Button as l } from "@burdenoff/fe-libs/ui";
6
7
  import { useI18n as u } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
8
+ import { useLoadingSystem as d } from "@burdenoff/fe-libs/ui/loading/LoadingSystemProvider";
7
9
  // src/files/components/SharedFolderView.tsx
8
- function d({ folderName: d, files: f, truncated: p, busyFileId: m, failedFileId: h, onPreview: g, onDownload: _ }) {
9
- let { t: v } = u();
10
+ function f({ folderName: f, files: p, truncated: m, busyFileId: h, failedFileId: g, onPreview: _, onDownload: v }) {
11
+ let y = d(), { t: b } = u();
10
12
  return /* @__PURE__ */ c("div", {
11
13
  className: "space-y-4",
12
14
  children: [
13
15
  /* @__PURE__ */ c("div", {
14
16
  className: "flex items-center gap-3 rounded-lg border border-border-seam bg-bg-sunken px-4 py-3",
15
- children: [/* @__PURE__ */ s(a, { className: "size-5 shrink-0 text-text-tertiary" }), /* @__PURE__ */ s("p", {
17
+ children: [/* @__PURE__ */ s(o, { className: "size-5 shrink-0 text-text-tertiary" }), /* @__PURE__ */ s("p", {
16
18
  className: "truncate text-sm font-medium text-text-primary",
17
- children: d
19
+ children: f
18
20
  })]
19
21
  }),
20
- f.length === 0 ? /* @__PURE__ */ s("p", {
22
+ p.length === 0 ? /* @__PURE__ */ s("p", {
21
23
  className: "text-sm text-text-secondary",
22
- children: e(v, "files.share.folder.empty", "This folder has no files yet.")
24
+ children: e(b, "files.share.folder.empty", "This folder has no files yet.")
23
25
  }) : /* @__PURE__ */ s("ul", {
24
26
  className: "divide-y divide-border-seam rounded-lg border border-border-seam",
25
- "aria-label": e(v, "files.share.folder.listLabel", "Files in this folder"),
26
- children: f.map((a) => {
27
- let u = m === a.id;
27
+ "aria-label": e(b, "files.share.folder.listLabel", "Files in this folder"),
28
+ children: p.map((o) => {
29
+ let u = h === o.id;
28
30
  return /* @__PURE__ */ c("li", {
29
31
  className: "px-3 py-2",
30
32
  children: [/* @__PURE__ */ c("div", {
31
33
  className: "flex items-center gap-3",
32
34
  children: [
33
- /* @__PURE__ */ s(i, { className: "size-4 shrink-0 text-text-tertiary" }),
35
+ /* @__PURE__ */ s(a, { className: "size-4 shrink-0 text-text-tertiary" }),
34
36
  /* @__PURE__ */ c("div", {
35
37
  className: "min-w-0 flex-1",
36
38
  children: [/* @__PURE__ */ s("p", {
37
39
  className: "truncate text-sm font-medium text-text-primary",
38
- children: a.name
40
+ children: o.name
39
41
  }), /* @__PURE__ */ s("p", {
40
42
  className: "text-xs text-text-secondary",
41
- children: t(Number(a.size))
43
+ children: t(Number(o.size))
42
44
  })]
43
45
  }),
44
46
  /* @__PURE__ */ s(l, {
@@ -46,35 +48,36 @@ function d({ folderName: d, files: f, truncated: p, busyFileId: m, failedFileId:
46
48
  variant: "ghost",
47
49
  size: "icon-sm",
48
50
  disabled: u,
49
- "aria-label": e(v, "files.share.folder.previewFile", "Preview {{name}}", { name: a.name }),
50
- onClick: () => g(a),
51
- children: /* @__PURE__ */ s(r, { className: "size-4" })
51
+ "aria-label": e(b, "files.share.folder.previewFile", "Preview {{name}}", { name: o.name }),
52
+ onClick: () => _(o),
53
+ children: /* @__PURE__ */ s(i, { className: "size-4" })
52
54
  }),
53
55
  /* @__PURE__ */ s(l, {
56
+ busy: y && u,
54
57
  type: "button",
55
58
  variant: "ghost",
56
59
  size: "icon-sm",
57
- disabled: u,
58
- "aria-label": e(v, "files.share.folder.downloadFile", "Download {{name}}", { name: a.name }),
59
- onClick: () => _(a),
60
- children: u ? /* @__PURE__ */ s(o, { className: "size-4 animate-spin" }) : /* @__PURE__ */ s(n, { className: "size-4" })
60
+ disabled: !y && u,
61
+ "aria-label": e(b, "files.share.folder.downloadFile", "Download {{name}}", { name: o.name }),
62
+ onClick: () => v(o),
63
+ children: !y && u ? /* @__PURE__ */ s(n, { className: "size-4 animate-spin" }) : /* @__PURE__ */ s(r, { className: "size-4" })
61
64
  })
62
65
  ]
63
- }), h === a.id && /* @__PURE__ */ s("p", {
66
+ }), g === o.id && /* @__PURE__ */ s("p", {
64
67
  role: "alert",
65
68
  className: "mt-1 text-xs text-status-error-text",
66
- children: e(v, "files.share.folder.fileFailed", "Couldn't open this file. Try again.")
69
+ children: e(b, "files.share.folder.fileFailed", "Couldn't open this file. Try again.")
67
70
  })]
68
- }, a.id);
71
+ }, o.id);
69
72
  })
70
73
  }),
71
- p && /* @__PURE__ */ s("p", {
74
+ m && /* @__PURE__ */ s("p", {
72
75
  className: "text-xs text-text-secondary",
73
- children: e(v, "files.share.folder.truncated", "This folder has more files than this link shows.")
76
+ children: e(b, "files.share.folder.truncated", "This folder has more files than this link shows.")
74
77
  })
75
78
  ]
76
79
  });
77
80
  }
78
- export { d as SharedFolderView };
81
+ export { f as SharedFolderView };
79
82
 
80
83
  //# sourceMappingURL=SharedFolderView.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SharedFolderView.js","names":["SharedFolderView","useI18n","Folder","folderName","files","tWithFallback","t","busy","busyFileId","file","FileText","formatFileSize","Button","onPreview","Eye","onDownload","Loader2","Download","failedFileId","truncated"],"sources":["../../../src/files/components/SharedFolderView.tsx"],"sourcesContent":["import { Download, Eye, FileText, Folder, Loader2 } from \"lucide-react\";\nimport { useI18n } from \"@burdenoff/fe-libs/shared/providers/shell/I18nProvider\";\nimport { Button } from \"@burdenoff/fe-libs/ui\";\nimport { tWithFallback } from \"../utils/i18n\";\nimport { formatFileSize } from \"../utils\";\nimport type { SharedFolderFile } from \"../utils/publicShare\";\n\nexport interface SharedFolderViewProps {\n folderName: string;\n files: SharedFolderFile[];\n /** True when the folder holds more files than the link lists. */\n truncated: boolean;\n /** The file whose download link is being fetched, if any. */\n busyFileId?: string | null;\n /** The file whose download link could not be fetched, if any. */\n failedFileId?: string | null;\n onPreview: (file: SharedFolderFile) => void;\n onDownload: (file: SharedFolderFile) => void;\n}\n\n/**\n * The files of a folder opened through its public share link (BOFF-11865).\n * Each file can be previewed or downloaded; the folder itself is read-only.\n */\nexport function SharedFolderView({\n folderName,\n files,\n truncated,\n busyFileId,\n failedFileId,\n onPreview,\n onDownload,\n}: SharedFolderViewProps) {\n const { t } = useI18n();\n\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 <Folder className=\"size-5 shrink-0 text-text-tertiary\" />\n <p className=\"truncate text-sm font-medium text-text-primary\">\n {folderName}\n </p>\n </div>\n\n {files.length === 0 ? (\n <p className=\"text-sm text-text-secondary\">\n {tWithFallback(\n t,\n \"files.share.folder.empty\",\n \"This folder has no files yet.\",\n )}\n </p>\n ) : (\n <ul\n className=\"divide-y divide-border-seam rounded-lg border border-border-seam\"\n aria-label={tWithFallback(\n t,\n \"files.share.folder.listLabel\",\n \"Files in this folder\",\n )}\n >\n {files.map((file) => {\n const busy = busyFileId === file.id;\n return (\n <li key={file.id} className=\"px-3 py-2\">\n <div className=\"flex items-center gap-3\">\n <FileText className=\"size-4 shrink-0 text-text-tertiary\" />\n <div className=\"min-w-0 flex-1\">\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(Number(file.size))}\n </p>\n </div>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={busy}\n aria-label={tWithFallback(\n t,\n \"files.share.folder.previewFile\",\n \"Preview {{name}}\",\n { name: file.name },\n )}\n onClick={() => onPreview(file)}\n >\n <Eye className=\"size-4\" />\n </Button>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={busy}\n aria-label={tWithFallback(\n t,\n \"files.share.folder.downloadFile\",\n \"Download {{name}}\",\n { name: file.name },\n )}\n onClick={() => onDownload(file)}\n >\n {busy ? (\n <Loader2 className=\"size-4 animate-spin\" />\n ) : (\n <Download className=\"size-4\" />\n )}\n </Button>\n </div>\n {failedFileId === file.id && (\n <p\n role=\"alert\"\n className=\"mt-1 text-xs text-status-error-text\"\n >\n {tWithFallback(\n t,\n \"files.share.folder.fileFailed\",\n \"Couldn't open this file. Try again.\",\n )}\n </p>\n )}\n </li>\n );\n })}\n </ul>\n )}\n\n {truncated && (\n <p className=\"text-xs text-text-secondary\">\n {tWithFallback(\n t,\n \"files.share.folder.truncated\",\n \"This folder has more files than this link shows.\",\n )}\n </p>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAwBA,SAAgBA,EAAiB,EAC/B,eACA,UACA,cACA,eACA,iBACA,cACA,iBACwB;CACxB,IAAM,EAAE,SAAMC,EAAQ;CAEtB,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACE,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAACC,GAAD,EAAQ,WAAU,qCAAsC,CAAA,GACxD,kBAAC,KAAD;KAAG,WAAU;KACV,UAAAC;IACA,CAAA,CACA;;GAEJC,EAAM,WAAW,IAChB,kBAAC,KAAD;IAAG,WAAU;IACV,UAAAC,EACCC,GACA,4BACA,+BACF;GACC,CAAA,IAEH,kBAAC,MAAD;IACE,WAAU;IACV,cAAYD,EACVC,GACA,gCACA,sBACF;IAEC,UAAAF,EAAM,KAAK,MAAS;KACnB,IAAMG,IAAOC,MAAeC,EAAK;KACjC,OACE,kBAAC,MAAD;MAAkB,WAAU;MAA5B,UAAA,CACE,kBAAC,OAAD;OAAK,WAAU;OAAf,UAAA;QACE,kBAACC,GAAD,EAAU,WAAU,qCAAsC,CAAA;QAC1D,kBAAC,OAAD;SAAK,WAAU;SAAf,UAAA,CACE,kBAAC,KAAD;UAAG,WAAU;UACV,UAAAD,EAAK;SACL,CAAA,GACH,kBAAC,KAAD;UAAG,WAAU;UACV,UAAAE,EAAe,OAAOF,EAAK,IAAI,CAAC;SAChC,CAAA,CACA;;QACL,kBAACG,GAAD;SACE,MAAK;SACL,SAAQ;SACR,MAAK;SACL,UAAUL;SACV,cAAYF,EACVC,GACA,kCACA,oBACA,EAAE,MAAMG,EAAK,KAAK,CACpB;SACA,eAAeI,EAAUJ,CAAI;SAE7B,UAAA,kBAACK,GAAD,EAAK,WAAU,SAAU,CAAA;QACnB,CAAA;QACR,kBAACF,GAAD;SACE,MAAK;SACL,SAAQ;SACR,MAAK;SACL,UAAUL;SACV,cAAYF,EACVC,GACA,mCACA,qBACA,EAAE,MAAMG,EAAK,KAAK,CACpB;SACA,eAAeM,EAAWN,CAAI;SAE7B,UAAAF,IACC,kBAACS,GAAD,EAAS,WAAU,sBAAuB,CAAA,IAE1C,kBAACC,GAAD,EAAU,WAAU,SAAU,CAAA;QAE1B,CAAA;OACL;MACJ,CAAA,GAAAC,MAAiBT,EAAK,MACrB,kBAAC,KAAD;OACE,MAAK;OACL,WAAU;OAET,UAAAJ,EACCC,GACA,iCACA,qCACF;MACC,CAAA,CAEH;KA1DK,GAAAG,EAAK,EA0DV;IAER,CAAC;GACC,CAAA;GAGLU,KACC,kBAAC,KAAD;IAAG,WAAU;IACV,UAAAd,EACCC,GACA,gCACA,kDACF;GACC,CAAA;EAEF;;AAET"}
1
+ {"version":3,"file":"SharedFolderView.js","names":["SharedFolderView","loadingSystem","useLoadingSystem","useI18n","Folder","folderName","files","tWithFallback","t","busy","busyFileId","file","FileText","formatFileSize","Button","onPreview","Eye","onDownload","SpinnerIcon","Download","failedFileId","truncated"],"sources":["../../../src/files/components/SharedFolderView.tsx"],"sourcesContent":["import { Download, Eye, FileText, Folder } from \"lucide-react\";\nimport { useI18n } from \"@burdenoff/fe-libs/shared/providers/shell/I18nProvider\";\nimport { Button } from \"@burdenoff/fe-libs/ui\";\nimport { tWithFallback } from \"../utils/i18n\";\nimport { formatFileSize } from \"../utils\";\nimport type { SharedFolderFile } from \"../utils/publicShare\";\nimport { useLoadingSystem } from \"@burdenoff/fe-libs/ui/loading/LoadingSystemProvider\";\nimport { SpinnerIcon } from \"./loadingSystem\";\n\nexport interface SharedFolderViewProps {\n folderName: string;\n files: SharedFolderFile[];\n /** True when the folder holds more files than the link lists. */\n truncated: boolean;\n /** The file whose download link is being fetched, if any. */\n busyFileId?: string | null;\n /** The file whose download link could not be fetched, if any. */\n failedFileId?: string | null;\n onPreview: (file: SharedFolderFile) => void;\n onDownload: (file: SharedFolderFile) => void;\n}\n\n/**\n * The files of a folder opened through its public share link (BOFF-11865).\n * Each file can be previewed or downloaded; the folder itself is read-only.\n */\nexport function SharedFolderView({\n folderName,\n files,\n truncated,\n busyFileId,\n failedFileId,\n onPreview,\n onDownload,\n}: SharedFolderViewProps) {\n const loadingSystem = useLoadingSystem();\n const { t } = useI18n();\n\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 <Folder className=\"size-5 shrink-0 text-text-tertiary\" />\n <p className=\"truncate text-sm font-medium text-text-primary\">\n {folderName}\n </p>\n </div>\n\n {files.length === 0 ? (\n <p className=\"text-sm text-text-secondary\">\n {tWithFallback(\n t,\n \"files.share.folder.empty\",\n \"This folder has no files yet.\",\n )}\n </p>\n ) : (\n <ul\n className=\"divide-y divide-border-seam rounded-lg border border-border-seam\"\n aria-label={tWithFallback(\n t,\n \"files.share.folder.listLabel\",\n \"Files in this folder\",\n )}\n >\n {files.map((file) => {\n const busy = busyFileId === file.id;\n return (\n <li key={file.id} className=\"px-3 py-2\">\n <div className=\"flex items-center gap-3\">\n <FileText className=\"size-4 shrink-0 text-text-tertiary\" />\n <div className=\"min-w-0 flex-1\">\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(Number(file.size))}\n </p>\n </div>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={busy}\n aria-label={tWithFallback(\n t,\n \"files.share.folder.previewFile\",\n \"Preview {{name}}\",\n { name: file.name },\n )}\n onClick={() => onPreview(file)}\n >\n <Eye className=\"size-4\" />\n </Button>\n <Button\n busy={loadingSystem && busy}\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={!loadingSystem && busy}\n aria-label={tWithFallback(\n t,\n \"files.share.folder.downloadFile\",\n \"Download {{name}}\",\n { name: file.name },\n )}\n onClick={() => onDownload(file)}\n >\n {!loadingSystem && busy ? (\n <SpinnerIcon className=\"size-4 animate-spin\" />\n ) : (\n <Download className=\"size-4\" />\n )}\n </Button>\n </div>\n {failedFileId === file.id && (\n <p\n role=\"alert\"\n className=\"mt-1 text-xs text-status-error-text\"\n >\n {tWithFallback(\n t,\n \"files.share.folder.fileFailed\",\n \"Couldn't open this file. Try again.\",\n )}\n </p>\n )}\n </li>\n );\n })}\n </ul>\n )}\n\n {truncated && (\n <p className=\"text-xs text-text-secondary\">\n {tWithFallback(\n t,\n \"files.share.folder.truncated\",\n \"This folder has more files than this link shows.\",\n )}\n </p>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AA0BA,SAAgBA,EAAiB,EAC/B,eACA,UACA,cACA,eACA,iBACA,cACA,iBACwB;CACxB,IAAMC,IAAgBC,EAAiB,GACjC,EAAE,SAAMC,EAAQ;CAEtB,OACE,kBAAC,OAAD;EAAK,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,EAAU,WAAU,SAAU,CAAA;QAE1B,CAAA;OACL;MACJ,CAAA,GAAAC,MAAiBT,EAAK,MACrB,kBAAC,KAAD;OACE,MAAK;OACL,WAAU;OAET,UAAAJ,EACCC,GACA,iCACA,qCACF;MACC,CAAA,CAEH;KA3DK,GAAAG,EAAK,EA2DV;IAER,CAAC;GACC,CAAA;GAGLU,KACC,kBAAC,KAAD;IAAG,WAAU;IACV,UAAAd,EACCC,GACA,gCACA,kDACF;GACC,CAAA;EAEF;;AAET"}
@@ -1,6 +1,7 @@
1
1
  import "../utils/index.js";
2
2
  import { isImageType as e } from "../utils/thumbnail.js";
3
3
  import { tWithFallback as t } from "../utils/i18n.js";
4
+ import "./loadingSystem.js";
4
5
  import { useEffect as n, useRef as r } from "react";
5
6
  import { Image as i, MoreHorizontal as a, Pause as o, Play as s, RotateCcw as c, X as l } from "lucide-react";
6
7
  import { jsx as u, jsxs as d } from "react/jsx-runtime";
@@ -1 +1 @@
1
- {"version":3,"file":"UploadQueue.js","names":["ImageIcon","UploadRowMoreMenu","useI18n","item","DropdownMenu","DropdownMenuTrigger","tWithFallback","t","MoreHorizontal","DropdownMenuContent","DropdownMenuItem","onPause","Pause","onResume","Play","UploadProgressBar","progressRef","useRef","isImage","isImageType","useEffect","Image","bytes","k","sizes","i","navigationV2","onRetry","RotateCcw","onCancel","X","UploadQueue","isOpen","completedCount","items","failedCount","activeCount","GlassCard","onClose"],"sources":["../../../src/files/components/UploadQueue.tsx"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport {\n MoreHorizontal,\n Pause,\n Play,\n RotateCcw,\n X,\n CheckCircle,\n AlertCircle,\n Loader2,\n Image as ImageIcon,\n} from \"lucide-react\";\nimport { useI18n } from \"@burdenoff/fe-libs/shared/providers/shell/I18nProvider\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n GlassCard,\n} from \"@burdenoff/fe-libs/ui\";\nimport type { UploadItem } from \"../types\";\nimport { isImageType } from \"../utils\";\nimport { tWithFallback } from \"../utils/i18n\";\n\ninterface UploadProgressBarProps {\n item: UploadItem;\n onPause: (id: string) => void;\n onResume: (id: string) => void;\n onRetry: (id: string) => void;\n onCancel: (id: string) => void;\n /** Navigation v2: Pause/Resume move into the row's own \"⋯\" menu. */\n navigationV2?: boolean;\n}\n\n/** Navigation v2: Pause or Resume, one click away in the row's \"⋯\" menu. */\nfunction UploadRowMoreMenu({\n item,\n onPause,\n onResume,\n}: Pick<UploadProgressBarProps, \"item\" | \"onPause\" | \"onResume\">) {\n const { t } = useI18n();\n if (item.status !== \"uploading\" && item.status !== \"paused\") return null;\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <button\n type=\"button\"\n className=\"p-1.5 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors\"\n aria-label={tWithFallback(\n t,\n \"files.upload.moreActions\",\n \"More actions for {{name}}\",\n { name: item.file.name },\n )}\n >\n <MoreHorizontal className=\"size-4\" />\n </button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n {item.status === \"uploading\" ? (\n <DropdownMenuItem onSelect={() => onPause(item.id)}>\n <Pause className=\"size-4\" />\n {tWithFallback(t, \"files.upload.pause\", \"Pause\")}\n </DropdownMenuItem>\n ) : (\n <DropdownMenuItem onSelect={() => onResume(item.id)}>\n <Play className=\"size-4\" />\n {tWithFallback(t, \"files.upload.resume\", \"Resume\")}\n </DropdownMenuItem>\n )}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\nfunction UploadProgressBar({\n item,\n onPause,\n onResume,\n onRetry,\n onCancel,\n navigationV2 = false,\n}: UploadProgressBarProps) {\n const { t } = useI18n();\n const progressRef = useRef<HTMLDivElement>(null);\n const isImage = isImageType(item.file.type);\n\n useEffect(() => {\n if (progressRef.current) {\n progressRef.current.style.width = `${item.progress}%`;\n }\n }, [item.progress]);\n\n const getStatusIcon = () => {\n switch (item.status) {\n case \"uploading\":\n return (\n <Loader2 className=\"size-4 animate-spin text-action-primary-bg\" />\n );\n case \"paused\":\n return <Pause className=\"size-4 text-status-warning-text\" />;\n case \"completed\":\n return <CheckCircle className=\"size-4 text-status-success-text\" />;\n case \"failed\":\n return <AlertCircle className=\"size-4 text-status-error-text\" />;\n default:\n return <Loader2 className=\"size-4 animate-spin text-text-tertiary\" />;\n }\n };\n\n const getStatusColor = () => {\n switch (item.status) {\n case \"uploading\":\n return \"bg-action-primary-bg\";\n case \"paused\":\n return \"bg-status-warning-bg\";\n case \"completed\":\n return \"bg-status-success-bg\";\n case \"failed\":\n return \"bg-status-error-bg\";\n default:\n return \"bg-text-tertiary\";\n }\n };\n\n const formatFileSize = (bytes: number) => {\n if (bytes === 0) return \"0 B\";\n const k = 1024;\n const sizes = [\"B\", \"KB\", \"MB\", \"GB\"];\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n return `${parseFloat((bytes / Math.pow(k, i)).toFixed(1))} ${sizes[i]}`;\n };\n\n return (\n <div className=\"bg-bg-elevated border border-border-default rounded-lg p-3\">\n <div className=\"flex items-center gap-3\">\n <div className=\"flex-shrink-0 size-10 bg-bg-sunken rounded flex items-center justify-center overflow-hidden\">\n {item.thumbnailUrl ? (\n <img\n src={item.thumbnailUrl}\n alt={item.file.name}\n className=\"w-full h-full object-cover\"\n />\n ) : isImage ? (\n <ImageIcon className=\"size-5 text-text-tertiary\" />\n ) : (\n <div className=\"w-full h-full bg-bg-accent\" />\n )}\n </div>\n\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center justify-between gap-2 mb-1.5\">\n <span className=\"text-sm font-medium text-text-primary truncate\">\n {item.file.name}\n </span>\n <span className=\"text-xs text-text-secondary whitespace-nowrap\">\n {formatFileSize(item.file.size)}\n </span>\n </div>\n\n <div className=\"relative h-1.5 bg-bg-sunken rounded-full overflow-hidden\">\n <div\n ref={progressRef}\n className={`absolute inset-y-0 left-0 ${getStatusColor()} transition-all duration-300 ease-out rounded-full`}\n style={{ width: `${item.progress}%` }}\n />\n </div>\n\n <div className=\"flex items-center justify-between mt-1.5\">\n <span className=\"text-xs text-text-secondary\">\n {item.status === \"paused\" &&\n tWithFallback(t, \"files.upload.paused\", \"Paused\")}\n {item.status === \"uploading\" && `${item.progress}%`}\n {item.status === \"completed\" &&\n tWithFallback(t, \"files.upload.completedStatus\", \"Completed\")}\n {item.status === \"failed\" &&\n (item.error ||\n tWithFallback(t, \"files.upload.failed\", \"Failed\"))}\n {item.status === \"pending\" &&\n tWithFallback(t, \"files.upload.pendingStatus\", \"Pending...\")}\n </span>\n </div>\n </div>\n\n <div className=\"flex items-center gap-1 flex-shrink-0\">\n {navigationV2 && (\n <UploadRowMoreMenu\n item={item}\n onPause={onPause}\n onResume={onResume}\n />\n )}\n\n {!navigationV2 && item.status === \"uploading\" && (\n <button\n type=\"button\"\n onClick={() => onPause(item.id)}\n className=\"p-1.5 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors\"\n title={tWithFallback(t, \"files.upload.pause\", \"Pause\")}\n >\n <Pause className=\"size-4\" />\n </button>\n )}\n\n {!navigationV2 && item.status === \"paused\" && (\n <button\n type=\"button\"\n onClick={() => onResume(item.id)}\n className=\"p-1.5 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors\"\n title={tWithFallback(t, \"files.upload.resume\", \"Resume\")}\n >\n <Play className=\"size-4\" />\n </button>\n )}\n\n {item.status === \"failed\" && (\n <button\n type=\"button\"\n onClick={() => onRetry(item.id)}\n className=\"p-1.5 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors\"\n title={tWithFallback(t, \"files.upload.retry\", \"Retry\")}\n >\n <RotateCcw className=\"size-4\" />\n </button>\n )}\n\n {(item.status === \"pending\" ||\n item.status === \"paused\" ||\n item.status === \"failed\") && (\n <button\n type=\"button\"\n onClick={() => onCancel(item.id)}\n className=\"p-1.5 text-text-secondary hover:text-status-error-text hover:bg-status-error-bg-subtle rounded transition-colors\"\n title={tWithFallback(t, \"files.upload.cancel\", \"Cancel\")}\n >\n <X className=\"size-4\" />\n </button>\n )}\n </div>\n </div>\n </div>\n );\n}\n\ninterface UploadQueueProps {\n items: UploadItem[];\n isOpen: boolean;\n onClose: () => void;\n onPause: (id: string) => void;\n onResume: (id: string) => void;\n onRetry: (id: string) => void;\n onCancel: (id: string) => void;\n /** Navigation v2: Pause/Resume sit in each row's \"⋯\"; Retry/Cancel stay visible. */\n navigationV2?: boolean;\n}\n\nexport function UploadQueue({\n items,\n isOpen,\n onClose,\n onPause,\n onResume,\n onRetry,\n onCancel,\n navigationV2 = false,\n}: UploadQueueProps) {\n const { t } = useI18n();\n if (!isOpen) return null;\n\n const completedCount = items.filter((i) => i.status === \"completed\").length;\n const failedCount = items.filter((i) => i.status === \"failed\").length;\n const activeCount = items.filter(\n (i) => i.status === \"uploading\" || i.status === \"pending\",\n ).length;\n\n return (\n <GlassCard\n treatment=\"glass\"\n glow\n className=\"fixed bottom-4 right-4 z-50 w-80 max-w-[90vw] md:w-96\"\n >\n <div className=\"flex items-center justify-between p-3 border-b border-border-seam\">\n <div>\n <h3 className=\"flex items-center gap-2 text-sm font-semibold text-text-primary\">\n {activeCount > 0 && (\n <span\n className=\"size-2 shrink-0 rounded-full bg-action-primary-bg motion-safe:animate-vc-glow-pulse\"\n aria-hidden=\"true\"\n />\n )}\n {tWithFallback(t, \"files.upload.uploads\", \"Uploads\")} (\n {tWithFallback(t, \"files.upload.active\", \"{{count}} uploading\", {\n count: activeCount,\n })}\n )\n </h3>\n {completedCount > 0 && (\n <p className=\"text-xs text-status-success-text\">\n {tWithFallback(\n t,\n \"files.upload.completed\",\n \"{{count}} completed\",\n {\n count: completedCount,\n },\n )}\n </p>\n )}\n {failedCount > 0 && (\n <p className=\"text-xs text-status-error-text\">\n {tWithFallback(\n t,\n \"files.upload.failedCount\",\n \"{{count}} failed\",\n {\n count: failedCount,\n },\n )}\n </p>\n )}\n </div>\n <button\n type=\"button\"\n onClick={onClose}\n aria-label={tWithFallback(t, \"files.upload.close\", \"Close uploads\")}\n className=\"p-1 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors\"\n >\n <X className=\"size-4\" />\n </button>\n </div>\n\n <div className=\"max-h-64 overflow-y-auto p-2 space-y-2\">\n {items.length === 0 ? (\n <p className=\"text-sm text-text-secondary text-center py-4\">\n {tWithFallback(t, \"files.upload.noUploads\", \"No uploads\")}\n </p>\n ) : (\n items.map((item) => (\n <UploadProgressBar\n key={item.id}\n item={item}\n onPause={onPause}\n onResume={onResume}\n onRetry={onRetry}\n onCancel={onCancel}\n navigationV2={navigationV2}\n />\n ))\n )}\n </div>\n </GlassCard>\n );\n}\n"],"mappings":";;;;;;;;;AAmCA,SAASC,EAAkB,EACzB,SACA,YACA,eACgE;CAChE,IAAM,EAAE,SAAMC,EAAQ;CAEtB,OADIC,EAAK,WAAW,eAAeA,EAAK,WAAW,WAAiB,OAElE,kBAACC,GAAD,EAAA,UAAA,CACE,kBAACC,GAAD;EAAqB,SAAA;EACnB,UAAA,kBAAC,UAAD;GACE,MAAK;GACL,WAAU;GACV,cAAYC,EACVC,GACA,4BACA,6BACA,EAAE,MAAMJ,EAAK,KAAK,KAAK,CACzB;GAEA,UAAA,kBAACK,GAAD,EAAgB,WAAU,SAAU,CAAA;EAC9B,CAAA;CACW,CAAA,GACrB,kBAACC,GAAD;EAAqB,OAAM;EACxB,UAAAN,EAAK,WAAW,cACf,kBAACO,GAAD;GAAkB,gBAAgBC,EAAQR,EAAK,EAAE;GAAjD,UAAA,CACE,kBAACS,GAAD,EAAO,WAAU,SAAU,CAAA,GAC1BN,EAAcC,GAAG,sBAAsB,OAAO,CAC/B;EAElB,CAAA,IAAA,kBAACG,GAAD;GAAkB,gBAAgBG,EAASV,EAAK,EAAE;GAAlD,UAAA,CACE,kBAACW,GAAD,EAAM,WAAU,SAAU,CAAA,GACzBR,EAAcC,GAAG,uBAAuB,QAAQ,CACjC;;CAED,CAAA,CACT,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c,KACb,kBAAC,KAAD;KAAG,WAAU;KACV,UAAA7B,EACCC,GACA,4BACA,oBACA,EACE,OAAO4B,EACT,CACF;IACC,CAAA;GAEF,EAAA,CAAA,GACL,kBAAC,UAAD;IACE,MAAK;IACL,SAASG;IACT,cAAYhC,EAAcC,GAAG,sBAAsB,eAAe;IAClE,WAAU;IAEV,UAAA,kBAACuB,GAAD,EAAG,WAAU,SAAU,CAAA;GACjB,CAAA,CACL;EAEL,CAAA,GAAA,kBAAC,OAAD;GAAK,WAAU;GACZ,UAAAI,EAAM,WAAW,IAChB,kBAAC,KAAD;IAAG,WAAU;IACV,UAAA5B,EAAcC,GAAG,0BAA0B,YAAY;GACvD,CAAA,IAEH2B,EAAM,KAAK,MACT,kBAACnB,GAAD;IAEQ;IACG;IACC;IACD;IACC;IACI;GACf,GAPMZ,EAAK,EAOX,CACF;EAEA,CAAA,CACI;;AAEf"}
1
+ {"version":3,"file":"UploadQueue.js","names":["ImageIcon","UploadRowMoreMenu","useI18n","item","DropdownMenu","DropdownMenuTrigger","tWithFallback","t","MoreHorizontal","DropdownMenuContent","DropdownMenuItem","onPause","Pause","onResume","Play","UploadProgressBar","progressRef","useRef","isImage","isImageType","useEffect","Image","bytes","k","sizes","i","navigationV2","onRetry","RotateCcw","onCancel","X","UploadQueue","isOpen","completedCount","items","failedCount","activeCount","GlassCard","onClose"],"sources":["../../../src/files/components/UploadQueue.tsx"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport {\n MoreHorizontal,\n Pause,\n Play,\n RotateCcw,\n X,\n CheckCircle,\n AlertCircle,\n Image as ImageIcon,\n} from \"lucide-react\";\nimport { useI18n } from \"@burdenoff/fe-libs/shared/providers/shell/I18nProvider\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n GlassCard,\n} from \"@burdenoff/fe-libs/ui\";\nimport type { UploadItem } from \"../types\";\nimport { isImageType } from \"../utils\";\nimport { tWithFallback } from \"../utils/i18n\";\nimport { SpinnerIcon } from \"./loadingSystem\";\n\ninterface UploadProgressBarProps {\n item: UploadItem;\n onPause: (id: string) => void;\n onResume: (id: string) => void;\n onRetry: (id: string) => void;\n onCancel: (id: string) => void;\n /** Navigation v2: Pause/Resume move into the row's own \"⋯\" menu. */\n navigationV2?: boolean;\n}\n\n/** Navigation v2: Pause or Resume, one click away in the row's \"⋯\" menu. */\nfunction UploadRowMoreMenu({\n item,\n onPause,\n onResume,\n}: Pick<UploadProgressBarProps, \"item\" | \"onPause\" | \"onResume\">) {\n const { t } = useI18n();\n if (item.status !== \"uploading\" && item.status !== \"paused\") return null;\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <button\n type=\"button\"\n className=\"p-1.5 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors\"\n aria-label={tWithFallback(\n t,\n \"files.upload.moreActions\",\n \"More actions for {{name}}\",\n { name: item.file.name },\n )}\n >\n <MoreHorizontal className=\"size-4\" />\n </button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n {item.status === \"uploading\" ? (\n <DropdownMenuItem onSelect={() => onPause(item.id)}>\n <Pause className=\"size-4\" />\n {tWithFallback(t, \"files.upload.pause\", \"Pause\")}\n </DropdownMenuItem>\n ) : (\n <DropdownMenuItem onSelect={() => onResume(item.id)}>\n <Play className=\"size-4\" />\n {tWithFallback(t, \"files.upload.resume\", \"Resume\")}\n </DropdownMenuItem>\n )}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\nfunction UploadProgressBar({\n item,\n onPause,\n onResume,\n onRetry,\n onCancel,\n navigationV2 = false,\n}: UploadProgressBarProps) {\n const { t } = useI18n();\n const progressRef = useRef<HTMLDivElement>(null);\n const isImage = isImageType(item.file.type);\n\n useEffect(() => {\n if (progressRef.current) {\n progressRef.current.style.width = `${item.progress}%`;\n }\n }, [item.progress]);\n\n const getStatusIcon = () => {\n switch (item.status) {\n case \"uploading\":\n return (\n <SpinnerIcon className=\"size-4 animate-spin text-action-primary-bg\" />\n );\n case \"paused\":\n return <Pause className=\"size-4 text-status-warning-text\" />;\n case \"completed\":\n return <CheckCircle className=\"size-4 text-status-success-text\" />;\n case \"failed\":\n return <AlertCircle className=\"size-4 text-status-error-text\" />;\n default:\n return (\n <SpinnerIcon className=\"size-4 animate-spin text-text-tertiary\" />\n );\n }\n };\n\n const getStatusColor = () => {\n switch (item.status) {\n case \"uploading\":\n return \"bg-action-primary-bg\";\n case \"paused\":\n return \"bg-status-warning-bg\";\n case \"completed\":\n return \"bg-status-success-bg\";\n case \"failed\":\n return \"bg-status-error-bg\";\n default:\n return \"bg-text-tertiary\";\n }\n };\n\n const formatFileSize = (bytes: number) => {\n if (bytes === 0) return \"0 B\";\n const k = 1024;\n const sizes = [\"B\", \"KB\", \"MB\", \"GB\"];\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n return `${parseFloat((bytes / Math.pow(k, i)).toFixed(1))} ${sizes[i]}`;\n };\n\n return (\n <div className=\"bg-bg-elevated border border-border-default rounded-lg p-3\">\n <div className=\"flex items-center gap-3\">\n <div className=\"flex-shrink-0 size-10 bg-bg-sunken rounded flex items-center justify-center overflow-hidden\">\n {item.thumbnailUrl ? (\n <img\n src={item.thumbnailUrl}\n alt={item.file.name}\n className=\"w-full h-full object-cover\"\n />\n ) : isImage ? (\n <ImageIcon className=\"size-5 text-text-tertiary\" />\n ) : (\n <div className=\"w-full h-full bg-bg-accent\" />\n )}\n </div>\n\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center justify-between gap-2 mb-1.5\">\n <span className=\"text-sm font-medium text-text-primary truncate\">\n {item.file.name}\n </span>\n <span className=\"text-xs text-text-secondary whitespace-nowrap\">\n {formatFileSize(item.file.size)}\n </span>\n </div>\n\n <div className=\"relative h-1.5 bg-bg-sunken rounded-full overflow-hidden\">\n <div\n ref={progressRef}\n className={`absolute inset-y-0 left-0 ${getStatusColor()} transition-all duration-300 ease-out rounded-full`}\n style={{ width: `${item.progress}%` }}\n />\n </div>\n\n <div className=\"flex items-center justify-between mt-1.5\">\n <span className=\"text-xs text-text-secondary\">\n {item.status === \"paused\" &&\n tWithFallback(t, \"files.upload.paused\", \"Paused\")}\n {item.status === \"uploading\" && `${item.progress}%`}\n {item.status === \"completed\" &&\n tWithFallback(t, \"files.upload.completedStatus\", \"Completed\")}\n {item.status === \"failed\" &&\n (item.error ||\n tWithFallback(t, \"files.upload.failed\", \"Failed\"))}\n {item.status === \"pending\" &&\n tWithFallback(t, \"files.upload.pendingStatus\", \"Pending...\")}\n </span>\n </div>\n </div>\n\n <div className=\"flex items-center gap-1 flex-shrink-0\">\n {navigationV2 && (\n <UploadRowMoreMenu\n item={item}\n onPause={onPause}\n onResume={onResume}\n />\n )}\n\n {!navigationV2 && item.status === \"uploading\" && (\n <button\n type=\"button\"\n onClick={() => onPause(item.id)}\n className=\"p-1.5 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors\"\n title={tWithFallback(t, \"files.upload.pause\", \"Pause\")}\n >\n <Pause className=\"size-4\" />\n </button>\n )}\n\n {!navigationV2 && item.status === \"paused\" && (\n <button\n type=\"button\"\n onClick={() => onResume(item.id)}\n className=\"p-1.5 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors\"\n title={tWithFallback(t, \"files.upload.resume\", \"Resume\")}\n >\n <Play className=\"size-4\" />\n </button>\n )}\n\n {item.status === \"failed\" && (\n <button\n type=\"button\"\n onClick={() => onRetry(item.id)}\n className=\"p-1.5 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors\"\n title={tWithFallback(t, \"files.upload.retry\", \"Retry\")}\n >\n <RotateCcw className=\"size-4\" />\n </button>\n )}\n\n {(item.status === \"pending\" ||\n item.status === \"paused\" ||\n item.status === \"failed\") && (\n <button\n type=\"button\"\n onClick={() => onCancel(item.id)}\n className=\"p-1.5 text-text-secondary hover:text-status-error-text hover:bg-status-error-bg-subtle rounded transition-colors\"\n title={tWithFallback(t, \"files.upload.cancel\", \"Cancel\")}\n >\n <X className=\"size-4\" />\n </button>\n )}\n </div>\n </div>\n </div>\n );\n}\n\ninterface UploadQueueProps {\n items: UploadItem[];\n isOpen: boolean;\n onClose: () => void;\n onPause: (id: string) => void;\n onResume: (id: string) => void;\n onRetry: (id: string) => void;\n onCancel: (id: string) => void;\n /** Navigation v2: Pause/Resume sit in each row's \"⋯\"; Retry/Cancel stay visible. */\n navigationV2?: boolean;\n}\n\nexport function UploadQueue({\n items,\n isOpen,\n onClose,\n onPause,\n onResume,\n onRetry,\n onCancel,\n navigationV2 = false,\n}: UploadQueueProps) {\n const { t } = useI18n();\n if (!isOpen) return null;\n\n const completedCount = items.filter((i) => i.status === \"completed\").length;\n const failedCount = items.filter((i) => i.status === \"failed\").length;\n const activeCount = items.filter(\n (i) => i.status === \"uploading\" || i.status === \"pending\",\n ).length;\n\n return (\n <GlassCard\n treatment=\"glass\"\n glow\n className=\"fixed bottom-4 right-4 z-50 w-80 max-w-[90vw] md:w-96\"\n >\n <div className=\"flex items-center justify-between p-3 border-b border-border-seam\">\n <div>\n <h3 className=\"flex items-center gap-2 text-sm font-semibold text-text-primary\">\n {activeCount > 0 && (\n <span\n className=\"size-2 shrink-0 rounded-full bg-action-primary-bg motion-safe:animate-vc-glow-pulse\"\n aria-hidden=\"true\"\n />\n )}\n {tWithFallback(t, \"files.upload.uploads\", \"Uploads\")} (\n {tWithFallback(t, \"files.upload.active\", \"{{count}} uploading\", {\n count: activeCount,\n })}\n )\n </h3>\n {completedCount > 0 && (\n <p className=\"text-xs text-status-success-text\">\n {tWithFallback(\n t,\n \"files.upload.completed\",\n \"{{count}} completed\",\n {\n count: completedCount,\n },\n )}\n </p>\n )}\n {failedCount > 0 && (\n <p className=\"text-xs text-status-error-text\">\n {tWithFallback(\n t,\n \"files.upload.failedCount\",\n \"{{count}} failed\",\n {\n count: failedCount,\n },\n )}\n </p>\n )}\n </div>\n <button\n type=\"button\"\n onClick={onClose}\n aria-label={tWithFallback(t, \"files.upload.close\", \"Close uploads\")}\n className=\"p-1 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors\"\n >\n <X className=\"size-4\" />\n </button>\n </div>\n\n <div className=\"max-h-64 overflow-y-auto p-2 space-y-2\">\n {items.length === 0 ? (\n <p className=\"text-sm text-text-secondary text-center py-4\">\n {tWithFallback(t, \"files.upload.noUploads\", \"No uploads\")}\n </p>\n ) : (\n items.map((item) => (\n <UploadProgressBar\n key={item.id}\n item={item}\n onPause={onPause}\n onResume={onResume}\n onRetry={onRetry}\n onCancel={onCancel}\n navigationV2={navigationV2}\n />\n ))\n )}\n </div>\n </GlassCard>\n );\n}\n"],"mappings":";;;;;;;;;;AAmCA,SAASC,EAAkB,EACzB,SACA,YACA,eACgE;CAChE,IAAM,EAAE,SAAMC,EAAQ;CAEtB,OADIC,EAAK,WAAW,eAAeA,EAAK,WAAW,WAAiB,OAElE,kBAACC,GAAD,EAAA,UAAA,CACE,kBAACC,GAAD;EAAqB,SAAA;EACnB,UAAA,kBAAC,UAAD;GACE,MAAK;GACL,WAAU;GACV,cAAYC,EACVC,GACA,4BACA,6BACA,EAAE,MAAMJ,EAAK,KAAK,KAAK,CACzB;GAEA,UAAA,kBAACK,GAAD,EAAgB,WAAU,SAAU,CAAA;EAC9B,CAAA;CACW,CAAA,GACrB,kBAACC,GAAD;EAAqB,OAAM;EACxB,UAAAN,EAAK,WAAW,cACf,kBAACO,GAAD;GAAkB,gBAAgBC,EAAQR,EAAK,EAAE;GAAjD,UAAA,CACE,kBAACS,GAAD,EAAO,WAAU,SAAU,CAAA,GAC1BN,EAAcC,GAAG,sBAAsB,OAAO,CAC/B;EAElB,CAAA,IAAA,kBAACG,GAAD;GAAkB,gBAAgBG,EAASV,EAAK,EAAE;GAAlD,UAAA,CACE,kBAACW,GAAD,EAAM,WAAU,SAAU,CAAA,GACzBR,EAAcC,GAAG,uBAAuB,QAAQ,CACjC;;CAED,CAAA,CACT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Ac,KACb,kBAAC,KAAD;KAAG,WAAU;KACV,UAAA7B,EACCC,GACA,4BACA,oBACA,EACE,OAAO4B,EACT,CACF;IACC,CAAA;GAEF,EAAA,CAAA,GACL,kBAAC,UAAD;IACE,MAAK;IACL,SAASG;IACT,cAAYhC,EAAcC,GAAG,sBAAsB,eAAe;IAClE,WAAU;IAEV,UAAA,kBAACuB,GAAD,EAAG,WAAU,SAAU,CAAA;GACjB,CAAA,CACL;EAEL,CAAA,GAAA,kBAAC,OAAD;GAAK,WAAU;GACZ,UAAAI,EAAM,WAAW,IAChB,kBAAC,KAAD;IAAG,WAAU;IACV,UAAA5B,EAAcC,GAAG,0BAA0B,YAAY;GACvD,CAAA,IAEH2B,EAAM,KAAK,MACT,kBAACnB,GAAD;IAEQ;IACG;IACC;IACD;IACC;IACI;GACf,GAPMZ,EAAK,EAOX,CACF;EAEA,CAAA,CACI;;AAEf"}
@@ -0,0 +1,64 @@
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
+ import { SpinnerIconProps } from '@burdenoff/fe-libs/ui/loading/SpinnerIcon';
3
+ /**
4
+ * A drop-in for `<Loader2 className="… animate-spin" />`. Without the opt-in it IS this module's
5
+ * `Loader2`, with exactly the props it was given: fe-libs resolves a newer lucide-react than the
6
+ * module's (its icons add `aria-hidden`), so fe-libs' own `SpinnerIcon` would not draw the module's
7
+ * spinner byte for byte. Under the opt-in, fe-libs' `SpinnerIcon`: the compact mark, sized from
8
+ * the classes, `animate-spin` dropped; `tone="current"` lights it in the label's colour (a filled
9
+ * button).
10
+ */
11
+ export declare function SpinnerIcon({ tone, ...props }: SpinnerIconProps): import('react').JSX.Element;
12
+ /**
13
+ * A spinner the module draws itself (a CSS ring, its own svg, a turning icon): `today` exactly
14
+ * without the opt-in; under it, the compact mark. As fe-libs' `CompactMarkOr`, with the mark's
15
+ * `tone`: in a filled button it lights in the label's colour (an accent light on an accent fill
16
+ * would not show).
17
+ */
18
+ export declare function CompactMarkOr({ today, className, tone, }: {
19
+ /** The spinner as the module draws it today. */
20
+ today: ReactNode;
21
+ /** The compact mark's classes (its size, its margins). */
22
+ className?: string;
23
+ tone?: "brand" | "current";
24
+ }): import('react').JSX.Element;
25
+ export type SkeletonBlockProps = HTMLAttributes<HTMLElement> & {
26
+ /** Today's element: a `span` stays a `span` (it may sit in a line of text). */
27
+ as?: "div" | "span";
28
+ };
29
+ /**
30
+ * A grey block standing in for content on its way: a drop-in for today's hand-made
31
+ * `<div className="… animate-pulse bg-…" />`. Without the opt-in it IS that element, with exactly
32
+ * the props it was given, in their order; under it, the system's skeleton (one light passing, still
33
+ * under reduced motion, hidden from assistive technology) in the block's size, shape and place.
34
+ */
35
+ export declare function SkeletonBlock({ as, ...props }: SkeletonBlockProps): import('react').JSX.Element;
36
+ /**
37
+ * A box that pulses as a whole around its grey blocks (today's `<div className="animate-pulse …">`
38
+ * with plain blocks inside): a drop-in for that element. Without the opt-in it IS that element,
39
+ * prop for prop; under it, the same element without the pulse (its blocks are `SkeletonBlock`s,
40
+ * each with the system's light).
41
+ */
42
+ export type SkeletonGroupProps = HTMLAttributes<HTMLElement> & {
43
+ /** Today's element. */
44
+ as?: "div" | "span" | "li" | "section";
45
+ };
46
+ export declare function SkeletonGroup({ as, ...props }: SkeletonGroupProps): import('react').JSX.Element;
47
+ export interface SectionLoaderOrProps {
48
+ /** Today's loader, rendered exactly as it is without the opt-in. */
49
+ today: ReactNode;
50
+ /** What is loading, from today's words; the shell's "Loading…" when the box had none. */
51
+ label?: string;
52
+ /** Today's box height, so nothing moves when the content lands. */
53
+ minHeight?: string;
54
+ /** A page's loader (a route's code or its first data): it also runs the route wire. */
55
+ route?: boolean;
56
+ /** Where today's box sat (its grid span, margins). */
57
+ className?: string;
58
+ }
59
+ /**
60
+ * A box that waits on content of unknown shape. Without the opt-in it is `today`, exactly; under
61
+ * it, fe-libs' `SectionLoader`: nothing for 300 ms, then the product's mark and the words, held at
62
+ * least 600 ms, in a box of today's height.
63
+ */
64
+ export declare function SectionLoaderOr({ today, label, minHeight, route, className, }: SectionLoaderOrProps): import('react').JSX.Element;
@@ -0,0 +1,56 @@
1
+ import { Loader2 as e } from "lucide-react";
2
+ import { Fragment as t, jsx as n } from "react/jsx-runtime";
3
+ import { BrandLoader as r } from "@burdenoff/fe-libs/ui/loading/BrandLoader";
4
+ import { useLoadingSystem as i } from "@burdenoff/fe-libs/ui/loading/LoadingSystemProvider";
5
+ import { SectionLoader as a } from "@burdenoff/fe-libs/ui/loading/Loaders";
6
+ import { SpinnerIcon as o } from "@burdenoff/fe-libs/ui/loading/SpinnerIcon";
7
+ import { Skeleton as s } from "@burdenoff/fe-libs/ui/skeleton";
8
+ import { useShellLabel as c } from "@burdenoff/fe-libs/shared/providers/shell/useShellLabel";
9
+ // src/files/components/loadingSystem.tsx
10
+ function l({ tone: t, ...r }) {
11
+ return i() ? /* @__PURE__ */ n(o, {
12
+ tone: t,
13
+ ...r
14
+ }) : /* @__PURE__ */ n(e, { ...r });
15
+ }
16
+ function u({ today: e, className: a, tone: o }) {
17
+ return i() ? /* @__PURE__ */ n(r, {
18
+ size: "s",
19
+ tone: o,
20
+ className: a
21
+ }) : /* @__PURE__ */ n(t, { children: e });
22
+ }
23
+ var d = /^(?:[\w-]+:)*(?:animate-pulse|animate-vc-shimmer|bg-\S+)$/;
24
+ function f(e) {
25
+ return (e ?? "").split(/\s+/).filter((e) => e && !d.test(e)).join(" ") || void 0;
26
+ }
27
+ function p({ as: e = "div", ...t }) {
28
+ if (!i()) return /* @__PURE__ */ n(e, { ...t });
29
+ let { className: r, ...a } = t, o = f(r);
30
+ if (e === "span") {
31
+ let e = o && /(?:^|\s|:)rounded/.test(o) ? "" : "rounded-card";
32
+ return /* @__PURE__ */ n("span", {
33
+ "data-slot": "skeleton",
34
+ "data-loading-system": "skeleton",
35
+ "aria-hidden": "true",
36
+ className: [e, o].filter(Boolean).join(" "),
37
+ ...a
38
+ });
39
+ }
40
+ return /* @__PURE__ */ n(s, {
41
+ className: o,
42
+ ...a
43
+ });
44
+ }
45
+ function m({ today: e, label: r, minHeight: o, route: s, className: l }) {
46
+ let u = i(), d = c();
47
+ return u ? /* @__PURE__ */ n(a, {
48
+ label: r ?? d("loading.generic", "Loading…"),
49
+ minHeight: o,
50
+ route: s,
51
+ className: l
52
+ }) : /* @__PURE__ */ n(t, { children: e });
53
+ }
54
+ export { u as CompactMarkOr, m as SectionLoaderOr, p as SkeletonBlock, l as SpinnerIcon };
55
+
56
+ //# sourceMappingURL=loadingSystem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadingSystem.js","names":["SpinnerIcon","SystemSpinnerIcon","_Fragment","Today","SpinnerIcon$1","props","useLoadingSystem","SpinnerIcon","Loader2","CompactMarkOr","BrandLoader","Fragment","today","TODAYS_PAINT","skeletonClasses","className","c","SkeletonBlock","as","rest","kept","corner","Skeleton","SectionLoaderOr","loadingSystem","shellLabel","useShellLabel","SectionLoader","label"],"sources":["../../../src/files/components/loadingSystem.tsx"],"sourcesContent":["/**\n * The loading system's pieces for this module's own hand-made loaders (BOFF-16259). Without the\n * product's opt-in (`AppShellConfig.loadingSystem`, FluidGrids only) each renders exactly today's\n * markup, so every other product that mounts the module sees no change; under it, the fe-libs\n * piece: the compact mark for a spinner, the system's skeleton for a pulse block, the section\n * loader for a box that waits.\n *\n * fe-libs is imported by its per-file paths (the same modules its barrels re-export), so a test\n * that stubs a barrel never takes these pieces with it; a component that branches on the opt-in\n * itself reads `useLoadingSystem` from `@burdenoff/fe-libs/ui/loading/LoadingSystemProvider`.\n */\nimport type { HTMLAttributes, ReactNode } from \"react\";\nimport { Loader2 } from \"lucide-react\";\nimport { BrandLoader } from \"@burdenoff/fe-libs/ui/loading/BrandLoader\";\nimport { useLoadingSystem } from \"@burdenoff/fe-libs/ui/loading/LoadingSystemProvider\";\nimport { SectionLoader } from \"@burdenoff/fe-libs/ui/loading/Loaders\";\nimport {\n SpinnerIcon as SystemSpinnerIcon,\n type SpinnerIconProps,\n} from \"@burdenoff/fe-libs/ui/loading/SpinnerIcon\";\nimport { Skeleton } from \"@burdenoff/fe-libs/ui/skeleton\";\nimport { useShellLabel } from \"@burdenoff/fe-libs/shared/providers/shell/useShellLabel\";\n\n/**\n * A drop-in for `<Loader2 className=\"… animate-spin\" />`. Without the opt-in it IS this module's\n * `Loader2`, with exactly the props it was given: fe-libs resolves a newer lucide-react than the\n * module's (its icons add `aria-hidden`), so fe-libs' own `SpinnerIcon` would not draw the module's\n * spinner byte for byte. Under the opt-in, fe-libs' `SpinnerIcon`: the compact mark, sized from\n * the classes, `animate-spin` dropped; `tone=\"current\"` lights it in the label's colour (a filled\n * button).\n */\nexport function SpinnerIcon({ tone, ...props }: SpinnerIconProps) {\n const loadingSystem = useLoadingSystem();\n if (!loadingSystem) return <Loader2 {...props} />;\n return <SystemSpinnerIcon tone={tone} {...props} />;\n}\n\n/**\n * A spinner the module draws itself (a CSS ring, its own svg, a turning icon): `today` exactly\n * without the opt-in; under it, the compact mark. As fe-libs' `CompactMarkOr`, with the mark's\n * `tone`: in a filled button it lights in the label's colour (an accent light on an accent fill\n * would not show).\n */\nexport function CompactMarkOr({\n today,\n className,\n tone,\n}: {\n /** The spinner as the module draws it today. */\n today: ReactNode;\n /** The compact mark's classes (its size, its margins). */\n className?: string;\n tone?: \"brand\" | \"current\";\n}) {\n const loadingSystem = useLoadingSystem();\n if (!loadingSystem) return <>{today}</>;\n return <BrandLoader size=\"s\" tone={tone} className={className} />;\n}\n\n/** What today's block paints itself, which the system's skeleton paints instead. */\nconst TODAYS_PAINT =\n /^(?:[\\w-]+:)*(?:animate-pulse|animate-vc-shimmer|bg-\\S+)$/;\n\n/** A pulse block's classes under the opt-in: its size, shape and place, not its paint. */\nfunction skeletonClasses(className: string | undefined): string | undefined {\n const kept = (className ?? \"\")\n .split(/\\s+/)\n .filter((c) => c && !TODAYS_PAINT.test(c))\n .join(\" \");\n return kept || undefined;\n}\n\nexport type SkeletonBlockProps = HTMLAttributes<HTMLElement> & {\n /** Today's element: a `span` stays a `span` (it may sit in a line of text). */\n as?: \"div\" | \"span\";\n};\n\n/**\n * A grey block standing in for content on its way: a drop-in for today's hand-made\n * `<div className=\"… animate-pulse bg-…\" />`. Without the opt-in it IS that element, with exactly\n * the props it was given, in their order; under it, the system's skeleton (one light passing, still\n * under reduced motion, hidden from assistive technology) in the block's size, shape and place.\n */\nexport function SkeletonBlock({ as = \"div\", ...props }: SkeletonBlockProps) {\n const loadingSystem = useLoadingSystem();\n if (!loadingSystem) {\n const Today = as;\n return <Today {...props} />;\n }\n const { className, ...rest } = props;\n const kept = skeletonClasses(className);\n if (as === \"span\") {\n // fe-libs' Skeleton is a div; in a line of text the same skeleton is a span (its attributes,\n // its corner unless the block sets its own).\n const corner = kept && /(?:^|\\s|:)rounded/.test(kept) ? \"\" : \"rounded-card\";\n return (\n <span\n data-slot=\"skeleton\"\n data-loading-system=\"skeleton\"\n aria-hidden=\"true\"\n className={[corner, kept].filter(Boolean).join(\" \")}\n {...rest}\n />\n );\n }\n return (\n <Skeleton className={kept} {...(rest as HTMLAttributes<HTMLDivElement>)} />\n );\n}\n\n/**\n * A box that pulses as a whole around its grey blocks (today's `<div className=\"animate-pulse …\">`\n * with plain blocks inside): a drop-in for that element. Without the opt-in it IS that element,\n * prop for prop; under it, the same element without the pulse (its blocks are `SkeletonBlock`s,\n * each with the system's light).\n */\nexport type SkeletonGroupProps = HTMLAttributes<HTMLElement> & {\n /** Today's element. */\n as?: \"div\" | \"span\" | \"li\" | \"section\";\n};\n\nexport function SkeletonGroup({ as = \"div\", ...props }: SkeletonGroupProps) {\n const loadingSystem = useLoadingSystem();\n const Today = as;\n if (!loadingSystem) return <Today {...props} />;\n const className =\n props.className\n ?.split(/\\s+/)\n .filter(\n (c) =>\n c && !/^(?:[\\w-]+:)*(?:animate-pulse|animate-vc-shimmer)$/.test(c),\n )\n .join(\" \") || undefined;\n return <Today {...props} className={className} />;\n}\n\nexport interface SectionLoaderOrProps {\n /** Today's loader, rendered exactly as it is without the opt-in. */\n today: ReactNode;\n /** What is loading, from today's words; the shell's \"Loading…\" when the box had none. */\n label?: string;\n /** Today's box height, so nothing moves when the content lands. */\n minHeight?: string;\n /** A page's loader (a route's code or its first data): it also runs the route wire. */\n route?: boolean;\n /** Where today's box sat (its grid span, margins). */\n className?: string;\n}\n\n/**\n * A box that waits on content of unknown shape. Without the opt-in it is `today`, exactly; under\n * it, fe-libs' `SectionLoader`: nothing for 300 ms, then the product's mark and the words, held at\n * least 600 ms, in a box of today's height.\n */\nexport function SectionLoaderOr({\n today,\n label,\n minHeight,\n route,\n className,\n}: SectionLoaderOrProps) {\n const loadingSystem = useLoadingSystem();\n const shellLabel = useShellLabel();\n if (!loadingSystem) return <>{today}</>;\n return (\n <SectionLoader\n label={label ?? shellLabel(\"loading.generic\", \"Loading…\")}\n minHeight={minHeight}\n route={route}\n className={className}\n />\n );\n}\n"],"mappings":";;;;;;;;;AA+BA,SAAgBA,EAAY,EAAE,SAAM,GAAGK,KAA2B;CAGhE,OAFsBC,EACjB,IACE,kBAACL,GAAD;EAAyB;EAAM,GAAII;CAAQ,CAAA,IADvB,kBAACG,GAAD,EAAS,GAAIH,EAAQ,CAAA;AAElD;AAQA,SAAgBI,EAAc,EAC5B,UACA,cACA,WAOC;CAGD,OAFsBH,EACjB,IACE,kBAACI,GAAD;EAAa,MAAK;EAAU;EAAiB;CAAY,CAAA,IADrC,kBAAAR,GAAA,EAAA,UAAGU,EAAQ,CAAA;AAExC;AAGA,IAAMC,IACJ;AAGF,SAASC,EAAgB,GAAmD;CAK1E,QAJcC,KAAa,GAAA,CACxB,MAAM,KAAK,CAAC,CACZ,QAAQ,MAAMC,KAAK,CAACH,EAAa,KAAKG,CAAC,CAAC,CAAC,CACzC,KAAK,GACD,KAAQ,KAAA;AACjB;AAaA,SAAgBC,EAAc,EAAE,QAAK,OAAO,GAAGZ,KAA6B;CAE1E,IAAI,CADkBC,EACjB,GAEH,OAAO,kBAACH,GAAD,EAAO,GAAIE,EAAQ,CAAA;CA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