@dimah-s3/ui 1.2.1 → 1.4.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,4 @@
1
+ export declare function DismissAttachmentAction({ onDismiss, }: {
2
+ onDismiss: () => void;
3
+ }): import("react").JSX.Element;
4
+ //# sourceMappingURL=dismiss-attachment-action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dismiss-attachment-action.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/attachment/dismiss-attachment-action.tsx"],"names":[],"mappings":"AAMA,wBAAgB,uBAAuB,CAAC,EACtC,SAAS,GACV,EAAE;IACD,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB,+BAgBA"}
@@ -1,5 +1,5 @@
1
1
  import type { ReactNode } from "react";
2
- import { type DimahS3Error } from "@dimah-s3/core";
2
+ import { type APIError } from "@dimah-s3/core";
3
3
  import { type AttachmentOrientation, type AttachmentSize, type AttachmentState } from "../../../lib/attachment-layout";
4
4
  export type FileAttachmentProps = {
5
5
  /** @default "sm" */
@@ -17,10 +17,12 @@ export type FileAttachmentProps = {
17
17
  percent?: number;
18
18
  /** Secondary line; defaults to size, or error text when `state="error"`. */
19
19
  description?: ReactNode;
20
- error?: string | DimahS3Error | null;
20
+ error?: string | APIError | null;
21
21
  onCancel?: () => void;
22
22
  onPause?: () => void;
23
+ /** Shown when `state` is `done` or `error`. Typically the hook `reset()`. */
24
+ onDismiss?: () => void;
23
25
  className?: string;
24
26
  };
25
- export declare function FileAttachment({ state, fileName, fileSize, fileType, previewUrl, percent, description, error, onCancel, onPause, size, orientation, className, }: FileAttachmentProps): import("react").JSX.Element;
27
+ export declare function FileAttachment({ state, fileName, fileSize, fileType, previewUrl, percent, description, error, onCancel, onPause, onDismiss, size, orientation, className, }: FileAttachmentProps): import("react").JSX.Element;
26
28
  //# sourceMappingURL=file-attachment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"file-attachment.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/attachment/file-attachment.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAC;AAaxB,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACnB,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAC;AAajC,MAAM,MAAM,mBAAmB,GAAG;IAChC,oBAAoB;IACpB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,4BAA4B;IAC5B,WAAW,CAAC,EAAE,qBAAqB,CAAC;IACpC,KAAK,EAAE,eAAe,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,uEAAuE;IACvE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,OAAW,EACX,WAAW,EACX,KAAK,EACL,QAAQ,EACR,OAAO,EACP,IAAW,EACX,WAA0B,EAC1B,SAAS,GACV,EAAE,mBAAmB,+BAiHrB"}
1
+ {"version":3,"file":"file-attachment.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/attachment/file-attachment.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAGL,KAAK,QAAQ,EACd,MAAM,gBAAgB,CAAC;AAcxB,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACnB,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAC;AAajC,MAAM,MAAM,mBAAmB,GAAG;IAChC,oBAAoB;IACpB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,4BAA4B;IAC5B,WAAW,CAAC,EAAE,qBAAqB,CAAC;IACpC,KAAK,EAAE,eAAe,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,uEAAuE;IACvE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,OAAW,EACX,WAAW,EACX,KAAK,EACL,QAAQ,EACR,OAAO,EACP,SAAS,EACT,IAAW,EACX,WAA0B,EAC1B,SAAS,GACV,EAAE,mBAAmB,+BAqHrB"}
@@ -10,11 +10,13 @@ export type StatusAttachmentProps = {
10
10
  description?: ReactNode;
11
11
  media?: ReactNode;
12
12
  actions?: ReactNode;
13
+ /** Dismiss control in `AttachmentActions`. Typically the hook `reset()`. */
14
+ onDismiss?: () => void;
13
15
  className?: string;
14
16
  };
15
17
  /**
16
18
  * Minimal Attachment shell for operation feedback (upload/download/delete).
17
19
  * Relies on Attachment `data-state` styles for error/done chrome.
18
20
  */
19
- export declare function StatusAttachment({ state, title, description, media, actions, size, orientation, className, }: StatusAttachmentProps): import("react").JSX.Element;
21
+ export declare function StatusAttachment({ state, title, description, media, actions, onDismiss, size, orientation, className, }: StatusAttachmentProps): import("react").JSX.Element;
20
22
  //# sourceMappingURL=status-attachment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"status-attachment.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/attachment/status-attachment.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAcvC,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACnB,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAC;AAGjC,MAAM,MAAM,qBAAqB,GAAG;IAClC,oBAAoB;IACpB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,4BAA4B;IAC5B,WAAW,CAAC,EAAE,qBAAqB,CAAC;IACpC,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,KAAK,EACL,WAAW,EACX,KAAK,EACL,OAAO,EACP,IAAW,EACX,WAA0B,EAC1B,SAAS,GACV,EAAE,qBAAqB,+BAwCvB"}
1
+ {"version":3,"file":"status-attachment.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/attachment/status-attachment.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAevC,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACnB,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAC;AAGjC,MAAM,MAAM,qBAAqB,GAAG;IAClC,oBAAoB;IACpB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,4BAA4B;IAC5B,WAAW,CAAC,EAAE,qBAAqB,CAAC;IACpC,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,KAAK,EACL,WAAW,EACX,KAAK,EACL,OAAO,EACP,SAAS,EACT,IAAW,EACX,WAA0B,EAC1B,SAAS,GACV,EAAE,qBAAqB,+BA6CvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"multi-upload-status.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/upload/multi-upload-status.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAmB,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAIxE,OAAO,KAAK,EACV,uBAAuB,EAGxB,MAAM,yBAAyB,CAAC;AAQjC,MAAM,MAAM,sBAAsB,GAAG,uBAAuB,GAAG;IAC7D,MAAM,EAAE,eAAe,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAChC,MAAM,EACN,cAAc,EACd,qBAAqB,EACrB,SAAS,GACV,EAAE,sBAAsB,sCAmHxB"}
1
+ {"version":3,"file":"multi-upload-status.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/upload/multi-upload-status.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAmB,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAIxE,OAAO,KAAK,EACV,uBAAuB,EAGxB,MAAM,yBAAyB,CAAC;AAQjC,MAAM,MAAM,sBAAsB,GAAG,uBAAuB,GAAG;IAC7D,MAAM,EAAE,eAAe,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAChC,MAAM,EACN,cAAc,EACd,qBAAqB,EACrB,SAAS,GACV,EAAE,sBAAsB,sCAqHxB"}
@@ -1,16 +1,18 @@
1
- import type { DimahS3Error, UploadFileState, UploadPhase, UseUploadReturn } from "@dimah-s3/react";
1
+ import type { APIError, UploadFileState, UploadPhase, UseUploadReturn } from "@dimah-s3/react";
2
2
  import type { AttachmentLayoutAliases, AttachmentLayoutProps } from "../../../lib/attachment-layout";
3
3
  export type UploadFileStatusProps = AttachmentLayoutProps & {
4
4
  phase: UploadPhase;
5
- error: DimahS3Error | null;
5
+ error: APIError | null;
6
6
  file: UploadFileState | null;
7
7
  onCancel?: () => void;
8
8
  /** When set (typically with an `uploadStore`), shows a pause control. */
9
9
  onPause?: () => void;
10
+ /** Clears a completed or failed row. Typically `upload.reset`. */
11
+ onDismiss?: () => void;
10
12
  className?: string;
11
13
  };
12
14
  /** Presentational row for a single file. Prefer {@link UploadStatus} with `upload`. */
13
- export declare function UploadFileStatus({ phase, error, file, onCancel, onPause, size, orientation, className, }: UploadFileStatusProps): import("react").JSX.Element | null;
15
+ export declare function UploadFileStatus({ phase, error, file, onCancel, onPause, onDismiss, size, orientation, className, }: UploadFileStatusProps): import("react").JSX.Element | null;
14
16
  export type UploadStatusProps = AttachmentLayoutAliases & {
15
17
  upload: UseUploadReturn;
16
18
  className?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"upload-status.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/upload/upload-status.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EACf,WAAW,EACX,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAIzB,OAAO,KAAK,EACV,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,qBAAqB,GAAG,qBAAqB,GAAG;IAC1D,KAAK,EAAE,WAAW,CAAC;IACnB,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IAC3B,IAAI,EAAE,eAAe,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,uFAAuF;AACvF,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,WAAW,EACX,SAAS,GACV,EAAE,qBAAqB,sCA0GvB;AAED,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,GAAG;IACxD,MAAM,EAAE,eAAe,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,gEAAgE;AAChE,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,cAAc,EACd,qBAAqB,EACrB,SAAS,GACV,EAAE,iBAAiB,+BA8BnB"}
1
+ {"version":3,"file":"upload-status.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/upload/upload-status.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,QAAQ,EACR,eAAe,EACf,WAAW,EACX,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAIzB,OAAO,KAAK,EACV,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,qBAAqB,GAAG,qBAAqB,GAAG;IAC1D,KAAK,EAAE,WAAW,CAAC;IACnB,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAC;IACvB,IAAI,EAAE,eAAe,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,uFAAuF;AACvF,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,SAAS,EACT,IAAI,EACJ,WAAW,EACX,SAAS,GACV,EAAE,qBAAqB,sCA6GvB;AAED,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,GAAG;IACxD,MAAM,EAAE,eAAe,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,gEAAgE;AAChE,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,cAAc,EACd,qBAAqB,EACrB,SAAS,GACV,EAAE,iBAAiB,+BAgCnB"}
@@ -8,7 +8,7 @@ export type UseDeleteUiOptions = AttachmentLayoutAliases & {
8
8
  /**
9
9
  * Toasts + success/error status for a `useDelete` return.
10
10
  * Status only renders for the matching `objectKey` so a list can share
11
- * one hook instance.
11
+ * one hook instance. Dismiss calls `delete.reset()`.
12
12
  */
13
13
  export declare function useDeleteUi(del: UseDeleteReturn, { toast: enableToast, objectKey, displayName, attachmentSize, attachmentOrientation, }: UseDeleteUiOptions): {
14
14
  statusNode: import("react").JSX.Element | null;
@@ -1 +1 @@
1
- {"version":3,"file":"use-delete-ui.d.ts","sourceRoot":"","sources":["../../src/hooks/use-delete-ui.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAuB,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAI5E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAEvE,MAAM,MAAM,kBAAkB,GAAG,uBAAuB,GAAG;IACzD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,eAAe,EACpB,EACE,KAAK,EAAE,WAAkB,EACzB,SAAS,EACT,WAAW,EACX,cAAc,EACd,qBAAqB,GACtB,EAAE,kBAAkB;;EAkCtB"}
1
+ {"version":3,"file":"use-delete-ui.d.ts","sourceRoot":"","sources":["../../src/hooks/use-delete-ui.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAuB,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAI5E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAEvE,MAAM,MAAM,kBAAkB,GAAG,uBAAuB,GAAG;IACzD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,eAAe,EACpB,EACE,KAAK,EAAE,WAAkB,EACzB,SAAS,EACT,WAAW,EACX,cAAc,EACd,qBAAqB,GACtB,EAAE,kBAAkB;;EAoCtB"}
@@ -7,11 +7,13 @@ export type UseDownloadUiOptions = AttachmentLayoutAliases & {
7
7
  fileSize?: number;
8
8
  };
9
9
  /**
10
- * Toasts + error status for a `useDownload` return.
10
+ * Toasts + success/error status for a `useDownload` return.
11
11
  * Status only renders for the matching `objectKey` so a list can share
12
- * one hook instance.
12
+ * one hook instance. Dismiss calls `download.reset()`.
13
13
  */
14
14
  export declare function useDownloadUi(download: UseDownloadReturn, { toast: enableToast, objectKey, fileName, fileSize, attachmentSize, attachmentOrientation, }: UseDownloadUiOptions): {
15
- statusNode: import("react").JSX.Element | null;
15
+ statusNode: null;
16
+ } | {
17
+ statusNode: import("react").JSX.Element;
16
18
  };
17
19
  //# sourceMappingURL=use-download-ui.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-download-ui.d.ts","sourceRoot":"","sources":["../../src/hooks/use-download-ui.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAuB,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAI9E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAEvE,MAAM,MAAM,oBAAoB,GAAG,uBAAuB,GAAG;IAC3D,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,iBAAiB,EAC3B,EACE,KAAK,EAAE,WAAkB,EACzB,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,qBAAqB,GACtB,EAAE,oBAAoB;;EAyBxB"}
1
+ {"version":3,"file":"use-download-ui.d.ts","sourceRoot":"","sources":["../../src/hooks/use-download-ui.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAuB,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAI9E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAEvE,MAAM,MAAM,oBAAoB,GAAG,uBAAuB,GAAG;IAC3D,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,iBAAiB,EAC3B,EACE,KAAK,EAAE,WAAkB,EACzB,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,qBAAqB,GACtB,EAAE,oBAAoB;;;;EAiDxB"}
package/dist/index.js CHANGED
@@ -313,6 +313,24 @@ function CircleProgress({
313
313
  }
314
314
  );
315
315
  }
316
+ function DismissAttachmentAction({
317
+ onDismiss
318
+ }) {
319
+ const t = useTranslations();
320
+ return /* @__PURE__ */ jsx(
321
+ AttachmentAction,
322
+ {
323
+ type: "button",
324
+ "aria-label": t("Dismiss", { note: "attachment action" }),
325
+ onClick: (e) => {
326
+ e.preventDefault();
327
+ e.stopPropagation();
328
+ onDismiss();
329
+ },
330
+ children: /* @__PURE__ */ jsx(XIcon, {})
331
+ }
332
+ );
333
+ }
316
334
  var CURATED_EXTS = [
317
335
  // documents
318
336
  "pdf",
@@ -490,6 +508,7 @@ function FileAttachment({
490
508
  error,
491
509
  onCancel,
492
510
  onPause,
511
+ onDismiss,
493
512
  size = "sm",
494
513
  orientation = "horizontal",
495
514
  className
@@ -500,7 +519,9 @@ function FileAttachment({
500
519
  const hasPreview = Boolean(previewUrl);
501
520
  const progress = PROGRESS_BY_SIZE[size];
502
521
  const resolvedDescription = description ?? (state === "error" ? errorText ?? t("Upload failed", { note: "status" }) : fileSize != null ? formatFileSize(fileSize) : null);
503
- const showActions = (state === "uploading" || state === "processing") && (onCancel != null || onPause != null);
522
+ const inFlight = state === "uploading" || state === "processing";
523
+ const showInFlightActions = inFlight && (onCancel != null || onPause != null);
524
+ const showDismiss = (state === "done" || state === "error") && onDismiss != null;
504
525
  const showProgressOverlay = state === "uploading" || state === "processing" || state === "idle";
505
526
  const mediaOverlay = showProgressOverlay ? /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-dimah-s3-background/60", children: /* @__PURE__ */ jsx(
506
527
  CircleProgress,
@@ -543,8 +564,8 @@ function FileAttachment({
543
564
  }
544
565
  ) : null
545
566
  ] }),
546
- showActions ? /* @__PURE__ */ jsxs(AttachmentActions, { children: [
547
- onPause ? /* @__PURE__ */ jsx(
567
+ showInFlightActions || showDismiss ? /* @__PURE__ */ jsxs(AttachmentActions, { children: [
568
+ showInFlightActions && onPause ? /* @__PURE__ */ jsx(
548
569
  AttachmentAction,
549
570
  {
550
571
  "aria-label": t("Pause", { note: "upload control" }),
@@ -555,7 +576,7 @@ function FileAttachment({
555
576
  children: /* @__PURE__ */ jsx(PauseIcon, {})
556
577
  }
557
578
  ) : null,
558
- onCancel ? /* @__PURE__ */ jsx(
579
+ showInFlightActions && onCancel ? /* @__PURE__ */ jsx(
559
580
  AttachmentAction,
560
581
  {
561
582
  "aria-label": t("Cancel", { note: "upload control" }),
@@ -565,7 +586,8 @@ function FileAttachment({
565
586
  },
566
587
  children: /* @__PURE__ */ jsx(XIcon, {})
567
588
  }
568
- ) : null
589
+ ) : null,
590
+ showDismiss && onDismiss ? /* @__PURE__ */ jsx(DismissAttachmentAction, { onDismiss }) : null
569
591
  ] }) : null
570
592
  ]
571
593
  }
@@ -577,6 +599,7 @@ function StatusAttachment({
577
599
  description,
578
600
  media,
579
601
  actions,
602
+ onDismiss,
580
603
  size = "sm",
581
604
  orientation = "horizontal",
582
605
  className
@@ -604,7 +627,10 @@ function StatusAttachment({
604
627
  }
605
628
  ) : null
606
629
  ] }),
607
- actions ? /* @__PURE__ */ jsx(AttachmentActions, { children: actions }) : null
630
+ actions || onDismiss ? /* @__PURE__ */ jsxs(AttachmentActions, { children: [
631
+ actions,
632
+ onDismiss ? /* @__PURE__ */ jsx(DismissAttachmentAction, { onDismiss }) : null
633
+ ] }) : null
608
634
  ]
609
635
  }
610
636
  );
@@ -756,6 +782,7 @@ function MultiUploadStatus({
756
782
  note: "status",
757
783
  variables: { count: String(files.length) }
758
784
  }),
785
+ onDismiss: upload.reset,
759
786
  ...layout
760
787
  }
761
788
  ),
@@ -770,6 +797,7 @@ function MultiUploadStatus({
770
797
  state: "error",
771
798
  title: t("Upload failed", { note: "status" }),
772
799
  description: errorText ?? void 0,
800
+ onDismiss: upload.reset,
773
801
  ...layout
774
802
  }
775
803
  ),
@@ -832,6 +860,7 @@ function UploadFileStatus({
832
860
  file,
833
861
  onCancel,
834
862
  onPause,
863
+ onDismiss,
835
864
  size,
836
865
  orientation,
837
866
  className
@@ -869,6 +898,7 @@ function UploadFileStatus({
869
898
  fileSize: file.size,
870
899
  fileType: file.type,
871
900
  previewUrl: file.previewUrl,
901
+ onDismiss,
872
902
  ...layout
873
903
  }
874
904
  );
@@ -884,6 +914,7 @@ function UploadFileStatus({
884
914
  fileType: file.type,
885
915
  previewUrl: file.previewUrl,
886
916
  error: errorText,
917
+ onDismiss,
887
918
  ...layout
888
919
  }
889
920
  );
@@ -894,6 +925,7 @@ function UploadFileStatus({
894
925
  state: "error",
895
926
  title: t("Upload failed", { note: "status" }),
896
927
  description: errorText ?? void 0,
928
+ onDismiss,
897
929
  ...layout
898
930
  }
899
931
  );
@@ -937,6 +969,7 @@ function UploadStatus({
937
969
  };
938
970
  const onCancel = upload.cancel;
939
971
  const onPause = upload.resumable ? upload.detach : void 0;
972
+ const onDismiss = upload.reset;
940
973
  if (upload.files.length > 1) {
941
974
  return /* @__PURE__ */ jsx(
942
975
  MultiUploadStatus,
@@ -956,6 +989,7 @@ function UploadStatus({
956
989
  file: upload.file,
957
990
  onCancel,
958
991
  onPause,
992
+ onDismiss,
959
993
  ...layout
960
994
  }
961
995
  );
@@ -1629,17 +1663,41 @@ function useDownloadUi(download, {
1629
1663
  const t = useTranslations();
1630
1664
  const formatError = useFormatDimahError();
1631
1665
  const isThis = download.objectKey === objectKey;
1632
- const statusNode = !isThis || download.phase !== "error" ? null : /* @__PURE__ */ jsx(
1633
- StatusAttachment,
1634
- {
1635
- state: "error",
1636
- title: t("Download failed", { note: "status" }),
1637
- description: download.error ? formatError(download.error) : void 0,
1638
- size: attachmentSize,
1639
- orientation: attachmentOrientation
1640
- }
1641
- );
1642
- return { statusNode };
1666
+ const layout = {
1667
+ size: attachmentSize,
1668
+ orientation: attachmentOrientation
1669
+ };
1670
+ if (!isThis) {
1671
+ return { statusNode: null };
1672
+ }
1673
+ if (download.phase === "error") {
1674
+ return {
1675
+ statusNode: /* @__PURE__ */ jsx(
1676
+ StatusAttachment,
1677
+ {
1678
+ state: "error",
1679
+ title: t("Download failed", { note: "status" }),
1680
+ description: download.error ? formatError(download.error) : void 0,
1681
+ onDismiss: download.reset,
1682
+ ...layout
1683
+ }
1684
+ )
1685
+ };
1686
+ }
1687
+ if (download.phase === "success") {
1688
+ return {
1689
+ statusNode: /* @__PURE__ */ jsx(
1690
+ StatusAttachment,
1691
+ {
1692
+ state: "done",
1693
+ title: t("Download complete", { note: "status" }),
1694
+ onDismiss: download.reset,
1695
+ ...layout
1696
+ }
1697
+ )
1698
+ };
1699
+ }
1700
+ return { statusNode: null };
1643
1701
  }
1644
1702
  function DownloadButton({
1645
1703
  download,
@@ -1987,6 +2045,7 @@ function useDeleteUi(del, {
1987
2045
  note: "status",
1988
2046
  variables: { name: truncateFileName(displayName) }
1989
2047
  }),
2048
+ onDismiss: del.reset,
1990
2049
  size: attachmentSize,
1991
2050
  orientation: attachmentOrientation
1992
2051
  }
@@ -1996,6 +2055,7 @@ function useDeleteUi(del, {
1996
2055
  state: "error",
1997
2056
  title: t("Delete failed", { note: "status" }),
1998
2057
  description: del.error ? formatError(del.error) : void 0,
2058
+ onDismiss: del.reset,
1999
2059
  size: attachmentSize,
2000
2060
  orientation: attachmentOrientation
2001
2061
  }