filecove 0.0.0-stage → 0.2.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/CHANGELOG.md +38 -0
- package/LICENSE +21 -0
- package/README.md +65 -2
- package/THIRD_PARTY_NOTICES.md +63 -0
- package/dist/components/buttons/toolbar-actions.d.ts +28 -0
- package/dist/components/buttons/tooltip-icon-button.d.ts +14 -0
- package/dist/components/downloads/download-panel.d.ts +23 -0
- package/dist/components/drag/drag-preview.d.ts +24 -0
- package/dist/components/file-manager/announcer.d.ts +14 -0
- package/dist/components/file-manager/content/file-grid.d.ts +8 -0
- package/dist/components/file-manager/content/file-list.d.ts +9 -0
- package/dist/components/file-manager/content/folder-view.d.ts +83 -0
- package/dist/components/file-manager/content/item-icon.d.ts +16 -0
- package/dist/components/file-manager/content/no-sections.d.ts +11 -0
- package/dist/components/file-manager/content/search-results.d.ts +40 -0
- package/dist/components/file-manager/content/search-tabs.d.ts +29 -0
- package/dist/components/file-manager/content/trash-bar.d.ts +13 -0
- package/dist/components/file-manager/context-menu/context-menu.d.ts +20 -0
- package/dist/components/file-manager/dialogs/conflict-step.d.ts +28 -0
- package/dist/components/file-manager/dialogs/delete-dialog.d.ts +49 -0
- package/dist/components/file-manager/dialogs/image-viewer.d.ts +42 -0
- package/dist/components/file-manager/dialogs/name-dialog.d.ts +41 -0
- package/dist/components/file-manager/dialogs/paste-dialog.d.ts +39 -0
- package/dist/components/file-manager/dialogs/preview-dialog.d.ts +75 -0
- package/dist/components/file-manager/dialogs/restore-dialog.d.ts +41 -0
- package/dist/components/file-manager/dialogs/shortcuts-dialog.d.ts +36 -0
- package/dist/components/file-manager/dialogs/transfer-dialog.d.ts +71 -0
- package/dist/components/file-manager/dialogs/upload-dialog.d.ts +34 -0
- package/dist/components/file-manager/file-manager.d.ts +320 -0
- package/dist/components/file-manager/find-layer.d.ts +29 -0
- package/dist/components/file-manager/header-bar/header-bar.d.ts +65 -0
- package/dist/components/file-manager/header-bar/history-menu.d.ts +18 -0
- package/dist/components/file-manager/header-bar/path-bar.d.ts +19 -0
- package/dist/components/file-manager/header-bar/path-field.d.ts +23 -0
- package/dist/components/file-manager/header-bar/search-field.d.ts +27 -0
- package/dist/components/file-manager/header-bar/search-sections-menu.d.ts +25 -0
- package/dist/components/file-manager/header-bar/view-menu.d.ts +39 -0
- package/dist/components/file-manager/notice-bar.d.ts +36 -0
- package/dist/components/file-manager/properties-pane.d.ts +53 -0
- package/dist/components/file-manager/resize-edge.d.ts +39 -0
- package/dist/components/file-manager/selection-bar.d.ts +15 -0
- package/dist/components/file-manager/sidebar/location-item.d.ts +36 -0
- package/dist/components/file-manager/sidebar/main-menu.d.ts +23 -0
- package/dist/components/file-manager/sidebar/sidebar.d.ts +80 -0
- package/dist/components/icons/check-badge.d.ts +3 -0
- package/dist/components/icons/create-icon.d.ts +20 -0
- package/dist/components/icons/file-icon.d.ts +19 -0
- package/dist/components/icons/icon-provider.d.ts +21 -0
- package/dist/components/icons/icon-slot.d.ts +6 -0
- package/dist/components/icons/icon.d.ts +19 -0
- package/dist/components/icons/locked-icon.d.ts +9 -0
- package/dist/components/media-manager/asset-delete.d.ts +29 -0
- package/dist/components/media-manager/asset-hold.d.ts +32 -0
- package/dist/components/media-manager/asset-option.d.ts +74 -0
- package/dist/components/media-manager/asset-trail.d.ts +13 -0
- package/dist/components/media-manager/choice-list.d.ts +29 -0
- package/dist/components/media-manager/choices-pane.d.ts +50 -0
- package/dist/components/media-manager/choose-bar.d.ts +26 -0
- package/dist/components/media-manager/drop-zone.d.ts +7 -0
- package/dist/components/media-manager/group-check.d.ts +13 -0
- package/dist/components/media-manager/group-create.d.ts +20 -0
- package/dist/components/media-manager/group-path.d.ts +24 -0
- package/dist/components/media-manager/library-list.d.ts +23 -0
- package/dist/components/media-manager/media-asset.d.ts +65 -0
- package/dist/components/media-manager/media-edit-many.d.ts +33 -0
- package/dist/components/media-manager/media-fields.d.ts +31 -0
- package/dist/components/media-manager/media-filter-chips.d.ts +17 -0
- package/dist/components/media-manager/media-filters-dialog.d.ts +39 -0
- package/dist/components/media-manager/media-filters.d.ts +37 -0
- package/dist/components/media-manager/media-form.d.ts +29 -0
- package/dist/components/media-manager/media-frame.d.ts +77 -0
- package/dist/components/media-manager/media-grid.d.ts +114 -0
- package/dist/components/media-manager/media-group.d.ts +29 -0
- package/dist/components/media-manager/media-header.d.ts +80 -0
- package/dist/components/media-manager/media-manager.d.ts +309 -0
- package/dist/components/media-manager/media-move.d.ts +30 -0
- package/dist/components/media-manager/media-picker.d.ts +140 -0
- package/dist/components/media-manager/media-picture.d.ts +26 -0
- package/dist/components/media-manager/media-process.d.ts +26 -0
- package/dist/components/media-manager/media-row.d.ts +13 -0
- package/dist/components/media-manager/media-step.d.ts +33 -0
- package/dist/components/media-manager/media-tile.d.ts +15 -0
- package/dist/components/media-manager/media-upload.d.ts +46 -0
- package/dist/components/media-manager/open-button.d.ts +15 -0
- package/dist/components/media-manager/picker-frame.d.ts +33 -0
- package/dist/components/media-manager/selection-bar.d.ts +25 -0
- package/dist/components/media-manager/upload-tile.d.ts +17 -0
- package/dist/components/properties/properties-panel.d.ts +53 -0
- package/dist/components/properties/property-display.d.ts +15 -0
- package/dist/components/properties/property-editor.d.ts +26 -0
- package/dist/components/properties/property-input.d.ts +36 -0
- package/dist/components/transfers/transfer-panel.d.ts +25 -0
- package/dist/components/ui/backdrop.d.ts +7 -0
- package/dist/components/ui/button-base.d.ts +7 -0
- package/dist/components/ui/button.d.ts +18 -0
- package/dist/components/ui/checkbox.d.ts +24 -0
- package/dist/components/ui/chip.d.ts +18 -0
- package/dist/components/ui/circular-progress.d.ts +14 -0
- package/dist/components/ui/collapse.d.ts +9 -0
- package/dist/components/ui/dialog.d.ts +40 -0
- package/dist/components/ui/divider.d.ts +4 -0
- package/dist/components/ui/icon-button.d.ts +12 -0
- package/dist/components/ui/linear-progress.d.ts +13 -0
- package/dist/components/ui/link.d.ts +4 -0
- package/dist/components/ui/menu.d.ts +77 -0
- package/dist/components/ui/root-providers.d.ts +16 -0
- package/dist/components/ui/text-field.d.ts +38 -0
- package/dist/components/ui/text.d.ts +21 -0
- package/dist/components/ui/tooltip.d.ts +24 -0
- package/dist/components/uploads/upload-panel.d.ts +31 -0
- package/dist/contexts/asset-look-context.d.ts +1 -0
- package/dist/contexts/cut-context.d.ts +6 -0
- package/dist/contexts/data-context.d.ts +12 -0
- package/dist/contexts/direction-context.d.ts +2 -0
- package/dist/contexts/drag-context.d.ts +36 -0
- package/dist/contexts/icon-context.d.ts +10 -0
- package/dist/contexts/locale-context.d.ts +2 -0
- package/dist/contexts/moving-context.d.ts +7 -0
- package/dist/create-icon-D2vnnBQX.js +40 -0
- package/dist/create-icon-D2vnnBQX.js.map +1 -0
- package/dist/hooks/use-announcer.d.ts +20 -0
- package/dist/hooks/use-asset-look.d.ts +6 -0
- package/dist/hooks/use-asset-states.d.ts +12 -0
- package/dist/hooks/use-chosen-column.d.ts +16 -0
- package/dist/hooks/use-clipboard-follow.d.ts +12 -0
- package/dist/hooks/use-controlled.d.ts +18 -0
- package/dist/hooks/use-cut-ids.d.ts +3 -0
- package/dist/hooks/use-dev-checks.d.ts +16 -0
- package/dist/hooks/use-download-queue.d.ts +19 -0
- package/dist/hooks/use-dragged-ids.d.ts +3 -0
- package/dist/hooks/use-drop-target.d.ts +48 -0
- package/dist/hooks/use-entry-drag.d.ts +46 -0
- package/dist/hooks/use-files-drop.d.ts +20 -0
- package/dist/hooks/use-folder.d.ts +14 -0
- package/dist/hooks/use-fork-ref.d.ts +6 -0
- package/dist/hooks/use-form-send.d.ts +12 -0
- package/dist/hooks/use-found.d.ts +10 -0
- package/dist/hooks/use-icon-config.d.ts +2 -0
- package/dist/hooks/use-level-filters.d.ts +112 -0
- package/dist/hooks/use-level-search.d.ts +21 -0
- package/dist/hooks/use-locale.d.ts +10 -0
- package/dist/hooks/use-location-history.d.ts +42 -0
- package/dist/hooks/use-long-press.d.ts +25 -0
- package/dist/hooks/use-marquee.d.ts +35 -0
- package/dist/hooks/use-match-count.d.ts +8 -0
- package/dist/hooks/use-media-search.d.ts +44 -0
- package/dist/hooks/use-moving-ids.d.ts +3 -0
- package/dist/hooks/use-picks.d.ts +39 -0
- package/dist/hooks/use-preview-contents.d.ts +33 -0
- package/dist/hooks/use-properties.d.ts +25 -0
- package/dist/hooks/use-scroll-measure.d.ts +34 -0
- package/dist/hooks/use-search.d.ts +12 -0
- package/dist/hooks/use-selection.d.ts +29 -0
- package/dist/hooks/use-setting.d.ts +21 -0
- package/dist/hooks/use-stable-set.d.ts +6 -0
- package/dist/hooks/use-swipe.d.ts +41 -0
- package/dist/hooks/use-text-direction.d.ts +8 -0
- package/dist/hooks/use-thumbnail.d.ts +8 -0
- package/dist/hooks/use-transfer-queue.d.ts +22 -0
- package/dist/hooks/use-tree-rows.d.ts +9 -0
- package/dist/hooks/use-tree-selection.d.ts +19 -0
- package/dist/hooks/use-type-ahead.d.ts +9 -0
- package/dist/hooks/use-type-icons.d.ts +10 -0
- package/dist/hooks/use-upload-queue.d.ts +24 -0
- package/dist/hooks/use-virtual-lines.d.ts +27 -0
- package/dist/hooks/use-virtual-rows.d.ts +31 -0
- package/dist/hooks/use-wheel-zoom.d.ts +10 -0
- package/dist/icon-sets/filled.d.ts +6 -0
- package/dist/icon-sets/filled.js +76 -0
- package/dist/icon-sets/filled.js.map +1 -0
- package/dist/icon-sets/outlined.d.ts +6 -0
- package/dist/icon-sets/outlined.js +73 -0
- package/dist/icon-sets/outlined.js.map +1 -0
- package/dist/icon-sets/rounded.d.ts +6 -0
- package/dist/icon-sets/rounded.js +73 -0
- package/dist/icon-sets/rounded.js.map +1 -0
- package/dist/icon-sets/sharp.d.ts +6 -0
- package/dist/icon-sets/sharp.js +73 -0
- package/dist/icon-sets/sharp.js.map +1 -0
- package/dist/icon-sets/two-tone.d.ts +6 -0
- package/dist/icon-sets/two-tone.js +188 -0
- package/dist/icon-sets/two-tone.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +32651 -0
- package/dist/index.js.map +1 -0
- package/dist/locales/en-us.d.ts +7 -0
- package/dist/store/download-queue.d.ts +37 -0
- package/dist/store/folder-store.d.ts +79 -0
- package/dist/store/keyboard-layout.d.ts +11 -0
- package/dist/store/properties-cache.d.ts +73 -0
- package/dist/store/thumbnail-cache.d.ts +30 -0
- package/dist/store/transfer-across.d.ts +24 -0
- package/dist/store/transfer-queue.d.ts +59 -0
- package/dist/store/upload-queue.d.ts +83 -0
- package/dist/styles/arrived.d.ts +6 -0
- package/dist/styles/classes.d.ts +212 -0
- package/dist/styles/layout.d.ts +55 -0
- package/dist/styles/media-layout.d.ts +36 -0
- package/dist/styles/order.d.ts +1 -0
- package/dist/styles.css +7632 -0
- package/dist/styles.layer.css +7634 -0
- package/dist/types/action.d.ts +296 -0
- package/dist/types/adapter.d.ts +922 -0
- package/dist/types/api.d.ts +192 -0
- package/dist/types/clipboard.d.ts +45 -0
- package/dist/types/download.d.ts +41 -0
- package/dist/types/drag.d.ts +57 -0
- package/dist/types/folder.d.ts +47 -0
- package/dist/types/icon.d.ts +20 -0
- package/dist/types/index.d.ts +27 -0
- package/dist/types/limits.d.ts +49 -0
- package/dist/types/locale.d.ts +1132 -0
- package/dist/types/main-menu.d.ts +20 -0
- package/dist/types/media.d.ts +631 -0
- package/dist/types/menu.d.ts +82 -0
- package/dist/types/navigation.d.ts +88 -0
- package/dist/types/preview.d.ts +54 -0
- package/dist/types/previewer.d.ts +67 -0
- package/dist/types/properties.d.ts +111 -0
- package/dist/types/property-definition.d.ts +286 -0
- package/dist/types/search.d.ts +46 -0
- package/dist/types/section.d.ts +98 -0
- package/dist/types/selection.d.ts +52 -0
- package/dist/types/slots.d.ts +218 -0
- package/dist/types/transfer.d.ts +68 -0
- package/dist/types/tree.d.ts +97 -0
- package/dist/types/undo.d.ts +133 -0
- package/dist/types/upload.d.ts +189 -0
- package/dist/types/view.d.ts +192 -0
- package/dist/utils/action-groups.d.ts +17 -0
- package/dist/utils/bidi.d.ts +15 -0
- package/dist/utils/clipboard.d.ts +30 -0
- package/dist/utils/cx.d.ts +2 -0
- package/dist/utils/dom.d.ts +36 -0
- package/dist/utils/download.d.ts +30 -0
- package/dist/utils/field-errors.d.ts +26 -0
- package/dist/utils/files.d.ts +48 -0
- package/dist/utils/format.d.ts +10 -0
- package/dist/utils/groups.d.ts +29 -0
- package/dist/utils/hidden.d.ts +3 -0
- package/dist/utils/keyboard.d.ts +21 -0
- package/dist/utils/limits.d.ts +7 -0
- package/dist/utils/media.d.ts +146 -0
- package/dist/utils/menu-position.d.ts +13 -0
- package/dist/utils/names.d.ts +21 -0
- package/dist/utils/navigation.d.ts +28 -0
- package/dist/utils/path.d.ts +33 -0
- package/dist/utils/permissions.d.ts +56 -0
- package/dist/utils/preview.d.ts +27 -0
- package/dist/utils/property-value.d.ts +41 -0
- package/dist/utils/resize.d.ts +2 -0
- package/dist/utils/search.d.ts +24 -0
- package/dist/utils/sections.d.ts +11 -0
- package/dist/utils/selection.d.ts +30 -0
- package/dist/utils/sets.d.ts +2 -0
- package/dist/utils/shortcut.d.ts +74 -0
- package/dist/utils/slots.d.ts +15 -0
- package/dist/utils/sort.d.ts +47 -0
- package/dist/utils/transfer.d.ts +48 -0
- package/dist/utils/trash.d.ts +25 -0
- package/dist/utils/undo.d.ts +63 -0
- package/dist/utils/zoom.d.ts +14 -0
- package/docs/README.md +55 -0
- package/docs/actions.md +301 -0
- package/docs/adapter.md +229 -0
- package/docs/copy-move-trash-undo.md +97 -0
- package/docs/customizing.md +247 -0
- package/docs/getting-started.md +168 -0
- package/docs/locale-and-rtl.md +58 -0
- package/docs/media-manager.md +498 -0
- package/docs/previewing.md +124 -0
- package/docs/properties.md +125 -0
- package/docs/recipes/in-memory-adapter.md +149 -0
- package/docs/recipes/rest-adapter.md +225 -0
- package/docs/recipes/s3-adapter.md +137 -0
- package/docs/search.md +73 -0
- package/docs/sections.md +119 -0
- package/docs/state-and-api.md +190 -0
- package/docs/uploads-and-downloads.md +144 -0
- package/package.json +90 -4
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MouseEvent } from "react";
|
|
2
|
+
interface GroupCheckProps {
|
|
3
|
+
index: number;
|
|
4
|
+
onCheck: (index: number, event: MouseEvent) => void;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A group's own check, where a group can be selected: a click on the group goes in, so this is what
|
|
9
|
+
* selects it. Out of the Tab order and hidden from screen readers, as its Open button is, since Space on
|
|
10
|
+
* the group does the same, which its `option` says by being selected or not.
|
|
11
|
+
*/
|
|
12
|
+
declare const GroupCheck: ({ index, onCheck, className }: GroupCheckProps) => import("react").JSX.Element;
|
|
13
|
+
export default GroupCheck;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { FileAdapter, FileEntry } from "../../types/index.js";
|
|
2
|
+
interface GroupCreateProps {
|
|
3
|
+
adapter: FileAdapter;
|
|
4
|
+
/** The root or group it's made in. */
|
|
5
|
+
parentId: string;
|
|
6
|
+
/** Closes it, asking nothing of the backend, or stopping what was asked. */
|
|
7
|
+
onCancel: () => void;
|
|
8
|
+
onCreated: (group: FileEntry) => void;
|
|
9
|
+
/** Left while the backend was being asked, which may have made it by then. */
|
|
10
|
+
onLeft: () => void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Asks a new group's name, in the library rather than in a dialog of its own, as a picker is often in
|
|
14
|
+
* the app's own dialog already, and with no `form` element, as it may be in the app's form too. Only
|
|
15
|
+
* the backend knows what a group's name may be, so only the adapter's `checkName` is asked as it's
|
|
16
|
+
* typed, and its `createFolder` has the final say: a name refused stays, with why under it. It stays
|
|
17
|
+
* until that answers, the field read-only rather than disabled, so it keeps the focus.
|
|
18
|
+
*/
|
|
19
|
+
declare const GroupCreate: ({ adapter, parentId, onCancel, onCreated, onLeft }: GroupCreateProps) => import("react").JSX.Element;
|
|
20
|
+
export default GroupCreate;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { DropTarget, FileEntry } from "../../types/index.js";
|
|
2
|
+
interface GroupPathProps {
|
|
3
|
+
/** The library's name, where the path starts. */
|
|
4
|
+
label: string;
|
|
5
|
+
/** The groups gone into from its root, to the one open. */
|
|
6
|
+
trail: readonly FileEntry[];
|
|
7
|
+
/** Goes to the level with that many groups of the trail open. */
|
|
8
|
+
onGoToLevel: (depth: number) => void;
|
|
9
|
+
/** Whether the level it ends at names what's shown as a heading, as it does in the header. */
|
|
10
|
+
heading?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* The level a step of the way leads to as somewhere what's dragged in the library can be dropped,
|
|
13
|
+
* by how many groups of the trail it has open; without it, the steps take no drops, as in the move
|
|
14
|
+
* step. A drag resting on a step goes back there, as a drag resting on a group goes into it.
|
|
15
|
+
*/
|
|
16
|
+
dropTargetAt?: (depth: number) => DropTarget;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Where the group open is, as it was walked to, as it's only ever listed a level at a time: the
|
|
20
|
+
* library's name and the groups on the way, each going back there, and the one open, which names
|
|
21
|
+
* what's shown: the library itself, with no group open.
|
|
22
|
+
*/
|
|
23
|
+
declare const GroupPath: ({ label, trail, onGoToLevel, heading, dropTargetAt }: GroupPathProps) => import("react").JSX.Element;
|
|
24
|
+
export default GroupPath;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Ref } from "react";
|
|
2
|
+
import type { MediaSectionGroup, SlotAttributes } from "../../types/index.js";
|
|
3
|
+
interface LibraryListProps {
|
|
4
|
+
ref: Ref<HTMLElement>;
|
|
5
|
+
groups: readonly MediaSectionGroup[];
|
|
6
|
+
/** The id of the library shown. */
|
|
7
|
+
openId: string | undefined;
|
|
8
|
+
/** Whether the drawer is open, where the list doesn't dock. */
|
|
9
|
+
open: boolean;
|
|
10
|
+
onOpen: (sectionId: string) => void;
|
|
11
|
+
/** Closes the drawer. */
|
|
12
|
+
onClose: () => void;
|
|
13
|
+
/** The app's attributes for the list (`slotProps.libraries`). */
|
|
14
|
+
attributes?: SlotAttributes;
|
|
15
|
+
/** Out of reach, while the filters' dialog is over the frame. */
|
|
16
|
+
inert?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The libraries, the sections in their groups, as a list of places the library shows one of:
|
|
20
|
+
* docked beside it where there's room, or a drawer over it.
|
|
21
|
+
*/
|
|
22
|
+
declare const LibraryList: ({ ref, groups, openId, open, onOpen, onClose, attributes, inert }: LibraryListProps) => import("react").JSX.Element;
|
|
23
|
+
export default LibraryList;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { PropertiesCache } from "../../store/properties-cache.js";
|
|
2
|
+
import type { AssetHold, FileAdapter, FileEntry, FilePreviewer, FileUploadItem, MediaLayout, MediaSection, PropertyDefinition, PropertyDefinitionGroup } from "../../types/index.js";
|
|
3
|
+
interface MediaAssetProps {
|
|
4
|
+
entry: FileEntry;
|
|
5
|
+
section: MediaSection;
|
|
6
|
+
/** How its library shows it, whose smaller picture stands in while its own loads. */
|
|
7
|
+
layout: MediaLayout;
|
|
8
|
+
/** The library's adapter, its own or the media manager's. */
|
|
9
|
+
adapter: FileAdapter;
|
|
10
|
+
/** The name of the library or group it's in, which its back button goes to. */
|
|
11
|
+
backTo: string;
|
|
12
|
+
/** Whether it can be chosen here, which shows the Select toggle: an asset, or a group that can be selected. */
|
|
13
|
+
choosing: boolean;
|
|
14
|
+
selected: boolean;
|
|
15
|
+
/** Why it can't be chosen now, shown under the header, with Select held unless it's selected. */
|
|
16
|
+
hold: AssetHold | undefined;
|
|
17
|
+
/** The backend's work on it while it can be chosen all the same, shown as a hold is. */
|
|
18
|
+
work: AssetHold | undefined;
|
|
19
|
+
/** What shows assets of its library: the library's own previewers, then the media manager's. */
|
|
20
|
+
previewers: readonly FilePreviewer[];
|
|
21
|
+
/** What it shows: the library's own definitions, or the media manager's; the adapter's groups without. */
|
|
22
|
+
definitions: readonly PropertyDefinitionGroup[] | undefined;
|
|
23
|
+
onBack: () => void;
|
|
24
|
+
/** Goes to the asset before or after it in the library as shown; missing at either end. */
|
|
25
|
+
onPrevious: (() => void) | undefined;
|
|
26
|
+
onNext: (() => void) | undefined;
|
|
27
|
+
onToggleSelected: () => void;
|
|
28
|
+
/** Opens what can be asked of it, while there's anything. */
|
|
29
|
+
onProcess: (() => void) | undefined;
|
|
30
|
+
/** Opens a group's form, while it has one. */
|
|
31
|
+
onEdit: (() => void) | undefined;
|
|
32
|
+
/** Opens where it can be moved to, while it can be. */
|
|
33
|
+
onMove: (() => void) | undefined;
|
|
34
|
+
/** Opens the file picker for a file to take its place, while its file can be replaced. */
|
|
35
|
+
onReplace: (() => void) | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Opens the file picker for files to go into the part a property of its shows
|
|
38
|
+
* (`PropertyDefinition.upload`), while it can take them.
|
|
39
|
+
*/
|
|
40
|
+
onUploadPart: ((definition: PropertyDefinition) => void) | undefined;
|
|
41
|
+
/** The files being sent into its parts, waiting, under way or failed, which its properties list. */
|
|
42
|
+
partUploads: readonly FileUploadItem[];
|
|
43
|
+
onCancelUpload: (id: number) => void;
|
|
44
|
+
onRetryUpload: (id: number) => void;
|
|
45
|
+
/** Whether any of those is shown over it: it's hidden, but stays as it was, and takes the focus back. */
|
|
46
|
+
covered: boolean;
|
|
47
|
+
/** Whether it can be deleted, which shows the Delete button. */
|
|
48
|
+
deletable: boolean;
|
|
49
|
+
onDeleted: () => void;
|
|
50
|
+
/** Left while its delete was being asked for, which the backend may have done by then. */
|
|
51
|
+
onDeleteLeft: () => void;
|
|
52
|
+
/** Lists the library again once a field of the asset's is saved. */
|
|
53
|
+
onUpdated: () => void;
|
|
54
|
+
propertiesCache: PropertiesCache;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* One asset in the library's place: shown by the app's previewers, or its picture, with the
|
|
58
|
+
* properties its adapter hands over, editable where the library is, files uploaded into the parts they
|
|
59
|
+
* show where its adapter takes them, a way back to the library, to the assets before and after it, a
|
|
60
|
+
* new file put in its place where its adapter can, and, while the app takes a choice, a toggle
|
|
61
|
+
* selecting it. A group opens here for its fields, to be edited, moved or deleted, with what the app's
|
|
62
|
+
* previewers show of it and nothing else of an asset's.
|
|
63
|
+
*/
|
|
64
|
+
declare const MediaAsset: ({ entry, section, layout, adapter, backTo, choosing, selected, hold, work, previewers, definitions, onBack, onPrevious, onNext, onToggleSelected, onProcess, onEdit, onMove, onReplace, onUploadPart, partUploads, onCancelUpload, onRetryUpload, covered, deletable, onDeleted, onDeleteLeft, onUpdated, propertiesCache, }: MediaAssetProps) => import("react").JSX.Element;
|
|
65
|
+
export default MediaAsset;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { PropertiesCache } from "../../store/properties-cache.js";
|
|
2
|
+
import type { FileAdapter, FileEntry, PropertyDefinitionGroup } from "../../types/index.js";
|
|
3
|
+
interface MediaEditManyProps {
|
|
4
|
+
/** What's changed, as it was when this opened: what's selected while browsing. */
|
|
5
|
+
entries: readonly FileEntry[];
|
|
6
|
+
/** The fields offered for all of them (`fieldsForMany`). */
|
|
7
|
+
groups: readonly PropertyDefinitionGroup[];
|
|
8
|
+
/** The library's adapter, its own or the media manager's. */
|
|
9
|
+
adapter: FileAdapter;
|
|
10
|
+
/** What's come of entries' properties already, so they aren't asked for again. */
|
|
11
|
+
propertiesCache: PropertiesCache;
|
|
12
|
+
backLabel: string;
|
|
13
|
+
/** Closes it, nothing asked of the backend. */
|
|
14
|
+
onCancel: () => void;
|
|
15
|
+
/**
|
|
16
|
+
* Told what was saved each time some was: all of what was asked, `done`, or what the backend
|
|
17
|
+
* reported saved before it refused the rest, which stays to try again.
|
|
18
|
+
*/
|
|
19
|
+
onSaved: (entries: FileEntry[], done: boolean) => void;
|
|
20
|
+
/** Left while the backend was being asked, which may have saved some of it by then. */
|
|
21
|
+
onLeft: () => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Edit fields…, for what's selected while browsing, in the library's place: the fields all of them
|
|
25
|
+
* offer, each left as each one has it until it's ticked, then set the same for all of them, a list's
|
|
26
|
+
* items added, taken out or put in place. What they hold now is said beside each, the same value,
|
|
27
|
+
* none, or mixed, once each has said, for up to `SUMMARIZED_AT_MOST` of them. Save goes to the adapter's
|
|
28
|
+
* `updateManyProperties`, or else to its `updateProperties`, one at a time, a few at once, a list's
|
|
29
|
+
* items read from `properties` first; it stays until that's answered, to say why when some are refused,
|
|
30
|
+
* naming those left, and then saves only those.
|
|
31
|
+
*/
|
|
32
|
+
declare const MediaEditMany: ({ entries, groups, adapter, propertiesCache, backLabel, onCancel, onSaved, onLeft, }: MediaEditManyProps) => import("react").JSX.Element;
|
|
33
|
+
export default MediaEditMany;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { FieldErrors, FileAdapter, FileEntry, PropertyDefinitionGroup } from "../../types/index.js";
|
|
2
|
+
export interface MediaFieldsProps<V = Record<string, unknown>> {
|
|
3
|
+
/** What to draw, made fresh from `values` each time if it likes, as it's only read to be drawn. */
|
|
4
|
+
groups: readonly PropertyDefinitionGroup[];
|
|
5
|
+
/** What the form holds, each field's value under its `field`. */
|
|
6
|
+
values: V;
|
|
7
|
+
/** Takes all of what the form holds once a field has changed, for the form to keep or change further. */
|
|
8
|
+
setValues: (next: V) => void;
|
|
9
|
+
/** The library's adapter, handed to the fields' own `render` and `renderEdit`. */
|
|
10
|
+
adapter: FileAdapter;
|
|
11
|
+
/** The asset they're for; in an upload form there's none yet, but `files`. */
|
|
12
|
+
asset?: FileEntry;
|
|
13
|
+
/** The files about to be uploaded, in an upload form. */
|
|
14
|
+
files?: readonly File[];
|
|
15
|
+
/** The form's `errors`, each field finding its own by its `errorKey`. */
|
|
16
|
+
errors?: FieldErrors;
|
|
17
|
+
/** The place the fields' keys in `errors` are made from. Without it, no field shows its errors. */
|
|
18
|
+
index?: number;
|
|
19
|
+
/** Whether the form's being sent, while no field can be changed. */
|
|
20
|
+
sending?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Fields from their definitions, by groups, for a form of the app's to draw all or part of itself
|
|
24
|
+
* with: each drawn as its definition says, with what's held under its `field`, and each change handed
|
|
25
|
+
* back with the rest, as they are by then, so a field answering late doesn't undo what's changed
|
|
26
|
+
* meanwhile. They're made fresh as the form likes, from what it holds, so a field can
|
|
27
|
+
* follow another: gone, or `disabled`, as it's unticked. The labels are the app's; the media manager
|
|
28
|
+
* knows nothing of what they mean, nor of the languages they're in. `{...form}` hands it all it needs.
|
|
29
|
+
*/
|
|
30
|
+
declare const MediaFields: <V>({ groups, values, setValues, adapter, asset, files, errors, index: pickIndex, sending, }: MediaFieldsProps<V>) => import("react").JSX.Element;
|
|
31
|
+
export default MediaFields;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { MediaFilterChip } from "../../types/index.js";
|
|
2
|
+
interface MediaFilterChipsProps {
|
|
3
|
+
/** The filters set, as the form names them. */
|
|
4
|
+
chips: readonly MediaFilterChip[];
|
|
5
|
+
onRemove: (chip: MediaFilterChip) => void;
|
|
6
|
+
onClear: () => void;
|
|
7
|
+
/** Gives the focus to the header's Filters button, once no chip is left to take it. */
|
|
8
|
+
onEmptied: () => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The filters set, under the header, as chips (`MediaFilterForm.chips`), each a button removing its
|
|
12
|
+
* filter, then Clear all: a row sliding open as the first is set and shut as the last goes, still
|
|
13
|
+
* showing those that were while it does. A chip removed from the keyboard hands the focus to the one
|
|
14
|
+
* now in its place, or the one before, and the last, or Clear all, to the Filters button.
|
|
15
|
+
*/
|
|
16
|
+
declare const MediaFilterChips: ({ chips, onRemove, onClear, onEmptied }: MediaFilterChipsProps) => import("react").JSX.Element;
|
|
17
|
+
export default MediaFilterChips;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Ref } from "react";
|
|
2
|
+
import type { MediaFilterForm, MediaFilterFormParams } from "../../types/index.js";
|
|
3
|
+
type Filters = Readonly<Record<string, unknown>>;
|
|
4
|
+
interface MediaFiltersDialogProps {
|
|
5
|
+
ref?: Ref<HTMLDivElement>;
|
|
6
|
+
/** Its id, which the header's Filters button controls. */
|
|
7
|
+
id: string;
|
|
8
|
+
form: MediaFilterForm;
|
|
9
|
+
/** What the form is drawn with as it's applied, whose `values` it starts from. */
|
|
10
|
+
params: MediaFilterFormParams;
|
|
11
|
+
/** Nothing set, which Clear all puts it back to. */
|
|
12
|
+
defaults: Filters;
|
|
13
|
+
/** How many are set of what it holds. */
|
|
14
|
+
countOf: (values: Filters) => number;
|
|
15
|
+
/** Whether what it holds can be applied: true, or false, or why not. */
|
|
16
|
+
readinessOf: (values: Filters) => boolean | string;
|
|
17
|
+
/** Whether it's going, drawn until it has gone, as nothing can reach it any more. */
|
|
18
|
+
leaving: boolean;
|
|
19
|
+
/** Apply: what it holds, in place of what the form held. */
|
|
20
|
+
onApply: (values: Filters) => void;
|
|
21
|
+
/** Cancel, Escape or a press around it: the filters as they were. */
|
|
22
|
+
onCancel: () => void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A library's filters in a dialog over the whole component (`filtersVariant` `"dialog"`), for a form too
|
|
26
|
+
* big for the card, such as rules of a field, an operator and a value, or one whose half-finished
|
|
27
|
+
* changes shouldn't search: the app's filter form (`MediaSection.filterForm`), drawn as a component of
|
|
28
|
+
* its own as the other forms are, holding its own values from what's applied as it opens, until Apply
|
|
29
|
+
* puts them in place of those, held back while the form's `ready` says no, with why beside it. Clear all
|
|
30
|
+
* clears what it holds, not yet what's applied. Cancel, Escape or a press around it leaves the filters
|
|
31
|
+
* as they were; Escape in a field only leaves the field, as a second cancels what's been changed, and
|
|
32
|
+
* goes no further, so an app's dialog around it stays.
|
|
33
|
+
*
|
|
34
|
+
* Drawn inside the component rather than portaled out, as a picker in an app's own modal dialog would
|
|
35
|
+
* have its focus trapped away from a portal, so it covers the component, not the page: the frame puts
|
|
36
|
+
* the rest of itself out of reach (`inert`) while it shows, and Tab goes round inside it.
|
|
37
|
+
*/
|
|
38
|
+
declare const MediaFiltersDialog: ({ ref, id, form, params, defaults, countOf, readinessOf, leaving, onApply, onCancel, }: MediaFiltersDialogProps) => import("react").JSX.Element;
|
|
39
|
+
export default MediaFiltersDialog;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { FocusEvent, Ref, RefObject } from "react";
|
|
2
|
+
import type { MediaFilterForm, MediaFilterFormParams } from "../../types/index.js";
|
|
3
|
+
interface MediaFiltersProps {
|
|
4
|
+
ref?: Ref<HTMLDivElement>;
|
|
5
|
+
/** Its id, which the header's Filters button controls. */
|
|
6
|
+
id: string;
|
|
7
|
+
form: MediaFilterForm;
|
|
8
|
+
params: MediaFilterFormParams;
|
|
9
|
+
/** How many filters are set, for Clear all. */
|
|
10
|
+
count: number;
|
|
11
|
+
/** Why what's set isn't applied yet: the form's reason, or false for none given; undefined while it is. */
|
|
12
|
+
heldBack: string | false | undefined;
|
|
13
|
+
/** Whether it's folding away, drawn until it has gone, as nothing can reach it any more. */
|
|
14
|
+
leaving: boolean;
|
|
15
|
+
/** The header's Filters button, which it drops from. */
|
|
16
|
+
anchorRef: RefObject<HTMLElement | null>;
|
|
17
|
+
onClear: () => void;
|
|
18
|
+
/** Escape: folds it away, the filters staying set, and gives the focus to the Filters button. */
|
|
19
|
+
onClose: () => void;
|
|
20
|
+
/** The focus leaving it, which folds it away when it goes on to the rest of the library. */
|
|
21
|
+
onBlur: (event: FocusEvent<HTMLDivElement>) => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A library's filters in a card dropping from the header's Filters button over the results, as a menu
|
|
25
|
+
* does, so the results stay where they are and change behind it as the filters do: the app's filter
|
|
26
|
+
* form (`MediaSection.filterForm`), drawn as a component of its own as the other forms are, and at its
|
|
27
|
+
* foot, why what's set isn't applied yet, while the form's `ready` holds it, and Clear all while any is
|
|
28
|
+
* set. What's changed applies as the search does, a moment after the last change, so there's nothing
|
|
29
|
+
* to submit, nor a button to fold it away: a press outside does, or Escape, going no further, so an
|
|
30
|
+
* app's dialog around it stays. A non-modal `dialog`, drawn inside the library rather than portaled
|
|
31
|
+
* out of it, so a picker in an app's modal dialog keeps the focus in reach.
|
|
32
|
+
*
|
|
33
|
+
* It sits in the library's panel, its end under the button's, measured from both, as the header's
|
|
34
|
+
* buttons come and go and the library is resized, and grows from under the button.
|
|
35
|
+
*/
|
|
36
|
+
declare const MediaFilters: ({ ref, id, form, params, count, heldBack, leaving, anchorRef, onClear, onClose, onBlur, }: MediaFiltersProps) => import("react").JSX.Element;
|
|
37
|
+
export default MediaFilters;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
interface MediaFormBodyProps<P> {
|
|
3
|
+
form: {
|
|
4
|
+
render(params: P): ReactNode;
|
|
5
|
+
};
|
|
6
|
+
params: P;
|
|
7
|
+
}
|
|
8
|
+
interface ChoiceMessagesProps {
|
|
9
|
+
/** The pick's own messages, about it as a whole, which `choiceErrorKey` finds. */
|
|
10
|
+
messages: readonly string[];
|
|
11
|
+
}
|
|
12
|
+
interface FormFailureProps {
|
|
13
|
+
/** Why the backend refused what the form holds. */
|
|
14
|
+
message: string;
|
|
15
|
+
/** What's to be said of it beside the backend's message, on a line of its own, such as what was left. */
|
|
16
|
+
detail?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A form of the app's, drawn as a component of its own, so hooks in its `render` always belong to the
|
|
20
|
+
* same one, wherever it's shown and whatever's shown around it. A component made afresh inside `render`
|
|
21
|
+
* would start over at each change, losing the focus and what its hooks hold, so that's warned of, once:
|
|
22
|
+
* the same name as last time on another function can only be that.
|
|
23
|
+
*/
|
|
24
|
+
export declare const MediaFormBody: <P>({ form, params }: MediaFormBodyProps<P>) => ReactNode;
|
|
25
|
+
/** A pick's own errors, above its form. */
|
|
26
|
+
export declare const ChoiceMessages: ({ messages }: ChoiceMessagesProps) => false | import("react").JSX.Element;
|
|
27
|
+
/** Why an upload's or a process form was refused, over it, brought into view as the form may be scrolled. */
|
|
28
|
+
export declare const FormFailure: ({ message, detail }: FormFailureProps) => import("react").JSX.Element;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { ReactNode, Ref } from "react";
|
|
2
|
+
import type { PropertiesCache } from "../../store/properties-cache.js";
|
|
3
|
+
import type { FileAdapter, FileEntry, FilePreviewer, FieldErrors, MediaActionGroup, MediaAssetParams, MediaChoice, MediaFiltersVariant, MediaLayouts, MediaLocation, MediaLocationChangeReason, MediaManagerApi, MediaManagerSlotProps, MediaManagerSlots, MediaPickForm, MediaSearch, MediaSection, MediaSectionGroup, MediaViewed, PropertyDefinitionGroup, PropertyErrorKeyParams } from "../../types/index.js";
|
|
4
|
+
export interface MediaFrameProps {
|
|
5
|
+
groups: readonly MediaSectionGroup[];
|
|
6
|
+
adapter: FileAdapter;
|
|
7
|
+
multiple: boolean;
|
|
8
|
+
/** How many can be selected at once with `multiple`. */
|
|
9
|
+
maxChoices: number | undefined;
|
|
10
|
+
/** Whether an asset can be added beside those already picked, for this use. */
|
|
11
|
+
canSelect: ((asset: FileEntry, section: MediaSection, choices: readonly MediaChoice[], trail: readonly FileEntry[] | undefined) => boolean | string) | undefined;
|
|
12
|
+
/** Whether groups can be selected as well as assets, while the app takes a pick. */
|
|
13
|
+
selectGroups: boolean;
|
|
14
|
+
/** The app's actions in the header. */
|
|
15
|
+
actions: readonly MediaActionGroup[] | undefined;
|
|
16
|
+
/** Whether what's shown can't be dragged onto a group or a step of the path while browsing. */
|
|
17
|
+
disableDrag: boolean;
|
|
18
|
+
/** How a library's filters show, where its form doesn't say (`MediaFilterForm.variant`). */
|
|
19
|
+
filtersVariant: MediaFiltersVariant;
|
|
20
|
+
onChoose: ((choices: MediaChoice[]) => void) | undefined;
|
|
21
|
+
pickForm: ((asset: FileEntry, section: MediaSection) => MediaPickForm | null) | undefined;
|
|
22
|
+
/** What an asset shows as it's opened, where its library has no `properties` of its own. */
|
|
23
|
+
properties: ((asset: FileEntry, section: MediaSection) => PropertyDefinitionGroup[]) | undefined;
|
|
24
|
+
/** The media manager's own previewers, asked after a library's. */
|
|
25
|
+
previewers: readonly FilePreviewer[] | undefined;
|
|
26
|
+
/** Draws the assets of the libraries with no `renderAsset` of their own. */
|
|
27
|
+
renderAsset: ((params: MediaAssetParams) => ReactNode) | undefined;
|
|
28
|
+
/** Draws the groups of the libraries with no `renderGroup` of their own. */
|
|
29
|
+
renderGroup: ((params: MediaAssetParams) => ReactNode) | undefined;
|
|
30
|
+
/** Draws what's above an open group's contents, in the libraries with no `groupHeader` of their own. */
|
|
31
|
+
groupHeader: ((group: FileEntry, section: MediaSection) => ReactNode) | undefined;
|
|
32
|
+
/** The layout each library is shown in, when the app keeps them. */
|
|
33
|
+
layout: MediaLayouts | undefined;
|
|
34
|
+
/** Where the libraries' layouts start, while it doesn't. */
|
|
35
|
+
defaultLayout: MediaLayouts | undefined;
|
|
36
|
+
onLayoutChange: ((layout: MediaLayouts) => void) | undefined;
|
|
37
|
+
/** The library shown and the group open in it, when the app keeps it; null for the first library's root. */
|
|
38
|
+
location: MediaLocation | null | undefined;
|
|
39
|
+
/** Where it starts, while the app doesn't keep it. */
|
|
40
|
+
defaultLocation: MediaLocation | undefined;
|
|
41
|
+
onLocationChange: ((location: MediaLocation, reason: MediaLocationChangeReason) => void) | undefined;
|
|
42
|
+
/** What's shown in the library's place, when the app keeps it; null for the library itself. */
|
|
43
|
+
viewed: MediaViewed | null | undefined;
|
|
44
|
+
/** What's shown in the library's place as it mounts, while the app doesn't keep it. */
|
|
45
|
+
defaultViewed: MediaViewed | undefined;
|
|
46
|
+
onViewedChange: ((viewed: MediaViewed | null) => void) | undefined;
|
|
47
|
+
/** The search, when the app keeps it; null while closed. */
|
|
48
|
+
search: MediaSearch | null | undefined;
|
|
49
|
+
/** The search as it mounts, while the app doesn't keep it. */
|
|
50
|
+
defaultSearch: MediaSearch | undefined;
|
|
51
|
+
onSearchChange: ((search: MediaSearch | null) => void) | undefined;
|
|
52
|
+
/** Uploads at once, from `limits`, or the queue's default. */
|
|
53
|
+
uploadLimit: number | undefined;
|
|
54
|
+
/** Moves at once, from `limits`, or the queue's default. */
|
|
55
|
+
transferLimit: number | undefined;
|
|
56
|
+
/** How long the typing stops before the adapter's `search` is asked, from `limits`, or the default. */
|
|
57
|
+
searchDelay: number | undefined;
|
|
58
|
+
apiRef: Ref<MediaManagerApi> | undefined;
|
|
59
|
+
/** What's selected, when the app keeps it. */
|
|
60
|
+
value: readonly MediaChoice[] | undefined;
|
|
61
|
+
/** What's selected as it mounts, while it doesn't. */
|
|
62
|
+
defaultValue: readonly MediaChoice[] | undefined;
|
|
63
|
+
/** Told what's selected, as it changes. */
|
|
64
|
+
onChange: ((choices: MediaChoice[]) => void) | undefined;
|
|
65
|
+
/** The app's backend's errors, for the picks and their forms, as the app passed them. */
|
|
66
|
+
errors: FieldErrors;
|
|
67
|
+
/** Where a pick's own errors are in `errors`, about it as a whole. */
|
|
68
|
+
choiceErrorKey: ((params: PropertyErrorKeyParams) => string | readonly string[]) | undefined;
|
|
69
|
+
propertiesCache: PropertiesCache;
|
|
70
|
+
/** The app's own states, drawn in their boxes in place of the media manager's (`slots`). */
|
|
71
|
+
slots: MediaManagerSlots;
|
|
72
|
+
/** The app's attributes for the media manager's parts (`slotProps`). */
|
|
73
|
+
slotProps: MediaManagerSlotProps;
|
|
74
|
+
}
|
|
75
|
+
/** Everything inside the media manager's root, below the contexts it provides. */
|
|
76
|
+
declare const MediaFrame: ({ groups, adapter, multiple, maxChoices, canSelect, selectGroups, actions, disableDrag, filtersVariant, onChoose, pickForm, properties, previewers, renderAsset, renderGroup, groupHeader, layout: layoutProp, defaultLayout, onLayoutChange, location: locationProp, defaultLocation, onLocationChange, viewed: viewedProp, defaultViewed, onViewedChange, search: searchProp, defaultSearch, onSearchChange, uploadLimit, transferLimit, searchDelay, apiRef, value, defaultValue, onChange, errors, choiceErrorKey, propertiesCache, slots, slotProps, }: MediaFrameProps) => import("react").JSX.Element;
|
|
77
|
+
export default MediaFrame;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { DragEvent, ReactNode, Ref } from "react";
|
|
2
|
+
import type { AssetHold, DropTarget, FileAdapter, FileEntry, FolderRef, HeldPress, MediaAssetDraw, MediaGridHandle, MediaKind, MediaLayout, MediaPickerSlotProps, MediaPickerSlots, MediaSection, UploadItem } from "../../types/index.js";
|
|
3
|
+
interface MediaGridProps {
|
|
4
|
+
/** The open level's assets and groups the search leaves, or what it found below, in the order shown. */
|
|
5
|
+
entries: readonly FileEntry[];
|
|
6
|
+
/** Where those from further down than the open level are, by their ids. */
|
|
7
|
+
trails?: ReadonlyMap<string, readonly FolderRef[]>;
|
|
8
|
+
/**
|
|
9
|
+
* Files being uploaded into the library, shown before its assets until they're listed, and folders
|
|
10
|
+
* being made its groups, until the group is.
|
|
11
|
+
*/
|
|
12
|
+
uploads: readonly UploadItem[];
|
|
13
|
+
/** The library's kind, whose tiles' shape they take, and its icon. */
|
|
14
|
+
kind: MediaKind;
|
|
15
|
+
/** How they're shown: as tiles, or as rows. */
|
|
16
|
+
layout: MediaLayout;
|
|
17
|
+
adapter: FileAdapter;
|
|
18
|
+
/** What the app draws the assets with, the library's `renderAsset` or the media manager's. */
|
|
19
|
+
drawAsset: MediaAssetDraw | undefined;
|
|
20
|
+
/** What the app draws the groups with, the library's `renderGroup` or the media manager's. */
|
|
21
|
+
drawGroup: MediaAssetDraw | undefined;
|
|
22
|
+
/** Whether a group has details to open, which puts the Open button on it. */
|
|
23
|
+
opensGroups: boolean;
|
|
24
|
+
/** Whether an asset has a view to open, which puts the Open button on it; the picker's have none. */
|
|
25
|
+
opensAssets?: boolean;
|
|
26
|
+
/** What the app draws above an open group's contents. */
|
|
27
|
+
header: ReactNode;
|
|
28
|
+
/** The name of the library or group open, which the grid is named by for screen readers. */
|
|
29
|
+
label: string;
|
|
30
|
+
selectedIds: ReadonlySet<string>;
|
|
31
|
+
/** Why assets can't be chosen now, by their ids, which their tiles show. */
|
|
32
|
+
holds: ReadonlyMap<string, AssetHold>;
|
|
33
|
+
/** The backend's work on assets that can be chosen all the same, by their ids. */
|
|
34
|
+
works: ReadonlyMap<string, AssetHold>;
|
|
35
|
+
/** The groups that can be selected, each with a check of its own, as a click on one goes in. */
|
|
36
|
+
groupChecks?: ReadonlySet<string>;
|
|
37
|
+
/** Whether as many as may be are selected (`maxChoices`), so there's no room for the others. */
|
|
38
|
+
full: boolean;
|
|
39
|
+
multiple: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Whether what's selected is for acting on in place, while the media manager is browsing, as a file
|
|
42
|
+
* manager's selection is: a click selects one alone, Ctrl or ⌘ adds or takes one out, Shift selects a
|
|
43
|
+
* range, a group by its check or those keys, as a click goes in; Space adds or takes out, Shift and
|
|
44
|
+
* the arrows extend, Ctrl+A selects them all, Escape clears, and Delete or Backspace asks to delete.
|
|
45
|
+
* Otherwise it's what's picked, by `multiple`.
|
|
46
|
+
*/
|
|
47
|
+
browsing?: boolean;
|
|
48
|
+
/** While browsing, a touch screen's selection mode, a long-press having started it: every tap adds or takes out. */
|
|
49
|
+
selecting?: boolean;
|
|
50
|
+
/** A long-press on an asset or group, by touch or pen, which a touch drag may go on from; none, none is taken. */
|
|
51
|
+
onLongPress?: (index: number, press: HeldPress) => void;
|
|
52
|
+
/** Whether what's shown can be dragged, to be dropped on a group or a step of the path. */
|
|
53
|
+
draggable?: boolean;
|
|
54
|
+
/** Starts a mouse drag from the asset or group pressed, by its index. */
|
|
55
|
+
onDragStart?: (index: number, event: DragEvent) => void;
|
|
56
|
+
/** The ids of what's being dragged, which fade. */
|
|
57
|
+
draggedIds?: ReadonlySet<string>;
|
|
58
|
+
/** A group as somewhere what's dragged could be dropped, by its index; without it, nothing in the grid takes drops. */
|
|
59
|
+
dropTargetOf?: (index: number) => DropTarget | undefined;
|
|
60
|
+
/** Delete on what's selected, while browsing. */
|
|
61
|
+
onDelete?: () => void;
|
|
62
|
+
/** Escape on what's selected, while browsing. */
|
|
63
|
+
onClearSelection?: () => void;
|
|
64
|
+
status: "loading" | "ready" | "error";
|
|
65
|
+
/** Whether the open level has anything at all, whatever the search leaves. */
|
|
66
|
+
hasMedia: boolean;
|
|
67
|
+
/** Whether more of the library is still coming, page by page, or it's listed again. */
|
|
68
|
+
busy: boolean;
|
|
69
|
+
/** Why it couldn't be listed, as the adapter said it, or nothing. */
|
|
70
|
+
error: string | undefined;
|
|
71
|
+
onRetry: () => void;
|
|
72
|
+
/** A click on a tile, or Space on it, with the keys held, by its index in `entries`. */
|
|
73
|
+
onPress: (index: number, keys: {
|
|
74
|
+
toggle: boolean;
|
|
75
|
+
range: boolean;
|
|
76
|
+
}) => void;
|
|
77
|
+
/** Choosing a tile on its own: a double click, or Enter, which goes into a group. */
|
|
78
|
+
onActivate: (index: number) => void;
|
|
79
|
+
/** Going into a group, from a click on it. */
|
|
80
|
+
onEnterGroup: (index: number) => void;
|
|
81
|
+
/** Going up a level, by Alt+Up; missing at the library's root. */
|
|
82
|
+
onLevelUp: (() => void) | undefined;
|
|
83
|
+
/** Opening an asset in the library's place: its button, or Alt+Enter. */
|
|
84
|
+
onOpen: (index: number) => void;
|
|
85
|
+
onSelectAll: () => void;
|
|
86
|
+
/** Takes an asset or group to focus, by its index, wherever it is in the grid. */
|
|
87
|
+
ref?: Ref<MediaGridHandle>;
|
|
88
|
+
/** The library shown, which the app's states and attributes are handed. */
|
|
89
|
+
section: MediaSection;
|
|
90
|
+
/** The group open, or null at the library's root. */
|
|
91
|
+
group: FileEntry | null;
|
|
92
|
+
/** What's typed in the search field, for the app's `noResults`. */
|
|
93
|
+
query: string;
|
|
94
|
+
/** What the library's filters held as applied, while any is set, for the app's `noResults`. */
|
|
95
|
+
filters?: Readonly<Record<string, unknown>>;
|
|
96
|
+
/** Uploads into the level as its Upload button does, for the app's `empty`; missing where it takes no files. */
|
|
97
|
+
onUpload?: () => void;
|
|
98
|
+
/** The app's own states, drawn in their boxes in place of the media manager's (`slots`). */
|
|
99
|
+
slots: MediaPickerSlots;
|
|
100
|
+
/** The app's attributes for each asset (`slotProps.asset`). */
|
|
101
|
+
assetSlot: MediaPickerSlotProps["asset"];
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* The open level's assets and groups as a grid of tiles, or a list of rows, a `listbox` of `option`s with one Tab
|
|
105
|
+
* stop, which the arrow keys, Home and End move. Space selects, Enter chooses, Alt+Enter opens one in the
|
|
106
|
+
* library's place, Ctrl+A selects them all. A click or Enter goes into a group, and Alt+Up back out.
|
|
107
|
+
*
|
|
108
|
+
* Only the assets in or near view are rendered, in lines as tall as the first one rendered, as the file
|
|
109
|
+
* manager's content is (`useVirtualLines`, see `virtualization.md`), and the one with the Tab stop
|
|
110
|
+
* wherever it is. So every asset is drawn as tall, and the frames focus one through `ref`'s `focusAt`
|
|
111
|
+
* rather than finding it in the page.
|
|
112
|
+
*/
|
|
113
|
+
declare const MediaGrid: ({ entries, trails, uploads, kind, layout, adapter, drawAsset, drawGroup, opensGroups, opensAssets, header, label, selectedIds, holds, works, groupChecks, full, multiple, browsing, selecting, onLongPress, draggable, onDragStart, draggedIds, dropTargetOf, onDelete, onClearSelection, status, hasMedia, busy, error, onRetry, onPress, onActivate, onEnterGroup, onLevelUp, onOpen, onSelectAll, ref, section, group, query, filters, onUpload, slots, assetSlot, }: MediaGridProps) => import("react").JSX.Element;
|
|
114
|
+
export default MediaGrid;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { FileAdapter, FileEntry, MediaGroupForm, MediaSection } from "../../types/index.js";
|
|
2
|
+
interface MediaGroupProps {
|
|
3
|
+
/** The group being edited, as it's listed now, or `null` for one being made. */
|
|
4
|
+
group: FileEntry | null;
|
|
5
|
+
/** The group it's in, `null` at the library's root. */
|
|
6
|
+
parent: FileEntry | null;
|
|
7
|
+
/** The id of the root or group it's made in. */
|
|
8
|
+
parentId: string;
|
|
9
|
+
section: MediaSection;
|
|
10
|
+
/** The library's adapter, its own or the media manager's. */
|
|
11
|
+
adapter: FileAdapter;
|
|
12
|
+
form: MediaGroupForm;
|
|
13
|
+
/** What its back button goes to. */
|
|
14
|
+
backLabel: string;
|
|
15
|
+
onCancel: () => void;
|
|
16
|
+
/** The backend said yes, with the group as it now is when it says. */
|
|
17
|
+
onDone: (group: FileEntry | undefined) => void;
|
|
18
|
+
/** Left while the backend was being asked, which may have done it by then. */
|
|
19
|
+
onLeft: () => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The step making or editing a group, in the library's place: the library's group form, which holds
|
|
23
|
+
* what it likes, under the app's own keys, as the media manager never reads them. Editing, its `load`
|
|
24
|
+
* brings what it starts from first, with Try again should that fail. What it holds goes to the adapter's
|
|
25
|
+
* `createGroup` or `updateGroup`, and it stays until that's answered, to say why when it's refused, over
|
|
26
|
+
* the form and under the fields it names.
|
|
27
|
+
*/
|
|
28
|
+
declare const MediaGroup: ({ group, parent, parentId, section, adapter, form, backLabel, onCancel, onDone, onLeft, }: MediaGroupProps) => import("react").JSX.Element;
|
|
29
|
+
export default MediaGroup;
|