@strapi/upload 5.2.0 → 5.4.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 (147) hide show
  1. package/dist/_chunks/{index-Bi33Km2i.mjs → App-D1ayH-QS.mjs} +112 -106
  2. package/dist/_chunks/App-D1ayH-QS.mjs.map +1 -0
  3. package/dist/_chunks/{index-DlRn6eNH.js → App-Dqqn78jO.js} +112 -106
  4. package/dist/_chunks/App-Dqqn78jO.js.map +1 -0
  5. package/dist/_chunks/{index-KSVkjErL.mjs → ConfigureTheView-B2Syy3q5.mjs} +24 -23
  6. package/dist/_chunks/ConfigureTheView-B2Syy3q5.mjs.map +1 -0
  7. package/dist/_chunks/{index-l4hbqJYu.js → ConfigureTheView-fwDgErsi.js} +42 -23
  8. package/dist/_chunks/ConfigureTheView-fwDgErsi.js.map +1 -0
  9. package/dist/_chunks/{index-GpFGwMho.mjs → SettingsPage-BYC3ism8.mjs} +45 -43
  10. package/dist/_chunks/SettingsPage-BYC3ism8.mjs.map +1 -0
  11. package/dist/_chunks/{index-D7YMYvKK.js → SettingsPage-oDEVs3XV.js} +61 -41
  12. package/dist/_chunks/SettingsPage-oDEVs3XV.js.map +1 -0
  13. package/dist/_chunks/{index-BHcSb0I3.js → index-B7NW5XiM.js} +1065 -1677
  14. package/dist/_chunks/index-B7NW5XiM.js.map +1 -0
  15. package/dist/_chunks/{index-BjvAmZvH.mjs → index-Clesg6BA.mjs} +1108 -1719
  16. package/dist/_chunks/index-Clesg6BA.mjs.map +1 -0
  17. package/dist/admin/index.js +2 -2
  18. package/dist/admin/index.mjs +2 -2
  19. package/dist/admin/src/components/AssetCard/AssetCard.d.ts +18 -0
  20. package/dist/admin/src/components/AssetCard/AssetCardBase.d.ts +14 -0
  21. package/dist/admin/src/components/AssetCard/AudioAssetCard.d.ts +7 -0
  22. package/dist/admin/src/components/AssetCard/AudioPreview.d.ts +6 -0
  23. package/dist/admin/src/components/AssetCard/DocAssetCard.d.ts +7 -0
  24. package/dist/admin/src/components/AssetCard/ImageAssetCard.d.ts +12 -0
  25. package/dist/admin/src/components/AssetCard/UploadingAssetCard.d.ts +17 -0
  26. package/dist/admin/src/components/AssetCard/VideoAssetCard.d.ts +8 -0
  27. package/dist/admin/src/components/AssetCard/VideoPreview.d.ts +9 -0
  28. package/dist/admin/src/components/AssetDialog/AssetDialog.d.ts +39 -0
  29. package/dist/admin/src/components/AssetDialog/BrowseStep/BrowseStep.d.ts +63 -0
  30. package/dist/admin/src/components/AssetDialog/BrowseStep/Filters.d.ts +23 -0
  31. package/dist/admin/src/components/AssetDialog/BrowseStep/PageSize.d.ts +6 -0
  32. package/dist/admin/src/components/AssetDialog/BrowseStep/PaginationFooter/Pagination.d.ts +13 -0
  33. package/dist/admin/src/components/AssetDialog/BrowseStep/PaginationFooter/PaginationFooter.d.ts +9 -0
  34. package/dist/admin/src/components/AssetDialog/BrowseStep/SearchAsset/SearchAsset.d.ts +7 -0
  35. package/dist/admin/src/components/AssetDialog/BrowseStep/utils/isSelectable.d.ts +1 -0
  36. package/dist/admin/src/components/AssetDialog/DialogFooter.d.ts +6 -0
  37. package/dist/admin/src/components/AssetDialog/SelectedStep/SelectedStep.d.ts +8 -0
  38. package/dist/admin/src/components/AssetGridList/AssetGridList.d.ts +13 -0
  39. package/dist/admin/src/components/AssetGridList/Draggable.d.ts +9 -0
  40. package/dist/admin/src/components/Breadcrumbs/Breadcrumbs.d.ts +14 -0
  41. package/dist/admin/src/components/Breadcrumbs/CrumbSimpleMenuAsync.d.ts +7 -0
  42. package/dist/admin/src/components/BulkMoveDialog/BulkMoveDialog.d.ts +15 -0
  43. package/dist/admin/src/components/ContextInfo/ContextInfo.d.ts +8 -0
  44. package/dist/admin/src/components/CopyLinkButton/CopyLinkButton.d.ts +3 -0
  45. package/dist/admin/src/components/EditAssetDialog/DialogHeader.d.ts +1 -0
  46. package/dist/admin/src/components/EditAssetDialog/EditAssetContent.d.ts +28 -0
  47. package/dist/admin/src/components/EditAssetDialog/PreviewBox/AssetPreview.d.ts +9 -0
  48. package/dist/admin/src/components/EditAssetDialog/PreviewBox/CroppingActions.d.ts +7 -0
  49. package/dist/admin/src/components/EditAssetDialog/PreviewBox/PreviewBox.d.ts +23 -0
  50. package/dist/admin/src/components/EditAssetDialog/PreviewBox/PreviewComponents.d.ts +17 -0
  51. package/dist/admin/src/components/EditAssetDialog/RemoveAssetDialog.d.ts +8 -0
  52. package/dist/admin/src/components/EditAssetDialog/ReplaceMediaButton.d.ts +8 -0
  53. package/dist/admin/src/components/EditFolderDialog/EditFolderDialog.d.ts +12 -0
  54. package/dist/admin/src/components/EditFolderDialog/ModalHeader/ModalHeader.d.ts +5 -0
  55. package/dist/admin/src/components/EditFolderDialog/RemoveFolderDialog.d.ts +7 -0
  56. package/dist/admin/src/components/EmptyAssets/EmptyAssetGrid.d.ts +6 -0
  57. package/dist/admin/src/components/EmptyAssets/EmptyAssets.d.ts +10 -0
  58. package/dist/admin/src/components/FilterList/FilterList.d.ts +33 -0
  59. package/dist/admin/src/components/FilterList/FilterTag.d.ts +23 -0
  60. package/dist/admin/src/components/FilterPopover/FilterPopover.d.ts +31 -0
  61. package/dist/admin/src/components/FilterPopover/FilterValueInput.d.ts +12 -0
  62. package/dist/admin/src/components/FilterPopover/utils/getFilterList.d.ts +21 -0
  63. package/dist/admin/src/components/FolderCard/FolderCard/FolderCard.d.ts +13 -0
  64. package/dist/admin/src/components/FolderCard/FolderCardBody/FolderCardBody.d.ts +2 -0
  65. package/dist/admin/src/components/FolderCard/FolderCardBodyAction/FolderCardBodyAction.d.ts +7 -0
  66. package/dist/admin/src/components/FolderCard/FolderCardCheckbox/FolderCardCheckbox.d.ts +2 -0
  67. package/dist/admin/src/components/FolderCard/contexts/FolderCard.d.ts +7 -0
  68. package/dist/admin/src/components/FolderGridList/FolderGridList.d.ts +6 -0
  69. package/dist/admin/src/components/MediaLibraryDialog/MediaLibraryDialog.d.ts +8 -0
  70. package/dist/admin/src/components/MediaLibraryInput/Carousel/CarouselAsset.d.ts +4 -0
  71. package/dist/admin/src/components/MediaLibraryInput/Carousel/CarouselAssetActions.d.ts +9 -0
  72. package/dist/admin/src/components/MediaLibraryInput/Carousel/CarouselAssets.d.ts +22 -0
  73. package/dist/admin/src/components/MediaLibraryInput/Carousel/EmptyStateAsset.d.ts +10 -0
  74. package/dist/admin/src/components/MediaLibraryInput/MediaLibraryInput.d.ts +17 -0
  75. package/dist/admin/src/components/SelectTree/Option.d.ts +16 -0
  76. package/dist/admin/src/components/SelectTree/SelectTree.d.ts +22 -0
  77. package/dist/admin/src/components/SelectTree/utils/flattenTree.d.ts +1 -1
  78. package/dist/admin/src/components/SelectTree/utils/getOpenValues.d.ts +9 -0
  79. package/dist/admin/src/components/SelectTree/utils/getValuesToClose.d.ts +6 -0
  80. package/dist/admin/src/components/SortPicker/SortPicker.d.ts +7 -0
  81. package/dist/admin/src/components/TableList/CellContent.d.ts +8 -0
  82. package/dist/admin/src/components/TableList/PreviewCell.d.ts +7 -0
  83. package/dist/admin/src/components/TableList/TableList.d.ts +31 -0
  84. package/dist/admin/src/components/TableList/TableRows.d.ts +22 -0
  85. package/dist/admin/src/components/UploadAssetDialog/AddAssetStep/AddAssetStep.d.ts +13 -0
  86. package/dist/admin/src/components/UploadAssetDialog/AddAssetStep/FromComputerForm.d.ts +8 -0
  87. package/dist/admin/src/components/UploadAssetDialog/AddAssetStep/FromUrlForm.d.ts +8 -0
  88. package/dist/admin/src/components/UploadAssetDialog/PendingAssetStep/PendingAssetStep.d.ts +22 -0
  89. package/dist/admin/src/components/UploadAssetDialog/UploadAssetDialog.d.ts +21 -0
  90. package/dist/admin/src/components/UploadProgress/UploadProgress.d.ts +7 -0
  91. package/dist/admin/src/{newConstants.d.ts → constants.d.ts} +25 -0
  92. package/dist/admin/src/hooks/useBulkMove.d.ts +5 -5
  93. package/dist/admin/src/hooks/useBulkRemove.d.ts +17 -20
  94. package/dist/admin/src/hooks/useFolder.d.ts +1 -1
  95. package/dist/admin/src/hooks/useFolderStructure.d.ts +7 -1
  96. package/dist/admin/src/hooks/useMediaLibraryPermissions.d.ts +5 -1
  97. package/dist/admin/src/hooks/useModalQueryParams.d.ts +2 -3
  98. package/dist/admin/src/hooks/useSelectionState.d.ts +1 -1
  99. package/dist/admin/src/hooks/useUpload.d.ts +6 -3
  100. package/dist/admin/src/index.d.ts +3 -0
  101. package/dist/admin/src/pages/App/App.d.ts +1 -0
  102. package/dist/admin/src/pages/App/ConfigureTheView/ConfigureTheView.d.ts +6 -0
  103. package/dist/admin/src/pages/App/ConfigureTheView/components/Settings.d.ts +13 -0
  104. package/dist/admin/src/pages/App/ConfigureTheView/state/actionTypes.d.ts +2 -0
  105. package/dist/admin/src/pages/App/ConfigureTheView/state/actions.d.ts +12 -0
  106. package/dist/admin/src/pages/App/ConfigureTheView/state/init.d.ts +8 -0
  107. package/dist/admin/src/pages/App/ConfigureTheView/state/reducer.d.ts +15 -0
  108. package/dist/admin/src/pages/App/MediaLibrary/MediaLibrary.d.ts +1 -0
  109. package/dist/admin/src/pages/App/MediaLibrary/components/BulkActions.d.ts +15 -0
  110. package/dist/admin/src/pages/App/MediaLibrary/components/BulkDeleteButton.d.ts +7 -0
  111. package/dist/admin/src/pages/App/MediaLibrary/components/BulkMoveButton.d.ts +15 -0
  112. package/dist/admin/src/pages/App/MediaLibrary/components/EmptyOrNoPermissions.d.ts +7 -0
  113. package/dist/admin/src/pages/App/MediaLibrary/components/Filters.d.ts +1 -0
  114. package/dist/admin/src/pages/App/MediaLibrary/components/Header.d.ts +22 -0
  115. package/dist/admin/src/pages/App/components/BulkActions.d.ts +15 -0
  116. package/dist/admin/src/pages/App/components/BulkDeleteButton.d.ts +10 -0
  117. package/dist/admin/src/pages/App/components/BulkMoveButton.d.ts +15 -0
  118. package/dist/admin/src/pages/App/components/EmptyOrNoPermissions.d.ts +8 -0
  119. package/dist/admin/src/pages/App/components/Filters.d.ts +1 -0
  120. package/dist/admin/src/pages/App/components/Header.d.ts +13 -0
  121. package/dist/admin/src/pages/SettingsPage/SettingsPage.d.ts +2 -0
  122. package/dist/admin/src/pages/SettingsPage/init.d.ts +2 -0
  123. package/dist/admin/src/pages/SettingsPage/reducer.d.ts +27 -0
  124. package/dist/admin/src/pluginId.d.ts +0 -1
  125. package/dist/admin/src/utils/findRecursiveFolderByValue.d.ts +3 -2
  126. package/dist/admin/src/utils/getAllowedFiles.d.ts +1 -2
  127. package/dist/admin/src/utils/getBreadcrumbDataCM.d.ts +1 -1
  128. package/dist/admin/src/utils/getBreadcrumbDataML.d.ts +1 -1
  129. package/dist/admin/src/utils/getFolderParents.d.ts +4 -3
  130. package/dist/admin/src/utils/moveElement.d.ts +1 -1
  131. package/dist/admin/src/utils/rawFileToAsset.d.ts +2 -2
  132. package/dist/admin/src/utils/toSingularTypes.d.ts +0 -1
  133. package/dist/admin/src/utils/typeFromMime.d.ts +1 -1
  134. package/dist/admin/src/utils/urlsToAssets.d.ts +3 -3
  135. package/dist/shared/contracts/files.d.ts +10 -6
  136. package/dist/shared/contracts/folders.d.ts +23 -2
  137. package/dist/shared/contracts/settings.d.ts +3 -2
  138. package/package.json +10 -10
  139. package/dist/_chunks/index-BHcSb0I3.js.map +0 -1
  140. package/dist/_chunks/index-Bi33Km2i.mjs.map +0 -1
  141. package/dist/_chunks/index-BjvAmZvH.mjs.map +0 -1
  142. package/dist/_chunks/index-D7YMYvKK.js.map +0 -1
  143. package/dist/_chunks/index-DlRn6eNH.js.map +0 -1
  144. package/dist/_chunks/index-GpFGwMho.mjs.map +0 -1
  145. package/dist/_chunks/index-KSVkjErL.mjs.map +0 -1
  146. package/dist/_chunks/index-l4hbqJYu.js.map +0 -1
  147. /package/dist/admin/src/hooks/utils/{rename-keys.d.ts → renameKeys.d.ts} +0 -0
@@ -1,12 +1,18 @@
1
1
  import { FolderNode } from '../../../shared/contracts/folders';
2
+ interface FolderNodeWithChildren extends Omit<FolderNode, 'children'> {
3
+ children: FolderNodeWithChildren[];
4
+ label?: string;
5
+ value: string | number | null;
6
+ }
2
7
  export declare const useFolderStructure: ({ enabled }?: {
3
8
  enabled?: boolean | undefined;
4
9
  }) => {
5
10
  data: {
6
11
  value: null;
7
12
  label: string;
8
- children: import("./utils/rename-keys").DeepRecord<FolderNode>[];
13
+ children: import("./utils/renameKeys").DeepRecord<FolderNodeWithChildren>[];
9
14
  }[] | undefined;
10
15
  error: unknown;
11
16
  isLoading: boolean;
12
17
  };
18
+ export {};
@@ -1,3 +1,7 @@
1
- export declare const useMediaLibraryPermissions: () => {
1
+ import { useRBAC } from '@strapi/admin/strapi-admin';
2
+ type UseRBACReturnType = ReturnType<typeof useRBAC>;
3
+ type AllowedActionsType = UseRBACReturnType['allowedActions'];
4
+ export declare const useMediaLibraryPermissions: () => AllowedActionsType & {
2
5
  isLoading: boolean;
3
6
  };
7
+ export {};
@@ -1,5 +1,5 @@
1
1
  import type { Query, FilterCondition } from '../../../shared/contracts/files';
2
- declare const useModalQueryParams: (initialState?: Partial<Query>) => ({
2
+ export declare const useModalQueryParams: (initialState?: Partial<Query>) => ({
3
3
  queryObject: Query;
4
4
  rawQuery: string;
5
5
  onChangeFilters?: undefined;
@@ -14,8 +14,7 @@ declare const useModalQueryParams: (initialState?: Partial<Query>) => ({
14
14
  onChangePage: (page: Query['page']) => void;
15
15
  onChangePageSize: (pageSize: Query['pageSize']) => void;
16
16
  onChangeSort: (sort: Query['sort']) => void;
17
- onChangeSearch: (_q: Query['_q']) => void;
17
+ onChangeSearch: (_q: Query['_q'] | null) => void;
18
18
  queryObject?: undefined;
19
19
  rawQuery?: undefined;
20
20
  })[];
21
- export default useModalQueryParams;
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  export declare const useSelectionState: <TValues extends object>(keys: Array<keyof TValues>, initialValue: TValues[]) => readonly [TValues[], {
3
3
  readonly selectOne: (selection: TValues) => void;
4
- readonly selectAll: (nextSelections: TValues[]) => void;
4
+ readonly selectAll: (nextSelections?: TValues[]) => void;
5
5
  readonly selectOnly: (nextSelection: TValues) => void;
6
6
  readonly selectMultiple: (nextSelections: TValues[]) => void;
7
7
  readonly deselectMultiple: (nextSelections: TValues[]) => void;
@@ -1,9 +1,12 @@
1
1
  import { File, RawFile } from '../../../shared/contracts/files';
2
- interface Asset extends File {
3
- rawFile: RawFile;
2
+ interface Asset extends Omit<File, 'id' | 'hash'> {
3
+ rawFile?: RawFile;
4
+ id?: File['id'];
5
+ hash?: File['hash'];
4
6
  }
5
7
  export declare const useUpload: () => {
6
- upload: (asset: Asset, folderId: number) => Promise<File[]>;
8
+ upload: (asset: Asset, folderId: number | null) => Promise<File[]>;
9
+ isLoading: boolean;
7
10
  cancel: () => void;
8
11
  error: import("@strapi/utils/dist/errors").ApplicationError<"ApplicationError", string, unknown> | import("@strapi/utils/dist/errors").ValidationError<string, unknown> | null | undefined;
9
12
  progress: number;
@@ -0,0 +1,3 @@
1
+ import type { Plugin } from '@strapi/types';
2
+ declare const admin: Plugin.Config.AdminInput;
3
+ export default admin;
@@ -0,0 +1 @@
1
+ export declare const Upload: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { Configuration } from '../../../../../shared/contracts/configuration';
2
+ interface ConfigureTheViewProps {
3
+ config: Configuration;
4
+ }
5
+ export declare const ConfigureTheView: ({ config }: ConfigureTheViewProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,13 @@
1
+ import type { Configuration } from '../../../../../../shared/contracts/configuration';
2
+ interface SettingsProps {
3
+ sort: string;
4
+ pageSize: string | number;
5
+ onChange: ({ target: { name, value }, }: {
6
+ target: {
7
+ name: keyof Configuration;
8
+ value: string | number;
9
+ };
10
+ }) => void;
11
+ }
12
+ declare const Settings: ({ sort, pageSize, onChange }: SettingsProps) => import("react/jsx-runtime").JSX.Element;
13
+ export { Settings };
@@ -0,0 +1,2 @@
1
+ export declare const ON_CHANGE: string;
2
+ export declare const SET_LOADED: string;
@@ -0,0 +1,12 @@
1
+ import type { InitialState } from './init';
2
+ export declare const onChange: ({ name, value, }: {
3
+ name: keyof NonNullable<InitialState['initialData']>;
4
+ value: number | string;
5
+ }) => {
6
+ type: string;
7
+ keys: keyof import("../../../../../../shared/contracts/configuration").Configuration;
8
+ value: string | number;
9
+ };
10
+ export declare const setLoaded: () => {
11
+ type: string;
12
+ };
@@ -0,0 +1,8 @@
1
+ import type { Configuration } from '../../../../../../shared/contracts/configuration';
2
+ export type InitialState = {
3
+ initialData: Partial<Configuration>;
4
+ modifiedData: Partial<Configuration>;
5
+ };
6
+ declare const initialState: InitialState;
7
+ declare const init: (configData: InitialState['initialData']) => InitialState;
8
+ export { init, initialState };
@@ -0,0 +1,15 @@
1
+ import type { InitialState } from './init';
2
+ export interface ActionOnChange {
3
+ type: string;
4
+ keys?: string;
5
+ value: string | number;
6
+ }
7
+ export interface ActionSetLoaded {
8
+ type: string;
9
+ }
10
+ interface ActionInitialValue {
11
+ type: string;
12
+ }
13
+ export type Action = ActionSetLoaded | ActionOnChange | ActionInitialValue;
14
+ export declare const reducer: (state?: InitialState, action?: Action) => InitialState;
15
+ export {};
@@ -0,0 +1 @@
1
+ export declare const MediaLibrary: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ import type { File } from '../../../../../../shared/contracts/files';
2
+ import type { FolderDefinition, Folder as FolderInitial } from '../../../../../../shared/contracts/folders';
3
+ interface FolderWithType extends FolderInitial {
4
+ type: string;
5
+ }
6
+ export interface FileWithType extends File {
7
+ type: string;
8
+ }
9
+ export interface BulkActionsProps {
10
+ selected: Array<FileWithType | FolderDefinition> | Array<FolderWithType | FileWithType>;
11
+ onSuccess: () => void;
12
+ currentFolder?: FolderWithType;
13
+ }
14
+ export declare const BulkActions: ({ selected, onSuccess, currentFolder }: BulkActionsProps) => import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { FolderDefinition } from '../../../../../../shared/contracts/folders';
2
+ import type { FileWithType } from '../../../../hooks/useBulkRemove';
3
+ export interface BulkDeleteButtonProps {
4
+ selected: Array<FileWithType | FolderDefinition>;
5
+ onSuccess: () => void;
6
+ }
7
+ export declare const BulkDeleteButton: ({ selected, onSuccess }: BulkDeleteButtonProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ import type { File } from '../../../../../../shared/contracts/files';
2
+ import type { Folder as FolderDefinition } from '../../../../../../shared/contracts/folders';
3
+ interface FolderWithType extends FolderDefinition {
4
+ type: string;
5
+ }
6
+ interface FileWithType extends File {
7
+ type: string;
8
+ }
9
+ export interface BulkMoveButtonProps {
10
+ onSuccess: () => void;
11
+ currentFolder?: FolderWithType;
12
+ selected?: Array<FolderWithType | FileWithType>;
13
+ }
14
+ export declare const BulkMoveButton: ({ selected, onSuccess, currentFolder, }: BulkMoveButtonProps) => import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -0,0 +1,7 @@
1
+ export interface EmptyOrNoPermissionsProps {
2
+ canCreate: boolean;
3
+ canRead: boolean;
4
+ isFiltering: boolean;
5
+ onActionClick: () => void;
6
+ }
7
+ export declare const EmptyOrNoPermissions: ({ canCreate, isFiltering, canRead, onActionClick, }: EmptyOrNoPermissionsProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const Filters: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,22 @@
1
+ import type { Folder } from '../../../../../../shared/contracts/folders';
2
+ import type { CrumbDefinition } from '../../../../components/Breadcrumbs/Breadcrumbs';
3
+ interface FolderDefinition extends Omit<Folder, 'children' | 'files' | 'parent'> {
4
+ children: {
5
+ count: number;
6
+ };
7
+ files: {
8
+ count: number;
9
+ };
10
+ parent?: FolderDefinition;
11
+ }
12
+ export interface HeaderProps {
13
+ breadcrumbs?: Array<CrumbDefinition> | null;
14
+ canCreate: boolean;
15
+ folder?: FolderDefinition | null;
16
+ onToggleEditFolderDialog: ({ created }?: {
17
+ created?: boolean;
18
+ }) => void;
19
+ onToggleUploadAssetDialog: () => void;
20
+ }
21
+ export declare const Header: ({ breadcrumbs, canCreate, folder, onToggleEditFolderDialog, onToggleUploadAssetDialog, }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
22
+ export {};
@@ -0,0 +1,15 @@
1
+ import type { File } from '../../../../../shared/contracts/files';
2
+ import type { FolderDefinition, Folder as FolderInitial } from '../../../../../shared/contracts/folders';
3
+ interface FolderWithType extends FolderInitial {
4
+ type: string;
5
+ }
6
+ export interface FileWithType extends File {
7
+ type: string;
8
+ }
9
+ interface BulkActionsProps {
10
+ selected: Array<FileWithType | FolderDefinition> | Array<FolderWithType | FileWithType>;
11
+ onSuccess: () => void;
12
+ currentFolder?: FolderWithType;
13
+ }
14
+ export declare const BulkActions: ({ selected, onSuccess, currentFolder }: BulkActionsProps) => import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { File } from '../../../../../shared/contracts/files';
2
+ import type { FolderDefinition } from '../../../../../shared/contracts/folders';
3
+ export interface FileWithType extends File {
4
+ type: string;
5
+ }
6
+ export interface BulkDeleteButtonProps {
7
+ selected: Array<FileWithType | FolderDefinition>;
8
+ onSuccess: () => void;
9
+ }
10
+ export declare const BulkDeleteButton: ({ selected, onSuccess }: BulkDeleteButtonProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ import type { File } from '../../../../../shared/contracts/files';
2
+ import type { Folder as FolderDefinition } from '../../../../../shared/contracts/folders';
3
+ interface FileWithType extends File {
4
+ type: string;
5
+ }
6
+ interface FolderWithType extends FolderDefinition {
7
+ type: string;
8
+ }
9
+ export interface BulkMoveButtonProps {
10
+ onSuccess: () => void;
11
+ currentFolder?: FolderWithType;
12
+ selected: Array<FolderWithType | FileWithType>;
13
+ }
14
+ export declare const BulkMoveButton: ({ selected, onSuccess, currentFolder }: BulkMoveButtonProps) => import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -0,0 +1,8 @@
1
+ interface EmptyOrNoPermissionsProps {
2
+ canCreate: boolean;
3
+ canRead: boolean;
4
+ isFiltering: boolean;
5
+ onActionClick: () => void;
6
+ }
7
+ export declare const EmptyOrNoPermissions: ({ canCreate, isFiltering, canRead, onActionClick, }: EmptyOrNoPermissionsProps) => import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1 @@
1
+ export declare const Filters: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import type { Folder } from '../../../../../shared/contracts/folders';
2
+ import type { CrumbDefinition } from '../../../components/Breadcrumbs/Breadcrumbs';
3
+ interface HeaderProps {
4
+ breadcrumbs?: Array<CrumbDefinition> | null;
5
+ canCreate: boolean;
6
+ folder?: Folder | null;
7
+ onToggleEditFolderDialog: ({ created }?: {
8
+ created?: boolean;
9
+ }) => void;
10
+ onToggleUploadAssetDialog: () => void;
11
+ }
12
+ export declare const Header: ({ breadcrumbs, canCreate, folder, onToggleEditFolderDialog, onToggleUploadAssetDialog, }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare const SettingsPage: () => import("react/jsx-runtime").JSX.Element;
2
+ export declare const ProtectedSettingsPage: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { InitialState } from './reducer';
2
+ export declare const init: (initialState: InitialState) => InitialState;
@@ -0,0 +1,27 @@
1
+ export type InitialState = {
2
+ initialData: {
3
+ responsiveDimensions?: boolean;
4
+ sizeOptimization?: boolean;
5
+ autoOrientation?: boolean;
6
+ videoPreview?: boolean;
7
+ } | null;
8
+ modifiedData: {
9
+ responsiveDimensions?: boolean;
10
+ sizeOptimization?: boolean;
11
+ autoOrientation?: boolean;
12
+ videoPreview?: boolean;
13
+ } | null;
14
+ };
15
+ interface ActionGetDataSucceeded {
16
+ type: 'GET_DATA_SUCCEEDED';
17
+ data: InitialState['initialData'];
18
+ }
19
+ interface ActionOnChange {
20
+ type: 'ON_CHANGE';
21
+ keys: keyof NonNullable<InitialState['initialData']>;
22
+ value: boolean;
23
+ }
24
+ export type Action = ActionGetDataSucceeded | ActionOnChange;
25
+ declare const initialState: InitialState;
26
+ declare const reducer: (state: InitialState, action: Action) => InitialState;
27
+ export { initialState, reducer };
@@ -1,2 +1 @@
1
1
  export declare const pluginId: string;
2
- export default pluginId;
@@ -1,10 +1,11 @@
1
1
  import type { FolderNode } from '../../../shared/contracts/folders';
2
2
  interface FolderStructureValue extends Omit<FolderNode, 'children'> {
3
- value: number | null;
3
+ value?: string | number | null;
4
4
  children?: FolderStructureValue[];
5
+ label?: string;
5
6
  }
6
7
  type Value = number | null | {
7
8
  value: number | null;
8
9
  };
9
- export declare function findRecursiveFolderByValue(data: FolderStructureValue[], value: Value): undefined;
10
+ export declare function findRecursiveFolderByValue(data: FolderStructureValue[], value: Value): FolderStructureValue | undefined;
10
11
  export {};
@@ -5,11 +5,10 @@ import type { File } from '../../../shared/contracts/files';
5
5
  * @param {Object[]} files Array of files
6
6
  * @returns Object[]
7
7
  */
8
- interface AllowedFiles extends File {
8
+ export interface AllowedFiles extends File {
9
9
  documentId: string;
10
10
  isSelectable: boolean;
11
11
  locale: string | null;
12
12
  type: string;
13
13
  }
14
14
  export declare const getAllowedFiles: (pluralTypes: string[], files: AllowedFiles[]) => AllowedFiles[];
15
- export {};
@@ -1,6 +1,6 @@
1
1
  import type { Folder } from '../../../shared/contracts/folders';
2
2
  import type { MessageDescriptor } from 'react-intl';
3
- interface BreadcrumbDataFolder extends Omit<Folder, 'children' | 'files' | 'parent'> {
3
+ export interface BreadcrumbDataFolder extends Omit<Folder, 'children' | 'files' | 'parent'> {
4
4
  parent?: BreadcrumbDataFolder;
5
5
  children?: {
6
6
  count: number;
@@ -15,4 +15,4 @@ interface GetBreadcrumbDataMLReturn {
15
15
  }
16
16
  type BreadcrumbData = GetBreadcrumbDataMLReturn | [];
17
17
  export declare const getBreadcrumbDataML: (folder: GetBreadcrumbDataMLProps['folder'] | null, { pathname, query }: GetBreadcrumbDataMLProps['options']) => BreadcrumbData[];
18
- export default getBreadcrumbDataML;
18
+ export {};
@@ -1,10 +1,11 @@
1
1
  import type { FolderNode } from '../../../shared/contracts/folders';
2
2
  interface FolderStructureValue extends Omit<FolderNode, 'children'> {
3
- value: number | null;
3
+ value: string | number | null;
4
4
  children?: FolderStructureValue[];
5
5
  }
6
6
  export declare const getFolderParents: (folders: FolderStructureValue[], currentFolderId: number) => {
7
- id: number | null | undefined;
8
- label: string | undefined;
7
+ id?: string | number | null | undefined;
8
+ label?: string | undefined;
9
+ path?: string | undefined;
9
10
  }[];
10
11
  export {};
@@ -1 +1 @@
1
- export declare const moveElement: (array: number[], index: number, offset: number) => number[];
1
+ export declare const moveElement: <T = number>(array: T[], index: number, offset: number) => T[];
@@ -1,11 +1,11 @@
1
- import { AssetSource } from '../newConstants';
1
+ import { AssetSource } from '../constants';
2
2
  import type { RawFile } from '../../../shared/contracts/files';
3
3
  export declare const rawFileToAsset: (rawFile: RawFile, assetSource: AssetSource) => {
4
4
  size: number;
5
5
  createdAt: string;
6
6
  name: string;
7
7
  source: AssetSource;
8
- type: import("../newConstants").AssetType;
8
+ type: import("../constants").AssetType;
9
9
  url: string;
10
10
  ext: string | undefined;
11
11
  mime: string;
@@ -1,2 +1 @@
1
1
  export declare const toSingularTypes: (types?: string[]) => string[];
2
- export default toSingularTypes;
@@ -1,2 +1,2 @@
1
- import { AssetType } from '../newConstants';
1
+ import { AssetType } from '../constants';
2
2
  export declare const typeFromMime: (mime: string) => AssetType;
@@ -1,10 +1,10 @@
1
- import { AssetSource } from '../newConstants';
1
+ import { AssetSource } from '../constants';
2
2
  export declare const urlsToAssets: (urls: string[]) => Promise<{
3
3
  source: AssetSource;
4
4
  name: string;
5
- type: import("../newConstants").AssetType;
5
+ type: import("../constants").AssetType;
6
6
  url: string;
7
7
  ext: string | undefined;
8
- mime: string | null;
8
+ mime: string | undefined;
9
9
  rawFile: File;
10
10
  }[]>;
@@ -44,21 +44,25 @@ export interface File {
44
44
  name: string;
45
45
  alternativeText?: string | null;
46
46
  caption?: string | null;
47
- width?: number;
48
- height?: number;
49
- formats?: Record<string, FileFormat>;
47
+ width?: number | null;
48
+ height?: number | null;
49
+ formats?: Record<string, FileFormat> | {
50
+ thumbnail: {
51
+ url: string;
52
+ };
53
+ } | null;
50
54
  hash: string;
51
55
  ext?: string;
52
56
  mime?: string;
53
57
  size?: number;
54
58
  sizeInBytes?: number;
55
59
  url?: string;
56
- previewUrl?: string;
60
+ previewUrl?: string | null;
57
61
  path?: string | null;
58
62
  provider?: string;
59
- provider_metadata?: Record<string, unknown>;
63
+ provider_metadata?: Record<string, unknown> | null;
60
64
  isUrlSigned?: boolean;
61
- folder?: number | null;
65
+ folder?: number | string | null;
62
66
  folderPath?: string;
63
67
  related?: {
64
68
  id: string | number;
@@ -2,6 +2,22 @@ import { errors } from '@strapi/utils';
2
2
  export type SortOrder = 'ASC' | 'DESC';
3
3
  export type SortKey = 'createdAt' | 'name' | 'updatedAt';
4
4
  import type { File } from './files';
5
+ export interface FolderDefinition extends Omit<Folder, 'children' | 'files' | 'parent'> {
6
+ children?: {
7
+ count: number;
8
+ };
9
+ createdAt?: string;
10
+ documentId?: string;
11
+ files?: {
12
+ count: number;
13
+ };
14
+ folderUrl?: string;
15
+ isSelectable?: boolean;
16
+ locale?: string | null;
17
+ publishedAt?: string;
18
+ type: string;
19
+ updatedAt?: string;
20
+ }
5
21
  export interface Folder {
6
22
  id: number;
7
23
  name: string;
@@ -20,6 +36,10 @@ export interface Folder {
20
36
  export type FolderNode = Partial<Omit<Folder, 'children'>> & {
21
37
  children: FolderNode[];
22
38
  };
39
+ type FolderNodeWithValue = Omit<FolderNode, 'children'> & {
40
+ value: string | number | null;
41
+ children: FolderNodeWithValue[];
42
+ };
23
43
  /**
24
44
  * GET /upload/folders/:id - Get specific folder
25
45
  */
@@ -94,7 +114,7 @@ export declare namespace GetFolderStructure {
94
114
  }
95
115
  interface Response {
96
116
  data: {
97
- data: number[] & FolderNode[];
117
+ data: number[] & FolderNodeWithValue[];
98
118
  };
99
119
  error?: errors.ApplicationError | errors.NotFoundError;
100
120
  }
@@ -112,7 +132,7 @@ export declare namespace BulkDeleteFolders {
112
132
  data: {
113
133
  data: {
114
134
  files: [];
115
- folders: Folder[];
135
+ folders: FolderDefinition[];
116
136
  };
117
137
  };
118
138
  error?: errors.ApplicationError | errors.ValidationError;
@@ -138,3 +158,4 @@ export declare namespace BulkMoveFolders {
138
158
  error?: errors.ApplicationError | errors.ValidationError;
139
159
  }
140
160
  }
161
+ export {};
@@ -6,9 +6,10 @@ import { errors } from '@strapi/utils';
6
6
  import { Utils } from '@strapi/types';
7
7
  export interface Settings {
8
8
  data: {
9
- sizeOptimization: boolean;
10
- responsiveDimensions: boolean;
9
+ sizeOptimization?: boolean;
10
+ responsiveDimensions?: boolean;
11
11
  autoOrientation?: boolean;
12
+ videoPreview?: boolean;
12
13
  };
13
14
  }
14
15
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/upload",
3
- "version": "5.2.0",
3
+ "version": "5.4.0",
4
4
  "description": "Makes it easy to upload images and files to your Strapi Application.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": {
@@ -18,7 +18,7 @@
18
18
  "exports": {
19
19
  "./strapi-admin": {
20
20
  "types": "./dist/admin/src/index.d.ts",
21
- "source": "./admin/src/index.js",
21
+ "source": "./admin/src/index.ts",
22
22
  "import": "./dist/admin/index.mjs",
23
23
  "require": "./dist/admin/index.js",
24
24
  "default": "./dist/admin/index.js"
@@ -56,10 +56,10 @@
56
56
  "watch": "pack-up watch"
57
57
  },
58
58
  "dependencies": {
59
- "@strapi/design-system": "2.0.0-rc.11",
60
- "@strapi/icons": "2.0.0-rc.11",
61
- "@strapi/provider-upload-local": "5.2.0",
62
- "@strapi/utils": "5.2.0",
59
+ "@strapi/design-system": "2.0.0-rc.12",
60
+ "@strapi/icons": "2.0.0-rc.12",
61
+ "@strapi/provider-upload-local": "5.4.0",
62
+ "@strapi/utils": "5.4.0",
63
63
  "byte-size": "8.1.1",
64
64
  "cropperjs": "1.6.1",
65
65
  "date-fns": "2.30.0",
@@ -81,9 +81,9 @@
81
81
  "yup": "0.32.9"
82
82
  },
83
83
  "devDependencies": {
84
- "@strapi/admin": "5.2.0",
84
+ "@strapi/admin": "5.4.0",
85
85
  "@strapi/pack-up": "5.0.0",
86
- "@strapi/types": "5.2.0",
86
+ "@strapi/types": "5.4.0",
87
87
  "@testing-library/dom": "10.1.0",
88
88
  "@testing-library/react": "15.0.7",
89
89
  "@testing-library/user-event": "14.5.2",
@@ -102,7 +102,7 @@
102
102
  "styled-components": "6.1.8"
103
103
  },
104
104
  "peerDependencies": {
105
- "@strapi/admin": "^5.0.0 || ^5.0.0-beta || ^5.0.0-alpha || ^5.0.0-rc",
105
+ "@strapi/admin": "^5.0.0",
106
106
  "react": "^17.0.0 || ^18.0.0",
107
107
  "react-dom": "^17.0.0 || ^18.0.0",
108
108
  "react-router-dom": "^6.0.0",
@@ -119,5 +119,5 @@
119
119
  "required": true,
120
120
  "kind": "plugin"
121
121
  },
122
- "gitHead": "c3b3af2ac546ef6c4dab905d9094a12a02060327"
122
+ "gitHead": "186981dd710bedbe48a84bd819f95f9764da61e1"
123
123
  }