import type { ReactNode } from 'react'; export type FileManagerItemKind = 'file' | 'folder'; /** Signature workflow state. `pending` surfaces the request-signature action. */ export type FileManagerSignatureStatus = 'none' | 'pending' | 'signed'; export interface FileManagerItem { /** Stable unique id. Emitted on DOM nodes as `data-item-id` — never the name. */ id: string; /** Display name. Treated as PHI by the agent contract (see file-manager.agent.ts). */ name: string; kind: FileManagerItemKind; /** Parent folder id, or `null` for items at the root. */ parentId: string | null; /** Size in bytes — files only. */ size?: number; /** * MIME type — files only. Drives the file-type icon. * * The brief names this field `contentType`; the kit keeps `mimeType` * because renaming would ripple through utils / list-view / preview for * no behavioural gain (documented deviation). */ mimeType?: string; /** ISO 8601 timestamp of the last modification. */ updatedAt?: string; /** * Open domain string — AlfaDocs uses * `'xray' | 'image' | 'text' | 'identification' | 'other' | …`. * Drives the type Badge column, grid card badge, and the toolbar type filter. */ documentType?: string; /** Clinical document flag (host-defined semantics). */ clinical?: boolean; /** Signature workflow state. `pending` unlocks the request-signature action. */ signatureStatus?: FileManagerSignatureStatus; /** Whether the document is shared with the patient. */ sharedWithPatient?: boolean; /** Thumbnail image URL — grid cards render it in place of the type icon. */ thumbnailUrl?: string; /** ISO 8601 expiry (e.g. identification documents). */ expiresAt?: string; } /** * Capability gates. Every entry point (toolbar button, keyboard shortcut, * per-row action, bulk bar, upload overlay) checks its gate; a missing gate * means the affordance is not rendered at all. * * Default is all-true (react-file-manager precedent; demo-friendly). `delete` * defaults true too but ALWAYS routes through a confirmation dialog — the * clinical-safe guard lives in the forced-choice confirm, not in the default. */ export interface FileManagerPermissions { createFolder?: boolean; upload?: boolean; download?: boolean; rename?: boolean; move?: boolean; delete?: boolean; share?: boolean; } /** * Either a flat gate set applied to every item, or a per-item resolver that * returns the gates for a given item (react-file-manager precedent). */ export type FileManagerPermissionsInput = FileManagerPermissions | ((item: FileManagerItem) => FileManagerPermissions); /** * Data-driven consumer action appended to a per-item kebab menu (after the * built-in rename/move/download/delete entries). Rendered through the shared * DropdownMenu / DataTable actions primitives — the kit never hardcodes * platform-specific actions. */ export interface FileManagerItemAction { id: string; label: string; icon?: ReactNode; onSelect: (item: FileManagerItem) => void; destructive?: boolean; } /** Data-driven consumer entry appended to the Add menu (after the built-ins). */ export interface FileManagerAddMenuItem { id: string; label: string; icon?: ReactNode; onSelect: () => void; destructive?: boolean; } /** Upload transport config — mirrors the kit `FileUpload` contract. */ export interface FileManagerUploadConfig { /** react-dropzone `accept` map (mime → extensions). */ accept?: Record; /** Max size per file in bytes. */ maxSize?: number; /** Allow selecting multiple files at once. @default true */ multiple?: boolean; } /** Per-file upload handler — the host owns transport. */ export type FileManagerUploadHandler = (file: File, helpers: { signal: AbortSignal; onProgress: (percent: number) => void; }, parentFolderId: string | null) => Promise; /** * Single-active-action state machine. Exactly one action dialog can be in * flight; attempts to begin another while one is active are ignored. */ export type FileManagerActiveAction = { type: 'none'; } | { type: 'create-folder'; } | { type: 'upload'; } | { type: 'rename'; itemId: string; } | { type: 'delete'; itemIds: string[]; } | { type: 'move'; itemIds: string[]; }; export type FileManagerActiveActionType = FileManagerActiveAction['type']; /** * PHI-safe projection of an item — structural metadata only, never the * display name. This is the shape the agent's always-on state exposes. * `documentType` / `signatureStatus` are non-identifying categories, safe to * surface for filtering and reasoning. */ export interface FileManagerItemMeta { id: string; kind: FileManagerItemKind; parentId: string | null; size?: number; updatedAt?: string; documentType?: string; signatureStatus?: FileManagerSignatureStatus; } /** * Curated imperative handle — the only programmable surface (agent registry * + `forwardRef`). Reads return identifiers and structural state; the sole * name-returning read (`getItemNames`) is surfaced by the agent adapter as a * `safety: 'phi'` action, never through always-on state. */ export interface FileManagerHandle { getSelection: () => string[]; setSelection: (ids: string[]) => void; clearSelection: () => void; getCurrentFolderId: () => string | null; navigateTo: (folderId: string | null) => void; /** Document-type filter (empty = no filter). Proxies to the DataTable column filter. */ getTypeFilter: () => string[]; setTypeFilter: (documentTypes: string[]) => void; /** * Metadata for every item (no argument), or for the children of one folder * (`null` = root). Never includes names — see `getItemNames`. */ getItems: (folderId?: string | null) => FileManagerItemMeta[]; /** Name-returning read — PHI. Exposed by the agent only via a `phi` action. */ getItemNames: (ids: string[]) => Array<{ id: string; name: string; }>; /** Folders navigate; files resolve through the host `onOpenFile` callback. */ openItem: (id: string) => void; /** Open the inline-rename dialog for an item (no-op if rename is denied). */ startRename: (id: string) => void; getActiveAction: () => FileManagerActiveActionType; } //# sourceMappingURL=types.d.ts.map