sanity-plugin-media 2.4.0 → 2.4.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.d.mts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +92 -61
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +66 -34
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
- package/src/components/AssetGridVirtualized/index.tsx +3 -2
- package/src/components/AssetMetadata/index.tsx +1 -1
- package/src/components/AssetTableVirtualized/index.tsx +1 -1
- package/src/components/Browser/index.tsx +1 -1
- package/src/components/CardAsset/index.tsx +16 -12
- package/src/components/CardUpload/index.tsx +1 -1
- package/src/components/DialogAssetEdit/index.tsx +1 -1
- package/src/components/DialogConfirm/index.tsx +1 -1
- package/src/components/DialogSearchFacets/index.tsx +1 -1
- package/src/components/DialogTagCreate/index.tsx +1 -1
- package/src/components/DialogTagEdit/index.tsx +1 -1
- package/src/components/DialogTags/index.tsx +1 -1
- package/src/components/Dialogs/index.tsx +1 -1
- package/src/components/FileAssetPreview/index.tsx +1 -1
- package/src/components/FileIcon/index.tsx +1 -1
- package/src/components/FormFieldInputLabel/index.tsx +1 -1
- package/src/components/Image/index.tsx +1 -1
- package/src/components/SearchFacet/index.tsx +8 -3
- package/src/components/SearchFacetNumber/index.tsx +1 -1
- package/src/components/SearchFacetSelect/index.tsx +1 -1
- package/src/components/SearchFacetString/index.tsx +1 -1
- package/src/components/SearchFacetTags/index.tsx +1 -1
- package/src/components/SearchFacets/index.tsx +1 -1
- package/src/components/SearchFacetsControl/index.tsx +1 -1
- package/src/components/TableHeader/index.tsx +14 -10
- package/src/components/TableRowAsset/index.tsx +5 -1
- package/src/components/Tag/index.tsx +2 -2
- package/src/components/TagsVirtualized/index.tsx +1 -1
- package/src/components/UploadDropzone/index.tsx +1 -1
- package/src/config/searchFacets.ts +1 -1
- package/src/constants.ts +1 -1
- package/src/contexts/ToolOptionsContext.tsx +1 -1
- package/src/index.ts +1 -1
- package/src/modules/assets/index.ts +1 -1
- package/src/modules/dialog/index.ts +1 -1
- package/src/modules/notifications/index.ts +1 -1
- package/src/modules/search/index.ts +1 -1
- package/src/modules/selectors.ts +1 -1
- package/src/modules/tags/index.ts +1 -1
- package/src/modules/uploads/index.ts +1 -1
- package/src/operators/checkTagName.ts +1 -1
- package/src/plugin.tsx +1 -1
- package/src/styled/react-select/creatable.tsx +9 -1
- package/src/styled/react-select/single.tsx +8 -1
- package/src/types/sanity-ui.d.ts +6 -0
- package/src/utils/blocksToText.ts +1 -1
- package/src/utils/constructFilter.ts +1 -1
- package/src/utils/getAssetResolution.ts +1 -1
- package/src/utils/getTagSelectOptions.ts +1 -1
- package/src/utils/imageDprUrl.ts +1 -1
- package/src/utils/typeGuards.ts +1 -1
- package/src/utils/uploadSanityAsset.ts +1 -1
package/dist/index.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import { ofType, combineEpics, createEpicMiddleware } from "redux-observable";
|
|
|
12
12
|
import { iif, throwError, of, from, empty, Subject, Observable, merge } from "rxjs";
|
|
13
13
|
import { delay, mergeMap, filter, withLatestFrom, catchError, switchMap, bufferTime, debounceTime, first, map, takeUntil } from "rxjs/operators";
|
|
14
14
|
import { uuid } from "@sanity/uuid";
|
|
15
|
-
import
|
|
15
|
+
import { css, createGlobalStyle, styled } from "styled-components";
|
|
16
16
|
import pluralize from "pluralize";
|
|
17
17
|
import { useNProgress } from "@tanem/react-nprogress";
|
|
18
18
|
import { hues, white } from "@sanity/color";
|
|
@@ -1080,7 +1080,7 @@ const UPLOADS_ACTIONS = {
|
|
|
1080
1080
|
},
|
|
1081
1081
|
fetchComplete(state, action) {
|
|
1082
1082
|
const assets = action.payload?.assets || [];
|
|
1083
|
-
assets.forEach((asset) => {
|
|
1083
|
+
assets && assets.forEach((asset) => {
|
|
1084
1084
|
state.allIds.includes(asset._id) || state.allIds.push(asset._id), state.byIds[asset._id] = {
|
|
1085
1085
|
_type: "asset",
|
|
1086
1086
|
asset,
|
|
@@ -1820,22 +1820,29 @@ const Container$1 = styled(Box)(({ scheme, theme }) => css`
|
|
|
1820
1820
|
const { children, facet } = props, { scheme } = useColorScheme(), dispatch = useDispatch(), handleClose = () => {
|
|
1821
1821
|
dispatch(searchActions.facetsRemoveById({ facetId: facet.id }));
|
|
1822
1822
|
};
|
|
1823
|
-
return /* @__PURE__ */ jsx(
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1823
|
+
return /* @__PURE__ */ jsx(
|
|
1824
|
+
Container$1,
|
|
1825
|
+
{
|
|
1826
|
+
padding: [2, 2, 1],
|
|
1827
|
+
scheme,
|
|
1828
|
+
children: /* @__PURE__ */ jsxs(Flex, { align: ["flex-start", "flex-start", "center"], direction: ["column", "column", "row"], children: [
|
|
1829
|
+
/* @__PURE__ */ jsx(Box, { paddingBottom: [3, 3, 0], paddingLeft: 1, paddingRight: 2, paddingTop: [1, 1, 0], children: /* @__PURE__ */ jsx(
|
|
1830
|
+
Label,
|
|
1831
|
+
{
|
|
1832
|
+
size: 0,
|
|
1833
|
+
style: {
|
|
1834
|
+
whiteSpace: "nowrap"
|
|
1835
|
+
},
|
|
1836
|
+
children: facet.title
|
|
1837
|
+
}
|
|
1838
|
+
) }),
|
|
1839
|
+
/* @__PURE__ */ jsxs(Flex, { align: "center", children: [
|
|
1840
|
+
children,
|
|
1841
|
+
/* @__PURE__ */ jsx(Box, { marginLeft: 1, paddingX: 2, children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 0, children: /* @__PURE__ */ jsx(CloseIcon, { onClick: handleClose }) }) })
|
|
1842
|
+
] })
|
|
1843
|
+
] })
|
|
1844
|
+
}
|
|
1845
|
+
);
|
|
1839
1846
|
}, TextInputNumber = (props) => {
|
|
1840
1847
|
const { onValueChange, value, ...remainingProps } = props;
|
|
1841
1848
|
return /* @__PURE__ */ jsx(
|
|
@@ -2037,6 +2044,7 @@ const Container$1 = styled(Box)(({ scheme, theme }) => css`
|
|
|
2037
2044
|
radius: themeRadius$1,
|
|
2038
2045
|
space: themeSpace$1
|
|
2039
2046
|
} = studioTheme, reactSelectStyles$1 = (scheme) => ({
|
|
2047
|
+
// @ts-expect-error - fix typings later
|
|
2040
2048
|
control: (styles, { isDisabled, isFocused }) => {
|
|
2041
2049
|
let boxShadow = "inset 0 0 0 1px var(--card-border-color)";
|
|
2042
2050
|
return isFocused && (boxShadow = `inset 0 0 0 1px ${getSchemeColor(scheme, "inputEnabledBorder")},
|
|
@@ -2058,6 +2066,7 @@ const Container$1 = styled(Box)(({ scheme, theme }) => css`
|
|
|
2058
2066
|
}
|
|
2059
2067
|
};
|
|
2060
2068
|
},
|
|
2069
|
+
// @ts-expect-error - fix typings later
|
|
2061
2070
|
input: (styles) => ({
|
|
2062
2071
|
...styles,
|
|
2063
2072
|
color: "var(--card-fg-color)",
|
|
@@ -2065,16 +2074,19 @@ const Container$1 = styled(Box)(({ scheme, theme }) => css`
|
|
|
2065
2074
|
fontSize: themeTextSizes[1].fontSize,
|
|
2066
2075
|
marginLeft: rem(themeSpace$1[2])
|
|
2067
2076
|
}),
|
|
2077
|
+
// @ts-expect-error - fix typings later
|
|
2068
2078
|
menuList: (styles) => ({
|
|
2069
2079
|
...styles,
|
|
2070
2080
|
padding: 0
|
|
2071
2081
|
}),
|
|
2082
|
+
// @ts-expect-error - fix typings later
|
|
2072
2083
|
noOptionsMessage: (styles) => ({
|
|
2073
2084
|
...styles,
|
|
2074
2085
|
fontFamily: studioTheme.fonts.text.family,
|
|
2075
2086
|
fontSize: themeTextSizes[1].fontSize,
|
|
2076
2087
|
lineHeight: "1em"
|
|
2077
2088
|
}),
|
|
2089
|
+
// @ts-expect-error - fix typings later
|
|
2078
2090
|
option: (styles, { isFocused }) => ({
|
|
2079
2091
|
...styles,
|
|
2080
2092
|
backgroundColor: isFocused ? getSchemeColor(scheme, "spotBlue") : "transparent",
|
|
@@ -2089,12 +2101,14 @@ const Container$1 = styled(Box)(({ scheme, theme }) => css`
|
|
|
2089
2101
|
color: getSchemeColor(scheme, "bg")
|
|
2090
2102
|
}
|
|
2091
2103
|
}),
|
|
2104
|
+
// @ts-expect-error - fix typings later
|
|
2092
2105
|
placeholder: (styles) => ({
|
|
2093
2106
|
...styles,
|
|
2094
2107
|
fontSize: themeTextSizes[1].fontSize,
|
|
2095
2108
|
marginLeft: rem(themeSpace$1[2]),
|
|
2096
2109
|
paddingLeft: 0
|
|
2097
2110
|
}),
|
|
2111
|
+
// @ts-expect-error - fix typings later
|
|
2098
2112
|
singleValue: (styles) => ({
|
|
2099
2113
|
...styles,
|
|
2100
2114
|
alignItems: "center",
|
|
@@ -2102,6 +2116,7 @@ const Container$1 = styled(Box)(({ scheme, theme }) => css`
|
|
|
2102
2116
|
height: "100%",
|
|
2103
2117
|
marginLeft: rem(themeSpace$1[2])
|
|
2104
2118
|
}),
|
|
2119
|
+
// @ts-expect-error - fix typings later
|
|
2105
2120
|
valueContainer: (styles) => ({
|
|
2106
2121
|
...styles,
|
|
2107
2122
|
margin: 0,
|
|
@@ -2693,6 +2708,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
2693
2708
|
}
|
|
2694
2709
|
) : /* @__PURE__ */ jsx(FileIcon, { extension: asset.extension, width: "50%" });
|
|
2695
2710
|
}, { radius: themeRadius, space: themeSpace } = studioTheme, reactSelectStyles = (scheme) => ({
|
|
2711
|
+
// @ts-expect-error - fix typings later
|
|
2696
2712
|
control: (styles, { isFocused }) => {
|
|
2697
2713
|
let boxShadow = "inset 0 0 0 1px var(--card-border-color)";
|
|
2698
2714
|
return isFocused && (boxShadow = `inset 0 0 0 1px ${getSchemeColor(scheme, "inputEnabledBorder")},
|
|
@@ -2714,10 +2730,12 @@ const imageDprUrl = (asset, options) => {
|
|
|
2714
2730
|
}
|
|
2715
2731
|
};
|
|
2716
2732
|
},
|
|
2733
|
+
// @ts-expect-error - fix typings later
|
|
2717
2734
|
indicatorsContainer: (styles, { isDisabled }) => ({
|
|
2718
2735
|
...styles,
|
|
2719
2736
|
opacity: isDisabled ? 0.25 : 1
|
|
2720
2737
|
}),
|
|
2738
|
+
// @ts-expect-error - fix typings later
|
|
2721
2739
|
input: (styles) => ({
|
|
2722
2740
|
...styles,
|
|
2723
2741
|
color: "var(--card-fg-color)",
|
|
@@ -2727,6 +2745,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
2727
2745
|
menuList: (styles) => ({
|
|
2728
2746
|
...styles
|
|
2729
2747
|
}),
|
|
2748
|
+
// @ts-expect-error - fix typings later
|
|
2730
2749
|
multiValue: (styles, { isDisabled }) => ({
|
|
2731
2750
|
...styles,
|
|
2732
2751
|
backgroundColor: getSchemeColor(scheme, "mutedHoveredBg"),
|
|
@@ -2738,6 +2757,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
2738
2757
|
fontSize: "inherit",
|
|
2739
2758
|
padding: 0
|
|
2740
2759
|
}),
|
|
2760
|
+
// @ts-expect-error - fix typings later
|
|
2741
2761
|
multiValueRemove: (styles) => ({
|
|
2742
2762
|
...styles,
|
|
2743
2763
|
borderTopLeftRadius: 0,
|
|
@@ -2747,11 +2767,13 @@ const imageDprUrl = (asset, options) => {
|
|
|
2747
2767
|
backgroundColor: getSchemeColor(scheme, "mutedSelectedBg")
|
|
2748
2768
|
}
|
|
2749
2769
|
}),
|
|
2770
|
+
// @ts-expect-error - fix typings later
|
|
2750
2771
|
noOptionsMessage: (styles) => ({
|
|
2751
2772
|
...styles,
|
|
2752
2773
|
fontFamily: studioTheme.fonts.text.family,
|
|
2753
2774
|
lineHeight: "1em"
|
|
2754
2775
|
}),
|
|
2776
|
+
// @ts-expect-error - fix typings later
|
|
2755
2777
|
option: (styles, { isFocused }) => ({
|
|
2756
2778
|
...styles,
|
|
2757
2779
|
backgroundColor: isFocused ? getSchemeColor(scheme, "spotBlue") : "transparent",
|
|
@@ -2763,10 +2785,12 @@ const imageDprUrl = (asset, options) => {
|
|
|
2763
2785
|
color: getSchemeColor(scheme, "bg")
|
|
2764
2786
|
}
|
|
2765
2787
|
}),
|
|
2788
|
+
// @ts-expect-error - fix typings later
|
|
2766
2789
|
placeholder: (styles) => ({
|
|
2767
2790
|
...styles,
|
|
2768
2791
|
marginLeft: rem(themeSpace[2])
|
|
2769
2792
|
}),
|
|
2793
|
+
// @ts-expect-error - fix typings later
|
|
2770
2794
|
valueContainer: (styles) => ({
|
|
2771
2795
|
...styles,
|
|
2772
2796
|
margin: 0,
|
|
@@ -3795,16 +3819,19 @@ const imageDprUrl = (asset, options) => {
|
|
|
3795
3819
|
}
|
|
3796
3820
|
`}
|
|
3797
3821
|
`
|
|
3798
|
-
), ContextActionContainer$2 = styled(Flex)(
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3822
|
+
), ContextActionContainer$2 = styled(Flex)(
|
|
3823
|
+
// @ts-expect-error - fix typings later
|
|
3824
|
+
({ scheme }) => css`
|
|
3825
|
+
cursor: pointer;
|
|
3826
|
+
height: ${PANEL_HEIGHT}px;
|
|
3827
|
+
transition: all 300ms;
|
|
3828
|
+
@media (hover: hover) and (pointer: fine) {
|
|
3829
|
+
&:hover {
|
|
3830
|
+
background: ${getSchemeColor(scheme, "bg")};
|
|
3831
|
+
}
|
|
3805
3832
|
}
|
|
3806
|
-
|
|
3807
|
-
|
|
3833
|
+
`
|
|
3834
|
+
), StyledWarningOutlineIcon = styled(WarningFilledIcon)(({ theme }) => ({
|
|
3808
3835
|
color: theme.sanity.color.spot.red
|
|
3809
3836
|
})), CardAsset = (props) => {
|
|
3810
3837
|
const { id, selected } = props, { scheme } = useColorScheme(), 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();
|
|
@@ -4311,6 +4338,7 @@ const CardWrapper = styled(Flex)`
|
|
|
4311
4338
|
computeItemKey: (index) => items[index]?.id,
|
|
4312
4339
|
components: {
|
|
4313
4340
|
Item: ItemContainer,
|
|
4341
|
+
// @ts-expect-error - fix typings later
|
|
4314
4342
|
List: ListContainer
|
|
4315
4343
|
},
|
|
4316
4344
|
endReached: onLoadMore,
|
|
@@ -4356,14 +4384,17 @@ const CardWrapper = styled(Flex)`
|
|
|
4356
4384
|
]
|
|
4357
4385
|
}
|
|
4358
4386
|
) });
|
|
4359
|
-
}, ContextActionContainer$1 = styled(Flex)(
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4387
|
+
}, ContextActionContainer$1 = styled(Flex)(
|
|
4388
|
+
// @ts-expect-error - fix typings later
|
|
4389
|
+
({ scheme }) => css`
|
|
4390
|
+
cursor: pointer;
|
|
4391
|
+
@media (hover: hover) and (pointer: fine) {
|
|
4392
|
+
&:hover {
|
|
4393
|
+
background: ${getSchemeColor(scheme, "bg")};
|
|
4394
|
+
}
|
|
4364
4395
|
}
|
|
4365
|
-
|
|
4366
|
-
|
|
4396
|
+
`
|
|
4397
|
+
), TableHeader = () => {
|
|
4367
4398
|
const { scheme } = useColorScheme(), dispatch = useDispatch(), fetching = useTypedSelector((state) => state.assets.fetching), itemsLength = useTypedSelector(selectAssetsLength), numPickedAssets = useTypedSelector(selectAssetsPickedLength), mediaIndex = useMediaIndex(), { onSelect } = useAssetSourceActions(), allSelected = numPickedAssets === itemsLength, handleContextActionClick = (e) => {
|
|
4368
4399
|
e.stopPropagation(), dispatch(allSelected ? assetsActions.pickClear() : assetsActions.pickAll());
|
|
4369
4400
|
};
|
|
@@ -4424,6 +4455,7 @@ const CardWrapper = styled(Flex)`
|
|
|
4424
4455
|
}
|
|
4425
4456
|
);
|
|
4426
4457
|
}, REFERENCE_COUNT_VISIBILITY_DELAY = 750, ContainerGrid = styled(Grid)(
|
|
4458
|
+
// @ts-expect-error - fix typings later
|
|
4427
4459
|
({
|
|
4428
4460
|
scheme,
|
|
4429
4461
|
selected,
|