@phis/ui 0.7.3 → 0.7.4

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 (65) hide show
  1. package/components/controls/phi-media-asset-tile-control.d.ts +4 -3
  2. package/components/controls/phi-media-picker-control.d.ts +9 -11
  3. package/components/controls/phi-media-picker-control.js +9 -11
  4. package/components/forms/form-field-labels.d.ts +3 -3
  5. package/components/forms/form-field-labels.js +13 -5
  6. package/components/forms/media-asset-field-keys.d.ts +9 -1
  7. package/components/forms/media-asset-field-keys.js +13 -1
  8. package/components/media/label-sets/media.js +4 -0
  9. package/components/media/media-folder-name-path.d.ts +14 -0
  10. package/components/media/media-folder-name-path.js +40 -2
  11. package/components/media/media-library-resource.d.ts +70 -0
  12. package/components/media/media-library-resource.js +41 -0
  13. package/components/media/media-widget-labels.d.ts +13 -0
  14. package/components/media/media-widget-labels.js +2 -0
  15. package/components/media/phi-area-upload-widget.d.ts +31 -1
  16. package/components/media/phi-area-upload-widget.js +33 -7
  17. package/components/media/phi-image-preview-data.d.ts +8 -1
  18. package/components/media/phi-image-preview-data.js +29 -0
  19. package/components/media/phi-media-picker-binding.d.ts +22 -20
  20. package/components/media/phi-media-picker-binding.js +20 -33
  21. package/components/media/use-media-library-add-picker.d.ts +94 -0
  22. package/components/media/use-media-library-add-picker.js +40 -0
  23. package/constants/media-library-provider-keys.d.ts +7 -0
  24. package/constants/media-library-provider-keys.js +7 -0
  25. package/constants/runtime-module-ownership.js +1 -0
  26. package/helpers/preset-tree-contract-check.d.ts +35 -0
  27. package/helpers/preset-tree-contract-check.js +211 -0
  28. package/module-page-check.d.ts +6 -0
  29. package/module-page-check.js +6 -0
  30. package/package.json +1 -1
  31. package/plugins/runtime-modules/asset/data-providers.d.ts +56 -38
  32. package/plugins/runtime-modules/asset/data-providers.js +4 -32
  33. package/plugins/runtime-modules/asset/definition.d.ts +115 -38
  34. package/plugins/runtime-modules/asset/definition.js +2 -1
  35. package/plugins/runtime-modules/asset/form-providers.d.ts +85 -2
  36. package/plugins/runtime-modules/asset/form-providers.js +70 -11
  37. package/plugins/runtime-modules/asset/form-ui-provider.js +7 -1
  38. package/plugins/runtime-modules/asset/media-asset-field.d.ts +7 -7
  39. package/plugins/runtime-modules/asset/media-asset-field.js +11 -33
  40. package/plugins/runtime-modules/asset/media-asset-form-control.d.ts +8 -7
  41. package/plugins/runtime-modules/asset/media-asset-form-control.js +42 -83
  42. package/plugins/runtime-modules/asset/media-assets-field.d.ts +37 -0
  43. package/plugins/runtime-modules/asset/media-assets-field.js +81 -0
  44. package/plugins/runtime-modules/asset/media-assets-form-control.d.ts +27 -0
  45. package/plugins/runtime-modules/asset/media-assets-form-control.js +182 -0
  46. package/plugins/runtime-modules/asset/media-field-picker-labels.d.ts +9 -0
  47. package/plugins/runtime-modules/asset/media-field-picker-labels.js +49 -0
  48. package/plugins/runtime-modules/asset/services/collection.js +12 -0
  49. package/plugins/runtime-modules/core/widgets/collection-view/asset-binding-tools.d.ts +24 -0
  50. package/plugins/runtime-modules/core/widgets/collection-view/asset-binding-tools.js +55 -0
  51. package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.d.ts +26 -2
  52. package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +125 -32
  53. package/plugins/runtime-modules/core/widgets/collection-view/client.d.ts +7 -2
  54. package/plugins/runtime-modules/core/widgets/collection-view/client.js +12 -4
  55. package/plugins/runtime-modules/core/widgets/collection-view/config.d.ts +25 -0
  56. package/plugins/runtime-modules/core/widgets/collection-view/config.js +34 -0
  57. package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.js +4 -1
  58. package/plugins/runtime-modules/core/widgets/collection-view/server.d.ts +3 -2
  59. package/plugins/runtime-modules/core/widgets/collection-view/server.js +20 -18
  60. package/plugins/runtime-modules/descriptor-compiler.d.ts +4 -0
  61. package/plugins/runtime-modules/descriptor-compiler.js +9 -204
  62. package/plugins/runtime-modules/resolver.js +31 -5
  63. package/types/collection-view-widget.d.ts +19 -0
  64. package/types/core-widget-placements.d.ts +9 -0
  65. package/types/media.d.ts +16 -0
@@ -1,12 +1,13 @@
1
1
  import type { PhiControlSize } from "../../types/control";
2
- import type { PhiMediaAssetTile } from "../../types/media";
2
+ import type { PhiMediaCollectionItem } from "../../types/media";
3
3
  import { type PhiCollectionLayoutControlProps } from "./phi-collection-layout-control";
4
4
  /**
5
5
  * What a tile reads of an Asset, and nothing more: a whole `PhiMediaAssetTile` fits, and so does an
6
6
  * Asset a Module holds in a shape of its own with these fields (`width`/`height` for the dimensions
7
- * label, `deliveryPolicy`/`lifecycleStatus` for whether the picture is public and may be optimised).
7
+ * label, `deliveryPolicy`/`lifecycleStatus` for whether the picture is public and may be optimised). The
8
+ * item a Collection hands the Media renderer is this and its Folder (`PhiMediaCollectionItem`).
8
9
  */
9
- export type PhiMediaAssetTileControlAsset = Pick<PhiMediaAssetTile, "id" | "kind" | "originalName" | "title" | "altText" | "contentType" | "deliveryUrl" | "thumbnailUrl" | "previewUrl" | "deliveryPolicy" | "lifecycleStatus" | "width" | "height" | "blurDataUrl">;
10
+ export type PhiMediaAssetTileControlAsset = Omit<PhiMediaCollectionItem, "folderId">;
10
11
  /** `onSelect` and `onDelete` hand back the Asset as it was passed in, in its own type. */
11
12
  export type PhiMediaAssetTileControlProps<TAsset extends PhiMediaAssetTileControlAsset = PhiMediaAssetTileControlAsset> = {
12
13
  asset: TAsset;
@@ -1,4 +1,4 @@
1
- import type { ReactNode } from "react";
1
+ import { type ReactNode } from "react";
2
2
  import type { PhisMediaSourceItem } from "@phis/contracts/media-source";
3
3
  import type { PhiMediaAssetTile } from "../../types/media";
4
4
  import type { PhiControlOption } from "./phi-control-options";
@@ -30,16 +30,14 @@ export type PhiMediaPickerControlProps = PhiPickerTransactionCallbacks<number |
30
30
  /** Why the last import did not work, said above the tiles. */
31
31
  sourceNotice?: string | null;
32
32
  /**
33
- * A file from the reader's machine was chosen to go into the library, where the picker offers that.
34
- * Answers the Asset it became -- chosen then as if it had been picked in the library -- or null where
35
- * nothing is to be chosen and the picker stays as it is. Absent, the picker offers no upload.
33
+ * The upload surface, where the picker offers one: the Upload button beside Reload shows it above the
34
+ * library's tiles -- the Media library's own upload surface (`PhiAreaUploadBinding`, one file), which
35
+ * the host draws, so a picker without upload carries no transport. It is drawn only while the picker is
36
+ * open and the panel shown, so closing either stops what is on its way. `choose` chooses an Asset that
37
+ * arrived as if it had been picked in the library, and closes the picker. Absent, no upload is offered.
36
38
  */
37
- onUpload?: (file: File) => Promise<PhiMediaAssetTile | null>;
38
- /** What the file dialog offers, as a MIME or extension list. */
39
- uploadAccept?: string;
40
- /** How far the upload on its way is, in per cent; null while none is. */
41
- uploadProgress?: number | null;
42
- /** Why the last upload did not work, said above the library's tiles. */
39
+ uploadPanel?: (choose: (assetId: number) => void) => ReactNode;
40
+ /** Why the last upload did not work, or the Folder could not be opened, said above the library's tiles. */
43
41
  uploadNotice?: string | null;
44
42
  folders?: readonly PhiControlOption[];
45
43
  folderValue?: string;
@@ -91,4 +89,4 @@ export type PhiMediaPickerControlProps = PhiPickerTransactionCallbacks<number |
91
89
  onMinColumnWidthChange?: (minColumnWidth: number) => void;
92
90
  onReload?: () => void;
93
91
  };
94
- export declare function PhiMediaPickerControl({ open, value, assets, spaces, spaceValue, sources, sourceValue, sourceItems, sourceHasMore, importingItemId, sourceNotice, onUpload, uploadAccept, uploadProgress, uploadNotice, folders, folderValue, query, page, pageSize, total, minColumnWidth, loading, disabled, readOnly, placement, showSearchBar, showFolderFilter, showPagination, trigger, isAssetSelectable, labels, getPopupContainer, popupRootClassName, onOpenChange, onQueryChange, onSpaceChange, onSourceChange, onSourceItemSelect, onSourceLoadMore, onFolderChange, onPageChange, onMinColumnWidthChange, onReload, onChange, onCommit, onDiscard, }: PhiMediaPickerControlProps): import("react").JSX.Element;
92
+ export declare function PhiMediaPickerControl({ open, value, assets, spaces, spaceValue, sources, sourceValue, sourceItems, sourceHasMore, importingItemId, sourceNotice, uploadPanel, uploadNotice, folders, folderValue, query, page, pageSize, total, minColumnWidth, loading, disabled, readOnly, placement, showSearchBar, showFolderFilter, showPagination, trigger, isAssetSelectable, labels, getPopupContainer, popupRootClassName, onOpenChange, onQueryChange, onSpaceChange, onSourceChange, onSourceItemSelect, onSourceLoadMore, onFolderChange, onPageChange, onMinColumnWidthChange, onReload, onChange, onCommit, onDiscard, }: PhiMediaPickerControlProps): import("react").JSX.Element;
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useState } from "react";
3
4
  import { Flex, Typography } from "antd";
4
5
  import { usePhiConfig } from "../root/phi-config-provider";
5
6
  import { PhiButtonControl } from "./phi-button-control";
6
7
  import { PhiCascaderControl } from "./phi-cascader-control";
7
8
  import { PhiEmptyControl } from "./phi-empty-control";
8
- import { PhiFileDropControl } from "./phi-file-drop-control";
9
9
  import { PhiSelectControl } from "./phi-select-control";
10
10
  import { PhiCollectionLayoutControl } from "./phi-collection-layout-control";
11
11
  import { PhiMediaAssetCollectionSkeletonControl, PhiMediaAssetTileControl, } from "./phi-media-asset-tile-control";
@@ -17,7 +17,7 @@ import { PhiSliderControl } from "./phi-slider-control";
17
17
  import { PhiTextControl } from "./phi-text-control";
18
18
  import { usePhiImmediatePicker } from "./use-phi-immediate-picker";
19
19
  import { PhiIcon } from "../shell/phi-icon";
20
- export function PhiMediaPickerControl({ open, value = null, assets, spaces = [], spaceValue = null, sources = [], sourceValue = "", sourceItems = [], sourceHasMore = false, importingItemId = null, sourceNotice = null, onUpload, uploadAccept, uploadProgress = null, uploadNotice = null, folders = [], folderValue = "/", query = "", page = 1, pageSize = 20, total = assets.length, minColumnWidth = PHI_MEDIA_PICKER_DEFAULT_COLUMN_WIDTH, loading, disabled, readOnly, placement = "left", showSearchBar = true, showFolderFilter = true, showPagination = true, trigger, isAssetSelectable, labels, getPopupContainer, popupRootClassName, onOpenChange, onQueryChange, onSpaceChange, onSourceChange, onSourceItemSelect, onSourceLoadMore, onFolderChange, onPageChange, onMinColumnWidthChange, onReload, onChange, onCommit, onDiscard, }) {
20
+ export function PhiMediaPickerControl({ open, value = null, assets, spaces = [], spaceValue = null, sources = [], sourceValue = "", sourceItems = [], sourceHasMore = false, importingItemId = null, sourceNotice = null, uploadPanel, uploadNotice = null, folders = [], folderValue = "/", query = "", page = 1, pageSize = 20, total = assets.length, minColumnWidth = PHI_MEDIA_PICKER_DEFAULT_COLUMN_WIDTH, loading, disabled, readOnly, placement = "left", showSearchBar = true, showFolderFilter = true, showPagination = true, trigger, isAssetSelectable, labels, getPopupContainer, popupRootClassName, onOpenChange, onQueryChange, onSpaceChange, onSourceChange, onSourceItemSelect, onSourceLoadMore, onFolderChange, onPageChange, onMinColumnWidthChange, onReload, onChange, onCommit, onDiscard, }) {
21
21
  const { token } = usePhiConfig();
22
22
  const locked = disabled || readOnly;
23
23
  const resolvedMinColumnWidth = normalizePhiMediaPickerMinColumnWidth(minColumnWidth);
@@ -34,7 +34,8 @@ export function PhiMediaPickerControl({ open, value = null, assets, spaces = [],
34
34
  // A source is shown while one other than the library is named; its items stand where the tiles do.
35
35
  const sourceActive = sources.length > 1 && sourceValue !== "";
36
36
  const importing = importingItemId != null;
37
- const uploading = uploadProgress != null;
37
+ const [uploadShown, setUploadShown] = useState(false);
38
+ const uploadOffered = uploadPanel != null && !sourceActive;
38
39
  const sourceTileItems = sourceItems.map((item) => (_jsx(PhiMediaSourceItemTileControl, { title: item.title, thumbnailUrl: item.thumbnailUrl, credit: item.credit, minColumnWidth: resolvedMinColumnWidth, busy: importingItemId === item.id, busyLabel: labels?.importing, disabled: locked || importing, onSelect: () => {
39
40
  void onSourceItemSelect?.(item).then((asset) => {
40
41
  if (!asset)
@@ -53,13 +54,10 @@ export function PhiMediaPickerControl({ open, value = null, assets, spaces = [],
53
54
  minHeight: 0,
54
55
  }, children: [_jsx(Typography.Text, { strong: true, children: labels?.title ?? "Select media" }), _jsxs(Flex, { gap: token.paddingSM, align: "center", wrap: true, children: [showSearchBar ? (_jsx("div", { style: { flex: "1 1 220px" }, children: _jsx(PhiTextControl, { inputType: "search", value: query, size: "small", placeholder: labels?.search ?? "Search", disabled: locked, onChange: (next) => onQueryChange?.(next ?? "") }) })) : null, spaces.length > 1 ? (_jsx("div", { style: { flex: "0 1 160px" }, children: _jsx(PhiSelectControl, { value: spaceValue ?? undefined, options: spaces, size: "small", placeholder: labels?.space ?? "Space", disabled: locked, getPopupContainer: getPopupContainer, popupRootClassName: popupRootClassName, onChange: (next) => { if (typeof next === "string" && next)
55
56
  onSpaceChange?.(next); } }) })) : null, sources.length > 1 ? (_jsx("div", { style: { flex: "0 1 160px" }, children: _jsx(PhiSelectControl, { value: sourceValue, options: sources, size: "small", ariaLabel: labels?.source ?? "Source", placeholder: labels?.source ?? "Source", disabled: locked || importing, getPopupContainer: getPopupContainer, popupRootClassName: popupRootClassName, onChange: (next) => { if (typeof next === "string")
56
- onSourceChange?.(next); } }) })) : null, showFolderFilter ? (_jsx("div", { style: { flex: "1 1 180px" }, children: _jsx(PhiCascaderControl, { value: folderValue, options: folders, allowRoot: true, rootValue: "/", separator: "/", size: "small", placeholder: labels?.folder ?? "Folder", disabled: locked, getPopupContainer: getPopupContainer, classNames: popupRootClassName ? { popup: { root: popupRootClassName } } : undefined, onChange: (next) => onFolderChange?.(next ?? "/") }) })) : null, _jsx(PhiButtonControl, { ariaLabel: labels?.reload ?? "Reload", tooltip: labels?.reload ?? "Reload", icon: _jsx(PhiIcon, { name: "reload", size: "inherit" }), size: "small", disabled: locked, onClick: onReload }), onUpload && !sourceActive ? (_jsx(PhiFileDropControl, { accept: uploadAccept, disabled: locked || uploading, onFile: (file) => {
57
- void onUpload(file).then((asset) => {
58
- if (!asset)
59
- return;
60
- picker.changeValue(asset.id);
61
- picker.closePicker("commit");
62
- });
63
- }, children: _jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: "upload", size: "inherit" }), label: uploading ? `${uploadProgress}%` : labels?.upload ?? "Upload", ariaLabel: labels?.upload ?? "Upload", size: "small", loading: uploading, disabled: locked || uploading }) })) : null] }), sourceActive && sourceNotice ? (_jsx(Typography.Text, { type: "danger", role: "alert", children: sourceNotice })) : null, !sourceActive && uploadNotice ? (_jsx(Typography.Text, { type: "danger", role: "alert", children: uploadNotice })) : null, _jsx("div", { style: { flex: "1 1 auto", minHeight: 0, overflow: "auto" }, children: sourceActive ? (loading && sourceItems.length === 0 ? (_jsx(PhiMediaAssetCollectionSkeletonControl, { mode: "grid", gap: token.paddingSM, minColumnWidth: resolvedMinColumnWidth, count: Math.min(pageSize, 12), size: "small" })) : sourceItems.length === 0 ? (_jsx(PhiEmptyControl, { description: labels?.sourceEmpty ?? labels?.empty ?? "No media" })) : (_jsx(PhiCollectionLayoutControl, { mode: "grid", gap: token.paddingSM, minColumnWidth: resolvedMinColumnWidth, items: sourceTileItems }))) : loading && assets.length === 0 ? (_jsx(PhiMediaAssetCollectionSkeletonControl, { mode: "grid", gap: token.paddingSM, minColumnWidth: resolvedMinColumnWidth, count: Math.min(pageSize, 12), size: "small" })) : assets.length === 0 ? (_jsx(PhiEmptyControl, { description: labels?.empty ?? "No media" })) : (_jsx(PhiCollectionLayoutControl, { mode: "grid", gap: token.paddingSM, minColumnWidth: resolvedMinColumnWidth, items: tileItems })) }), _jsxs(Flex, { align: "center", gap: token.paddingSM, style: { flex: "0 0 auto", minWidth: 0 }, children: [_jsx(Typography.Text, { type: "secondary", ellipsis: true, style: { flex: "0 1 180px", minWidth: 0 }, children: selected?.title || selected?.originalName || "" }), _jsxs(Flex, { align: "center", gap: token.paddingXS, style: { flex: "1 1 160px", minWidth: 120 }, children: [_jsx(PhiSliderControl, { ariaLabel: labels?.tileSize ?? "Tile size", value: resolvedMinColumnWidth, min: PHI_MEDIA_PICKER_MIN_COLUMN_WIDTH, max: PHI_MEDIA_PICKER_MAX_COLUMN_WIDTH, step: PHI_MEDIA_PICKER_COLUMN_WIDTH_STEP, tooltipSuffix: " px", disabled: locked, style: { flex: "1 1 auto", minWidth: 0 }, onChange: onMinColumnWidthChange }), _jsxs(Typography.Text, { type: "secondary", style: { fontSize: token.fontSizeSM, whiteSpace: "nowrap" }, children: [resolvedMinColumnWidth, "px"] })] }), _jsx(PhiButtonControl, { label: labels?.clear ?? "Clear", size: "small", disabled: locked || picker.value == null, onClick: () => picker.changeValue(null) }), sourceActive ? (sourceHasMore ? (_jsx(PhiButtonControl, { label: labels?.loadMore ?? "Load more", size: "small", loading: loading, disabled: locked || importing, onClick: onSourceLoadMore })) : null) : showPagination ? (_jsx(PhiPaginationControl, { page: page, pageSize: pageSize, total: total, size: "small", disabled: locked, showSizeChanger: true, getPopupContainer: getPopupContainer, popupRootClassName: popupRootClassName, onChange: (next) => onPageChange?.(next.page, next.pageSize) })) : null] })] }));
57
+ onSourceChange?.(next); } }) })) : null, showFolderFilter ? (_jsx("div", { style: { flex: "1 1 180px" }, children: _jsx(PhiCascaderControl, { value: folderValue, options: folders, allowRoot: true, rootValue: "/", separator: "/", size: "small", placeholder: labels?.folder ?? "Folder", disabled: locked, getPopupContainer: getPopupContainer, classNames: popupRootClassName ? { popup: { root: popupRootClassName } } : undefined, onChange: (next) => onFolderChange?.(next ?? "/") }) })) : null, _jsx(PhiButtonControl, { ariaLabel: labels?.reload ?? "Reload", tooltip: labels?.reload ?? "Reload", icon: _jsx(PhiIcon, { name: "reload", size: "inherit" }), size: "small", disabled: locked, onClick: onReload }), uploadOffered ? (_jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: "upload", size: "inherit" }), ariaLabel: labels?.upload ?? "Upload", tooltip: labels?.upload ?? "Upload", type: uploadShown ? "primary" : "default", size: "small", disabled: locked, onClick: () => setUploadShown((current) => !current) })) : null] }), uploadOffered && uploadShown && picker.open && !locked ? uploadPanel((assetId) => {
58
+ setUploadShown(false);
59
+ picker.changeValue(assetId);
60
+ picker.closePicker("commit");
61
+ }) : null, sourceActive && sourceNotice ? (_jsx(Typography.Text, { type: "danger", role: "alert", children: sourceNotice })) : null, !sourceActive && uploadNotice ? (_jsx(Typography.Text, { type: "danger", role: "alert", children: uploadNotice })) : null, _jsx("div", { style: { flex: "1 1 auto", minHeight: 0, overflow: "auto" }, children: sourceActive ? (loading && sourceItems.length === 0 ? (_jsx(PhiMediaAssetCollectionSkeletonControl, { mode: "grid", gap: token.paddingSM, minColumnWidth: resolvedMinColumnWidth, count: Math.min(pageSize, 12), size: "small" })) : sourceItems.length === 0 ? (_jsx(PhiEmptyControl, { description: labels?.sourceEmpty ?? labels?.empty ?? "No media" })) : (_jsx(PhiCollectionLayoutControl, { mode: "grid", gap: token.paddingSM, minColumnWidth: resolvedMinColumnWidth, items: sourceTileItems }))) : loading && assets.length === 0 ? (_jsx(PhiMediaAssetCollectionSkeletonControl, { mode: "grid", gap: token.paddingSM, minColumnWidth: resolvedMinColumnWidth, count: Math.min(pageSize, 12), size: "small" })) : assets.length === 0 ? (_jsx(PhiEmptyControl, { description: labels?.empty ?? "No media" })) : (_jsx(PhiCollectionLayoutControl, { mode: "grid", gap: token.paddingSM, minColumnWidth: resolvedMinColumnWidth, items: tileItems })) }), _jsxs(Flex, { align: "center", gap: token.paddingSM, style: { flex: "0 0 auto", minWidth: 0 }, children: [_jsx(Typography.Text, { type: "secondary", ellipsis: true, style: { flex: "0 1 180px", minWidth: 0 }, children: selected?.title || selected?.originalName || "" }), _jsxs(Flex, { align: "center", gap: token.paddingXS, style: { flex: "1 1 160px", minWidth: 120 }, children: [_jsx(PhiSliderControl, { ariaLabel: labels?.tileSize ?? "Tile size", value: resolvedMinColumnWidth, min: PHI_MEDIA_PICKER_MIN_COLUMN_WIDTH, max: PHI_MEDIA_PICKER_MAX_COLUMN_WIDTH, step: PHI_MEDIA_PICKER_COLUMN_WIDTH_STEP, tooltipSuffix: " px", disabled: locked, style: { flex: "1 1 auto", minWidth: 0 }, onChange: onMinColumnWidthChange }), _jsxs(Typography.Text, { type: "secondary", style: { fontSize: token.fontSizeSM, whiteSpace: "nowrap" }, children: [resolvedMinColumnWidth, "px"] })] }), _jsx(PhiButtonControl, { label: labels?.clear ?? "Clear", size: "small", disabled: locked || picker.value == null, onClick: () => picker.changeValue(null) }), sourceActive ? (sourceHasMore ? (_jsx(PhiButtonControl, { label: labels?.loadMore ?? "Load more", size: "small", loading: loading, disabled: locked || importing, onClick: onSourceLoadMore })) : null) : showPagination ? (_jsx(PhiPaginationControl, { page: page, pageSize: pageSize, total: total, size: "small", disabled: locked, showSizeChanger: true, getPopupContainer: getPopupContainer, popupRootClassName: popupRootClassName, onChange: (next) => onPageChange?.(next.page, next.pageSize) })) : null] })] }));
64
62
  return (_jsx(PhiPopoverControl, { open: picker.open, content: content, placement: placement, disabled: locked, getPopupContainer: getPopupContainer, rootClassName: popupRootClassName, onOpenChange: picker.handleOpenChange, children: trigger ?? (_jsx("span", { children: _jsx(PhiButtonControl, { block: true, icon: _jsx(PhiIcon, { name: "picture", size: "inherit" }), label: labels?.trigger ?? "Select media", disabled: locked, onClick: picker.openPicker }) })) }));
65
63
  }
@@ -4,9 +4,9 @@ import type { PhiFormRenderContext } from "./form-resolution";
4
4
  /**
5
5
  * What a Form's field types say for themselves, under the keys their controls read.
6
6
  *
7
- * The `media-asset` field is the same: the picker it opens says the Media Label Set's words, read here
8
- * for every Form that has such a field (`media-asset-field-keys.ts`), and the upload inside it says the
9
- * upload's refusals and its hold under the upload field's keys. The `table` field says its add, remove and
7
+ * The `media-asset` and `media-assets` fields are the same: the picker they open and the upload surface
8
+ * say the Media Label Set's words, read here for every Form that has such a field
9
+ * (`media-asset-field-keys.ts`), and the upload says its refusals and its hold under the upload field's keys. The `table` field says its add, remove and
10
10
  * empty words from Core's `widget:table` set (`table-field-labels.ts`) where its config names none.
11
11
  *
12
12
  * A field type whose control speaks -- the upload field's trigger, its drop hint, its holds and the
@@ -1,7 +1,7 @@
1
1
  import "server-only";
2
2
  import { getPhiMediaWidgetLabels } from "../media/label-sets/media";
3
3
  import { getPhiMediaUploadLabels } from "../media/label-sets/media-upload";
4
- import { PHI_MEDIA_ASSET_FORM_FIELD_PROVIDER_KEY } from "../../constants/media-library-provider-keys";
4
+ import { PHI_MEDIA_ASSET_FORM_FIELD_PROVIDER_KEY, PHI_MEDIA_ASSETS_FORM_FIELD_PROVIDER_KEY, } from "../../constants/media-library-provider-keys";
5
5
  import { phiRuntime } from "../../server-helpers/phi-runtime";
6
6
  import { PHI_FORM_MEDIA_ASSET_PICKER_LABEL_KEYS } from "./media-asset-field-keys";
7
7
  import { PHI_FORM_UPLOAD_FIELD_PROVIDER_KEY, PHI_FORM_UPLOAD_LABEL_KEYS } from "./upload-field-keys";
@@ -11,9 +11,9 @@ import { PHI_FORM_TABLE_LABEL_KEYS } from "./table-field-labels";
11
11
  /**
12
12
  * What a Form's field types say for themselves, under the keys their controls read.
13
13
  *
14
- * The `media-asset` field is the same: the picker it opens says the Media Label Set's words, read here
15
- * for every Form that has such a field (`media-asset-field-keys.ts`), and the upload inside it says the
16
- * upload's refusals and its hold under the upload field's keys. The `table` field says its add, remove and
14
+ * The `media-asset` and `media-assets` fields are the same: the picker they open and the upload surface
15
+ * say the Media Label Set's words, read here for every Form that has such a field
16
+ * (`media-asset-field-keys.ts`), and the upload says its refusals and its hold under the upload field's keys. The `table` field says its add, remove and
17
17
  * empty words from Core's `widget:table` set (`table-field-labels.ts`) where its config names none.
18
18
  *
19
19
  * A field type whose control speaks -- the upload field's trigger, its drop hint, its holds and the
@@ -27,7 +27,8 @@ import { PHI_FORM_TABLE_LABEL_KEYS } from "./table-field-labels";
27
27
  */
28
28
  export async function resolvePhiFormFieldLabels(context, descriptor) {
29
29
  const hasUpload = descriptor.fields.some((field) => field.fieldProviderKey === PHI_FORM_UPLOAD_FIELD_PROVIDER_KEY);
30
- const hasMediaAsset = descriptor.fields.some((field) => field.fieldProviderKey === PHI_MEDIA_ASSET_FORM_FIELD_PROVIDER_KEY);
30
+ const hasMediaAsset = descriptor.fields.some((field) => field.fieldProviderKey === PHI_MEDIA_ASSET_FORM_FIELD_PROVIDER_KEY ||
31
+ field.fieldProviderKey === PHI_MEDIA_ASSETS_FORM_FIELD_PROVIDER_KEY);
31
32
  const hasTable = descriptor.fields.some((field) => field.fieldProviderKey === PHI_FORM_TABLE_FIELD_PROVIDER_KEY);
32
33
  if (!hasUpload && !hasMediaAsset && !hasTable)
33
34
  return {};
@@ -86,6 +87,13 @@ async function readMediaAssetFieldLabels(options) {
86
87
  [keys.importingLabel]: picker.importingLabel,
87
88
  [keys.importFailedText]: picker.importFailedText,
88
89
  [keys.loadMoreLabel]: picker.loadMoreLabel,
90
+ [keys.chooseFromLibraryLabel]: tool.chooseFromLibraryLabel,
89
91
  [keys.uploadLabel]: upload.uploadToggleLabel,
92
+ [keys.uploadDropTitle]: upload.dropTitle,
93
+ [keys.uploadDropHint]: upload.dropHint,
94
+ [keys.uploadRetryLabel]: upload.retryLabel,
95
+ [keys.uploadDoneLabel]: upload.doneLabel,
96
+ [keys.uploadFailedLabel]: upload.failedLabel,
97
+ [keys.uploadSuccessTemplate]: upload.uploadSuccessTemplate,
90
98
  };
91
99
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The `media-asset` field's picker words, under the keys its control reads them from.
2
+ * The `media-asset` and `media-assets` fields' picker words, under the keys their controls read them from.
3
3
  *
4
4
  * The field opens the Media library's own picker, and the picker's words are the Media Label Set's
5
5
  * (`getPhiMediaWidgetLabels`). The Form Widget reads that set on the Server for every Form that has a
@@ -25,6 +25,14 @@ export declare const PHI_FORM_MEDIA_ASSET_PICKER_LABEL_KEYS: {
25
25
  readonly importingLabel: "mediaAssetPickerImporting";
26
26
  readonly importFailedText: "mediaAssetPickerImportFailed";
27
27
  readonly loadMoreLabel: "mediaAssetPickerLoadMore";
28
+ /** The `media-assets` field's button that opens the picker (the Media Label Set's "Choose from Media library"). */
29
+ readonly chooseFromLibraryLabel: "mediaAssetPickerChooseFromLibrary";
28
30
  /** The picker's upload button (the Media Label Set's upload toggle). */
29
31
  readonly uploadLabel: "mediaAssetPickerUpload";
32
+ readonly uploadDropTitle: "mediaAssetPickerUploadDropTitle";
33
+ readonly uploadDropHint: "mediaAssetPickerUploadDropHint";
34
+ readonly uploadRetryLabel: "mediaAssetPickerUploadRetry";
35
+ readonly uploadDoneLabel: "mediaAssetPickerUploadDone";
36
+ readonly uploadFailedLabel: "mediaAssetPickerUploadFailed";
37
+ readonly uploadSuccessTemplate: "mediaAssetPickerUploadSuccess";
30
38
  };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The `media-asset` field's picker words, under the keys its control reads them from.
2
+ * The `media-asset` and `media-assets` fields' picker words, under the keys their controls read them from.
3
3
  *
4
4
  * The field opens the Media library's own picker, and the picker's words are the Media Label Set's
5
5
  * (`getPhiMediaWidgetLabels`). The Form Widget reads that set on the Server for every Form that has a
@@ -25,6 +25,18 @@ export const PHI_FORM_MEDIA_ASSET_PICKER_LABEL_KEYS = {
25
25
  importingLabel: "mediaAssetPickerImporting",
26
26
  importFailedText: "mediaAssetPickerImportFailed",
27
27
  loadMoreLabel: "mediaAssetPickerLoadMore",
28
+ /** The `media-assets` field's button that opens the picker (the Media Label Set's "Choose from Media library"). */
29
+ chooseFromLibraryLabel: "mediaAssetPickerChooseFromLibrary",
28
30
  /** The picker's upload button (the Media Label Set's upload toggle). */
29
31
  uploadLabel: "mediaAssetPickerUpload",
32
+ /*
33
+ * The upload surface the button shows, the Media library's own (`PhiAreaUploadBinding`): its drop area,
34
+ * the state of the file on its way, and the message once it arrived (`widget:upload`'s `area_*`).
35
+ */
36
+ uploadDropTitle: "mediaAssetPickerUploadDropTitle",
37
+ uploadDropHint: "mediaAssetPickerUploadDropHint",
38
+ uploadRetryLabel: "mediaAssetPickerUploadRetry",
39
+ uploadDoneLabel: "mediaAssetPickerUploadDone",
40
+ uploadFailedLabel: "mediaAssetPickerUploadFailed",
41
+ uploadSuccessTemplate: "mediaAssetPickerUploadSuccess",
30
42
  };
@@ -27,6 +27,7 @@ const PHI_MEDIA_WIDGET_LABEL_SET = definePhiLabelSet({
27
27
  tool_kind_label: PHI_MEDIA_WIDGET_DEFAULT_LABELS.tool.kindLabel,
28
28
  tool_reset_label: PHI_MEDIA_WIDGET_DEFAULT_LABELS.tool.resetLabel,
29
29
  tool_reload_label: PHI_MEDIA_WIDGET_DEFAULT_LABELS.tool.reloadLabel,
30
+ tool_choose_from_library_label: PHI_MEDIA_WIDGET_DEFAULT_LABELS.tool.chooseFromLibraryLabel,
30
31
  tool_image_kind_label: PHI_MEDIA_WIDGET_DEFAULT_LABELS.tool.imageKindLabel,
31
32
  tool_video_kind_label: PHI_MEDIA_WIDGET_DEFAULT_LABELS.tool.videoKindLabel,
32
33
  tool_audio_kind_label: PHI_MEDIA_WIDGET_DEFAULT_LABELS.tool.audioKindLabel,
@@ -45,6 +46,7 @@ const PHI_MEDIA_WIDGET_LABEL_SET = definePhiLabelSet({
45
46
  grid_delete_label: PHI_MEDIA_WIDGET_DEFAULT_LABELS.grid.deleteLabel,
46
47
  grid_delete_success_template: definePhiMessageLabel(PHI_MEDIA_WIDGET_DEFAULT_LABELS.grid.deleteSuccessTemplate),
47
48
  grid_delete_failed_text: definePhiMessageLabel(PHI_MEDIA_WIDGET_DEFAULT_LABELS.grid.deleteFailedText),
49
+ grid_add_failed_text: definePhiMessageLabel(PHI_MEDIA_WIDGET_DEFAULT_LABELS.grid.addFailedText),
48
50
  picker_trigger_label: PHI_MEDIA_WIDGET_DEFAULT_LABELS.picker.triggerLabel,
49
51
  picker_popover_title: PHI_MEDIA_WIDGET_DEFAULT_LABELS.picker.popoverTitle,
50
52
  picker_empty_description: definePhiMessageLabel(PHI_MEDIA_WIDGET_DEFAULT_LABELS.picker.emptyDescription),
@@ -82,6 +84,7 @@ export async function getPhiMediaWidgetLabels(options) {
82
84
  kindLabel: labels.tool_kind_label,
83
85
  resetLabel: labels.tool_reset_label,
84
86
  reloadLabel: labels.tool_reload_label,
87
+ chooseFromLibraryLabel: labels.tool_choose_from_library_label,
85
88
  imageKindLabel: labels.tool_image_kind_label,
86
89
  videoKindLabel: labels.tool_video_kind_label,
87
90
  audioKindLabel: labels.tool_audio_kind_label,
@@ -103,6 +106,7 @@ export async function getPhiMediaWidgetLabels(options) {
103
106
  deleteLabel: labels.grid_delete_label,
104
107
  deleteSuccessTemplate: labels.grid_delete_success_template,
105
108
  deleteFailedText: labels.grid_delete_failed_text,
109
+ addFailedText: labels.grid_add_failed_text,
106
110
  },
107
111
  picker: {
108
112
  triggerLabel: labels.picker_trigger_label,
@@ -15,3 +15,17 @@ export declare function findPhiMediaFolderByNamePath(folders: readonly Pick<PhiM
15
15
  folderId: number | null;
16
16
  depth: number;
17
17
  };
18
+ /**
19
+ * Whether a Folder path setting is one whose placeholders read `{key}`: every brace opens or closes one
20
+ * (`{}`, `{a`, `a}`, `{a{b}}` do not). What the `media-asset` field's `folderPath` and the Media
21
+ * renderer's `features.media.folderPath` are held to.
22
+ */
23
+ export declare function isPhiMediaFolderPathTemplate(value: string): boolean;
24
+ /**
25
+ * The Folder path a template of names (`splitPhiMediaFolderNamePath` of a setting) names for these
26
+ * values: each `{key}` the value under `key` -- the `media-asset` field's Form values, the Collection
27
+ * View's binding params for the Media renderer. A name whose placeholder has no value is left out whole
28
+ * -- "Shop Images / {category} / {product}" without a category is "Shop Images / <product>" -- and a name
29
+ * that comes out empty is left out too.
30
+ */
31
+ export declare function resolvePhiMediaFolderPathTemplate(folderPath: readonly string[], values: Readonly<Record<string, unknown>>): string[];
@@ -1,8 +1,9 @@
1
+ import { readPhiDotPath } from "../../helpers/dot-path";
1
2
  /*
2
3
  * A Folder named by its path of names rather than its id: what a setting states that a preset writes for
3
4
  * every Site (the `area-upload` Widget's `folderPath`) and what the Asset Controller's `path` signal may
4
- * carry. Pure and without runtime imports, because the upload transport reads it and every upload surface carries
5
- * the transport.
5
+ * carry -- with the `{key}` placeholders a path setting may hold. Pure and without runtime imports beyond
6
+ * the dot-path reader, because the upload transport reads it and every upload surface carries the transport.
6
7
  */
7
8
  /**
8
9
  * A Folder named by its path, written the way a person types it and Core reads it: names from the root
@@ -34,3 +35,40 @@ export function findPhiMediaFolderByNamePath(folders, path) {
34
35
  }
35
36
  return { folderId, depth };
36
37
  }
38
+ /* `{key}`: a value's key, a dotted path into it for a value that is a record. */
39
+ const PHI_MEDIA_FOLDER_PATH_PLACEHOLDER = /\{([A-Za-z0-9_.-]+)\}/gu;
40
+ /**
41
+ * Whether a Folder path setting is one whose placeholders read `{key}`: every brace opens or closes one
42
+ * (`{}`, `{a`, `a}`, `{a{b}}` do not). What the `media-asset` field's `folderPath` and the Media
43
+ * renderer's `features.media.folderPath` are held to.
44
+ */
45
+ export function isPhiMediaFolderPathTemplate(value) {
46
+ return !/[{}]/u.test(value.replace(PHI_MEDIA_FOLDER_PATH_PLACEHOLDER, ""));
47
+ }
48
+ /*
49
+ * A value as a Folder name: a text or a number, trimmed, and a `/` in it a `-`, so a value can name a
50
+ * Folder but never add a level of them. Anything else -- empty, absent, a list, a record -- is no name.
51
+ */
52
+ function readPhiMediaFolderPathValue(value) {
53
+ const text = typeof value === "string" ? value : typeof value === "number" && Number.isFinite(value) ? String(value) : "";
54
+ return text.replace(/\//gu, "-").replace(/\s+/gu, " ").trim();
55
+ }
56
+ /**
57
+ * The Folder path a template of names (`splitPhiMediaFolderNamePath` of a setting) names for these
58
+ * values: each `{key}` the value under `key` -- the `media-asset` field's Form values, the Collection
59
+ * View's binding params for the Media renderer. A name whose placeholder has no value is left out whole
60
+ * -- "Shop Images / {category} / {product}" without a category is "Shop Images / <product>" -- and a name
61
+ * that comes out empty is left out too.
62
+ */
63
+ export function resolvePhiMediaFolderPathTemplate(folderPath, values) {
64
+ return folderPath.flatMap((segment) => {
65
+ let missing = false;
66
+ const resolved = segment.replace(PHI_MEDIA_FOLDER_PATH_PLACEHOLDER, (_placeholder, key) => {
67
+ const value = readPhiMediaFolderPathValue(readPhiDotPath(values, key));
68
+ if (!value)
69
+ missing = true;
70
+ return value;
71
+ }).replace(/\s+/gu, " ").trim();
72
+ return missing || !resolved ? [] : [resolved];
73
+ });
74
+ }
@@ -0,0 +1,70 @@
1
+ /**
2
+ * The Media library's own Collection resource, `assets` of `PHI_MEDIA_LIBRARY_DATA_PROVIDER_KEYS.collection`,
3
+ * as the Asset Module declares it (`plugins/runtime-modules/asset/data-providers.ts` names this object):
4
+ * its filters, its Folder, lock, upload and delete actions, and its upload panel -- what the Media
5
+ * renderer offers for it (COLLECTIONS.md, "The Media renderer").
6
+ *
7
+ * The Foundation's, like the keys beside it, because a Foundation surface binds that resource without a
8
+ * page's registry and still has to hand the renderer its declaration: the Media preview grid
9
+ * (`PhiAssetPreviewGridWidget`). One object, so the declaration the Area's registry holds and the one the
10
+ * grid hands over cannot say different things.
11
+ */
12
+ export declare const PHI_MEDIA_LIBRARY_ASSET_RESOURCE: {
13
+ readonly resourceKey: "assets";
14
+ readonly title: "Assets";
15
+ readonly itemIdentityPath: "id";
16
+ readonly itemRendererKey: `${string}/${string}`;
17
+ readonly selectionValueSchema: `${string}/signals/${string}`;
18
+ readonly defaultForWidget: true;
19
+ readonly query: {
20
+ readonly search: true;
21
+ readonly pagination: true;
22
+ readonly filterFields: readonly [{
23
+ readonly key: "kind";
24
+ readonly title: "Kind";
25
+ readonly type: "enum[]";
26
+ }, {
27
+ readonly key: "presentationFlags";
28
+ readonly title: "Flags";
29
+ readonly type: "enum[]";
30
+ }, {
31
+ readonly key: "folderId";
32
+ readonly title: "Folder";
33
+ readonly type: "path";
34
+ }];
35
+ };
36
+ readonly actions: readonly [{
37
+ readonly key: "createFolder";
38
+ readonly title: "Create folder";
39
+ readonly scope: "resource";
40
+ }, {
41
+ readonly key: "lockFolder";
42
+ readonly title: "Lock folder";
43
+ readonly scope: "resource";
44
+ }, {
45
+ readonly key: "unlockFolder";
46
+ readonly title: "Unlock folder";
47
+ readonly scope: "resource";
48
+ }, {
49
+ readonly key: "upload";
50
+ readonly title: "Upload";
51
+ readonly scope: "resource";
52
+ readonly panelKey: "upload";
53
+ }, {
54
+ readonly key: "refresh";
55
+ readonly title: "Reload";
56
+ readonly scope: "resource";
57
+ }, {
58
+ readonly key: "update";
59
+ readonly title: "Update";
60
+ readonly scope: "item";
61
+ }, {
62
+ readonly key: "delete";
63
+ readonly title: "Delete";
64
+ readonly scope: "item";
65
+ }];
66
+ readonly panels: readonly [{
67
+ readonly key: "upload";
68
+ readonly title: "Upload assets";
69
+ }];
70
+ };
@@ -0,0 +1,41 @@
1
+ import { PHI_MEDIA_LIBRARY_ITEM_RENDERER_KEY } from "../../constants/media-library-provider-keys";
2
+ import { PHI_SIGNAL_VALUE_SCHEMAS } from "../../types/signals";
3
+ /**
4
+ * The Media library's own Collection resource, `assets` of `PHI_MEDIA_LIBRARY_DATA_PROVIDER_KEYS.collection`,
5
+ * as the Asset Module declares it (`plugins/runtime-modules/asset/data-providers.ts` names this object):
6
+ * its filters, its Folder, lock, upload and delete actions, and its upload panel -- what the Media
7
+ * renderer offers for it (COLLECTIONS.md, "The Media renderer").
8
+ *
9
+ * The Foundation's, like the keys beside it, because a Foundation surface binds that resource without a
10
+ * page's registry and still has to hand the renderer its declaration: the Media preview grid
11
+ * (`PhiAssetPreviewGridWidget`). One object, so the declaration the Area's registry holds and the one the
12
+ * grid hands over cannot say different things.
13
+ */
14
+ export const PHI_MEDIA_LIBRARY_ASSET_RESOURCE = {
15
+ resourceKey: "assets",
16
+ title: "Assets",
17
+ itemIdentityPath: "id",
18
+ itemRendererKey: PHI_MEDIA_LIBRARY_ITEM_RENDERER_KEY,
19
+ selectionValueSchema: PHI_SIGNAL_VALUE_SCHEMAS.mediaAssetSelection,
20
+ defaultForWidget: true,
21
+ query: {
22
+ search: true,
23
+ pagination: true,
24
+ filterFields: [
25
+ { key: "kind", title: "Kind", type: "enum[]" },
26
+ { key: "presentationFlags", title: "Flags", type: "enum[]" },
27
+ { key: "folderId", title: "Folder", type: "path" },
28
+ ],
29
+ },
30
+ actions: [
31
+ { key: "createFolder", title: "Create folder", scope: "resource" },
32
+ // The Folder the listing is filtered to; Core refuses every change to what a locked one holds.
33
+ { key: "lockFolder", title: "Lock folder", scope: "resource" },
34
+ { key: "unlockFolder", title: "Unlock folder", scope: "resource" },
35
+ { key: "upload", title: "Upload", scope: "resource", panelKey: "upload" },
36
+ { key: "refresh", title: "Reload", scope: "resource" },
37
+ { key: "update", title: "Update", scope: "item" },
38
+ { key: "delete", title: "Delete", scope: "item" },
39
+ ],
40
+ panels: [{ key: "upload", title: "Upload assets" }],
41
+ };
@@ -15,6 +15,12 @@ export type PhiAssetPreviewToolWidgetLabels = {
15
15
  kindLabel: string;
16
16
  resetLabel: string;
17
17
  reloadLabel: string;
18
+ /**
19
+ * The Media renderer's toolbar action `add`: the Media library's picker, whose pick goes to the bound
20
+ * resource's `add` action. A Collection of references to Assets offers it (a gallery); the Media
21
+ * library's own does not.
22
+ */
23
+ chooseFromLibraryLabel: string;
18
24
  imageKindLabel: string;
19
25
  videoKindLabel: string;
20
26
  audioKindLabel: string;
@@ -50,9 +56,16 @@ export type PhiAreaUploadWidgetLabels = {
50
56
  };
51
57
  export type PhiAssetPreviewGridWidgetLabels = {
52
58
  emptyDescription: string;
59
+ /**
60
+ * A tile's delete, the bound resource's `delete` action: the Media library deletes the file, a
61
+ * Collection of references takes it out -- whose placement says so in its own words
62
+ * (`presentation.labels.grid`).
63
+ */
53
64
  deleteLabel: string;
54
65
  deleteSuccessTemplate: string;
55
66
  deleteFailedText: string;
67
+ /** Said where the resource's `add` action refused an Asset picked or uploaded, without words of its own. */
68
+ addFailedText: string;
56
69
  };
57
70
  export type PhiAssetInspectorWidgetLabels = {
58
71
  inspectorTitle: string;
@@ -14,6 +14,7 @@ export const PHI_MEDIA_WIDGET_DEFAULT_LABELS = {
14
14
  kindLabel: "Kind",
15
15
  resetLabel: "Reset",
16
16
  reloadLabel: "Reload",
17
+ chooseFromLibraryLabel: "Choose from Media library",
17
18
  imageKindLabel: "image",
18
19
  videoKindLabel: "video",
19
20
  audioKindLabel: "audio",
@@ -47,6 +48,7 @@ export const PHI_MEDIA_WIDGET_DEFAULT_LABELS = {
47
48
  deleteLabel: "Delete asset",
48
49
  deleteSuccessTemplate: "Asset %1 deleted.",
49
50
  deleteFailedText: "Delete failed.",
51
+ addFailedText: "The file could not be added.",
50
52
  },
51
53
  picker: {
52
54
  triggerLabel: "Mediathek",
@@ -1,11 +1,41 @@
1
1
  import type { PhiCmsAreaUploadWidgetConfig } from "../../types/media";
2
+ import type { PhiMediaAssetTile } from "../../types/media";
2
3
  import type { PhiCollectionProviderQuery } from "../../types/collection-provider";
3
4
  import type { PhiAreaUploadWidgetLabels } from "./media-widget-labels";
5
+ import { type PhiMediaUploadAcceptance } from "./phi-media-upload";
4
6
  import { type PhiImagePreviewStoreState } from "./phi-image-preview-store";
5
7
  export type PhiAreaUploadWidgetProps = {
6
8
  config?: PhiCmsAreaUploadWidgetConfig | null;
7
9
  labels: PhiAreaUploadWidgetLabels;
8
10
  onUploadComplete?: () => void;
11
+ /**
12
+ * What the surface takes (`usePhiMediaUpload`'s acceptance): a file of another kind is refused before
13
+ * it is sent, and the file dialog offers these kinds. Absent: `config.accept`, every file by default.
14
+ */
15
+ acceptance?: PhiMediaUploadAcceptance;
16
+ /**
17
+ * Whether an Asset that arrived stays in the wall as a tile, with its delete -- the Media library's own
18
+ * upload panel. `false` for a surface whose Collection shows what arrived itself (a Collection View of
19
+ * another Provider that adds it, the picker that chooses it): only the files on their way and the
20
+ * failed ones stand here, so nothing shows twice. Default `true`.
21
+ */
22
+ showFinished?: boolean;
23
+ /** The Asset that arrived, for a host that does something with it (adds it, chooses it). */
24
+ onAssetUploaded?: (asset: PhiMediaAssetTile) => void;
25
+ /** Whether a file is on its way, for a host that holds something back meanwhile (a Form's submit). */
26
+ onUploadingChange?: (uploading: boolean) => void;
27
+ /**
28
+ * The host's own refusal of a file before it is sent, asked of each file dropped or chosen with the
29
+ * number of files this surface has on their way (the ones let through in the same selection included):
30
+ * the sentence, said as the upload's refusals are (an application message), or `null` to send it. For a
31
+ * host whose list has room for so many (the `media-assets` field's `max`).
32
+ */
33
+ refuseFile?: (file: File, sending: number) => string | null;
34
+ /**
35
+ * Uploads into the Site Space, whatever Space the Media library's listing last showed: for a host that
36
+ * stores a reference everybody follows. A `config.folderPath` is read in the Site Space either way.
37
+ */
38
+ siteSpaceOnly?: boolean;
9
39
  collectionContext?: {
10
40
  folders: PhiImagePreviewStoreState["folders"];
11
41
  folderId: number | null;
@@ -14,5 +44,5 @@ export type PhiAreaUploadWidgetProps = {
14
44
  query: PhiCollectionProviderQuery;
15
45
  };
16
46
  };
17
- export declare function PhiAreaUploadBinding({ config, labels, onUploadComplete, collectionContext }: PhiAreaUploadWidgetProps): import("react").JSX.Element;
47
+ export declare function PhiAreaUploadBinding({ config, labels, onUploadComplete, acceptance, showFinished, onAssetUploaded, onUploadingChange, refuseFile, siteSpaceOnly, collectionContext, }: PhiAreaUploadWidgetProps): import("react").JSX.Element;
18
48
  export declare function PhiAreaUploadWidget(props: PhiAreaUploadWidgetProps): import("react").JSX.Element;