sanity-plugin-media 2.4.2 → 3.0.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.mjs CHANGED
@@ -2042,7 +2042,6 @@ const Container$1 = styled(Box)(({ scheme, theme }) => css`
2042
2042
  radius: themeRadius$1,
2043
2043
  space: themeSpace$1
2044
2044
  } = studioTheme, reactSelectStyles$1 = (scheme) => ({
2045
- // @ts-expect-error - fix typings later
2046
2045
  control: (styles, { isDisabled, isFocused }) => {
2047
2046
  let boxShadow = "inset 0 0 0 1px var(--card-border-color)";
2048
2047
  return isFocused && (boxShadow = `inset 0 0 0 1px ${getSchemeColor(scheme, "inputEnabledBorder")},
@@ -2064,7 +2063,6 @@ const Container$1 = styled(Box)(({ scheme, theme }) => css`
2064
2063
  }
2065
2064
  };
2066
2065
  },
2067
- // @ts-expect-error - fix typings later
2068
2066
  input: (styles) => ({
2069
2067
  ...styles,
2070
2068
  color: "var(--card-fg-color)",
@@ -2072,19 +2070,16 @@ const Container$1 = styled(Box)(({ scheme, theme }) => css`
2072
2070
  fontSize: themeTextSizes[1].fontSize,
2073
2071
  marginLeft: rem(themeSpace$1[2])
2074
2072
  }),
2075
- // @ts-expect-error - fix typings later
2076
2073
  menuList: (styles) => ({
2077
2074
  ...styles,
2078
2075
  padding: 0
2079
2076
  }),
2080
- // @ts-expect-error - fix typings later
2081
2077
  noOptionsMessage: (styles) => ({
2082
2078
  ...styles,
2083
2079
  fontFamily: studioTheme.fonts.text.family,
2084
2080
  fontSize: themeTextSizes[1].fontSize,
2085
2081
  lineHeight: "1em"
2086
2082
  }),
2087
- // @ts-expect-error - fix typings later
2088
2083
  option: (styles, { isFocused }) => ({
2089
2084
  ...styles,
2090
2085
  backgroundColor: isFocused ? getSchemeColor(scheme, "spotBlue") : "transparent",
@@ -2099,14 +2094,12 @@ const Container$1 = styled(Box)(({ scheme, theme }) => css`
2099
2094
  color: getSchemeColor(scheme, "bg")
2100
2095
  }
2101
2096
  }),
2102
- // @ts-expect-error - fix typings later
2103
2097
  placeholder: (styles) => ({
2104
2098
  ...styles,
2105
2099
  fontSize: themeTextSizes[1].fontSize,
2106
2100
  marginLeft: rem(themeSpace$1[2]),
2107
2101
  paddingLeft: 0
2108
2102
  }),
2109
- // @ts-expect-error - fix typings later
2110
2103
  singleValue: (styles) => ({
2111
2104
  ...styles,
2112
2105
  alignItems: "center",
@@ -2114,7 +2107,6 @@ const Container$1 = styled(Box)(({ scheme, theme }) => css`
2114
2107
  height: "100%",
2115
2108
  marginLeft: rem(themeSpace$1[2])
2116
2109
  }),
2117
- // @ts-expect-error - fix typings later
2118
2110
  valueContainer: (styles) => ({
2119
2111
  ...styles,
2120
2112
  margin: 0,
@@ -2558,7 +2550,7 @@ const imageDprUrl = (asset, options) => {
2558
2550
  const val = formData[key];
2559
2551
  return typeof val == "object" && val !== null && val.constructor !== Array ? acc[key] = sanitizeFormData(val) : val === "" || typeof val > "u" || val?.length === 0 ? acc[key] = null : typeof val == "string" && val ? acc[key] = formData[key].trim() : acc[key] = formData[key], acc;
2560
2552
  }, {}), isFileAsset = (asset) => asset._type === "sanity.fileAsset", isImageAsset = (asset) => asset._type === "sanity.imageAsset", getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asset.metadata.dimensions.height}px`, ButtonAssetCopy = ({ disabled, url }) => {
2561
- const popoverProps = usePortalPopoverProps(), refPopoverTimeout = useRef(), [popoverVisible, setPopoverVisible] = useState(!1), handleClick = () => {
2553
+ const popoverProps = usePortalPopoverProps(), refPopoverTimeout = useRef(null), [popoverVisible, setPopoverVisible] = useState(!1), handleClick = () => {
2562
2554
  refPopoverTimeout.current && clearTimeout(refPopoverTimeout.current), setPopoverVisible(!0), copy(url), refPopoverTimeout.current = setTimeout(() => {
2563
2555
  setPopoverVisible(!1);
2564
2556
  }, 1250);
@@ -2706,7 +2698,6 @@ const imageDprUrl = (asset, options) => {
2706
2698
  }
2707
2699
  ) : /* @__PURE__ */ jsx(FileIcon, { extension: asset.extension, width: "50%" });
2708
2700
  }, { radius: themeRadius, space: themeSpace } = studioTheme, reactSelectStyles = (scheme) => ({
2709
- // @ts-expect-error - fix typings later
2710
2701
  control: (styles, { isFocused }) => {
2711
2702
  let boxShadow = "inset 0 0 0 1px var(--card-border-color)";
2712
2703
  return isFocused && (boxShadow = `inset 0 0 0 1px ${getSchemeColor(scheme, "inputEnabledBorder")},
@@ -2728,12 +2719,10 @@ const imageDprUrl = (asset, options) => {
2728
2719
  }
2729
2720
  };
2730
2721
  },
2731
- // @ts-expect-error - fix typings later
2732
2722
  indicatorsContainer: (styles, { isDisabled }) => ({
2733
2723
  ...styles,
2734
2724
  opacity: isDisabled ? 0.25 : 1
2735
2725
  }),
2736
- // @ts-expect-error - fix typings later
2737
2726
  input: (styles) => ({
2738
2727
  ...styles,
2739
2728
  color: "var(--card-fg-color)",
@@ -2743,7 +2732,6 @@ const imageDprUrl = (asset, options) => {
2743
2732
  menuList: (styles) => ({
2744
2733
  ...styles
2745
2734
  }),
2746
- // @ts-expect-error - fix typings later
2747
2735
  multiValue: (styles, { isDisabled }) => ({
2748
2736
  ...styles,
2749
2737
  backgroundColor: getSchemeColor(scheme, "mutedHoveredBg"),
@@ -2755,7 +2743,6 @@ const imageDprUrl = (asset, options) => {
2755
2743
  fontSize: "inherit",
2756
2744
  padding: 0
2757
2745
  }),
2758
- // @ts-expect-error - fix typings later
2759
2746
  multiValueRemove: (styles) => ({
2760
2747
  ...styles,
2761
2748
  borderTopLeftRadius: 0,
@@ -2765,13 +2752,11 @@ const imageDprUrl = (asset, options) => {
2765
2752
  backgroundColor: getSchemeColor(scheme, "mutedSelectedBg")
2766
2753
  }
2767
2754
  }),
2768
- // @ts-expect-error - fix typings later
2769
2755
  noOptionsMessage: (styles) => ({
2770
2756
  ...styles,
2771
2757
  fontFamily: studioTheme.fonts.text.family,
2772
2758
  lineHeight: "1em"
2773
2759
  }),
2774
- // @ts-expect-error - fix typings later
2775
2760
  option: (styles, { isFocused }) => ({
2776
2761
  ...styles,
2777
2762
  backgroundColor: isFocused ? getSchemeColor(scheme, "spotBlue") : "transparent",
@@ -2783,12 +2768,10 @@ const imageDprUrl = (asset, options) => {
2783
2768
  color: getSchemeColor(scheme, "bg")
2784
2769
  }
2785
2770
  }),
2786
- // @ts-expect-error - fix typings later
2787
2771
  placeholder: (styles) => ({
2788
2772
  ...styles,
2789
2773
  marginLeft: rem(themeSpace[2])
2790
2774
  }),
2791
- // @ts-expect-error - fix typings later
2792
2775
  valueContainer: (styles) => ({
2793
2776
  ...styles,
2794
2777
  margin: 0,
@@ -4336,7 +4319,6 @@ const CardWrapper = styled(Flex)`
4336
4319
  computeItemKey: (index) => items[index]?.id,
4337
4320
  components: {
4338
4321
  Item: ItemContainer,
4339
- // @ts-expect-error - fix typings later
4340
4322
  List: ListContainer
4341
4323
  },
4342
4324
  endReached: onLoadMore,
@@ -4484,7 +4466,7 @@ const CardWrapper = styled(Flex)`
4484
4466
  `), StyledWarningIcon = styled(WarningFilledIcon)(({ theme }) => ({
4485
4467
  color: theme.sanity.color.spot.red
4486
4468
  })), TableRowAsset = (props) => {
4487
- const { id, selected } = props, scheme = useColorSchemeValue(), shiftPressed = useKeyPress("shift"), [referenceCountVisible, setReferenceCountVisible] = useState(!1), refCountVisibleTimeout = useRef(), 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(
4469
+ 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(
4488
4470
  (e) => {
4489
4471
  e.stopPropagation(), asset && (onSelect ? dispatch(dialogActions.showAssetEdit({ assetId: asset._id })) : shiftPressed.current && !picked ? dispatch(assetsActions.pickRange({ startId: lastPicked || asset._id, endId: asset._id })) : dispatch(assetsActions.pick({ assetId: asset._id, picked: !picked })));
4490
4472
  },