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.
Files changed (280) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/LICENSE +21 -0
  3. package/README.md +65 -2
  4. package/THIRD_PARTY_NOTICES.md +63 -0
  5. package/dist/components/buttons/toolbar-actions.d.ts +28 -0
  6. package/dist/components/buttons/tooltip-icon-button.d.ts +14 -0
  7. package/dist/components/downloads/download-panel.d.ts +23 -0
  8. package/dist/components/drag/drag-preview.d.ts +24 -0
  9. package/dist/components/file-manager/announcer.d.ts +14 -0
  10. package/dist/components/file-manager/content/file-grid.d.ts +8 -0
  11. package/dist/components/file-manager/content/file-list.d.ts +9 -0
  12. package/dist/components/file-manager/content/folder-view.d.ts +83 -0
  13. package/dist/components/file-manager/content/item-icon.d.ts +16 -0
  14. package/dist/components/file-manager/content/no-sections.d.ts +11 -0
  15. package/dist/components/file-manager/content/search-results.d.ts +40 -0
  16. package/dist/components/file-manager/content/search-tabs.d.ts +29 -0
  17. package/dist/components/file-manager/content/trash-bar.d.ts +13 -0
  18. package/dist/components/file-manager/context-menu/context-menu.d.ts +20 -0
  19. package/dist/components/file-manager/dialogs/conflict-step.d.ts +28 -0
  20. package/dist/components/file-manager/dialogs/delete-dialog.d.ts +49 -0
  21. package/dist/components/file-manager/dialogs/image-viewer.d.ts +42 -0
  22. package/dist/components/file-manager/dialogs/name-dialog.d.ts +41 -0
  23. package/dist/components/file-manager/dialogs/paste-dialog.d.ts +39 -0
  24. package/dist/components/file-manager/dialogs/preview-dialog.d.ts +75 -0
  25. package/dist/components/file-manager/dialogs/restore-dialog.d.ts +41 -0
  26. package/dist/components/file-manager/dialogs/shortcuts-dialog.d.ts +36 -0
  27. package/dist/components/file-manager/dialogs/transfer-dialog.d.ts +71 -0
  28. package/dist/components/file-manager/dialogs/upload-dialog.d.ts +34 -0
  29. package/dist/components/file-manager/file-manager.d.ts +320 -0
  30. package/dist/components/file-manager/find-layer.d.ts +29 -0
  31. package/dist/components/file-manager/header-bar/header-bar.d.ts +65 -0
  32. package/dist/components/file-manager/header-bar/history-menu.d.ts +18 -0
  33. package/dist/components/file-manager/header-bar/path-bar.d.ts +19 -0
  34. package/dist/components/file-manager/header-bar/path-field.d.ts +23 -0
  35. package/dist/components/file-manager/header-bar/search-field.d.ts +27 -0
  36. package/dist/components/file-manager/header-bar/search-sections-menu.d.ts +25 -0
  37. package/dist/components/file-manager/header-bar/view-menu.d.ts +39 -0
  38. package/dist/components/file-manager/notice-bar.d.ts +36 -0
  39. package/dist/components/file-manager/properties-pane.d.ts +53 -0
  40. package/dist/components/file-manager/resize-edge.d.ts +39 -0
  41. package/dist/components/file-manager/selection-bar.d.ts +15 -0
  42. package/dist/components/file-manager/sidebar/location-item.d.ts +36 -0
  43. package/dist/components/file-manager/sidebar/main-menu.d.ts +23 -0
  44. package/dist/components/file-manager/sidebar/sidebar.d.ts +80 -0
  45. package/dist/components/icons/check-badge.d.ts +3 -0
  46. package/dist/components/icons/create-icon.d.ts +20 -0
  47. package/dist/components/icons/file-icon.d.ts +19 -0
  48. package/dist/components/icons/icon-provider.d.ts +21 -0
  49. package/dist/components/icons/icon-slot.d.ts +6 -0
  50. package/dist/components/icons/icon.d.ts +19 -0
  51. package/dist/components/icons/locked-icon.d.ts +9 -0
  52. package/dist/components/media-manager/asset-delete.d.ts +29 -0
  53. package/dist/components/media-manager/asset-hold.d.ts +32 -0
  54. package/dist/components/media-manager/asset-option.d.ts +74 -0
  55. package/dist/components/media-manager/asset-trail.d.ts +13 -0
  56. package/dist/components/media-manager/choice-list.d.ts +29 -0
  57. package/dist/components/media-manager/choices-pane.d.ts +50 -0
  58. package/dist/components/media-manager/choose-bar.d.ts +26 -0
  59. package/dist/components/media-manager/drop-zone.d.ts +7 -0
  60. package/dist/components/media-manager/group-check.d.ts +13 -0
  61. package/dist/components/media-manager/group-create.d.ts +20 -0
  62. package/dist/components/media-manager/group-path.d.ts +24 -0
  63. package/dist/components/media-manager/library-list.d.ts +23 -0
  64. package/dist/components/media-manager/media-asset.d.ts +65 -0
  65. package/dist/components/media-manager/media-edit-many.d.ts +33 -0
  66. package/dist/components/media-manager/media-fields.d.ts +31 -0
  67. package/dist/components/media-manager/media-filter-chips.d.ts +17 -0
  68. package/dist/components/media-manager/media-filters-dialog.d.ts +39 -0
  69. package/dist/components/media-manager/media-filters.d.ts +37 -0
  70. package/dist/components/media-manager/media-form.d.ts +29 -0
  71. package/dist/components/media-manager/media-frame.d.ts +77 -0
  72. package/dist/components/media-manager/media-grid.d.ts +114 -0
  73. package/dist/components/media-manager/media-group.d.ts +29 -0
  74. package/dist/components/media-manager/media-header.d.ts +80 -0
  75. package/dist/components/media-manager/media-manager.d.ts +309 -0
  76. package/dist/components/media-manager/media-move.d.ts +30 -0
  77. package/dist/components/media-manager/media-picker.d.ts +140 -0
  78. package/dist/components/media-manager/media-picture.d.ts +26 -0
  79. package/dist/components/media-manager/media-process.d.ts +26 -0
  80. package/dist/components/media-manager/media-row.d.ts +13 -0
  81. package/dist/components/media-manager/media-step.d.ts +33 -0
  82. package/dist/components/media-manager/media-tile.d.ts +15 -0
  83. package/dist/components/media-manager/media-upload.d.ts +46 -0
  84. package/dist/components/media-manager/open-button.d.ts +15 -0
  85. package/dist/components/media-manager/picker-frame.d.ts +33 -0
  86. package/dist/components/media-manager/selection-bar.d.ts +25 -0
  87. package/dist/components/media-manager/upload-tile.d.ts +17 -0
  88. package/dist/components/properties/properties-panel.d.ts +53 -0
  89. package/dist/components/properties/property-display.d.ts +15 -0
  90. package/dist/components/properties/property-editor.d.ts +26 -0
  91. package/dist/components/properties/property-input.d.ts +36 -0
  92. package/dist/components/transfers/transfer-panel.d.ts +25 -0
  93. package/dist/components/ui/backdrop.d.ts +7 -0
  94. package/dist/components/ui/button-base.d.ts +7 -0
  95. package/dist/components/ui/button.d.ts +18 -0
  96. package/dist/components/ui/checkbox.d.ts +24 -0
  97. package/dist/components/ui/chip.d.ts +18 -0
  98. package/dist/components/ui/circular-progress.d.ts +14 -0
  99. package/dist/components/ui/collapse.d.ts +9 -0
  100. package/dist/components/ui/dialog.d.ts +40 -0
  101. package/dist/components/ui/divider.d.ts +4 -0
  102. package/dist/components/ui/icon-button.d.ts +12 -0
  103. package/dist/components/ui/linear-progress.d.ts +13 -0
  104. package/dist/components/ui/link.d.ts +4 -0
  105. package/dist/components/ui/menu.d.ts +77 -0
  106. package/dist/components/ui/root-providers.d.ts +16 -0
  107. package/dist/components/ui/text-field.d.ts +38 -0
  108. package/dist/components/ui/text.d.ts +21 -0
  109. package/dist/components/ui/tooltip.d.ts +24 -0
  110. package/dist/components/uploads/upload-panel.d.ts +31 -0
  111. package/dist/contexts/asset-look-context.d.ts +1 -0
  112. package/dist/contexts/cut-context.d.ts +6 -0
  113. package/dist/contexts/data-context.d.ts +12 -0
  114. package/dist/contexts/direction-context.d.ts +2 -0
  115. package/dist/contexts/drag-context.d.ts +36 -0
  116. package/dist/contexts/icon-context.d.ts +10 -0
  117. package/dist/contexts/locale-context.d.ts +2 -0
  118. package/dist/contexts/moving-context.d.ts +7 -0
  119. package/dist/create-icon-D2vnnBQX.js +40 -0
  120. package/dist/create-icon-D2vnnBQX.js.map +1 -0
  121. package/dist/hooks/use-announcer.d.ts +20 -0
  122. package/dist/hooks/use-asset-look.d.ts +6 -0
  123. package/dist/hooks/use-asset-states.d.ts +12 -0
  124. package/dist/hooks/use-chosen-column.d.ts +16 -0
  125. package/dist/hooks/use-clipboard-follow.d.ts +12 -0
  126. package/dist/hooks/use-controlled.d.ts +18 -0
  127. package/dist/hooks/use-cut-ids.d.ts +3 -0
  128. package/dist/hooks/use-dev-checks.d.ts +16 -0
  129. package/dist/hooks/use-download-queue.d.ts +19 -0
  130. package/dist/hooks/use-dragged-ids.d.ts +3 -0
  131. package/dist/hooks/use-drop-target.d.ts +48 -0
  132. package/dist/hooks/use-entry-drag.d.ts +46 -0
  133. package/dist/hooks/use-files-drop.d.ts +20 -0
  134. package/dist/hooks/use-folder.d.ts +14 -0
  135. package/dist/hooks/use-fork-ref.d.ts +6 -0
  136. package/dist/hooks/use-form-send.d.ts +12 -0
  137. package/dist/hooks/use-found.d.ts +10 -0
  138. package/dist/hooks/use-icon-config.d.ts +2 -0
  139. package/dist/hooks/use-level-filters.d.ts +112 -0
  140. package/dist/hooks/use-level-search.d.ts +21 -0
  141. package/dist/hooks/use-locale.d.ts +10 -0
  142. package/dist/hooks/use-location-history.d.ts +42 -0
  143. package/dist/hooks/use-long-press.d.ts +25 -0
  144. package/dist/hooks/use-marquee.d.ts +35 -0
  145. package/dist/hooks/use-match-count.d.ts +8 -0
  146. package/dist/hooks/use-media-search.d.ts +44 -0
  147. package/dist/hooks/use-moving-ids.d.ts +3 -0
  148. package/dist/hooks/use-picks.d.ts +39 -0
  149. package/dist/hooks/use-preview-contents.d.ts +33 -0
  150. package/dist/hooks/use-properties.d.ts +25 -0
  151. package/dist/hooks/use-scroll-measure.d.ts +34 -0
  152. package/dist/hooks/use-search.d.ts +12 -0
  153. package/dist/hooks/use-selection.d.ts +29 -0
  154. package/dist/hooks/use-setting.d.ts +21 -0
  155. package/dist/hooks/use-stable-set.d.ts +6 -0
  156. package/dist/hooks/use-swipe.d.ts +41 -0
  157. package/dist/hooks/use-text-direction.d.ts +8 -0
  158. package/dist/hooks/use-thumbnail.d.ts +8 -0
  159. package/dist/hooks/use-transfer-queue.d.ts +22 -0
  160. package/dist/hooks/use-tree-rows.d.ts +9 -0
  161. package/dist/hooks/use-tree-selection.d.ts +19 -0
  162. package/dist/hooks/use-type-ahead.d.ts +9 -0
  163. package/dist/hooks/use-type-icons.d.ts +10 -0
  164. package/dist/hooks/use-upload-queue.d.ts +24 -0
  165. package/dist/hooks/use-virtual-lines.d.ts +27 -0
  166. package/dist/hooks/use-virtual-rows.d.ts +31 -0
  167. package/dist/hooks/use-wheel-zoom.d.ts +10 -0
  168. package/dist/icon-sets/filled.d.ts +6 -0
  169. package/dist/icon-sets/filled.js +76 -0
  170. package/dist/icon-sets/filled.js.map +1 -0
  171. package/dist/icon-sets/outlined.d.ts +6 -0
  172. package/dist/icon-sets/outlined.js +73 -0
  173. package/dist/icon-sets/outlined.js.map +1 -0
  174. package/dist/icon-sets/rounded.d.ts +6 -0
  175. package/dist/icon-sets/rounded.js +73 -0
  176. package/dist/icon-sets/rounded.js.map +1 -0
  177. package/dist/icon-sets/sharp.d.ts +6 -0
  178. package/dist/icon-sets/sharp.js +73 -0
  179. package/dist/icon-sets/sharp.js.map +1 -0
  180. package/dist/icon-sets/two-tone.d.ts +6 -0
  181. package/dist/icon-sets/two-tone.js +188 -0
  182. package/dist/icon-sets/two-tone.js.map +1 -0
  183. package/dist/index.d.ts +18 -0
  184. package/dist/index.js +32651 -0
  185. package/dist/index.js.map +1 -0
  186. package/dist/locales/en-us.d.ts +7 -0
  187. package/dist/store/download-queue.d.ts +37 -0
  188. package/dist/store/folder-store.d.ts +79 -0
  189. package/dist/store/keyboard-layout.d.ts +11 -0
  190. package/dist/store/properties-cache.d.ts +73 -0
  191. package/dist/store/thumbnail-cache.d.ts +30 -0
  192. package/dist/store/transfer-across.d.ts +24 -0
  193. package/dist/store/transfer-queue.d.ts +59 -0
  194. package/dist/store/upload-queue.d.ts +83 -0
  195. package/dist/styles/arrived.d.ts +6 -0
  196. package/dist/styles/classes.d.ts +212 -0
  197. package/dist/styles/layout.d.ts +55 -0
  198. package/dist/styles/media-layout.d.ts +36 -0
  199. package/dist/styles/order.d.ts +1 -0
  200. package/dist/styles.css +7632 -0
  201. package/dist/styles.layer.css +7634 -0
  202. package/dist/types/action.d.ts +296 -0
  203. package/dist/types/adapter.d.ts +922 -0
  204. package/dist/types/api.d.ts +192 -0
  205. package/dist/types/clipboard.d.ts +45 -0
  206. package/dist/types/download.d.ts +41 -0
  207. package/dist/types/drag.d.ts +57 -0
  208. package/dist/types/folder.d.ts +47 -0
  209. package/dist/types/icon.d.ts +20 -0
  210. package/dist/types/index.d.ts +27 -0
  211. package/dist/types/limits.d.ts +49 -0
  212. package/dist/types/locale.d.ts +1132 -0
  213. package/dist/types/main-menu.d.ts +20 -0
  214. package/dist/types/media.d.ts +631 -0
  215. package/dist/types/menu.d.ts +82 -0
  216. package/dist/types/navigation.d.ts +88 -0
  217. package/dist/types/preview.d.ts +54 -0
  218. package/dist/types/previewer.d.ts +67 -0
  219. package/dist/types/properties.d.ts +111 -0
  220. package/dist/types/property-definition.d.ts +286 -0
  221. package/dist/types/search.d.ts +46 -0
  222. package/dist/types/section.d.ts +98 -0
  223. package/dist/types/selection.d.ts +52 -0
  224. package/dist/types/slots.d.ts +218 -0
  225. package/dist/types/transfer.d.ts +68 -0
  226. package/dist/types/tree.d.ts +97 -0
  227. package/dist/types/undo.d.ts +133 -0
  228. package/dist/types/upload.d.ts +189 -0
  229. package/dist/types/view.d.ts +192 -0
  230. package/dist/utils/action-groups.d.ts +17 -0
  231. package/dist/utils/bidi.d.ts +15 -0
  232. package/dist/utils/clipboard.d.ts +30 -0
  233. package/dist/utils/cx.d.ts +2 -0
  234. package/dist/utils/dom.d.ts +36 -0
  235. package/dist/utils/download.d.ts +30 -0
  236. package/dist/utils/field-errors.d.ts +26 -0
  237. package/dist/utils/files.d.ts +48 -0
  238. package/dist/utils/format.d.ts +10 -0
  239. package/dist/utils/groups.d.ts +29 -0
  240. package/dist/utils/hidden.d.ts +3 -0
  241. package/dist/utils/keyboard.d.ts +21 -0
  242. package/dist/utils/limits.d.ts +7 -0
  243. package/dist/utils/media.d.ts +146 -0
  244. package/dist/utils/menu-position.d.ts +13 -0
  245. package/dist/utils/names.d.ts +21 -0
  246. package/dist/utils/navigation.d.ts +28 -0
  247. package/dist/utils/path.d.ts +33 -0
  248. package/dist/utils/permissions.d.ts +56 -0
  249. package/dist/utils/preview.d.ts +27 -0
  250. package/dist/utils/property-value.d.ts +41 -0
  251. package/dist/utils/resize.d.ts +2 -0
  252. package/dist/utils/search.d.ts +24 -0
  253. package/dist/utils/sections.d.ts +11 -0
  254. package/dist/utils/selection.d.ts +30 -0
  255. package/dist/utils/sets.d.ts +2 -0
  256. package/dist/utils/shortcut.d.ts +74 -0
  257. package/dist/utils/slots.d.ts +15 -0
  258. package/dist/utils/sort.d.ts +47 -0
  259. package/dist/utils/transfer.d.ts +48 -0
  260. package/dist/utils/trash.d.ts +25 -0
  261. package/dist/utils/undo.d.ts +63 -0
  262. package/dist/utils/zoom.d.ts +14 -0
  263. package/docs/README.md +55 -0
  264. package/docs/actions.md +301 -0
  265. package/docs/adapter.md +229 -0
  266. package/docs/copy-move-trash-undo.md +97 -0
  267. package/docs/customizing.md +247 -0
  268. package/docs/getting-started.md +168 -0
  269. package/docs/locale-and-rtl.md +58 -0
  270. package/docs/media-manager.md +498 -0
  271. package/docs/previewing.md +124 -0
  272. package/docs/properties.md +125 -0
  273. package/docs/recipes/in-memory-adapter.md +149 -0
  274. package/docs/recipes/rest-adapter.md +225 -0
  275. package/docs/recipes/s3-adapter.md +137 -0
  276. package/docs/search.md +73 -0
  277. package/docs/sections.md +119 -0
  278. package/docs/state-and-api.md +190 -0
  279. package/docs/uploads-and-downloads.md +144 -0
  280. package/package.json +90 -4
@@ -0,0 +1,80 @@
1
+ import type { Ref, RefObject } from "react";
2
+ import type { DropTarget, FileEntry, MediaLayout, MediaSection, SlotAttributes, ToolbarGroup } from "../../types/index.js";
3
+ interface MediaHeaderProps {
4
+ section: MediaSection | undefined;
5
+ /** The groups gone into from the library's root, to the one open; none at its root. */
6
+ trail: readonly FileEntry[];
7
+ /** Goes to the level with that many groups of the trail open. */
8
+ onGoToLevel: (depth: number) => void;
9
+ /** Where what's dragged would go, dropped on a step of the path, while the library is dragged in. */
10
+ pathDropTargetAt?: (depth: number) => DropTarget;
11
+ /** Opens the details of the group open; missing at the root, and while something's in the library's place. */
12
+ onGroupDetails: (() => void) | undefined;
13
+ groupDetailsRef: Ref<HTMLButtonElement>;
14
+ /** Whether there's more than one library, to choose among from a drawer where the list doesn't dock. */
15
+ several: boolean;
16
+ /** Whether that drawer is open. */
17
+ librariesOpen: boolean;
18
+ librariesOpenerRef: Ref<HTMLButtonElement>;
19
+ onOpenLibraries: () => void;
20
+ /** Whether the search can be used, which it can't while something else is in the library's place. */
21
+ searchable: boolean;
22
+ /** Whether the search field is open, in place of the library's name. */
23
+ searching: boolean;
24
+ query: string;
25
+ searchInputRef: RefObject<HTMLInputElement | null>;
26
+ searchButtonRef: Ref<HTMLButtonElement>;
27
+ onQueryChange: (query: string) => void;
28
+ /** The search button: opens the field, or closes it when it's open. */
29
+ onToggleSearch: () => void;
30
+ /** Escape, or ✕ with nothing typed, which give the focus back. */
31
+ onCloseSearch: () => void;
32
+ /** The focus going elsewhere with nothing typed, where it stays. */
33
+ onDismissSearch: () => void;
34
+ /** Down or Enter in the field, on to the assets. */
35
+ onFocusAssets: () => void;
36
+ /** Shows or folds away the library's filters; missing where it has none, and while the search can't be used. */
37
+ onToggleFilters?: () => void;
38
+ /** Whether their card shows. */
39
+ filtersOpen?: boolean;
40
+ /** How many filters are set, shown in a badge on their button. */
41
+ filterCount?: number;
42
+ /** The card's id, which their button controls. */
43
+ filtersId?: string;
44
+ filtersButtonRef?: Ref<HTMLButtonElement>;
45
+ /** The layout its button switches to, while the library offers another. */
46
+ otherLayout: MediaLayout | undefined;
47
+ onSwitchLayout: () => void;
48
+ /** Opens or closes the field asking a new group's name; missing while none can be made here. */
49
+ onNewGroup: (() => void) | undefined;
50
+ /** What it's named: the library's form's title for a new group, or else the media manager's. */
51
+ newGroupLabel: string;
52
+ /** Whether that field, or that form, is open. */
53
+ creatingGroup: boolean;
54
+ newGroupRef: Ref<HTMLButtonElement>;
55
+ /**
56
+ * The app's actions for what's shown, bound to it; none while a step is in the library's place,
57
+ * and none in the picker, which has nothing for managing a library.
58
+ */
59
+ actions?: readonly ToolbarGroup[];
60
+ /** Picks files to upload into the level open; missing while it takes none. */
61
+ onUpload: (() => void) | undefined;
62
+ uploadRef: Ref<HTMLButtonElement>;
63
+ /**
64
+ * Picks a folder to make a group of at the level open; missing while it takes none, or the browser
65
+ * can't pick folders.
66
+ */
67
+ onUploadFolder?: () => void;
68
+ /** The app's attributes for the header (`slotProps.header`). */
69
+ attributes?: SlotAttributes;
70
+ }
71
+ /**
72
+ * Above the library: the button opening the libraries where they don't dock, its name, or the path
73
+ * to the group open, each step of it going back there, or the search field in its place while
74
+ * searching, the button opening that, the library's filters' button, while it has any, the button
75
+ * switching its layout, while it offers another, the
76
+ * details of the group open, New group, while one can be made here, the app's actions, and Upload, while
77
+ * it takes files.
78
+ */
79
+ declare const MediaHeader: ({ section, trail, onGoToLevel, pathDropTargetAt, onGroupDetails, groupDetailsRef, several, librariesOpen, librariesOpenerRef, onOpenLibraries, searchable, searching, query, searchInputRef, searchButtonRef, onQueryChange, onToggleSearch, onCloseSearch, onDismissSearch, onFocusAssets, onToggleFilters, filtersOpen, filterCount, filtersId, filtersButtonRef, otherLayout, onSwitchLayout, onNewGroup, newGroupLabel, creatingGroup, newGroupRef, actions, onUpload, uploadRef, onUploadFolder, attributes, }: MediaHeaderProps) => import("react").JSX.Element;
80
+ export default MediaHeader;
@@ -0,0 +1,309 @@
1
+ import type { ComponentPropsWithoutRef, ReactNode, Ref } from "react";
2
+ import type { FieldErrors, FileAdapter, FileEntry, FilePreviewer, MediaActionGroup, MediaAssetParams, MediaChoice, MediaFiltersVariant, MediaLayouts, MediaLocation, MediaLocationChangeReason, MediaManagerApi, MediaManagerLimits, MediaManagerLocaleText, MediaManagerSlotProps, MediaManagerSlots, MediaPickForm, MediaSearch, MediaSection, MediaSectionGroup, MediaViewed, PropertyDefinitionGroup, PropertyErrorKeyParams } from "../../types/index.js";
3
+ type RootAttributes = Omit<ComponentPropsWithoutRef<"div">, "children" | "defaultValue" | "onChange">;
4
+ interface BaseProps<V> extends RootAttributes {
5
+ /** Serves the libraries that don't bring their own adapter. */
6
+ adapter: FileAdapter;
7
+ /**
8
+ * Whether several assets can be selected and chosen at once, from any of the libraries, such as
9
+ * pictures and videos for a product's carousel: what's selected stays as another library is
10
+ * shown, listed in the selected column, in an order set there. One at a time when omitted. While
11
+ * the media manager is only browsed, several are always selected as in a file manager (a click one
12
+ * alone, Ctrl or ⌘ adding, Shift a range, Ctrl+A all), at the level open, to move, delete or drag
13
+ * together from the selection bar at the library's foot, whatever this says.
14
+ */
15
+ multiple?: boolean;
16
+ /**
17
+ * How many assets can be selected at once with `multiple`, across the libraries. The selected
18
+ * column says how many of them are, and once they all are, nothing more is added until one is
19
+ * taken out: a Shift range or Select all adds what fits, and an upload is selected while there's
20
+ * room. More than this given with `defaultValue`, or left by lowering it, stay selected, those
21
+ * past it holding Choose back until they're taken out. The app's backend still has the last word
22
+ * when it saves the picks. No limit when omitted.
23
+ */
24
+ maxChoices?: number;
25
+ /**
26
+ * Whether an asset can be added, for this use of the media manager, beside what's picked already,
27
+ * such as one video at most for a product's carousel: `true`, or `false`, or why not, in the app's
28
+ * language, which its tile shows in place of its size. `choices` are those before it, without it,
29
+ * in the order set, and none one at a time, as it would replace them. Asked for every asset shown
30
+ * as the picks change, so keep it quick, and outside the component or memoized. A pick that breaks
31
+ * it, as given with `defaultValue`, is told apart by the ones before it: its row says why, and it
32
+ * holds Choose back until it's taken out. A library's own `selectable` is for what depends on the
33
+ * backend, such as an expired licence, and an asset has to pass both.
34
+ *
35
+ * `trail` is the groups it's in, from its library's root, and each of `choices` has its own, so what's
36
+ * inside a group picked, or a group with a pick inside it, can be refused, what that means being the
37
+ * app's: nothing is refused for it otherwise. `trail` is unset for a pick given without one, whose
38
+ * place isn't known. Ids are only unique within an adapter, so compare them within a library's.
39
+ */
40
+ canSelect?: (asset: FileEntry, section: MediaSection, choices: readonly MediaChoice<V>[], trail: readonly FileEntry[] | undefined) => boolean | string;
41
+ /**
42
+ * Whether groups can be selected and chosen as well as assets, such as a whole album or season,
43
+ * while the app takes a pick. A click on a group still goes in, so one that can be has a check of
44
+ * its own, and Space does the same. `canSelect` and a library's `selectable` decide per group, a
45
+ * plain `false` only leaving its check off, and a pick's form is handed the group as its `asset`.
46
+ * What's chosen hands it back as listed, for the backend to expand: nothing walks down to collect
47
+ * what's inside it, and a group picked with something inside it are the backend's to settle. Off
48
+ * when omitted.
49
+ */
50
+ selectGroups?: boolean;
51
+ /**
52
+ * Turns dragging off. While the media manager is only browsed (none of `value`, `defaultValue`,
53
+ * `onChange` and `onChoose` given), what's selected, or the asset or group grabbed, is dragged onto a
54
+ * group, or a step of the path above, to move it there, through the adapter's `move`, by mouse, or on a
55
+ * touch screen by a long-press and moving on; a drag resting on a group goes into it. With this, nothing
56
+ * is dragged, and Move to… in the selection bar is the way to move several, as Move in an asset's view is
57
+ * for one. A long-press still starts selecting on a touch screen. False when omitted.
58
+ */
59
+ disableDrag?: boolean;
60
+ /**
61
+ * How a library's filters (`MediaSection.filterForm`) show from the header's Filters button:
62
+ * `"card"`, dropping from it over the results, which change behind it as the filters do, or
63
+ * `"dialog"`, over the whole component, the rest of it out of reach, applying what's changed only
64
+ * with its Apply, for a form too big for the card or whose half-finished changes shouldn't search.
65
+ * A form's own `variant` comes first. Both are drawn inside the component. `"card"` when omitted.
66
+ */
67
+ filtersVariant?: MediaFiltersVariant;
68
+ /**
69
+ * The app's own actions in the header, for what the component leaves to it, such as reordering a
70
+ * group. Those with an icon show as buttons, two at most and from the width the list of libraries
71
+ * docks at, and the rest in a "More actions" menu. Each is told the
72
+ * library, the group open, the asset shown, what's selected and whether it can be changed, and given
73
+ * `refresh()` to list again what it changed. `visible` and `disabled` are asked as any of those change,
74
+ * so keep them quick. None show while a step such as an upload's form is in the library's place.
75
+ */
76
+ actions?: readonly MediaActionGroup<V>[];
77
+ /**
78
+ * Takes what's chosen, with the Choose button, a double click or Enter on an asset: each as it
79
+ * was listed, `meta` and all, with the library it's from, whose `kind` says what it is, and what
80
+ * the app's form holds for it (`values`), in the order set in the selected column. Pass only
81
+ * the libraries of the kinds the app takes. Without it there's no selected column, and the media
82
+ * manager is a library to look through.
83
+ */
84
+ onChoose?: (choices: MediaChoice<V>[]) => void;
85
+ /**
86
+ * The app's own form for each pick, for this use of the asset, by the asset and its library: an
87
+ * alt text and a caption for a picture in a carousel, "Play on its own" for a video, a field per
88
+ * language when the app has several, or `null` for none. It's the use's, not the backend's, so
89
+ * the same library picked from elsewhere may ask for something else. It's drawn in the selected
90
+ * column as a pick's details are opened, with what the media manager keeps with the pick, as it's
91
+ * moved and as other libraries are shown, and hands back with `onChoose` (`values`): its `defaults`
92
+ * from the moment it's picked. Its `ready` holds Choose back, and its `errorKeys` count on the pick's
93
+ * row what there is to fix. A library's own `pickForm`, for what comes with its backend, is used in
94
+ * place of it. Without either, picks have no details. Keep it outside the component, or memoized.
95
+ */
96
+ pickForm?: (asset: FileEntry, section: MediaSection) => MediaPickForm<V> | null;
97
+ /**
98
+ * What an asset or a group shows as it's opened, by the entry and its library (a group is an entry
99
+ * of `kind: "folder"`), for the libraries without `properties` of their own: the app's definitions of the values the adapter's `properties`
100
+ * hands over (`values`), each shown as its type, its kind and its functions say, editable where
101
+ * it's marked so and the library isn't `readOnly`. Without either, the adapter's own groups
102
+ * show. The media manager adds nothing of its own.
103
+ */
104
+ properties?: (asset: FileEntry, section: MediaSection) => PropertyDefinitionGroup[];
105
+ /**
106
+ * Shows assets of any library as one is opened, asked after the library's own `previewers`, in
107
+ * order: a player, a document viewer, the app's own way of showing a kind. The asset's
108
+ * thumbnail when none accepts it, as the media manager plays and renders nothing itself.
109
+ */
110
+ previewers?: FilePreviewer[];
111
+ /**
112
+ * Draws the assets of the libraries without a `renderAsset` of their own, in place of the media
113
+ * manager's look: `MediaTile` or `MediaRow` with what to change, or anything else. See
114
+ * `MediaSection.renderAsset`. Keep it outside the component, or memoized.
115
+ */
116
+ renderAsset?: (params: MediaAssetParams) => ReactNode;
117
+ /**
118
+ * Draws the groups of the libraries without a `renderGroup` of their own, in place of the media
119
+ * manager's look. See `MediaSection.renderGroup`. Keep it outside the component, or memoized.
120
+ */
121
+ renderGroup?: (params: MediaAssetParams) => ReactNode;
122
+ /**
123
+ * Draws what's above a group's contents while it's open, for the libraries without a `groupHeader`
124
+ * of their own. See `MediaSection.groupHeader`.
125
+ */
126
+ groupHeader?: (group: FileEntry, section: MediaSection) => ReactNode;
127
+ /**
128
+ * The library's states drawn as the app's own components (`empty`, `noResults`, `error`,
129
+ * `loading`, and `noSections` with no library), each in the box the media manager's own takes.
130
+ * Keep them outside the app's component, as one made while rendering starts over every time.
131
+ * See `MediaManagerSlots`.
132
+ */
133
+ slots?: MediaManagerSlots;
134
+ /**
135
+ * Attributes for the media manager's parts, `libraries`, `header`, `chosen`, and `asset`, each
136
+ * asset's and group's option, or a function giving each its own: utility classes, `data-*` for
137
+ * tests, handlers. What a part sets itself stays its own (see `SlotAttributes`). Keep the object
138
+ * outside the app's component, or memoized: a new `asset` draws every asset again.
139
+ */
140
+ slotProps?: MediaManagerSlotProps;
141
+ /**
142
+ * The layout each library is shown in, of those it offers (`MediaSection.layouts`), by its `id`, for
143
+ * an app keeping what the user switched to across visits. Change it in `onLayoutChange`; leave it
144
+ * out for the media manager to keep it, starting from `defaultLayout`.
145
+ */
146
+ layout?: MediaLayouts;
147
+ /** Where the libraries' layouts start, while `layout` isn't passed. */
148
+ defaultLayout?: MediaLayouts;
149
+ /** Told every library's layout, as the user switches one. */
150
+ onLayoutChange?: (layout: MediaLayouts) => void;
151
+ /**
152
+ * Where the media manager is, for an app keeping it, e.g. in the URL: the library shown and the groups
153
+ * gone into in it. Every change, the user's and the media manager's own, is asked for through
154
+ * `onLocationChange`, and shows once it's passed back. Null shows the first library's root. A location
155
+ * in a library that isn't there shows the first library's root, which is asked for as "replace", and so
156
+ * is a library's root in place of groups in one rooted elsewhere or served by another adapter since.
157
+ * Each other library's level is remembered while mounted, so opening it again goes back there. Changed
158
+ * by the app, what's over the library (an asset shown, a step, the search) goes, as when the user goes
159
+ * to a level, unless the app changed that too, and screen readers hear where it is.
160
+ */
161
+ location?: MediaLocation | null;
162
+ /** Where it starts, while `location` isn't passed: the first library's root when omitted. */
163
+ defaultLocation?: MediaLocation;
164
+ /**
165
+ * Told the location as it changes, and why: the user, or `apiRef`, going there ("navigate"), or
166
+ * what was there changing under it ("replace"), such as a group on the way deleted or renamed.
167
+ */
168
+ onLocationChange?: (location: MediaLocation, reason: MediaLocationChangeReason) => void;
169
+ /**
170
+ * The asset, or the group's details, shown in a library's place, for an app keeping it, e.g. in the
171
+ * URL; null for the library itself. Shown while its library is the one shown. Every change is asked
172
+ * for through `onViewedChange`: opening one, Previous and Next, going back, and anything closing it,
173
+ * such as going to another level or library.
174
+ */
175
+ viewed?: MediaViewed | null;
176
+ /** What's shown in the library's place as it mounts, while `viewed` isn't passed. */
177
+ defaultViewed?: MediaViewed;
178
+ /** Told what's shown in the library's place as it changes, with the groups it's in, or null. */
179
+ onViewedChange?: (viewed: MediaViewed | null) => void;
180
+ /**
181
+ * The search, for an app keeping it, null while it's closed: what's typed and what the library's
182
+ * filters hold (`MediaSearch.filters`). Every change is asked for through `onSearchChange`: opening
183
+ * it, each key typed, each filter changed, and closing it, which going to another level or library
184
+ * does too, the filters with it. Its field shows while it's opened or something's typed: one with
185
+ * only filters runs the search without it, the chips under the header saying what's set, and
186
+ * closing the field then clears only what's typed. It's focused as it opens once it's passed back.
187
+ */
188
+ search?: MediaSearch | null;
189
+ /** The search as it mounts, while `search` isn't passed: closed when omitted. */
190
+ defaultSearch?: MediaSearch;
191
+ /** Told the search as it opens, as what's typed or a filter changes, and as it closes, with null. */
192
+ onSearchChange?: (search: MediaSearch | null) => void;
193
+ /**
194
+ * How old, in ms, a library's or a group's listing may be before showing it lists it again. Listings
195
+ * are kept, so one shown again shows at once, and is listed again in the background meanwhile, so what
196
+ * changed elsewhere shows without a refresh. 0, the default, lists it again every time; `Infinity`
197
+ * never does, for a backend where listing costs, leaving changes made elsewhere to `apiRef.refresh`.
198
+ * Changes made through the media manager show either way.
199
+ */
200
+ relistAfter?: number;
201
+ /**
202
+ * How much the media manager does at once and keeps, for a backend that takes more, or less, than the
203
+ * defaults: uploads, moves and thumbnails at once, thumbnails and listings kept while nothing shows
204
+ * them, and how long the typing stops before the adapter's `search` is asked. Each is left to its
205
+ * default when omitted, and a change takes effect at once: more at once starts what's waiting, less
206
+ * lets what's under way finish, and fewer kept drops what's beyond them.
207
+ */
208
+ limits?: MediaManagerLimits;
209
+ /**
210
+ * Takes the `MediaManagerApi`, for going to a library or a group, showing an asset, searching,
211
+ * selecting, choosing, uploading, listing again or moving the focus in, from outside.
212
+ */
213
+ apiRef?: Ref<MediaManagerApi<V>>;
214
+ /**
215
+ * What's selected, when the app keeps it, with `onChange`: every change is then only asked for, and
216
+ * shows once it's passed back. Each is matched to its library by `section.id`. Pass back what
217
+ * `onChange` handed over where you can: a choice made or copied by the app takes its `values` as
218
+ * changed, so they stop following the form's `defaults`, as those of `defaultValue` do.
219
+ */
220
+ value?: readonly MediaChoice<V>[];
221
+ /**
222
+ * What's selected as it mounts, with what the app's form held for each, such as a product's
223
+ * carousel being edited, in its order. Each is matched to its library by `section.id`.
224
+ */
225
+ defaultValue?: readonly MediaChoice<V>[];
226
+ /**
227
+ * Told everything selected as it changes, in the order set, each with what its form holds, so at
228
+ * every key typed in a form: keep it quick. A pick found to be gone, its library or its listing no
229
+ * longer having it, is told too; a new listing of an asset alone isn't. Any of `value`,
230
+ * `defaultValue`, `onChange` and `onChoose` has the media manager take picks, with the selected column;
231
+ * without `onChoose` there's no Choose, for picks that are part of a form of the app's, saved by
232
+ * its own button, and a double click or Enter opens the asset.
233
+ */
234
+ onChange?: (choices: MediaChoice<V>[]) => void;
235
+ /**
236
+ * What the app's backend answered when the picks were saved, as it came, by its own keys, a
237
+ * message or several each, as Laravel's validation errors are:
238
+ * `{ "media.0.translations.en.title": ["The title field is required."] }`. Pass it all: only
239
+ * the keys the app names are read, and the rest, the form's other fields' and the list's own
240
+ * (`media`), are left for the app to show. Each field `MediaFields` draws finds its own by its
241
+ * `errorKey`, made from the pick's place (``({ index }) => `media.${index}.loop` ``), shown
242
+ * under it, a form of the app's reads them itself (`MediaPickFormParams.errors`), and each pick
243
+ * finds its own by `choiceErrorKey`, with the pick's row in the selected column saying how many
244
+ * there are to fix (`MediaPickForm.errorKeys`). The keys go by the order the app was handed the
245
+ * picks in, at Choose (or, before any, the order as the errors came), so each pick keeps its own
246
+ * as it's moved; one taken out takes them with it, and one added since has none. Pass the same
247
+ * object for as long as they're the same.
248
+ */
249
+ errors?: FieldErrors;
250
+ /**
251
+ * Where a pick's own errors are in `errors`, about it as a whole rather than one of its fields,
252
+ * such as "This video is still processing.": the backend's key for it, or its keys, made from
253
+ * its place, ``({ index }) => [`media.${index}`, `media.${index}.id`]``. Its messages show at
254
+ * the top of its details, above its form, and its row counts them as one more to fix.
255
+ */
256
+ choiceErrorKey?: (params: PropertyErrorKeyParams) => string | readonly string[];
257
+ /**
258
+ * The component's own text, for another language or other wording. Keys left out stay in
259
+ * English, as `enUS` has them. Functions written inline are new each render and make every
260
+ * tile render again, so keep those outside the component or memoize the object.
261
+ */
262
+ localeText?: Partial<MediaManagerLocaleText>;
263
+ /**
264
+ * The BCP 47 language tag, such as "de" or "fa-IR", that numbers, sizes and dates are written
265
+ * in and names are matched by. The browser's language when omitted.
266
+ */
267
+ locale?: string;
268
+ /** The root element, which fills the box it's placed in. */
269
+ ref?: Ref<HTMLDivElement>;
270
+ /**
271
+ * Styles the root element, over its own, e.g. to size it. It fills its container by default,
272
+ * and lays itself out by its own width (container queries), not the viewport's.
273
+ */
274
+ className?: string;
275
+ }
276
+ interface MultiSectionProps<V> extends BaseProps<V> {
277
+ /**
278
+ * The libraries, in groups. Each holds one kind of asset, and is an independent root. What it
279
+ * lists as entries of `kind: "folder"` are groups of it (collections, albums, seasons, to any
280
+ * depth), which are gone into a level at a time, each listed through `list`.
281
+ */
282
+ sections: MediaSectionGroup[];
283
+ section?: never;
284
+ }
285
+ interface SingleSectionProps<V> extends BaseProps<V> {
286
+ /** The one library to show, with no list of libraries beside it. */
287
+ section: MediaSection;
288
+ sections?: never;
289
+ }
290
+ /**
291
+ * Either `sections`, for several libraries to switch between, or a single `section`. Both may
292
+ * change after mounting: the library shown goes back to the first when its section goes (asked for
293
+ * through `onLocationChange` as "replace"), and what was picked in a library that's gone goes with it. `V` is the shape of what the app's form holds
294
+ * for each pick (`pickForm`).
295
+ */
296
+ export type MediaManagerProps<V = Record<string, unknown>> = MultiSectionProps<V> | SingleSectionProps<V>;
297
+ /**
298
+ * Libraries of media to look through and choose from, each holding one kind of asset: pictures as
299
+ * square tiles, videos as wide ones, audio as rows, documents as pages, searched by name, each
300
+ * opened in the library's place, shown by the app's previewers, with the properties its adapter
301
+ * hands over. While the app takes a choice, what's selected is listed in a column beside them, put
302
+ * in order there, each with the app's own form for this use of it. Files are uploaded into a
303
+ * library taking them by its Upload button, a drop or a paste, asked first what its `uploadForm`
304
+ * asks, and selected as they arrive while the app takes a choice. Built from the parts it shares
305
+ * with `FileManager` (the adapter, the listing store, thumbnails, the properties panel, the upload
306
+ * queue and panel), not from the file manager itself.
307
+ */
308
+ declare const MediaManager: <V>({ adapter, sections: groupsProp, section: singleSection, multiple, maxChoices, canSelect, selectGroups, disableDrag, filtersVariant, actions, onChoose, pickForm, properties, previewers, renderAsset, renderGroup, groupHeader, slots, slotProps, layout, defaultLayout, onLayoutChange, location, defaultLocation, onLocationChange, viewed, defaultViewed, onViewedChange, search, defaultSearch, onSearchChange, relistAfter, limits, apiRef, value, defaultValue, onChange, errors, choiceErrorKey, localeText, locale, ref, className, ...rootAttributes }: MediaManagerProps<V>) => import("react").JSX.Element;
309
+ export default MediaManager;
@@ -0,0 +1,30 @@
1
+ import type { FileEntry, MediaSection } from "../../types/index.js";
2
+ interface MediaMoveProps {
3
+ /** What's being moved: the asset or group shown, or what's selected. */
4
+ entries: readonly FileEntry[];
5
+ section: MediaSection;
6
+ /** The groups the way through starts from, from the library's root: where the one shown is, or the level open. */
7
+ from: readonly FileEntry[];
8
+ /**
9
+ * The levels they're in now, by their ids, the library's root by its own, so Move here is held back
10
+ * where every one of them is already; a search may have found them in several.
11
+ */
12
+ sources: ReadonlySet<string>;
13
+ /** Those on their way somewhere already, which can't be gone into. */
14
+ movingIds: ReadonlySet<string>;
15
+ /** What going back from it is named: back to the asset shown, or to the library. */
16
+ backLabel: string;
17
+ onCancel: () => void;
18
+ /** Moves them into the level with these groups open. */
19
+ onMove: (to: readonly FileEntry[]) => void;
20
+ }
21
+ /**
22
+ * Where an asset or group goes, or several, a step in the library's place: a level at a time through its
23
+ * library's groups, as they're only ever listed so, from where they are now, a group being moved never
24
+ * offered, so nothing goes inside itself. They stay in their library, as what a library holds is one
25
+ * kind. Move here is held back where they all are already, where the listing or the group says nothing
26
+ * can be written, and with a group among them, where the library's `createGroups` says none can be. The
27
+ * backend has the final say.
28
+ */
29
+ declare const MediaMove: ({ entries, section, from, sources, movingIds, backLabel, onCancel, onMove }: MediaMoveProps) => import("react").JSX.Element;
30
+ export default MediaMove;
@@ -0,0 +1,140 @@
1
+ import type { ComponentPropsWithoutRef, Ref } from "react";
2
+ import type { FileAdapter, FileEntry, MediaChoice, MediaFiltersVariant, MediaManagerLimits, MediaManagerLocaleText, MediaPickerValue, MediaPickForm, MediaPickerSlotProps, MediaPickerSlots, MediaSection } from "../../types/index.js";
3
+ type RootAttributes = Omit<ComponentPropsWithoutRef<"div">, "children" | "defaultValue" | "onChange">;
4
+ export interface MediaPickerProps<V = Record<string, unknown>> extends RootAttributes {
5
+ /** Serves the library, unless it brings its own adapter. */
6
+ adapter: FileAdapter;
7
+ /**
8
+ * The one library to pick from, the same object a `MediaManager` takes. Its `layouts`,
9
+ * `renderAsset`, `renderGroup`, `groupHeader`, `selectable`, `acceptUploads`, `uploadForm` and
10
+ * `pickForm` count here too, and with `allowCreateGroups`, `createGroups` and `groupForm`; what's
11
+ * for managing it, such as `processForm`, has no place here and is left unread. Changing it, or its
12
+ * adapter, starts the picker afresh.
13
+ */
14
+ section: MediaSection;
15
+ /**
16
+ * Takes what's chosen, with the Choose button, a double click or Enter on an asset: each its `asset`
17
+ * as it was listed, `meta` and all, and what `pickForm` holds for it (`values`), in the order set:
18
+ * one, unless `multiple`. What's stored of it is the app's. Without it there's no Choose, for an app
19
+ * taking what's selected as it changes (`onChange`), and a double click or Enter only selects.
20
+ */
21
+ onChoose?: (choices: MediaChoice<V>[]) => void;
22
+ /**
23
+ * What's asked of each pick for this use of it, such as a caption, or `null` for nothing, by the
24
+ * form's shape the media manager's `pickForm` has. Passing it adds the selected column beside the
25
+ * library, or over it where there's no room: what's selected, put in order with `multiple`, and each
26
+ * one's form. Its `defaults` count from the moment it's picked and its `ready` holds Choose back;
27
+ * the backend's `errors` have no place here, as what's picked is saved by the app's form around the
28
+ * picker. A library's own `pickForm` comes first. Without either there's no column. Keep it outside
29
+ * the component, or memoized.
30
+ */
31
+ pickForm?: (asset: FileEntry, section: MediaSection) => MediaPickForm<V> | null;
32
+ /** Puts a Cancel button beside Choose, for a picker in the app's own dialog. */
33
+ onCancel?: () => void;
34
+ /** Whether several can be chosen at once, in the order they were selected. One at a time when omitted. */
35
+ multiple?: boolean;
36
+ /** How many can be selected at once with `multiple`. No limit when omitted. */
37
+ maxChoices?: number;
38
+ /**
39
+ * Whether an asset or group can be added, for this use of the picker, beside what's picked already,
40
+ * as the media manager's `canSelect`: `true`, or `false`, or why not, in the app's language, which
41
+ * its tile shows. `section` is the library given, so one function can serve a `MediaManager` too, and
42
+ * `choices` are those before it, without it, in the order set, and none one at a time, as it would
43
+ * replace them. Asked for everything shown as the picks change, so keep it quick, and outside the
44
+ * component or memoized. A pick that breaks it, as given with `defaultValue`, says why and holds Choose
45
+ * back until it's taken out. A library's own `selectable` is for what depends on the backend, and
46
+ * one has to pass both.
47
+ *
48
+ * `trail` is the groups it's in, from the library's root, and each of `choices` has its own, so what's
49
+ * inside a group picked, or a group with a pick inside it, can be refused, what that means being the
50
+ * app's: nothing is refused for it otherwise. `trail` is unset for a pick given without one, whose
51
+ * place isn't known.
52
+ */
53
+ canSelect?: (asset: FileEntry, section: MediaSection, choices: readonly MediaChoice<V>[], trail: readonly FileEntry[] | undefined) => boolean | string;
54
+ /**
55
+ * Whether groups can be selected and chosen as well as assets. A click on a group still goes in, so
56
+ * one that can be has a check of its own, and Space does the same. `canSelect` and the library's
57
+ * `selectable` decide per group, a plain `false` only leaving its check off. What's chosen hands it
58
+ * back as listed, for the backend to expand. Off when omitted.
59
+ */
60
+ selectGroups?: boolean;
61
+ /**
62
+ * Whether files can be uploaded here, for when what's wanted isn't there yet, by an Upload button,
63
+ * a drop or a paste, into the level open: off by default, as nothing else in a picker changes the
64
+ * backend. It still needs the adapter's `upload` and a library taking them (`acceptUploads`, not
65
+ * `readOnly`). The library's `uploadForm` is asked first, and each file is selected as it arrives,
66
+ * holding Choose back while it's being processed. An upload under way is cancelled as the picker
67
+ * goes.
68
+ */
69
+ allowUpload?: boolean;
70
+ /**
71
+ * Whether groups can be made here, for uploads that want a group of their own, by New group in the
72
+ * header: off by default, as `allowUpload` is. It's offered where the library's `createGroups` says
73
+ * one can be made in the level open, as in the media manager, asking the library's `groupForm`
74
+ * where the adapter has `createGroup`, or else only a name, where it has `createFolder`, and not in
75
+ * a `readOnly` library or a level that refuses writing. Once it's made, the picker goes into it, so
76
+ * what's uploaded next goes there.
77
+ */
78
+ allowCreateGroups?: boolean;
79
+ /**
80
+ * How the library's filters (`MediaSection.filterForm`) show from the header's Filters button:
81
+ * `"card"`, dropping from it over the results, or `"dialog"`, over the whole picker, its foot
82
+ * included, applying what's changed only with its Apply, as `MediaManager`'s does. A form's own
83
+ * `variant` comes first. Both are drawn inside the picker, so one in an app's own modal dialog keeps
84
+ * the focus. `"card"` when omitted.
85
+ */
86
+ filtersVariant?: MediaFiltersVariant;
87
+ /**
88
+ * The library's states drawn as the app's own components (`empty`, `noResults`, `error`,
89
+ * `loading`), each in the box the picker's own takes. Keep them outside the app's component, as
90
+ * one made while rendering starts over every time. See `MediaPickerSlots`.
91
+ */
92
+ slots?: MediaPickerSlots;
93
+ /**
94
+ * Attributes for the picker's parts, `header`, `chosen`, and `asset`, each asset's and group's
95
+ * option, or a function giving each its own. What a part sets itself stays its own (see
96
+ * `SlotAttributes`). Keep the object outside the app's component, or memoized.
97
+ */
98
+ slotProps?: MediaPickerSlotProps;
99
+ /** What's selected, when the app keeps it, with `onChange`: every change is then only asked for. */
100
+ value?: readonly MediaPickerValue<V>[];
101
+ /** What's selected as it mounts, such as what the field it's picking for holds now. */
102
+ defaultValue?: readonly MediaPickerValue<V>[];
103
+ /**
104
+ * Told everything selected as it changes, in the order set, each with what its form holds, so at
105
+ * every key typed in one. One found to be gone, no longer listed where it was picked, is told too; a
106
+ * new listing of an asset alone isn't.
107
+ */
108
+ onChange?: (choices: MediaChoice<V>[]) => void;
109
+ /**
110
+ * How old, in ms, a level's listing may be before showing it lists it again in the background, as
111
+ * the media manager's `relistAfter`: 0, the default, every time; `Infinity` never.
112
+ */
113
+ relistAfter?: number;
114
+ /**
115
+ * How much it does at once and keeps, as the media manager's `limits`: uploads and thumbnails at once,
116
+ * thumbnails and listings kept, and how long the typing stops before the adapter's `search` is asked;
117
+ * `transfers` counts for nothing here. Each is its default when omitted, and a change takes effect at
118
+ * once. The picker has stores of its own, so a media manager around it doesn't share them.
119
+ */
120
+ limits?: MediaManagerLimits;
121
+ /** The component's own text, the media manager's. Keys left out stay in English, as `enUS` has them. */
122
+ localeText?: Partial<MediaManagerLocaleText>;
123
+ /** The BCP 47 language tag that numbers, sizes and dates are written in and names are matched by. */
124
+ locale?: string;
125
+ /** The root element, which fills the box it's placed in. */
126
+ ref?: Ref<HTMLDivElement>;
127
+ /** Styles the root element, over its own, e.g. to size it. It fills its container by default. */
128
+ className?: string;
129
+ }
130
+ /**
131
+ * One library to find an asset in and choose it, for a field that points at an asset of another
132
+ * library, such as a series' teaser or a video's poster: its assets and groups, a search by name, and,
133
+ * when the app allows it, uploading what isn't there yet and making a group for it. It's a sibling of
134
+ * `MediaManager` built from the same parts, with nothing else for managing a library: no list of
135
+ * libraries, no asset view, and nothing to delete or move, so none of that needs turning off. With `pickForm`, what's
136
+ * selected is listed beside the library, each with the app's form for this use of it. It has no dialog
137
+ * of its own, as a picker's place is the app's.
138
+ */
139
+ declare const MediaPicker: <V>({ adapter, section, onChoose, pickForm, onCancel, multiple, maxChoices, canSelect, selectGroups, allowUpload, allowCreateGroups, filtersVariant, slots, slotProps, value, defaultValue, onChange, relistAfter, limits, localeText, locale, ref, className, ...rootAttributes }: MediaPickerProps<V>) => import("react").JSX.Element;
140
+ export default MediaPicker;
@@ -0,0 +1,26 @@
1
+ import type { ComponentPropsWithoutRef, Ref } from "react";
2
+ import type { FileAdapter, FileEntry, ViewMode } from "../../types/index.js";
3
+ export interface MediaPictureProps extends Omit<ComponentPropsWithoutRef<"div">, "children"> {
4
+ /** The asset or group to show, as the adapter listed it. */
5
+ entry: FileEntry;
6
+ /** Its adapter, whose `thumbnail` is asked for the picture. */
7
+ adapter: FileAdapter;
8
+ /** The view it's asked for (`ThumbnailOptions.view`). "list" when omitted. */
9
+ view?: ViewMode;
10
+ /** The side of the square it's asked to fit, in rem, for a backend making thumbnails to order. 6 when omitted. */
11
+ size?: number;
12
+ /** The picture's text for screen readers. None when omitted, for one shown beside its name. */
13
+ alt?: string;
14
+ /** The root element. */
15
+ ref?: Ref<HTMLDivElement>;
16
+ /** Styles the root element, over its own: its size and shape, `{ width: 72, aspectRatio: "16 / 9" }`. */
17
+ className?: string;
18
+ }
19
+ /**
20
+ * An asset's or a group's small picture, asked of the adapter's `thumbnail`, for showing one outside a
21
+ * library, such as in a field pointing at it (`MediaPicker`): filling a box the app sizes and shapes
22
+ * with its `className` or `style`, cut to fit, or its type's icon when it has none or it fails. It needs no provider around
23
+ * it, and keeps nothing once it's gone.
24
+ */
25
+ declare const MediaPicture: ({ entry, adapter, view, size, alt, ref, className, ...rest }: MediaPictureProps) => import("react").JSX.Element;
26
+ export default MediaPicture;
@@ -0,0 +1,26 @@
1
+ import type { FileAdapter, FileEntry, MediaProcessForm, MediaSection } from "../../types/index.js";
2
+ interface MediaProcessProps {
3
+ /** The asset as it's listed now, which the form follows. */
4
+ entry: FileEntry;
5
+ section: MediaSection;
6
+ /** The library's adapter, its own or the media manager's. */
7
+ adapter: FileAdapter;
8
+ /** What can be asked of it: its library's process form for it now, or else as it was when this opened. */
9
+ form: MediaProcessForm;
10
+ /** Whether its library has nothing to ask of it now, which holds Process back. */
11
+ unavailable: boolean;
12
+ onCancel: () => void;
13
+ /**
14
+ * The backend took it on (`taken`), or may have by the time it was cancelled: its library is listed
15
+ * again.
16
+ */
17
+ onSent: (taken: boolean) => void;
18
+ }
19
+ /**
20
+ * The step asking what's to be made of an asset already uploaded, in the library's place: the
21
+ * library's process form, with Cancel and Process, held back while it isn't ready. What it holds goes to
22
+ * the adapter's `process`, and it stays open until that's answered, to say why when it's refused,
23
+ * over the form and under the fields it names.
24
+ */
25
+ declare const MediaProcess: ({ entry, section, adapter, form, unavailable, onCancel, onSent }: MediaProcessProps) => import("react").JSX.Element;
26
+ export default MediaProcess;
@@ -0,0 +1,13 @@
1
+ import type { MediaAssetLookProps } from "../../types/index.js";
2
+ /**
3
+ * How the media manager draws an asset of a library shown as a list, for an app's `renderAsset` to
4
+ * change a little: `<MediaRow {...params} title={params.asset.meta?.title} />`. Its picture or icon,
5
+ * its name, its type, size and dimensions, or in their place why it can't be chosen now, with a bar
6
+ * along its picture's foot while it's processed, and its length. Every row is as tall: the line under
7
+ * the name is kept, empty or not, and so is a trail's while the grid shows results with them. Its look only: what makes it an asset to select, its Open
8
+ * button and its check stay the media manager's, beside it, so it's only drawn inside `renderAsset`.
9
+ * A group, an entry of `kind: "folder"`, is drawn as one: its picture or a folder's icon, and how many
10
+ * it holds under its name. A search's result from further down says where it is, under those.
11
+ */
12
+ declare const MediaRow: ({ asset, kind, thumbnail, hold, trail, title, detail, badge, picture, className }: MediaAssetLookProps) => import("react").JSX.Element;
13
+ export default MediaRow;