@strapi/upload 5.0.0-beta.9 → 5.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +18 -3
- package/dist/_chunks/{graphql-Bj6oo87a.js → graphql-DnH9sdRy.js} +2 -2
- package/dist/_chunks/{graphql-Bj6oo87a.js.map → graphql-DnH9sdRy.js.map} +1 -1
- package/dist/_chunks/{graphql-edcz_5zt.mjs → graphql-_gnSn8ak.mjs} +2 -2
- package/dist/_chunks/{graphql-edcz_5zt.mjs.map → graphql-_gnSn8ak.mjs.map} +1 -1
- package/dist/_chunks/{index-DmPsR26u.mjs → index-12OzcF7r.mjs} +415 -360
- package/dist/_chunks/index-12OzcF7r.mjs.map +1 -0
- package/dist/_chunks/{index-4iUTOybK.mjs → index-Bfk_br9x.mjs} +7 -7
- package/dist/_chunks/index-Bfk_br9x.mjs.map +1 -0
- package/dist/_chunks/{index-GkNHbl9s.js → index-Bht2H-mc.js} +6 -6
- package/dist/_chunks/index-Bht2H-mc.js.map +1 -0
- package/dist/_chunks/{index-XL3Mrkqq.js → index-CPLBfQb2.js} +10 -19
- package/dist/_chunks/index-CPLBfQb2.js.map +1 -0
- package/dist/_chunks/{index-BRMOG3M5.mjs → index-Cc9M3C9k.mjs} +11 -20
- package/dist/_chunks/index-Cc9M3C9k.mjs.map +1 -0
- package/dist/_chunks/{index-Dhpsbqb0.mjs → index-CofwxhyW.mjs} +57 -87
- package/dist/_chunks/index-CofwxhyW.mjs.map +1 -0
- package/dist/_chunks/{index-_XL6OkHu.js → index-DNIvA1Nj.js} +11 -5
- package/dist/_chunks/index-DNIvA1Nj.js.map +1 -0
- package/dist/_chunks/{index-DLpj5yNr.js → index-DxZ4ATkY.js} +414 -359
- package/dist/_chunks/index-DxZ4ATkY.js.map +1 -0
- package/dist/_chunks/{index-BTrpl94p.mjs → index-aW1eiyyQ.mjs} +11 -5
- package/dist/_chunks/index-aW1eiyyQ.mjs.map +1 -0
- package/dist/_chunks/{index-C6Zy6JkX.js → index-oE8jnZsX.js} +73 -85
- package/dist/_chunks/index-oE8jnZsX.js.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/index.mjs +1 -1
- package/dist/server/src/controllers/admin-file.d.ts.map +1 -1
- package/package.json +8 -8
- package/dist/_chunks/index-4iUTOybK.mjs.map +0 -1
- package/dist/_chunks/index-BRMOG3M5.mjs.map +0 -1
- package/dist/_chunks/index-BTrpl94p.mjs.map +0 -1
- package/dist/_chunks/index-C6Zy6JkX.js.map +0 -1
- package/dist/_chunks/index-DLpj5yNr.js.map +0 -1
- package/dist/_chunks/index-Dhpsbqb0.mjs.map +0 -1
- package/dist/_chunks/index-DmPsR26u.mjs.map +0 -1
- package/dist/_chunks/index-GkNHbl9s.js.map +0 -1
- package/dist/_chunks/index-XL3Mrkqq.js.map +0 -1
- package/dist/_chunks/index-_XL6OkHu.js.map +0 -1
|
@@ -4,7 +4,7 @@ import * as React from "react";
|
|
|
4
4
|
import { useEffect, useState, useMemo, useRef, useCallback, forwardRef, createElement, createContext, useContext, useLayoutEffect } from "react";
|
|
5
5
|
import PropTypes from "prop-types";
|
|
6
6
|
import { useNotification, useFetchClient, useRBAC, useTracking, ConfirmDialog, useQueryParams, Layouts, Page, translatedErrors, useField } from "@strapi/admin/strapi-admin";
|
|
7
|
-
import { useNotifyAT, Box, Grid,
|
|
7
|
+
import { useNotifyAT, Box, Grid, Flex, Typography, Modal, IconButton, ProgressBar, Dialog, Badge, Menu, FocusTrap, Button, VisuallyHidden, Loader, Field, TextInput, CardAction, Card as Card$1, CardHeader, CardCheckbox, CardBody, CardContent, CardTitle, CardSubtitle, CardBadge, CardAsset as CardAsset$2, CardTimer, KeyboardNavigable, CrumbSimpleMenu, MenuItem, Breadcrumbs as Breadcrumbs$1, CrumbLink, Crumb, SingleSelect, SingleSelectOption, Avatar, Tbody, Tr, Td, Checkbox, Table, Thead, Th, Tooltip, Tag, DateTimePicker, Popover, SearchForm, Searchbar, Divider, Tabs, Textarea, CarouselActions, CarouselInput, CarouselSlide } from "@strapi/design-system";
|
|
8
8
|
import { useIntl } from "react-intl";
|
|
9
9
|
import { styled, useTheme } from "styled-components";
|
|
10
10
|
import byteSize from "byte-size";
|
|
@@ -32,7 +32,7 @@ const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
34
|
const name$1 = "@strapi/upload";
|
|
35
|
-
const version = "5.0.0-
|
|
35
|
+
const version = "5.0.0-rc.0";
|
|
36
36
|
const description = "Makes it easy to upload images and files to your Strapi Application.";
|
|
37
37
|
const license = "SEE LICENSE IN LICENSE";
|
|
38
38
|
const author = {
|
|
@@ -77,10 +77,10 @@ const scripts = {
|
|
|
77
77
|
watch: "pack-up watch"
|
|
78
78
|
};
|
|
79
79
|
const dependencies = {
|
|
80
|
-
"@strapi/design-system": "2.0.0-beta.
|
|
81
|
-
"@strapi/icons": "2.0.0-beta.
|
|
82
|
-
"@strapi/provider-upload-local": "5.0.0-
|
|
83
|
-
"@strapi/utils": "5.0.0-
|
|
80
|
+
"@strapi/design-system": "2.0.0-beta.6",
|
|
81
|
+
"@strapi/icons": "2.0.0-beta.6",
|
|
82
|
+
"@strapi/provider-upload-local": "5.0.0-rc.0",
|
|
83
|
+
"@strapi/utils": "5.0.0-rc.0",
|
|
84
84
|
"byte-size": "8.1.1",
|
|
85
85
|
cropperjs: "1.6.1",
|
|
86
86
|
"date-fns": "2.30.0",
|
|
@@ -102,9 +102,9 @@ const dependencies = {
|
|
|
102
102
|
yup: "0.32.9"
|
|
103
103
|
};
|
|
104
104
|
const devDependencies = {
|
|
105
|
-
"@strapi/admin": "5.0.0-
|
|
105
|
+
"@strapi/admin": "5.0.0-rc.0",
|
|
106
106
|
"@strapi/pack-up": "5.0.0",
|
|
107
|
-
"@strapi/types": "5.0.0-
|
|
107
|
+
"@strapi/types": "5.0.0-rc.0",
|
|
108
108
|
"@testing-library/dom": "10.1.0",
|
|
109
109
|
"@testing-library/react": "15.0.7",
|
|
110
110
|
"@testing-library/user-event": "14.5.2",
|
|
@@ -353,20 +353,20 @@ const ParentFolderShape = {
|
|
|
353
353
|
};
|
|
354
354
|
ParentFolderShape.parent = PropTypes.shape(ParentFolderShape);
|
|
355
355
|
const FolderShape = {
|
|
356
|
-
id: PropTypes.number
|
|
356
|
+
id: PropTypes.number,
|
|
357
357
|
children: PropTypes.shape({
|
|
358
358
|
count: PropTypes.number.isRequired
|
|
359
359
|
}),
|
|
360
|
-
createdAt: PropTypes.string
|
|
360
|
+
createdAt: PropTypes.string,
|
|
361
361
|
createdBy: PropTypes.shape(),
|
|
362
362
|
files: PropTypes.shape({
|
|
363
363
|
count: PropTypes.number.isRequired
|
|
364
364
|
}),
|
|
365
|
-
name: PropTypes.string
|
|
366
|
-
updatedAt: PropTypes.string
|
|
365
|
+
name: PropTypes.string,
|
|
366
|
+
updatedAt: PropTypes.string,
|
|
367
367
|
updatedBy: PropTypes.shape(),
|
|
368
|
-
pathId: PropTypes.number
|
|
369
|
-
path: PropTypes.string
|
|
368
|
+
pathId: PropTypes.number,
|
|
369
|
+
path: PropTypes.string
|
|
370
370
|
};
|
|
371
371
|
FolderShape.parent = PropTypes.shape(ParentFolderShape);
|
|
372
372
|
const FolderDefinition = PropTypes.shape(FolderShape);
|
|
@@ -971,7 +971,7 @@ const ContextInfo = ({ blocks }) => {
|
|
|
971
971
|
paddingTop: 4,
|
|
972
972
|
paddingBottom: 4,
|
|
973
973
|
background: "neutral100",
|
|
974
|
-
children: /* @__PURE__ */ jsx(Grid, { gap: 4, children: blocks.map(({ label, value }) => /* @__PURE__ */ jsx(
|
|
974
|
+
children: /* @__PURE__ */ jsx(Grid.Root, { gap: 4, children: blocks.map(({ label, value }) => /* @__PURE__ */ jsx(Grid.Item, { col: 6, xs: 12, children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
|
|
975
975
|
/* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", children: label }),
|
|
976
976
|
/* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral700", children: value })
|
|
977
977
|
] }) }, label)) })
|
|
@@ -1214,6 +1214,11 @@ const getSelectStyles = (theme, error) => {
|
|
|
1214
1214
|
color: theme.colors.neutral800,
|
|
1215
1215
|
gridTemplateColumns: "0 100%"
|
|
1216
1216
|
}),
|
|
1217
|
+
menuPortal: (base) => ({
|
|
1218
|
+
...base,
|
|
1219
|
+
zIndex: theme.zIndices.dialog,
|
|
1220
|
+
pointerEvents: "auto"
|
|
1221
|
+
}),
|
|
1217
1222
|
menu(base) {
|
|
1218
1223
|
return {
|
|
1219
1224
|
...base,
|
|
@@ -1235,10 +1240,6 @@ const getSelectStyles = (theme, error) => {
|
|
|
1235
1240
|
paddingRight: theme.spaces[1],
|
|
1236
1241
|
paddingBottom: theme.spaces[1]
|
|
1237
1242
|
}),
|
|
1238
|
-
menuPortal: (base) => ({
|
|
1239
|
-
...base,
|
|
1240
|
-
zIndex: 100
|
|
1241
|
-
}),
|
|
1242
1243
|
option(base, state) {
|
|
1243
1244
|
let backgroundColor = base.backgroundColor;
|
|
1244
1245
|
if (state.isFocused || state.isSelected) {
|
|
@@ -1303,7 +1304,7 @@ SelectTree.propTypes = {
|
|
|
1303
1304
|
};
|
|
1304
1305
|
const DialogHeader = () => {
|
|
1305
1306
|
const { formatMessage } = useIntl();
|
|
1306
|
-
return /* @__PURE__ */ jsx(
|
|
1307
|
+
return /* @__PURE__ */ jsx(Modal.Header, { children: /* @__PURE__ */ jsx(Modal.Title, { children: formatMessage({ id: "global.details", defaultMessage: "Details" }) }) });
|
|
1307
1308
|
};
|
|
1308
1309
|
const QUALITY = 1;
|
|
1309
1310
|
const useCropImg = () => {
|
|
@@ -1561,15 +1562,19 @@ const useRemoveAsset = (onSuccess) => {
|
|
|
1561
1562
|
};
|
|
1562
1563
|
return { ...mutation, removeAsset };
|
|
1563
1564
|
};
|
|
1564
|
-
const RemoveAssetDialog = ({ onClose, asset }) => {
|
|
1565
|
-
const { removeAsset } = useRemoveAsset(() =>
|
|
1566
|
-
|
|
1565
|
+
const RemoveAssetDialog = ({ open, onClose, asset }) => {
|
|
1566
|
+
const { removeAsset } = useRemoveAsset(() => {
|
|
1567
|
+
onClose(null);
|
|
1568
|
+
});
|
|
1569
|
+
const handleConfirm = async (event) => {
|
|
1570
|
+
event.preventDefault();
|
|
1567
1571
|
await removeAsset(asset.id);
|
|
1568
1572
|
};
|
|
1569
|
-
return /* @__PURE__ */ jsx(
|
|
1573
|
+
return /* @__PURE__ */ jsx(Dialog.Root, { open, onOpenChange: onClose, children: /* @__PURE__ */ jsx(ConfirmDialog, { onConfirm: handleConfirm }) });
|
|
1570
1574
|
};
|
|
1571
1575
|
RemoveAssetDialog.propTypes = {
|
|
1572
1576
|
onClose: PropTypes.func.isRequired,
|
|
1577
|
+
open: PropTypes.bool.isRequired,
|
|
1573
1578
|
asset: PropTypes.shape({
|
|
1574
1579
|
id: PropTypes.number,
|
|
1575
1580
|
height: PropTypes.number,
|
|
@@ -1629,7 +1634,8 @@ const RelativeBox = styled(Box)`
|
|
|
1629
1634
|
`;
|
|
1630
1635
|
const Wrapper$1 = styled.div`
|
|
1631
1636
|
position: relative;
|
|
1632
|
-
|
|
1637
|
+
display: flex;
|
|
1638
|
+
justify-content: center;
|
|
1633
1639
|
background: repeating-conic-gradient(
|
|
1634
1640
|
${({ theme }) => theme.colors.neutral100} 0% 25%,
|
|
1635
1641
|
transparent 0% 50%
|
|
@@ -1674,6 +1680,7 @@ const UploadProgressWrapper$1 = styled.div`
|
|
|
1674
1680
|
`;
|
|
1675
1681
|
const CroppingActions = ({ onCancel, onValidate, onDuplicate }) => {
|
|
1676
1682
|
const { formatMessage } = useIntl();
|
|
1683
|
+
const theme = useTheme();
|
|
1677
1684
|
return /* @__PURE__ */ jsx(FocusTrap, { onEscape: onCancel, children: /* @__PURE__ */ jsx(CroppingActionRow, { justifyContent: "flex-end", paddingLeft: 3, paddingRight: 3, children: /* @__PURE__ */ jsxs(Flex, { gap: 1, children: [
|
|
1678
1685
|
/* @__PURE__ */ jsx(
|
|
1679
1686
|
IconButton,
|
|
@@ -1709,7 +1716,7 @@ const CroppingActions = ({ onCancel, onValidate, onDuplicate }) => {
|
|
|
1709
1716
|
)
|
|
1710
1717
|
}
|
|
1711
1718
|
),
|
|
1712
|
-
/* @__PURE__ */ jsxs(Menu.Content, { zIndex:
|
|
1719
|
+
/* @__PURE__ */ jsxs(Menu.Content, { zIndex: theme.zIndices.dialog, children: [
|
|
1713
1720
|
/* @__PURE__ */ jsx(Menu.Item, { onSelect: onValidate, children: formatMessage({
|
|
1714
1721
|
id: getTrad("checkControl.crop-original"),
|
|
1715
1722
|
defaultMessage: "Crop the original asset"
|
|
@@ -1922,9 +1929,10 @@ const PreviewBox = ({
|
|
|
1922
1929
|
}
|
|
1923
1930
|
)
|
|
1924
1931
|
] }),
|
|
1925
|
-
|
|
1932
|
+
/* @__PURE__ */ jsx(
|
|
1926
1933
|
RemoveAssetDialog,
|
|
1927
1934
|
{
|
|
1935
|
+
open: showConfirmDialog,
|
|
1928
1936
|
onClose: () => {
|
|
1929
1937
|
setShowConfirmDialog(false);
|
|
1930
1938
|
onDelete(null);
|
|
@@ -2002,7 +2010,7 @@ const fileInfoSchema = yup.object({
|
|
|
2002
2010
|
caption: yup.string(),
|
|
2003
2011
|
folder: yup.number()
|
|
2004
2012
|
});
|
|
2005
|
-
const
|
|
2013
|
+
const EditAssetContent = ({
|
|
2006
2014
|
onClose,
|
|
2007
2015
|
asset,
|
|
2008
2016
|
canUpdate,
|
|
@@ -2075,18 +2083,13 @@ const EditAssetDialog = ({
|
|
|
2075
2083
|
}
|
|
2076
2084
|
};
|
|
2077
2085
|
if (folderStructureIsLoading) {
|
|
2078
|
-
return /* @__PURE__ */ jsxs(
|
|
2086
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2079
2087
|
/* @__PURE__ */ jsx(DialogHeader, {}),
|
|
2080
2088
|
/* @__PURE__ */ jsx(LoadingBody$1, { minHeight: "60vh", justifyContent: "center", paddingTop: 4, paddingBottom: 4, children: /* @__PURE__ */ jsx(Loader, { children: formatMessage({
|
|
2081
2089
|
id: getTrad("content.isLoading"),
|
|
2082
2090
|
defaultMessage: "Content is loading."
|
|
2083
2091
|
}) }) }),
|
|
2084
|
-
/* @__PURE__ */ jsx(
|
|
2085
|
-
ModalFooter,
|
|
2086
|
-
{
|
|
2087
|
-
startActions: /* @__PURE__ */ jsx(Button, { onClick: () => handleClose(), variant: "tertiary", children: formatMessage({ id: "cancel", defaultMessage: "Cancel" }) })
|
|
2088
|
-
}
|
|
2089
|
-
)
|
|
2092
|
+
/* @__PURE__ */ jsx(Modal.Footer, { children: /* @__PURE__ */ jsx(Button, { onClick: () => handleClose(), variant: "tertiary", children: formatMessage({ id: "cancel", defaultMessage: "Cancel" }) }) })
|
|
2090
2093
|
] });
|
|
2091
2094
|
}
|
|
2092
2095
|
return /* @__PURE__ */ jsx(
|
|
@@ -2096,10 +2099,10 @@ const EditAssetDialog = ({
|
|
|
2096
2099
|
validateOnChange: false,
|
|
2097
2100
|
onSubmit: handleSubmit,
|
|
2098
2101
|
initialValues: initialFormData,
|
|
2099
|
-
children: ({ values, errors, handleChange, setFieldValue }) => /* @__PURE__ */ jsxs(
|
|
2102
|
+
children: ({ values, errors, handleChange, setFieldValue }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2100
2103
|
/* @__PURE__ */ jsx(DialogHeader, {}),
|
|
2101
|
-
/* @__PURE__ */ jsx(
|
|
2102
|
-
/* @__PURE__ */ jsx(
|
|
2104
|
+
/* @__PURE__ */ jsx(Modal.Body, { children: /* @__PURE__ */ jsxs(Grid.Root, { gap: 4, children: [
|
|
2105
|
+
/* @__PURE__ */ jsx(Grid.Item, { xs: 12, col: 6, children: /* @__PURE__ */ jsx(
|
|
2103
2106
|
PreviewBox,
|
|
2104
2107
|
{
|
|
2105
2108
|
asset,
|
|
@@ -2114,7 +2117,7 @@ const EditAssetDialog = ({
|
|
|
2114
2117
|
trackedLocation
|
|
2115
2118
|
}
|
|
2116
2119
|
) }),
|
|
2117
|
-
/* @__PURE__ */ jsx(
|
|
2120
|
+
/* @__PURE__ */ jsx(Grid.Item, { xs: 12, col: 6, children: /* @__PURE__ */ jsxs(Form, { noValidate: true, children: [
|
|
2118
2121
|
/* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 3, children: [
|
|
2119
2122
|
/* @__PURE__ */ jsx(
|
|
2120
2123
|
ContextInfo,
|
|
@@ -2249,44 +2252,64 @@ const EditAssetDialog = ({
|
|
|
2249
2252
|
) })
|
|
2250
2253
|
] }) })
|
|
2251
2254
|
] }) }),
|
|
2252
|
-
/* @__PURE__ */
|
|
2253
|
-
|
|
2254
|
-
{
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
] })
|
|
2276
|
-
}
|
|
2277
|
-
)
|
|
2255
|
+
/* @__PURE__ */ jsxs(Modal.Footer, { children: [
|
|
2256
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => handleClose(values), variant: "tertiary", children: formatMessage({ id: "global.cancel", defaultMessage: "Cancel" }) }),
|
|
2257
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
2258
|
+
/* @__PURE__ */ jsx(
|
|
2259
|
+
ReplaceMediaButton,
|
|
2260
|
+
{
|
|
2261
|
+
onSelectMedia: setReplacementFile,
|
|
2262
|
+
acceptedMime: asset.mime,
|
|
2263
|
+
disabled: formDisabled,
|
|
2264
|
+
trackedLocation
|
|
2265
|
+
}
|
|
2266
|
+
),
|
|
2267
|
+
/* @__PURE__ */ jsx(
|
|
2268
|
+
Button,
|
|
2269
|
+
{
|
|
2270
|
+
onClick: () => submitButtonRef.current.click(),
|
|
2271
|
+
loading: isLoading,
|
|
2272
|
+
disabled: formDisabled,
|
|
2273
|
+
children: formatMessage({ id: "global.finish", defaultMessage: "Finish" })
|
|
2274
|
+
}
|
|
2275
|
+
)
|
|
2276
|
+
] })
|
|
2277
|
+
] })
|
|
2278
2278
|
] })
|
|
2279
2279
|
}
|
|
2280
2280
|
);
|
|
2281
2281
|
};
|
|
2282
|
+
EditAssetContent.defaultProps = {
|
|
2283
|
+
asset: {},
|
|
2284
|
+
trackedLocation: void 0,
|
|
2285
|
+
canUpdate: false,
|
|
2286
|
+
canCopyLink: false,
|
|
2287
|
+
canDownload: false
|
|
2288
|
+
};
|
|
2289
|
+
EditAssetContent.propTypes = {
|
|
2290
|
+
asset: AssetDefinition,
|
|
2291
|
+
canUpdate: PropTypes.bool,
|
|
2292
|
+
canCopyLink: PropTypes.bool,
|
|
2293
|
+
canDownload: PropTypes.bool,
|
|
2294
|
+
onClose: PropTypes.func.isRequired,
|
|
2295
|
+
trackedLocation: PropTypes.string
|
|
2296
|
+
};
|
|
2297
|
+
const EditAssetDialog = ({ open, onClose, ...restProps }) => {
|
|
2298
|
+
return /* @__PURE__ */ jsx(Modal.Root, { open, onOpenChange: onClose, children: /* @__PURE__ */ jsx(Modal.Content, { children: /* @__PURE__ */ jsx(EditAssetContent, { onClose, ...restProps }) }) });
|
|
2299
|
+
};
|
|
2282
2300
|
EditAssetDialog.defaultProps = {
|
|
2283
|
-
|
|
2301
|
+
asset: {},
|
|
2302
|
+
trackedLocation: void 0,
|
|
2303
|
+
canUpdate: false,
|
|
2304
|
+
canCopyLink: false,
|
|
2305
|
+
canDownload: false
|
|
2284
2306
|
};
|
|
2285
2307
|
EditAssetDialog.propTypes = {
|
|
2286
|
-
asset: AssetDefinition
|
|
2287
|
-
canUpdate: PropTypes.bool
|
|
2288
|
-
canCopyLink: PropTypes.bool
|
|
2289
|
-
canDownload: PropTypes.bool
|
|
2308
|
+
asset: AssetDefinition,
|
|
2309
|
+
canUpdate: PropTypes.bool,
|
|
2310
|
+
canCopyLink: PropTypes.bool,
|
|
2311
|
+
canDownload: PropTypes.bool,
|
|
2312
|
+
open: PropTypes.bool.isRequired,
|
|
2290
2313
|
onClose: PropTypes.func.isRequired,
|
|
2291
2314
|
trackedLocation: PropTypes.string
|
|
2292
2315
|
};
|
|
@@ -2353,7 +2376,7 @@ const useEditFolder = () => {
|
|
|
2353
2376
|
};
|
|
2354
2377
|
const EditFolderModalHeader = ({ isEditing }) => {
|
|
2355
2378
|
const { formatMessage } = useIntl();
|
|
2356
|
-
return /* @__PURE__ */ jsx(
|
|
2379
|
+
return /* @__PURE__ */ jsx(Modal.Header, { children: /* @__PURE__ */ jsx(Modal.Title, { children: formatMessage(
|
|
2357
2380
|
isEditing ? {
|
|
2358
2381
|
id: getTrad("modal.folder.edit.title"),
|
|
2359
2382
|
defaultMessage: "Edit folder"
|
|
@@ -2369,11 +2392,12 @@ EditFolderModalHeader.defaultProps = {
|
|
|
2369
2392
|
EditFolderModalHeader.propTypes = {
|
|
2370
2393
|
isEditing: PropTypes.bool
|
|
2371
2394
|
};
|
|
2372
|
-
const RemoveFolderDialog = ({ onClose, onConfirm }) => {
|
|
2373
|
-
return /* @__PURE__ */ jsx(
|
|
2395
|
+
const RemoveFolderDialog = ({ onClose, onConfirm, open }) => {
|
|
2396
|
+
return /* @__PURE__ */ jsx(Dialog.Root, { open, onOpenChange: onClose, children: /* @__PURE__ */ jsx(ConfirmDialog, { onConfirm }) });
|
|
2374
2397
|
};
|
|
2375
2398
|
RemoveFolderDialog.propTypes = {
|
|
2376
2399
|
onClose: PropTypes.func.isRequired,
|
|
2400
|
+
open: PropTypes.bool.isRequired,
|
|
2377
2401
|
onConfirm: PropTypes.func.isRequired
|
|
2378
2402
|
};
|
|
2379
2403
|
const folderSchema = yup.object({
|
|
@@ -2383,7 +2407,7 @@ const folderSchema = yup.object({
|
|
|
2383
2407
|
value: yup.number().nullable(true)
|
|
2384
2408
|
}).nullable(true)
|
|
2385
2409
|
});
|
|
2386
|
-
const
|
|
2410
|
+
const EditFolderContent = ({ onClose, folder, location, parentFolderId }) => {
|
|
2387
2411
|
const { data: folderStructure, isLoading: folderStructureIsLoading } = useFolderStructure({
|
|
2388
2412
|
enabled: true
|
|
2389
2413
|
});
|
|
@@ -2453,15 +2477,15 @@ const EditFolderDialog = ({ onClose, folder, location, parentFolderId }) => {
|
|
|
2453
2477
|
onClose();
|
|
2454
2478
|
};
|
|
2455
2479
|
if (isLoading) {
|
|
2456
|
-
return /* @__PURE__ */ jsxs(
|
|
2480
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2457
2481
|
/* @__PURE__ */ jsx(EditFolderModalHeader, { isEditing }),
|
|
2458
|
-
/* @__PURE__ */ jsx(
|
|
2482
|
+
/* @__PURE__ */ jsx(Modal.Body, { children: /* @__PURE__ */ jsx(Flex, { justifyContent: "center", paddingTop: 4, paddingBottom: 4, children: /* @__PURE__ */ jsx(Loader, { children: formatMessage({
|
|
2459
2483
|
id: getTrad("content.isLoading"),
|
|
2460
2484
|
defaultMessage: "Content is loading."
|
|
2461
2485
|
}) }) }) })
|
|
2462
2486
|
] });
|
|
2463
2487
|
}
|
|
2464
|
-
return /* @__PURE__ */ jsxs(
|
|
2488
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2465
2489
|
/* @__PURE__ */ jsx(
|
|
2466
2490
|
Formik,
|
|
2467
2491
|
{
|
|
@@ -2471,8 +2495,8 @@ const EditFolderDialog = ({ onClose, folder, location, parentFolderId }) => {
|
|
|
2471
2495
|
initialValues: initialFormData,
|
|
2472
2496
|
children: ({ values, errors, handleChange, setFieldValue }) => /* @__PURE__ */ jsxs(Form, { noValidate: true, children: [
|
|
2473
2497
|
/* @__PURE__ */ jsx(EditFolderModalHeader, { isEditing }),
|
|
2474
|
-
/* @__PURE__ */ jsx(
|
|
2475
|
-
isEditing && /* @__PURE__ */ jsx(
|
|
2498
|
+
/* @__PURE__ */ jsx(Modal.Body, { children: /* @__PURE__ */ jsxs(Grid.Root, { gap: 4, children: [
|
|
2499
|
+
isEditing && /* @__PURE__ */ jsx(Grid.Item, { xs: 12, col: 12, children: /* @__PURE__ */ jsx(
|
|
2476
2500
|
ContextInfo,
|
|
2477
2501
|
{
|
|
2478
2502
|
blocks: [
|
|
@@ -2502,7 +2526,7 @@ const EditFolderDialog = ({ onClose, folder, location, parentFolderId }) => {
|
|
|
2502
2526
|
]
|
|
2503
2527
|
}
|
|
2504
2528
|
) }),
|
|
2505
|
-
/* @__PURE__ */ jsx(
|
|
2529
|
+
/* @__PURE__ */ jsx(Grid.Item, { xs: 12, col: 6, children: /* @__PURE__ */ jsxs(Field.Root, { name: "name", error: errors.name, children: [
|
|
2506
2530
|
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
|
2507
2531
|
id: getTrad("form.input.label.folder-name"),
|
|
2508
2532
|
defaultMessage: "Name"
|
|
@@ -2517,7 +2541,7 @@ const EditFolderDialog = ({ onClose, folder, location, parentFolderId }) => {
|
|
|
2517
2541
|
),
|
|
2518
2542
|
/* @__PURE__ */ jsx(Field.Error, {})
|
|
2519
2543
|
] }) }),
|
|
2520
|
-
/* @__PURE__ */ jsx(
|
|
2544
|
+
/* @__PURE__ */ jsx(Grid.Item, { xs: 12, col: 6, children: /* @__PURE__ */ jsxs(Field.Root, { id: "folder-parent", children: [
|
|
2521
2545
|
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
|
2522
2546
|
id: getTrad("form.input.label.folder-location"),
|
|
2523
2547
|
defaultMessage: "Location"
|
|
@@ -2551,46 +2575,64 @@ const EditFolderDialog = ({ onClose, folder, location, parentFolderId }) => {
|
|
|
2551
2575
|
)
|
|
2552
2576
|
] }) })
|
|
2553
2577
|
] }) }),
|
|
2554
|
-
/* @__PURE__ */
|
|
2555
|
-
|
|
2556
|
-
{
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
] })
|
|
2586
|
-
}
|
|
2587
|
-
)
|
|
2578
|
+
/* @__PURE__ */ jsxs(Modal.Footer, { children: [
|
|
2579
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => onClose(), variant: "tertiary", name: "cancel", children: formatMessage({ id: "cancel", defaultMessage: "Cancel" }) }),
|
|
2580
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
2581
|
+
isEditing && canUpdate && /* @__PURE__ */ jsx(
|
|
2582
|
+
Button,
|
|
2583
|
+
{
|
|
2584
|
+
type: "button",
|
|
2585
|
+
variant: "danger-light",
|
|
2586
|
+
onClick: () => setShowConfirmDialog(true),
|
|
2587
|
+
name: "delete",
|
|
2588
|
+
disabled: !canUpdate || isEditFolderLoading,
|
|
2589
|
+
children: formatMessage({
|
|
2590
|
+
id: getTrad("modal.folder.create.delete"),
|
|
2591
|
+
defaultMessage: "Delete folder"
|
|
2592
|
+
})
|
|
2593
|
+
}
|
|
2594
|
+
),
|
|
2595
|
+
/* @__PURE__ */ jsx(
|
|
2596
|
+
Button,
|
|
2597
|
+
{
|
|
2598
|
+
name: "submit",
|
|
2599
|
+
loading: isEditFolderLoading,
|
|
2600
|
+
disabled: formDisabled,
|
|
2601
|
+
type: "submit",
|
|
2602
|
+
children: formatMessage(
|
|
2603
|
+
isEditing ? { id: getTrad("modal.folder.edit.submit"), defaultMessage: "Save" } : { id: getTrad("modal.folder.create.submit"), defaultMessage: "Create" }
|
|
2604
|
+
)
|
|
2605
|
+
}
|
|
2606
|
+
)
|
|
2607
|
+
] })
|
|
2608
|
+
] })
|
|
2588
2609
|
] })
|
|
2589
2610
|
}
|
|
2590
2611
|
),
|
|
2591
|
-
|
|
2612
|
+
/* @__PURE__ */ jsx(
|
|
2613
|
+
RemoveFolderDialog,
|
|
2614
|
+
{
|
|
2615
|
+
open: showConfirmDialog,
|
|
2616
|
+
onClose: () => setShowConfirmDialog(false),
|
|
2617
|
+
onConfirm: handleDelete
|
|
2618
|
+
}
|
|
2619
|
+
)
|
|
2592
2620
|
] });
|
|
2593
2621
|
};
|
|
2622
|
+
EditFolderContent.defaultProps = {
|
|
2623
|
+
folder: void 0,
|
|
2624
|
+
location: void 0,
|
|
2625
|
+
parentFolderId: null
|
|
2626
|
+
};
|
|
2627
|
+
EditFolderContent.propTypes = {
|
|
2628
|
+
folder: FolderDefinition,
|
|
2629
|
+
location: PropTypes.string,
|
|
2630
|
+
onClose: PropTypes.func.isRequired,
|
|
2631
|
+
parentFolderId: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
2632
|
+
};
|
|
2633
|
+
const EditFolderDialog = ({ open, onClose, ...restProps }) => {
|
|
2634
|
+
return /* @__PURE__ */ jsx(Modal.Root, { open, onOpenChange: onClose, children: /* @__PURE__ */ jsx(Modal.Content, { children: /* @__PURE__ */ jsx(EditFolderContent, { ...restProps, onClose }) }) });
|
|
2635
|
+
};
|
|
2594
2636
|
EditFolderDialog.defaultProps = {
|
|
2595
2637
|
folder: void 0,
|
|
2596
2638
|
location: void 0,
|
|
@@ -2599,6 +2641,7 @@ EditFolderDialog.defaultProps = {
|
|
|
2599
2641
|
EditFolderDialog.propTypes = {
|
|
2600
2642
|
folder: FolderDefinition,
|
|
2601
2643
|
location: PropTypes.string,
|
|
2644
|
+
open: PropTypes.bool.isRequired,
|
|
2602
2645
|
onClose: PropTypes.func.isRequired,
|
|
2603
2646
|
parentFolderId: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
2604
2647
|
};
|
|
@@ -2685,7 +2728,7 @@ const AssetCardBase = ({
|
|
|
2685
2728
|
return /* @__PURE__ */ jsxs(CardContainer, { role: "button", height: "100%", tabIndex: -1, onClick: handleClick, children: [
|
|
2686
2729
|
/* @__PURE__ */ jsxs(CardHeader, { children: [
|
|
2687
2730
|
isSelectable2 && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
2688
|
-
/* @__PURE__ */ jsx("div", { onClick: handlePropagationClick, children: /* @__PURE__ */ jsx(CardCheckbox, {
|
|
2731
|
+
/* @__PURE__ */ jsx("div", { onClick: handlePropagationClick, children: /* @__PURE__ */ jsx(CardCheckbox, { checked: selected, onCheckedChange: onSelect }) }),
|
|
2689
2732
|
(onRemove || onEdit) && /* @__PURE__ */ jsxs(CardActionsContainer, { onClick: handlePropagationClick, position: "end", children: [
|
|
2690
2733
|
onRemove && /* @__PURE__ */ jsx(
|
|
2691
2734
|
IconButton,
|
|
@@ -3021,10 +3064,10 @@ const AssetGridList = ({
|
|
|
3021
3064
|
}) => {
|
|
3022
3065
|
return /* @__PURE__ */ jsxs(KeyboardNavigable, { tagName: "article", children: [
|
|
3023
3066
|
title && /* @__PURE__ */ jsx(Box, { paddingTop: 2, paddingBottom: 2, children: /* @__PURE__ */ jsx(Typography, { tag: "h2", variant: "delta", fontWeight: "semiBold", children: title }) }),
|
|
3024
|
-
/* @__PURE__ */ jsx(Grid, { gap: 4, children: assets.map((asset, index2) => {
|
|
3067
|
+
/* @__PURE__ */ jsx(Grid.Root, { gap: 4, children: assets.map((asset, index2) => {
|
|
3025
3068
|
const isSelected = !!selectedAssets.find((currentAsset) => currentAsset.id === asset.id);
|
|
3026
3069
|
if (onReorderAsset) {
|
|
3027
|
-
return /* @__PURE__ */ jsx(
|
|
3070
|
+
return /* @__PURE__ */ jsx(Grid.Item, { col: 3, height: "100%", children: /* @__PURE__ */ jsx(Draggable, { index: index2, moveItem: onReorderAsset, id: asset.id, children: /* @__PURE__ */ jsx(
|
|
3028
3071
|
AssetCard,
|
|
3029
3072
|
{
|
|
3030
3073
|
allowedTypes,
|
|
@@ -3036,7 +3079,7 @@ const AssetGridList = ({
|
|
|
3036
3079
|
}
|
|
3037
3080
|
) }) }, asset.id);
|
|
3038
3081
|
}
|
|
3039
|
-
return /* @__PURE__ */ jsx(
|
|
3082
|
+
return /* @__PURE__ */ jsx(Grid.Item, { col: 3, height: "100%", children: /* @__PURE__ */ jsx(
|
|
3040
3083
|
AssetCard,
|
|
3041
3084
|
{
|
|
3042
3085
|
allowedTypes,
|
|
@@ -3259,7 +3302,7 @@ const Card = styled(Box)`
|
|
|
3259
3302
|
&:hover,
|
|
3260
3303
|
&:focus-within {
|
|
3261
3304
|
${CardActionDisplay} {
|
|
3262
|
-
display: ${({ isCardActions }) => isCardActions ? "block" : ""};
|
|
3305
|
+
display: ${({ $isCardActions }) => $isCardActions ? "block" : ""};
|
|
3263
3306
|
}
|
|
3264
3307
|
}
|
|
3265
3308
|
`;
|
|
@@ -3267,7 +3310,7 @@ const FolderCard = forwardRef(
|
|
|
3267
3310
|
({ children, id: id2, startAction, cardActions, ariaLabel, onClick, to, ...props }, ref) => {
|
|
3268
3311
|
const generatedId = useId(id2);
|
|
3269
3312
|
const fodlerCtxValue = useMemo(() => ({ id: generatedId }), [generatedId]);
|
|
3270
|
-
return /* @__PURE__ */ jsx(FolderCardContext.Provider, { value: fodlerCtxValue, children: /* @__PURE__ */ jsxs(Card, { position: "relative", tabIndex: 0, isCardActions: !!cardActions, ref, ...props, children: [
|
|
3313
|
+
return /* @__PURE__ */ jsx(FolderCardContext.Provider, { value: fodlerCtxValue, children: /* @__PURE__ */ jsxs(Card, { position: "relative", tabIndex: 0, $isCardActions: !!cardActions, ref, ...props, children: [
|
|
3271
3314
|
/* @__PURE__ */ jsx(
|
|
3272
3315
|
FauxClickWrapper,
|
|
3273
3316
|
{
|
|
@@ -3382,7 +3425,7 @@ FolderCardBodyAction.propTypes = {
|
|
|
3382
3425
|
const FolderGridList = ({ title, children }) => {
|
|
3383
3426
|
return /* @__PURE__ */ jsxs(KeyboardNavigable, { tagName: "article", children: [
|
|
3384
3427
|
title && /* @__PURE__ */ jsx(Box, { paddingBottom: 2, children: /* @__PURE__ */ jsx(Typography, { tag: "h2", variant: "delta", fontWeight: "semiBold", children: title }) }),
|
|
3385
|
-
/* @__PURE__ */ jsx(Grid, { gap: 4, children })
|
|
3428
|
+
/* @__PURE__ */ jsx(Grid.Root, { gap: 4, children })
|
|
3386
3429
|
] });
|
|
3387
3430
|
};
|
|
3388
3431
|
FolderGridList.defaultProps = {
|
|
@@ -3435,12 +3478,22 @@ const VideoPreviewWrapper$1 = styled(Box)`
|
|
|
3435
3478
|
`;
|
|
3436
3479
|
const PreviewCell = ({ type, content }) => {
|
|
3437
3480
|
if (type === "folder") {
|
|
3438
|
-
return /* @__PURE__ */ jsx(
|
|
3481
|
+
return /* @__PURE__ */ jsx(
|
|
3482
|
+
Flex,
|
|
3483
|
+
{
|
|
3484
|
+
justifyContent: "center",
|
|
3485
|
+
background: "secondary100",
|
|
3486
|
+
width: "3.2rem",
|
|
3487
|
+
height: "3.2rem",
|
|
3488
|
+
borderRadius: "50%",
|
|
3489
|
+
children: /* @__PURE__ */ jsx(Folder, { fill: "secondary500", width: "1.6rem", height: "1.6rem" })
|
|
3490
|
+
}
|
|
3491
|
+
);
|
|
3439
3492
|
}
|
|
3440
3493
|
const { alternativeText, ext, formats, mime, name: name2, url } = content;
|
|
3441
3494
|
if (mime.includes(AssetType.Image)) {
|
|
3442
3495
|
const mediaURL = prefixFileUrlWithBackendUrl(formats?.thumbnail?.url) ?? prefixFileUrlWithBackendUrl(url);
|
|
3443
|
-
return /* @__PURE__ */ jsx(Avatar, { src: mediaURL, alt: alternativeText, preview: true });
|
|
3496
|
+
return /* @__PURE__ */ jsx(Avatar.Item, { src: mediaURL, alt: alternativeText, preview: true });
|
|
3444
3497
|
}
|
|
3445
3498
|
if (mime.includes(AssetType.Video)) {
|
|
3446
3499
|
return /* @__PURE__ */ jsx(VideoPreviewWrapper$1, { children: /* @__PURE__ */ jsx(
|
|
@@ -3452,7 +3505,7 @@ const PreviewCell = ({ type, content }) => {
|
|
|
3452
3505
|
}
|
|
3453
3506
|
) });
|
|
3454
3507
|
}
|
|
3455
|
-
return /* @__PURE__ */ jsx(
|
|
3508
|
+
return /* @__PURE__ */ jsx(Box, { background: "secondary100", color: "secondary600", width: "3.2rem", height: "3.2rem", children: getFileExtension(ext) });
|
|
3456
3509
|
};
|
|
3457
3510
|
PreviewCell.propTypes = {
|
|
3458
3511
|
content: PropTypes.shape({
|
|
@@ -3556,7 +3609,7 @@ const TableRows = ({
|
|
|
3556
3609
|
);
|
|
3557
3610
|
return /* @__PURE__ */ jsxs(Tr, { onClick: () => handleRowClickFn(element, contentType, id2, path), children: [
|
|
3558
3611
|
/* @__PURE__ */ jsx(Td, { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(
|
|
3559
|
-
|
|
3612
|
+
Checkbox,
|
|
3560
3613
|
{
|
|
3561
3614
|
"aria-label": formatMessage(
|
|
3562
3615
|
{
|
|
@@ -3566,7 +3619,7 @@ const TableRows = ({
|
|
|
3566
3619
|
{ name: name2 }
|
|
3567
3620
|
),
|
|
3568
3621
|
disabled: !isSelectable2,
|
|
3569
|
-
|
|
3622
|
+
onCheckedChange: () => onSelectOne(element),
|
|
3570
3623
|
checked: isSelected
|
|
3571
3624
|
}
|
|
3572
3625
|
) }),
|
|
@@ -3650,16 +3703,15 @@ const TableList = ({
|
|
|
3650
3703
|
return /* @__PURE__ */ jsxs(Table, { colCount: tableHeaders.length + 2, rowCount: assetCount + folderCount + 1, children: [
|
|
3651
3704
|
/* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsxs(Tr, { children: [
|
|
3652
3705
|
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(
|
|
3653
|
-
|
|
3706
|
+
Checkbox,
|
|
3654
3707
|
{
|
|
3655
3708
|
"aria-label": formatMessage({
|
|
3656
3709
|
id: getTrad("bulk.select.label"),
|
|
3657
3710
|
defaultMessage: "Select all folders & assets"
|
|
3658
3711
|
}),
|
|
3659
3712
|
disabled: shouldDisableBulkSelect,
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
value: (assetCount > 0 || folderCount > 0) && selected.length === assetCount + folderCount
|
|
3713
|
+
onCheckedChange: (checked) => onSelectAll(checked, rows),
|
|
3714
|
+
checked: indeterminate && !shouldDisableBulkSelect ? "indeterminate" : (assetCount > 0 || folderCount > 0) && selected.length === assetCount + folderCount
|
|
3663
3715
|
}
|
|
3664
3716
|
) }),
|
|
3665
3717
|
tableHeaders.map(({ metadatas: { label, isSortable }, name: name2, key }) => {
|
|
@@ -3800,7 +3852,7 @@ const FilterTag = ({ attribute, filter, onClick, operator, value }) => {
|
|
|
3800
3852
|
id: `components.FilterOptions.FILTER_TYPES.${operator}`,
|
|
3801
3853
|
defaultMessage: operator
|
|
3802
3854
|
})} ${formattedValue}`;
|
|
3803
|
-
return /* @__PURE__ */ jsx(
|
|
3855
|
+
return /* @__PURE__ */ jsx(Tag, { onClick: handleClick, icon: /* @__PURE__ */ jsx(Cross, {}), padding: 1, children: content });
|
|
3804
3856
|
};
|
|
3805
3857
|
FilterTag.propTypes = {
|
|
3806
3858
|
attribute: PropTypes.shape({
|
|
@@ -4007,7 +4059,7 @@ const getFilterList = ({ fieldSchema: { type: fieldType, mainField } }) => {
|
|
|
4007
4059
|
];
|
|
4008
4060
|
}
|
|
4009
4061
|
};
|
|
4010
|
-
const FilterPopover = ({ displayedFilters: displayedFilters2, filters, onSubmit, onToggle
|
|
4062
|
+
const FilterPopover = ({ displayedFilters: displayedFilters2, filters, onSubmit, onToggle }) => {
|
|
4011
4063
|
const { formatMessage } = useIntl();
|
|
4012
4064
|
const [modifiedData, setModifiedData] = useState({
|
|
4013
4065
|
name: "createdAt",
|
|
@@ -4129,7 +4181,7 @@ const FilterPopover = ({ displayedFilters: displayedFilters2, filters, onSubmit,
|
|
|
4129
4181
|
onToggle();
|
|
4130
4182
|
};
|
|
4131
4183
|
const appliedFilter = displayedFilters2.find((filter) => filter.name === modifiedData.name);
|
|
4132
|
-
return /* @__PURE__ */ jsx(Popover, {
|
|
4184
|
+
return /* @__PURE__ */ jsx(Popover.Content, { sideOffset: 4, children: /* @__PURE__ */ jsx("form", { onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs(Flex, { padding: 3, direction: "column", alignItems: "stretch", gap: 1, style: { minWidth: 184 }, children: [
|
|
4133
4185
|
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
|
|
4134
4186
|
SingleSelect,
|
|
4135
4187
|
{
|
|
@@ -4184,34 +4236,20 @@ FilterPopover.propTypes = {
|
|
|
4184
4236
|
).isRequired,
|
|
4185
4237
|
filters: PropTypes.array.isRequired,
|
|
4186
4238
|
onSubmit: PropTypes.func.isRequired,
|
|
4187
|
-
onToggle: PropTypes.func.isRequired
|
|
4188
|
-
source: PropTypes.shape({ current: PropTypes.instanceOf(Element) }).isRequired
|
|
4239
|
+
onToggle: PropTypes.func.isRequired
|
|
4189
4240
|
};
|
|
4190
4241
|
const Filters = ({ appliedFilters, onChangeFilters }) => {
|
|
4191
|
-
const
|
|
4192
|
-
const [isVisible, setVisible] = useState(false);
|
|
4242
|
+
const [open, setOpen] = React.useState(false);
|
|
4193
4243
|
const { formatMessage } = useIntl();
|
|
4194
|
-
|
|
4195
|
-
|
|
4244
|
+
return /* @__PURE__ */ jsxs(Popover.Root, { open, onOpenChange: setOpen, children: [
|
|
4245
|
+
/* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(Button, { variant: "tertiary", startIcon: /* @__PURE__ */ jsx(Filter, {}), size: "S", children: formatMessage({ id: "app.utils.filters", defaultMessage: "Filters" }) }) }),
|
|
4196
4246
|
/* @__PURE__ */ jsx(
|
|
4197
|
-
Button,
|
|
4198
|
-
{
|
|
4199
|
-
variant: "tertiary",
|
|
4200
|
-
ref: buttonRef,
|
|
4201
|
-
startIcon: /* @__PURE__ */ jsx(Filter, {}),
|
|
4202
|
-
onClick: toggleFilter,
|
|
4203
|
-
size: "S",
|
|
4204
|
-
children: formatMessage({ id: "app.utils.filters", defaultMessage: "Filters" })
|
|
4205
|
-
}
|
|
4206
|
-
),
|
|
4207
|
-
isVisible && /* @__PURE__ */ jsx(
|
|
4208
4247
|
FilterPopover,
|
|
4209
4248
|
{
|
|
4249
|
+
onToggle: setOpen,
|
|
4210
4250
|
displayedFilters,
|
|
4211
4251
|
filters: appliedFilters,
|
|
4212
|
-
onSubmit: onChangeFilters
|
|
4213
|
-
onToggle: toggleFilter,
|
|
4214
|
-
source: buttonRef
|
|
4252
|
+
onSubmit: onChangeFilters
|
|
4215
4253
|
}
|
|
4216
4254
|
),
|
|
4217
4255
|
appliedFilters && /* @__PURE__ */ jsx(
|
|
@@ -4667,15 +4705,14 @@ const BrowseStep = ({
|
|
|
4667
4705
|
borderColor: "neutral200",
|
|
4668
4706
|
height: "3.2rem",
|
|
4669
4707
|
children: /* @__PURE__ */ jsx(
|
|
4670
|
-
|
|
4708
|
+
Checkbox,
|
|
4671
4709
|
{
|
|
4672
4710
|
"aria-label": formatMessage({
|
|
4673
4711
|
id: getTrad("bulk.select.label"),
|
|
4674
4712
|
defaultMessage: "Select all assets"
|
|
4675
4713
|
}),
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
onChange: onSelectAllAsset
|
|
4714
|
+
checked: !areAllAssetSelected && hasSomeAssetSelected ? "indeterminate" : areAllAssetSelected,
|
|
4715
|
+
onCheckedChange: onSelectAllAsset
|
|
4679
4716
|
}
|
|
4680
4717
|
)
|
|
4681
4718
|
}
|
|
@@ -4776,7 +4813,7 @@ const BrowseStep = ({
|
|
|
4776
4813
|
{ count: folderCount }
|
|
4777
4814
|
) || "",
|
|
4778
4815
|
children: folders.map((folder) => {
|
|
4779
|
-
return /* @__PURE__ */ jsx(
|
|
4816
|
+
return /* @__PURE__ */ jsx(Grid.Item, { col: 3, children: /* @__PURE__ */ jsx(
|
|
4780
4817
|
FolderCard,
|
|
4781
4818
|
{
|
|
4782
4819
|
ariaLabel: folder.name,
|
|
@@ -4799,10 +4836,18 @@ const BrowseStep = ({
|
|
|
4799
4836
|
{
|
|
4800
4837
|
onClick: () => handleClickFolderCard(folder.id, folder.path),
|
|
4801
4838
|
children: /* @__PURE__ */ jsxs(Flex, { tag: "h2", direction: "column", alignItems: "start", maxWidth: "100%", children: [
|
|
4802
|
-
/* @__PURE__ */ jsxs(
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4839
|
+
/* @__PURE__ */ jsxs(
|
|
4840
|
+
TypographyMaxWidth,
|
|
4841
|
+
{
|
|
4842
|
+
fontWeight: "semiBold",
|
|
4843
|
+
ellipsis: true,
|
|
4844
|
+
textColor: "neutral800",
|
|
4845
|
+
children: [
|
|
4846
|
+
folder.name,
|
|
4847
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { children: "-" })
|
|
4848
|
+
]
|
|
4849
|
+
}
|
|
4850
|
+
),
|
|
4806
4851
|
/* @__PURE__ */ jsx(
|
|
4807
4852
|
TypographyMaxWidth,
|
|
4808
4853
|
{
|
|
@@ -4900,13 +4945,10 @@ BrowseStep.propTypes = {
|
|
|
4900
4945
|
};
|
|
4901
4946
|
const DialogFooter = ({ onClose, onValidate }) => {
|
|
4902
4947
|
const { formatMessage } = useIntl();
|
|
4903
|
-
return /* @__PURE__ */
|
|
4904
|
-
|
|
4905
|
-
{
|
|
4906
|
-
|
|
4907
|
-
endActions: onValidate && /* @__PURE__ */ jsx(Button, { onClick: onValidate, children: formatMessage({ id: "global.finish", defaultMessage: "Finish" }) })
|
|
4908
|
-
}
|
|
4909
|
-
);
|
|
4948
|
+
return /* @__PURE__ */ jsxs(Modal.Footer, { children: [
|
|
4949
|
+
/* @__PURE__ */ jsx(Button, { onClick: onClose, variant: "tertiary", children: formatMessage({ id: "app.components.Button.cancel", defaultMessage: "Cancel" }) }),
|
|
4950
|
+
onValidate && /* @__PURE__ */ jsx(Button, { onClick: onValidate, children: formatMessage({ id: "global.finish", defaultMessage: "Finish" }) })
|
|
4951
|
+
] });
|
|
4910
4952
|
};
|
|
4911
4953
|
DialogFooter.defaultProps = {
|
|
4912
4954
|
onValidate: void 0
|
|
@@ -4955,7 +4997,7 @@ const LoadingBody = styled(Flex)`
|
|
|
4955
4997
|
/* 80px are coming from the Tabs component that is not included in the ModalBody */
|
|
4956
4998
|
min-height: ${() => `calc(60vh + 8rem)`};
|
|
4957
4999
|
`;
|
|
4958
|
-
const
|
|
5000
|
+
const AssetContent = ({
|
|
4959
5001
|
allowedTypes,
|
|
4960
5002
|
folderId,
|
|
4961
5003
|
onClose,
|
|
@@ -5006,9 +5048,6 @@ const AssetDialog = ({
|
|
|
5006
5048
|
selectedAssets,
|
|
5007
5049
|
{ selectOne, selectOnly, setSelections, selectMultiple, deselectMultiple }
|
|
5008
5050
|
] = useSelectionState(["id"], initiallySelectedAssets);
|
|
5009
|
-
const [initialSelectedTabIndex, setInitialSelectedTabIndex] = useState(
|
|
5010
|
-
selectedAssets.length > 0 ? 1 : 0
|
|
5011
|
-
);
|
|
5012
5051
|
const handleSelectAllAssets = () => {
|
|
5013
5052
|
const allowedAssets = getAllowedFiles(allowedTypes, assets);
|
|
5014
5053
|
if (!multiple) {
|
|
@@ -5029,8 +5068,8 @@ const AssetDialog = ({
|
|
|
5029
5068
|
const isLoading = isLoadingPermissions || isLoadingAssets || isLoadingFolders;
|
|
5030
5069
|
const hasError = errorAssets || errorFolders;
|
|
5031
5070
|
if (isLoading) {
|
|
5032
|
-
return /* @__PURE__ */ jsxs(
|
|
5033
|
-
/* @__PURE__ */ jsx(
|
|
5071
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5072
|
+
/* @__PURE__ */ jsx(Modal.Header, { children: /* @__PURE__ */ jsx(Modal.Title, { children: formatMessage({
|
|
5034
5073
|
id: getTrad("header.actions.add-assets"),
|
|
5035
5074
|
defaultMessage: "Add new assets"
|
|
5036
5075
|
}) }) }),
|
|
@@ -5042,8 +5081,8 @@ const AssetDialog = ({
|
|
|
5042
5081
|
] });
|
|
5043
5082
|
}
|
|
5044
5083
|
if (hasError) {
|
|
5045
|
-
return /* @__PURE__ */ jsxs(
|
|
5046
|
-
/* @__PURE__ */ jsx(
|
|
5084
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5085
|
+
/* @__PURE__ */ jsx(Modal.Header, { children: /* @__PURE__ */ jsx(Modal.Title, { children: formatMessage({
|
|
5047
5086
|
id: getTrad("header.actions.add-assets"),
|
|
5048
5087
|
defaultMessage: "Add new assets"
|
|
5049
5088
|
}) }) }),
|
|
@@ -5052,8 +5091,8 @@ const AssetDialog = ({
|
|
|
5052
5091
|
] });
|
|
5053
5092
|
}
|
|
5054
5093
|
if (!canRead) {
|
|
5055
|
-
return /* @__PURE__ */ jsxs(
|
|
5056
|
-
/* @__PURE__ */ jsx(
|
|
5094
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5095
|
+
/* @__PURE__ */ jsx(Modal.Header, { children: /* @__PURE__ */ jsx(Modal.Title, { children: formatMessage({
|
|
5057
5096
|
id: getTrad("header.actions.add-assets"),
|
|
5058
5097
|
defaultMessage: "Add new assets"
|
|
5059
5098
|
}) }) }),
|
|
@@ -5063,7 +5102,7 @@ const AssetDialog = ({
|
|
|
5063
5102
|
}
|
|
5064
5103
|
if (assetToEdit) {
|
|
5065
5104
|
return /* @__PURE__ */ jsx(
|
|
5066
|
-
|
|
5105
|
+
EditAssetContent,
|
|
5067
5106
|
{
|
|
5068
5107
|
onClose: () => setAssetToEdit(void 0),
|
|
5069
5108
|
asset: assetToEdit,
|
|
@@ -5076,7 +5115,7 @@ const AssetDialog = ({
|
|
|
5076
5115
|
}
|
|
5077
5116
|
if (folderToEdit) {
|
|
5078
5117
|
return /* @__PURE__ */ jsx(
|
|
5079
|
-
|
|
5118
|
+
EditFolderContent,
|
|
5080
5119
|
{
|
|
5081
5120
|
folder: folderToEdit,
|
|
5082
5121
|
onClose: () => setFolderToEdit(void 0),
|
|
@@ -5095,101 +5134,112 @@ const AssetDialog = ({
|
|
|
5095
5134
|
onChangeFolder(folderId2);
|
|
5096
5135
|
onChangeFolderParam(folderId2, folderPath);
|
|
5097
5136
|
};
|
|
5098
|
-
return /* @__PURE__ */ jsxs(
|
|
5099
|
-
/* @__PURE__ */ jsx(
|
|
5137
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5138
|
+
/* @__PURE__ */ jsx(Modal.Header, { children: /* @__PURE__ */ jsx(Modal.Title, { children: formatMessage({
|
|
5100
5139
|
id: getTrad("header.actions.add-assets"),
|
|
5101
5140
|
defaultMessage: "Add new assets"
|
|
5102
5141
|
}) }) }),
|
|
5103
|
-
/* @__PURE__ */ jsxs(
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
/* @__PURE__ */
|
|
5116
|
-
/* @__PURE__ */ jsx(Tab, { children: formatMessage({
|
|
5117
|
-
id: getTrad("modal.nav.browse"),
|
|
5118
|
-
defaultMessage: "Browse"
|
|
5119
|
-
}) }),
|
|
5120
|
-
/* @__PURE__ */ jsxs(Tab, { children: [
|
|
5121
|
-
formatMessage({
|
|
5122
|
-
id: getTrad("modal.header.select-files"),
|
|
5123
|
-
defaultMessage: "Selected files"
|
|
5124
|
-
}),
|
|
5125
|
-
/* @__PURE__ */ jsx(Badge, { marginLeft: 2, children: selectedAssets.length })
|
|
5126
|
-
] })
|
|
5127
|
-
] }),
|
|
5128
|
-
/* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
5129
|
-
/* @__PURE__ */ jsx(
|
|
5130
|
-
Button,
|
|
5131
|
-
{
|
|
5132
|
-
variant: "secondary",
|
|
5133
|
-
onClick: () => onAddFolder({ folderId: queryObject?.folder }),
|
|
5134
|
-
children: formatMessage({
|
|
5135
|
-
id: getTrad("modal.upload-list.sub-header.add-folder"),
|
|
5136
|
-
defaultMessage: "Add folder"
|
|
5137
|
-
})
|
|
5138
|
-
}
|
|
5139
|
-
),
|
|
5140
|
-
/* @__PURE__ */ jsx(Button, { onClick: () => onAddAsset({ folderId: queryObject?.folder }), children: formatMessage({
|
|
5141
|
-
id: getTrad("modal.upload-list.sub-header.button"),
|
|
5142
|
-
defaultMessage: "Add more assets"
|
|
5143
|
-
}) })
|
|
5144
|
-
] })
|
|
5145
|
-
] }),
|
|
5146
|
-
/* @__PURE__ */ jsx(Divider, {}),
|
|
5147
|
-
/* @__PURE__ */ jsxs(TabPanels, { children: [
|
|
5148
|
-
/* @__PURE__ */ jsx(TabPanel, { children: /* @__PURE__ */ jsx(ModalBody, { children: /* @__PURE__ */ jsx(
|
|
5149
|
-
BrowseStep,
|
|
5150
|
-
{
|
|
5151
|
-
allowedTypes,
|
|
5152
|
-
assets,
|
|
5153
|
-
canCreate,
|
|
5154
|
-
canRead,
|
|
5155
|
-
folders,
|
|
5156
|
-
onSelectAsset: handleSelectAsset,
|
|
5157
|
-
selectedAssets,
|
|
5158
|
-
multiple,
|
|
5159
|
-
onSelectAllAsset: handleSelectAllAssets,
|
|
5160
|
-
onEditAsset: setAssetToEdit,
|
|
5161
|
-
onEditFolder: setFolderToEdit,
|
|
5162
|
-
pagination,
|
|
5163
|
-
queryObject,
|
|
5164
|
-
onAddAsset,
|
|
5165
|
-
onChangeFilters,
|
|
5166
|
-
onChangeFolder: handleFolderChange,
|
|
5167
|
-
onChangePage,
|
|
5168
|
-
onChangePageSize,
|
|
5169
|
-
onChangeSort,
|
|
5170
|
-
onChangeSearch
|
|
5171
|
-
}
|
|
5172
|
-
) }) }),
|
|
5173
|
-
/* @__PURE__ */ jsx(TabPanel, { children: /* @__PURE__ */ jsx(ModalBody, { children: /* @__PURE__ */ jsx(
|
|
5174
|
-
SelectedStep,
|
|
5175
|
-
{
|
|
5176
|
-
selectedAssets,
|
|
5177
|
-
onSelectAsset: handleSelectAsset,
|
|
5178
|
-
onReorderAsset: handleMoveItem
|
|
5179
|
-
}
|
|
5180
|
-
) }) })
|
|
5142
|
+
/* @__PURE__ */ jsxs(TabsRoot, { variant: "simple", defaultValue: selectedAssets.length > 0 ? "selected" : "browse", children: [
|
|
5143
|
+
/* @__PURE__ */ jsxs(Flex, { paddingLeft: 8, paddingRight: 8, paddingTop: 6, justifyContent: "space-between", children: [
|
|
5144
|
+
/* @__PURE__ */ jsxs(Tabs.List, { children: [
|
|
5145
|
+
/* @__PURE__ */ jsx(Tabs.Trigger, { value: "browse", children: formatMessage({
|
|
5146
|
+
id: getTrad("modal.nav.browse"),
|
|
5147
|
+
defaultMessage: "Browse"
|
|
5148
|
+
}) }),
|
|
5149
|
+
/* @__PURE__ */ jsxs(Tabs.Trigger, { value: "selected", children: [
|
|
5150
|
+
formatMessage({
|
|
5151
|
+
id: getTrad("modal.header.select-files"),
|
|
5152
|
+
defaultMessage: "Selected files"
|
|
5153
|
+
}),
|
|
5154
|
+
/* @__PURE__ */ jsx(Badge, { marginLeft: 2, children: selectedAssets.length })
|
|
5181
5155
|
] })
|
|
5182
|
-
]
|
|
5183
|
-
|
|
5184
|
-
|
|
5156
|
+
] }),
|
|
5157
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
5158
|
+
/* @__PURE__ */ jsx(
|
|
5159
|
+
Button,
|
|
5160
|
+
{
|
|
5161
|
+
variant: "secondary",
|
|
5162
|
+
onClick: () => onAddFolder({ folderId: queryObject?.folder }),
|
|
5163
|
+
children: formatMessage({
|
|
5164
|
+
id: getTrad("modal.upload-list.sub-header.add-folder"),
|
|
5165
|
+
defaultMessage: "Add folder"
|
|
5166
|
+
})
|
|
5167
|
+
}
|
|
5168
|
+
),
|
|
5169
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => onAddAsset({ folderId: queryObject?.folder }), children: formatMessage({
|
|
5170
|
+
id: getTrad("modal.upload-list.sub-header.button"),
|
|
5171
|
+
defaultMessage: "Add more assets"
|
|
5172
|
+
}) })
|
|
5173
|
+
] })
|
|
5174
|
+
] }),
|
|
5175
|
+
/* @__PURE__ */ jsx(Divider, {}),
|
|
5176
|
+
/* @__PURE__ */ jsxs(Modal.Body, { children: [
|
|
5177
|
+
/* @__PURE__ */ jsx(Tabs.Content, { value: "browse", children: /* @__PURE__ */ jsx(
|
|
5178
|
+
BrowseStep,
|
|
5179
|
+
{
|
|
5180
|
+
allowedTypes,
|
|
5181
|
+
assets,
|
|
5182
|
+
canCreate,
|
|
5183
|
+
canRead,
|
|
5184
|
+
folders,
|
|
5185
|
+
onSelectAsset: handleSelectAsset,
|
|
5186
|
+
selectedAssets,
|
|
5187
|
+
multiple,
|
|
5188
|
+
onSelectAllAsset: handleSelectAllAssets,
|
|
5189
|
+
onEditAsset: setAssetToEdit,
|
|
5190
|
+
onEditFolder: setFolderToEdit,
|
|
5191
|
+
pagination,
|
|
5192
|
+
queryObject,
|
|
5193
|
+
onAddAsset,
|
|
5194
|
+
onChangeFilters,
|
|
5195
|
+
onChangeFolder: handleFolderChange,
|
|
5196
|
+
onChangePage,
|
|
5197
|
+
onChangePageSize,
|
|
5198
|
+
onChangeSort,
|
|
5199
|
+
onChangeSearch
|
|
5200
|
+
}
|
|
5201
|
+
) }),
|
|
5202
|
+
/* @__PURE__ */ jsx(Tabs.Content, { value: "selected", children: /* @__PURE__ */ jsx(
|
|
5203
|
+
SelectedStep,
|
|
5204
|
+
{
|
|
5205
|
+
selectedAssets,
|
|
5206
|
+
onSelectAsset: handleSelectAsset,
|
|
5207
|
+
onReorderAsset: handleMoveItem
|
|
5208
|
+
}
|
|
5209
|
+
) })
|
|
5210
|
+
] })
|
|
5211
|
+
] }),
|
|
5185
5212
|
/* @__PURE__ */ jsx(DialogFooter, { onClose, onValidate: () => onValidate(selectedAssets) })
|
|
5186
5213
|
] });
|
|
5187
5214
|
};
|
|
5215
|
+
AssetContent.defaultProps = {
|
|
5216
|
+
allowedTypes: [],
|
|
5217
|
+
folderId: null,
|
|
5218
|
+
initiallySelectedAssets: [],
|
|
5219
|
+
multiple: false,
|
|
5220
|
+
trackedLocation: void 0
|
|
5221
|
+
};
|
|
5222
|
+
AssetContent.propTypes = {
|
|
5223
|
+
allowedTypes: PropTypes.arrayOf(PropTypes.string),
|
|
5224
|
+
folderId: PropTypes.number,
|
|
5225
|
+
initiallySelectedAssets: PropTypes.arrayOf(AssetDefinition),
|
|
5226
|
+
multiple: PropTypes.bool,
|
|
5227
|
+
onAddAsset: PropTypes.func.isRequired,
|
|
5228
|
+
onAddFolder: PropTypes.func.isRequired,
|
|
5229
|
+
onChangeFolder: PropTypes.func.isRequired,
|
|
5230
|
+
onClose: PropTypes.func.isRequired,
|
|
5231
|
+
onValidate: PropTypes.func.isRequired,
|
|
5232
|
+
trackedLocation: PropTypes.string
|
|
5233
|
+
};
|
|
5234
|
+
const AssetDialog = ({ open, onClose, ...restProps }) => {
|
|
5235
|
+
return /* @__PURE__ */ jsx(Modal.Root, { open, onOpenChange: onClose, children: /* @__PURE__ */ jsx(Modal.Content, { children: /* @__PURE__ */ jsx(AssetContent, { onClose, ...restProps }) }) });
|
|
5236
|
+
};
|
|
5188
5237
|
AssetDialog.defaultProps = {
|
|
5189
5238
|
allowedTypes: [],
|
|
5190
5239
|
folderId: null,
|
|
5191
5240
|
initiallySelectedAssets: [],
|
|
5192
5241
|
multiple: false,
|
|
5242
|
+
open: false,
|
|
5193
5243
|
trackedLocation: void 0
|
|
5194
5244
|
};
|
|
5195
5245
|
AssetDialog.propTypes = {
|
|
@@ -5200,10 +5250,16 @@ AssetDialog.propTypes = {
|
|
|
5200
5250
|
onAddAsset: PropTypes.func.isRequired,
|
|
5201
5251
|
onAddFolder: PropTypes.func.isRequired,
|
|
5202
5252
|
onChangeFolder: PropTypes.func.isRequired,
|
|
5253
|
+
open: PropTypes.bool,
|
|
5203
5254
|
onClose: PropTypes.func.isRequired,
|
|
5204
5255
|
onValidate: PropTypes.func.isRequired,
|
|
5205
5256
|
trackedLocation: PropTypes.string
|
|
5206
5257
|
};
|
|
5258
|
+
const TabsRoot = styled(Tabs.Root)`
|
|
5259
|
+
display: flex;
|
|
5260
|
+
flex-direction: column;
|
|
5261
|
+
overflow: hidden;
|
|
5262
|
+
`;
|
|
5207
5263
|
const typeFromMime = (mime) => {
|
|
5208
5264
|
if (mime.includes(AssetType.Image)) {
|
|
5209
5265
|
return AssetType.Image;
|
|
@@ -5338,15 +5394,10 @@ const FromComputerForm = ({ onClose, onAddAssets, trackedLocation }) => {
|
|
|
5338
5394
|
] }) })
|
|
5339
5395
|
}
|
|
5340
5396
|
) }) }),
|
|
5341
|
-
/* @__PURE__ */ jsx(
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
id: "app.components.Button.cancel",
|
|
5346
|
-
defaultMessage: "cancel"
|
|
5347
|
-
}) })
|
|
5348
|
-
}
|
|
5349
|
-
)
|
|
5397
|
+
/* @__PURE__ */ jsx(Modal.Footer, { children: /* @__PURE__ */ jsx(Button, { onClick: onClose, variant: "tertiary", children: formatMessage({
|
|
5398
|
+
id: "app.components.Button.cancel",
|
|
5399
|
+
defaultMessage: "cancel"
|
|
5400
|
+
}) }) })
|
|
5350
5401
|
] });
|
|
5351
5402
|
};
|
|
5352
5403
|
FromComputerForm.defaultProps = {
|
|
@@ -5472,16 +5523,13 @@ const FromUrlForm = ({ onClose, onAddAsset, trackedLocation }) => {
|
|
|
5472
5523
|
]
|
|
5473
5524
|
}
|
|
5474
5525
|
) }),
|
|
5475
|
-
/* @__PURE__ */
|
|
5476
|
-
|
|
5477
|
-
{
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
}) })
|
|
5483
|
-
}
|
|
5484
|
-
)
|
|
5526
|
+
/* @__PURE__ */ jsxs(Modal.Footer, { children: [
|
|
5527
|
+
/* @__PURE__ */ jsx(Button, { onClick: onClose, variant: "tertiary", children: formatMessage({ id: "app.components.Button.cancel", defaultMessage: "cancel" }) }),
|
|
5528
|
+
/* @__PURE__ */ jsx(Button, { type: "submit", loading, children: formatMessage({
|
|
5529
|
+
id: getTrad("button.next"),
|
|
5530
|
+
defaultMessage: "Next"
|
|
5531
|
+
}) })
|
|
5532
|
+
] })
|
|
5485
5533
|
] })
|
|
5486
5534
|
}
|
|
5487
5535
|
);
|
|
@@ -5497,53 +5545,50 @@ FromUrlForm.propTypes = {
|
|
|
5497
5545
|
const AddAssetStep = ({ onClose, onAddAsset, trackedLocation }) => {
|
|
5498
5546
|
const { formatMessage } = useIntl();
|
|
5499
5547
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5500
|
-
/* @__PURE__ */ jsx(
|
|
5548
|
+
/* @__PURE__ */ jsx(Modal.Header, { children: /* @__PURE__ */ jsx(Modal.Title, { children: formatMessage({
|
|
5501
5549
|
id: getTrad("header.actions.add-assets"),
|
|
5502
5550
|
defaultMessage: "Add new assets"
|
|
5503
5551
|
}) }) }),
|
|
5504
|
-
/* @__PURE__ */ jsxs(
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
/* @__PURE__ */ jsx(Tab, { children: formatMessage({
|
|
5552
|
+
/* @__PURE__ */ jsxs(Tabs.Root, { variant: "simple", defaultValue: "computer", children: [
|
|
5553
|
+
/* @__PURE__ */ jsxs(Box, { paddingLeft: 8, paddingRight: 8, paddingTop: 6, children: [
|
|
5554
|
+
/* @__PURE__ */ jsxs(
|
|
5555
|
+
Tabs.List,
|
|
5556
|
+
{
|
|
5557
|
+
"aria-label": formatMessage({
|
|
5558
|
+
id: getTrad("tabs.title"),
|
|
5559
|
+
defaultMessage: "How do you want to upload your assets?"
|
|
5560
|
+
}),
|
|
5561
|
+
children: [
|
|
5562
|
+
/* @__PURE__ */ jsx(Tabs.Trigger, { value: "computer", children: formatMessage({
|
|
5516
5563
|
id: getTrad("modal.nav.computer"),
|
|
5517
5564
|
defaultMessage: "From computer"
|
|
5518
5565
|
}) }),
|
|
5519
|
-
/* @__PURE__ */ jsx(
|
|
5566
|
+
/* @__PURE__ */ jsx(Tabs.Trigger, { value: "url", children: formatMessage({
|
|
5520
5567
|
id: getTrad("modal.nav.url"),
|
|
5521
5568
|
defaultMessage: "From URL"
|
|
5522
5569
|
}) })
|
|
5523
|
-
]
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
}
|
|
5546
|
-
)
|
|
5570
|
+
]
|
|
5571
|
+
}
|
|
5572
|
+
),
|
|
5573
|
+
/* @__PURE__ */ jsx(Divider, {})
|
|
5574
|
+
] }),
|
|
5575
|
+
/* @__PURE__ */ jsx(Tabs.Content, { value: "computer", children: /* @__PURE__ */ jsx(
|
|
5576
|
+
FromComputerForm,
|
|
5577
|
+
{
|
|
5578
|
+
onClose,
|
|
5579
|
+
onAddAssets: onAddAsset,
|
|
5580
|
+
trackedLocation
|
|
5581
|
+
}
|
|
5582
|
+
) }),
|
|
5583
|
+
/* @__PURE__ */ jsx(Tabs.Content, { value: "url", children: /* @__PURE__ */ jsx(
|
|
5584
|
+
FromUrlForm,
|
|
5585
|
+
{
|
|
5586
|
+
onClose,
|
|
5587
|
+
onAddAsset,
|
|
5588
|
+
trackedLocation
|
|
5589
|
+
}
|
|
5590
|
+
) })
|
|
5591
|
+
] })
|
|
5547
5592
|
] });
|
|
5548
5593
|
};
|
|
5549
5594
|
AddAssetStep.defaultProps = {
|
|
@@ -5698,12 +5743,12 @@ const PendingAssetStep = ({
|
|
|
5698
5743
|
onUploadSucceed(file);
|
|
5699
5744
|
}
|
|
5700
5745
|
};
|
|
5701
|
-
return /* @__PURE__ */ jsxs(
|
|
5702
|
-
/* @__PURE__ */ jsx(
|
|
5746
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5747
|
+
/* @__PURE__ */ jsx(Modal.Header, { children: /* @__PURE__ */ jsx(Modal.Title, { children: formatMessage({
|
|
5703
5748
|
id: getTrad("header.actions.add-assets"),
|
|
5704
5749
|
defaultMessage: "Add new assets"
|
|
5705
5750
|
}) }) }),
|
|
5706
|
-
/* @__PURE__ */ jsx(
|
|
5751
|
+
/* @__PURE__ */ jsx(Modal.Body, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 7, children: [
|
|
5707
5752
|
/* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", children: [
|
|
5708
5753
|
/* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 0, children: [
|
|
5709
5754
|
/* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral800", children: formatMessage(
|
|
@@ -5723,10 +5768,10 @@ const PendingAssetStep = ({
|
|
|
5723
5768
|
defaultMessage: "Add new assets"
|
|
5724
5769
|
}) })
|
|
5725
5770
|
] }),
|
|
5726
|
-
/* @__PURE__ */ jsx(KeyboardNavigable, { tagName: "article", children: /* @__PURE__ */ jsx(Grid, { gap: 4, children: assets.map((asset) => {
|
|
5771
|
+
/* @__PURE__ */ jsx(KeyboardNavigable, { tagName: "article", children: /* @__PURE__ */ jsx(Grid.Root, { gap: 4, children: assets.map((asset) => {
|
|
5727
5772
|
const assetKey = asset.url;
|
|
5728
5773
|
if (uploadStatus === Status.Uploading || uploadStatus === Status.Intermediate) {
|
|
5729
|
-
return /* @__PURE__ */ jsx(
|
|
5774
|
+
return /* @__PURE__ */ jsx(Grid.Item, { col: 4, children: /* @__PURE__ */ jsx(
|
|
5730
5775
|
UploadingAssetCard,
|
|
5731
5776
|
{
|
|
5732
5777
|
addUploadedFiles,
|
|
@@ -5739,7 +5784,7 @@ const PendingAssetStep = ({
|
|
|
5739
5784
|
}
|
|
5740
5785
|
) }, assetKey);
|
|
5741
5786
|
}
|
|
5742
|
-
return /* @__PURE__ */ jsx(
|
|
5787
|
+
return /* @__PURE__ */ jsx(Grid.Item, { col: 4, children: /* @__PURE__ */ jsx(
|
|
5743
5788
|
AssetCard,
|
|
5744
5789
|
{
|
|
5745
5790
|
asset,
|
|
@@ -5753,19 +5798,16 @@ const PendingAssetStep = ({
|
|
|
5753
5798
|
) }, assetKey);
|
|
5754
5799
|
}) }) })
|
|
5755
5800
|
] }) }),
|
|
5756
|
-
/* @__PURE__ */
|
|
5757
|
-
|
|
5758
|
-
{
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
{
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
) })
|
|
5767
|
-
}
|
|
5768
|
-
)
|
|
5801
|
+
/* @__PURE__ */ jsxs(Modal.Footer, { children: [
|
|
5802
|
+
/* @__PURE__ */ jsx(Button, { onClick: onClose, variant: "tertiary", children: formatMessage({ id: "app.components.Button.cancel", defaultMessage: "cancel" }) }),
|
|
5803
|
+
/* @__PURE__ */ jsx(Button, { onClick: handleSubmit, loading: uploadStatus === Status.Uploading, children: formatMessage(
|
|
5804
|
+
{
|
|
5805
|
+
id: getTrad("modal.upload-list.footer.button"),
|
|
5806
|
+
defaultMessage: "Upload {number, plural, one {# asset} other {# assets}} to the library"
|
|
5807
|
+
},
|
|
5808
|
+
{ number: assets.length }
|
|
5809
|
+
) })
|
|
5810
|
+
] })
|
|
5769
5811
|
] });
|
|
5770
5812
|
};
|
|
5771
5813
|
PendingAssetStep.defaultProps = {
|
|
@@ -5795,6 +5837,7 @@ const UploadAssetDialog = ({
|
|
|
5795
5837
|
onClose,
|
|
5796
5838
|
addUploadedFiles,
|
|
5797
5839
|
trackedLocation,
|
|
5840
|
+
open,
|
|
5798
5841
|
validateAssetsTypes = (_, cb) => cb()
|
|
5799
5842
|
}) => {
|
|
5800
5843
|
const { formatMessage } = useIntl();
|
|
@@ -5850,16 +5893,16 @@ const UploadAssetDialog = ({
|
|
|
5850
5893
|
const nextAssets = assets.filter((asset) => asset !== assetToRemove);
|
|
5851
5894
|
setAssets(nextAssets);
|
|
5852
5895
|
};
|
|
5853
|
-
return /* @__PURE__ */ jsxs(
|
|
5854
|
-
step === Steps.AddAsset && /* @__PURE__ */ jsx(
|
|
5896
|
+
return /* @__PURE__ */ jsxs(Modal.Root, { open, onOpenChange: handleClose, children: [
|
|
5897
|
+
step === Steps.AddAsset && /* @__PURE__ */ jsx(Modal.Content, { children: /* @__PURE__ */ jsx(
|
|
5855
5898
|
AddAssetStep,
|
|
5856
5899
|
{
|
|
5857
5900
|
onClose,
|
|
5858
5901
|
onAddAsset: handleAddToPendingAssets,
|
|
5859
5902
|
trackedLocation
|
|
5860
5903
|
}
|
|
5861
|
-
),
|
|
5862
|
-
step === Steps.PendingAsset && /* @__PURE__ */ jsx(
|
|
5904
|
+
) }),
|
|
5905
|
+
step === Steps.PendingAsset && /* @__PURE__ */ jsx(Modal.Content, { children: /* @__PURE__ */ jsx(
|
|
5863
5906
|
PendingAssetStep,
|
|
5864
5907
|
{
|
|
5865
5908
|
onClose: handleClose,
|
|
@@ -5874,9 +5917,9 @@ const UploadAssetDialog = ({
|
|
|
5874
5917
|
folderId,
|
|
5875
5918
|
trackedLocation
|
|
5876
5919
|
}
|
|
5877
|
-
),
|
|
5878
|
-
assetToEdit && /* @__PURE__ */ jsx(
|
|
5879
|
-
|
|
5920
|
+
) }),
|
|
5921
|
+
assetToEdit && /* @__PURE__ */ jsx(Modal.Content, { children: /* @__PURE__ */ jsx(
|
|
5922
|
+
EditAssetContent,
|
|
5880
5923
|
{
|
|
5881
5924
|
onClose: handleAssetEditValidation,
|
|
5882
5925
|
asset: assetToEdit,
|
|
@@ -5885,7 +5928,7 @@ const UploadAssetDialog = ({
|
|
|
5885
5928
|
canDownload: false,
|
|
5886
5929
|
trackedLocation
|
|
5887
5930
|
}
|
|
5888
|
-
)
|
|
5931
|
+
) })
|
|
5889
5932
|
] });
|
|
5890
5933
|
};
|
|
5891
5934
|
UploadAssetDialog.defaultProps = {
|
|
@@ -5901,6 +5944,7 @@ UploadAssetDialog.propTypes = {
|
|
|
5901
5944
|
addUploadedFiles: PropTypes.func,
|
|
5902
5945
|
folderId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
5903
5946
|
initialAssetsToAdd: PropTypes.arrayOf(AssetDefinition),
|
|
5947
|
+
open: PropTypes.bool.isRequired,
|
|
5904
5948
|
onClose: PropTypes.func,
|
|
5905
5949
|
trackedLocation: PropTypes.string,
|
|
5906
5950
|
validateAssetsTypes: PropTypes.func
|
|
@@ -6214,9 +6258,10 @@ const CarouselAssets = forwardRef(
|
|
|
6214
6258
|
))
|
|
6215
6259
|
}
|
|
6216
6260
|
),
|
|
6217
|
-
|
|
6261
|
+
/* @__PURE__ */ jsx(
|
|
6218
6262
|
EditAssetDialog,
|
|
6219
6263
|
{
|
|
6264
|
+
open: isEditingAsset,
|
|
6220
6265
|
onClose: (editedAsset) => {
|
|
6221
6266
|
setIsEditingAsset(false);
|
|
6222
6267
|
if (editedAsset === null) {
|
|
@@ -6269,7 +6314,7 @@ const STEPS = {
|
|
|
6269
6314
|
FolderCreate: "FolderCreate"
|
|
6270
6315
|
};
|
|
6271
6316
|
const MediaLibraryInput = forwardRef(
|
|
6272
|
-
({ attribute: { allowedTypes }, label, hint, disabled, labelAction,
|
|
6317
|
+
({ attribute: { allowedTypes, multiple }, label, hint, disabled, labelAction, name: name2, required }, forwardedRef) => {
|
|
6273
6318
|
const { formatMessage } = useIntl();
|
|
6274
6319
|
const { onChange, value, error } = useField(name2);
|
|
6275
6320
|
const fieldAllowedTypes = allowedTypes || ["files", "images", "videos", "audios"];
|
|
@@ -6408,6 +6453,7 @@ const MediaLibraryInput = forwardRef(
|
|
|
6408
6453
|
setStep(void 0);
|
|
6409
6454
|
setFolderId(null);
|
|
6410
6455
|
},
|
|
6456
|
+
open: step === STEPS.AssetSelect,
|
|
6411
6457
|
onValidate: handleValidation,
|
|
6412
6458
|
multiple,
|
|
6413
6459
|
onAddAsset: () => setStep(STEPS.AssetUpload),
|
|
@@ -6419,6 +6465,7 @@ const MediaLibraryInput = forwardRef(
|
|
|
6419
6465
|
step === STEPS.AssetUpload && /* @__PURE__ */ jsx(
|
|
6420
6466
|
UploadAssetDialog,
|
|
6421
6467
|
{
|
|
6468
|
+
open: step === STEPS.AssetUpload,
|
|
6422
6469
|
onClose: () => setStep(STEPS.AssetSelect),
|
|
6423
6470
|
initialAssetsToAdd: droppedAssets,
|
|
6424
6471
|
addUploadedFiles: handleFilesUploadSucceeded,
|
|
@@ -6427,26 +6474,34 @@ const MediaLibraryInput = forwardRef(
|
|
|
6427
6474
|
validateAssetsTypes
|
|
6428
6475
|
}
|
|
6429
6476
|
),
|
|
6430
|
-
step === STEPS.FolderCreate && /* @__PURE__ */ jsx(
|
|
6477
|
+
step === STEPS.FolderCreate && /* @__PURE__ */ jsx(
|
|
6478
|
+
EditFolderDialog,
|
|
6479
|
+
{
|
|
6480
|
+
open: step === STEPS.FolderCreate,
|
|
6481
|
+
onClose: () => setStep(STEPS.AssetSelect),
|
|
6482
|
+
parentFolderId: folderId
|
|
6483
|
+
}
|
|
6484
|
+
)
|
|
6431
6485
|
] });
|
|
6432
6486
|
}
|
|
6433
6487
|
);
|
|
6434
6488
|
MediaLibraryInput.defaultProps = {
|
|
6435
|
-
attribute: { allowedTypes: ["videos", "files", "images", "audios"] },
|
|
6489
|
+
attribute: { allowedTypes: ["videos", "files", "images", "audios"], multiple: false },
|
|
6436
6490
|
disabled: false,
|
|
6437
6491
|
hint: void 0,
|
|
6438
6492
|
label: void 0,
|
|
6439
6493
|
labelAction: void 0,
|
|
6440
|
-
multiple: false,
|
|
6441
6494
|
required: false
|
|
6442
6495
|
};
|
|
6443
6496
|
MediaLibraryInput.propTypes = {
|
|
6444
|
-
attribute: PropTypes.shape({
|
|
6497
|
+
attribute: PropTypes.shape({
|
|
6498
|
+
allowedTypes: PropTypes.arrayOf(PropTypes.string),
|
|
6499
|
+
multiple: PropTypes.bool
|
|
6500
|
+
}),
|
|
6445
6501
|
disabled: PropTypes.bool,
|
|
6446
6502
|
hint: PropTypes.string,
|
|
6447
6503
|
label: PropTypes.string,
|
|
6448
6504
|
labelAction: PropTypes.node,
|
|
6449
|
-
multiple: PropTypes.bool,
|
|
6450
6505
|
name: PropTypes.string.isRequired,
|
|
6451
6506
|
required: PropTypes.bool
|
|
6452
6507
|
};
|
|
@@ -6470,7 +6525,7 @@ const index = {
|
|
|
6470
6525
|
defaultMessage: "Media Library"
|
|
6471
6526
|
},
|
|
6472
6527
|
permissions: PERMISSIONS.main,
|
|
6473
|
-
Component: () => import("./index-
|
|
6528
|
+
Component: () => import("./index-CofwxhyW.mjs"),
|
|
6474
6529
|
position: 4
|
|
6475
6530
|
});
|
|
6476
6531
|
app.addSettingsLink("global", {
|
|
@@ -6480,7 +6535,7 @@ const index = {
|
|
|
6480
6535
|
defaultMessage: "Media Library"
|
|
6481
6536
|
},
|
|
6482
6537
|
to: "media-library",
|
|
6483
|
-
Component: () => import("./index-
|
|
6538
|
+
Component: () => import("./index-Bfk_br9x.mjs"),
|
|
6484
6539
|
permissions: PERMISSIONS.settings
|
|
6485
6540
|
});
|
|
6486
6541
|
app.addFields({ type: "media", Component: MediaLibraryInput });
|
|
@@ -6551,4 +6606,4 @@ export {
|
|
|
6551
6606
|
FolderCardBodyAction as y,
|
|
6552
6607
|
AssetGridList as z
|
|
6553
6608
|
};
|
|
6554
|
-
//# sourceMappingURL=index-
|
|
6609
|
+
//# sourceMappingURL=index-12OzcF7r.mjs.map
|