@electrolux-oss/sanity-plugin-media 1.0.3 → 2.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
@@ -4049,7 +4049,7 @@ const imageDprUrl = (asset, options) => {
4049
4049
  `
4050
4050
  ), StyledWarningOutlineIcon = styled(WarningFilledIcon)(({ theme }) => ({
4051
4051
  color: theme.sanity.color.spot.red
4052
- })), CardAsset = (props) => {
4052
+ })), CardAsset$1 = (props) => {
4053
4053
  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();
4054
4054
  if (!asset)
4055
4055
  return null;
@@ -4179,7 +4179,7 @@ const imageDprUrl = (asset, options) => {
4179
4179
  )
4180
4180
  ] }) });
4181
4181
  };
4182
- var CardAsset$1 = memo(CardAsset);
4182
+ var CardAsset = memo(CardAsset$1);
4183
4183
  const PREVIEW_WIDTH = 180, createBlob = (img) => new Promise((resolve) => {
4184
4184
  const imageAspect = img.width / img.height, canvas = document.createElement("canvas");
4185
4185
  canvas.width = PREVIEW_WIDTH, canvas.height = Math.max(PREVIEW_WIDTH / imageAspect, 1);
@@ -4536,7 +4536,7 @@ const CardWrapper = styled(Flex)`
4536
4536
  }
4537
4537
  ) });
4538
4538
  }, CARD_HEIGHT = 220, CARD_WIDTH = 240, VirtualCell = memo(
4539
- ({ item, selected }) => item?.type === "asset" ? /* @__PURE__ */ jsx(CardAsset$1, { id: item.id, selected }) : item?.type === "upload" ? /* @__PURE__ */ jsx(CardUpload, { id: item.id }) : null
4539
+ ({ item, selected }) => item?.type === "asset" ? /* @__PURE__ */ jsx(CardAsset, { id: item.id, selected }) : item?.type === "upload" ? /* @__PURE__ */ jsx(CardUpload, { id: item.id }) : null
4540
4540
  ), StyledItemContainer = styled.div`
4541
4541
  height: ${CARD_HEIGHT}px;
4542
4542
  width: ${CARD_WIDTH}px;
@@ -4701,7 +4701,7 @@ const CardWrapper = styled(Flex)`
4701
4701
  `
4702
4702
  ), StyledWarningIcon = styled(WarningFilledIcon)(({ theme }) => ({
4703
4703
  color: theme.sanity.color.spot.red
4704
- })), TableRowAsset = (props) => {
4704
+ })), TableRowAsset$1 = (props) => {
4705
4705
  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(
4706
4706
  (e) => {
4707
4707
  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 })));
@@ -4927,7 +4927,7 @@ const CardWrapper = styled(Flex)`
4927
4927
  }
4928
4928
  ) : null;
4929
4929
  };
4930
- var TableRowAsset$1 = memo(TableRowAsset);
4930
+ var TableRowAsset = memo(TableRowAsset$1);
4931
4931
  const TableRowUpload = (props) => {
4932
4932
  const { id } = props, scheme = useColorSchemeValue(), dispatch = useDispatch(), item = useTypedSelector((state) => selectUploadById(state, id)), mediaIndex = useMediaIndex();
4933
4933
  if (!item)
@@ -5041,7 +5041,7 @@ const TableRowUpload = (props) => {
5041
5041
  }
5042
5042
  );
5043
5043
  }, VirtualRow = memo(
5044
- ({ item, selected }) => item?.type === "asset" ? /* @__PURE__ */ jsx(Box, { style: { height: "100px" }, children: /* @__PURE__ */ jsx(TableRowAsset$1, { id: item.id, selected }) }) : item?.type === "upload" ? /* @__PURE__ */ jsx(Box, { style: { height: "100px" }, children: /* @__PURE__ */ jsx(TableRowUpload, { id: item.id }) }) : null
5044
+ ({ item, selected }) => item?.type === "asset" ? /* @__PURE__ */ jsx(Box, { style: { height: "100px" }, children: /* @__PURE__ */ jsx(TableRowAsset, { id: item.id, selected }) }) : item?.type === "upload" ? /* @__PURE__ */ jsx(Box, { style: { height: "100px" }, children: /* @__PURE__ */ jsx(TableRowUpload, { id: item.id }) }) : null
5045
5045
  ), AssetTableVirtualized = (props) => {
5046
5046
  const { items, onLoadMore } = props, selectedAssets = useTypedSelector((state) => state.selected.assets), selectedIds = selectedAssets && selectedAssets.map((asset) => asset._id) || [], totalCount = items?.length;
5047
5047
  return totalCount === 0 ? null : /* @__PURE__ */ jsx(