@strapi/upload 5.0.0-beta.13 → 5.0.0-beta.14

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.
@@ -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-beta.12";
35
+ const version = "5.0.0-beta.13";
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 = {
@@ -79,8 +79,8 @@ const scripts = {
79
79
  const dependencies = {
80
80
  "@strapi/design-system": "2.0.0-beta.6",
81
81
  "@strapi/icons": "2.0.0-beta.6",
82
- "@strapi/provider-upload-local": "5.0.0-beta.12",
83
- "@strapi/utils": "5.0.0-beta.12",
82
+ "@strapi/provider-upload-local": "5.0.0-beta.13",
83
+ "@strapi/utils": "5.0.0-beta.13",
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-beta.12",
105
+ "@strapi/admin": "5.0.0-beta.13",
106
106
  "@strapi/pack-up": "5.0.0",
107
- "@strapi/types": "5.0.0-beta.12",
107
+ "@strapi/types": "5.0.0-beta.13",
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",
@@ -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) {
@@ -1562,8 +1563,11 @@ const useRemoveAsset = (onSuccess) => {
1562
1563
  return { ...mutation, removeAsset };
1563
1564
  };
1564
1565
  const RemoveAssetDialog = ({ open, onClose, asset }) => {
1565
- const { removeAsset } = useRemoveAsset(() => onClose(null));
1566
- const handleConfirm = async () => {
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
1573
  return /* @__PURE__ */ jsx(Dialog.Root, { open, onOpenChange: onClose, children: /* @__PURE__ */ jsx(ConfirmDialog, { onConfirm: handleConfirm }) });
@@ -1630,7 +1634,8 @@ const RelativeBox = styled(Box)`
1630
1634
  `;
1631
1635
  const Wrapper$1 = styled.div`
1632
1636
  position: relative;
1633
- text-align: center;
1637
+ display: flex;
1638
+ justify-content: center;
1634
1639
  background: repeating-conic-gradient(
1635
1640
  ${({ theme }) => theme.colors.neutral100} 0% 25%,
1636
1641
  transparent 0% 50%
@@ -1675,6 +1680,7 @@ const UploadProgressWrapper$1 = styled.div`
1675
1680
  `;
1676
1681
  const CroppingActions = ({ onCancel, onValidate, onDuplicate }) => {
1677
1682
  const { formatMessage } = useIntl();
1683
+ const theme = useTheme();
1678
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: [
1679
1685
  /* @__PURE__ */ jsx(
1680
1686
  IconButton,
@@ -1710,7 +1716,7 @@ const CroppingActions = ({ onCancel, onValidate, onDuplicate }) => {
1710
1716
  )
1711
1717
  }
1712
1718
  ),
1713
- /* @__PURE__ */ jsxs(Menu.Content, { zIndex: 5, children: [
1719
+ /* @__PURE__ */ jsxs(Menu.Content, { zIndex: theme.zIndices.dialog, children: [
1714
1720
  /* @__PURE__ */ jsx(Menu.Item, { onSelect: onValidate, children: formatMessage({
1715
1721
  id: getTrad("checkControl.crop-original"),
1716
1722
  defaultMessage: "Crop the original asset"
@@ -4830,10 +4836,18 @@ const BrowseStep = ({
4830
4836
  {
4831
4837
  onClick: () => handleClickFolderCard(folder.id, folder.path),
4832
4838
  children: /* @__PURE__ */ jsxs(Flex, { tag: "h2", direction: "column", alignItems: "start", maxWidth: "100%", children: [
4833
- /* @__PURE__ */ jsxs(TypographyMaxWidth, { fontWeight: "semiBold", ellipsis: true, children: [
4834
- folder.name,
4835
- /* @__PURE__ */ jsx(VisuallyHidden, { children: "-" })
4836
- ] }),
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
+ ),
4837
4851
  /* @__PURE__ */ jsx(
4838
4852
  TypographyMaxWidth,
4839
4853
  {
@@ -5125,7 +5139,7 @@ const AssetContent = ({
5125
5139
  id: getTrad("header.actions.add-assets"),
5126
5140
  defaultMessage: "Add new assets"
5127
5141
  }) }) }),
5128
- /* @__PURE__ */ jsxs(Tabs.Root, { variant: "simple", defaultValue: selectedAssets.length > 0 ? "selected" : "browse", children: [
5142
+ /* @__PURE__ */ jsxs(TabsRoot, { variant: "simple", defaultValue: selectedAssets.length > 0 ? "selected" : "browse", children: [
5129
5143
  /* @__PURE__ */ jsxs(Flex, { paddingLeft: 8, paddingRight: 8, paddingTop: 6, justifyContent: "space-between", children: [
5130
5144
  /* @__PURE__ */ jsxs(Tabs.List, { children: [
5131
5145
  /* @__PURE__ */ jsx(Tabs.Trigger, { value: "browse", children: formatMessage({
@@ -5241,6 +5255,11 @@ AssetDialog.propTypes = {
5241
5255
  onValidate: PropTypes.func.isRequired,
5242
5256
  trackedLocation: PropTypes.string
5243
5257
  };
5258
+ const TabsRoot = styled(Tabs.Root)`
5259
+ display: flex;
5260
+ flex-direction: column;
5261
+ overflow: hidden;
5262
+ `;
5244
5263
  const typeFromMime = (mime) => {
5245
5264
  if (mime.includes(AssetType.Image)) {
5246
5265
  return AssetType.Image;
@@ -5724,7 +5743,7 @@ const PendingAssetStep = ({
5724
5743
  onUploadSucceed(file);
5725
5744
  }
5726
5745
  };
5727
- return /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, children: [
5746
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
5728
5747
  /* @__PURE__ */ jsx(Modal.Header, { children: /* @__PURE__ */ jsx(Modal.Title, { children: formatMessage({
5729
5748
  id: getTrad("header.actions.add-assets"),
5730
5749
  defaultMessage: "Add new assets"
@@ -5781,7 +5800,7 @@ const PendingAssetStep = ({
5781
5800
  ] }) }),
5782
5801
  /* @__PURE__ */ jsxs(Modal.Footer, { children: [
5783
5802
  /* @__PURE__ */ jsx(Button, { onClick: onClose, variant: "tertiary", children: formatMessage({ id: "app.components.Button.cancel", defaultMessage: "cancel" }) }),
5784
- /* @__PURE__ */ jsx(Button, { type: "submit", loading: uploadStatus === Status.Uploading, children: formatMessage(
5803
+ /* @__PURE__ */ jsx(Button, { onClick: handleSubmit, loading: uploadStatus === Status.Uploading, children: formatMessage(
5785
5804
  {
5786
5805
  id: getTrad("modal.upload-list.footer.button"),
5787
5806
  defaultMessage: "Upload {number, plural, one {# asset} other {# assets}} to the library"
@@ -5874,16 +5893,16 @@ const UploadAssetDialog = ({
5874
5893
  const nextAssets = assets.filter((asset) => asset !== assetToRemove);
5875
5894
  setAssets(nextAssets);
5876
5895
  };
5877
- return /* @__PURE__ */ jsx(Modal.Root, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs(Modal.Content, { children: [
5878
- 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(
5879
5898
  AddAssetStep,
5880
5899
  {
5881
5900
  onClose,
5882
5901
  onAddAsset: handleAddToPendingAssets,
5883
5902
  trackedLocation
5884
5903
  }
5885
- ),
5886
- step === Steps.PendingAsset && /* @__PURE__ */ jsx(
5904
+ ) }),
5905
+ step === Steps.PendingAsset && /* @__PURE__ */ jsx(Modal.Content, { children: /* @__PURE__ */ jsx(
5887
5906
  PendingAssetStep,
5888
5907
  {
5889
5908
  onClose: handleClose,
@@ -5898,8 +5917,8 @@ const UploadAssetDialog = ({
5898
5917
  folderId,
5899
5918
  trackedLocation
5900
5919
  }
5901
- ),
5902
- assetToEdit && /* @__PURE__ */ jsx(
5920
+ ) }),
5921
+ assetToEdit && /* @__PURE__ */ jsx(Modal.Content, { children: /* @__PURE__ */ jsx(
5903
5922
  EditAssetContent,
5904
5923
  {
5905
5924
  onClose: handleAssetEditValidation,
@@ -5909,8 +5928,8 @@ const UploadAssetDialog = ({
5909
5928
  canDownload: false,
5910
5929
  trackedLocation
5911
5930
  }
5912
- )
5913
- ] }) });
5931
+ ) })
5932
+ ] });
5914
5933
  };
5915
5934
  UploadAssetDialog.defaultProps = {
5916
5935
  addUploadedFiles: void 0,
@@ -6424,7 +6443,7 @@ const MediaLibraryInput = forwardRef(
6424
6443
  trackedLocation: "content-manager"
6425
6444
  }
6426
6445
  ),
6427
- /* @__PURE__ */ jsx(
6446
+ step === STEPS.AssetSelect && /* @__PURE__ */ jsx(
6428
6447
  AssetDialog,
6429
6448
  {
6430
6449
  allowedTypes: fieldAllowedTypes,
@@ -6443,7 +6462,7 @@ const MediaLibraryInput = forwardRef(
6443
6462
  trackedLocation: "content-manager"
6444
6463
  }
6445
6464
  ),
6446
- /* @__PURE__ */ jsx(
6465
+ step === STEPS.AssetUpload && /* @__PURE__ */ jsx(
6447
6466
  UploadAssetDialog,
6448
6467
  {
6449
6468
  open: step === STEPS.AssetUpload,
@@ -6455,7 +6474,7 @@ const MediaLibraryInput = forwardRef(
6455
6474
  validateAssetsTypes
6456
6475
  }
6457
6476
  ),
6458
- /* @__PURE__ */ jsx(
6477
+ step === STEPS.FolderCreate && /* @__PURE__ */ jsx(
6459
6478
  EditFolderDialog,
6460
6479
  {
6461
6480
  open: step === STEPS.FolderCreate,
@@ -6506,7 +6525,7 @@ const index = {
6506
6525
  defaultMessage: "Media Library"
6507
6526
  },
6508
6527
  permissions: PERMISSIONS.main,
6509
- Component: () => import("./index-wlqyHyYN.mjs"),
6528
+ Component: () => import("./index-o2LeT5q_.mjs"),
6510
6529
  position: 4
6511
6530
  });
6512
6531
  app.addSettingsLink("global", {
@@ -6516,7 +6535,7 @@ const index = {
6516
6535
  defaultMessage: "Media Library"
6517
6536
  },
6518
6537
  to: "media-library",
6519
- Component: () => import("./index-fRIsD0zT.mjs"),
6538
+ Component: () => import("./index-0jsm4ag3.mjs"),
6520
6539
  permissions: PERMISSIONS.settings
6521
6540
  });
6522
6541
  app.addFields({ type: "media", Component: MediaLibraryInput });
@@ -6587,4 +6606,4 @@ export {
6587
6606
  FolderCardBodyAction as y,
6588
6607
  AssetGridList as z
6589
6608
  };
6590
- //# sourceMappingURL=index-CXLlwfhh.mjs.map
6609
+ //# sourceMappingURL=index-CMm7ZJTg.mjs.map