sanity-plugin-media 2.4.1 → 2.4.2-canary.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 +84 -50
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +87 -53
- package/dist/index.mjs.map +1 -1
- package/package.json +17 -16
- package/src/components/AssetGridVirtualized/index.tsx +0 -1
- package/src/components/Browser/index.tsx +2 -2
- package/src/components/ButtonAssetCopy/index.tsx +1 -1
- package/src/components/CardAsset/index.tsx +2 -2
- package/src/components/CardUpload/index.tsx +2 -3
- package/src/components/DialogAssetEdit/index.tsx +2 -2
- package/src/components/FormFieldInputTags/index.tsx +2 -3
- package/src/components/PickedBar/index.tsx +2 -3
- package/src/components/ReduxProvider/index.tsx +19 -0
- package/src/components/SearchFacet/index.tsx +2 -2
- package/src/components/SearchFacetTags/index.tsx +3 -4
- package/src/components/TableHeader/index.tsx +2 -2
- package/src/components/TableRowAsset/index.tsx +3 -3
- package/src/components/TableRowUpload/index.tsx +2 -3
- package/src/components/TagViewHeader/index.tsx +2 -3
- package/src/modules/assets/index.ts +3 -3
- package/src/modules/debug/index.ts +1 -1
- package/src/modules/dialog/index.ts +9 -5
- package/src/modules/notifications/index.ts +2 -2
- package/src/modules/search/index.ts +3 -3
- package/src/modules/tags/index.ts +9 -14
- package/src/modules/uploads/index.ts +1 -1
- package/src/styled/react-select/creatable.tsx +6 -0
- package/src/styled/react-select/single.tsx +6 -0
- package/src/types/index.ts +4 -4
package/dist/index.js
CHANGED
|
@@ -555,22 +555,18 @@ const useKeyPress = (hotkey, onPress) => {
|
|
|
555
555
|
const { tagId } = action.payload;
|
|
556
556
|
delete state.byIds[tagId].error;
|
|
557
557
|
}).addMatcher(
|
|
558
|
-
(
|
|
559
|
-
ASSETS_ACTIONS.tagsAddComplete
|
|
560
|
-
ASSETS_ACTIONS.tagsAddError
|
|
561
|
-
ASSETS_ACTIONS.tagsRemoveComplete
|
|
562
|
-
ASSETS_ACTIONS.tagsRemoveError
|
|
563
|
-
|
|
558
|
+
toolkit.isAnyOf(
|
|
559
|
+
ASSETS_ACTIONS.tagsAddComplete,
|
|
560
|
+
ASSETS_ACTIONS.tagsAddError,
|
|
561
|
+
ASSETS_ACTIONS.tagsRemoveComplete,
|
|
562
|
+
ASSETS_ACTIONS.tagsRemoveError
|
|
563
|
+
),
|
|
564
564
|
(state, action) => {
|
|
565
565
|
const { tag } = action.payload;
|
|
566
566
|
state.byIds[tag._id].updating = !1;
|
|
567
567
|
}
|
|
568
568
|
).addMatcher(
|
|
569
|
-
(
|
|
570
|
-
ASSETS_ACTIONS.tagsAddRequest.type,
|
|
571
|
-
//
|
|
572
|
-
ASSETS_ACTIONS.tagsRemoveRequest.type
|
|
573
|
-
].includes(action.type),
|
|
569
|
+
toolkit.isAnyOf(ASSETS_ACTIONS.tagsAddRequest, ASSETS_ACTIONS.tagsRemoveRequest),
|
|
574
570
|
(state, action) => {
|
|
575
571
|
const { tag } = action.payload;
|
|
576
572
|
state.byIds[tag._id].updating = !0;
|
|
@@ -895,7 +891,7 @@ const useKeyPress = (hotkey, onPress) => {
|
|
|
895
891
|
return tagItem?.tag && acc.push(tagItem), acc;
|
|
896
892
|
}, []);
|
|
897
893
|
return tags && tags?.length > 0 ? getTagSelectOptions(tags) : null;
|
|
898
|
-
}, tagsActions = tagsSlice.actions;
|
|
894
|
+
}, tagsActions = { ...tagsSlice.actions };
|
|
899
895
|
var tagsReducer = tagsSlice.reducer;
|
|
900
896
|
const initialState$6 = {
|
|
901
897
|
facets: [],
|
|
@@ -956,7 +952,7 @@ const initialState$6 = {
|
|
|
956
952
|
value: tagItem?.tag?._id
|
|
957
953
|
}
|
|
958
954
|
})
|
|
959
|
-
) : rxjs.
|
|
955
|
+
) : rxjs.EMPTY;
|
|
960
956
|
})
|
|
961
957
|
), selectIsSearchFacetTag = toolkit.createSelector(
|
|
962
958
|
[
|
|
@@ -966,7 +962,7 @@ const initialState$6 = {
|
|
|
966
962
|
(searchFacets, tagId) => searchFacets.some(
|
|
967
963
|
(facet) => facet.name === "tag" && facet.type === "searchable" && (facet.operatorType === "references" || facet.operatorType === "doesNotReference") && facet.value?.value === tagId
|
|
968
964
|
)
|
|
969
|
-
), searchActions = searchSlice.actions;
|
|
965
|
+
), searchActions = { ...searchSlice.actions };
|
|
970
966
|
var searchReducer = searchSlice.reducer;
|
|
971
967
|
const UPLOADS_ACTIONS = {
|
|
972
968
|
uploadComplete: toolkit.createAction(
|
|
@@ -1284,7 +1280,7 @@ const UPLOADS_ACTIONS = {
|
|
|
1284
1280
|
const nextPageIndex = Math.floor(state.assets.allIds.length / state.assets.pageSize);
|
|
1285
1281
|
return rxjs.of(assetsActions.loadPageIndex({ pageIndex: nextPageIndex }));
|
|
1286
1282
|
}
|
|
1287
|
-
return rxjs.
|
|
1283
|
+
return rxjs.EMPTY;
|
|
1288
1284
|
})
|
|
1289
1285
|
), filterAssetWithoutTag = (tag) => (asset) => (asset?.asset?.opt?.media?.tags?.findIndex((t) => t._ref === tag?._id) ?? -1) < 0, patchOperationTagAppend = ({ tag }) => (patch) => patch.setIfMissing({ opt: {} }).setIfMissing({ "opt.media": {} }).setIfMissing({ "opt.media.tags": [] }).append("opt.media.tags", [{ _key: nanoid.nanoid(), _ref: tag?._id, _type: "reference", _weak: !0 }]), patchOperationTagUnset = ({ asset, tag }) => (patch) => patch.ifRevisionId(asset?.asset?._rev).unset([`opt.media.tags[_ref == "${tag._id}"]`]), assetsOrderSetEpic = (action$) => action$.pipe(
|
|
1290
1286
|
operators$1.filter(assetsActions.orderSet.match),
|
|
@@ -1467,7 +1463,7 @@ const UPLOADS_ACTIONS = {
|
|
|
1467
1463
|
), selectAssetsPickedLength = toolkit.createSelector(
|
|
1468
1464
|
[selectAssetsPicked],
|
|
1469
1465
|
(assetsPicked) => assetsPicked.length
|
|
1470
|
-
), assetsActions = assetsSlice.actions;
|
|
1466
|
+
), assetsActions = { ...assetsSlice.actions };
|
|
1471
1467
|
var assetsReducer = assetsSlice.reducer;
|
|
1472
1468
|
const customScrollbar = styledComponents.css`
|
|
1473
1469
|
::-webkit-scrollbar {
|
|
@@ -1636,16 +1632,18 @@ const customScrollbar = styledComponents.css`
|
|
|
1636
1632
|
tagsActions.deleteComplete.type,
|
|
1637
1633
|
tagsActions.updateComplete.type
|
|
1638
1634
|
),
|
|
1639
|
-
operators$1.filter(
|
|
1635
|
+
operators$1.filter(
|
|
1636
|
+
(action) => !!action?.payload?.closeDialogId
|
|
1637
|
+
),
|
|
1640
1638
|
operators$1.mergeMap((action) => {
|
|
1641
1639
|
const dialogId = action?.payload?.closeDialogId;
|
|
1642
|
-
return dialogId ? rxjs.of(dialogSlice.actions.remove({ id: dialogId })) : rxjs.
|
|
1640
|
+
return dialogId ? rxjs.of(dialogSlice.actions.remove({ id: dialogId })) : rxjs.EMPTY;
|
|
1643
1641
|
})
|
|
1644
1642
|
), dialogTagCreateEpic = (action$) => action$.pipe(
|
|
1645
1643
|
operators$1.filter(tagsActions.createComplete.match),
|
|
1646
1644
|
operators$1.mergeMap((action) => {
|
|
1647
1645
|
const { assetId, tag } = action?.payload;
|
|
1648
|
-
return assetId ? rxjs.of(dialogSlice.actions.inlineTagCreate({ tag, assetId })) : tag._id ? rxjs.of(dialogSlice.actions.remove({ id: "tagCreate" })) : rxjs.
|
|
1646
|
+
return assetId ? rxjs.of(dialogSlice.actions.inlineTagCreate({ tag, assetId })) : tag._id ? rxjs.of(dialogSlice.actions.remove({ id: "tagCreate" })) : rxjs.EMPTY;
|
|
1649
1647
|
})
|
|
1650
1648
|
), dialogTagDeleteEpic = (action$) => action$.pipe(
|
|
1651
1649
|
operators$1.filter(tagsActions.listenerDeleteQueueComplete.match),
|
|
@@ -1653,7 +1651,7 @@ const customScrollbar = styledComponents.css`
|
|
|
1653
1651
|
const { tagIds } = action?.payload;
|
|
1654
1652
|
return rxjs.of(dialogSlice.actions.inlineTagRemove({ tagIds }));
|
|
1655
1653
|
})
|
|
1656
|
-
), dialogActions = dialogSlice.actions;
|
|
1654
|
+
), dialogActions = { ...dialogSlice.actions };
|
|
1657
1655
|
var dialogReducer = dialogSlice.reducer;
|
|
1658
1656
|
const ButtonViewGroup = () => {
|
|
1659
1657
|
const dispatch = reactRedux.useDispatch(), view = useTypedSelector((state) => state.assets.view);
|
|
@@ -1808,7 +1806,7 @@ const Container$1 = styledComponents.styled(ui.Box)(({ scheme, theme }) => style
|
|
|
1808
1806
|
background: ${getSchemeColor(scheme, "bg")};
|
|
1809
1807
|
border-radius: ${ui.rem(theme.sanity.radius[2])};
|
|
1810
1808
|
`), SearchFacet = (props) => {
|
|
1811
|
-
const { children, facet } = props,
|
|
1809
|
+
const { children, facet } = props, scheme = sanity.useColorSchemeValue(), dispatch = reactRedux.useDispatch(), handleClose = () => {
|
|
1812
1810
|
dispatch(searchActions.facetsRemoveById({ facetId: facet.id }));
|
|
1813
1811
|
};
|
|
1814
1812
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2113,16 +2111,22 @@ const Container$1 = styledComponents.styled(ui.Box)(({ scheme, theme }) => style
|
|
|
2113
2111
|
margin: 0,
|
|
2114
2112
|
padding: 0
|
|
2115
2113
|
})
|
|
2116
|
-
}), ClearIndicator = (props) =>
|
|
2117
|
-
|
|
2118
|
-
{
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2114
|
+
}), ClearIndicator = (props) => (
|
|
2115
|
+
// @ts-expect-error - fix typings later
|
|
2116
|
+
/* @__PURE__ */ jsxRuntime.jsx(Select.components.ClearIndicator, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2117
|
+
ui.Box,
|
|
2118
|
+
{
|
|
2119
|
+
paddingRight: 1,
|
|
2120
|
+
style: {
|
|
2121
|
+
transform: "scale(0.85)"
|
|
2122
|
+
},
|
|
2123
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 0, children: /* @__PURE__ */ jsxRuntime.jsx(icons.CloseIcon, {}) })
|
|
2124
|
+
}
|
|
2125
|
+
) })
|
|
2126
|
+
), Menu$1 = (props) => (
|
|
2127
|
+
// @ts-expect-error - fix typings later
|
|
2128
|
+
/* @__PURE__ */ jsxRuntime.jsx(Select.components.Menu, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { radius: 1, shadow: 2, children: props.children }) })
|
|
2129
|
+
), MenuList$1 = (props) => {
|
|
2126
2130
|
const { children } = props, MAX_ROWS = 5, OPTION_HEIGHT = 33;
|
|
2127
2131
|
if (Array.isArray(children)) {
|
|
2128
2132
|
const height = children.length > MAX_ROWS ? OPTION_HEIGHT * MAX_ROWS : children.length * OPTION_HEIGHT;
|
|
@@ -2140,7 +2144,10 @@ const Container$1 = styledComponents.styled(ui.Box)(({ scheme, theme }) => style
|
|
|
2140
2144
|
);
|
|
2141
2145
|
}
|
|
2142
2146
|
return /* @__PURE__ */ jsxRuntime.jsx(Select.components.MenuList, { ...props, children });
|
|
2143
|
-
}, NoOptionsMessage = (props) => /* @__PURE__ */ jsxRuntime.jsx(Select.components.NoOptionsMessage, { ...props, children: props.children }), Option$1 = (props) => /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Select.components.Option, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingY: 1, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, style: { color: "inherit" }, textOverflow: "ellipsis", children: props.children }) }) }) }), SingleValue = (props) =>
|
|
2147
|
+
}, NoOptionsMessage = (props) => /* @__PURE__ */ jsxRuntime.jsx(Select.components.NoOptionsMessage, { ...props, children: props.children }), Option$1 = (props) => /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Select.components.Option, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingY: 1, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, style: { color: "inherit" }, textOverflow: "ellipsis", children: props.children }) }) }) }), SingleValue = (props) => (
|
|
2148
|
+
// @ts-expect-error - fix typings later
|
|
2149
|
+
/* @__PURE__ */ jsxRuntime.jsx(Select.components.SingleValue, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, textOverflow: "ellipsis", children: props.children }) })
|
|
2150
|
+
), reactSelectComponents$1 = {
|
|
2144
2151
|
ClearIndicator,
|
|
2145
2152
|
DropdownIndicator: null,
|
|
2146
2153
|
IndicatorSeparator: null,
|
|
@@ -2150,7 +2157,7 @@ const Container$1 = styledComponents.styled(ui.Box)(({ scheme, theme }) => style
|
|
|
2150
2157
|
Option: Option$1,
|
|
2151
2158
|
SingleValue
|
|
2152
2159
|
}, SearchFacetTags = ({ facet }) => {
|
|
2153
|
-
const
|
|
2160
|
+
const scheme = sanity.useColorSchemeValue(), dispatch = reactRedux.useDispatch(), tags = useTypedSelector((state) => selectTags(state)), tagsFetching = useTypedSelector((state) => state.tags.fetching), allTagOptions = getTagSelectOptions(tags), popoverProps = usePortalPopoverProps(), handleChange = (option) => {
|
|
2154
2161
|
dispatch(
|
|
2155
2162
|
searchActions.facetsUpdateById({
|
|
2156
2163
|
id: facet.id,
|
|
@@ -2474,7 +2481,7 @@ const Container$1 = styledComponents.styled(ui.Box)(({ scheme, theme }) => style
|
|
|
2474
2481
|
state.enabled = !state.enabled;
|
|
2475
2482
|
}
|
|
2476
2483
|
}
|
|
2477
|
-
}), debugActions = debugSlice.actions;
|
|
2484
|
+
}), debugActions = { ...debugSlice.actions };
|
|
2478
2485
|
var debugReducer = debugSlice.reducer;
|
|
2479
2486
|
const DebugControls = () => {
|
|
2480
2487
|
const dispatch = reactRedux.useDispatch(), badConnection = useTypedSelector((state) => state.debug.badConnection), debugEnabled = useTypedSelector((state) => state.debug.enabled), handleChange = (e) => {
|
|
@@ -2551,7 +2558,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
2551
2558
|
const val = formData[key];
|
|
2552
2559
|
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;
|
|
2553
2560
|
}, {}), 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 }) => {
|
|
2554
|
-
const popoverProps = usePortalPopoverProps(), refPopoverTimeout = react.useRef(), [popoverVisible, setPopoverVisible] = react.useState(!1), handleClick = () => {
|
|
2561
|
+
const popoverProps = usePortalPopoverProps(), refPopoverTimeout = react.useRef(null), [popoverVisible, setPopoverVisible] = react.useState(!1), handleClick = () => {
|
|
2555
2562
|
refPopoverTimeout.current && clearTimeout(refPopoverTimeout.current), setPopoverVisible(!0), copy__default.default(url), refPopoverTimeout.current = setTimeout(() => {
|
|
2556
2563
|
setPopoverVisible(!1);
|
|
2557
2564
|
}, 1250);
|
|
@@ -2787,7 +2794,13 @@ const imageDprUrl = (asset, options) => {
|
|
|
2787
2794
|
margin: 0,
|
|
2788
2795
|
padding: 0
|
|
2789
2796
|
})
|
|
2790
|
-
}), DropdownIndicator = (props) =>
|
|
2797
|
+
}), DropdownIndicator = (props) => (
|
|
2798
|
+
// @ts-expect-error - fix typings later
|
|
2799
|
+
/* @__PURE__ */ jsxRuntime.jsx(Select.components.DropdownIndicator, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingX: 2, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronDownIcon, {}) }) }) })
|
|
2800
|
+
), Menu = (props) => (
|
|
2801
|
+
// @ts-expect-error - fix typings later
|
|
2802
|
+
/* @__PURE__ */ jsxRuntime.jsx(Select.components.Menu, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { radius: 1, shadow: 2, children: props.children }) })
|
|
2803
|
+
), MenuList = (props) => {
|
|
2791
2804
|
const { children } = props, MAX_ROWS = 5, OPTION_HEIGHT = 37;
|
|
2792
2805
|
if (Array.isArray(children)) {
|
|
2793
2806
|
const height = children.length > MAX_ROWS ? OPTION_HEIGHT * MAX_ROWS : children.length * OPTION_HEIGHT;
|
|
@@ -2805,7 +2818,10 @@ const imageDprUrl = (asset, options) => {
|
|
|
2805
2818
|
);
|
|
2806
2819
|
}
|
|
2807
2820
|
return /* @__PURE__ */ jsxRuntime.jsx(Select.components.MenuList, { ...props, children });
|
|
2808
|
-
}, MultiValueLabel = (props) => /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 2, paddingRight: 1, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, weight: "medium", children: /* @__PURE__ */ jsxRuntime.jsx(Select.components.MultiValueLabel, { ...props }) }) }), MultiValueRemove = (props) =>
|
|
2821
|
+
}, MultiValueLabel = (props) => /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 2, paddingRight: 1, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, weight: "medium", children: /* @__PURE__ */ jsxRuntime.jsx(Select.components.MultiValueLabel, { ...props }) }) }), MultiValueRemove = (props) => (
|
|
2822
|
+
// @ts-expect-error - fix typings later
|
|
2823
|
+
/* @__PURE__ */ jsxRuntime.jsx(Select.components.MultiValueRemove, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(icons.CloseIcon, { color: "#1f2123" }) })
|
|
2824
|
+
), Option = (props) => /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingX: 1, paddingY: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Select.components.Option, { ...props, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", children: [
|
|
2809
2825
|
props.data.__isNew__ && /* @__PURE__ */ jsxRuntime.jsx(icons.AddIcon, { style: { marginRight: "3px" } }),
|
|
2810
2826
|
props.children
|
|
2811
2827
|
] }) }) }), reactSelectComponents = {
|
|
@@ -2851,7 +2867,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
2851
2867
|
options,
|
|
2852
2868
|
placeholder,
|
|
2853
2869
|
value
|
|
2854
|
-
} = props,
|
|
2870
|
+
} = props, scheme = sanity.useColorSchemeValue(), creating = useTypedSelector((state) => state.tags.creating), tagsFetching = useTypedSelector((state) => state.tags.fetching);
|
|
2855
2871
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2856
2872
|
ui.Box,
|
|
2857
2873
|
{
|
|
@@ -2977,7 +2993,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
2977
2993
|
const {
|
|
2978
2994
|
children,
|
|
2979
2995
|
dialog: { assetId, id, lastCreatedTag, lastRemovedTagIds }
|
|
2980
|
-
} = props, client = useVersionedClient(),
|
|
2996
|
+
} = 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(
|
|
2981
2997
|
(asset) => ({
|
|
2982
2998
|
altText: asset?.altText || "",
|
|
2983
2999
|
creditLine: asset?.creditLine || "",
|
|
@@ -3629,7 +3645,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
3629
3645
|
}
|
|
3630
3646
|
);
|
|
3631
3647
|
}, TagViewHeader = ({ allowCreate, light, title }) => {
|
|
3632
|
-
const
|
|
3648
|
+
const scheme = sanity.useColorSchemeValue(), dispatch = reactRedux.useDispatch(), tagsCreating = useTypedSelector((state) => state.tags.creating), tagsFetching = useTypedSelector((state) => state.tags.fetching), handleTagCreate = () => {
|
|
3633
3649
|
dispatch(DIALOG_ACTIONS.showTagCreate());
|
|
3634
3650
|
};
|
|
3635
3651
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -3829,7 +3845,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
3829
3845
|
), StyledWarningOutlineIcon = styledComponents.styled(icons.WarningFilledIcon)(({ theme }) => ({
|
|
3830
3846
|
color: theme.sanity.color.spot.red
|
|
3831
3847
|
})), CardAsset = (props) => {
|
|
3832
|
-
const { id, selected } = props,
|
|
3848
|
+
const { id, selected } = props, scheme = sanity.useColorSchemeValue(), shiftPressed = useKeyPress("shift"), dispatch = reactRedux.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();
|
|
3833
3849
|
if (!asset)
|
|
3834
3850
|
return null;
|
|
3835
3851
|
const handleAssetClick = (e) => {
|
|
@@ -4205,7 +4221,7 @@ toolkit.createSelector(
|
|
|
4205
4221
|
[selectUploadsByIds, selectUploadsAllIds],
|
|
4206
4222
|
(byIds, allIds) => allIds.map((id) => byIds[id])
|
|
4207
4223
|
);
|
|
4208
|
-
const uploadsActions = uploadsSlice.actions;
|
|
4224
|
+
const uploadsActions = { ...uploadsSlice.actions };
|
|
4209
4225
|
var uploadsReducer = uploadsSlice.reducer;
|
|
4210
4226
|
const CardWrapper = styledComponents.styled(ui.Flex)`
|
|
4211
4227
|
box-sizing: border-box;
|
|
@@ -4214,7 +4230,7 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
|
|
|
4214
4230
|
position: relative;
|
|
4215
4231
|
width: 100%;
|
|
4216
4232
|
`, CardUpload = (props) => {
|
|
4217
|
-
const { id } = props,
|
|
4233
|
+
const { id } = props, scheme = sanity.useColorSchemeValue(), dispatch = reactRedux.useDispatch(), item = useTypedSelector((state) => selectUploadById(state, id));
|
|
4218
4234
|
if (!item)
|
|
4219
4235
|
return null;
|
|
4220
4236
|
const fileSize = filesize__default.default(item.size, { base: 10, round: 0 }), percentLoaded = Math.round(item.percent || 0), isComplete = item.status === "complete", isUploading = item.status === "uploading", isQueued = item.status === "queued";
|
|
@@ -4333,7 +4349,6 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
|
|
|
4333
4349
|
computeItemKey: (index) => items[index]?.id,
|
|
4334
4350
|
components: {
|
|
4335
4351
|
Item: ItemContainer,
|
|
4336
|
-
// @ts-expect-error - fix typings later
|
|
4337
4352
|
List: ListContainer
|
|
4338
4353
|
},
|
|
4339
4354
|
endReached: onLoadMore,
|
|
@@ -4390,7 +4405,7 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
|
|
|
4390
4405
|
}
|
|
4391
4406
|
`
|
|
4392
4407
|
), TableHeader = () => {
|
|
4393
|
-
const
|
|
4408
|
+
const scheme = sanity.useColorSchemeValue(), dispatch = reactRedux.useDispatch(), fetching = useTypedSelector((state) => state.assets.fetching), itemsLength = useTypedSelector(selectAssetsLength), numPickedAssets = useTypedSelector(selectAssetsPickedLength), mediaIndex = ui.useMediaIndex(), { onSelect } = useAssetSourceActions(), allSelected = numPickedAssets === itemsLength, handleContextActionClick = (e) => {
|
|
4394
4409
|
e.stopPropagation(), dispatch(allSelected ? assetsActions.pickClear() : assetsActions.pickAll());
|
|
4395
4410
|
};
|
|
4396
4411
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -4481,7 +4496,7 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
|
|
|
4481
4496
|
`), StyledWarningIcon = styledComponents.styled(icons.WarningFilledIcon)(({ theme }) => ({
|
|
4482
4497
|
color: theme.sanity.color.spot.red
|
|
4483
4498
|
})), TableRowAsset = (props) => {
|
|
4484
|
-
const { id, selected } = props,
|
|
4499
|
+
const { id, selected } = props, scheme = sanity.useColorSchemeValue(), shiftPressed = useKeyPress("shift"), [referenceCountVisible, setReferenceCountVisible] = react.useState(!1), refCountVisibleTimeout = react.useRef(null), dispatch = reactRedux.useDispatch(), lastPicked = useTypedSelector((state) => state.assets.lastPicked), item = useTypedSelector((state) => selectAssetById(state, id)), mediaIndex = ui.useMediaIndex(), asset = item?.asset, error = item?.error, isOpaque = item?.asset?.metadata?.isOpaque, picked = item?.picked, updating = item?.updating, { onSelect } = useAssetSourceActions(), handleContextActionClick = react.useCallback(
|
|
4485
4500
|
(e) => {
|
|
4486
4501
|
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 })));
|
|
4487
4502
|
},
|
|
@@ -4707,7 +4722,7 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
|
|
|
4707
4722
|
};
|
|
4708
4723
|
var TableRowAsset$1 = react.memo(TableRowAsset);
|
|
4709
4724
|
const TableRowUpload = (props) => {
|
|
4710
|
-
const { id } = props,
|
|
4725
|
+
const { id } = props, scheme = sanity.useColorSchemeValue(), dispatch = reactRedux.useDispatch(), item = useTypedSelector((state) => selectUploadById(state, id)), mediaIndex = ui.useMediaIndex();
|
|
4711
4726
|
if (!item)
|
|
4712
4727
|
return null;
|
|
4713
4728
|
const fileSize = filesize__default.default(item.size, { base: 10, round: 0 }), percentLoaded = Math.round(item.percent || 0), isComplete = item.status === "complete", isUploading = item.status === "uploading", isQueued = item.status === "queued";
|
|
@@ -4852,7 +4867,7 @@ const TableRowUpload = (props) => {
|
|
|
4852
4867
|
}
|
|
4853
4868
|
}, [items.length]), null;
|
|
4854
4869
|
}, PickedBar = () => {
|
|
4855
|
-
const
|
|
4870
|
+
const scheme = sanity.useColorSchemeValue(), dispatch = reactRedux.useDispatch(), assetsPicked = useTypedSelector(selectAssetsPicked), handlePickClear = () => {
|
|
4856
4871
|
dispatch(assetsActions.pickClear());
|
|
4857
4872
|
}, handleDeletePicked = () => {
|
|
4858
4873
|
dispatch(dialogActions.showConfirmDeleteAssets({ assets: assetsPicked }));
|
|
@@ -5014,7 +5029,7 @@ const initialState = {
|
|
|
5014
5029
|
), notificationsTagUpdateCompleteEpic = (action$) => action$.pipe(
|
|
5015
5030
|
operators$1.filter(tagsActions.updateComplete.match),
|
|
5016
5031
|
operators$1.mergeMap(() => rxjs.of(notificationsSlice.actions.add({ status: "info", title: "Tag updated" })))
|
|
5017
|
-
), notificationsActions = notificationsSlice.actions;
|
|
5032
|
+
), notificationsActions = { ...notificationsSlice.actions };
|
|
5018
5033
|
var notificationsReducer = notificationsSlice.reducer;
|
|
5019
5034
|
const rootEpic = reduxObservable.combineEpics(
|
|
5020
5035
|
assetsDeleteEpic,
|
|
@@ -5106,10 +5121,29 @@ class ReduxProvider extends react.Component {
|
|
|
5106
5121
|
...initialState$5,
|
|
5107
5122
|
assetTypes: props?.assetType ? [props.assetType] : ["file", "image"]
|
|
5108
5123
|
},
|
|
5124
|
+
debug: {
|
|
5125
|
+
badConnection: !1,
|
|
5126
|
+
enabled: !1
|
|
5127
|
+
},
|
|
5128
|
+
dialog: { items: [] },
|
|
5129
|
+
notifications: { items: [] },
|
|
5130
|
+
search: { facets: [], query: "" },
|
|
5109
5131
|
selected: {
|
|
5110
5132
|
assets: props.selectedAssets || [],
|
|
5111
5133
|
document: props.document,
|
|
5112
5134
|
documentAssetIds: props.document ? getDocumentAssetIds(props.document) : []
|
|
5135
|
+
},
|
|
5136
|
+
tags: {
|
|
5137
|
+
allIds: [],
|
|
5138
|
+
byIds: {},
|
|
5139
|
+
creating: !1,
|
|
5140
|
+
fetchCount: -1,
|
|
5141
|
+
fetching: !1,
|
|
5142
|
+
panelVisible: !0
|
|
5143
|
+
},
|
|
5144
|
+
uploads: {
|
|
5145
|
+
allIds: [],
|
|
5146
|
+
byIds: {}
|
|
5113
5147
|
}
|
|
5114
5148
|
}
|
|
5115
5149
|
}), epicMiddleware.run(rootEpic);
|
|
@@ -5258,7 +5292,7 @@ const UploadDropzone = (props) => {
|
|
|
5258
5292
|
] }) })
|
|
5259
5293
|
] }) });
|
|
5260
5294
|
}, Browser = (props) => {
|
|
5261
|
-
const client = useVersionedClient(),
|
|
5295
|
+
const client = useVersionedClient(), scheme = sanity.useColorSchemeValue();
|
|
5262
5296
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5263
5297
|
ReduxProvider,
|
|
5264
5298
|
{
|