@dimah-s3/ui 1.7.1 → 2.0.0-beta.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.
- 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
|
@@ -1,14 +1,37 @@
|
|
|
1
|
-
import type { UseUploadReturn } from "@dimah-s3/react";
|
|
1
|
+
import type { UploadCallOptions, UseObjectListReturn, UseUploadReturn } from "@dimah-s3/react";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Call options for files uploaded into `parent` (`null` is the root): the
|
|
4
|
+
* source's `uploadOptions` for that folder. `undefined` when the source has
|
|
5
|
+
* none, so the hook's own options apply.
|
|
6
|
+
*/
|
|
7
|
+
export declare function folderUploadCall<TItem>(list: UseObjectListReturn<TItem>, parent: string | null): UploadCallOptions | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Reloads the list once each time the upload queue settles with new
|
|
10
|
+
* successful files. Files that succeeded before mount do not count.
|
|
4
11
|
* Call it from the list root, outside the folder key, so opening another
|
|
5
12
|
* folder does not reload again.
|
|
6
13
|
*/
|
|
7
|
-
export declare function useRefreshListAfterUpload(upload: UseUploadReturn | undefined, refresh: (
|
|
8
|
-
|
|
9
|
-
|
|
14
|
+
export declare function useRefreshListAfterUpload(upload: UseUploadReturn | undefined, refresh: () => void | Promise<void>): void;
|
|
15
|
+
/**
|
|
16
|
+
* Progress and errors for the list's `upload`, under the header.
|
|
17
|
+
* Hidden while idle and after a queue that fully succeeded.
|
|
18
|
+
*/
|
|
19
|
+
export declare function ObjectListUploadStatus({ className }: {
|
|
20
|
+
className?: string;
|
|
10
21
|
}): import("react").JSX.Element | null;
|
|
11
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Overlay and live message while files are dragged over the list.
|
|
24
|
+
*
|
|
25
|
+
* `active` is the frame's own drag state, so a drag over another drop
|
|
26
|
+
* target of the same hook stays quiet. `target` is what takes the drag
|
|
27
|
+
* inside the frame: over a folder row the overlay steps aside and the live
|
|
28
|
+
* message names `folder`; over a dropzone both step aside, since the
|
|
29
|
+
* dropzone shows and announces its own state.
|
|
30
|
+
*/
|
|
31
|
+
export declare function ObjectListDropOverlay({ upload, active, target, folder, }: {
|
|
12
32
|
upload: UseUploadReturn;
|
|
33
|
+
active: boolean;
|
|
34
|
+
target?: "frame" | "folder" | "dropzone";
|
|
35
|
+
folder?: string | null;
|
|
13
36
|
}): import("react").JSX.Element;
|
|
14
37
|
//# sourceMappingURL=object-list-upload.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-list-upload.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/list/object-list-upload.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"object-list-upload.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/list/object-list-upload.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAMzB;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EACpC,IAAI,EAAE,mBAAmB,CAAC,KAAK,CAAC,EAChC,MAAM,EAAE,MAAM,GAAG,IAAI,GACpB,iBAAiB,GAAG,SAAS,CAI/B;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,eAAe,GAAG,SAAS,EACnC,OAAO,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,QA2BpC;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,sCAgB3E;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,MAAM,EACN,MAAM,EACN,MAAgB,EAChB,MAAa,GACd,EAAE;IACD,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB,+BAyCA"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Bytes and file count from `list.usage`, with a meter when the usage
|
|
3
|
+
* carries the server's `maxBytes` or `maxFiles`. Renders nothing until the
|
|
4
|
+
* query sends `usage`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function ObjectListUsage({ className }: {
|
|
7
|
+
className?: string;
|
|
8
|
+
}): import("react").JSX.Element | null;
|
|
7
9
|
//# sourceMappingURL=object-list-usage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-list-usage.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/list/object-list-usage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"object-list-usage.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/list/object-list-usage.tsx"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,sCA6EpE"}
|
|
@@ -1,169 +1,110 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import type {
|
|
3
|
-
import
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export type ObjectListView<TItem> = {
|
|
9
|
-
items: readonly TItem[];
|
|
10
|
-
folders?: readonly ObjectListFolder[];
|
|
11
|
-
/** Path from the root, root excluded. */
|
|
12
|
-
trail?: readonly ObjectListFolder[];
|
|
13
|
-
error?: APIError | null;
|
|
14
|
-
isLoading?: boolean;
|
|
15
|
-
isLoadingMore?: boolean;
|
|
16
|
-
isRefreshing?: boolean;
|
|
17
|
-
hasMore?: boolean;
|
|
18
|
-
loadMore?: () => void | Promise<void>;
|
|
19
|
-
refresh?: () => void | Promise<void>;
|
|
20
|
-
openFolder?: (folder: ObjectListFolder) => void;
|
|
21
|
-
/** Pass `[]` for the root. */
|
|
22
|
-
navigate?: (trail: readonly ObjectListFolder[]) => void;
|
|
2
|
+
import type { AnyDownloadReturn, DeleteResult, ObjectListFolder, UseDeleteReturn, UseDownloadReturn, UseObjectListReturn, UseObjectListSelectionReturn, UseUploadReturn } from "@dimah-s3/react";
|
|
3
|
+
import { type ObjectListRenderers, type ObjectListView } from "./object-list-context.js";
|
|
4
|
+
/** Props for {@link ObjectList}. */
|
|
5
|
+
export type ObjectListProps<TItem> = ObjectListRenderers<TItem> & {
|
|
6
|
+
/** `useObjectList` return. The component renders it and does not fetch. */
|
|
7
|
+
list: UseObjectListReturn<TItem>;
|
|
23
8
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
9
|
+
* `useObjectListSelection` return. Adds checkboxes, the selection bar,
|
|
10
|
+
* Ctrl+A / Cmd+A, Escape, Space, and Shift ranges.
|
|
26
11
|
*/
|
|
27
|
-
|
|
12
|
+
selection?: UseObjectListSelectionReturn<TItem>;
|
|
28
13
|
/**
|
|
29
|
-
*
|
|
30
|
-
* `
|
|
14
|
+
* `useUpload`. Drop or paste files onto the list to upload them into the
|
|
15
|
+
* open folder. When the source has `uploadOptions`, files go where it
|
|
16
|
+
* says, folder rows take drops, and their menu has Upload to this folder.
|
|
17
|
+
* `UploadTrigger` and `UploadDropzone` inside the list use the same hook
|
|
18
|
+
* and folder without their own `Upload`. The list reloads once each time
|
|
19
|
+
* the queue settles with new uploads.
|
|
31
20
|
*/
|
|
32
|
-
|
|
33
|
-
};
|
|
34
|
-
/** Checked rows on the loaded page. */
|
|
35
|
-
export type ObjectListSelectionChange<TItem> = {
|
|
36
|
-
items: readonly TItem[];
|
|
37
|
-
folders: readonly ObjectListFolder[];
|
|
38
|
-
};
|
|
39
|
-
/** Caps for the usage line. The list does not read them from the server. */
|
|
40
|
-
export type ObjectListUsageLimits = {
|
|
21
|
+
upload?: UseUploadReturn;
|
|
41
22
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
23
|
+
* `useDownload` or `useFetchDownload`. Adds Download to the file menu.
|
|
24
|
+
* `DownloadTrigger` inside the list uses it without its own `Download`.
|
|
44
25
|
*/
|
|
45
|
-
|
|
26
|
+
download?: AnyDownloadReturn;
|
|
46
27
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
28
|
+
* Navigate-mode `useDownload` for Copy link, such as one with
|
|
29
|
+
* `disposition: "inline"`. Falls back to a navigate-mode `download`.
|
|
49
30
|
*/
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
/** Filename used for the type glyph. Defaults to `getLabel`. */
|
|
59
|
-
getFileName?: (item: TItem) => string;
|
|
60
|
-
getFileType?: (item: TItem) => string | null;
|
|
61
|
-
/** Image thumbnail. The label stays the accessible name. */
|
|
62
|
-
getPreviewUrl?: (item: TItem) => string | null;
|
|
63
|
-
/** Replaces the file row. */
|
|
64
|
-
renderItem?: (item: TItem) => ReactNode;
|
|
65
|
-
/** Replaces the folder row. */
|
|
66
|
-
renderFolder?: (folder: ObjectListFolder) => ReactNode;
|
|
67
|
-
/** Trailing controls for a file, such as download and delete. */
|
|
68
|
-
renderActions?: (item: TItem) => ReactNode;
|
|
31
|
+
share?: UseDownloadReturn;
|
|
32
|
+
/**
|
|
33
|
+
* `useDelete`. Adds Delete to the file menu and to the selection bar,
|
|
34
|
+
* with one confirmation for the whole list. `DeleteTrigger` inside the
|
|
35
|
+
* list uses it too. Deleted files leave the rows at once; the list then
|
|
36
|
+
* reloads.
|
|
37
|
+
*/
|
|
38
|
+
delete?: UseDeleteReturn;
|
|
69
39
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
40
|
+
* Show toasts for `upload`, `download`, and `delete`. They step aside for
|
|
41
|
+
* an `UploadToasts`, `DownloadToasts`, or `DeleteToasts` you mount for the
|
|
42
|
+
* same hook. Off, delete results and the list's own controls (Copy link,
|
|
43
|
+
* bulk Delete) report in a polite live region instead, unless you mount a
|
|
44
|
+
* `DeleteToasts` for the same hook. @default true
|
|
72
45
|
*/
|
|
73
|
-
|
|
46
|
+
toasts?: boolean;
|
|
47
|
+
/** Controlled view. Pass it with `onViewChange`. */
|
|
48
|
+
view?: ObjectListView;
|
|
49
|
+
/** Uncontrolled starting view. @default "list" */
|
|
50
|
+
defaultView?: ObjectListView;
|
|
51
|
+
onViewChange?: (view: ObjectListView) => void;
|
|
74
52
|
/**
|
|
75
|
-
* Called when
|
|
76
|
-
*
|
|
53
|
+
* Called when a file row is clicked or activated with Enter.
|
|
54
|
+
* Folders always open in place.
|
|
77
55
|
*/
|
|
78
56
|
onOpenItem?: (item: TItem) => void;
|
|
79
|
-
/**
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Object keys stored in a folder. Selected folders join a bulk delete
|
|
59
|
+
* only when this is set. Pair it with `isSelectable` on the selection.
|
|
60
|
+
*/
|
|
61
|
+
resolveFolderKeys?: (folder: ObjectListFolder) => Promise<readonly string[]>;
|
|
62
|
+
/** Called after each confirmed delete in the list, with every key's outcome. */
|
|
63
|
+
onDeleted?: (result: DeleteResult) => void;
|
|
64
|
+
/** Root breadcrumb label and the list's accessible name. @default "Files" */
|
|
84
65
|
rootLabel?: string;
|
|
85
|
-
/** Show the path. @default true */
|
|
66
|
+
/** Show the path in the default header. @default true */
|
|
86
67
|
breadcrumb?: boolean;
|
|
87
|
-
|
|
88
|
-
|
|
68
|
+
/** Trailing controls in the default header, such as an upload button. */
|
|
69
|
+
toolbar?: ReactNode;
|
|
70
|
+
/** Extra controls on the selection bar, beside Delete. */
|
|
71
|
+
selectionActions?: ReactNode;
|
|
72
|
+
/** Replaces the empty state. `ObjectListEmpty` takes your own text. */
|
|
73
|
+
empty?: ReactNode;
|
|
89
74
|
/**
|
|
90
|
-
*
|
|
91
|
-
*
|
|
75
|
+
* `auto` loads the next page as the end of the rows comes into view.
|
|
76
|
+
* `button` waits for Load more. @default "auto"
|
|
92
77
|
*/
|
|
93
|
-
|
|
94
|
-
className?: string;
|
|
78
|
+
loadMore?: "auto" | "button";
|
|
95
79
|
/**
|
|
96
80
|
* Fixed frame height. The header stays put and the rows scroll inside.
|
|
97
|
-
* A number is pixels. A string is a CSS length, such as `"18rem"
|
|
81
|
+
* A number is pixels. A string is a CSS length, such as `"18rem"`.
|
|
98
82
|
*/
|
|
99
83
|
height?: number | string;
|
|
100
84
|
/**
|
|
101
|
-
* Largest frame height. The list grows with its
|
|
85
|
+
* Largest frame height. The list grows with its rows until this cap,
|
|
102
86
|
* then the rows scroll and the header stays put.
|
|
103
|
-
* A number is pixels. A string is a CSS length.
|
|
104
87
|
*/
|
|
105
88
|
maxHeight?: number | string;
|
|
89
|
+
className?: string;
|
|
106
90
|
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
* When `list.hasMore` is set, the header checkbox selects this page.
|
|
110
|
-
* A folder gets a checkbox only when {@link ObjectListProps.resolveFolderKeys}
|
|
111
|
-
* is set. Escape clears the selection. Ctrl+A or Cmd+A, with focus inside
|
|
112
|
-
* the list, selects the same rows as the header checkbox.
|
|
113
|
-
*/
|
|
114
|
-
selectable?: boolean;
|
|
115
|
-
/**
|
|
116
|
-
* S3 object key for a file. Defaults to `getKey`.
|
|
117
|
-
* Bulk delete uses this, not the row id.
|
|
118
|
-
*/
|
|
119
|
-
getObjectKey?: (item: TItem) => string;
|
|
120
|
-
/**
|
|
121
|
-
* Object keys stored in a folder. The folder gets a checkbox only when
|
|
122
|
-
* this is set, and bulk delete includes the keys it returns.
|
|
123
|
-
*/
|
|
124
|
-
resolveFolderKeys?: (folder: ObjectListFolder) => Promise<readonly string[]>;
|
|
125
|
-
/** Selection bar delete. Implies {@link ObjectListProps.selectable}. */
|
|
126
|
-
delete?: UseDeleteReturn;
|
|
127
|
-
/**
|
|
128
|
-
* Called when the checked rows change, including when the folder changes
|
|
129
|
-
* and the selection clears. `items` and `folders` are from the loaded page.
|
|
130
|
-
*/
|
|
131
|
-
onSelectionChange?: (selection: ObjectListSelectionChange<TItem>) => void;
|
|
132
|
-
/**
|
|
133
|
-
* Extra controls on the selection bar, beside Delete.
|
|
134
|
-
* Implies {@link ObjectListProps.selectable}.
|
|
135
|
-
*/
|
|
136
|
-
selectionActions?: ReactNode;
|
|
137
|
-
/** Called after a bulk delete, including keys that failed. */
|
|
138
|
-
onDeleted?: (result: {
|
|
139
|
-
deleted: string[];
|
|
140
|
-
failed: string[];
|
|
141
|
-
}) => void;
|
|
142
|
-
/**
|
|
143
|
-
* Drop and paste files onto this list. Pass `useUpload` with `noClick`
|
|
144
|
-
* and `noKeyboard`. `getUploadOptions` chooses the folder from
|
|
145
|
-
* `list.parent`; this component does not write metadata. Clicking the
|
|
146
|
-
* list does not open the file picker. The list renders the hook's file
|
|
147
|
-
* input, so `upload.open()` from any trigger, such as a menu item or an
|
|
148
|
-
* empty-state button, opens the picker. A paste uploads while focus is
|
|
149
|
-
* inside the list. The destination is the open folder, including when
|
|
150
|
-
* the pointer is over a folder row. When the batch settles and at least
|
|
151
|
-
* one file succeeded, `list.refresh` runs once. A mixed batch still
|
|
152
|
-
* reloads. Share this hook with `UploadButton` in `header` and set that
|
|
153
|
-
* button's `toast` and `status` to false so progress stays here.
|
|
154
|
-
*/
|
|
155
|
-
upload?: UseUploadReturn;
|
|
156
|
-
/**
|
|
157
|
-
* Caps drawn next to `list.usage`. Ignored when `list.usage` is omitted.
|
|
158
|
-
* Without this, the line shows the totals and no meter.
|
|
91
|
+
* Your own layout from the list parts. Omit it for the default:
|
|
92
|
+
* header, usage, upload status, and content.
|
|
159
93
|
*/
|
|
160
|
-
|
|
94
|
+
children?: ReactNode;
|
|
161
95
|
};
|
|
162
96
|
/**
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
97
|
+
* File and folder catalog for a `useObjectList` return.
|
|
98
|
+
*
|
|
99
|
+
* Works on its own: pass `list`, then the hooks you have — `selection`,
|
|
100
|
+
* `upload`, `download`, `share`, `delete` — to switch features on. Use the
|
|
101
|
+
* `render*` props to change parts of each entry, or pass `children` to
|
|
102
|
+
* arrange the parts (`ObjectListHeader`, `ObjectListSearch`,
|
|
103
|
+
* `ObjectListContent`, …) yourself.
|
|
104
|
+
*
|
|
105
|
+
* The list is the `Upload`, `Download`, and `Delete` root for its hooks,
|
|
106
|
+
* so the family parts work inside it, and one delete confirmation serves
|
|
107
|
+
* every row and the selection bar.
|
|
167
108
|
*/
|
|
168
|
-
export declare function ObjectList<TItem>(
|
|
109
|
+
export declare function ObjectList<TItem>({ list, selection, upload, download, share, delete: del, toasts, view: viewProp, defaultView, onViewChange, onOpenItem, resolveFolderKeys, onDeleted, rootLabel, breadcrumb, toolbar, selectionActions, empty, loadMore, height, maxHeight, className, children, renderEntry, renderActions, renderDescription, renderMeta, }: ObjectListProps<TItem>): import("react").JSX.Element;
|
|
169
110
|
//# sourceMappingURL=object-list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-list.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/list/object-list.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"object-list.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/list/object-list.tsx"],"names":[],"mappings":"AAEA,OAAO,EAOL,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,4BAA4B,EAC5B,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAgBzB,OAAO,EAIL,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACpB,MAAM,gDAAgD,CAAC;AAexD,oCAAoC;AACpC,MAAM,MAAM,eAAe,CAAC,KAAK,IAAI,mBAAmB,CAAC,KAAK,CAAC,GAAG;IAChE,2EAA2E;IAC3E,IAAI,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACjC;;;OAGG;IACH,SAAS,CAAC,EAAE,4BAA4B,CAAC,KAAK,CAAC,CAAC;IAChD;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B;;;OAGG;IACH,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,oDAAoD;IACpD,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,kDAAkD;IAClD,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;IAC9C;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,IAAI,CAAC;IACnC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;IAC7E,gFAAgF;IAChF,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IAC3C,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,yEAAyE;IACzE,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,0DAA0D;IAC1D,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,uEAAuE;IACvE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC7B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,EAChC,IAAI,EACJ,SAAS,EACT,MAAM,EACN,QAAQ,EACR,KAAK,EACL,MAAM,EAAE,GAAG,EACX,MAAa,EACb,IAAI,EAAE,QAAQ,EACd,WAAoB,EACpB,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,SAAS,EACT,UAAiB,EACjB,OAAO,EACP,gBAAgB,EAChB,KAAK,EACL,QAAiB,EACjB,MAAM,EACN,SAAS,EACT,SAAS,EACT,QAAQ,EACR,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,UAAU,GACX,EAAE,eAAe,CAAC,KAAK,CAAC,+BAkIxB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { AnyDownloadReturn, DeleteResult, UseDeleteReturn } from "@dimah-s3/react";
|
|
2
|
+
import { type FileAttachmentProps } from "../attachment/file-attachment.js";
|
|
3
|
+
/** Props for {@link ObjectCard}. Other props go to `FileAttachment`. */
|
|
4
|
+
export type ObjectCardProps = Omit<FileAttachmentProps, "state" | "fileName" | "percent" | "error" | "onCancel" | "onDismiss"> & {
|
|
5
|
+
/** Stored object key. Named `objectKey` because React reserves the `key` prop. */
|
|
6
|
+
objectKey: string;
|
|
7
|
+
/** Display name, and the name the browser saves. Defaults to the key's file name. */
|
|
8
|
+
fileName?: string;
|
|
9
|
+
/** A `useDownload` or `useFetchDownload` return. Adds a download action. */
|
|
10
|
+
download?: AnyDownloadReturn;
|
|
11
|
+
/** A `useDelete` return. Adds a delete action with its confirm dialog. */
|
|
12
|
+
delete?: UseDeleteReturn;
|
|
13
|
+
/** Called once a confirmed delete settles. Remove the card when it lists the key. */
|
|
14
|
+
onDeleted?: (result: DeleteResult) => void;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Card for one stored object, with download and delete actions for the
|
|
18
|
+
* hooks you pass. While a `useFetchDownload` call for the key runs, the
|
|
19
|
+
* card shows its progress ring and the bytes received; while the key is
|
|
20
|
+
* deleting, a spinner. `actions` go before the download and delete
|
|
21
|
+
* actions.
|
|
22
|
+
*
|
|
23
|
+
* Each card is its own `Download` and `Delete` root. It does not toast:
|
|
24
|
+
* mount `DownloadToasts` and `DeleteToasts` for the hooks.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <ObjectCard
|
|
29
|
+
* objectKey={file.key}
|
|
30
|
+
* fileSize={file.size}
|
|
31
|
+
* download={download}
|
|
32
|
+
* delete={remove}
|
|
33
|
+
* onDeleted={(result) => result.deleted.includes(file.key) && drop(file)}
|
|
34
|
+
* />
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function ObjectCard({ objectKey, fileName, fileSize, download, delete: del, onDeleted, description, actions, ...props }: ObjectCardProps): import("react").JSX.Element;
|
|
38
|
+
//# sourceMappingURL=object-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-card.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/preview/object-card.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EACZ,eAAe,EAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,kDAAkD,CAAC;AAW1D,wEAAwE;AACxE,MAAM,MAAM,eAAe,GAAG,IAAI,CAChC,mBAAmB,EACnB,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,UAAU,GAAG,WAAW,CACtE,GAAG;IACF,kFAAkF;IAClF,SAAS,EAAE,MAAM,CAAC;IAClB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,0EAA0E;IAC1E,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,qFAAqF;IACrF,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;CAC5C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,UAAU,CAAC,EACzB,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,MAAM,EAAE,GAAG,EACX,SAAS,EACT,WAAW,EACX,OAAO,EACP,GAAG,KAAK,EACT,EAAE,eAAe,+BAuFjB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type ImgHTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
import type { S3Api, S3RouteName } from "@dimah-s3/core";
|
|
3
|
+
/** Props for {@link ObjectImage}. Other props go to the `<img>`. */
|
|
4
|
+
export type ObjectImageProps = Omit<ImgHTMLAttributes<HTMLImageElement>, "src"> & {
|
|
5
|
+
/** Named server route that presigns the GET. */
|
|
6
|
+
route: S3RouteName;
|
|
7
|
+
/** Stored object key. `null` shows `fallback`. */
|
|
8
|
+
objectKey: string | null;
|
|
9
|
+
/** Required. Pass `""` when the image is decorative. */
|
|
10
|
+
alt: string;
|
|
11
|
+
/** Optional when an `<S3Provider>` is in the tree. */
|
|
12
|
+
api?: S3Api;
|
|
13
|
+
/** Shown while there is no key, while the URL is signed, and on errors. */
|
|
14
|
+
fallback?: ReactNode;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Image of a stored object. It presigns an inline URL with `useObjectUrl`,
|
|
18
|
+
* which refreshes it before it expires and shares it with other images of
|
|
19
|
+
* the same object.
|
|
20
|
+
*
|
|
21
|
+
* `fallback` renders instead of the image while there is no key, while the
|
|
22
|
+
* URL is signed, when signing fails and when the image fails to load.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <ObjectImage route="avatars" objectKey={user.avatarKey} alt={user.name} />
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function ObjectImage({ route, objectKey, alt, api, fallback, onError, ...props }: ObjectImageProps): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null;
|
|
30
|
+
//# sourceMappingURL=object-image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-image.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/preview/object-image.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,iBAAiB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGzD,oEAAoE;AACpE,MAAM,MAAM,gBAAgB,GAAG,IAAI,CACjC,iBAAiB,CAAC,gBAAgB,CAAC,EACnC,KAAK,CACN,GAAG;IACF,gDAAgD;IAChD,KAAK,EAAE,WAAW,CAAC;IACnB,kDAAkD;IAClD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,wDAAwD;IACxD,GAAG,EAAE,MAAM,CAAC;IACZ,sDAAsD;IACtD,GAAG,CAAC,EAAE,KAAK,CAAC;IACZ,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,SAAS,EACT,GAAG,EACH,GAAG,EACH,QAAe,EACf,OAAO,EACP,GAAG,KAAK,EACT,EAAE,gBAAgB,mTAkBlB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { S3Api, S3RouteName } from "@dimah-s3/core";
|
|
2
|
+
import { type UploadResult, type UseUploadReturn } from "@dimah-s3/react";
|
|
3
|
+
/** Props for {@link AvatarUpload}. */
|
|
4
|
+
export type AvatarUploadProps = {
|
|
5
|
+
/** The `useUpload` return that uploads the picked image. */
|
|
6
|
+
upload: UseUploadReturn;
|
|
7
|
+
/** Named server route that presigns the GET for `objectKey`. */
|
|
8
|
+
route: S3RouteName;
|
|
9
|
+
/** Key of the current image. `null` or absent shows a placeholder. */
|
|
10
|
+
objectKey?: string | null;
|
|
11
|
+
/** Accessible name of the button, such as "Change profile photo". */
|
|
12
|
+
label: string;
|
|
13
|
+
/** Runs once per uploaded image. Store `result.key` and pass it back as `objectKey`. */
|
|
14
|
+
onChange?: (result: UploadResult) => void;
|
|
15
|
+
/** Width and height in pixels. @default 96 */
|
|
16
|
+
size?: number;
|
|
17
|
+
/** `circle` for people, `square` (rounded corners) for logos and covers. @default "circle" */
|
|
18
|
+
shape?: "circle" | "square";
|
|
19
|
+
className?: string;
|
|
20
|
+
/** Signs the image URL. Optional when an `<S3Provider>` is in the tree. */
|
|
21
|
+
api?: S3Api;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Image button that uploads a new picture, round by default. A click opens the file
|
|
25
|
+
* picker, and an image dropped on it uploads too. It is disabled while the
|
|
26
|
+
* hook is (`upload.disabled`).
|
|
27
|
+
*
|
|
28
|
+
* It shows the picked file's preview while it uploads and after, with a
|
|
29
|
+
* progress ring while it is in flight. Otherwise it shows `objectKey`, or a
|
|
30
|
+
* placeholder. A polite live region announces the upload phase, errors
|
|
31
|
+
* and rejected files.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* const upload = useUpload({ route: "avatars", accept: ["image/*"] });
|
|
36
|
+
*
|
|
37
|
+
* <AvatarUpload
|
|
38
|
+
* upload={upload}
|
|
39
|
+
* route="avatars"
|
|
40
|
+
* objectKey={user.avatarKey}
|
|
41
|
+
* label="Change profile photo"
|
|
42
|
+
* onChange={(result) => saveAvatar(result.key)}
|
|
43
|
+
* />
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare function AvatarUpload({ upload, route, objectKey, label, onChange, size, shape, api, className, }: AvatarUploadProps): import("react").JSX.Element;
|
|
47
|
+
//# sourceMappingURL=avatar-upload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar-upload.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/upload/avatar-upload.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,eAAe,EACrB,MAAM,iBAAiB,CAAC;AAMzB,sCAAsC;AACtC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,4DAA4D;IAC5D,MAAM,EAAE,eAAe,CAAC;IACxB,gEAAgE;IAChE,KAAK,EAAE,WAAW,CAAC;IACnB,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,qEAAqE;IACrE,KAAK,EAAE,MAAM,CAAC;IACd,wFAAwF;IACxF,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IAC1C,8CAA8C;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8FAA8F;IAC9F,KAAK,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,GAAG,CAAC,EAAE,KAAK,CAAC;CACb,CAAC;AAgBF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,KAAK,EACL,SAAgB,EAChB,KAAK,EACL,QAAQ,EACR,IAAS,EACT,KAAgB,EAChB,GAAG,EACH,SAAS,GACV,EAAE,iBAAiB,+BA4FnB"}
|
|
@@ -1,27 +1,50 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
className?: string;
|
|
8
|
-
/** Dropzone label. */
|
|
9
|
-
label?: string;
|
|
10
|
-
/**
|
|
11
|
-
* Custom dropzone chrome (icon + hints). Replaces the built-in idle content
|
|
12
|
-
* only — status still renders via the `status` prop.
|
|
13
|
-
*/
|
|
14
|
-
children?: ReactNode;
|
|
15
|
-
disabled?: boolean;
|
|
16
|
-
/** Show toasts during upload. @default true */
|
|
17
|
-
toast?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Inline status control.
|
|
20
|
-
* - `true` (default): render inside the dropzone
|
|
21
|
-
* - `false`: hide status
|
|
22
|
-
* - `(node) => ReactNode`: wrap or relocate the status node
|
|
23
|
-
*/
|
|
24
|
-
status?: StatusSlot;
|
|
1
|
+
import { type HTMLAttributes } from "react";
|
|
2
|
+
import type { UploadCallOptions } from "@dimah-s3/react";
|
|
3
|
+
/** Props for {@link UploadDropzone}. Other props go to the dropzone `<div>`. */
|
|
4
|
+
export type UploadDropzoneProps = HTMLAttributes<HTMLDivElement> & {
|
|
5
|
+
/** Call options for the files dropped on it, and picked or pasted through its trigger. */
|
|
6
|
+
call?: UploadCallOptions;
|
|
25
7
|
};
|
|
26
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Drop area of the nearest `Upload`. Render it inside `<Upload>`.
|
|
10
|
+
*
|
|
11
|
+
* Files dropped anywhere on it upload, also over the status inside it. Its
|
|
12
|
+
* drag state follows only the files over this element, not the whole hook,
|
|
13
|
+
* and a polite live region announces whether they can be dropped. It stays
|
|
14
|
+
* usable while files upload, so new files follow the hook's `queue` option.
|
|
15
|
+
*
|
|
16
|
+
* Without `children` it renders an `UploadDropzoneTrigger` and an
|
|
17
|
+
* `UploadStatus`, so progress shows inside the dropzone. Pass `children`
|
|
18
|
+
* to arrange them yourself, or to keep the status outside it.
|
|
19
|
+
*
|
|
20
|
+
* It sets `data-drag-active` while files are over it, `data-drag-reject`
|
|
21
|
+
* when they cannot be dropped, and `data-disabled` while the hook is
|
|
22
|
+
* disabled or the root is full.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <Upload upload={upload}>
|
|
27
|
+
* <UploadDropzone />
|
|
28
|
+
* </Upload>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function UploadDropzone({ call, className, children, onDragEnter, onDragLeave, onDrop, ...props }: UploadDropzoneProps): import("react").JSX.Element;
|
|
32
|
+
/** Props for {@link UploadDropzoneTrigger}. Other props go to the trigger `<div>`. */
|
|
33
|
+
export type UploadDropzoneTriggerProps = HTMLAttributes<HTMLDivElement>;
|
|
34
|
+
/**
|
|
35
|
+
* The part of an `UploadDropzone` that opens the file picker. Render it
|
|
36
|
+
* inside `<UploadDropzone>`.
|
|
37
|
+
*
|
|
38
|
+
* It is a button: a click, Enter or Space opens the picker, and files
|
|
39
|
+
* pasted while it has focus upload. The route's limits describe it. While
|
|
40
|
+
* the hook is disabled it is `aria-disabled` and out of the tab order;
|
|
41
|
+
* while the root is full, as in a full `UploadField`, it stays focusable
|
|
42
|
+
* but is `aria-disabled`, and "Maximum files reached." leads its
|
|
43
|
+
* description.
|
|
44
|
+
*
|
|
45
|
+
* The default content is an icon, a title that follows the drag, and the
|
|
46
|
+
* route's limits. `children` replace them; the limits stay attached as the
|
|
47
|
+
* description. It is a button, so do not put controls inside it.
|
|
48
|
+
*/
|
|
49
|
+
export declare function UploadDropzoneTrigger({ className, children, "aria-describedby": describedBy, ...props }: UploadDropzoneTriggerProps): import("react").JSX.Element;
|
|
27
50
|
//# sourceMappingURL=upload-dropzone.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-dropzone.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/upload/upload-dropzone.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"upload-dropzone.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/upload/upload-dropzone.tsx"],"names":[],"mappings":"AAEA,OAAO,EAML,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAqB,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAuB5E,gFAAgF;AAChF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IACjE,0FAA0F;IAC1F,IAAI,CAAC,EAAE,iBAAiB,CAAC;CAC1B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,WAAW,EACX,WAAW,EACX,MAAM,EACN,GAAG,KAAK,EACT,EAAE,mBAAmB,+BAoErB;AAED,sFAAsF;AACtF,MAAM,MAAM,0BAA0B,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAExE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,SAAS,EACT,QAAQ,EACR,kBAAkB,EAAE,WAAW,EAC/B,GAAG,KAAK,EACT,EAAE,0BAA0B,+BA6G5B"}
|