sanity-plugin-media 4.0.0 → 4.1.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.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: !0 });
3
- var jsxRuntime = require("react/jsx-runtime"), sanity = require("sanity"), icons = require("@sanity/icons"), ui = require("@sanity/ui"), react = require("react"), groq = require("groq"), reactRedux = require("react-redux"), toolkit = require("@reduxjs/toolkit"), nanoid = require("nanoid"), reduxObservable = require("redux-observable"), rxjs = require("rxjs"), operators$1 = require("rxjs/operators"), uuid = require("@sanity/uuid"), styledComponents = require("styled-components"), pluralize = require("pluralize"), reactNprogress = require("@tanem/react-nprogress"), color = require("@sanity/color"), Select = require("react-select"), reactVirtuoso = require("react-virtuoso"), zod = require("@hookform/resolvers/zod"), reactHookForm = require("react-hook-form"), z = require("zod"), format = require("date-fns/format"), filesize = require("filesize"), copy = require("copy-to-clipboard"), router = require("sanity/router"), reactFileIcon = require("react-file-icon"), CreatableSelect = require("react-select/creatable"), formatRelative = require("date-fns/formatRelative"), reactDropzone = require("react-dropzone");
3
+ var jsxRuntime = require("react/jsx-runtime"), sanity = require("sanity"), icons = require("@sanity/icons"), ui = require("@sanity/ui"), react = require("react"), groq = require("groq"), reactRedux = require("react-redux"), toolkit = require("@reduxjs/toolkit"), nanoid = require("nanoid"), reduxObservable = require("redux-observable"), rxjs = require("rxjs"), operators$1 = require("rxjs/operators"), uuid = require("@sanity/uuid"), styledComponents = require("styled-components"), pluralize = require("pluralize"), reactNprogress = require("@tanem/react-nprogress"), color = require("@sanity/color"), Select = require("react-select"), reactVirtuoso = require("react-virtuoso"), zod = require("@hookform/resolvers/zod"), reactHookForm = require("react-hook-form"), z = require("zod"), dateFns = require("date-fns"), filesize = require("filesize"), copy = require("copy-to-clipboard"), router = require("sanity/router"), reactFileIcon = require("react-file-icon"), CreatableSelect = require("react-select/creatable"), reactDropzone = require("react-dropzone");
4
4
  function _interopDefaultCompat(e) {
5
5
  return e && typeof e == "object" && "default" in e ? e : { default: e };
6
6
  }
@@ -19,7 +19,7 @@ function _interopNamespaceCompat(e) {
19
19
  }
20
20
  }), n.default = e, Object.freeze(n);
21
21
  }
22
- var groq__default = /* @__PURE__ */ _interopDefaultCompat(groq), pluralize__default = /* @__PURE__ */ _interopDefaultCompat(pluralize), Select__default = /* @__PURE__ */ _interopDefaultCompat(Select), z__namespace = /* @__PURE__ */ _interopNamespaceCompat(z), format__default = /* @__PURE__ */ _interopDefaultCompat(format), filesize__default = /* @__PURE__ */ _interopDefaultCompat(filesize), copy__default = /* @__PURE__ */ _interopDefaultCompat(copy), CreatableSelect__default = /* @__PURE__ */ _interopDefaultCompat(CreatableSelect), formatRelative__default = /* @__PURE__ */ _interopDefaultCompat(formatRelative);
22
+ var groq__default = /* @__PURE__ */ _interopDefaultCompat(groq), pluralize__default = /* @__PURE__ */ _interopDefaultCompat(pluralize), Select__default = /* @__PURE__ */ _interopDefaultCompat(Select), z__namespace = /* @__PURE__ */ _interopNamespaceCompat(z), filesize__default = /* @__PURE__ */ _interopDefaultCompat(filesize), copy__default = /* @__PURE__ */ _interopDefaultCompat(copy), CreatableSelect__default = /* @__PURE__ */ _interopDefaultCompat(CreatableSelect);
23
23
  function getDefaultExportFromCjs(x) {
24
24
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x.default : x;
25
25
  }
@@ -1250,7 +1250,9 @@ const UPLOADS_ACTIONS = {
1250
1250
  originalFilename,
1251
1251
  size,
1252
1252
  source {
1253
- name
1253
+ name,
1254
+ id,
1255
+ url,
1254
1256
  },
1255
1257
  title,
1256
1258
  url
@@ -2353,15 +2355,21 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
2353
2355
  let creditLineExcludeSources;
2354
2356
  return options?.creditLine?.excludeSources && (creditLineExcludeSources = Array.isArray(options?.creditLine?.excludeSources) ? options.creditLine.excludeSources : [options?.creditLine?.excludeSources]), {
2355
2357
  dropzone: { maxSize: options?.maximumUploadSize },
2358
+ components: {
2359
+ details: options?.components?.details
2360
+ },
2356
2361
  creditLine: {
2357
2362
  enabled: options?.creditLine?.enabled || !1,
2358
2363
  excludeSources: creditLineExcludeSources
2359
- }
2364
+ },
2365
+ directUploads: options?.directUploads ?? !0
2360
2366
  };
2361
2367
  }, [
2362
2368
  options?.creditLine?.enabled,
2369
+ options?.components,
2363
2370
  options?.creditLine?.excludeSources,
2364
- options?.maximumUploadSize
2371
+ options?.maximumUploadSize,
2372
+ options?.directUploads
2365
2373
  ]);
2366
2374
  return /* @__PURE__ */ jsxRuntime.jsx(ToolOptionsContext.Provider, { value, children });
2367
2375
  }, useToolOptions = () => {
@@ -2760,7 +2768,7 @@ const imageDprUrl = (asset, options) => {
2760
2768
  Row,
2761
2769
  {
2762
2770
  label: "Original date",
2763
- value: format__default.default(new Date(exif.DateTimeOriginal), "PPp")
2771
+ value: dateFns.format(new Date(exif.DateTimeOriginal), "PPp")
2764
2772
  }
2765
2773
  )
2766
2774
  ] }) })
@@ -2820,7 +2828,51 @@ const imageDprUrl = (asset, options) => {
2820
2828
  }
2821
2829
  }
2822
2830
  ) : /* @__PURE__ */ jsxRuntime.jsx(FileIcon, { extension: asset.extension, width: "50%" });
2823
- }, { radius: themeRadius, space: themeSpace } = ui.studioTheme, reactSelectStyles = (scheme) => ({
2831
+ }, FormSubmitButton = (props) => {
2832
+ const { disabled, isValid, lastUpdated, onClick } = props;
2833
+ let content;
2834
+ return isValid ? lastUpdated ? content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2835
+ "Last updated",
2836
+ /* @__PURE__ */ jsxRuntime.jsx("br", {}),
2837
+ " ",
2838
+ dateFns.format(new Date(lastUpdated), "PPp")
2839
+ ] }) : content = "No unpublished changes" : content = "There are validation errors that need to be fixed before this document can be published", /* @__PURE__ */ jsxRuntime.jsx(
2840
+ ui.Tooltip,
2841
+ {
2842
+ animate: !0,
2843
+ content: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 3, style: { maxWidth: "185px" }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: content }) }),
2844
+ disabled: "ontouchstart" in window,
2845
+ placement: "top",
2846
+ portal: !0,
2847
+ children: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(
2848
+ ui.Button,
2849
+ {
2850
+ disabled,
2851
+ fontSize: 1,
2852
+ onClick,
2853
+ text: "Save and close",
2854
+ tone: "primary"
2855
+ }
2856
+ ) })
2857
+ }
2858
+ );
2859
+ }, Image$1 = styledComponents.styled.img`
2860
+ --checkerboard-color: ${(props) => props.$scheme ? getSchemeColor(props.$scheme, "bg2") : "inherit"};
2861
+
2862
+ display: block;
2863
+ width: 100%;
2864
+ height: 100%;
2865
+ object-fit: contain;
2866
+
2867
+ ${(props) => props.$showCheckerboard && styledComponents.css`
2868
+ background-image: linear-gradient(45deg, var(--checkerboard-color) 25%, transparent 25%),
2869
+ linear-gradient(-45deg, var(--checkerboard-color) 25%, transparent 25%),
2870
+ linear-gradient(45deg, transparent 75%, var(--checkerboard-color) 75%),
2871
+ linear-gradient(-45deg, transparent 75%, var(--checkerboard-color) 75%);
2872
+ background-size: 20px 20px;
2873
+ background-position: 0 0, 0 10px, 10px -10px, -10px 0;
2874
+ `}
2875
+ `, { radius: themeRadius, space: themeSpace } = ui.studioTheme, reactSelectStyles = (scheme) => ({
2824
2876
  control: (styles, { isFocused }) => {
2825
2877
  let boxShadow = "inset 0 0 0 1px var(--card-border-color)";
2826
2878
  return isFocused && (boxShadow = `inset 0 0 0 1px ${getSchemeColor(scheme, "inputEnabledBorder")},
@@ -3044,55 +3096,99 @@ const imageDprUrl = (asset, options) => {
3044
3096
  }
3045
3097
  )
3046
3098
  ] });
3047
- }), FormSubmitButton = (props) => {
3048
- const { disabled, isValid, lastUpdated, onClick } = props;
3049
- let content;
3050
- return isValid ? lastUpdated ? content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3051
- "Last updated",
3052
- /* @__PURE__ */ jsxRuntime.jsx("br", {}),
3053
- " ",
3054
- format__default.default(new Date(lastUpdated), "PPp")
3055
- ] }) : content = "No unpublished changes" : content = "There are validation errors that need to be fixed before this document can be published", /* @__PURE__ */ jsxRuntime.jsx(
3056
- ui.Tooltip,
3057
- {
3058
- animate: !0,
3059
- content: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 3, style: { maxWidth: "185px" }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: content }) }),
3060
- disabled: "ontouchstart" in window,
3061
- placement: "top",
3062
- portal: !0,
3063
- children: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(
3064
- ui.Button,
3065
- {
3066
- disabled,
3067
- fontSize: 1,
3068
- onClick,
3069
- text: "Save and close",
3070
- tone: "primary"
3071
- }
3072
- ) })
3073
- }
3074
- );
3075
- }, Image$1 = styledComponents.styled.img`
3076
- --checkerboard-color: ${(props) => props.$scheme ? getSchemeColor(props.$scheme, "bg2") : "inherit"};
3077
-
3078
- display: block;
3079
- width: 100%;
3080
- height: 100%;
3081
- object-fit: contain;
3082
-
3083
- ${(props) => props.$showCheckerboard && styledComponents.css`
3084
- background-image: linear-gradient(45deg, var(--checkerboard-color) 25%, transparent 25%),
3085
- linear-gradient(-45deg, var(--checkerboard-color) 25%, transparent 25%),
3086
- linear-gradient(45deg, transparent 75%, var(--checkerboard-color) 75%),
3087
- linear-gradient(-45deg, transparent 75%, var(--checkerboard-color) 75%);
3088
- background-size: 20px 20px;
3089
- background-position: 0 0, 0 10px, 10px -10px, -10px 0;
3090
- `}
3091
- `, DialogAssetEdit = (props) => {
3099
+ });
3100
+ function Details({
3101
+ formUpdating,
3102
+ handleCreateTag,
3103
+ control,
3104
+ errors,
3105
+ register,
3106
+ allTagOptions,
3107
+ assetTagOptions,
3108
+ currentAsset,
3109
+ creditLine
3110
+ }) {
3111
+ return /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
3112
+ /* @__PURE__ */ jsxRuntime.jsx(
3113
+ FormFieldInputTags,
3114
+ {
3115
+ control,
3116
+ disabled: formUpdating,
3117
+ error: errors?.opt?.media?.tags?.message,
3118
+ label: "Tags",
3119
+ name: "opt.media.tags",
3120
+ onCreateTag: handleCreateTag,
3121
+ options: allTagOptions,
3122
+ placeholder: "Select or create...",
3123
+ value: assetTagOptions
3124
+ }
3125
+ ),
3126
+ /* @__PURE__ */ jsxRuntime.jsx(
3127
+ FormFieldInputText,
3128
+ {
3129
+ ...register("originalFilename"),
3130
+ disabled: formUpdating,
3131
+ error: errors?.originalFilename?.message,
3132
+ label: "Filename",
3133
+ name: "originalFilename",
3134
+ value: currentAsset?.originalFilename
3135
+ }
3136
+ ),
3137
+ /* @__PURE__ */ jsxRuntime.jsx(
3138
+ FormFieldInputText,
3139
+ {
3140
+ ...register("title"),
3141
+ disabled: formUpdating,
3142
+ error: errors?.title?.message,
3143
+ label: "Title",
3144
+ name: "title",
3145
+ value: currentAsset?.title
3146
+ }
3147
+ ),
3148
+ /* @__PURE__ */ jsxRuntime.jsx(
3149
+ FormFieldInputText,
3150
+ {
3151
+ ...register("altText"),
3152
+ disabled: formUpdating,
3153
+ error: errors?.altText?.message,
3154
+ label: "Alt Text",
3155
+ name: "altText",
3156
+ value: currentAsset?.altText
3157
+ }
3158
+ ),
3159
+ /* @__PURE__ */ jsxRuntime.jsx(
3160
+ FormFieldInputTextarea,
3161
+ {
3162
+ ...register("description"),
3163
+ disabled: formUpdating,
3164
+ error: errors?.description?.message,
3165
+ label: "Description",
3166
+ name: "description",
3167
+ rows: 5,
3168
+ value: currentAsset?.description
3169
+ }
3170
+ ),
3171
+ creditLine?.enabled && /* @__PURE__ */ jsxRuntime.jsx(
3172
+ FormFieldInputText,
3173
+ {
3174
+ ...register("creditLine"),
3175
+ error: errors?.creditLine?.message,
3176
+ label: "Credit",
3177
+ name: "creditLine",
3178
+ value: currentAsset?.creditLine,
3179
+ disabled: formUpdating || creditLine?.excludeSources?.includes(currentAsset?.source?.name)
3180
+ }
3181
+ )
3182
+ ] });
3183
+ }
3184
+ function renderDefaultDetails(props) {
3185
+ return /* @__PURE__ */ jsxRuntime.jsx(Details, { ...props });
3186
+ }
3187
+ const DialogAssetEdit = (props) => {
3092
3188
  const {
3093
3189
  children,
3094
3190
  dialog: { assetId, id, lastCreatedTag, lastRemovedTagIds }
3095
- } = props, client = useVersionedClient(), scheme = sanity.useColorSchemeValue(), documentStore = sanity.useDocumentStore(), dispatch = reactRedux.useDispatch(), assetItem = useTypedSelector((state) => selectAssetById(state, String(assetId))), tags = useTypedSelector(selectTags), assetUpdatedPrev = react.useRef(void 0), [assetSnapshot, setAssetSnapshot] = react.useState(assetItem?.asset), [tabSection, setTabSection] = react.useState("details"), currentAsset = assetItem ? assetItem?.asset : assetSnapshot, allTagOptions = getTagSelectOptions(tags), assetTagOptions = useTypedSelector(selectTagSelectOptions(currentAsset)), { creditLine } = useToolOptions(), generateDefaultValues = react.useCallback(
3191
+ } = props, client = useVersionedClient(), scheme = sanity.useColorSchemeValue(), documentStore = sanity.useDocumentStore(), dispatch = reactRedux.useDispatch(), assetItem = useTypedSelector((state) => selectAssetById(state, String(assetId))), tags = useTypedSelector(selectTags), assetUpdatedPrev = react.useRef(void 0), [assetSnapshot, setAssetSnapshot] = react.useState(assetItem?.asset), [tabSection, setTabSection] = react.useState("details"), currentAsset = assetItem ? assetItem?.asset : assetSnapshot, allTagOptions = getTagSelectOptions(tags), assetTagOptions = useTypedSelector(selectTagSelectOptions(currentAsset)), { creditLine, components: { details: CustomDetails } = {} } = useToolOptions(), generateDefaultValues = react.useCallback(
3096
3192
  (asset) => ({
3097
3193
  altText: asset?.altText || "",
3098
3194
  creditLine: asset?.creditLine || "",
@@ -3207,7 +3303,21 @@ const imageDprUrl = (asset, options) => {
3207
3303
  }
3208
3304
  )
3209
3305
  ] }) });
3210
- return currentAsset ? /* @__PURE__ */ jsxRuntime.jsxs(
3306
+ if (!currentAsset)
3307
+ return null;
3308
+ const detailsProps = {
3309
+ control,
3310
+ errors,
3311
+ formUpdating,
3312
+ register,
3313
+ setValue,
3314
+ assetTagOptions,
3315
+ allTagOptions,
3316
+ handleCreateTag,
3317
+ currentAsset,
3318
+ creditLine
3319
+ };
3320
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3211
3321
  Dialog,
3212
3322
  {
3213
3323
  animate: !0,
@@ -3256,78 +3366,13 @@ const imageDprUrl = (asset, options) => {
3256
3366
  "aria-labelledby": "details",
3257
3367
  hidden: tabSection !== "details",
3258
3368
  id: "details-panel",
3259
- children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
3260
- /* @__PURE__ */ jsxRuntime.jsx(
3261
- FormFieldInputTags,
3262
- {
3263
- control,
3264
- disabled: formUpdating,
3265
- error: errors?.opt?.media?.tags?.message,
3266
- label: "Tags",
3267
- name: "opt.media.tags",
3268
- onCreateTag: handleCreateTag,
3269
- options: allTagOptions,
3270
- placeholder: "Select or create...",
3271
- value: assetTagOptions
3272
- }
3273
- ),
3274
- /* @__PURE__ */ jsxRuntime.jsx(
3275
- FormFieldInputText,
3276
- {
3277
- ...register("originalFilename"),
3278
- disabled: formUpdating,
3279
- error: errors?.originalFilename?.message,
3280
- label: "Filename",
3281
- name: "originalFilename",
3282
- value: currentAsset?.originalFilename
3283
- }
3284
- ),
3285
- /* @__PURE__ */ jsxRuntime.jsx(
3286
- FormFieldInputText,
3287
- {
3288
- ...register("title"),
3289
- disabled: formUpdating,
3290
- error: errors?.title?.message,
3291
- label: "Title",
3292
- name: "title",
3293
- value: currentAsset?.title
3294
- }
3295
- ),
3296
- /* @__PURE__ */ jsxRuntime.jsx(
3297
- FormFieldInputText,
3298
- {
3299
- ...register("altText"),
3300
- disabled: formUpdating,
3301
- error: errors?.altText?.message,
3302
- label: "Alt Text",
3303
- name: "altText",
3304
- value: currentAsset?.altText
3305
- }
3306
- ),
3307
- /* @__PURE__ */ jsxRuntime.jsx(
3308
- FormFieldInputTextarea,
3309
- {
3310
- ...register("description"),
3311
- disabled: formUpdating,
3312
- error: errors?.description?.message,
3313
- label: "Description",
3314
- name: "description",
3315
- rows: 5,
3316
- value: currentAsset?.description
3317
- }
3318
- ),
3319
- creditLine?.enabled && /* @__PURE__ */ jsxRuntime.jsx(
3320
- FormFieldInputText,
3321
- {
3322
- ...register("creditLine"),
3323
- error: errors?.creditLine?.message,
3324
- label: "Credit",
3325
- name: "creditLine",
3326
- value: currentAsset?.creditLine,
3327
- disabled: formUpdating || creditLine?.excludeSources?.includes(currentAsset?.source?.name)
3328
- }
3329
- )
3330
- ] })
3369
+ children: CustomDetails ? /* @__PURE__ */ jsxRuntime.jsx(
3370
+ CustomDetails,
3371
+ {
3372
+ ...detailsProps,
3373
+ renderDefaultDetails
3374
+ }
3375
+ ) : /* @__PURE__ */ jsxRuntime.jsx(Details, { ...detailsProps })
3331
3376
  }
3332
3377
  ),
3333
3378
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -3367,7 +3412,7 @@ const imageDprUrl = (asset, options) => {
3367
3412
  children
3368
3413
  ]
3369
3414
  }
3370
- ) : null;
3415
+ );
3371
3416
  }, DialogConfirm = (props) => {
3372
3417
  const { children, dialog } = props, dispatch = reactRedux.useDispatch(), handleClose = () => {
3373
3418
  dispatch(dialogActions.remove({ id: dialog?.id }));
@@ -3856,7 +3901,7 @@ const imageDprUrl = (asset, options) => {
3856
3901
  throw new Error("useDropzoneActions must be used within an DropzoneDispatchProvider");
3857
3902
  return context;
3858
3903
  }, Header = (props) => {
3859
- const { onClose } = props, { open } = useDropzoneActions(), { onSelect } = useAssetSourceActions(), assetTypes = useTypedSelector((state) => state.assets.assetTypes), selectedDocument = useTypedSelector((state) => state.selected.document);
3904
+ const { onClose } = props, { open } = useDropzoneActions(), { onSelect } = useAssetSourceActions(), assetTypes = useTypedSelector((state) => state.assets.assetTypes), selectedDocument = useTypedSelector((state) => state.selected.document), { directUploads } = useToolOptions();
3860
3905
  return /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingY: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", justify: "space-between", children: [
3861
3906
  /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, marginX: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Inline, { style: { whiteSpace: "nowrap" }, children: [
3862
3907
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { textOverflow: "ellipsis", weight: "semibold", children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: onSelect ? `Insert ${assetTypes.join(" or ")}` : "Browse Assets" }) }),
@@ -3866,15 +3911,14 @@ const imageDprUrl = (asset, options) => {
3866
3911
  ] }) })
3867
3912
  ] }) }),
3868
3913
  /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { marginX: 2, children: [
3869
- /* @__PURE__ */ jsxRuntime.jsx(
3914
+ directUploads && /* @__PURE__ */ jsxRuntime.jsx(
3870
3915
  ui.Button,
3871
3916
  {
3872
3917
  fontSize: 1,
3873
3918
  icon: icons.UploadIcon,
3874
3919
  mode: "bleed",
3875
3920
  onClick: open,
3876
- text: `Upload ${assetTypes.length === 1 ? pluralize__default.default(assetTypes[0]) : "assets"}`,
3877
- tone: "primary"
3921
+ text: `Upload ${assetTypes.length === 1 ? pluralize__default.default(assetTypes[0]) : "assets"}`
3878
3922
  }
3879
3923
  ),
3880
3924
  onClose && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { style: { flexShrink: 0 }, children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -4798,7 +4842,7 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4798
4842
  gridRow: mediaIndex < 3 ? 4 : "auto",
4799
4843
  opacity: opacityCell
4800
4844
  },
4801
- children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, style: { lineHeight: "2em" }, textOverflow: "ellipsis", children: formatRelative__default.default(new Date(asset._updatedAt), /* @__PURE__ */ new Date()) })
4845
+ children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, style: { lineHeight: "2em" }, textOverflow: "ellipsis", children: dateFns.formatRelative(new Date(asset._updatedAt), /* @__PURE__ */ new Date()) })
4802
4846
  }
4803
4847
  ),
4804
4848
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -5342,7 +5386,8 @@ async function filterFiles(fileList) {
5342
5386
  }
5343
5387
  const UploadDropzone = (props) => {
5344
5388
  const { children } = props, {
5345
- dropzone: { maxSize }
5389
+ dropzone: { maxSize },
5390
+ directUploads
5346
5391
  } = useToolOptions(), { onSelect } = useAssetSourceActions(), dispatch = reactRedux.useDispatch(), assetTypes = useTypedSelector((state) => state.assets.assetTypes), isImageAssetType = assetTypes.length === 1 && assetTypes[0] === "image", handleDrop = async (acceptedFiles) => {
5347
5392
  acceptedFiles.forEach(
5348
5393
  (file) => dispatch(
@@ -5383,7 +5428,8 @@ const UploadDropzone = (props) => {
5383
5428
  noDrag: !!onSelect,
5384
5429
  onDrop: handleDrop,
5385
5430
  maxSize,
5386
- onDropRejected: handleDropRejected
5431
+ onDropRejected: handleDropRejected,
5432
+ disabled: !directUploads
5387
5433
  });
5388
5434
  return /* @__PURE__ */ jsxRuntime.jsx(DropzoneDispatchProvider, { open, children: /* @__PURE__ */ jsxRuntime.jsxs(UploadContainer, { ...getRootProps(), children: [
5389
5435
  /* @__PURE__ */ jsxRuntime.jsx("input", { ...getInputProps() }),