@starasia/admin 14.17.1 → 14.18.0

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.
@@ -0,0 +1,55 @@
1
+ import { default as React } from 'react';
2
+
3
+ export interface PreviewAttachment {
4
+ /** Display name shown in the header. */
5
+ fileName: string;
6
+ /** Source URL used for the preview (and for "open in new tab"). */
7
+ fileUrl: string;
8
+ /** Optional MIME type — improves auto-detection over the URL extension. */
9
+ mimeType?: string;
10
+ }
11
+ export type AttachmentKind = "image" | "pdf" | "video" | "audio" | "other";
12
+ export interface AttachmentPreviewLabels {
13
+ download?: string;
14
+ close?: string;
15
+ openInNewTab?: string;
16
+ /** Shown for files that cannot be previewed, above the "open in new tab" action. */
17
+ unsupported?: string;
18
+ }
19
+ export interface AttachmentPreviewProps {
20
+ /** The attachment to preview. `null` renders nothing (treated as closed). */
21
+ attachment: PreviewAttachment | null;
22
+ /** Called when the dialog is dismissed (close button, backdrop, or Escape). */
23
+ onClose: () => void;
24
+ /**
25
+ * Optional download handler. When provided, a "Download" button appears in the
26
+ * header — use it for authenticated/tracked downloads. Omit to hide the button.
27
+ */
28
+ onDownload?: () => void;
29
+ /** Marks the download button as busy (spinner + disabled). */
30
+ isDownloading?: boolean;
31
+ /** Force the preview kind instead of auto-detecting from mimeType/extension. */
32
+ kind?: AttachmentKind;
33
+ /** Dialog max width. Defaults to a wider value for PDFs. */
34
+ maxWidth?: number | string;
35
+ /** Overridable text labels (i18n). */
36
+ labels?: AttachmentPreviewLabels;
37
+ }
38
+ /**
39
+ * Modal preview for a single file attachment. Renders images, PDFs, video and
40
+ * audio inline (auto-detected from `mimeType` or the URL extension) and falls
41
+ * back to an "open in new tab" action for anything else. Built on the design
42
+ * system `Dialog`, so backdrop, Escape, focus trap and portal are handled.
43
+ *
44
+ * Controlled via `attachment`: pass the file to open it, `null` to close.
45
+ *
46
+ * ```tsx
47
+ * <AttachmentPreview
48
+ * attachment={selected}
49
+ * onClose={() => setSelected(null)}
50
+ * onDownload={handleDownload}
51
+ * isDownloading={isDownloading}
52
+ * />
53
+ * ```
54
+ */
55
+ export declare const AttachmentPreview: React.FC<AttachmentPreviewProps>;
@@ -0,0 +1 @@
1
+ export * from './AttachmentPreview';
@@ -31,6 +31,7 @@ export * from './FullSection';
31
31
  export * from './SelectButton';
32
32
  export * from './LayoutDialog';
33
33
  export * from './ImagePreview';
34
+ export * from './AttachmentPreview';
34
35
  export * from './SelectionActionBar';
35
36
  export * from './EntityCard';
36
37
  export * from './Highlight';