@dimah-s3/ui 1.7.1 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -16
- package/css/shadcn.css +57 -23
- package/dist/components/dimah-s3/attachment/circle-progress.d.ts +14 -5
- package/dist/components/dimah-s3/attachment/circle-progress.d.ts.map +1 -1
- package/dist/components/dimah-s3/attachment/dismiss-attachment-action.d.ts +6 -2
- package/dist/components/dimah-s3/attachment/dismiss-attachment-action.d.ts.map +1 -1
- package/dist/components/dimah-s3/attachment/file-attachment.d.ts +33 -18
- package/dist/components/dimah-s3/attachment/file-attachment.d.ts.map +1 -1
- package/dist/components/dimah-s3/attachment/file-name.d.ts +18 -0
- package/dist/components/dimah-s3/attachment/file-name.d.ts.map +1 -0
- package/dist/{lib/file-type-icon.d.ts → components/dimah-s3/attachment/file-type-glyph.d.ts} +5 -11
- package/dist/components/dimah-s3/attachment/file-type-glyph.d.ts.map +1 -0
- package/dist/components/dimah-s3/attachment/folder-glyph.d.ts +9 -0
- package/dist/components/dimah-s3/attachment/folder-glyph.d.ts.map +1 -0
- package/dist/components/dimah-s3/attachment/status-attachment.d.ts +9 -11
- package/dist/components/dimah-s3/attachment/status-attachment.d.ts.map +1 -1
- package/dist/components/dimah-s3/delete/delete-confirm-dialog.d.ts +20 -0
- package/dist/components/dimah-s3/delete/delete-confirm-dialog.d.ts.map +1 -0
- package/dist/components/dimah-s3/delete/delete-toasts.d.ts +34 -0
- package/dist/components/dimah-s3/delete/delete-toasts.d.ts.map +1 -0
- package/dist/components/dimah-s3/delete/delete-trigger.d.ts +18 -0
- package/dist/components/dimah-s3/delete/delete-trigger.d.ts.map +1 -0
- package/dist/components/dimah-s3/delete/delete.d.ts +83 -0
- package/dist/components/dimah-s3/delete/delete.d.ts.map +1 -0
- package/dist/components/dimah-s3/download/download-progress.d.ts +16 -0
- package/dist/components/dimah-s3/download/download-progress.d.ts.map +1 -0
- package/dist/components/dimah-s3/download/download-toasts.d.ts +25 -0
- package/dist/components/dimah-s3/download/download-toasts.d.ts.map +1 -0
- package/dist/components/dimah-s3/download/download-trigger.d.ts +32 -0
- package/dist/components/dimah-s3/download/download-trigger.d.ts.map +1 -0
- package/dist/components/dimah-s3/download/download.d.ts +30 -0
- package/dist/components/dimah-s3/download/download.d.ts.map +1 -0
- package/dist/components/dimah-s3/list/object-list-breadcrumb.d.ts +6 -5
- package/dist/components/dimah-s3/list/object-list-breadcrumb.d.ts.map +1 -1
- package/dist/components/dimah-s3/list/object-list-content.d.ts +8 -0
- package/dist/components/dimah-s3/list/object-list-content.d.ts.map +1 -0
- package/dist/components/dimah-s3/list/object-list-context.d.ts +76 -0
- package/dist/components/dimah-s3/list/object-list-context.d.ts.map +1 -0
- package/dist/components/dimah-s3/list/object-list-controls.d.ts +46 -0
- package/dist/components/dimah-s3/list/object-list-controls.d.ts.map +1 -0
- package/dist/components/dimah-s3/list/object-list-entry.d.ts +28 -0
- package/dist/components/dimah-s3/list/object-list-entry.d.ts.map +1 -0
- package/dist/components/dimah-s3/list/object-list-feedback.d.ts +26 -0
- package/dist/components/dimah-s3/list/object-list-feedback.d.ts.map +1 -0
- package/dist/components/dimah-s3/list/object-list-header.d.ts +81 -0
- package/dist/components/dimah-s3/list/object-list-header.d.ts.map +1 -0
- package/dist/components/dimah-s3/list/object-list-item-menu.d.ts +65 -0
- package/dist/components/dimah-s3/list/object-list-item-menu.d.ts.map +1 -0
- package/dist/components/dimah-s3/list/object-list-keyboard.d.ts +21 -0
- package/dist/components/dimah-s3/list/object-list-keyboard.d.ts.map +1 -0
- package/dist/components/dimah-s3/list/object-list-states.d.ts +25 -11
- package/dist/components/dimah-s3/list/object-list-states.d.ts.map +1 -1
- package/dist/components/dimah-s3/list/object-list-upload.d.ts +29 -6
- package/dist/components/dimah-s3/list/object-list-upload.d.ts.map +1 -1
- package/dist/components/dimah-s3/list/object-list-usage.d.ts +8 -6
- package/dist/components/dimah-s3/list/object-list-usage.d.ts.map +1 -1
- package/dist/components/dimah-s3/list/object-list.d.ts +78 -137
- package/dist/components/dimah-s3/list/object-list.d.ts.map +1 -1
- package/dist/components/dimah-s3/preview/object-card.d.ts +38 -0
- package/dist/components/dimah-s3/preview/object-card.d.ts.map +1 -0
- package/dist/components/dimah-s3/preview/object-image.d.ts +30 -0
- package/dist/components/dimah-s3/preview/object-image.d.ts.map +1 -0
- package/dist/components/dimah-s3/upload/avatar-upload.d.ts +47 -0
- package/dist/components/dimah-s3/upload/avatar-upload.d.ts.map +1 -0
- package/dist/components/dimah-s3/upload/upload-dropzone.d.ts +48 -25
- package/dist/components/dimah-s3/upload/upload-dropzone.d.ts.map +1 -1
- package/dist/components/dimah-s3/upload/upload-field.d.ts +96 -0
- package/dist/components/dimah-s3/upload/upload-field.d.ts.map +1 -0
- package/dist/components/dimah-s3/upload/upload-file-list.d.ts +34 -0
- package/dist/components/dimah-s3/upload/upload-file-list.d.ts.map +1 -0
- package/dist/components/dimah-s3/upload/upload-status.d.ts +25 -20
- package/dist/components/dimah-s3/upload/upload-status.d.ts.map +1 -1
- package/dist/components/dimah-s3/upload/upload-toasts.d.ts +23 -0
- package/dist/components/dimah-s3/upload/upload-toasts.d.ts.map +1 -0
- package/dist/components/dimah-s3/upload/upload-trigger.d.ts +23 -0
- package/dist/components/dimah-s3/upload/upload-trigger.d.ts.map +1 -0
- package/dist/components/dimah-s3/upload/upload.d.ts +79 -0
- package/dist/components/dimah-s3/upload/upload.d.ts.map +1 -0
- package/dist/hooks/use-file-preview.d.ts +7 -0
- package/dist/hooks/use-file-preview.d.ts.map +1 -0
- package/dist/hooks/use-own-drag.d.ts +17 -0
- package/dist/hooks/use-own-drag.d.ts.map +1 -0
- package/dist/hooks/use-paste-files.d.ts +18 -0
- package/dist/hooks/use-paste-files.d.ts.map +1 -0
- package/dist/hooks/use-toast-owner.d.ts +16 -0
- package/dist/hooks/use-toast-owner.d.ts.map +1 -0
- package/dist/index.d.ts +39 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4226 -2676
- package/dist/index.js.map +1 -1
- package/dist/lib/attachment-layout.d.ts +3 -33
- package/dist/lib/attachment-layout.d.ts.map +1 -1
- package/dist/lib/format-expires-in.d.ts +2 -2
- package/dist/lib/format-expires-in.d.ts.map +1 -1
- package/dist/lib/is-field-target.d.ts +6 -0
- package/dist/lib/is-field-target.d.ts.map +1 -0
- package/dist/lib/upload-hints.d.ts +16 -0
- package/dist/lib/upload-hints.d.ts.map +1 -0
- package/package.json +24 -13
- package/styles.css +4 -3
- package/dist/components/dimah-s3/delete/delete-button.d.ts +0 -43
- package/dist/components/dimah-s3/delete/delete-button.d.ts.map +0 -1
- package/dist/components/dimah-s3/download/download-button.d.ts +0 -39
- package/dist/components/dimah-s3/download/download-button.d.ts.map +0 -1
- package/dist/components/dimah-s3/download/progress-download-button.d.ts +0 -44
- package/dist/components/dimah-s3/download/progress-download-button.d.ts.map +0 -1
- package/dist/components/dimah-s3/list/object-list-menu.d.ts +0 -65
- package/dist/components/dimah-s3/list/object-list-menu.d.ts.map +0 -1
- package/dist/components/dimah-s3/list/object-list-rows.d.ts +0 -32
- package/dist/components/dimah-s3/list/object-list-rows.d.ts.map +0 -1
- package/dist/components/dimah-s3/list/object-list-selection-state.d.ts +0 -38
- package/dist/components/dimah-s3/list/object-list-selection-state.d.ts.map +0 -1
- package/dist/components/dimah-s3/list/object-list-selection.d.ts +0 -36
- package/dist/components/dimah-s3/list/object-list-selection.d.ts.map +0 -1
- package/dist/components/dimah-s3/upload/multi-upload-status.d.ts +0 -8
- package/dist/components/dimah-s3/upload/multi-upload-status.d.ts.map +0 -1
- package/dist/components/dimah-s3/upload/upload-button.d.ts +0 -32
- package/dist/components/dimah-s3/upload/upload-button.d.ts.map +0 -1
- package/dist/hooks/use-delete-toast.d.ts +0 -12
- package/dist/hooks/use-delete-toast.d.ts.map +0 -1
- package/dist/hooks/use-delete-ui.d.ts +0 -16
- package/dist/hooks/use-delete-ui.d.ts.map +0 -1
- package/dist/hooks/use-download-toast.d.ts +0 -17
- package/dist/hooks/use-download-toast.d.ts.map +0 -1
- package/dist/hooks/use-download-ui.d.ts +0 -19
- package/dist/hooks/use-download-ui.d.ts.map +0 -1
- package/dist/hooks/use-file-reject-toast.d.ts +0 -7
- package/dist/hooks/use-file-reject-toast.d.ts.map +0 -1
- package/dist/hooks/use-upload-toast.d.ts +0 -7
- package/dist/hooks/use-upload-toast.d.ts.map +0 -1
- package/dist/hooks/use-upload-ui.d.ts +0 -13
- package/dist/hooks/use-upload-ui.d.ts.map +0 -1
- package/dist/lib/file-type-icon.d.ts.map +0 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
/** Props for {@link DownloadProgress}. Other props go to the progressbar element. */
|
|
3
|
+
export type DownloadProgressProps = {
|
|
4
|
+
/** S3 object key whose download to show. */
|
|
5
|
+
objectKey: string;
|
|
6
|
+
} & HTMLAttributes<HTMLDivElement>;
|
|
7
|
+
/**
|
|
8
|
+
* Progress bar for the running `useFetchDownload` call of one key, with the
|
|
9
|
+
* file name and the bytes received. It has `role="progressbar"` and is
|
|
10
|
+
* indeterminate until the total size is known.
|
|
11
|
+
*
|
|
12
|
+
* Renders nothing with `useDownload`, which has no byte progress, and when
|
|
13
|
+
* no call for the key is running.
|
|
14
|
+
*/
|
|
15
|
+
export declare function DownloadProgress({ objectKey, className, "aria-label": ariaLabel, ...props }: DownloadProgressProps): import("react").JSX.Element | null;
|
|
16
|
+
//# sourceMappingURL=download-progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download-progress.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/download/download-progress.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAW5C,qFAAqF;AACrF,MAAM,MAAM,qBAAqB,GAAG;IAClC,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAEnC;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,SAAS,EACT,SAAS,EACT,YAAY,EAAE,SAAS,EACvB,GAAG,KAAK,EACT,EAAE,qBAAqB,sCAiEvB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type AnyDownloadReturn } from "@dimah-s3/react";
|
|
2
|
+
/** Props for {@link DownloadToasts}. */
|
|
3
|
+
export type DownloadToastsProps = {
|
|
4
|
+
/** A `useDownload` or `useFetchDownload` return. */
|
|
5
|
+
download: AnyDownloadReturn;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Shows toasts for every call of one download hook. Mount it once per hook,
|
|
9
|
+
* next to one `<Toaster />`. It renders no element of its own.
|
|
10
|
+
*
|
|
11
|
+
* - `useDownload`: "Download started" once the browser has the URL.
|
|
12
|
+
* - `useFetchDownload`: a "Downloading" toast with the bytes received and a
|
|
13
|
+
* Cancel action, then "Download complete".
|
|
14
|
+
* - Both: "Download failed" with the error, and "Download cancelled".
|
|
15
|
+
*
|
|
16
|
+
* A second `DownloadToasts` for the same hook renders nothing and warns in
|
|
17
|
+
* development. Calls that settled before it mounted are not announced.
|
|
18
|
+
*/
|
|
19
|
+
export declare function DownloadToasts({ download }: DownloadToastsProps): import("react").JSX.Element | null;
|
|
20
|
+
/**
|
|
21
|
+
* Weak owner for `ObjectList`: it shows the same toasts only while no
|
|
22
|
+
* {@link DownloadToasts} is mounted for the hook. @internal
|
|
23
|
+
*/
|
|
24
|
+
export declare function BuiltInDownloadToasts({ download }: DownloadToastsProps): import("react").JSX.Element | null;
|
|
25
|
+
//# sourceMappingURL=download-toasts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download-toasts.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/download/download-toasts.tsx"],"names":[],"mappings":"AAGA,OAAO,EAGL,KAAK,iBAAiB,EAGvB,MAAM,iBAAiB,CAAC;AAWzB,wCAAwC;AACxC,MAAM,MAAM,mBAAmB,GAAG;IAChC,oDAAoD;IACpD,QAAQ,EAAE,iBAAiB,CAAC;CAC7B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE,mBAAmB,sCAG/D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,QAAQ,EAAE,EAAE,mBAAmB,sCAGtE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
2
|
+
import { Button } from "../../ui/button.js";
|
|
3
|
+
/** Props for {@link DownloadTrigger}. Other props go to the `Button`. */
|
|
4
|
+
export type DownloadTriggerProps = ComponentProps<typeof Button> & {
|
|
5
|
+
/**
|
|
6
|
+
* S3 object key to download.
|
|
7
|
+
* Named `objectKey` because React reserves the `key` prop.
|
|
8
|
+
*/
|
|
9
|
+
objectKey: string;
|
|
10
|
+
/** File name the browser saves, fitted to 255 UTF-8 bytes like an upload name. */
|
|
11
|
+
fileName?: string;
|
|
12
|
+
/** Size in bytes. A fetch download uses it as the progress total until the response gives one. */
|
|
13
|
+
fileSize?: number | null;
|
|
14
|
+
/** Tooltip content. No tooltip when omitted. */
|
|
15
|
+
tooltip?: ReactNode;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Button that downloads one object with the hook of the nearest `Download`.
|
|
19
|
+
*
|
|
20
|
+
* - With `useDownload`, it is disabled and shows a spinner while the URL is
|
|
21
|
+
* signed.
|
|
22
|
+
* - With `useFetchDownload`, it fills with the progress while the call runs,
|
|
23
|
+
* and a click cancels the call. Its content becomes "Cancel" and its name
|
|
24
|
+
* "Cancel download of {name}" for that time. The second click of a
|
|
25
|
+
* double-click does not cancel the download the first one started. An
|
|
26
|
+
* icon-size button shows only the cancel icon.
|
|
27
|
+
*
|
|
28
|
+
* `children` replace the default icon and label while no cancel is offered.
|
|
29
|
+
* `data-phase` carries the phase of the newest call for the key.
|
|
30
|
+
*/
|
|
31
|
+
export declare function DownloadTrigger({ objectKey, fileName, fileSize, tooltip, children, className, disabled, focusableWhenDisabled, onClick, variant, size, "aria-label": ariaLabel, ...props }: DownloadTriggerProps): import("react").JSX.Element;
|
|
32
|
+
//# sourceMappingURL=download-trigger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download-trigger.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/download/download-trigger.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAQhD,yEAAyE;AACzE,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,GAAG;IACjE;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,kFAAkF;IAClF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kGAAkG;IAClG,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,gDAAgD;IAChD,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,qBAAqB,EACrB,OAAO,EACP,OAAmB,EACnB,IAAI,EACJ,YAAY,EAAE,SAAS,EACvB,GAAG,KAAK,EACT,EAAE,oBAAoB,+BAoGtB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type AnyDownloadReturn, type DownloadOperation, type FetchDownloadOperation, type TransferProgress } from "@dimah-s3/react";
|
|
3
|
+
/** Props for {@link Download}. */
|
|
4
|
+
export type DownloadProps = {
|
|
5
|
+
/** A `useDownload` or `useFetchDownload` return. */
|
|
6
|
+
download: AnyDownloadReturn;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
};
|
|
9
|
+
/** What {@link useDownloadContext} returns. */
|
|
10
|
+
export type DownloadContextValue = {
|
|
11
|
+
download: AnyDownloadReturn;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Root of the download family. It holds one download hook for the
|
|
15
|
+
* `DownloadTrigger` and `DownloadProgress` parts inside it. It renders no
|
|
16
|
+
* element of its own.
|
|
17
|
+
*/
|
|
18
|
+
export declare function Download({ download, children }: DownloadProps): import("react").JSX.Element;
|
|
19
|
+
/** The hook of the nearest {@link Download}. Use it to build your own parts. */
|
|
20
|
+
export declare function useDownloadContext(): DownloadContextValue;
|
|
21
|
+
/** Whether a download operation is still running. @internal */
|
|
22
|
+
export declare function isDownloadRunning(operation: DownloadOperation | FetchDownloadOperation): boolean;
|
|
23
|
+
/** The name to show for an operation's file. @internal */
|
|
24
|
+
export declare function downloadDisplayName(operation: DownloadOperation | FetchDownloadOperation): string;
|
|
25
|
+
/**
|
|
26
|
+
* Formats the bytes received so far, with the total when it is known.
|
|
27
|
+
* Returns `null` before the first byte when the total is unknown. @internal
|
|
28
|
+
*/
|
|
29
|
+
export declare function useFormatDownloadedBytes(): (progress: TransferProgress) => string | null;
|
|
30
|
+
//# sourceMappingURL=download.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/download/download.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACtB,MAAM,iBAAiB,CAAC;AAGzB,kCAAkC;AAClC,MAAM,MAAM,aAAa,GAAG;IAC1B,oDAAoD;IACpD,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,+CAA+C;AAC/C,MAAM,MAAM,oBAAoB,GAAG;IAAE,QAAQ,EAAE,iBAAiB,CAAA;CAAE,CAAC;AAInE;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,aAAa,+BAO7D;AAED,gFAAgF;AAChF,wBAAgB,kBAAkB,IAAI,oBAAoB,CAQzD;AAED,+DAA+D;AAC/D,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,iBAAiB,GAAG,sBAAsB,GACpD,OAAO,CAET;AAED,0DAA0D;AAC1D,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,iBAAiB,GAAG,sBAAsB,GACpD,MAAM,CAER;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI,CAC1C,QAAQ,EAAE,gBAAgB,KACvB,MAAM,GAAG,IAAI,CAkBjB"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Path from the root to the open folder. It shortens to fit its width,
|
|
3
|
+
* down to the open folder alone, and a menu lists the folders above it.
|
|
4
|
+
*/
|
|
5
|
+
export declare function ObjectListBreadcrumb({ className }: {
|
|
6
|
+
className?: string;
|
|
6
7
|
}): import("react").JSX.Element;
|
|
7
8
|
//# sourceMappingURL=object-list-breadcrumb.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-list-breadcrumb.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/list/object-list-breadcrumb.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"object-list-breadcrumb.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/list/object-list-breadcrumb.tsx"],"names":[],"mappings":"AAgDA;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,+BAkFzE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The rows, or the loading, error, and empty states, and the next page.
|
|
3
|
+
* With `height` or `maxHeight` on the list, this is the part that scrolls.
|
|
4
|
+
*/
|
|
5
|
+
export declare function ObjectListContent({ className }: {
|
|
6
|
+
className?: string;
|
|
7
|
+
}): import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=object-list-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-list-content.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/list/object-list-content.tsx"],"names":[],"mappings":"AAqBA;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,+BAiDtE"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { AnyDownloadReturn, ObjectListEntry, ObjectListFolder, UseDeleteReturn, UseDownloadReturn, UseObjectListReturn, UseObjectListSelectionReturn, UseUploadReturn } from "@dimah-s3/react";
|
|
3
|
+
/** `list` draws one row per entry. `grid` draws tiles with larger previews. */
|
|
4
|
+
export type ObjectListView = "list" | "grid";
|
|
5
|
+
/** Per-entry render hooks. Each returns the default when left out. */
|
|
6
|
+
export type ObjectListRenderers<TItem> = {
|
|
7
|
+
/** Replaces the whole row or tile. Compose `ObjectListRow` or `ObjectListTile` to keep selection. */
|
|
8
|
+
renderEntry?: (entry: ObjectListEntry<TItem>) => ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Trailing controls. Defaults to `ObjectListItemMenu` on files when the
|
|
11
|
+
* list has `download`, `share`, or `delete`, and on folders when files
|
|
12
|
+
* can be uploaded into them. Return `null` to hide them.
|
|
13
|
+
*/
|
|
14
|
+
renderActions?: (entry: ObjectListEntry<TItem>) => ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Second line. Defaults to the size and date of a file. Text only: it
|
|
17
|
+
* sits inside the entry's button. Controls go in `renderActions`.
|
|
18
|
+
*/
|
|
19
|
+
renderDescription?: (entry: ObjectListEntry<TItem>) => ReactNode;
|
|
20
|
+
/** Beside the name, such as a status badge. Text only, like the description. */
|
|
21
|
+
renderMeta?: (entry: ObjectListEntry<TItem>) => ReactNode;
|
|
22
|
+
};
|
|
23
|
+
/** The one-shot result of a list control, such as Copy link. */
|
|
24
|
+
export type ObjectListFeedback = {
|
|
25
|
+
type: "success" | "error" | "info";
|
|
26
|
+
title: string;
|
|
27
|
+
description?: ReactNode;
|
|
28
|
+
};
|
|
29
|
+
/** What `ObjectList` shares with its parts. Read it with {@link useObjectListContext}. */
|
|
30
|
+
export type ObjectListContextValue<TItem> = ObjectListRenderers<TItem> & {
|
|
31
|
+
list: UseObjectListReturn<TItem>;
|
|
32
|
+
selection: UseObjectListSelectionReturn<TItem> | null;
|
|
33
|
+
upload: UseUploadReturn | null;
|
|
34
|
+
download: AnyDownloadReturn | null;
|
|
35
|
+
/** Signs Copy link. Falls back to a navigate-mode `download`. */
|
|
36
|
+
share: UseDownloadReturn | null;
|
|
37
|
+
delete: UseDeleteReturn | null;
|
|
38
|
+
/**
|
|
39
|
+
* The list shows toasts. Off, its controls report through `announce`
|
|
40
|
+
* instead.
|
|
41
|
+
*/
|
|
42
|
+
toasts: boolean;
|
|
43
|
+
/** Reads `feedback` out in the list's polite live region. */
|
|
44
|
+
announce: (feedback: ObjectListFeedback) => void;
|
|
45
|
+
view: ObjectListView;
|
|
46
|
+
setView: (view: ObjectListView) => void;
|
|
47
|
+
/** Root breadcrumb label and the list's accessible name. */
|
|
48
|
+
label: string;
|
|
49
|
+
/** `fixed` with `height`, `max` with `maxHeight`. Rows scroll inside. */
|
|
50
|
+
sizing: "fixed" | "max" | null;
|
|
51
|
+
showBreadcrumb: boolean;
|
|
52
|
+
selectionActions: ReactNode;
|
|
53
|
+
empty: ReactNode;
|
|
54
|
+
loadMore: "auto" | "button";
|
|
55
|
+
onOpenItem: ((item: TItem) => void) | undefined;
|
|
56
|
+
/** Object keys stored in a folder. Lets bulk delete include folders. */
|
|
57
|
+
resolveFolderKeys: ((folder: ObjectListFolder) => Promise<readonly string[]>) | undefined;
|
|
58
|
+
};
|
|
59
|
+
export declare function ObjectListProvider<TItem>({ value, children, }: {
|
|
60
|
+
value: ObjectListContextValue<TItem>;
|
|
61
|
+
children: ReactNode;
|
|
62
|
+
}): import("react").JSX.Element;
|
|
63
|
+
export declare function ObjectListEntryProvider<TItem>({ entry, children, }: {
|
|
64
|
+
entry: ObjectListEntry<TItem>;
|
|
65
|
+
children: ReactNode;
|
|
66
|
+
}): import("react").JSX.Element;
|
|
67
|
+
/**
|
|
68
|
+
* The list, selection, hooks, and view of the nearest `ObjectList`.
|
|
69
|
+
* Use it to build your own parts.
|
|
70
|
+
*/
|
|
71
|
+
export declare function useObjectListContext<TItem = unknown>(): ObjectListContextValue<TItem>;
|
|
72
|
+
/** Like {@link useObjectListContext}, but `null` outside an `ObjectList`. */
|
|
73
|
+
export declare function useOptionalObjectListContext<TItem = unknown>(): ObjectListContextValue<TItem> | null;
|
|
74
|
+
/** The entry a row or tile renders. `null` outside one. */
|
|
75
|
+
export declare function useObjectListEntry<TItem = unknown>(): ObjectListEntry<TItem> | null;
|
|
76
|
+
//# sourceMappingURL=object-list-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-list-context.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/list/object-list-context.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ObjectListSortDirection } from "@dimah-s3/react";
|
|
2
|
+
/** Props for {@link ObjectListSearch}. */
|
|
3
|
+
export type ObjectListSearchProps = {
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
/** Milliseconds to wait after typing before the list reloads. @default 250 */
|
|
6
|
+
delay?: number;
|
|
7
|
+
/**
|
|
8
|
+
* Inside `ObjectListHeader`, start as a search button that opens into a
|
|
9
|
+
* field across the whole bar. `false` keeps the field in the bar. Outside
|
|
10
|
+
* a header the field always shows. @default true
|
|
11
|
+
*/
|
|
12
|
+
collapsible?: boolean;
|
|
13
|
+
className?: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Search for `list.search`. The query receives the text; the source
|
|
17
|
+
* decides what matches (`memoryObjectSource` matches names).
|
|
18
|
+
*
|
|
19
|
+
* Inside `ObjectListHeader` it is a search button. A click opens a field
|
|
20
|
+
* across the whole bar and focuses it; the field stays open while it has
|
|
21
|
+
* text. Escape clears the text, then closes the field. Close search clears
|
|
22
|
+
* and closes it, and focus returns to the button. An empty field also
|
|
23
|
+
* closes when focus leaves it. Render it as a direct child of the header.
|
|
24
|
+
*/
|
|
25
|
+
export declare function ObjectListSearch({ placeholder, delay, collapsible, className, }: ObjectListSearchProps): import("react").JSX.Element;
|
|
26
|
+
/** One choice in {@link ObjectListSortMenu}. */
|
|
27
|
+
export type ObjectListSortOption = {
|
|
28
|
+
/** Sent to the query as `sort.field`. */
|
|
29
|
+
field: string;
|
|
30
|
+
label: string;
|
|
31
|
+
/** Direction when this field is first picked. @default "asc" */
|
|
32
|
+
direction?: ObjectListSortDirection;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Sort picker for `list.sort`. The query receives the order; the source
|
|
36
|
+
* applies it. Defaults to name, size, and date.
|
|
37
|
+
*/
|
|
38
|
+
export declare function ObjectListSortMenu({ options, className, }: {
|
|
39
|
+
options?: readonly ObjectListSortOption[];
|
|
40
|
+
className?: string;
|
|
41
|
+
}): import("react").JSX.Element;
|
|
42
|
+
/** List and grid buttons for the list's `view`. */
|
|
43
|
+
export declare function ObjectListViewToggle({ className }: {
|
|
44
|
+
className?: string;
|
|
45
|
+
}): import("react").JSX.Element;
|
|
46
|
+
//# sourceMappingURL=object-list-controls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-list-controls.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/list/object-list-controls.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAiC/D,0CAA0C;AAC1C,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8EAA8E;IAC9E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,WAAW,EACX,KAAW,EACX,WAAkB,EAClB,SAAS,GACV,EAAE,qBAAqB,+BAkJvB;AAED,gDAAgD;AAChD,MAAM,MAAM,oBAAoB,GAAG;IACjC,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,SAAS,CAAC,EAAE,uBAAuB,CAAC;CACrC,CAAC;AAEF;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,SAAS,GACV,EAAE;IACD,OAAO,CAAC,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,+BA+EA;AAED,mDAAmD;AACnD,wBAAgB,oBAAoB,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,+BAyCzE"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type ObjectListEntry } from "@dimah-s3/react";
|
|
3
|
+
/** Props shared by {@link ObjectListRow} and {@link ObjectListTile}. */
|
|
4
|
+
export type ObjectListEntryProps<TItem> = {
|
|
5
|
+
entry: ObjectListEntry<TItem>;
|
|
6
|
+
className?: string;
|
|
7
|
+
/** Replaces the trailing controls. Defaults to `renderActions`. */
|
|
8
|
+
actions?: ReactNode;
|
|
9
|
+
/** Replaces the second line. Defaults to `renderDescription`. */
|
|
10
|
+
description?: ReactNode;
|
|
11
|
+
/** Beside the name. Defaults to `renderMeta`. */
|
|
12
|
+
meta?: ReactNode;
|
|
13
|
+
/** Replaces the icon or thumbnail. */
|
|
14
|
+
media?: ReactNode;
|
|
15
|
+
};
|
|
16
|
+
/** Checkbox for an entry or the select-all control. Reports Shift. */
|
|
17
|
+
export declare function ObjectListCheckbox({ checked, indeterminate, label, onCheckedChange, className, }: {
|
|
18
|
+
checked: boolean;
|
|
19
|
+
indeterminate?: boolean;
|
|
20
|
+
label: string;
|
|
21
|
+
onCheckedChange: (checked: boolean, shiftKey: boolean) => void;
|
|
22
|
+
className?: string;
|
|
23
|
+
}): import("react").JSX.Element;
|
|
24
|
+
/** One row in the `list` view. */
|
|
25
|
+
export declare function ObjectListRow<TItem>(props: ObjectListEntryProps<TItem>): import("react").JSX.Element;
|
|
26
|
+
/** One tile in the `grid` view. */
|
|
27
|
+
export declare function ObjectListTile<TItem>(props: ObjectListEntryProps<TItem>): import("react").JSX.Element;
|
|
28
|
+
//# sourceMappingURL=object-list-entry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-list-entry.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/list/object-list-entry.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA2B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,iBAAiB,CAAC;AAWzB,wEAAwE;AACxE,MAAM,MAAM,oBAAoB,CAAC,KAAK,IAAI;IACxC,KAAK,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,iEAAiE;IACjE,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,iDAAiD;IACjD,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,sCAAsC;IACtC,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,CAAC;AAEF,sEAAsE;AACtE,wBAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,aAAa,EACb,KAAK,EACL,eAAe,EACf,SAAS,GACV,EAAE;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,+BAuBA;AAMD,kCAAkC;AAClC,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,oBAAoB,CAAC,KAAK,CAAC,+BA4DtE;AAED,mCAAmC;AACnC,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,oBAAoB,CAAC,KAAK,CAAC,+BA6DvE"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type ObjectListFeedback } from "./object-list-context.js";
|
|
2
|
+
/**
|
|
3
|
+
* Reports the one-shot results of a list control, such as Copy link. With
|
|
4
|
+
* the list's `toasts` on, or outside a list, each one is a toast. With them
|
|
5
|
+
* off, the list's {@link ObjectListAnnouncer} reads it out. @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare function useObjectListFeedback(): (feedback: ObjectListFeedback) => void;
|
|
8
|
+
/** The newest feedback for {@link ObjectListAnnouncer}. */
|
|
9
|
+
export type ObjectListAnnouncement = {
|
|
10
|
+
/** New for every message, so the same text is read out again. */
|
|
11
|
+
id: number;
|
|
12
|
+
feedback: ObjectListFeedback;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* State behind the list's `announce`: the newest announcement and the
|
|
16
|
+
* function that sets it. @internal
|
|
17
|
+
*/
|
|
18
|
+
export declare function useObjectListAnnouncement(): {
|
|
19
|
+
announcement: ObjectListAnnouncement | null;
|
|
20
|
+
announce: (feedback: ObjectListFeedback) => void;
|
|
21
|
+
};
|
|
22
|
+
/** Polite live region for list feedback while the list's toasts are off. @internal */
|
|
23
|
+
export declare function ObjectListAnnouncer({ announcement, }: {
|
|
24
|
+
announcement: ObjectListAnnouncement | null;
|
|
25
|
+
}): import("react").JSX.Element;
|
|
26
|
+
//# sourceMappingURL=object-list-feedback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-list-feedback.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/list/object-list-feedback.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,gDAAgD,CAAC;AAExD;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,CACvC,QAAQ,EAAE,kBAAkB,KACzB,IAAI,CAUR;AAED,2DAA2D;AAC3D,MAAM,MAAM,sBAAsB,GAAG;IACnC,iEAAiE;IACjE,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,kBAAkB,CAAC;CAC9B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,yBAAyB;;yBAGC,kBAAkB;EAO3D;AAED,sFAAsF;AACtF,wBAAgB,mBAAmB,CAAC,EAClC,YAAY,GACb,EAAE;IACD,YAAY,EAAE,sBAAsB,GAAG,IAAI,CAAC;CAC7C,+BAiBA"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
/** Props for {@link ObjectListHeader}. */
|
|
3
|
+
export type ObjectListHeaderProps = {
|
|
4
|
+
/** Trailing controls, such as search, sort, view, and upload. */
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
/** Show the path. Defaults to the list's `breadcrumb`. */
|
|
7
|
+
breadcrumb?: boolean;
|
|
8
|
+
/** Extra controls on the selection bar. Defaults to the list's `selectionActions`. */
|
|
9
|
+
selectionActions?: ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
};
|
|
12
|
+
/** What {@link ObjectListHeader} shares with the controls inside it. @internal */
|
|
13
|
+
type ObjectListHeaderContextValue = {
|
|
14
|
+
/** A search field inside the header is open and takes the whole bar. */
|
|
15
|
+
setSearchExpanded: (expanded: boolean) => void;
|
|
16
|
+
/** The new-folder field is open and takes the whole bar. */
|
|
17
|
+
setFolderExpanded: (expanded: boolean) => void;
|
|
18
|
+
};
|
|
19
|
+
/** The nearest {@link ObjectListHeader}, or `null` outside one. @internal */
|
|
20
|
+
export declare function useOptionalObjectListHeader(): ObjectListHeaderContextValue | null;
|
|
21
|
+
/**
|
|
22
|
+
* Hides a label below this header width, so the control shows its icon
|
|
23
|
+
* alone. Outside a header the label always shows.
|
|
24
|
+
*/
|
|
25
|
+
export declare const OBJECT_LIST_HEADER_COMPACT_LABEL = "@max-[36rem]/object-list-header:sr-only";
|
|
26
|
+
/** Makes a labelled `sm` button square while its label hides. */
|
|
27
|
+
export declare const OBJECT_LIST_HEADER_COMPACT_BUTTON = "@max-[36rem]/object-list-header:aspect-square @max-[36rem]/object-list-header:px-0!";
|
|
28
|
+
/**
|
|
29
|
+
* Top bar: select-all, the path, a reload spinner, New folder (when the
|
|
30
|
+
* source can create folders), and `children`. While entries are selected it
|
|
31
|
+
* becomes the selection bar.
|
|
32
|
+
*
|
|
33
|
+
* It lays out by its own width (a container query). The path keeps room
|
|
34
|
+
* for itself and shortens to fit; when the controls do not fit beside it,
|
|
35
|
+
* they move to a second row, aligned to the end. Labels of the built-in
|
|
36
|
+
* controls and `UploadTrigger` hide under 36rem, leaving their icons. An
|
|
37
|
+
* `ObjectListSearch` among `children` shows as a search button, and opens
|
|
38
|
+
* into a field across the whole bar. New folder does the same with its
|
|
39
|
+
* name field: the path and the other controls hide until it closes.
|
|
40
|
+
*/
|
|
41
|
+
export declare function ObjectListHeader({ children, breadcrumb, selectionActions, className, }: ObjectListHeaderProps): import("react").JSX.Element;
|
|
42
|
+
/**
|
|
43
|
+
* Checkbox for every loaded entry. With more pages to load, it selects the
|
|
44
|
+
* rows on screen and says so. Hidden without a multiple selection.
|
|
45
|
+
*/
|
|
46
|
+
export declare function ObjectListSelectAll({ className }: {
|
|
47
|
+
className?: string;
|
|
48
|
+
}): import("react").JSX.Element | null;
|
|
49
|
+
/** Props for {@link ObjectListSelectionBar}. */
|
|
50
|
+
export type ObjectListSelectionBarProps = {
|
|
51
|
+
/** Controls beside Delete. Inert while the selected files delete. */
|
|
52
|
+
actions?: ReactNode;
|
|
53
|
+
className?: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Count, `actions`, bulk Delete (when the list has `delete`), and Clear.
|
|
57
|
+
* Renders nothing while the selection is empty.
|
|
58
|
+
*/
|
|
59
|
+
export declare function ObjectListSelectionBar({ actions, className, }: ObjectListSelectionBarProps): import("react").JSX.Element | null;
|
|
60
|
+
/**
|
|
61
|
+
* Delete button for the selected entries. The list's delete root asks for
|
|
62
|
+
* confirmation. `ObjectListSelectionBar` already has one; use this in a bar
|
|
63
|
+
* of your own.
|
|
64
|
+
*/
|
|
65
|
+
export declare function ObjectListBulkDelete(): import("react").JSX.Element | null;
|
|
66
|
+
/** Props for {@link NewFolderControl}. */
|
|
67
|
+
export type NewFolderControlProps = {
|
|
68
|
+
className?: string;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* New folder button for the open folder. Inside `ObjectListHeader` it opens
|
|
72
|
+
* a name field across the whole bar, and the path and the other controls
|
|
73
|
+
* hide until it closes. Enter creates the folder through the source, and
|
|
74
|
+
* Escape or Cancel closes the field. An invalid or taken name shows a
|
|
75
|
+
* message under the field that describes it. Outside a header the field
|
|
76
|
+
* stays inline. Renders nothing when the source has no `createFolder`.
|
|
77
|
+
* `ObjectListHeader` already has one.
|
|
78
|
+
*/
|
|
79
|
+
export declare function NewFolderControl({ className }: NewFolderControlProps): import("react").JSX.Element | null;
|
|
80
|
+
export {};
|
|
81
|
+
//# sourceMappingURL=object-list-header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-list-header.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/list/object-list-header.tsx"],"names":[],"mappings":"AAEA,OAAO,EAWL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAuBf,0CAA0C;AAC1C,MAAM,MAAM,qBAAqB,GAAG;IAClC,iEAAiE;IACjE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,0DAA0D;IAC1D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,sFAAsF;IACtF,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,kFAAkF;AAClF,KAAK,4BAA4B,GAAG;IAClC,wEAAwE;IACxE,iBAAiB,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C,4DAA4D;IAC5D,iBAAiB,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;CAChD,CAAC;AAKF,6EAA6E;AAC7E,wBAAgB,2BAA2B,wCAE1C;AAED;;;GAGG;AACH,eAAO,MAAM,gCAAgC,4CACF,CAAC;AAE5C,iEAAiE;AACjE,eAAO,MAAM,iCAAiC,wFACyC,CAAC;AAExF;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,SAAS,GACV,EAAE,qBAAqB,+BAqEvB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,sCA0BxE;AAED,gDAAgD;AAChD,MAAM,MAAM,2BAA2B,GAAG;IACxC,qEAAqE;IACrE,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,OAAO,EACP,SAAS,GACV,EAAE,2BAA2B,sCA2D7B;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,uCAInC;AA4GD,0CAA0C;AAC1C,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,SAAS,EAAE,EAAE,qBAAqB,sCAsDpE"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type UseDownloadReturn } from "@dimah-s3/react";
|
|
3
|
+
/** One extra row in {@link ObjectListItemMenu}. */
|
|
4
|
+
export type ObjectListMenuAction = {
|
|
5
|
+
/** Row label. */
|
|
6
|
+
label: string;
|
|
7
|
+
onClick: () => void;
|
|
8
|
+
/** Icon before the label. */
|
|
9
|
+
icon?: ReactNode;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
/** Destructive color. Stays above Delete, in its own group. */
|
|
12
|
+
destructive?: boolean;
|
|
13
|
+
};
|
|
14
|
+
/** Props for {@link ObjectListItemMenu}. */
|
|
15
|
+
export type ObjectListItemMenuProps = {
|
|
16
|
+
/**
|
|
17
|
+
* S3 object key. Inside an `ObjectList` file row it defaults to the
|
|
18
|
+
* entry's `objectKey`. Named `objectKey` because React reserves `key`.
|
|
19
|
+
*/
|
|
20
|
+
objectKey?: string;
|
|
21
|
+
/** Download filename and confirmation label. Defaults to the entry name. */
|
|
22
|
+
fileName?: string;
|
|
23
|
+
/** Shown in the delete confirmation. Defaults to the entry size. */
|
|
24
|
+
fileSize?: number | null;
|
|
25
|
+
/**
|
|
26
|
+
* Navigate-mode `useDownload` used only for Copy link. Defaults to the
|
|
27
|
+
* list's `share`, then to a navigate-mode list `download`. Pass one with
|
|
28
|
+
* `{ disposition: "inline" }` when the link should open in a browser
|
|
29
|
+
* while Download stays an attachment.
|
|
30
|
+
*/
|
|
31
|
+
share?: UseDownloadReturn;
|
|
32
|
+
/**
|
|
33
|
+
* Requested TTL in seconds for the copied link.
|
|
34
|
+
* The server signs the shorter of this value and the route cap.
|
|
35
|
+
* The toast shows the TTL that was actually signed.
|
|
36
|
+
*/
|
|
37
|
+
expiresIn?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Extra rows, after Copy link and before Delete.
|
|
40
|
+
* Use this for actions the menu does not provide, such as rename.
|
|
41
|
+
*/
|
|
42
|
+
actions?: readonly ObjectListMenuAction[];
|
|
43
|
+
/** More `DropdownMenuItem`s, after `actions`. */
|
|
44
|
+
children?: ReactNode;
|
|
45
|
+
/** Classes on the trigger button. */
|
|
46
|
+
className?: string;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Overflow menu for one entry.
|
|
50
|
+
*
|
|
51
|
+
* - Files: Download, Copy link, your actions, Delete.
|
|
52
|
+
* - Folders: Upload to this folder (the keyboard path to a folder drop),
|
|
53
|
+
* then your actions. It is disabled while the list's `upload` is.
|
|
54
|
+
*
|
|
55
|
+
* Inside an `ObjectList` every prop is optional: the key, name, size, and
|
|
56
|
+
* hooks come from the entry and the list. Download runs the list's
|
|
57
|
+
* `download`, and Delete asks the list's delete root, which owns the
|
|
58
|
+
* confirmation. Outside a list the menu has Copy link (with `share`) and
|
|
59
|
+
* your own rows.
|
|
60
|
+
*
|
|
61
|
+
* Copy link signs one URL and writes it to the clipboard. Signing does not
|
|
62
|
+
* start a download.
|
|
63
|
+
*/
|
|
64
|
+
export declare function ObjectListItemMenu({ objectKey: objectKeyProp, fileName: fileNameProp, fileSize: fileSizeProp, share: shareProp, expiresIn, actions, children, className, }: ObjectListItemMenuProps): import("react").JSX.Element | null;
|
|
65
|
+
//# sourceMappingURL=object-list-item-menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-list-item-menu.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/list/object-list-item-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,SAAS,EAAkB,MAAM,OAAO,CAAC;AAEzE,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,iBAAiB,CAAC;AA4BzB,mDAAmD;AACnD,MAAM,MAAM,oBAAoB,GAAG;IACjC,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,6BAA6B;IAC7B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+DAA+D;IAC/D,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,4CAA4C;AAC5C,MAAM,MAAM,uBAAuB,GAAG;IACpC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAC1C,iDAAiD;IACjD,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,SAAS,EAAE,aAAa,EACxB,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,SAAS,EAChB,SAAS,EACT,OAAO,EACP,QAAQ,EACR,SAAS,GACV,EAAE,uBAAuB,sCA6HzB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type KeyboardEvent } from "react";
|
|
2
|
+
import type { UseObjectListReturn, UseObjectListSelectionReturn } from "@dimah-s3/react";
|
|
3
|
+
import type { ObjectListView } from "./object-list-context.js";
|
|
4
|
+
/**
|
|
5
|
+
* Keys inside the list frame:
|
|
6
|
+
* - Arrows, Home, End: move between entries (grid: by row and column).
|
|
7
|
+
* - Space on an entry: toggle its checkbox. Shift extends the range.
|
|
8
|
+
* - Ctrl+A / Cmd+A: select every loaded entry. Escape: clear.
|
|
9
|
+
* - Backspace or Alt+ArrowUp: open the parent folder.
|
|
10
|
+
*
|
|
11
|
+
* Fields, menus, and dialogs keep their own keys.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useObjectListKeyboard<TItem>({ list, selection, view, }: {
|
|
14
|
+
list: UseObjectListReturn<TItem>;
|
|
15
|
+
selection: UseObjectListSelectionReturn<TItem> | null;
|
|
16
|
+
view: ObjectListView;
|
|
17
|
+
}): {
|
|
18
|
+
onKeyDown: (event: KeyboardEvent<HTMLElement>) => void;
|
|
19
|
+
onKeyUp: (event: KeyboardEvent<HTMLElement>) => void;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=object-list-keyboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-list-keyboard.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/list/object-list-keyboard.ts"],"names":[],"mappings":"AAEA,OAAO,EAAU,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,KAAK,EACV,mBAAmB,EACnB,4BAA4B,EAC7B,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAMrF;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,EAC3C,IAAI,EACJ,SAAS,EACT,IAAI,GACL,EAAE;IACD,IAAI,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACjC,SAAS,EAAE,4BAA4B,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IACtD,IAAI,EAAE,cAAc,CAAC;CACtB;uBAW2B,aAAa,CAAC,WAAW,CAAC;qBA8C5B,aAAa,CAAC,WAAW,CAAC;EAOnD"}
|
|
@@ -1,7 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { ObjectListView } from "./object-list-context.js";
|
|
3
|
+
/** Props for {@link ObjectListEmpty}. */
|
|
4
|
+
export type ObjectListEmptyProps = {
|
|
5
|
+
/** Defaults to "This folder is empty", or "No results" while searching. */
|
|
6
|
+
title?: ReactNode;
|
|
7
|
+
description?: ReactNode;
|
|
8
|
+
/** Below the text, such as an upload button. */
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Empty state for the open folder. Pass it as `empty` with your own text
|
|
14
|
+
* or a call to action. It reads the search text from the list.
|
|
15
|
+
*/
|
|
16
|
+
export declare function ObjectListEmpty({ title, description, children, className, }: ObjectListEmptyProps): import("react").JSX.Element;
|
|
5
17
|
export declare function ObjectListError({ message, onRetry, }: {
|
|
6
18
|
message: string | null;
|
|
7
19
|
onRetry?: () => void | Promise<void>;
|
|
@@ -10,13 +22,15 @@ export declare function ObjectListErrorBanner({ message, onRetry, }: {
|
|
|
10
22
|
message: string;
|
|
11
23
|
onRetry?: () => void | Promise<void>;
|
|
12
24
|
}): import("react").JSX.Element;
|
|
13
|
-
export declare function ObjectListSkeleton(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
25
|
+
export declare function ObjectListSkeleton({ view }: {
|
|
26
|
+
view: ObjectListView;
|
|
27
|
+
}): import("react").JSX.Element;
|
|
28
|
+
/**
|
|
29
|
+
* The next page. `auto` loads it when the end of the rows is on screen;
|
|
30
|
+
* `button` waits for Load more.
|
|
31
|
+
*/
|
|
32
|
+
export declare function ObjectListPagination({ mode, root, ready, }: {
|
|
33
|
+
mode: "auto" | "button";
|
|
20
34
|
/** Scroll parent. `null` uses the viewport. */
|
|
21
35
|
root: HTMLElement | null;
|
|
22
36
|
ready: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-list-states.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/list/object-list-states.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"object-list-states.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/list/object-list-states.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAqC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAe1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAIrF,yCAAyC;AACzC,MAAM,MAAM,oBAAoB,GAAG;IACjC,2EAA2E;IAC3E,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,gDAAgD;IAChD,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,WAAW,EACX,QAAQ,EACR,SAAS,GACV,EAAE,oBAAoB,+BAuCtB;AAED,wBAAgB,eAAe,CAAC,EAC9B,OAAO,EACP,OAAO,GACR,EAAE;IACD,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC,+BAyBA;AAED,wBAAgB,qBAAqB,CAAC,EACpC,OAAO,EACP,OAAO,GACR,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC,+BAYA;AAcD,wBAAgB,kBAAkB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,+BAmCpE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,IAAI,EACJ,IAAI,EACJ,KAAK,GACN,EAAE;IACD,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;IACxB,+CAA+C;IAC/C,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IACzB,KAAK,EAAE,OAAO,CAAC;CAChB,sCA0DA"}
|