sanity-plugin-media 2.4.2 → 3.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.d.mts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.js +438 -285
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +457 -305
- package/dist/index.mjs.map +1 -1
- package/package.json +39 -33
- package/src/components/AssetGridVirtualized/index.tsx +13 -3
- package/src/components/Browser/index.tsx +30 -41
- package/src/components/ButtonAssetCopy/index.tsx +1 -1
- package/src/components/ButtonViewGroup/index.tsx +0 -1
- package/src/components/CardAsset/index.tsx +13 -14
- package/src/components/CardUpload/index.tsx +1 -1
- package/src/components/Controls/index.tsx +0 -1
- package/src/components/DebugControls/index.tsx +1 -0
- package/src/components/DialogAssetEdit/index.tsx +10 -3
- package/src/components/DialogConfirm/index.tsx +8 -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/DocumentList/index.tsx +1 -1
- package/src/components/FileAssetPreview/index.tsx +1 -1
- package/src/components/FormFieldInputLabel/index.tsx +2 -1
- package/src/components/FormSubmitButton/index.tsx +1 -0
- package/src/components/Header/index.tsx +1 -1
- package/src/components/Image/index.tsx +4 -4
- package/src/components/OrderSelect/index.tsx +0 -1
- package/src/components/Progress/index.tsx +0 -1
- package/src/components/ReduxProvider/index.tsx +0 -1
- package/src/components/SearchFacet/index.tsx +4 -9
- package/src/components/SearchFacetNumber/index.tsx +1 -1
- package/src/components/SearchFacetSelect/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 +4 -6
- package/src/components/TableHeaderItem/index.tsx +1 -1
- package/src/components/TableRowAsset/index.tsx +38 -46
- package/src/components/TableRowUpload/index.tsx +6 -1
- package/src/components/Tag/index.tsx +1 -0
- package/src/components/TagIcon/index.tsx +0 -2
- package/src/components/TagView/index.tsx +1 -1
- package/src/components/TagsPanel/index.tsx +1 -1
- package/src/components/Tool/index.tsx +1 -1
- package/src/hooks/usePortalPopoverProps.ts +1 -0
- package/src/plugin.tsx +0 -1
- package/src/styled/react-select/creatable.tsx +0 -9
- package/src/styled/react-select/single.tsx +0 -8
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useClient, useColorSchemeValue, useSchema, Preview, useDocumentStore, WithReferringDocuments, useFormValue, definePlugin } from "sanity";
|
|
3
3
|
import { ThLargeIcon, ThListIcon, SortIcon, CloseIcon, SelectIcon, AddIcon, SearchIcon, PlugIcon, ClipboardIcon, DownloadIcon, ChevronDownIcon, ErrorOutlineIcon, WarningOutlineIcon, EditIcon, ArrowUpIcon, ArrowDownIcon, TrashIcon, ComposeIcon, Icon, UploadIcon, WarningFilledIcon, CheckmarkCircleIcon, ChevronUpIcon, ImageIcon } from "@sanity/icons";
|
|
4
|
-
import { Inline, Button, usePortal, MenuButton, Menu as Menu$2, MenuItem, MenuDivider, Box, studioTheme, rem, Flex, Label, Text, TextInput, Card, MenuGroup, useMediaIndex, Tooltip, Switch, Popover, Stack, Dialog as Dialog$1, TextArea, TabList, Tab, TabPanel, Container as Container$2, Spinner, Checkbox, Grid, useToast,
|
|
4
|
+
import { Inline, Button, usePortal, MenuButton, Menu as Menu$2, MenuItem, MenuDivider, Box, studioTheme, rem, Flex, Label, Text, TextInput, Card, MenuGroup, useMediaIndex, Tooltip, Switch, Popover, Stack, Dialog as Dialog$1, TextArea, TabList, Tab, TabPanel, Container as Container$2, Spinner, Checkbox, Grid, useToast, PortalProvider, useLayer, Portal } from "@sanity/ui";
|
|
5
5
|
import { useRef, useCallback, useEffect, createContext, useContext, useMemo, useState, forwardRef, memo, Component } from "react";
|
|
6
|
-
import isHotkey from "is-hotkey";
|
|
7
6
|
import groq from "groq";
|
|
8
7
|
import { useSelector, useDispatch, Provider } from "react-redux";
|
|
9
8
|
import { createAction, createSlice, isAnyOf, createSelector, combineReducers, configureStore } from "@reduxjs/toolkit";
|
|
@@ -29,6 +28,143 @@ import { FileIcon as FileIcon$1, defaultStyles } from "react-file-icon";
|
|
|
29
28
|
import CreatableSelect from "react-select/creatable";
|
|
30
29
|
import formatRelative from "date-fns/formatRelative";
|
|
31
30
|
import { useDropzone } from "react-dropzone";
|
|
31
|
+
function getDefaultExportFromCjs(x) {
|
|
32
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x.default : x;
|
|
33
|
+
}
|
|
34
|
+
var lib = {}, hasRequiredLib;
|
|
35
|
+
function requireLib() {
|
|
36
|
+
if (hasRequiredLib) return lib;
|
|
37
|
+
hasRequiredLib = 1, Object.defineProperty(lib, "__esModule", {
|
|
38
|
+
value: !0
|
|
39
|
+
});
|
|
40
|
+
for (var IS_MAC = typeof window < "u" && /Mac|iPod|iPhone|iPad/.test(window.navigator.platform), MODIFIERS = {
|
|
41
|
+
alt: "altKey",
|
|
42
|
+
control: "ctrlKey",
|
|
43
|
+
meta: "metaKey",
|
|
44
|
+
shift: "shiftKey"
|
|
45
|
+
}, ALIASES = {
|
|
46
|
+
add: "+",
|
|
47
|
+
break: "pause",
|
|
48
|
+
cmd: "meta",
|
|
49
|
+
command: "meta",
|
|
50
|
+
ctl: "control",
|
|
51
|
+
ctrl: "control",
|
|
52
|
+
del: "delete",
|
|
53
|
+
down: "arrowdown",
|
|
54
|
+
esc: "escape",
|
|
55
|
+
ins: "insert",
|
|
56
|
+
left: "arrowleft",
|
|
57
|
+
mod: IS_MAC ? "meta" : "control",
|
|
58
|
+
opt: "alt",
|
|
59
|
+
option: "alt",
|
|
60
|
+
return: "enter",
|
|
61
|
+
right: "arrowright",
|
|
62
|
+
space: " ",
|
|
63
|
+
spacebar: " ",
|
|
64
|
+
up: "arrowup",
|
|
65
|
+
win: "meta",
|
|
66
|
+
windows: "meta"
|
|
67
|
+
}, CODES = {
|
|
68
|
+
backspace: 8,
|
|
69
|
+
tab: 9,
|
|
70
|
+
enter: 13,
|
|
71
|
+
shift: 16,
|
|
72
|
+
control: 17,
|
|
73
|
+
alt: 18,
|
|
74
|
+
pause: 19,
|
|
75
|
+
capslock: 20,
|
|
76
|
+
escape: 27,
|
|
77
|
+
" ": 32,
|
|
78
|
+
pageup: 33,
|
|
79
|
+
pagedown: 34,
|
|
80
|
+
end: 35,
|
|
81
|
+
home: 36,
|
|
82
|
+
arrowleft: 37,
|
|
83
|
+
arrowup: 38,
|
|
84
|
+
arrowright: 39,
|
|
85
|
+
arrowdown: 40,
|
|
86
|
+
insert: 45,
|
|
87
|
+
delete: 46,
|
|
88
|
+
meta: 91,
|
|
89
|
+
numlock: 144,
|
|
90
|
+
scrolllock: 145,
|
|
91
|
+
";": 186,
|
|
92
|
+
"=": 187,
|
|
93
|
+
",": 188,
|
|
94
|
+
"-": 189,
|
|
95
|
+
".": 190,
|
|
96
|
+
"/": 191,
|
|
97
|
+
"`": 192,
|
|
98
|
+
"[": 219,
|
|
99
|
+
"\\": 220,
|
|
100
|
+
"]": 221,
|
|
101
|
+
"'": 222
|
|
102
|
+
}, f = 1; f < 20; f++)
|
|
103
|
+
CODES["f" + f] = 111 + f;
|
|
104
|
+
function isHotkey2(hotkey, options, event) {
|
|
105
|
+
options && !("byKey" in options) && (event = options, options = null), Array.isArray(hotkey) || (hotkey = [hotkey]);
|
|
106
|
+
var array = hotkey.map(function(string) {
|
|
107
|
+
return parseHotkey(string, options);
|
|
108
|
+
}), check = function(e) {
|
|
109
|
+
return array.some(function(object) {
|
|
110
|
+
return compareHotkey(object, e);
|
|
111
|
+
});
|
|
112
|
+
}, ret = event == null ? check : check(event);
|
|
113
|
+
return ret;
|
|
114
|
+
}
|
|
115
|
+
function isCodeHotkey(hotkey, event) {
|
|
116
|
+
return isHotkey2(hotkey, event);
|
|
117
|
+
}
|
|
118
|
+
function isKeyHotkey(hotkey, event) {
|
|
119
|
+
return isHotkey2(hotkey, { byKey: !0 }, event);
|
|
120
|
+
}
|
|
121
|
+
function parseHotkey(hotkey, options) {
|
|
122
|
+
var byKey = options && options.byKey, ret = {};
|
|
123
|
+
hotkey = hotkey.replace("++", "+add");
|
|
124
|
+
var values = hotkey.split("+"), length = values.length;
|
|
125
|
+
for (var k in MODIFIERS)
|
|
126
|
+
ret[MODIFIERS[k]] = !1;
|
|
127
|
+
var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
|
128
|
+
try {
|
|
129
|
+
for (var _iterator = values[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
|
130
|
+
var value = _step.value, optional = value.endsWith("?") && value.length > 1;
|
|
131
|
+
optional && (value = value.slice(0, -1));
|
|
132
|
+
var name = toKeyName(value), modifier = MODIFIERS[name];
|
|
133
|
+
if (value.length > 1 && !modifier && !ALIASES[value] && !CODES[name])
|
|
134
|
+
throw new TypeError('Unknown modifier: "' + value + '"');
|
|
135
|
+
(length === 1 || !modifier) && (byKey ? ret.key = name : ret.which = toKeyCode(value)), modifier && (ret[modifier] = optional ? null : !0);
|
|
136
|
+
}
|
|
137
|
+
} catch (err) {
|
|
138
|
+
_didIteratorError = !0, _iteratorError = err;
|
|
139
|
+
} finally {
|
|
140
|
+
try {
|
|
141
|
+
!_iteratorNormalCompletion && _iterator.return && _iterator.return();
|
|
142
|
+
} finally {
|
|
143
|
+
if (_didIteratorError)
|
|
144
|
+
throw _iteratorError;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return ret;
|
|
148
|
+
}
|
|
149
|
+
function compareHotkey(object, event) {
|
|
150
|
+
for (var key in object) {
|
|
151
|
+
var expected = object[key], actual = void 0;
|
|
152
|
+
if (expected != null && (key === "key" && event.key != null ? actual = event.key.toLowerCase() : key === "which" ? actual = expected === 91 && event.which === 93 ? 91 : event.which : actual = event[key], !(actual == null && expected === !1) && actual !== expected))
|
|
153
|
+
return !1;
|
|
154
|
+
}
|
|
155
|
+
return !0;
|
|
156
|
+
}
|
|
157
|
+
function toKeyCode(name) {
|
|
158
|
+
name = toKeyName(name);
|
|
159
|
+
var code = CODES[name] || name.toUpperCase().charCodeAt(0);
|
|
160
|
+
return code;
|
|
161
|
+
}
|
|
162
|
+
function toKeyName(name) {
|
|
163
|
+
return name = name.toLowerCase(), name = ALIASES[name] || name, name;
|
|
164
|
+
}
|
|
165
|
+
return lib.default = isHotkey2, lib.isHotkey = isHotkey2, lib.isCodeHotkey = isCodeHotkey, lib.isKeyHotkey = isKeyHotkey, lib.parseHotkey = parseHotkey, lib.compareHotkey = compareHotkey, lib.toKeyCode = toKeyCode, lib.toKeyName = toKeyName, lib;
|
|
166
|
+
}
|
|
167
|
+
var libExports = requireLib(), isHotkey = /* @__PURE__ */ getDefaultExportFromCjs(libExports);
|
|
32
168
|
const useKeyPress = (hotkey, onPress) => {
|
|
33
169
|
const keyPressed = useRef(!1), downHandler = useCallback(
|
|
34
170
|
(e) => {
|
|
@@ -1696,6 +1832,7 @@ const ButtonViewGroup = () => {
|
|
|
1696
1832
|
function usePortalPopoverProps() {
|
|
1697
1833
|
const portal = usePortal();
|
|
1698
1834
|
return {
|
|
1835
|
+
animate: !0,
|
|
1699
1836
|
constrainSize: !0,
|
|
1700
1837
|
floatingBoundary: portal.element,
|
|
1701
1838
|
portal: !0,
|
|
@@ -1811,36 +1948,29 @@ const OrderSelect = () => {
|
|
|
1811
1948
|
function getSchemeColor(scheme, colorKey) {
|
|
1812
1949
|
return SCHEME_COLORS[colorKey]?.[scheme];
|
|
1813
1950
|
}
|
|
1814
|
-
const Container$1 = styled(Box)(({ scheme, theme }) => css`
|
|
1815
|
-
background: ${getSchemeColor(scheme, "bg")};
|
|
1951
|
+
const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
1952
|
+
background: ${getSchemeColor($scheme, "bg")};
|
|
1816
1953
|
border-radius: ${rem(theme.sanity.radius[2])};
|
|
1817
1954
|
`), SearchFacet = (props) => {
|
|
1818
1955
|
const { children, facet } = props, scheme = useColorSchemeValue(), dispatch = useDispatch(), handleClose = () => {
|
|
1819
1956
|
dispatch(searchActions.facetsRemoveById({ facetId: facet.id }));
|
|
1820
1957
|
};
|
|
1821
|
-
return /* @__PURE__ */ jsx(
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
/* @__PURE__ */ jsxs(Flex, { align: "center", children: [
|
|
1838
|
-
children,
|
|
1839
|
-
/* @__PURE__ */ jsx(Box, { marginLeft: 1, paddingX: 2, children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 0, children: /* @__PURE__ */ jsx(CloseIcon, { onClick: handleClose }) }) })
|
|
1840
|
-
] })
|
|
1841
|
-
] })
|
|
1842
|
-
}
|
|
1843
|
-
);
|
|
1958
|
+
return /* @__PURE__ */ jsx(Container$1, { padding: [2, 2, 1], $scheme: scheme, children: /* @__PURE__ */ jsxs(Flex, { align: ["flex-start", "flex-start", "center"], direction: ["column", "column", "row"], children: [
|
|
1959
|
+
/* @__PURE__ */ jsx(Box, { paddingBottom: [3, 3, 0], paddingLeft: 1, paddingRight: 2, paddingTop: [1, 1, 0], children: /* @__PURE__ */ jsx(
|
|
1960
|
+
Label,
|
|
1961
|
+
{
|
|
1962
|
+
size: 0,
|
|
1963
|
+
style: {
|
|
1964
|
+
whiteSpace: "nowrap"
|
|
1965
|
+
},
|
|
1966
|
+
children: facet.title
|
|
1967
|
+
}
|
|
1968
|
+
) }),
|
|
1969
|
+
/* @__PURE__ */ jsxs(Flex, { align: "center", children: [
|
|
1970
|
+
children,
|
|
1971
|
+
/* @__PURE__ */ jsx(Box, { marginLeft: 1, paddingX: 2, children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 0, children: /* @__PURE__ */ jsx(CloseIcon, { onClick: handleClose }) }) })
|
|
1972
|
+
] })
|
|
1973
|
+
] }) });
|
|
1844
1974
|
}, TextInputNumber = (props) => {
|
|
1845
1975
|
const { onValueChange, value, ...remainingProps } = props;
|
|
1846
1976
|
return /* @__PURE__ */ jsx(
|
|
@@ -2042,7 +2172,6 @@ const Container$1 = styled(Box)(({ scheme, theme }) => css`
|
|
|
2042
2172
|
radius: themeRadius$1,
|
|
2043
2173
|
space: themeSpace$1
|
|
2044
2174
|
} = studioTheme, reactSelectStyles$1 = (scheme) => ({
|
|
2045
|
-
// @ts-expect-error - fix typings later
|
|
2046
2175
|
control: (styles, { isDisabled, isFocused }) => {
|
|
2047
2176
|
let boxShadow = "inset 0 0 0 1px var(--card-border-color)";
|
|
2048
2177
|
return isFocused && (boxShadow = `inset 0 0 0 1px ${getSchemeColor(scheme, "inputEnabledBorder")},
|
|
@@ -2064,7 +2193,6 @@ const Container$1 = styled(Box)(({ scheme, theme }) => css`
|
|
|
2064
2193
|
}
|
|
2065
2194
|
};
|
|
2066
2195
|
},
|
|
2067
|
-
// @ts-expect-error - fix typings later
|
|
2068
2196
|
input: (styles) => ({
|
|
2069
2197
|
...styles,
|
|
2070
2198
|
color: "var(--card-fg-color)",
|
|
@@ -2072,19 +2200,16 @@ const Container$1 = styled(Box)(({ scheme, theme }) => css`
|
|
|
2072
2200
|
fontSize: themeTextSizes[1].fontSize,
|
|
2073
2201
|
marginLeft: rem(themeSpace$1[2])
|
|
2074
2202
|
}),
|
|
2075
|
-
// @ts-expect-error - fix typings later
|
|
2076
2203
|
menuList: (styles) => ({
|
|
2077
2204
|
...styles,
|
|
2078
2205
|
padding: 0
|
|
2079
2206
|
}),
|
|
2080
|
-
// @ts-expect-error - fix typings later
|
|
2081
2207
|
noOptionsMessage: (styles) => ({
|
|
2082
2208
|
...styles,
|
|
2083
2209
|
fontFamily: studioTheme.fonts.text.family,
|
|
2084
2210
|
fontSize: themeTextSizes[1].fontSize,
|
|
2085
2211
|
lineHeight: "1em"
|
|
2086
2212
|
}),
|
|
2087
|
-
// @ts-expect-error - fix typings later
|
|
2088
2213
|
option: (styles, { isFocused }) => ({
|
|
2089
2214
|
...styles,
|
|
2090
2215
|
backgroundColor: isFocused ? getSchemeColor(scheme, "spotBlue") : "transparent",
|
|
@@ -2099,14 +2224,12 @@ const Container$1 = styled(Box)(({ scheme, theme }) => css`
|
|
|
2099
2224
|
color: getSchemeColor(scheme, "bg")
|
|
2100
2225
|
}
|
|
2101
2226
|
}),
|
|
2102
|
-
// @ts-expect-error - fix typings later
|
|
2103
2227
|
placeholder: (styles) => ({
|
|
2104
2228
|
...styles,
|
|
2105
2229
|
fontSize: themeTextSizes[1].fontSize,
|
|
2106
2230
|
marginLeft: rem(themeSpace$1[2]),
|
|
2107
2231
|
paddingLeft: 0
|
|
2108
2232
|
}),
|
|
2109
|
-
// @ts-expect-error - fix typings later
|
|
2110
2233
|
singleValue: (styles) => ({
|
|
2111
2234
|
...styles,
|
|
2112
2235
|
alignItems: "center",
|
|
@@ -2114,7 +2237,6 @@ const Container$1 = styled(Box)(({ scheme, theme }) => css`
|
|
|
2114
2237
|
height: "100%",
|
|
2115
2238
|
marginLeft: rem(themeSpace$1[2])
|
|
2116
2239
|
}),
|
|
2117
|
-
// @ts-expect-error - fix typings later
|
|
2118
2240
|
valueContainer: (styles) => ({
|
|
2119
2241
|
...styles,
|
|
2120
2242
|
margin: 0,
|
|
@@ -2506,6 +2628,7 @@ const DebugControls = () => {
|
|
|
2506
2628
|
/* @__PURE__ */ jsx(
|
|
2507
2629
|
Tooltip,
|
|
2508
2630
|
{
|
|
2631
|
+
animate: !0,
|
|
2509
2632
|
content: /* @__PURE__ */ jsx(Box, { padding: 2, children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: badConnection ? "Bad connection: +3000ms & 50% chance to fail" : "No connection throttling" }) }),
|
|
2510
2633
|
fallbackPlacements: ["right", "left"],
|
|
2511
2634
|
placement: "bottom",
|
|
@@ -2558,7 +2681,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
2558
2681
|
const val = formData[key];
|
|
2559
2682
|
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
2683
|
}, {}), 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 = () => {
|
|
2684
|
+
const popoverProps = usePortalPopoverProps(), refPopoverTimeout = useRef(null), [popoverVisible, setPopoverVisible] = useState(!1), handleClick = () => {
|
|
2562
2685
|
refPopoverTimeout.current && clearTimeout(refPopoverTimeout.current), setPopoverVisible(!0), copy(url), refPopoverTimeout.current = setTimeout(() => {
|
|
2563
2686
|
setPopoverVisible(!1);
|
|
2564
2687
|
}, 1250);
|
|
@@ -2706,7 +2829,6 @@ const imageDprUrl = (asset, options) => {
|
|
|
2706
2829
|
}
|
|
2707
2830
|
) : /* @__PURE__ */ jsx(FileIcon, { extension: asset.extension, width: "50%" });
|
|
2708
2831
|
}, { radius: themeRadius, space: themeSpace } = studioTheme, reactSelectStyles = (scheme) => ({
|
|
2709
|
-
// @ts-expect-error - fix typings later
|
|
2710
2832
|
control: (styles, { isFocused }) => {
|
|
2711
2833
|
let boxShadow = "inset 0 0 0 1px var(--card-border-color)";
|
|
2712
2834
|
return isFocused && (boxShadow = `inset 0 0 0 1px ${getSchemeColor(scheme, "inputEnabledBorder")},
|
|
@@ -2728,12 +2850,10 @@ const imageDprUrl = (asset, options) => {
|
|
|
2728
2850
|
}
|
|
2729
2851
|
};
|
|
2730
2852
|
},
|
|
2731
|
-
// @ts-expect-error - fix typings later
|
|
2732
2853
|
indicatorsContainer: (styles, { isDisabled }) => ({
|
|
2733
2854
|
...styles,
|
|
2734
2855
|
opacity: isDisabled ? 0.25 : 1
|
|
2735
2856
|
}),
|
|
2736
|
-
// @ts-expect-error - fix typings later
|
|
2737
2857
|
input: (styles) => ({
|
|
2738
2858
|
...styles,
|
|
2739
2859
|
color: "var(--card-fg-color)",
|
|
@@ -2743,7 +2863,6 @@ const imageDprUrl = (asset, options) => {
|
|
|
2743
2863
|
menuList: (styles) => ({
|
|
2744
2864
|
...styles
|
|
2745
2865
|
}),
|
|
2746
|
-
// @ts-expect-error - fix typings later
|
|
2747
2866
|
multiValue: (styles, { isDisabled }) => ({
|
|
2748
2867
|
...styles,
|
|
2749
2868
|
backgroundColor: getSchemeColor(scheme, "mutedHoveredBg"),
|
|
@@ -2755,7 +2874,6 @@ const imageDprUrl = (asset, options) => {
|
|
|
2755
2874
|
fontSize: "inherit",
|
|
2756
2875
|
padding: 0
|
|
2757
2876
|
}),
|
|
2758
|
-
// @ts-expect-error - fix typings later
|
|
2759
2877
|
multiValueRemove: (styles) => ({
|
|
2760
2878
|
...styles,
|
|
2761
2879
|
borderTopLeftRadius: 0,
|
|
@@ -2765,13 +2883,11 @@ const imageDprUrl = (asset, options) => {
|
|
|
2765
2883
|
backgroundColor: getSchemeColor(scheme, "mutedSelectedBg")
|
|
2766
2884
|
}
|
|
2767
2885
|
}),
|
|
2768
|
-
// @ts-expect-error - fix typings later
|
|
2769
2886
|
noOptionsMessage: (styles) => ({
|
|
2770
2887
|
...styles,
|
|
2771
2888
|
fontFamily: studioTheme.fonts.text.family,
|
|
2772
2889
|
lineHeight: "1em"
|
|
2773
2890
|
}),
|
|
2774
|
-
// @ts-expect-error - fix typings later
|
|
2775
2891
|
option: (styles, { isFocused }) => ({
|
|
2776
2892
|
...styles,
|
|
2777
2893
|
backgroundColor: isFocused ? getSchemeColor(scheme, "spotBlue") : "transparent",
|
|
@@ -2783,12 +2899,10 @@ const imageDprUrl = (asset, options) => {
|
|
|
2783
2899
|
color: getSchemeColor(scheme, "bg")
|
|
2784
2900
|
}
|
|
2785
2901
|
}),
|
|
2786
|
-
// @ts-expect-error - fix typings later
|
|
2787
2902
|
placeholder: (styles) => ({
|
|
2788
2903
|
...styles,
|
|
2789
2904
|
marginLeft: rem(themeSpace[2])
|
|
2790
2905
|
}),
|
|
2791
|
-
// @ts-expect-error - fix typings later
|
|
2792
2906
|
valueContainer: (styles) => ({
|
|
2793
2907
|
...styles,
|
|
2794
2908
|
margin: 0,
|
|
@@ -2833,6 +2947,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
2833
2947
|
error && /* @__PURE__ */ jsx(Text, { size: 1, children: /* @__PURE__ */ jsx(
|
|
2834
2948
|
Tooltip,
|
|
2835
2949
|
{
|
|
2950
|
+
animate: !0,
|
|
2836
2951
|
content: /* @__PURE__ */ jsx(Box, { padding: 2, children: /* @__PURE__ */ jsxs(Text, { muted: !0, size: 1, children: [
|
|
2837
2952
|
/* @__PURE__ */ jsx(StyledErrorOutlineIcon, { style: { marginRight: "0.1em" } }),
|
|
2838
2953
|
error
|
|
@@ -2948,6 +3063,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
2948
3063
|
] }) : content = "No unpublished changes" : content = "There are validation errors that need to be fixed before this document can be published", /* @__PURE__ */ jsx(
|
|
2949
3064
|
Tooltip,
|
|
2950
3065
|
{
|
|
3066
|
+
animate: !0,
|
|
2951
3067
|
content: /* @__PURE__ */ jsx(Box, { padding: 3, style: { maxWidth: "185px" }, children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: content }) }),
|
|
2952
3068
|
disabled: "ontouchstart" in window,
|
|
2953
3069
|
placement: "top",
|
|
@@ -2965,14 +3081,14 @@ const imageDprUrl = (asset, options) => {
|
|
|
2965
3081
|
}
|
|
2966
3082
|
);
|
|
2967
3083
|
}, Image$1 = styled.img`
|
|
2968
|
-
--checkerboard-color: ${(props) => props
|
|
3084
|
+
--checkerboard-color: ${(props) => props.$scheme ? getSchemeColor(props.$scheme, "bg2") : "inherit"};
|
|
2969
3085
|
|
|
2970
3086
|
display: block;
|
|
2971
3087
|
width: 100%;
|
|
2972
3088
|
height: 100%;
|
|
2973
3089
|
object-fit: contain;
|
|
2974
3090
|
|
|
2975
|
-
${(props) => props
|
|
3091
|
+
${(props) => props.$showCheckerboard && css`
|
|
2976
3092
|
background-image: linear-gradient(45deg, var(--checkerboard-color) 25%, transparent 25%),
|
|
2977
3093
|
linear-gradient(-45deg, var(--checkerboard-color) 25%, transparent 25%),
|
|
2978
3094
|
linear-gradient(45deg, transparent 75%, var(--checkerboard-color) 75%),
|
|
@@ -3076,204 +3192,226 @@ const imageDprUrl = (asset, options) => {
|
|
|
3076
3192
|
}
|
|
3077
3193
|
}, [getValues, lastRemovedTagIds, setValue]), useEffect(() => {
|
|
3078
3194
|
assetUpdatedPrev.current !== assetItem?.asset._updatedAt && reset(generateDefaultValues(assetItem?.asset)), assetUpdatedPrev.current = assetItem?.asset._updatedAt;
|
|
3079
|
-
}, [assetItem?.asset, generateDefaultValues, reset]), currentAsset ? /* @__PURE__ */ jsxs(
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
),
|
|
3118
|
-
/* @__PURE__ */ jsx(
|
|
3119
|
-
Tab,
|
|
3120
|
-
{
|
|
3121
|
-
"aria-controls": "references-panel",
|
|
3122
|
-
disabled: formUpdating,
|
|
3123
|
-
id: "references-tab",
|
|
3124
|
-
label: `References${!isLoading && Array.isArray(uniqueReferringDocuments) ? ` (${uniqueReferringDocuments.length})` : ""}`,
|
|
3125
|
-
onClick: () => setTabSection("references"),
|
|
3126
|
-
selected: tabSection === "references",
|
|
3127
|
-
size: 2
|
|
3128
|
-
}
|
|
3129
|
-
)
|
|
3130
|
-
] }),
|
|
3131
|
-
/* @__PURE__ */ jsxs(Box, { as: "form", marginTop: 4, onSubmit: handleSubmit(onSubmit), children: [
|
|
3132
|
-
!assetItem && /* @__PURE__ */ jsx(Card, { marginBottom: 3, padding: 3, radius: 2, shadow: 1, tone: "critical", children: /* @__PURE__ */ jsx(Text, { size: 1, children: "This file cannot be found \u2013 it may have been deleted." }) }),
|
|
3133
|
-
/* @__PURE__ */ jsx("button", { style: { display: "none" }, tabIndex: -1, type: "submit" }),
|
|
3134
|
-
/* @__PURE__ */ jsx(
|
|
3135
|
-
TabPanel,
|
|
3136
|
-
{
|
|
3137
|
-
"aria-labelledby": "details",
|
|
3138
|
-
hidden: tabSection !== "details",
|
|
3139
|
-
id: "details-panel",
|
|
3140
|
-
children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
|
|
3141
|
-
/* @__PURE__ */ jsx(
|
|
3142
|
-
FormFieldInputTags,
|
|
3143
|
-
{
|
|
3144
|
-
control,
|
|
3145
|
-
disabled: formUpdating,
|
|
3146
|
-
error: errors?.opt?.media?.tags?.message,
|
|
3147
|
-
label: "Tags",
|
|
3148
|
-
name: "opt.media.tags",
|
|
3149
|
-
onCreateTag: handleCreateTag,
|
|
3150
|
-
options: allTagOptions,
|
|
3151
|
-
placeholder: "Select or create...",
|
|
3152
|
-
value: assetTagOptions
|
|
3153
|
-
}
|
|
3154
|
-
),
|
|
3155
|
-
/* @__PURE__ */ jsx(
|
|
3156
|
-
FormFieldInputText,
|
|
3157
|
-
{
|
|
3158
|
-
...register("originalFilename"),
|
|
3159
|
-
disabled: formUpdating,
|
|
3160
|
-
error: errors?.originalFilename?.message,
|
|
3161
|
-
label: "Filename",
|
|
3162
|
-
name: "originalFilename",
|
|
3163
|
-
value: currentAsset?.originalFilename
|
|
3164
|
-
}
|
|
3165
|
-
),
|
|
3166
|
-
/* @__PURE__ */ jsx(
|
|
3167
|
-
FormFieldInputText,
|
|
3168
|
-
{
|
|
3169
|
-
...register("title"),
|
|
3170
|
-
disabled: formUpdating,
|
|
3171
|
-
error: errors?.title?.message,
|
|
3172
|
-
label: "Title",
|
|
3173
|
-
name: "title",
|
|
3174
|
-
value: currentAsset?.title
|
|
3175
|
-
}
|
|
3176
|
-
),
|
|
3177
|
-
/* @__PURE__ */ jsx(
|
|
3178
|
-
FormFieldInputText,
|
|
3179
|
-
{
|
|
3180
|
-
...register("altText"),
|
|
3181
|
-
disabled: formUpdating,
|
|
3182
|
-
error: errors?.altText?.message,
|
|
3183
|
-
label: "Alt Text",
|
|
3184
|
-
name: "altText",
|
|
3185
|
-
value: currentAsset?.altText
|
|
3186
|
-
}
|
|
3187
|
-
),
|
|
3188
|
-
/* @__PURE__ */ jsx(
|
|
3189
|
-
FormFieldInputTextarea,
|
|
3190
|
-
{
|
|
3191
|
-
...register("description"),
|
|
3192
|
-
disabled: formUpdating,
|
|
3193
|
-
error: errors?.description?.message,
|
|
3194
|
-
label: "Description",
|
|
3195
|
-
name: "description",
|
|
3196
|
-
rows: 5,
|
|
3197
|
-
value: currentAsset?.description
|
|
3198
|
-
}
|
|
3199
|
-
),
|
|
3200
|
-
creditLine?.enabled && /* @__PURE__ */ jsx(
|
|
3201
|
-
FormFieldInputText,
|
|
3202
|
-
{
|
|
3203
|
-
...register("creditLine"),
|
|
3204
|
-
error: errors?.creditLine?.message,
|
|
3205
|
-
label: "Credit",
|
|
3206
|
-
name: "creditLine",
|
|
3207
|
-
value: currentAsset?.creditLine,
|
|
3208
|
-
disabled: formUpdating || creditLine?.excludeSources?.includes(currentAsset?.source?.name)
|
|
3209
|
-
}
|
|
3210
|
-
)
|
|
3211
|
-
] })
|
|
3212
|
-
}
|
|
3213
|
-
),
|
|
3214
|
-
/* @__PURE__ */ jsx(
|
|
3215
|
-
TabPanel,
|
|
3216
|
-
{
|
|
3217
|
-
"aria-labelledby": "references",
|
|
3218
|
-
hidden: tabSection !== "references",
|
|
3219
|
-
id: "references-panel",
|
|
3220
|
-
children: /* @__PURE__ */ jsx(Box, { marginTop: 5, children: assetItem?.asset && /* @__PURE__ */ jsx(
|
|
3221
|
-
DocumentList,
|
|
3195
|
+
}, [assetItem?.asset, generateDefaultValues, reset]), currentAsset ? /* @__PURE__ */ jsxs(
|
|
3196
|
+
Dialog,
|
|
3197
|
+
{
|
|
3198
|
+
animate: !0,
|
|
3199
|
+
footer: /* @__PURE__ */ jsx(() => /* @__PURE__ */ jsx(Box, { padding: 3, children: /* @__PURE__ */ jsxs(Flex, { justify: "space-between", children: [
|
|
3200
|
+
/* @__PURE__ */ jsx(
|
|
3201
|
+
Button,
|
|
3202
|
+
{
|
|
3203
|
+
disabled: formUpdating,
|
|
3204
|
+
fontSize: 1,
|
|
3205
|
+
mode: "bleed",
|
|
3206
|
+
onClick: handleDelete,
|
|
3207
|
+
text: "Delete",
|
|
3208
|
+
tone: "critical"
|
|
3209
|
+
}
|
|
3210
|
+
),
|
|
3211
|
+
/* @__PURE__ */ jsx(
|
|
3212
|
+
FormSubmitButton,
|
|
3213
|
+
{
|
|
3214
|
+
disabled: formUpdating || !isDirty || !isValid,
|
|
3215
|
+
isValid,
|
|
3216
|
+
lastUpdated: currentAsset?._updatedAt,
|
|
3217
|
+
onClick: handleSubmit(onSubmit)
|
|
3218
|
+
}
|
|
3219
|
+
)
|
|
3220
|
+
] }) }), {}),
|
|
3221
|
+
header: "Asset details",
|
|
3222
|
+
id,
|
|
3223
|
+
onClose: handleClose,
|
|
3224
|
+
width: 3,
|
|
3225
|
+
children: [
|
|
3226
|
+
/* @__PURE__ */ jsxs(Flex, { direction: ["column-reverse", "column-reverse", "row-reverse"], children: [
|
|
3227
|
+
/* @__PURE__ */ jsx(Box, { flex: 1, marginTop: [5, 5, 0], padding: 4, children: /* @__PURE__ */ jsx(WithReferringDocuments, { documentStore, id: currentAsset._id, children: ({ isLoading, referringDocuments }) => {
|
|
3228
|
+
const uniqueReferringDocuments = getUniqueDocuments(referringDocuments);
|
|
3229
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3230
|
+
/* @__PURE__ */ jsxs(TabList, { space: 2, children: [
|
|
3231
|
+
/* @__PURE__ */ jsx(
|
|
3232
|
+
Tab,
|
|
3222
3233
|
{
|
|
3223
|
-
|
|
3224
|
-
|
|
3234
|
+
"aria-controls": "details-panel",
|
|
3235
|
+
disabled: formUpdating,
|
|
3236
|
+
id: "details-tab",
|
|
3237
|
+
label: "Details",
|
|
3238
|
+
onClick: () => setTabSection("details"),
|
|
3239
|
+
selected: tabSection === "details",
|
|
3240
|
+
size: 2
|
|
3225
3241
|
}
|
|
3226
|
-
)
|
|
3227
|
-
|
|
3228
|
-
|
|
3242
|
+
),
|
|
3243
|
+
/* @__PURE__ */ jsx(
|
|
3244
|
+
Tab,
|
|
3245
|
+
{
|
|
3246
|
+
"aria-controls": "references-panel",
|
|
3247
|
+
disabled: formUpdating,
|
|
3248
|
+
id: "references-tab",
|
|
3249
|
+
label: `References${!isLoading && Array.isArray(uniqueReferringDocuments) ? ` (${uniqueReferringDocuments.length})` : ""}`,
|
|
3250
|
+
onClick: () => setTabSection("references"),
|
|
3251
|
+
selected: tabSection === "references",
|
|
3252
|
+
size: 2
|
|
3253
|
+
}
|
|
3254
|
+
)
|
|
3255
|
+
] }),
|
|
3256
|
+
/* @__PURE__ */ jsxs(Box, { as: "form", marginTop: 4, onSubmit: handleSubmit(onSubmit), children: [
|
|
3257
|
+
!assetItem && /* @__PURE__ */ jsx(Card, { marginBottom: 3, padding: 3, radius: 2, shadow: 1, tone: "critical", children: /* @__PURE__ */ jsx(Text, { size: 1, children: "This file cannot be found \u2013 it may have been deleted." }) }),
|
|
3258
|
+
/* @__PURE__ */ jsx("button", { style: { display: "none" }, tabIndex: -1, type: "submit" }),
|
|
3259
|
+
/* @__PURE__ */ jsx(
|
|
3260
|
+
TabPanel,
|
|
3261
|
+
{
|
|
3262
|
+
"aria-labelledby": "details",
|
|
3263
|
+
hidden: tabSection !== "details",
|
|
3264
|
+
id: "details-panel",
|
|
3265
|
+
children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
|
|
3266
|
+
/* @__PURE__ */ jsx(
|
|
3267
|
+
FormFieldInputTags,
|
|
3268
|
+
{
|
|
3269
|
+
control,
|
|
3270
|
+
disabled: formUpdating,
|
|
3271
|
+
error: errors?.opt?.media?.tags?.message,
|
|
3272
|
+
label: "Tags",
|
|
3273
|
+
name: "opt.media.tags",
|
|
3274
|
+
onCreateTag: handleCreateTag,
|
|
3275
|
+
options: allTagOptions,
|
|
3276
|
+
placeholder: "Select or create...",
|
|
3277
|
+
value: assetTagOptions
|
|
3278
|
+
}
|
|
3279
|
+
),
|
|
3280
|
+
/* @__PURE__ */ jsx(
|
|
3281
|
+
FormFieldInputText,
|
|
3282
|
+
{
|
|
3283
|
+
...register("originalFilename"),
|
|
3284
|
+
disabled: formUpdating,
|
|
3285
|
+
error: errors?.originalFilename?.message,
|
|
3286
|
+
label: "Filename",
|
|
3287
|
+
name: "originalFilename",
|
|
3288
|
+
value: currentAsset?.originalFilename
|
|
3289
|
+
}
|
|
3290
|
+
),
|
|
3291
|
+
/* @__PURE__ */ jsx(
|
|
3292
|
+
FormFieldInputText,
|
|
3293
|
+
{
|
|
3294
|
+
...register("title"),
|
|
3295
|
+
disabled: formUpdating,
|
|
3296
|
+
error: errors?.title?.message,
|
|
3297
|
+
label: "Title",
|
|
3298
|
+
name: "title",
|
|
3299
|
+
value: currentAsset?.title
|
|
3300
|
+
}
|
|
3301
|
+
),
|
|
3302
|
+
/* @__PURE__ */ jsx(
|
|
3303
|
+
FormFieldInputText,
|
|
3304
|
+
{
|
|
3305
|
+
...register("altText"),
|
|
3306
|
+
disabled: formUpdating,
|
|
3307
|
+
error: errors?.altText?.message,
|
|
3308
|
+
label: "Alt Text",
|
|
3309
|
+
name: "altText",
|
|
3310
|
+
value: currentAsset?.altText
|
|
3311
|
+
}
|
|
3312
|
+
),
|
|
3313
|
+
/* @__PURE__ */ jsx(
|
|
3314
|
+
FormFieldInputTextarea,
|
|
3315
|
+
{
|
|
3316
|
+
...register("description"),
|
|
3317
|
+
disabled: formUpdating,
|
|
3318
|
+
error: errors?.description?.message,
|
|
3319
|
+
label: "Description",
|
|
3320
|
+
name: "description",
|
|
3321
|
+
rows: 5,
|
|
3322
|
+
value: currentAsset?.description
|
|
3323
|
+
}
|
|
3324
|
+
),
|
|
3325
|
+
creditLine?.enabled && /* @__PURE__ */ jsx(
|
|
3326
|
+
FormFieldInputText,
|
|
3327
|
+
{
|
|
3328
|
+
...register("creditLine"),
|
|
3329
|
+
error: errors?.creditLine?.message,
|
|
3330
|
+
label: "Credit",
|
|
3331
|
+
name: "creditLine",
|
|
3332
|
+
value: currentAsset?.creditLine,
|
|
3333
|
+
disabled: formUpdating || creditLine?.excludeSources?.includes(currentAsset?.source?.name)
|
|
3334
|
+
}
|
|
3335
|
+
)
|
|
3336
|
+
] })
|
|
3337
|
+
}
|
|
3338
|
+
),
|
|
3339
|
+
/* @__PURE__ */ jsx(
|
|
3340
|
+
TabPanel,
|
|
3341
|
+
{
|
|
3342
|
+
"aria-labelledby": "references",
|
|
3343
|
+
hidden: tabSection !== "references",
|
|
3344
|
+
id: "references-panel",
|
|
3345
|
+
children: /* @__PURE__ */ jsx(Box, { marginTop: 5, children: assetItem?.asset && /* @__PURE__ */ jsx(
|
|
3346
|
+
DocumentList,
|
|
3347
|
+
{
|
|
3348
|
+
documents: uniqueReferringDocuments,
|
|
3349
|
+
isLoading
|
|
3350
|
+
}
|
|
3351
|
+
) })
|
|
3352
|
+
}
|
|
3353
|
+
)
|
|
3354
|
+
] })
|
|
3355
|
+
] });
|
|
3356
|
+
} }) }),
|
|
3357
|
+
/* @__PURE__ */ jsxs(Box, { flex: 1, padding: 4, children: [
|
|
3358
|
+
/* @__PURE__ */ jsxs(Box, { style: { aspectRatio: "1" }, children: [
|
|
3359
|
+
isFileAsset(currentAsset) && /* @__PURE__ */ jsx(FileAssetPreview, { asset: currentAsset }),
|
|
3360
|
+
isImageAsset(currentAsset) && /* @__PURE__ */ jsx(
|
|
3361
|
+
Image$1,
|
|
3362
|
+
{
|
|
3363
|
+
draggable: !1,
|
|
3364
|
+
$scheme: scheme,
|
|
3365
|
+
$showCheckerboard: !currentAsset?.metadata?.isOpaque,
|
|
3366
|
+
src: imageDprUrl(currentAsset, { height: 600, width: 600 })
|
|
3367
|
+
}
|
|
3368
|
+
)
|
|
3369
|
+
] }),
|
|
3370
|
+
currentAsset && /* @__PURE__ */ jsx(Box, { marginTop: 4, children: /* @__PURE__ */ jsx(AssetMetadata, { asset: currentAsset, item: assetItem }) })
|
|
3229
3371
|
] })
|
|
3230
|
-
] });
|
|
3231
|
-
} }) }),
|
|
3232
|
-
/* @__PURE__ */ jsxs(Box, { flex: 1, padding: 4, children: [
|
|
3233
|
-
/* @__PURE__ */ jsxs(Box, { style: { aspectRatio: "1" }, children: [
|
|
3234
|
-
isFileAsset(currentAsset) && /* @__PURE__ */ jsx(FileAssetPreview, { asset: currentAsset }),
|
|
3235
|
-
isImageAsset(currentAsset) && /* @__PURE__ */ jsx(
|
|
3236
|
-
Image$1,
|
|
3237
|
-
{
|
|
3238
|
-
draggable: !1,
|
|
3239
|
-
scheme,
|
|
3240
|
-
showCheckerboard: !currentAsset?.metadata?.isOpaque,
|
|
3241
|
-
src: imageDprUrl(currentAsset, { height: 600, width: 600 })
|
|
3242
|
-
}
|
|
3243
|
-
)
|
|
3244
3372
|
] }),
|
|
3245
|
-
|
|
3246
|
-
]
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
] }) : null;
|
|
3373
|
+
children
|
|
3374
|
+
]
|
|
3375
|
+
}
|
|
3376
|
+
) : null;
|
|
3250
3377
|
}, DialogConfirm = (props) => {
|
|
3251
3378
|
const { children, dialog } = props, dispatch = useDispatch(), handleClose = () => {
|
|
3252
3379
|
dispatch(dialogActions.remove({ id: dialog?.id }));
|
|
3253
3380
|
}, handleConfirm = () => {
|
|
3254
3381
|
dialog?.closeDialogId && dispatch(dialogActions.remove({ id: dialog?.closeDialogId })), dialog?.confirmCallbackAction && dispatch(dialog.confirmCallbackAction), handleClose();
|
|
3255
3382
|
};
|
|
3256
|
-
return /* @__PURE__ */ jsxs(
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
{
|
|
3261
|
-
fontSize: 1,
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3383
|
+
return /* @__PURE__ */ jsxs(
|
|
3384
|
+
Dialog,
|
|
3385
|
+
{
|
|
3386
|
+
animate: !0,
|
|
3387
|
+
footer: /* @__PURE__ */ jsx(() => /* @__PURE__ */ jsx(Box, { padding: 3, children: /* @__PURE__ */ jsxs(Flex, { justify: "space-between", children: [
|
|
3388
|
+
/* @__PURE__ */ jsx(Button, { fontSize: 1, mode: "bleed", onClick: handleClose, text: "Cancel" }),
|
|
3389
|
+
/* @__PURE__ */ jsx(
|
|
3390
|
+
Button,
|
|
3391
|
+
{
|
|
3392
|
+
fontSize: 1,
|
|
3393
|
+
onClick: handleConfirm,
|
|
3394
|
+
text: dialog?.confirmText,
|
|
3395
|
+
tone: dialog?.tone
|
|
3396
|
+
}
|
|
3397
|
+
)
|
|
3398
|
+
] }) }), {}),
|
|
3399
|
+
header: /* @__PURE__ */ jsx(() => /* @__PURE__ */ jsxs(Flex, { align: "center", children: [
|
|
3400
|
+
/* @__PURE__ */ jsx(Box, { paddingX: 1, children: /* @__PURE__ */ jsx(WarningOutlineIcon, {}) }),
|
|
3401
|
+
/* @__PURE__ */ jsx(Box, { marginLeft: 2, children: dialog?.headerTitle })
|
|
3402
|
+
] }), {}),
|
|
3403
|
+
id: "confirm",
|
|
3404
|
+
onClose: handleClose,
|
|
3405
|
+
width: 1,
|
|
3406
|
+
children: [
|
|
3407
|
+
/* @__PURE__ */ jsx(Box, { paddingX: 4, paddingY: 4, children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
|
|
3408
|
+
dialog?.title && /* @__PURE__ */ jsx(Text, { size: 1, children: dialog.title }),
|
|
3409
|
+
dialog?.description && /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: /* @__PURE__ */ jsx("em", { children: dialog.description }) })
|
|
3410
|
+
] }) }),
|
|
3411
|
+
children
|
|
3412
|
+
]
|
|
3413
|
+
}
|
|
3414
|
+
);
|
|
3277
3415
|
}, DialogSearchFacets = (props) => {
|
|
3278
3416
|
const {
|
|
3279
3417
|
children,
|
|
@@ -3281,7 +3419,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
3281
3419
|
} = props, dispatch = useDispatch(), handleClose = useCallback(() => {
|
|
3282
3420
|
dispatch(dialogActions.clear());
|
|
3283
3421
|
}, []);
|
|
3284
|
-
return /* @__PURE__ */ jsxs(Dialog, { header: "Filters", id, onClose: handleClose, width: 1, children: [
|
|
3422
|
+
return /* @__PURE__ */ jsxs(Dialog, { animate: !0, header: "Filters", id, onClose: handleClose, width: 1, children: [
|
|
3285
3423
|
/* @__PURE__ */ jsxs(Box, { padding: 3, children: [
|
|
3286
3424
|
/* @__PURE__ */ jsx(SearchFacets, { layout: "stack" }),
|
|
3287
3425
|
/* @__PURE__ */ jsx(SearchFacetsControl, {})
|
|
@@ -3314,7 +3452,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
3314
3452
|
creatingError && setError("name", {
|
|
3315
3453
|
message: creatingError?.message
|
|
3316
3454
|
});
|
|
3317
|
-
}, [creatingError, setError]), /* @__PURE__ */ jsxs(Dialog, { footer: /* @__PURE__ */ jsx(() => /* @__PURE__ */ jsx(Box, { padding: 3, children: /* @__PURE__ */ jsx(Flex, { justify: "flex-end", children: /* @__PURE__ */ jsx(
|
|
3455
|
+
}, [creatingError, setError]), /* @__PURE__ */ jsxs(Dialog, { animate: !0, footer: /* @__PURE__ */ jsx(() => /* @__PURE__ */ jsx(Box, { padding: 3, children: /* @__PURE__ */ jsx(Flex, { justify: "flex-end", children: /* @__PURE__ */ jsx(
|
|
3318
3456
|
FormSubmitButton,
|
|
3319
3457
|
{
|
|
3320
3458
|
disabled: formUpdating || !isDirty || !isValid,
|
|
@@ -3397,7 +3535,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
3397
3535
|
return () => {
|
|
3398
3536
|
subscriptionAsset?.unsubscribe();
|
|
3399
3537
|
};
|
|
3400
|
-
}, [client, handleTagUpdate, tagItem?.tag]), currentTag ? /* @__PURE__ */ jsxs(Dialog, { footer: /* @__PURE__ */ jsx(() => /* @__PURE__ */ jsx(Box, { padding: 3, children: /* @__PURE__ */ jsxs(Flex, { justify: "space-between", children: [
|
|
3538
|
+
}, [client, handleTagUpdate, tagItem?.tag]), currentTag ? /* @__PURE__ */ jsxs(Dialog, { animate: !0, footer: /* @__PURE__ */ jsx(() => /* @__PURE__ */ jsx(Box, { padding: 3, children: /* @__PURE__ */ jsxs(Flex, { justify: "space-between", children: [
|
|
3401
3539
|
/* @__PURE__ */ jsx(
|
|
3402
3540
|
Button,
|
|
3403
3541
|
{
|
|
@@ -3452,6 +3590,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
3452
3590
|
return /* @__PURE__ */ jsx(
|
|
3453
3591
|
Tooltip,
|
|
3454
3592
|
{
|
|
3593
|
+
animate: !0,
|
|
3455
3594
|
content: /* @__PURE__ */ jsx(Container$2, { padding: 2, width: 0, children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: tooltip }) }),
|
|
3456
3595
|
disabled: "ontouchstart" in window,
|
|
3457
3596
|
placement: "top",
|
|
@@ -3690,7 +3829,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
3690
3829
|
} = props, dispatch = useDispatch(), handleClose = useCallback(() => {
|
|
3691
3830
|
dispatch(dialogActions.clear());
|
|
3692
3831
|
}, []);
|
|
3693
|
-
return /* @__PURE__ */ jsxs(Dialog, { header: "All Tags", id, onClose: handleClose, width: 1, children: [
|
|
3832
|
+
return /* @__PURE__ */ jsxs(Dialog, { animate: !0, header: "All Tags", id, onClose: handleClose, width: 1, children: [
|
|
3694
3833
|
/* @__PURE__ */ jsx(
|
|
3695
3834
|
Box,
|
|
3696
3835
|
{
|
|
@@ -3798,18 +3937,18 @@ const imageDprUrl = (asset, options) => {
|
|
|
3798
3937
|
position: relative;
|
|
3799
3938
|
width: 100%;
|
|
3800
3939
|
`, CardContainer = styled(Flex)(
|
|
3801
|
-
({ picked, theme, updating }) => css`
|
|
3940
|
+
({ $picked, theme, $updating }) => css`
|
|
3802
3941
|
border: 1px solid transparent;
|
|
3803
3942
|
height: 100%;
|
|
3804
|
-
pointer-events: ${updating ? "none" : "auto"};
|
|
3943
|
+
pointer-events: ${$updating ? "none" : "auto"};
|
|
3805
3944
|
position: relative;
|
|
3806
3945
|
transition: all 300ms;
|
|
3807
3946
|
user-select: none;
|
|
3808
3947
|
width: 100%;
|
|
3809
3948
|
|
|
3810
|
-
border: ${picked ? `1px solid ${theme.sanity.color.spot.orange} !important` : "1px solid inherit"};
|
|
3949
|
+
border: ${$picked ? `1px solid ${theme.sanity.color.spot.orange} !important` : "1px solid inherit"};
|
|
3811
3950
|
|
|
3812
|
-
${
|
|
3951
|
+
${!$updating && css`
|
|
3813
3952
|
@media (hover: hover) and (pointer: fine) {
|
|
3814
3953
|
&:hover {
|
|
3815
3954
|
border: 1px solid var(--card-border-color);
|
|
@@ -3818,14 +3957,13 @@ const imageDprUrl = (asset, options) => {
|
|
|
3818
3957
|
`}
|
|
3819
3958
|
`
|
|
3820
3959
|
), ContextActionContainer$2 = styled(Flex)(
|
|
3821
|
-
|
|
3822
|
-
({ scheme }) => css`
|
|
3960
|
+
({ $scheme }) => css`
|
|
3823
3961
|
cursor: pointer;
|
|
3824
3962
|
height: ${PANEL_HEIGHT}px;
|
|
3825
3963
|
transition: all 300ms;
|
|
3826
3964
|
@media (hover: hover) and (pointer: fine) {
|
|
3827
3965
|
&:hover {
|
|
3828
|
-
background: ${getSchemeColor(scheme, "bg")};
|
|
3966
|
+
background: ${getSchemeColor($scheme, "bg")};
|
|
3829
3967
|
}
|
|
3830
3968
|
}
|
|
3831
3969
|
`
|
|
@@ -3845,7 +3983,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
3845
3983
|
}, handleContextActionClick = (e) => {
|
|
3846
3984
|
e.stopPropagation(), 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 }));
|
|
3847
3985
|
}, opacityContainer = updating ? 0.5 : 1, opacityPreview = selected || updating ? 0.25 : 1;
|
|
3848
|
-
return /* @__PURE__ */ jsx(CardWrapper$1, { padding: 1, children: /* @__PURE__ */ jsxs(CardContainer, { direction: "column", picked, updating: item.updating, children: [
|
|
3986
|
+
return /* @__PURE__ */ jsx(CardWrapper$1, { padding: 1, children: /* @__PURE__ */ jsxs(CardContainer, { direction: "column", $picked: picked, $updating: item.updating, children: [
|
|
3849
3987
|
/* @__PURE__ */ jsxs(
|
|
3850
3988
|
Box,
|
|
3851
3989
|
{
|
|
@@ -3861,8 +3999,8 @@ const imageDprUrl = (asset, options) => {
|
|
|
3861
3999
|
Image$1,
|
|
3862
4000
|
{
|
|
3863
4001
|
draggable: !1,
|
|
3864
|
-
scheme,
|
|
3865
|
-
showCheckerboard: !isOpaque,
|
|
4002
|
+
$scheme: scheme,
|
|
4003
|
+
$showCheckerboard: !isOpaque,
|
|
3866
4004
|
src: imageDprUrl(asset, { height: 250, width: 250 }),
|
|
3867
4005
|
style: {
|
|
3868
4006
|
draggable: !1,
|
|
@@ -3911,7 +4049,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
3911
4049
|
align: "center",
|
|
3912
4050
|
onClick: handleContextActionClick,
|
|
3913
4051
|
paddingX: 1,
|
|
3914
|
-
scheme,
|
|
4052
|
+
$scheme: scheme,
|
|
3915
4053
|
style: { opacity: opacityContainer },
|
|
3916
4054
|
children: [
|
|
3917
4055
|
onSelect ? /* @__PURE__ */ jsx(
|
|
@@ -3950,6 +4088,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
3950
4088
|
children: /* @__PURE__ */ jsx(
|
|
3951
4089
|
Tooltip,
|
|
3952
4090
|
{
|
|
4091
|
+
animate: !0,
|
|
3953
4092
|
content: /* @__PURE__ */ jsx(Container$2, { padding: 2, width: 0, children: /* @__PURE__ */ jsx(Text, { size: 1, children: error }) }),
|
|
3954
4093
|
placement: "left",
|
|
3955
4094
|
portal: !0,
|
|
@@ -4259,7 +4398,7 @@ const CardWrapper = styled(Flex)`
|
|
|
4259
4398
|
Image$1,
|
|
4260
4399
|
{
|
|
4261
4400
|
draggable: !1,
|
|
4262
|
-
scheme,
|
|
4401
|
+
$scheme: scheme,
|
|
4263
4402
|
src: item.objectUrl,
|
|
4264
4403
|
style: {
|
|
4265
4404
|
opacity: 0.4
|
|
@@ -4318,16 +4457,26 @@ const CardWrapper = styled(Flex)`
|
|
|
4318
4457
|
) });
|
|
4319
4458
|
}, CARD_HEIGHT = 220, CARD_WIDTH = 240, VirtualCell = memo(
|
|
4320
4459
|
({ item, selected }) => item?.type === "asset" ? /* @__PURE__ */ jsx(CardAsset$1, { id: item.id, selected }) : item?.type === "upload" ? /* @__PURE__ */ jsx(CardUpload, { id: item.id }) : null
|
|
4321
|
-
),
|
|
4460
|
+
), StyledItemContainer = styled.div`
|
|
4322
4461
|
height: ${CARD_HEIGHT}px;
|
|
4323
4462
|
width: ${CARD_WIDTH}px;
|
|
4324
|
-
|
|
4463
|
+
`;
|
|
4464
|
+
function ItemContainer(props) {
|
|
4465
|
+
const { context, ...rest } = props;
|
|
4466
|
+
return /* @__PURE__ */ jsx(StyledItemContainer, { ...rest });
|
|
4467
|
+
}
|
|
4468
|
+
const StyledListContainer = styled.div`
|
|
4325
4469
|
display: grid;
|
|
4326
4470
|
grid-template-columns: repeat(auto-fill, ${CARD_WIDTH}px);
|
|
4327
4471
|
grid-template-rows: repeat(auto-fill, ${CARD_HEIGHT}px);
|
|
4328
4472
|
justify-content: center;
|
|
4329
4473
|
margin: 0 auto;
|
|
4330
|
-
|
|
4474
|
+
`;
|
|
4475
|
+
function ListContainer(props) {
|
|
4476
|
+
const { context, ...rest } = props;
|
|
4477
|
+
return /* @__PURE__ */ jsx(StyledListContainer, { ...rest });
|
|
4478
|
+
}
|
|
4479
|
+
const AssetGridVirtualized = (props) => {
|
|
4331
4480
|
const { items, onLoadMore } = props, selectedAssets = useTypedSelector((state) => state.selected.assets), selectedIds = selectedAssets && selectedAssets.map((asset) => asset._id) || [], totalCount = items?.length;
|
|
4332
4481
|
return totalCount === 0 ? null : /* @__PURE__ */ jsx(
|
|
4333
4482
|
VirtuosoGrid,
|
|
@@ -4336,7 +4485,6 @@ const CardWrapper = styled(Flex)`
|
|
|
4336
4485
|
computeItemKey: (index) => items[index]?.id,
|
|
4337
4486
|
components: {
|
|
4338
4487
|
Item: ItemContainer,
|
|
4339
|
-
// @ts-expect-error - fix typings later
|
|
4340
4488
|
List: ListContainer
|
|
4341
4489
|
},
|
|
4342
4490
|
endReached: onLoadMore,
|
|
@@ -4383,12 +4531,11 @@ const CardWrapper = styled(Flex)`
|
|
|
4383
4531
|
}
|
|
4384
4532
|
) });
|
|
4385
4533
|
}, ContextActionContainer$1 = styled(Flex)(
|
|
4386
|
-
|
|
4387
|
-
({ scheme }) => css`
|
|
4534
|
+
({ $scheme }) => css`
|
|
4388
4535
|
cursor: pointer;
|
|
4389
4536
|
@media (hover: hover) and (pointer: fine) {
|
|
4390
4537
|
&:hover {
|
|
4391
|
-
background: ${getSchemeColor(scheme, "bg")};
|
|
4538
|
+
background: ${getSchemeColor($scheme, "bg")};
|
|
4392
4539
|
}
|
|
4393
4540
|
}
|
|
4394
4541
|
`
|
|
@@ -4422,7 +4569,7 @@ const CardWrapper = styled(Flex)`
|
|
|
4422
4569
|
align: "center",
|
|
4423
4570
|
justify: "center",
|
|
4424
4571
|
onClick: handleContextActionClick,
|
|
4425
|
-
scheme,
|
|
4572
|
+
$scheme: scheme,
|
|
4426
4573
|
style: {
|
|
4427
4574
|
height: "100%",
|
|
4428
4575
|
position: "relative"
|
|
@@ -4452,39 +4599,34 @@ const CardWrapper = styled(Flex)`
|
|
|
4452
4599
|
]
|
|
4453
4600
|
}
|
|
4454
4601
|
);
|
|
4455
|
-
}, REFERENCE_COUNT_VISIBILITY_DELAY = 750, ContainerGrid = styled(Grid)(
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
align-items: center;
|
|
4463
|
-
cursor: ${selected ? "default" : "pointer"};
|
|
4464
|
-
height: 100%;
|
|
4465
|
-
pointer-events: ${updating ? "none" : "auto"};
|
|
4466
|
-
user-select: none;
|
|
4467
|
-
white-space: nowrap;
|
|
4602
|
+
}, REFERENCE_COUNT_VISIBILITY_DELAY = 750, ContainerGrid = styled(Grid)(({ $scheme, $selected, $updating }) => css`
|
|
4603
|
+
align-items: center;
|
|
4604
|
+
cursor: ${$selected ? "default" : "pointer"};
|
|
4605
|
+
height: 100%;
|
|
4606
|
+
pointer-events: ${$updating ? "none" : "auto"};
|
|
4607
|
+
user-select: none;
|
|
4608
|
+
white-space: nowrap;
|
|
4468
4609
|
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
}
|
|
4610
|
+
${!$updating && css`
|
|
4611
|
+
@media (hover: hover) and (pointer: fine) {
|
|
4612
|
+
&:hover {
|
|
4613
|
+
background: ${getSchemeColor($scheme, "bg")};
|
|
4474
4614
|
}
|
|
4475
|
-
`}
|
|
4476
|
-
`
|
|
4477
|
-
), ContextActionContainer = styled(Flex)(({ scheme }) => css`
|
|
4478
|
-
cursor: pointer;
|
|
4479
|
-
@media (hover: hover) and (pointer: fine) {
|
|
4480
|
-
&:hover {
|
|
4481
|
-
background: ${getSchemeColor(scheme, "bg2")};
|
|
4482
4615
|
}
|
|
4483
|
-
}
|
|
4484
|
-
`),
|
|
4616
|
+
`}
|
|
4617
|
+
`), ContextActionContainer = styled(Flex)(
|
|
4618
|
+
({ $scheme }) => css`
|
|
4619
|
+
cursor: pointer;
|
|
4620
|
+
@media (hover: hover) and (pointer: fine) {
|
|
4621
|
+
&:hover {
|
|
4622
|
+
background: ${getSchemeColor($scheme, "bg2")};
|
|
4623
|
+
}
|
|
4624
|
+
}
|
|
4625
|
+
`
|
|
4626
|
+
), StyledWarningIcon = styled(WarningFilledIcon)(({ theme }) => ({
|
|
4485
4627
|
color: theme.sanity.color.spot.red
|
|
4486
4628
|
})), 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(
|
|
4629
|
+
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
4630
|
(e) => {
|
|
4489
4631
|
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
4632
|
},
|
|
@@ -4504,21 +4646,21 @@ const CardWrapper = styled(Flex)`
|
|
|
4504
4646
|
ContainerGrid,
|
|
4505
4647
|
{
|
|
4506
4648
|
onClick: selected ? void 0 : handleClick,
|
|
4507
|
-
scheme,
|
|
4508
|
-
selected,
|
|
4649
|
+
$scheme: scheme,
|
|
4650
|
+
$selected: selected,
|
|
4509
4651
|
style: {
|
|
4510
4652
|
gridColumnGap: mediaIndex < 3 ? 0 : "16px",
|
|
4511
4653
|
gridRowGap: 0,
|
|
4512
4654
|
gridTemplateColumns: mediaIndex < 3 ? GRID_TEMPLATE_COLUMNS.SMALL : GRID_TEMPLATE_COLUMNS.LARGE,
|
|
4513
4655
|
gridTemplateRows: mediaIndex < 3 ? "auto" : "1fr"
|
|
4514
4656
|
},
|
|
4515
|
-
updating: item.updating,
|
|
4657
|
+
$updating: item.updating,
|
|
4516
4658
|
children: [
|
|
4517
4659
|
/* @__PURE__ */ jsx(
|
|
4518
4660
|
ContextActionContainer,
|
|
4519
4661
|
{
|
|
4520
4662
|
onClick: handleContextActionClick,
|
|
4521
|
-
scheme,
|
|
4663
|
+
$scheme: scheme,
|
|
4522
4664
|
style: {
|
|
4523
4665
|
alignItems: "center",
|
|
4524
4666
|
gridColumn: 1,
|
|
@@ -4568,8 +4710,8 @@ const CardWrapper = styled(Flex)`
|
|
|
4568
4710
|
Image$1,
|
|
4569
4711
|
{
|
|
4570
4712
|
draggable: !1,
|
|
4571
|
-
scheme,
|
|
4572
|
-
showCheckerboard: !isOpaque,
|
|
4713
|
+
$scheme: scheme,
|
|
4714
|
+
$showCheckerboard: !isOpaque,
|
|
4573
4715
|
src: imageDprUrl(asset, { height: 100, width: 100 })
|
|
4574
4716
|
}
|
|
4575
4717
|
)
|
|
@@ -4696,6 +4838,7 @@ const CardWrapper = styled(Flex)`
|
|
|
4696
4838
|
children: error && /* @__PURE__ */ jsx(Box, { padding: 2, children: /* @__PURE__ */ jsx(
|
|
4697
4839
|
Tooltip,
|
|
4698
4840
|
{
|
|
4841
|
+
animate: !0,
|
|
4699
4842
|
content: /* @__PURE__ */ jsx(Container$2, { padding: 2, width: 0, children: /* @__PURE__ */ jsx(Text, { size: 1, children: error }) }),
|
|
4700
4843
|
placement: "left",
|
|
4701
4844
|
portal: !0,
|
|
@@ -4760,7 +4903,15 @@ const TableRowUpload = (props) => {
|
|
|
4760
4903
|
width: "100px"
|
|
4761
4904
|
},
|
|
4762
4905
|
children: /* @__PURE__ */ jsxs(Box, { style: { height: "100%", position: "relative" }, children: [
|
|
4763
|
-
item.assetType === "image" && item?.objectUrl && /* @__PURE__ */ jsx(
|
|
4906
|
+
item.assetType === "image" && item?.objectUrl && /* @__PURE__ */ jsx(
|
|
4907
|
+
Image$1,
|
|
4908
|
+
{
|
|
4909
|
+
draggable: !1,
|
|
4910
|
+
$scheme: scheme,
|
|
4911
|
+
src: item.objectUrl,
|
|
4912
|
+
style: { opacity: 0.25 }
|
|
4913
|
+
}
|
|
4914
|
+
),
|
|
4764
4915
|
item.assetType === "file" && /* @__PURE__ */ jsx("div", { style: { height: "100%", opacity: 0.1 }, children: /* @__PURE__ */ jsx(FileIcon, { width: "40px" }) }),
|
|
4765
4916
|
!isComplete && percentLoaded !== 100 && /* @__PURE__ */ jsx(
|
|
4766
4917
|
Flex,
|
|
@@ -5248,14 +5399,15 @@ const UploadDropzone = (props) => {
|
|
|
5248
5399
|
children
|
|
5249
5400
|
] }) });
|
|
5250
5401
|
}, BrowserContent = ({ onClose }) => {
|
|
5251
|
-
const client = useVersionedClient(), [portalElement, setPortalElement] = useState(null), dispatch = useDispatch()
|
|
5252
|
-
const { documentId, result, transition } = update;
|
|
5253
|
-
transition === "appear" && dispatch(assetsActions.listenerCreateQueue({ asset: result })), transition === "disappear" && dispatch(assetsActions.listenerDeleteQueue({ assetId: documentId })), transition === "update" && dispatch(assetsActions.listenerUpdateQueue({ asset: result }));
|
|
5254
|
-
}, handleTagUpdate = (update) => {
|
|
5255
|
-
const { documentId, result, transition } = update;
|
|
5256
|
-
transition === "appear" && dispatch(tagsActions.listenerCreateQueue({ tag: result })), transition === "disappear" && dispatch(tagsActions.listenerDeleteQueue({ tagId: documentId })), transition === "update" && dispatch(tagsActions.listenerUpdateQueue({ tag: result }));
|
|
5257
|
-
};
|
|
5402
|
+
const client = useVersionedClient(), [portalElement, setPortalElement] = useState(null), dispatch = useDispatch();
|
|
5258
5403
|
return useEffect(() => {
|
|
5404
|
+
const handleAssetUpdate = (update) => {
|
|
5405
|
+
const { documentId, result, transition } = update;
|
|
5406
|
+
transition === "appear" && dispatch(assetsActions.listenerCreateQueue({ asset: result })), transition === "disappear" && dispatch(assetsActions.listenerDeleteQueue({ assetId: documentId })), transition === "update" && dispatch(assetsActions.listenerUpdateQueue({ asset: result }));
|
|
5407
|
+
}, handleTagUpdate = (update) => {
|
|
5408
|
+
const { documentId, result, transition } = update;
|
|
5409
|
+
transition === "appear" && dispatch(tagsActions.listenerCreateQueue({ tag: result })), transition === "disappear" && dispatch(tagsActions.listenerDeleteQueue({ tagId: documentId })), transition === "update" && dispatch(tagsActions.listenerUpdateQueue({ tag: result }));
|
|
5410
|
+
};
|
|
5259
5411
|
dispatch(assetsActions.loadPageIndex({ pageIndex: 0 })), dispatch(tagsActions.fetchRequest());
|
|
5260
5412
|
const subscriptionAsset = client.listen(
|
|
5261
5413
|
groq`*[_type in ["sanity.fileAsset", "sanity.imageAsset"] && !(_id in path("drafts.**"))]`
|
|
@@ -5263,7 +5415,7 @@ const UploadDropzone = (props) => {
|
|
|
5263
5415
|
return () => {
|
|
5264
5416
|
subscriptionAsset?.unsubscribe(), subscriptionTag?.unsubscribe();
|
|
5265
5417
|
};
|
|
5266
|
-
}, []), /* @__PURE__ */ jsx(PortalProvider, { element: portalElement, children: /* @__PURE__ */ jsxs(UploadDropzone, { children: [
|
|
5418
|
+
}, [client, dispatch]), /* @__PURE__ */ jsx(PortalProvider, { element: portalElement, children: /* @__PURE__ */ jsxs(UploadDropzone, { children: [
|
|
5267
5419
|
/* @__PURE__ */ jsx(Dialogs, {}),
|
|
5268
5420
|
/* @__PURE__ */ jsx(Notifications, {}),
|
|
5269
5421
|
/* @__PURE__ */ jsx(Card, { display: "flex", height: "fill", ref: setPortalElement, children: /* @__PURE__ */ jsxs(Flex, { direction: "column", flex: 1, children: [
|
|
@@ -5280,7 +5432,7 @@ const UploadDropzone = (props) => {
|
|
|
5280
5432
|
] }) })
|
|
5281
5433
|
] }) });
|
|
5282
5434
|
}, Browser = (props) => {
|
|
5283
|
-
const client = useVersionedClient()
|
|
5435
|
+
const client = useVersionedClient();
|
|
5284
5436
|
return /* @__PURE__ */ jsx(
|
|
5285
5437
|
ReduxProvider,
|
|
5286
5438
|
{
|
|
@@ -5288,10 +5440,10 @@ const UploadDropzone = (props) => {
|
|
|
5288
5440
|
client,
|
|
5289
5441
|
document: props?.document,
|
|
5290
5442
|
selectedAssets: props?.selectedAssets,
|
|
5291
|
-
children: /* @__PURE__ */
|
|
5443
|
+
children: /* @__PURE__ */ jsxs(AssetBrowserDispatchProvider, { onSelect: props?.onSelect, children: [
|
|
5292
5444
|
/* @__PURE__ */ jsx(GlobalStyle, {}),
|
|
5293
5445
|
/* @__PURE__ */ jsx(BrowserContent, { onClose: props?.onClose })
|
|
5294
|
-
] })
|
|
5446
|
+
] })
|
|
5295
5447
|
}
|
|
5296
5448
|
);
|
|
5297
5449
|
}, FormBuilderTool = (props) => {
|