@electrolux-oss/sanity-plugin-media 4.1.0 → 5.0.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/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { useClient, useSchema, Preview, useColorSchemeValue, useDocumentStore, WithReferringDocuments, useCurrentUser, useFormValue, definePlugin } from "sanity";
2
+ import { useClient, useSchema, Preview, useColorSchemeValue, useDocumentStore, WithReferringDocuments, useCurrentUser, useFormValue, defineType, defineField, definePlugin } from "sanity";
3
3
  import { forwardRef, createContext, useContext, useState, useEffect, useMemo, useRef, useCallback, memo } from "react";
4
- import { usePortal, Popover, Button, Text, Box, Stack, Inline, Flex, Dialog as Dialog$1, Card, Tooltip, TextInput, studioTheme, rem, TextArea, TabList, Tab, TabPanel, Label, MenuButton, Menu as Menu$2, MenuItem, MenuDivider, MenuGroup, Container as Container$2, useToast, PortalProvider, useMediaIndex, Switch, Spinner, Checkbox, Grid, useLayer, Portal } from "@sanity/ui";
4
+ import { usePortal, Button, Text, Box, Stack, Inline, Flex, Dialog as Dialog$1, Card, TextInput, useTheme_v2, rem, TextArea, TabList, Tab, TabPanel, Label, Container as Container$2, PortalProvider, useMediaIndex, Switch, Spinner, Checkbox, Grid, useLayer, Portal } from "@sanity/ui";
5
5
  import { useSelector, useDispatch, Provider } from "react-redux";
6
6
  import groq from "groq";
7
7
  import { nanoid } from "nanoid";
@@ -17,13 +17,18 @@ import { zodResolver } from "@hookform/resolvers/zod";
17
17
  import * as z from "zod";
18
18
  import { format, formatRelative } from "date-fns";
19
19
  import filesize from "filesize";
20
+ import { Popover } from "@sanity/ui/popover";
20
21
  import copy from "copy-to-clipboard";
21
22
  import { useIntentLink } from "sanity/router";
23
+ import { getTheme_v2 } from "@sanity/ui/theme";
22
24
  import { FileIcon as FileIcon$1, defaultStyles } from "react-file-icon";
25
+ import { Tooltip } from "@sanity/ui/tooltip";
23
26
  import { hues, white } from "@sanity/color";
24
27
  import CreatableSelect from "react-select/creatable";
25
28
  import Select, { components } from "react-select";
26
29
  import { Virtuoso, VirtuosoGrid, GroupedVirtuoso } from "react-virtuoso";
30
+ import { MenuButton, Menu as Menu$2, MenuItem, MenuDivider, MenuGroup } from "@sanity/ui/menu";
31
+ import { useToast } from "@sanity/ui/toast";
27
32
  import { isHotkey } from "is-hotkey-esm";
28
33
  import { useNProgress } from "@tanem/react-nprogress";
29
34
  import { useDropzone } from "react-dropzone";
@@ -460,7 +465,7 @@ const EditIcon = /* @__PURE__ */ forwardRef(function(props, ref) {
460
465
  ], GRID_TEMPLATE_COLUMNS = {
461
466
  SMALL: "3rem 100px auto 1.5rem",
462
467
  LARGE: "3rem 100px auto 5.5rem 5.5rem 3.5rem 8.5rem 4.75rem 2rem"
463
- }, PANEL_HEIGHT = 32, TAG_DOCUMENT_NAME = "media.tag", TAGS_PANEL_WIDTH = 250, debugThrottle = (throttled) => function(source) {
468
+ }, EDIT_MEDIA_SOURCE_NAME = "edit-media", PANEL_HEIGHT = 32, TAG_DOCUMENT_NAME = "media.tag", TAGS_PANEL_WIDTH = 250, debugThrottle = (throttled) => function(source) {
464
469
  return iif(
465
470
  () => !!throttled,
466
471
  source.pipe(
@@ -1760,27 +1765,19 @@ const customScrollbar = css`
1760
1765
  throw new Error("useToolOptions must be used within an ToolOptionsProvider");
1761
1766
  return context;
1762
1767
  }, tagOptionSchema = z.object({
1763
- label: z.string().trim().min(1, { message: "Label cannot be empty" }),
1764
- value: z.string().trim().min(1, { message: "Value cannot be empty" })
1768
+ label: z.string().trim().min(1, { error: "Label cannot be empty" }),
1769
+ value: z.string().trim().min(1, { error: "Value cannot be empty" })
1765
1770
  }), tagFormSchema = z.object({
1766
- name: z.string().min(1, { message: "Name cannot be empty" })
1767
- }), createAssetFormSchema = (languages, validateAltTexts = !1) => {
1771
+ name: z.string().min(1, { error: "Name cannot be empty" })
1772
+ }), hasText = (text) => !!text?.trim(), createAssetFormSchema = (languages, validateAltTexts = !1) => {
1768
1773
  const defaultLanguage = languages.find((lang) => lang.default), createAltTextsSchema = () => {
1769
- const baseSchema = z.record(z.string().nullable());
1770
- return validateAltTexts ? baseSchema.refine(
1771
- (altTexts) => {
1772
- if (defaultLanguage) {
1773
- const defaultText = altTexts[defaultLanguage.code];
1774
- return defaultText != null && defaultText.trim().length > 0;
1775
- }
1776
- return Object.values(altTexts).some(
1777
- (text) => text != null && text.trim().length > 0
1778
- );
1779
- },
1780
- {
1781
- message: 'The default language must have alt text. Please fill in the default language field and click "Save and close".'
1782
- }
1783
- ) : baseSchema;
1774
+ const baseSchema = z.record(z.string(), z.string().nullish());
1775
+ return validateAltTexts ? defaultLanguage ? baseSchema.refine((altTexts) => hasText(altTexts[defaultLanguage.code]), {
1776
+ error: `Alt text is required for the default language (${defaultLanguage.title}).`,
1777
+ path: [defaultLanguage.code]
1778
+ }) : baseSchema.refine((altTexts) => Object.values(altTexts).some(hasText), {
1779
+ error: "At least one language must have alt text."
1780
+ }) : baseSchema;
1784
1781
  };
1785
1782
  return z.object({
1786
1783
  altText: z.string().trim().optional(),
@@ -1792,7 +1789,7 @@ const customScrollbar = css`
1792
1789
  tags: z.array(tagOptionSchema).nullable()
1793
1790
  })
1794
1791
  }),
1795
- originalFilename: z.string().trim().min(1, { message: "Filename cannot be empty" }),
1792
+ originalFilename: z.string().trim().min(1, { error: "Filename cannot be empty" }),
1796
1793
  title: z.string().trim().optional()
1797
1794
  });
1798
1795
  };
@@ -1993,7 +1990,7 @@ const ButtonAssetCopy = ({ disabled, url }) => {
1993
1990
  window.location.href = `${asset.url}?dl=${asset.originalFilename}`;
1994
1991
  };
1995
1992
  return /* @__PURE__ */ jsxs(Box, { marginTop: 3, children: [
1996
- /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
1993
+ /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Stack, { gap: 3, children: [
1997
1994
  /* @__PURE__ */ jsx(Row, { label: "Size", value: filesize(asset?.size, { base: 10, round: 0 }) }),
1998
1995
  /* @__PURE__ */ jsx(Row, { label: "MIME type", value: asset?.mimeType }),
1999
1996
  /* @__PURE__ */ jsx(Row, { label: "Extension", value: asset?.extension?.toUpperCase() }),
@@ -2014,7 +2011,7 @@ const ButtonAssetCopy = ({ disabled, url }) => {
2014
2011
  }
2015
2012
  }
2016
2013
  ),
2017
- /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
2014
+ /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Stack, { gap: 3, children: [
2018
2015
  exif.ISO && /* @__PURE__ */ jsx(Row, { label: "ISO", value: exif.ISO }),
2019
2016
  exif.FNumber && /* @__PURE__ */ jsx(Row, { label: "Aperture", value: `\u0192/${exif.FNumber}` }),
2020
2017
  exif.FocalLength && /* @__PURE__ */ jsx(Row, { label: "Focal length", value: `${exif.FocalLength}mm` }),
@@ -2028,7 +2025,7 @@ const ButtonAssetCopy = ({ disabled, url }) => {
2028
2025
  )
2029
2026
  ] }) })
2030
2027
  ] }),
2031
- /* @__PURE__ */ jsx(Box, { marginTop: 5, children: /* @__PURE__ */ jsxs(Inline, { space: 2, children: [
2028
+ /* @__PURE__ */ jsx(Box, { marginTop: 5, children: /* @__PURE__ */ jsxs(Inline, { gap: 2, children: [
2032
2029
  /* @__PURE__ */ jsx(
2033
2030
  Button,
2034
2031
  {
@@ -2045,7 +2042,7 @@ const ButtonAssetCopy = ({ disabled, url }) => {
2045
2042
  ] });
2046
2043
  }, Dialog = (props) => /* @__PURE__ */ jsx(Dialog$1, { ...props, style: { position: "fixed" } }), DocumentList = ({ documents, isLoading }) => {
2047
2044
  const schema = useSchema();
2048
- return isLoading ? /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: "Loading..." }) : documents.length === 0 ? /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: "No documents are referencing this asset" }) : /* @__PURE__ */ jsx(Card, { flex: 1, marginBottom: 2, padding: 2, radius: 2, shadow: 1, children: /* @__PURE__ */ jsx(Stack, { space: 2, children: documents?.map((doc) => /* @__PURE__ */ jsx(ReferringDocument, { doc, schemaType: schema.get(doc._type) }, doc._id)) }) });
2045
+ return isLoading ? /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: "Loading..." }) : documents.length === 0 ? /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: "No documents are referencing this asset" }) : /* @__PURE__ */ jsx(Card, { flex: 1, marginBottom: 2, padding: 2, radius: 2, shadow: 1, children: /* @__PURE__ */ jsx(Stack, { gap: 2, children: documents?.map((doc) => /* @__PURE__ */ jsx(ReferringDocument, { doc, schemaType: schema.get(doc._type) }, doc._id)) }) });
2049
2046
  }, ReferringDocument = (props) => {
2050
2047
  const { doc, schemaType } = props, { onClick } = useIntentLink({
2051
2048
  intent: "edit",
@@ -2057,7 +2054,7 @@ const ButtonAssetCopy = ({ disabled, url }) => {
2057
2054
  ] }) });
2058
2055
  }, Container$1 = styled(Box)(({ theme }) => css`
2059
2056
  text {
2060
- font-family: ${theme.sanity.fonts.text.family} !important;
2057
+ font-family: ${getTheme_v2(theme).font.text.family} !important;
2061
2058
  font-size: 8px !important;
2062
2059
  font-weight: 500 !important;
2063
2060
  }
@@ -2101,11 +2098,11 @@ const ButtonAssetCopy = ({ disabled, url }) => {
2101
2098
  })
2102
2099
  });
2103
2100
  }), StyledErrorOutlineIcon = styled(ErrorOutlineIcon)(({ theme }) => ({
2104
- color: theme.sanity.color.spot.red
2101
+ color: getTheme_v2(theme).color.avatar.red.bg
2105
2102
  })), FormFieldInputLabel = (props) => {
2106
2103
  const { description, error, label, name } = props;
2107
2104
  return /* @__PURE__ */ jsxs(Fragment, { children: [
2108
- /* @__PURE__ */ jsx(Box, { marginY: 3, children: /* @__PURE__ */ jsxs(Inline, { space: 2, children: [
2105
+ /* @__PURE__ */ jsx(Box, { marginY: 3, children: /* @__PURE__ */ jsxs(Inline, { gap: 2, children: [
2109
2106
  /* @__PURE__ */ jsx(Text, { as: "label", htmlFor: name, size: 1, weight: "semibold", children: label }),
2110
2107
  error && /* @__PURE__ */ jsx(Text, { size: 1, children: /* @__PURE__ */ jsx(
2111
2108
  Tooltip,
@@ -2134,6 +2131,7 @@ const ButtonAssetCopy = ({ disabled, url }) => {
2134
2131
  ...rest,
2135
2132
  autoComplete: "off",
2136
2133
  autoFocus: !0,
2134
+ customValidity: error,
2137
2135
  defaultValue: value,
2138
2136
  disabled,
2139
2137
  id: name,
@@ -2179,30 +2177,6 @@ const ButtonAssetCopy = ({ disabled, url }) => {
2179
2177
  bg2: {
2180
2178
  dark: hues.gray[900].hex,
2181
2179
  light: hues.gray[100].hex
2182
- },
2183
- inputEnabledBorder: {
2184
- dark: studioTheme.color.dark.default.input.default.enabled.border,
2185
- light: studioTheme.color.light.default.input.default.enabled.border
2186
- },
2187
- inputHoveredBorder: {
2188
- dark: studioTheme.color.dark.default.input.default.hovered.border,
2189
- light: studioTheme.color.light.default.input.default.hovered.border
2190
- },
2191
- mutedHoveredBg: {
2192
- dark: studioTheme.color.dark.primary.muted.primary.hovered.bg,
2193
- light: studioTheme.color.light.primary.muted.primary.hovered.bg
2194
- },
2195
- mutedHoveredFg: {
2196
- dark: studioTheme.color.dark.primary.muted.primary.hovered.fg,
2197
- light: studioTheme.color.light.primary.muted.primary.hovered.fg
2198
- },
2199
- mutedSelectedBg: {
2200
- dark: studioTheme.color.dark.primary.muted.primary.selected.bg,
2201
- light: studioTheme.color.light.primary.muted.primary.selected.bg
2202
- },
2203
- spotBlue: {
2204
- dark: studioTheme.color.dark.primary.spot.blue,
2205
- light: studioTheme.color.light.primary.spot.blue
2206
2180
  }
2207
2181
  };
2208
2182
  function getSchemeColor(scheme, colorKey) {
@@ -2275,87 +2249,90 @@ const Image$1 = styled.img`
2275
2249
  strokeLinejoin: "round"
2276
2250
  })
2277
2251
  });
2278
- }), { radius: themeRadius$1, space: themeSpace$1 } = studioTheme, reactSelectStyles$1 = (scheme) => ({
2279
- control: (styles, { isFocused }) => {
2280
- let boxShadow = "inset 0 0 0 1px var(--card-border-color)";
2281
- return isFocused && (boxShadow = `inset 0 0 0 1px ${getSchemeColor(scheme, "inputEnabledBorder")},
2252
+ }), useReactSelectStyles$1 = () => {
2253
+ const scheme = useColorSchemeValue(), { color, font, radius, space } = useTheme_v2();
2254
+ return {
2255
+ control: (styles, { isFocused }) => {
2256
+ let boxShadow = "inset 0 0 0 1px var(--card-border-color)";
2257
+ return isFocused && (boxShadow = `inset 0 0 0 1px ${color.input.default.enabled.border},
2282
2258
  0 0 0 1px var(--card-bg-color),
2283
2259
  0 0 0 3px var(--card-focus-ring-color) !important`), {
2260
+ ...styles,
2261
+ backgroundColor: "var(--card-bg-color)",
2262
+ color: "inherit",
2263
+ border: "none",
2264
+ borderRadius: radius[1],
2265
+ boxShadow,
2266
+ margin: 0,
2267
+ minHeight: "35px",
2268
+ outline: "none",
2269
+ padding: rem(space[1]),
2270
+ transition: "none",
2271
+ "&:hover": {
2272
+ boxShadow: `inset 0 0 0 1px ${color.input.default.hovered.border}`
2273
+ }
2274
+ };
2275
+ },
2276
+ indicatorsContainer: (styles, { isDisabled }) => ({
2284
2277
  ...styles,
2285
- backgroundColor: "var(--card-bg-color)",
2286
- color: "inherit",
2287
- border: "none",
2288
- borderRadius: themeRadius$1[1],
2289
- boxShadow,
2290
- margin: 0,
2291
- minHeight: "35px",
2292
- outline: "none",
2293
- padding: rem(themeSpace$1[1]),
2294
- transition: "none",
2278
+ opacity: isDisabled ? 0.25 : 1
2279
+ }),
2280
+ input: (styles) => ({
2281
+ ...styles,
2282
+ color: "var(--card-fg-color)",
2283
+ fontFamily: font.text.family,
2284
+ marginLeft: rem(space[2])
2285
+ }),
2286
+ menuList: (styles) => ({
2287
+ ...styles
2288
+ }),
2289
+ multiValue: (styles, { isDisabled }) => ({
2290
+ ...styles,
2291
+ backgroundColor: color.button.ghost.primary.hovered.bg,
2292
+ borderRadius: radius[2],
2293
+ opacity: isDisabled ? 0.5 : 1
2294
+ }),
2295
+ multiValueLabel: () => ({
2296
+ color: color.button.ghost.primary.hovered.fg,
2297
+ fontSize: "inherit",
2298
+ padding: 0
2299
+ }),
2300
+ multiValueRemove: (styles) => ({
2301
+ ...styles,
2302
+ borderTopLeftRadius: 0,
2303
+ borderBottomLeftRadius: 0,
2304
+ svg: { color: color.button.ghost.primary.hovered.fg },
2295
2305
  "&:hover": {
2296
- boxShadow: `inset 0 0 0 1px ${getSchemeColor(scheme, "inputHoveredBorder")}`
2306
+ backgroundColor: color.button.ghost.primary.selected.bg
2297
2307
  }
2298
- };
2299
- },
2300
- indicatorsContainer: (styles, { isDisabled }) => ({
2301
- ...styles,
2302
- opacity: isDisabled ? 0.25 : 1
2303
- }),
2304
- input: (styles) => ({
2305
- ...styles,
2306
- color: "var(--card-fg-color)",
2307
- fontFamily: studioTheme.fonts.text.family,
2308
- marginLeft: rem(themeSpace$1[2])
2309
- }),
2310
- menuList: (styles) => ({
2311
- ...styles
2312
- }),
2313
- multiValue: (styles, { isDisabled }) => ({
2314
- ...styles,
2315
- backgroundColor: getSchemeColor(scheme, "mutedHoveredBg"),
2316
- borderRadius: themeRadius$1[2],
2317
- opacity: isDisabled ? 0.5 : 1
2318
- }),
2319
- multiValueLabel: () => ({
2320
- color: getSchemeColor(scheme, "mutedHoveredFg"),
2321
- fontSize: "inherit",
2322
- padding: 0
2323
- }),
2324
- multiValueRemove: (styles) => ({
2325
- ...styles,
2326
- borderTopLeftRadius: 0,
2327
- borderBottomLeftRadius: 0,
2328
- svg: { color: getSchemeColor(scheme, "mutedHoveredFg") },
2329
- "&:hover": {
2330
- backgroundColor: getSchemeColor(scheme, "mutedSelectedBg")
2331
- }
2332
- }),
2333
- noOptionsMessage: (styles) => ({
2334
- ...styles,
2335
- fontFamily: studioTheme.fonts.text.family,
2336
- lineHeight: "1em"
2337
- }),
2338
- option: (styles, { isFocused }) => ({
2339
- ...styles,
2340
- backgroundColor: isFocused ? getSchemeColor(scheme, "spotBlue") : "transparent",
2341
- borderRadius: themeRadius$1[2],
2342
- color: isFocused ? getSchemeColor(scheme, "bg") : "inherit",
2343
- padding: `${rem(themeSpace$1[1])} ${rem(themeSpace$1[2])}`,
2344
- "&:hover": {
2345
- backgroundColor: getSchemeColor(scheme, "spotBlue"),
2346
- color: getSchemeColor(scheme, "bg")
2347
- }
2348
- }),
2349
- placeholder: (styles) => ({
2350
- ...styles,
2351
- marginLeft: rem(themeSpace$1[2])
2352
- }),
2353
- valueContainer: (styles) => ({
2354
- ...styles,
2355
- margin: 0,
2356
- padding: 0
2357
- })
2358
- }), DropdownIndicator = (props) => /* @__PURE__ */ jsx(components.DropdownIndicator, { ...props, children: /* @__PURE__ */ jsx(Box, { paddingX: 2, children: /* @__PURE__ */ jsx(Text, { size: 1, children: /* @__PURE__ */ jsx(ChevronDownIcon, {}) }) }) }), Menu$1 = (props) => /* @__PURE__ */ jsx(components.Menu, { ...props, children: /* @__PURE__ */ jsx(Card, { radius: 1, shadow: 2, children: props.children }) }), MenuList$1 = (props) => {
2308
+ }),
2309
+ noOptionsMessage: (styles) => ({
2310
+ ...styles,
2311
+ fontFamily: font.text.family,
2312
+ lineHeight: "1em"
2313
+ }),
2314
+ option: (styles, { isFocused }) => ({
2315
+ ...styles,
2316
+ backgroundColor: isFocused ? color.avatar.blue.bg : "transparent",
2317
+ borderRadius: radius[2],
2318
+ color: isFocused ? getSchemeColor(scheme, "bg") : "inherit",
2319
+ padding: `${rem(space[1])} ${rem(space[2])}`,
2320
+ "&:hover": {
2321
+ backgroundColor: color.avatar.blue.bg,
2322
+ color: getSchemeColor(scheme, "bg")
2323
+ }
2324
+ }),
2325
+ placeholder: (styles) => ({
2326
+ ...styles,
2327
+ marginLeft: rem(space[2])
2328
+ }),
2329
+ valueContainer: (styles) => ({
2330
+ ...styles,
2331
+ margin: 0,
2332
+ padding: 0
2333
+ })
2334
+ };
2335
+ }, DropdownIndicator = (props) => /* @__PURE__ */ jsx(components.DropdownIndicator, { ...props, children: /* @__PURE__ */ jsx(Box, { paddingX: 2, children: /* @__PURE__ */ jsx(Text, { size: 1, children: /* @__PURE__ */ jsx(ChevronDownIcon, {}) }) }) }), Menu$1 = (props) => /* @__PURE__ */ jsx(components.Menu, { ...props, children: /* @__PURE__ */ jsx(Card, { radius: 1, shadow: 2, children: props.children }) }), MenuList$1 = (props) => {
2359
2336
  const { children } = props, MAX_ROWS = 5, OPTION_HEIGHT = 37;
2360
2337
  if (Array.isArray(children)) {
2361
2338
  const height = children.length > MAX_ROWS ? OPTION_HEIGHT * MAX_ROWS : children.length * OPTION_HEIGHT;
@@ -2396,7 +2373,7 @@ const Image$1 = styled.img`
2396
2373
  options,
2397
2374
  placeholder,
2398
2375
  value
2399
- } = props, scheme = useColorSchemeValue(), creating = useTypedSelector((state) => state.tags.creating), tagsFetching = useTypedSelector((state) => state.tags.fetching);
2376
+ } = props, reactSelectStyles = useReactSelectStyles$1(), creating = useTypedSelector((state) => state.tags.creating), tagsFetching = useTypedSelector((state) => state.tags.fetching);
2400
2377
  return /* @__PURE__ */ jsxs(
2401
2378
  Box,
2402
2379
  {
@@ -2427,7 +2404,7 @@ const Image$1 = styled.img`
2427
2404
  onCreateOption: onCreateTag,
2428
2405
  options,
2429
2406
  placeholder: tagsFetching ? "Loading..." : placeholder,
2430
- styles: reactSelectStyles$1(scheme),
2407
+ styles: reactSelectStyles,
2431
2408
  value: controllerValue
2432
2409
  }
2433
2410
  );
@@ -2468,7 +2445,7 @@ function Details({
2468
2445
  currentAsset,
2469
2446
  creditLine
2470
2447
  }) {
2471
- return /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
2448
+ return /* @__PURE__ */ jsxs(Stack, { gap: 3, children: [
2472
2449
  /* @__PURE__ */ jsx(
2473
2450
  FormFieldInputTags,
2474
2451
  {
@@ -2578,7 +2555,7 @@ const DialogAssetEdit = (props) => {
2578
2555
  useEffect(() => {
2579
2556
  trigger();
2580
2557
  }, [trigger]);
2581
- const altTextsError = errors?.altTexts?.root?.message || errors?.altTexts?.message, formUpdating = !assetItem || assetItem?.updating, handleClose = useCallback(() => {
2558
+ const defaultLanguageCode = languages.find((language) => language.default)?.code, altTextsError = errors?.altTexts?.root?.message || errors?.altTexts?.message || defaultLanguageCode && errors?.altTexts?.[defaultLanguageCode]?.message, formUpdating = !assetItem || assetItem?.updating, handleClose = useCallback(() => {
2582
2559
  dispatch(dialogActions.remove({ id }));
2583
2560
  }, [dispatch, id]), handleDelete = useCallback(() => {
2584
2561
  assetItem?.asset && dispatch(
@@ -2646,8 +2623,8 @@ const DialogAssetEdit = (props) => {
2646
2623
  setValue("opt.media.tags", updatedTags, { shouldDirty: !0 });
2647
2624
  }
2648
2625
  }, [getValues, lastRemovedTagIds, setValue]), useEffect(() => {
2649
- assetUpdatedPrev.current !== assetItem?.asset._updatedAt && reset(generateDefaultValues(assetItem?.asset)), assetUpdatedPrev.current = assetItem?.asset._updatedAt;
2650
- }, [assetItem?.asset, generateDefaultValues, reset]);
2626
+ assetUpdatedPrev.current !== assetItem?.asset._updatedAt && (reset(generateDefaultValues(assetItem?.asset)), trigger()), assetUpdatedPrev.current = assetItem?.asset._updatedAt;
2627
+ }, [assetItem?.asset, generateDefaultValues, reset, trigger]);
2651
2628
  const Footer = () => /* @__PURE__ */ jsx(Box, { padding: 3, children: /* @__PURE__ */ jsxs(Flex, { justify: "space-between", children: [
2652
2629
  /* @__PURE__ */ jsx(
2653
2630
  Button,
@@ -2698,7 +2675,7 @@ const DialogAssetEdit = (props) => {
2698
2675
  /* @__PURE__ */ jsx(Box, { flex: 1, marginTop: [5, 5, 0], padding: 4, children: /* @__PURE__ */ jsx(WithReferringDocuments, { documentStore, id: currentAsset._id, children: ({ isLoading, referringDocuments }) => {
2699
2676
  const uniqueReferringDocuments = getUniqueDocuments(referringDocuments);
2700
2677
  return /* @__PURE__ */ jsxs(Fragment, { children: [
2701
- /* @__PURE__ */ jsxs(TabList, { space: 2, children: [
2678
+ /* @__PURE__ */ jsxs(TabList, { gap: 2, children: [
2702
2679
  /* @__PURE__ */ jsx(
2703
2680
  Tab,
2704
2681
  {
@@ -2764,7 +2741,7 @@ const DialogAssetEdit = (props) => {
2764
2741
  id: "alt-texts",
2765
2742
  children: [
2766
2743
  altTextsError && /* @__PURE__ */ jsx(Stack, { marginBottom: 3, children: /* @__PURE__ */ jsx(Card, { padding: [3, 3, 4], radius: 2, shadow: 1, tone: "critical", children: /* @__PURE__ */ jsx(Text, { size: 1, children: altTextsError }) }) }),
2767
- /* @__PURE__ */ jsx(Stack, { space: 2, style: { height: "65dvh", overflowY: "auto" }, children: languages.map((language) => {
2744
+ /* @__PURE__ */ jsx(Stack, { gap: 2, style: { height: "55dvh", overflowY: "auto" }, children: languages.map((language) => {
2768
2745
  const label = language.default ? `${language.title} (Default)` : language.title;
2769
2746
  return /* @__PURE__ */ jsx(
2770
2747
  FormFieldInputText,
@@ -2855,7 +2832,7 @@ const DialogAssetEdit = (props) => {
2855
2832
  onClose: handleClose,
2856
2833
  width: 1,
2857
2834
  children: [
2858
- /* @__PURE__ */ jsx(Box, { paddingX: 4, paddingY: 4, children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
2835
+ /* @__PURE__ */ jsx(Box, { paddingX: 4, paddingY: 4, children: /* @__PURE__ */ jsxs(Stack, { gap: 3, children: [
2859
2836
  dialog?.title && /* @__PURE__ */ jsx(Text, { size: 1, children: dialog.title }),
2860
2837
  dialog?.description && /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: /* @__PURE__ */ jsx("em", { children: dialog.description }) })
2861
2838
  ] }) }),
@@ -2883,7 +2860,7 @@ const DialogAssetEdit = (props) => {
2883
2860
  }), Container = styled(Box)(
2884
2861
  ({ $scheme, theme }) => css`
2885
2862
  background: ${getSchemeColor($scheme, "bg")};
2886
- border-radius: ${rem(theme.sanity.radius[2])};
2863
+ border-radius: ${rem(getTheme_v2(theme).radius[2])};
2887
2864
  `
2888
2865
  ), SearchFacet = (props) => {
2889
2866
  const { children, facet } = props, scheme = useColorSchemeValue(), dispatch = useDispatch(), handleClose = () => {
@@ -3105,84 +3082,81 @@ const DialogAssetEdit = (props) => {
3105
3082
  () => excludeTagSlugs.length > 0 ? tags.filter((tagItem) => !excludeTagSlugs.includes(tagItem.tag.name.current)) : tags,
3106
3083
  [excludeTagSlugs, tags]
3107
3084
  );
3108
- }, {
3109
- fonts: {
3110
- text: { sizes: themeTextSizes }
3111
- },
3112
- radius: themeRadius,
3113
- space: themeSpace
3114
- } = studioTheme, reactSelectStyles = (scheme) => ({
3115
- control: (styles, { isDisabled, isFocused }) => {
3116
- let boxShadow = "inset 0 0 0 1px var(--card-border-color)";
3117
- return isFocused && (boxShadow = `inset 0 0 0 1px ${getSchemeColor(scheme, "inputEnabledBorder")},
3085
+ }, useReactSelectStyles = () => {
3086
+ const scheme = useColorSchemeValue(), { color, font, radius, space } = useTheme_v2();
3087
+ return {
3088
+ control: (styles, { isDisabled, isFocused }) => {
3089
+ let boxShadow = "inset 0 0 0 1px var(--card-border-color)";
3090
+ return isFocused && (boxShadow = `inset 0 0 0 1px ${color.input.default.enabled.border},
3118
3091
  0 0 0 1px ${getSchemeColor(scheme, "bg2")},
3119
3092
  0 0 0 3px var(--card-focus-ring-color) !important`), {
3093
+ ...styles,
3094
+ backgroundColor: "var(--card-bg-color)",
3095
+ color: "inherit",
3096
+ border: "none",
3097
+ borderRadius: radius[2],
3098
+ boxShadow,
3099
+ fontSize: font.text.sizes[1].fontSize,
3100
+ minHeight: "25px",
3101
+ opacity: isDisabled ? 0.5 : "inherit",
3102
+ outline: "none",
3103
+ transition: "none",
3104
+ "&:hover": {
3105
+ boxShadow: `inset 0 0 0 1px ${color.input.default.hovered.border}`
3106
+ }
3107
+ };
3108
+ },
3109
+ input: (styles) => ({
3120
3110
  ...styles,
3121
- backgroundColor: "var(--card-bg-color)",
3122
- color: "inherit",
3123
- border: "none",
3124
- borderRadius: themeRadius[2],
3125
- boxShadow,
3126
- fontSize: themeTextSizes[1].fontSize,
3127
- minHeight: "25px",
3128
- opacity: isDisabled ? 0.5 : "inherit",
3129
- outline: "none",
3130
- transition: "none",
3111
+ color: "var(--card-fg-color)",
3112
+ fontFamily: font.text.family,
3113
+ fontSize: font.text.sizes[1].fontSize,
3114
+ marginLeft: rem(space[2])
3115
+ }),
3116
+ menuList: (styles) => ({
3117
+ ...styles,
3118
+ padding: 0
3119
+ }),
3120
+ noOptionsMessage: (styles) => ({
3121
+ ...styles,
3122
+ fontFamily: font.text.family,
3123
+ fontSize: font.text.sizes[1].fontSize,
3124
+ lineHeight: "1em"
3125
+ }),
3126
+ option: (styles, { isFocused }) => ({
3127
+ ...styles,
3128
+ backgroundColor: isFocused ? color.avatar.blue.bg : "transparent",
3129
+ borderRadius: radius[2],
3130
+ color: isFocused ? getSchemeColor(scheme, "bg") : "inherit",
3131
+ fontSize: font.text.sizes[1].fontSize,
3132
+ lineHeight: "1em",
3133
+ margin: 0,
3134
+ padding: rem(space[1]),
3131
3135
  "&:hover": {
3132
- boxShadow: `inset 0 0 0 1px ${getSchemeColor(scheme, "inputHoveredBorder")}`
3136
+ backgroundColor: color.avatar.blue.bg,
3137
+ color: getSchemeColor(scheme, "bg")
3133
3138
  }
3134
- };
3135
- },
3136
- input: (styles) => ({
3137
- ...styles,
3138
- color: "var(--card-fg-color)",
3139
- fontFamily: studioTheme.fonts.text.family,
3140
- fontSize: themeTextSizes[1].fontSize,
3141
- marginLeft: rem(themeSpace[2])
3142
- }),
3143
- menuList: (styles) => ({
3144
- ...styles,
3145
- padding: 0
3146
- }),
3147
- noOptionsMessage: (styles) => ({
3148
- ...styles,
3149
- fontFamily: studioTheme.fonts.text.family,
3150
- fontSize: themeTextSizes[1].fontSize,
3151
- lineHeight: "1em"
3152
- }),
3153
- option: (styles, { isFocused }) => ({
3154
- ...styles,
3155
- backgroundColor: isFocused ? getSchemeColor(scheme, "spotBlue") : "transparent",
3156
- borderRadius: themeRadius[2],
3157
- color: isFocused ? getSchemeColor(scheme, "bg") : "inherit",
3158
- fontSize: themeTextSizes[1].fontSize,
3159
- lineHeight: "1em",
3160
- margin: 0,
3161
- padding: rem(themeSpace[1]),
3162
- "&:hover": {
3163
- backgroundColor: getSchemeColor(scheme, "spotBlue"),
3164
- color: getSchemeColor(scheme, "bg")
3165
- }
3166
- }),
3167
- placeholder: (styles) => ({
3168
- ...styles,
3169
- fontSize: themeTextSizes[1].fontSize,
3170
- marginLeft: rem(themeSpace[2]),
3171
- paddingLeft: 0
3172
- }),
3173
- singleValue: (styles) => ({
3174
- ...styles,
3175
- alignItems: "center",
3176
- display: "inline-flex",
3177
- height: "100%",
3178
- marginLeft: rem(themeSpace[2])
3179
- }),
3180
- valueContainer: (styles) => ({
3181
- ...styles,
3182
- margin: 0,
3183
- padding: 0
3184
- })
3185
- }), ClearIndicator = (props) => /* @__PURE__ */ jsx(components.ClearIndicator, { ...props, children: /* @__PURE__ */ jsx(
3139
+ }),
3140
+ placeholder: (styles) => ({
3141
+ ...styles,
3142
+ fontSize: font.text.sizes[1].fontSize,
3143
+ marginLeft: rem(space[2]),
3144
+ paddingLeft: 0
3145
+ }),
3146
+ singleValue: (styles) => ({
3147
+ ...styles,
3148
+ alignItems: "center",
3149
+ display: "inline-flex",
3150
+ height: "100%",
3151
+ marginLeft: rem(space[2])
3152
+ }),
3153
+ valueContainer: (styles) => ({
3154
+ ...styles,
3155
+ margin: 0,
3156
+ padding: 0
3157
+ })
3158
+ };
3159
+ }, ClearIndicator = (props) => /* @__PURE__ */ jsx(components.ClearIndicator, { ...props, children: /* @__PURE__ */ jsx(
3186
3160
  Box,
3187
3161
  {
3188
3162
  paddingRight: 1,
@@ -3219,7 +3193,7 @@ const DialogAssetEdit = (props) => {
3219
3193
  Option,
3220
3194
  SingleValue
3221
3195
  }, SearchFacetTags = ({ facet }) => {
3222
- const scheme = useColorSchemeValue(), dispatch = useDispatch(), tags = useVisibleTags(), tagsFetching = useTypedSelector((state) => state.tags.fetching), allTagOptions = getTagSelectOptions(tags), popoverProps = usePortalPopoverProps(), handleChange = (option) => {
3196
+ const reactSelectStyles = useReactSelectStyles(), dispatch = useDispatch(), tags = useVisibleTags(), tagsFetching = useTypedSelector((state) => state.tags.fetching), allTagOptions = getTagSelectOptions(tags), popoverProps = usePortalPopoverProps(), handleChange = (option) => {
3223
3197
  dispatch(
3224
3198
  searchActions.facetsUpdateById({
3225
3199
  id: facet.id,
@@ -3255,7 +3229,7 @@ const DialogAssetEdit = (props) => {
3255
3229
  fontSize: 1,
3256
3230
  onClick: () => handleOperatorItemClick(operatorType),
3257
3231
  padding: 2,
3258
- space: 4,
3232
+ gap: 4,
3259
3233
  style: { minWidth: "150px" },
3260
3234
  text: operators[operatorType].label
3261
3235
  },
@@ -3277,14 +3251,14 @@ const DialogAssetEdit = (props) => {
3277
3251
  onChange: (value) => handleChange(value),
3278
3252
  options: allTagOptions,
3279
3253
  placeholder: tagsFetching ? "Loading..." : "Select...",
3280
- styles: reactSelectStyles(scheme),
3254
+ styles: reactSelectStyles,
3281
3255
  value: facet?.value
3282
3256
  }
3283
3257
  ) })
3284
3258
  ] });
3285
3259
  }, StackContainer = styled(Flex)(({ theme }) => css`
3286
3260
  > * {
3287
- margin-bottom: ${rem(theme.sanity.space[2])};
3261
+ margin-bottom: ${rem(getTheme_v2(theme).space[2])};
3288
3262
  }
3289
3263
  `), SearchFacets = (props) => {
3290
3264
  const { layout = "inline" } = props, searchFacets = useTypedSelector((state) => state.search.facets), Items2 = searchFacets.map((facet) => {
@@ -3292,7 +3266,7 @@ const DialogAssetEdit = (props) => {
3292
3266
  return facet.type === "number" ? /* @__PURE__ */ jsx(SearchFacetNumber, { facet }, key) : facet.type === "searchable" ? /* @__PURE__ */ jsx(SearchFacetTags, { facet }, key) : facet.type === "select" ? /* @__PURE__ */ jsx(SearchFacetSelect, { facet }, key) : facet.type === "string" ? /* @__PURE__ */ jsx(SearchFacetString, { facet }, key) : null;
3293
3267
  });
3294
3268
  if (layout === "inline")
3295
- return searchFacets.length === 0 ? null : /* @__PURE__ */ jsx(Box, { marginBottom: 2, children: /* @__PURE__ */ jsx(Inline, { space: 2, children: Items2 }) });
3269
+ return searchFacets.length === 0 ? null : /* @__PURE__ */ jsx(Box, { marginBottom: 2, children: /* @__PURE__ */ jsx(Inline, { gap: 2, children: Items2 }) });
3296
3270
  if (layout === "stack")
3297
3271
  return /* @__PURE__ */ jsx(StackContainer, { align: "flex-start", direction: "column", children: Items2 });
3298
3272
  throw Error("Invalid layout");
@@ -3334,7 +3308,7 @@ const DialogAssetEdit = (props) => {
3334
3308
  fontSize: 1,
3335
3309
  icon: AddIcon,
3336
3310
  mode: "bleed",
3337
- space: 2,
3311
+ gap: 2,
3338
3312
  text: "Add filter",
3339
3313
  tone: "primary"
3340
3314
  }
@@ -3827,7 +3801,7 @@ const DialogAssetEdit = (props) => {
3827
3801
  height: `${PANEL_HEIGHT}px`
3828
3802
  },
3829
3803
  children: [
3830
- /* @__PURE__ */ jsxs(Inline, { space: 2, children: [
3804
+ /* @__PURE__ */ jsxs(Inline, { gap: 2, children: [
3831
3805
  /* @__PURE__ */ jsx(Label, { size: 0, children: title }),
3832
3806
  tagsFetching && /* @__PURE__ */ jsx(Label, { size: 0, style: { opacity: 0.3 }, children: "Loading..." })
3833
3807
  ] }),
@@ -4529,7 +4503,7 @@ const EPIC_END_TYPE = "media/epicEnd", createReduxStore = (props) => {
4529
4503
  });
4530
4504
  }), ButtonViewGroup = () => {
4531
4505
  const dispatch = useDispatch(), view = useTypedSelector((state) => state.assets.view);
4532
- return /* @__PURE__ */ jsxs(Inline, { space: 0, style: { whiteSpace: "nowrap" }, children: [
4506
+ return /* @__PURE__ */ jsxs(Inline, { gap: 0, style: { whiteSpace: "nowrap" }, children: [
4533
4507
  /* @__PURE__ */ jsx(
4534
4508
  Button,
4535
4509
  {
@@ -4606,7 +4580,7 @@ const EPIC_END_TYPE = "media/epicEnd", createReduxStore = (props) => {
4606
4580
  ),
4607
4581
  padding: 2,
4608
4582
  selected,
4609
- space: 4,
4583
+ gap: 4,
4610
4584
  style: { minWidth: "200px" },
4611
4585
  text: getOrderTitle(item.field, item.direction)
4612
4586
  },
@@ -4750,7 +4724,7 @@ const EPIC_END_TYPE = "media/epicEnd", createReduxStore = (props) => {
4750
4724
  /* @__PURE__ */ jsx(SearchFacets, {}),
4751
4725
  /* @__PURE__ */ jsx(SearchFacetsControl, {})
4752
4726
  ] }),
4753
- /* @__PURE__ */ jsx(Box, { display: ["block", "block", "none"], marginX: 2, children: /* @__PURE__ */ jsxs(Inline, { space: 2, style: { whiteSpace: "nowrap" }, children: [
4727
+ /* @__PURE__ */ jsx(Box, { display: ["block", "block", "none"], marginX: 2, children: /* @__PURE__ */ jsxs(Inline, { gap: 2, style: { whiteSpace: "nowrap" }, children: [
4754
4728
  /* @__PURE__ */ jsx(
4755
4729
  Button,
4756
4730
  {
@@ -5002,7 +4976,7 @@ const EPIC_END_TYPE = "media/epicEnd", createReduxStore = (props) => {
5002
4976
  user-select: none;
5003
4977
  width: 100%;
5004
4978
 
5005
- border: ${$picked ? `1px solid ${theme.sanity.color.spot.orange} !important` : "1px solid inherit"};
4979
+ border: ${$picked ? `1px solid ${getTheme_v2(theme).color.avatar.orange.bg} !important` : "1px solid inherit"};
5006
4980
 
5007
4981
  ${!$updating && css`
5008
4982
  @media (hover: hover) and (pointer: fine) {
@@ -5024,7 +4998,7 @@ const EPIC_END_TYPE = "media/epicEnd", createReduxStore = (props) => {
5024
4998
  }
5025
4999
  `
5026
5000
  ), StyledWarningOutlineIcon = styled(WarningFilledIcon)(({ theme }) => ({
5027
- color: theme.sanity.color.spot.red
5001
+ color: getTheme_v2(theme).color.avatar.red.bg
5028
5002
  })), CardAsset$1 = (props) => {
5029
5003
  const { id, selected } = props, scheme = useColorSchemeValue(), shiftPressed = useKeyPress("shift"), dispatch = useDispatch(), lastPicked = useTypedSelector((state) => state.assets.lastPicked), item = useTypedSelector((state) => selectAssetById(state, id)), asset = item?.asset, error = item?.error, isOpaque = item?.asset?.metadata?.isOpaque, picked = item?.picked, updating = item?.updating, { onSelect } = useAssetSourceActions();
5030
5004
  if (!asset)
@@ -5444,7 +5418,7 @@ const CardWrapper = styled(Flex)`
5444
5418
  }
5445
5419
  `
5446
5420
  ), StyledWarningIcon = styled(WarningFilledIcon)(({ theme }) => ({
5447
- color: theme.sanity.color.spot.red
5421
+ color: getTheme_v2(theme).color.avatar.red.bg
5448
5422
  })), TableRowAsset$1 = (props) => {
5449
5423
  const { id, selected } = props, scheme = useColorSchemeValue(), shiftPressed = useKeyPress("shift"), [referenceCountVisible, setReferenceCountVisible] = useState(!1), refCountVisibleTimeout = useRef(null), dispatch = useDispatch(), lastPicked = useTypedSelector((state) => state.assets.lastPicked), item = useTypedSelector((state) => selectAssetById(state, id)), mediaIndex = useMediaIndex(), asset = item?.asset, error = item?.error, isOpaque = item?.asset?.metadata?.isOpaque, picked = item?.picked, updating = item?.updating, { onSelect } = useAssetSourceActions(), handleContextActionClick = useCallback(
5450
5424
  (e) => {
@@ -5770,7 +5744,7 @@ const TableRowUpload = (props) => {
5770
5744
  gridRow: mediaIndex < 3 ? "2/4" : "auto",
5771
5745
  marginLeft: mediaIndex < 3 ? 3 : 0
5772
5746
  },
5773
- children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
5747
+ children: /* @__PURE__ */ jsxs(Stack, { gap: 3, children: [
5774
5748
  /* @__PURE__ */ jsxs(Text, { muted: !0, size: 1, textOverflow: "ellipsis", children: [
5775
5749
  item.name,
5776
5750
  " (",
@@ -6077,6 +6051,17 @@ const UploadDropzone = (props) => {
6077
6051
  children: /* @__PURE__ */ jsx(Browser, { document: currentDocument, ...props })
6078
6052
  }
6079
6053
  ) }) });
6054
+ }, isAssetSchemaType = (schemaType) => schemaType ? schemaType.name === "image" || schemaType.name === "file" ? !0 : isAssetSchemaType(schemaType.type) : !1, withoutEditMedia = (sources) => sources ? typeof sources == "function" ? (source) => source.name !== EDIT_MEDIA_SOURCE_NAME && sources(source) : sources.filter(
6055
+ (entry) => (typeof entry == "string" ? entry : entry.name) !== EDIT_MEDIA_SOURCE_NAME
6056
+ ) : (source) => source.name !== EDIT_MEDIA_SOURCE_NAME, AssetSourcesInput = (props) => {
6057
+ const { renderDefault, schemaType, value } = props, hideEditMedia = isAssetSchemaType(schemaType) && !value?.asset?._ref, schemaTypeWithoutEditMedia = useMemo(() => {
6058
+ const options = schemaType.options;
6059
+ return {
6060
+ ...schemaType,
6061
+ options: { ...options, sources: withoutEditMedia(options?.sources) }
6062
+ };
6063
+ }, [schemaType]);
6064
+ return renderDefault(hideEditMedia ? { ...props, schemaType: schemaTypeWithoutEditMedia } : props);
6080
6065
  }, Tool = () => /* @__PURE__ */ jsx(Flex, { direction: "column", height: "fill", flex: 1, children: /* @__PURE__ */ jsx(Browser, {}) }), listeners = /* @__PURE__ */ new Set(), subscribeToUploadRejections = (listener) => (listeners.add(listener), () => {
6081
6066
  listeners.delete(listener);
6082
6067
  }), withMaximumUploadSize = (source, maximumUploadSize) => {
@@ -6110,31 +6095,30 @@ const UploadDropzone = (props) => {
6110
6095
  [toast]
6111
6096
  ), null;
6112
6097
  };
6113
- var mediaTag = {
6098
+ var mediaTag = defineType({
6114
6099
  title: "Media Tag",
6115
6100
  icon: TagIcon,
6116
6101
  name: TAG_DOCUMENT_NAME,
6117
6102
  type: "document",
6118
6103
  fields: [
6119
- {
6104
+ defineField({
6120
6105
  title: "Name",
6121
6106
  name: "name",
6122
6107
  type: "slug"
6123
- }
6108
+ })
6124
6109
  ],
6125
6110
  preview: {
6126
6111
  select: {
6127
6112
  name: "name"
6128
6113
  },
6129
- prepare(selection) {
6130
- const { name } = selection;
6114
+ prepare({ name }) {
6131
6115
  return {
6132
6116
  media: TagIcon,
6133
6117
  title: name?.current
6134
6118
  };
6135
6119
  }
6136
6120
  }
6137
- };
6121
+ });
6138
6122
  const getUploadedAssetId = (patches) => (Array.isArray(patches) ? patches : [patches]).find(
6139
6123
  (patch) => patch?.type === "set" && patch.path?.length === 1 && patch.path[0] === "asset" && typeof patch.value?._ref == "string"
6140
6124
  )?.value?._ref, withUploaderRecording = (source, { client, uploader }) => {
@@ -6170,7 +6154,7 @@ const getUploadedAssetId = (patches) => (Array.isArray(patches) ? patches : [pat
6170
6154
  component: FormBuilderTool
6171
6155
  }, editMediaAssetSource = {
6172
6156
  icon: EditIcon,
6173
- name: "edit-media",
6157
+ name: EDIT_MEDIA_SOURCE_NAME,
6174
6158
  title: "Edit Media",
6175
6159
  component: EditAssetTool
6176
6160
  }, tool = {
@@ -6203,6 +6187,9 @@ const getUploadedAssetId = (patches) => (Array.isArray(patches) ? patches : [pat
6203
6187
  }
6204
6188
  },
6205
6189
  form: {
6190
+ components: {
6191
+ input: AssetSourcesInput
6192
+ },
6206
6193
  file: {
6207
6194
  assetSources: resolveAssetSources
6208
6195
  },