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.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
-
var jsxRuntime = require("react/jsx-runtime"), sanity = require("sanity"), icons = require("@sanity/icons"), ui = require("@sanity/ui"), react = require("react"),
|
|
3
|
+
var jsxRuntime = require("react/jsx-runtime"), sanity = require("sanity"), icons = require("@sanity/icons"), ui = require("@sanity/ui"), react = require("react"), groq = require("groq"), reactRedux = require("react-redux"), toolkit = require("@reduxjs/toolkit"), nanoid = require("nanoid"), reduxObservable = require("redux-observable"), rxjs = require("rxjs"), operators$1 = require("rxjs/operators"), uuid = require("@sanity/uuid"), styledComponents = require("styled-components"), pluralize = require("pluralize"), reactNprogress = require("@tanem/react-nprogress"), color = require("@sanity/color"), Select = require("react-select"), reactVirtuoso = require("react-virtuoso"), zod = require("@hookform/resolvers/zod"), reactHookForm = require("react-hook-form"), z = require("zod"), format = require("date-fns/format"), filesize = require("filesize"), copy = require("copy-to-clipboard"), router = require("sanity/router"), reactFileIcon = require("react-file-icon"), CreatableSelect = require("react-select/creatable"), formatRelative = require("date-fns/formatRelative"), reactDropzone = require("react-dropzone");
|
|
4
4
|
function _interopDefaultCompat(e) {
|
|
5
5
|
return e && typeof e == "object" && "default" in e ? e : { default: e };
|
|
6
6
|
}
|
|
@@ -19,11 +19,148 @@ function _interopNamespaceCompat(e) {
|
|
|
19
19
|
}
|
|
20
20
|
}), n.default = e, Object.freeze(n);
|
|
21
21
|
}
|
|
22
|
-
var
|
|
22
|
+
var groq__default = /* @__PURE__ */ _interopDefaultCompat(groq), pluralize__default = /* @__PURE__ */ _interopDefaultCompat(pluralize), Select__default = /* @__PURE__ */ _interopDefaultCompat(Select), z__namespace = /* @__PURE__ */ _interopNamespaceCompat(z), format__default = /* @__PURE__ */ _interopDefaultCompat(format), filesize__default = /* @__PURE__ */ _interopDefaultCompat(filesize), copy__default = /* @__PURE__ */ _interopDefaultCompat(copy), CreatableSelect__default = /* @__PURE__ */ _interopDefaultCompat(CreatableSelect), formatRelative__default = /* @__PURE__ */ _interopDefaultCompat(formatRelative);
|
|
23
|
+
function getDefaultExportFromCjs(x) {
|
|
24
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x.default : x;
|
|
25
|
+
}
|
|
26
|
+
var lib = {}, hasRequiredLib;
|
|
27
|
+
function requireLib() {
|
|
28
|
+
if (hasRequiredLib) return lib;
|
|
29
|
+
hasRequiredLib = 1, Object.defineProperty(lib, "__esModule", {
|
|
30
|
+
value: !0
|
|
31
|
+
});
|
|
32
|
+
for (var IS_MAC = typeof window < "u" && /Mac|iPod|iPhone|iPad/.test(window.navigator.platform), MODIFIERS = {
|
|
33
|
+
alt: "altKey",
|
|
34
|
+
control: "ctrlKey",
|
|
35
|
+
meta: "metaKey",
|
|
36
|
+
shift: "shiftKey"
|
|
37
|
+
}, ALIASES = {
|
|
38
|
+
add: "+",
|
|
39
|
+
break: "pause",
|
|
40
|
+
cmd: "meta",
|
|
41
|
+
command: "meta",
|
|
42
|
+
ctl: "control",
|
|
43
|
+
ctrl: "control",
|
|
44
|
+
del: "delete",
|
|
45
|
+
down: "arrowdown",
|
|
46
|
+
esc: "escape",
|
|
47
|
+
ins: "insert",
|
|
48
|
+
left: "arrowleft",
|
|
49
|
+
mod: IS_MAC ? "meta" : "control",
|
|
50
|
+
opt: "alt",
|
|
51
|
+
option: "alt",
|
|
52
|
+
return: "enter",
|
|
53
|
+
right: "arrowright",
|
|
54
|
+
space: " ",
|
|
55
|
+
spacebar: " ",
|
|
56
|
+
up: "arrowup",
|
|
57
|
+
win: "meta",
|
|
58
|
+
windows: "meta"
|
|
59
|
+
}, CODES = {
|
|
60
|
+
backspace: 8,
|
|
61
|
+
tab: 9,
|
|
62
|
+
enter: 13,
|
|
63
|
+
shift: 16,
|
|
64
|
+
control: 17,
|
|
65
|
+
alt: 18,
|
|
66
|
+
pause: 19,
|
|
67
|
+
capslock: 20,
|
|
68
|
+
escape: 27,
|
|
69
|
+
" ": 32,
|
|
70
|
+
pageup: 33,
|
|
71
|
+
pagedown: 34,
|
|
72
|
+
end: 35,
|
|
73
|
+
home: 36,
|
|
74
|
+
arrowleft: 37,
|
|
75
|
+
arrowup: 38,
|
|
76
|
+
arrowright: 39,
|
|
77
|
+
arrowdown: 40,
|
|
78
|
+
insert: 45,
|
|
79
|
+
delete: 46,
|
|
80
|
+
meta: 91,
|
|
81
|
+
numlock: 144,
|
|
82
|
+
scrolllock: 145,
|
|
83
|
+
";": 186,
|
|
84
|
+
"=": 187,
|
|
85
|
+
",": 188,
|
|
86
|
+
"-": 189,
|
|
87
|
+
".": 190,
|
|
88
|
+
"/": 191,
|
|
89
|
+
"`": 192,
|
|
90
|
+
"[": 219,
|
|
91
|
+
"\\": 220,
|
|
92
|
+
"]": 221,
|
|
93
|
+
"'": 222
|
|
94
|
+
}, f = 1; f < 20; f++)
|
|
95
|
+
CODES["f" + f] = 111 + f;
|
|
96
|
+
function isHotkey2(hotkey, options, event) {
|
|
97
|
+
options && !("byKey" in options) && (event = options, options = null), Array.isArray(hotkey) || (hotkey = [hotkey]);
|
|
98
|
+
var array = hotkey.map(function(string) {
|
|
99
|
+
return parseHotkey(string, options);
|
|
100
|
+
}), check = function(e) {
|
|
101
|
+
return array.some(function(object) {
|
|
102
|
+
return compareHotkey(object, e);
|
|
103
|
+
});
|
|
104
|
+
}, ret = event == null ? check : check(event);
|
|
105
|
+
return ret;
|
|
106
|
+
}
|
|
107
|
+
function isCodeHotkey(hotkey, event) {
|
|
108
|
+
return isHotkey2(hotkey, event);
|
|
109
|
+
}
|
|
110
|
+
function isKeyHotkey(hotkey, event) {
|
|
111
|
+
return isHotkey2(hotkey, { byKey: !0 }, event);
|
|
112
|
+
}
|
|
113
|
+
function parseHotkey(hotkey, options) {
|
|
114
|
+
var byKey = options && options.byKey, ret = {};
|
|
115
|
+
hotkey = hotkey.replace("++", "+add");
|
|
116
|
+
var values = hotkey.split("+"), length = values.length;
|
|
117
|
+
for (var k in MODIFIERS)
|
|
118
|
+
ret[MODIFIERS[k]] = !1;
|
|
119
|
+
var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
|
120
|
+
try {
|
|
121
|
+
for (var _iterator = values[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
|
122
|
+
var value = _step.value, optional = value.endsWith("?") && value.length > 1;
|
|
123
|
+
optional && (value = value.slice(0, -1));
|
|
124
|
+
var name = toKeyName(value), modifier = MODIFIERS[name];
|
|
125
|
+
if (value.length > 1 && !modifier && !ALIASES[value] && !CODES[name])
|
|
126
|
+
throw new TypeError('Unknown modifier: "' + value + '"');
|
|
127
|
+
(length === 1 || !modifier) && (byKey ? ret.key = name : ret.which = toKeyCode(value)), modifier && (ret[modifier] = optional ? null : !0);
|
|
128
|
+
}
|
|
129
|
+
} catch (err) {
|
|
130
|
+
_didIteratorError = !0, _iteratorError = err;
|
|
131
|
+
} finally {
|
|
132
|
+
try {
|
|
133
|
+
!_iteratorNormalCompletion && _iterator.return && _iterator.return();
|
|
134
|
+
} finally {
|
|
135
|
+
if (_didIteratorError)
|
|
136
|
+
throw _iteratorError;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return ret;
|
|
140
|
+
}
|
|
141
|
+
function compareHotkey(object, event) {
|
|
142
|
+
for (var key in object) {
|
|
143
|
+
var expected = object[key], actual = void 0;
|
|
144
|
+
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))
|
|
145
|
+
return !1;
|
|
146
|
+
}
|
|
147
|
+
return !0;
|
|
148
|
+
}
|
|
149
|
+
function toKeyCode(name) {
|
|
150
|
+
name = toKeyName(name);
|
|
151
|
+
var code = CODES[name] || name.toUpperCase().charCodeAt(0);
|
|
152
|
+
return code;
|
|
153
|
+
}
|
|
154
|
+
function toKeyName(name) {
|
|
155
|
+
return name = name.toLowerCase(), name = ALIASES[name] || name, name;
|
|
156
|
+
}
|
|
157
|
+
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;
|
|
158
|
+
}
|
|
159
|
+
var libExports = requireLib(), isHotkey = /* @__PURE__ */ getDefaultExportFromCjs(libExports);
|
|
23
160
|
const useKeyPress = (hotkey, onPress) => {
|
|
24
161
|
const keyPressed = react.useRef(!1), downHandler = react.useCallback(
|
|
25
162
|
(e) => {
|
|
26
|
-
|
|
163
|
+
isHotkey(hotkey, e) && (keyPressed.current = !0, onPress && onPress());
|
|
27
164
|
},
|
|
28
165
|
[hotkey, onPress]
|
|
29
166
|
), upHandler = react.useCallback(() => {
|
|
@@ -1687,6 +1824,7 @@ const ButtonViewGroup = () => {
|
|
|
1687
1824
|
function usePortalPopoverProps() {
|
|
1688
1825
|
const portal = ui.usePortal();
|
|
1689
1826
|
return {
|
|
1827
|
+
animate: !0,
|
|
1690
1828
|
constrainSize: !0,
|
|
1691
1829
|
floatingBoundary: portal.element,
|
|
1692
1830
|
portal: !0,
|
|
@@ -1802,36 +1940,29 @@ const OrderSelect = () => {
|
|
|
1802
1940
|
function getSchemeColor(scheme, colorKey) {
|
|
1803
1941
|
return SCHEME_COLORS[colorKey]?.[scheme];
|
|
1804
1942
|
}
|
|
1805
|
-
const Container$1 = styledComponents.styled(ui.Box)(({ scheme, theme }) => styledComponents.css`
|
|
1806
|
-
background: ${getSchemeColor(scheme, "bg")};
|
|
1943
|
+
const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styledComponents.css`
|
|
1944
|
+
background: ${getSchemeColor($scheme, "bg")};
|
|
1807
1945
|
border-radius: ${ui.rem(theme.sanity.radius[2])};
|
|
1808
1946
|
`), SearchFacet = (props) => {
|
|
1809
1947
|
const { children, facet } = props, scheme = sanity.useColorSchemeValue(), dispatch = reactRedux.useDispatch(), handleClose = () => {
|
|
1810
1948
|
dispatch(searchActions.facetsRemoveById({ facetId: facet.id }));
|
|
1811
1949
|
};
|
|
1812
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", children: [
|
|
1829
|
-
children,
|
|
1830
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginLeft: 1, paddingX: 2, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 0, children: /* @__PURE__ */ jsxRuntime.jsx(icons.CloseIcon, { onClick: handleClose }) }) })
|
|
1831
|
-
] })
|
|
1832
|
-
] })
|
|
1833
|
-
}
|
|
1834
|
-
);
|
|
1950
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Container$1, { padding: [2, 2, 1], $scheme: scheme, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: ["flex-start", "flex-start", "center"], direction: ["column", "column", "row"], children: [
|
|
1951
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingBottom: [3, 3, 0], paddingLeft: 1, paddingRight: 2, paddingTop: [1, 1, 0], children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1952
|
+
ui.Label,
|
|
1953
|
+
{
|
|
1954
|
+
size: 0,
|
|
1955
|
+
style: {
|
|
1956
|
+
whiteSpace: "nowrap"
|
|
1957
|
+
},
|
|
1958
|
+
children: facet.title
|
|
1959
|
+
}
|
|
1960
|
+
) }),
|
|
1961
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", children: [
|
|
1962
|
+
children,
|
|
1963
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginLeft: 1, paddingX: 2, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 0, children: /* @__PURE__ */ jsxRuntime.jsx(icons.CloseIcon, { onClick: handleClose }) }) })
|
|
1964
|
+
] })
|
|
1965
|
+
] }) });
|
|
1835
1966
|
}, TextInputNumber = (props) => {
|
|
1836
1967
|
const { onValueChange, value, ...remainingProps } = props;
|
|
1837
1968
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2033,7 +2164,6 @@ const Container$1 = styledComponents.styled(ui.Box)(({ scheme, theme }) => style
|
|
|
2033
2164
|
radius: themeRadius$1,
|
|
2034
2165
|
space: themeSpace$1
|
|
2035
2166
|
} = ui.studioTheme, reactSelectStyles$1 = (scheme) => ({
|
|
2036
|
-
// @ts-expect-error - fix typings later
|
|
2037
2167
|
control: (styles, { isDisabled, isFocused }) => {
|
|
2038
2168
|
let boxShadow = "inset 0 0 0 1px var(--card-border-color)";
|
|
2039
2169
|
return isFocused && (boxShadow = `inset 0 0 0 1px ${getSchemeColor(scheme, "inputEnabledBorder")},
|
|
@@ -2055,7 +2185,6 @@ const Container$1 = styledComponents.styled(ui.Box)(({ scheme, theme }) => style
|
|
|
2055
2185
|
}
|
|
2056
2186
|
};
|
|
2057
2187
|
},
|
|
2058
|
-
// @ts-expect-error - fix typings later
|
|
2059
2188
|
input: (styles) => ({
|
|
2060
2189
|
...styles,
|
|
2061
2190
|
color: "var(--card-fg-color)",
|
|
@@ -2063,19 +2192,16 @@ const Container$1 = styledComponents.styled(ui.Box)(({ scheme, theme }) => style
|
|
|
2063
2192
|
fontSize: themeTextSizes[1].fontSize,
|
|
2064
2193
|
marginLeft: ui.rem(themeSpace$1[2])
|
|
2065
2194
|
}),
|
|
2066
|
-
// @ts-expect-error - fix typings later
|
|
2067
2195
|
menuList: (styles) => ({
|
|
2068
2196
|
...styles,
|
|
2069
2197
|
padding: 0
|
|
2070
2198
|
}),
|
|
2071
|
-
// @ts-expect-error - fix typings later
|
|
2072
2199
|
noOptionsMessage: (styles) => ({
|
|
2073
2200
|
...styles,
|
|
2074
2201
|
fontFamily: ui.studioTheme.fonts.text.family,
|
|
2075
2202
|
fontSize: themeTextSizes[1].fontSize,
|
|
2076
2203
|
lineHeight: "1em"
|
|
2077
2204
|
}),
|
|
2078
|
-
// @ts-expect-error - fix typings later
|
|
2079
2205
|
option: (styles, { isFocused }) => ({
|
|
2080
2206
|
...styles,
|
|
2081
2207
|
backgroundColor: isFocused ? getSchemeColor(scheme, "spotBlue") : "transparent",
|
|
@@ -2090,14 +2216,12 @@ const Container$1 = styledComponents.styled(ui.Box)(({ scheme, theme }) => style
|
|
|
2090
2216
|
color: getSchemeColor(scheme, "bg")
|
|
2091
2217
|
}
|
|
2092
2218
|
}),
|
|
2093
|
-
// @ts-expect-error - fix typings later
|
|
2094
2219
|
placeholder: (styles) => ({
|
|
2095
2220
|
...styles,
|
|
2096
2221
|
fontSize: themeTextSizes[1].fontSize,
|
|
2097
2222
|
marginLeft: ui.rem(themeSpace$1[2]),
|
|
2098
2223
|
paddingLeft: 0
|
|
2099
2224
|
}),
|
|
2100
|
-
// @ts-expect-error - fix typings later
|
|
2101
2225
|
singleValue: (styles) => ({
|
|
2102
2226
|
...styles,
|
|
2103
2227
|
alignItems: "center",
|
|
@@ -2105,7 +2229,6 @@ const Container$1 = styledComponents.styled(ui.Box)(({ scheme, theme }) => style
|
|
|
2105
2229
|
height: "100%",
|
|
2106
2230
|
marginLeft: ui.rem(themeSpace$1[2])
|
|
2107
2231
|
}),
|
|
2108
|
-
// @ts-expect-error - fix typings later
|
|
2109
2232
|
valueContainer: (styles) => ({
|
|
2110
2233
|
...styles,
|
|
2111
2234
|
margin: 0,
|
|
@@ -2497,6 +2620,7 @@ const DebugControls = () => {
|
|
|
2497
2620
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2498
2621
|
ui.Tooltip,
|
|
2499
2622
|
{
|
|
2623
|
+
animate: !0,
|
|
2500
2624
|
content: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 2, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: badConnection ? "Bad connection: +3000ms & 50% chance to fail" : "No connection throttling" }) }),
|
|
2501
2625
|
fallbackPlacements: ["right", "left"],
|
|
2502
2626
|
placement: "bottom",
|
|
@@ -2549,7 +2673,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
2549
2673
|
const val = formData[key];
|
|
2550
2674
|
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;
|
|
2551
2675
|
}, {}), 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 }) => {
|
|
2552
|
-
const popoverProps = usePortalPopoverProps(), refPopoverTimeout = react.useRef(), [popoverVisible, setPopoverVisible] = react.useState(!1), handleClick = () => {
|
|
2676
|
+
const popoverProps = usePortalPopoverProps(), refPopoverTimeout = react.useRef(null), [popoverVisible, setPopoverVisible] = react.useState(!1), handleClick = () => {
|
|
2553
2677
|
refPopoverTimeout.current && clearTimeout(refPopoverTimeout.current), setPopoverVisible(!0), copy__default.default(url), refPopoverTimeout.current = setTimeout(() => {
|
|
2554
2678
|
setPopoverVisible(!1);
|
|
2555
2679
|
}, 1250);
|
|
@@ -2697,7 +2821,6 @@ const imageDprUrl = (asset, options) => {
|
|
|
2697
2821
|
}
|
|
2698
2822
|
) : /* @__PURE__ */ jsxRuntime.jsx(FileIcon, { extension: asset.extension, width: "50%" });
|
|
2699
2823
|
}, { radius: themeRadius, space: themeSpace } = ui.studioTheme, reactSelectStyles = (scheme) => ({
|
|
2700
|
-
// @ts-expect-error - fix typings later
|
|
2701
2824
|
control: (styles, { isFocused }) => {
|
|
2702
2825
|
let boxShadow = "inset 0 0 0 1px var(--card-border-color)";
|
|
2703
2826
|
return isFocused && (boxShadow = `inset 0 0 0 1px ${getSchemeColor(scheme, "inputEnabledBorder")},
|
|
@@ -2719,12 +2842,10 @@ const imageDprUrl = (asset, options) => {
|
|
|
2719
2842
|
}
|
|
2720
2843
|
};
|
|
2721
2844
|
},
|
|
2722
|
-
// @ts-expect-error - fix typings later
|
|
2723
2845
|
indicatorsContainer: (styles, { isDisabled }) => ({
|
|
2724
2846
|
...styles,
|
|
2725
2847
|
opacity: isDisabled ? 0.25 : 1
|
|
2726
2848
|
}),
|
|
2727
|
-
// @ts-expect-error - fix typings later
|
|
2728
2849
|
input: (styles) => ({
|
|
2729
2850
|
...styles,
|
|
2730
2851
|
color: "var(--card-fg-color)",
|
|
@@ -2734,7 +2855,6 @@ const imageDprUrl = (asset, options) => {
|
|
|
2734
2855
|
menuList: (styles) => ({
|
|
2735
2856
|
...styles
|
|
2736
2857
|
}),
|
|
2737
|
-
// @ts-expect-error - fix typings later
|
|
2738
2858
|
multiValue: (styles, { isDisabled }) => ({
|
|
2739
2859
|
...styles,
|
|
2740
2860
|
backgroundColor: getSchemeColor(scheme, "mutedHoveredBg"),
|
|
@@ -2746,7 +2866,6 @@ const imageDprUrl = (asset, options) => {
|
|
|
2746
2866
|
fontSize: "inherit",
|
|
2747
2867
|
padding: 0
|
|
2748
2868
|
}),
|
|
2749
|
-
// @ts-expect-error - fix typings later
|
|
2750
2869
|
multiValueRemove: (styles) => ({
|
|
2751
2870
|
...styles,
|
|
2752
2871
|
borderTopLeftRadius: 0,
|
|
@@ -2756,13 +2875,11 @@ const imageDprUrl = (asset, options) => {
|
|
|
2756
2875
|
backgroundColor: getSchemeColor(scheme, "mutedSelectedBg")
|
|
2757
2876
|
}
|
|
2758
2877
|
}),
|
|
2759
|
-
// @ts-expect-error - fix typings later
|
|
2760
2878
|
noOptionsMessage: (styles) => ({
|
|
2761
2879
|
...styles,
|
|
2762
2880
|
fontFamily: ui.studioTheme.fonts.text.family,
|
|
2763
2881
|
lineHeight: "1em"
|
|
2764
2882
|
}),
|
|
2765
|
-
// @ts-expect-error - fix typings later
|
|
2766
2883
|
option: (styles, { isFocused }) => ({
|
|
2767
2884
|
...styles,
|
|
2768
2885
|
backgroundColor: isFocused ? getSchemeColor(scheme, "spotBlue") : "transparent",
|
|
@@ -2774,12 +2891,10 @@ const imageDprUrl = (asset, options) => {
|
|
|
2774
2891
|
color: getSchemeColor(scheme, "bg")
|
|
2775
2892
|
}
|
|
2776
2893
|
}),
|
|
2777
|
-
// @ts-expect-error - fix typings later
|
|
2778
2894
|
placeholder: (styles) => ({
|
|
2779
2895
|
...styles,
|
|
2780
2896
|
marginLeft: ui.rem(themeSpace[2])
|
|
2781
2897
|
}),
|
|
2782
|
-
// @ts-expect-error - fix typings later
|
|
2783
2898
|
valueContainer: (styles) => ({
|
|
2784
2899
|
...styles,
|
|
2785
2900
|
margin: 0,
|
|
@@ -2824,6 +2939,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
2824
2939
|
error && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2825
2940
|
ui.Tooltip,
|
|
2826
2941
|
{
|
|
2942
|
+
animate: !0,
|
|
2827
2943
|
content: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { muted: !0, size: 1, children: [
|
|
2828
2944
|
/* @__PURE__ */ jsxRuntime.jsx(StyledErrorOutlineIcon, { style: { marginRight: "0.1em" } }),
|
|
2829
2945
|
error
|
|
@@ -2939,6 +3055,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
2939
3055
|
] }) : content = "No unpublished changes" : content = "There are validation errors that need to be fixed before this document can be published", /* @__PURE__ */ jsxRuntime.jsx(
|
|
2940
3056
|
ui.Tooltip,
|
|
2941
3057
|
{
|
|
3058
|
+
animate: !0,
|
|
2942
3059
|
content: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 3, style: { maxWidth: "185px" }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: content }) }),
|
|
2943
3060
|
disabled: "ontouchstart" in window,
|
|
2944
3061
|
placement: "top",
|
|
@@ -2956,14 +3073,14 @@ const imageDprUrl = (asset, options) => {
|
|
|
2956
3073
|
}
|
|
2957
3074
|
);
|
|
2958
3075
|
}, Image$1 = styledComponents.styled.img`
|
|
2959
|
-
--checkerboard-color: ${(props) => props
|
|
3076
|
+
--checkerboard-color: ${(props) => props.$scheme ? getSchemeColor(props.$scheme, "bg2") : "inherit"};
|
|
2960
3077
|
|
|
2961
3078
|
display: block;
|
|
2962
3079
|
width: 100%;
|
|
2963
3080
|
height: 100%;
|
|
2964
3081
|
object-fit: contain;
|
|
2965
3082
|
|
|
2966
|
-
${(props) => props
|
|
3083
|
+
${(props) => props.$showCheckerboard && styledComponents.css`
|
|
2967
3084
|
background-image: linear-gradient(45deg, var(--checkerboard-color) 25%, transparent 25%),
|
|
2968
3085
|
linear-gradient(-45deg, var(--checkerboard-color) 25%, transparent 25%),
|
|
2969
3086
|
linear-gradient(45deg, transparent 75%, var(--checkerboard-color) 75%),
|
|
@@ -3090,183 +3207,205 @@ const imageDprUrl = (asset, options) => {
|
|
|
3090
3207
|
}
|
|
3091
3208
|
)
|
|
3092
3209
|
] }) });
|
|
3093
|
-
return currentAsset ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
),
|
|
3111
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3112
|
-
ui.Tab,
|
|
3113
|
-
{
|
|
3114
|
-
"aria-controls": "references-panel",
|
|
3115
|
-
disabled: formUpdating,
|
|
3116
|
-
id: "references-tab",
|
|
3117
|
-
label: `References${!isLoading && Array.isArray(uniqueReferringDocuments) ? ` (${uniqueReferringDocuments.length})` : ""}`,
|
|
3118
|
-
onClick: () => setTabSection("references"),
|
|
3119
|
-
selected: tabSection === "references",
|
|
3120
|
-
size: 2
|
|
3121
|
-
}
|
|
3122
|
-
)
|
|
3123
|
-
] }),
|
|
3124
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { as: "form", marginTop: 4, onSubmit: handleSubmit(onSubmit), children: [
|
|
3125
|
-
!assetItem && /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { marginBottom: 3, padding: 3, radius: 2, shadow: 1, tone: "critical", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: "This file cannot be found \u2013 it may have been deleted." }) }),
|
|
3126
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { style: { display: "none" }, tabIndex: -1, type: "submit" }),
|
|
3127
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3128
|
-
ui.TabPanel,
|
|
3129
|
-
{
|
|
3130
|
-
"aria-labelledby": "details",
|
|
3131
|
-
hidden: tabSection !== "details",
|
|
3132
|
-
id: "details-panel",
|
|
3133
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
|
|
3134
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3135
|
-
FormFieldInputTags,
|
|
3136
|
-
{
|
|
3137
|
-
control,
|
|
3138
|
-
disabled: formUpdating,
|
|
3139
|
-
error: errors?.opt?.media?.tags?.message,
|
|
3140
|
-
label: "Tags",
|
|
3141
|
-
name: "opt.media.tags",
|
|
3142
|
-
onCreateTag: handleCreateTag,
|
|
3143
|
-
options: allTagOptions,
|
|
3144
|
-
placeholder: "Select or create...",
|
|
3145
|
-
value: assetTagOptions
|
|
3146
|
-
}
|
|
3147
|
-
),
|
|
3148
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3149
|
-
FormFieldInputText,
|
|
3150
|
-
{
|
|
3151
|
-
...register("originalFilename"),
|
|
3152
|
-
disabled: formUpdating,
|
|
3153
|
-
error: errors?.originalFilename?.message,
|
|
3154
|
-
label: "Filename",
|
|
3155
|
-
name: "originalFilename",
|
|
3156
|
-
value: currentAsset?.originalFilename
|
|
3157
|
-
}
|
|
3158
|
-
),
|
|
3159
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3160
|
-
FormFieldInputText,
|
|
3161
|
-
{
|
|
3162
|
-
...register("title"),
|
|
3163
|
-
disabled: formUpdating,
|
|
3164
|
-
error: errors?.title?.message,
|
|
3165
|
-
label: "Title",
|
|
3166
|
-
name: "title",
|
|
3167
|
-
value: currentAsset?.title
|
|
3168
|
-
}
|
|
3169
|
-
),
|
|
3170
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3171
|
-
FormFieldInputText,
|
|
3172
|
-
{
|
|
3173
|
-
...register("altText"),
|
|
3174
|
-
disabled: formUpdating,
|
|
3175
|
-
error: errors?.altText?.message,
|
|
3176
|
-
label: "Alt Text",
|
|
3177
|
-
name: "altText",
|
|
3178
|
-
value: currentAsset?.altText
|
|
3179
|
-
}
|
|
3180
|
-
),
|
|
3181
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3182
|
-
FormFieldInputTextarea,
|
|
3183
|
-
{
|
|
3184
|
-
...register("description"),
|
|
3185
|
-
disabled: formUpdating,
|
|
3186
|
-
error: errors?.description?.message,
|
|
3187
|
-
label: "Description",
|
|
3188
|
-
name: "description",
|
|
3189
|
-
rows: 5,
|
|
3190
|
-
value: currentAsset?.description
|
|
3191
|
-
}
|
|
3192
|
-
),
|
|
3193
|
-
creditLine?.enabled && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3194
|
-
FormFieldInputText,
|
|
3195
|
-
{
|
|
3196
|
-
...register("creditLine"),
|
|
3197
|
-
error: errors?.creditLine?.message,
|
|
3198
|
-
label: "Credit",
|
|
3199
|
-
name: "creditLine",
|
|
3200
|
-
value: currentAsset?.creditLine,
|
|
3201
|
-
disabled: formUpdating || creditLine?.excludeSources?.includes(currentAsset?.source?.name)
|
|
3202
|
-
}
|
|
3203
|
-
)
|
|
3204
|
-
] })
|
|
3205
|
-
}
|
|
3206
|
-
),
|
|
3207
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3208
|
-
ui.TabPanel,
|
|
3209
|
-
{
|
|
3210
|
-
"aria-labelledby": "references",
|
|
3211
|
-
hidden: tabSection !== "references",
|
|
3212
|
-
id: "references-panel",
|
|
3213
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginTop: 5, children: assetItem?.asset && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3214
|
-
DocumentList,
|
|
3210
|
+
return currentAsset ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3211
|
+
Dialog,
|
|
3212
|
+
{
|
|
3213
|
+
animate: !0,
|
|
3214
|
+
footer: /* @__PURE__ */ jsxRuntime.jsx(Footer, {}),
|
|
3215
|
+
header: "Asset details",
|
|
3216
|
+
id,
|
|
3217
|
+
onClose: handleClose,
|
|
3218
|
+
width: 3,
|
|
3219
|
+
children: [
|
|
3220
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: ["column-reverse", "column-reverse", "row-reverse"], children: [
|
|
3221
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, marginTop: [5, 5, 0], padding: 4, children: /* @__PURE__ */ jsxRuntime.jsx(sanity.WithReferringDocuments, { documentStore, id: currentAsset._id, children: ({ isLoading, referringDocuments }) => {
|
|
3222
|
+
const uniqueReferringDocuments = getUniqueDocuments(referringDocuments);
|
|
3223
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3224
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.TabList, { space: 2, children: [
|
|
3225
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3226
|
+
ui.Tab,
|
|
3215
3227
|
{
|
|
3216
|
-
|
|
3217
|
-
|
|
3228
|
+
"aria-controls": "details-panel",
|
|
3229
|
+
disabled: formUpdating,
|
|
3230
|
+
id: "details-tab",
|
|
3231
|
+
label: "Details",
|
|
3232
|
+
onClick: () => setTabSection("details"),
|
|
3233
|
+
selected: tabSection === "details",
|
|
3234
|
+
size: 2
|
|
3218
3235
|
}
|
|
3219
|
-
)
|
|
3220
|
-
|
|
3221
|
-
|
|
3236
|
+
),
|
|
3237
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3238
|
+
ui.Tab,
|
|
3239
|
+
{
|
|
3240
|
+
"aria-controls": "references-panel",
|
|
3241
|
+
disabled: formUpdating,
|
|
3242
|
+
id: "references-tab",
|
|
3243
|
+
label: `References${!isLoading && Array.isArray(uniqueReferringDocuments) ? ` (${uniqueReferringDocuments.length})` : ""}`,
|
|
3244
|
+
onClick: () => setTabSection("references"),
|
|
3245
|
+
selected: tabSection === "references",
|
|
3246
|
+
size: 2
|
|
3247
|
+
}
|
|
3248
|
+
)
|
|
3249
|
+
] }),
|
|
3250
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { as: "form", marginTop: 4, onSubmit: handleSubmit(onSubmit), children: [
|
|
3251
|
+
!assetItem && /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { marginBottom: 3, padding: 3, radius: 2, shadow: 1, tone: "critical", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: "This file cannot be found \u2013 it may have been deleted." }) }),
|
|
3252
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { style: { display: "none" }, tabIndex: -1, type: "submit" }),
|
|
3253
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3254
|
+
ui.TabPanel,
|
|
3255
|
+
{
|
|
3256
|
+
"aria-labelledby": "details",
|
|
3257
|
+
hidden: tabSection !== "details",
|
|
3258
|
+
id: "details-panel",
|
|
3259
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
|
|
3260
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3261
|
+
FormFieldInputTags,
|
|
3262
|
+
{
|
|
3263
|
+
control,
|
|
3264
|
+
disabled: formUpdating,
|
|
3265
|
+
error: errors?.opt?.media?.tags?.message,
|
|
3266
|
+
label: "Tags",
|
|
3267
|
+
name: "opt.media.tags",
|
|
3268
|
+
onCreateTag: handleCreateTag,
|
|
3269
|
+
options: allTagOptions,
|
|
3270
|
+
placeholder: "Select or create...",
|
|
3271
|
+
value: assetTagOptions
|
|
3272
|
+
}
|
|
3273
|
+
),
|
|
3274
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3275
|
+
FormFieldInputText,
|
|
3276
|
+
{
|
|
3277
|
+
...register("originalFilename"),
|
|
3278
|
+
disabled: formUpdating,
|
|
3279
|
+
error: errors?.originalFilename?.message,
|
|
3280
|
+
label: "Filename",
|
|
3281
|
+
name: "originalFilename",
|
|
3282
|
+
value: currentAsset?.originalFilename
|
|
3283
|
+
}
|
|
3284
|
+
),
|
|
3285
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3286
|
+
FormFieldInputText,
|
|
3287
|
+
{
|
|
3288
|
+
...register("title"),
|
|
3289
|
+
disabled: formUpdating,
|
|
3290
|
+
error: errors?.title?.message,
|
|
3291
|
+
label: "Title",
|
|
3292
|
+
name: "title",
|
|
3293
|
+
value: currentAsset?.title
|
|
3294
|
+
}
|
|
3295
|
+
),
|
|
3296
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3297
|
+
FormFieldInputText,
|
|
3298
|
+
{
|
|
3299
|
+
...register("altText"),
|
|
3300
|
+
disabled: formUpdating,
|
|
3301
|
+
error: errors?.altText?.message,
|
|
3302
|
+
label: "Alt Text",
|
|
3303
|
+
name: "altText",
|
|
3304
|
+
value: currentAsset?.altText
|
|
3305
|
+
}
|
|
3306
|
+
),
|
|
3307
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3308
|
+
FormFieldInputTextarea,
|
|
3309
|
+
{
|
|
3310
|
+
...register("description"),
|
|
3311
|
+
disabled: formUpdating,
|
|
3312
|
+
error: errors?.description?.message,
|
|
3313
|
+
label: "Description",
|
|
3314
|
+
name: "description",
|
|
3315
|
+
rows: 5,
|
|
3316
|
+
value: currentAsset?.description
|
|
3317
|
+
}
|
|
3318
|
+
),
|
|
3319
|
+
creditLine?.enabled && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3320
|
+
FormFieldInputText,
|
|
3321
|
+
{
|
|
3322
|
+
...register("creditLine"),
|
|
3323
|
+
error: errors?.creditLine?.message,
|
|
3324
|
+
label: "Credit",
|
|
3325
|
+
name: "creditLine",
|
|
3326
|
+
value: currentAsset?.creditLine,
|
|
3327
|
+
disabled: formUpdating || creditLine?.excludeSources?.includes(currentAsset?.source?.name)
|
|
3328
|
+
}
|
|
3329
|
+
)
|
|
3330
|
+
] })
|
|
3331
|
+
}
|
|
3332
|
+
),
|
|
3333
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3334
|
+
ui.TabPanel,
|
|
3335
|
+
{
|
|
3336
|
+
"aria-labelledby": "references",
|
|
3337
|
+
hidden: tabSection !== "references",
|
|
3338
|
+
id: "references-panel",
|
|
3339
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginTop: 5, children: assetItem?.asset && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3340
|
+
DocumentList,
|
|
3341
|
+
{
|
|
3342
|
+
documents: uniqueReferringDocuments,
|
|
3343
|
+
isLoading
|
|
3344
|
+
}
|
|
3345
|
+
) })
|
|
3346
|
+
}
|
|
3347
|
+
)
|
|
3348
|
+
] })
|
|
3349
|
+
] });
|
|
3350
|
+
} }) }),
|
|
3351
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { flex: 1, padding: 4, children: [
|
|
3352
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { style: { aspectRatio: "1" }, children: [
|
|
3353
|
+
isFileAsset(currentAsset) && /* @__PURE__ */ jsxRuntime.jsx(FileAssetPreview, { asset: currentAsset }),
|
|
3354
|
+
isImageAsset(currentAsset) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3355
|
+
Image$1,
|
|
3356
|
+
{
|
|
3357
|
+
draggable: !1,
|
|
3358
|
+
$scheme: scheme,
|
|
3359
|
+
$showCheckerboard: !currentAsset?.metadata?.isOpaque,
|
|
3360
|
+
src: imageDprUrl(currentAsset, { height: 600, width: 600 })
|
|
3361
|
+
}
|
|
3362
|
+
)
|
|
3363
|
+
] }),
|
|
3364
|
+
currentAsset && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginTop: 4, children: /* @__PURE__ */ jsxRuntime.jsx(AssetMetadata, { asset: currentAsset, item: assetItem }) })
|
|
3222
3365
|
] })
|
|
3223
|
-
] });
|
|
3224
|
-
} }) }),
|
|
3225
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { flex: 1, padding: 4, children: [
|
|
3226
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { style: { aspectRatio: "1" }, children: [
|
|
3227
|
-
isFileAsset(currentAsset) && /* @__PURE__ */ jsxRuntime.jsx(FileAssetPreview, { asset: currentAsset }),
|
|
3228
|
-
isImageAsset(currentAsset) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3229
|
-
Image$1,
|
|
3230
|
-
{
|
|
3231
|
-
draggable: !1,
|
|
3232
|
-
scheme,
|
|
3233
|
-
showCheckerboard: !currentAsset?.metadata?.isOpaque,
|
|
3234
|
-
src: imageDprUrl(currentAsset, { height: 600, width: 600 })
|
|
3235
|
-
}
|
|
3236
|
-
)
|
|
3237
3366
|
] }),
|
|
3238
|
-
|
|
3239
|
-
]
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
] }) : null;
|
|
3367
|
+
children
|
|
3368
|
+
]
|
|
3369
|
+
}
|
|
3370
|
+
) : null;
|
|
3243
3371
|
}, DialogConfirm = (props) => {
|
|
3244
3372
|
const { children, dialog } = props, dispatch = reactRedux.useDispatch(), handleClose = () => {
|
|
3245
3373
|
dispatch(dialogActions.remove({ id: dialog?.id }));
|
|
3246
3374
|
}, handleConfirm = () => {
|
|
3247
3375
|
dialog?.closeDialogId && dispatch(dialogActions.remove({ id: dialog?.closeDialogId })), dialog?.confirmCallbackAction && dispatch(dialog.confirmCallbackAction), handleClose();
|
|
3248
3376
|
};
|
|
3249
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
{
|
|
3254
|
-
fontSize: 1,
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3377
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3378
|
+
Dialog,
|
|
3379
|
+
{
|
|
3380
|
+
animate: !0,
|
|
3381
|
+
footer: /* @__PURE__ */ jsxRuntime.jsx(() => /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { justify: "space-between", children: [
|
|
3382
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { fontSize: 1, mode: "bleed", onClick: handleClose, text: "Cancel" }),
|
|
3383
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3384
|
+
ui.Button,
|
|
3385
|
+
{
|
|
3386
|
+
fontSize: 1,
|
|
3387
|
+
onClick: handleConfirm,
|
|
3388
|
+
text: dialog?.confirmText,
|
|
3389
|
+
tone: dialog?.tone
|
|
3390
|
+
}
|
|
3391
|
+
)
|
|
3392
|
+
] }) }), {}),
|
|
3393
|
+
header: /* @__PURE__ */ jsxRuntime.jsx(() => /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", children: [
|
|
3394
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingX: 1, children: /* @__PURE__ */ jsxRuntime.jsx(icons.WarningOutlineIcon, {}) }),
|
|
3395
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginLeft: 2, children: dialog?.headerTitle })
|
|
3396
|
+
] }), {}),
|
|
3397
|
+
id: "confirm",
|
|
3398
|
+
onClose: handleClose,
|
|
3399
|
+
width: 1,
|
|
3400
|
+
children: [
|
|
3401
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingX: 4, paddingY: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
|
|
3402
|
+
dialog?.title && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: dialog.title }),
|
|
3403
|
+
dialog?.description && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: /* @__PURE__ */ jsxRuntime.jsx("em", { children: dialog.description }) })
|
|
3404
|
+
] }) }),
|
|
3405
|
+
children
|
|
3406
|
+
]
|
|
3407
|
+
}
|
|
3408
|
+
);
|
|
3270
3409
|
}, DialogSearchFacets = (props) => {
|
|
3271
3410
|
const {
|
|
3272
3411
|
children,
|
|
@@ -3274,7 +3413,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
3274
3413
|
} = props, dispatch = reactRedux.useDispatch(), handleClose = react.useCallback(() => {
|
|
3275
3414
|
dispatch(dialogActions.clear());
|
|
3276
3415
|
}, []);
|
|
3277
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { header: "Filters", id, onClose: handleClose, width: 1, children: [
|
|
3416
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { animate: !0, header: "Filters", id, onClose: handleClose, width: 1, children: [
|
|
3278
3417
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { padding: 3, children: [
|
|
3279
3418
|
/* @__PURE__ */ jsxRuntime.jsx(SearchFacets, { layout: "stack" }),
|
|
3280
3419
|
/* @__PURE__ */ jsxRuntime.jsx(SearchFacetsControl, {})
|
|
@@ -3307,7 +3446,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
3307
3446
|
creatingError && setError("name", {
|
|
3308
3447
|
message: creatingError?.message
|
|
3309
3448
|
});
|
|
3310
|
-
}, [creatingError, setError]), /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { footer: /* @__PURE__ */ jsxRuntime.jsx(() => /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 3, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { justify: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3449
|
+
}, [creatingError, setError]), /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { animate: !0, footer: /* @__PURE__ */ jsxRuntime.jsx(() => /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 3, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { justify: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3311
3450
|
FormSubmitButton,
|
|
3312
3451
|
{
|
|
3313
3452
|
disabled: formUpdating || !isDirty || !isValid,
|
|
@@ -3413,7 +3552,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
3413
3552
|
}
|
|
3414
3553
|
)
|
|
3415
3554
|
] }) });
|
|
3416
|
-
return currentTag ? /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { footer: /* @__PURE__ */ jsxRuntime.jsx(Footer, {}), header: "Edit Tag", id, onClose: handleClose, width: 1, children: [
|
|
3555
|
+
return currentTag ? /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { animate: !0, footer: /* @__PURE__ */ jsxRuntime.jsx(Footer, {}), header: "Edit Tag", id, onClose: handleClose, width: 1, children: [
|
|
3417
3556
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { as: "form", padding: 4, onSubmit: handleSubmit(onSubmit), children: [
|
|
3418
3557
|
!tagItem && /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { marginBottom: 3, padding: 3, radius: 2, shadow: 1, tone: "critical", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: "This tag cannot be found \u2013 it may have been deleted." }) }),
|
|
3419
3558
|
/* @__PURE__ */ jsxRuntime.jsx("button", { style: { display: "none" }, tabIndex: -1, type: "submit" }),
|
|
@@ -3447,6 +3586,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
3447
3586
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3448
3587
|
ui.Tooltip,
|
|
3449
3588
|
{
|
|
3589
|
+
animate: !0,
|
|
3450
3590
|
content: /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { padding: 2, width: 0, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: tooltip }) }),
|
|
3451
3591
|
disabled: "ontouchstart" in window,
|
|
3452
3592
|
placement: "top",
|
|
@@ -3685,7 +3825,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
3685
3825
|
} = props, dispatch = reactRedux.useDispatch(), handleClose = react.useCallback(() => {
|
|
3686
3826
|
dispatch(dialogActions.clear());
|
|
3687
3827
|
}, []);
|
|
3688
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { header: "All Tags", id, onClose: handleClose, width: 1, children: [
|
|
3828
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { animate: !0, header: "All Tags", id, onClose: handleClose, width: 1, children: [
|
|
3689
3829
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3690
3830
|
ui.Box,
|
|
3691
3831
|
{
|
|
@@ -3793,18 +3933,18 @@ const imageDprUrl = (asset, options) => {
|
|
|
3793
3933
|
position: relative;
|
|
3794
3934
|
width: 100%;
|
|
3795
3935
|
`, CardContainer = styledComponents.styled(ui.Flex)(
|
|
3796
|
-
({ picked, theme, updating }) => styledComponents.css`
|
|
3936
|
+
({ $picked, theme, $updating }) => styledComponents.css`
|
|
3797
3937
|
border: 1px solid transparent;
|
|
3798
3938
|
height: 100%;
|
|
3799
|
-
pointer-events: ${updating ? "none" : "auto"};
|
|
3939
|
+
pointer-events: ${$updating ? "none" : "auto"};
|
|
3800
3940
|
position: relative;
|
|
3801
3941
|
transition: all 300ms;
|
|
3802
3942
|
user-select: none;
|
|
3803
3943
|
width: 100%;
|
|
3804
3944
|
|
|
3805
|
-
border: ${picked ? `1px solid ${theme.sanity.color.spot.orange} !important` : "1px solid inherit"};
|
|
3945
|
+
border: ${$picked ? `1px solid ${theme.sanity.color.spot.orange} !important` : "1px solid inherit"};
|
|
3806
3946
|
|
|
3807
|
-
${
|
|
3947
|
+
${!$updating && styledComponents.css`
|
|
3808
3948
|
@media (hover: hover) and (pointer: fine) {
|
|
3809
3949
|
&:hover {
|
|
3810
3950
|
border: 1px solid var(--card-border-color);
|
|
@@ -3813,14 +3953,13 @@ const imageDprUrl = (asset, options) => {
|
|
|
3813
3953
|
`}
|
|
3814
3954
|
`
|
|
3815
3955
|
), ContextActionContainer$2 = styledComponents.styled(ui.Flex)(
|
|
3816
|
-
|
|
3817
|
-
({ scheme }) => styledComponents.css`
|
|
3956
|
+
({ $scheme }) => styledComponents.css`
|
|
3818
3957
|
cursor: pointer;
|
|
3819
3958
|
height: ${PANEL_HEIGHT}px;
|
|
3820
3959
|
transition: all 300ms;
|
|
3821
3960
|
@media (hover: hover) and (pointer: fine) {
|
|
3822
3961
|
&:hover {
|
|
3823
|
-
background: ${getSchemeColor(scheme, "bg")};
|
|
3962
|
+
background: ${getSchemeColor($scheme, "bg")};
|
|
3824
3963
|
}
|
|
3825
3964
|
}
|
|
3826
3965
|
`
|
|
@@ -3840,7 +3979,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
3840
3979
|
}, handleContextActionClick = (e) => {
|
|
3841
3980
|
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 }));
|
|
3842
3981
|
}, opacityContainer = updating ? 0.5 : 1, opacityPreview = selected || updating ? 0.25 : 1;
|
|
3843
|
-
return /* @__PURE__ */ jsxRuntime.jsx(CardWrapper$1, { padding: 1, children: /* @__PURE__ */ jsxRuntime.jsxs(CardContainer, { direction: "column", picked, updating: item.updating, children: [
|
|
3982
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CardWrapper$1, { padding: 1, children: /* @__PURE__ */ jsxRuntime.jsxs(CardContainer, { direction: "column", $picked: picked, $updating: item.updating, children: [
|
|
3844
3983
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3845
3984
|
ui.Box,
|
|
3846
3985
|
{
|
|
@@ -3856,8 +3995,8 @@ const imageDprUrl = (asset, options) => {
|
|
|
3856
3995
|
Image$1,
|
|
3857
3996
|
{
|
|
3858
3997
|
draggable: !1,
|
|
3859
|
-
scheme,
|
|
3860
|
-
showCheckerboard: !isOpaque,
|
|
3998
|
+
$scheme: scheme,
|
|
3999
|
+
$showCheckerboard: !isOpaque,
|
|
3861
4000
|
src: imageDprUrl(asset, { height: 250, width: 250 }),
|
|
3862
4001
|
style: {
|
|
3863
4002
|
draggable: !1,
|
|
@@ -3906,7 +4045,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
3906
4045
|
align: "center",
|
|
3907
4046
|
onClick: handleContextActionClick,
|
|
3908
4047
|
paddingX: 1,
|
|
3909
|
-
scheme,
|
|
4048
|
+
$scheme: scheme,
|
|
3910
4049
|
style: { opacity: opacityContainer },
|
|
3911
4050
|
children: [
|
|
3912
4051
|
onSelect ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3945,6 +4084,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
3945
4084
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3946
4085
|
ui.Tooltip,
|
|
3947
4086
|
{
|
|
4087
|
+
animate: !0,
|
|
3948
4088
|
content: /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { padding: 2, width: 0, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: error }) }),
|
|
3949
4089
|
placement: "left",
|
|
3950
4090
|
portal: !0,
|
|
@@ -4254,7 +4394,7 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
|
|
|
4254
4394
|
Image$1,
|
|
4255
4395
|
{
|
|
4256
4396
|
draggable: !1,
|
|
4257
|
-
scheme,
|
|
4397
|
+
$scheme: scheme,
|
|
4258
4398
|
src: item.objectUrl,
|
|
4259
4399
|
style: {
|
|
4260
4400
|
opacity: 0.4
|
|
@@ -4313,16 +4453,26 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
|
|
|
4313
4453
|
) });
|
|
4314
4454
|
}, CARD_HEIGHT = 220, CARD_WIDTH = 240, VirtualCell = react.memo(
|
|
4315
4455
|
({ item, selected }) => item?.type === "asset" ? /* @__PURE__ */ jsxRuntime.jsx(CardAsset$1, { id: item.id, selected }) : item?.type === "upload" ? /* @__PURE__ */ jsxRuntime.jsx(CardUpload, { id: item.id }) : null
|
|
4316
|
-
),
|
|
4456
|
+
), StyledItemContainer = styledComponents.styled.div`
|
|
4317
4457
|
height: ${CARD_HEIGHT}px;
|
|
4318
4458
|
width: ${CARD_WIDTH}px;
|
|
4319
|
-
|
|
4459
|
+
`;
|
|
4460
|
+
function ItemContainer(props) {
|
|
4461
|
+
const { context, ...rest } = props;
|
|
4462
|
+
return /* @__PURE__ */ jsxRuntime.jsx(StyledItemContainer, { ...rest });
|
|
4463
|
+
}
|
|
4464
|
+
const StyledListContainer = styledComponents.styled.div`
|
|
4320
4465
|
display: grid;
|
|
4321
4466
|
grid-template-columns: repeat(auto-fill, ${CARD_WIDTH}px);
|
|
4322
4467
|
grid-template-rows: repeat(auto-fill, ${CARD_HEIGHT}px);
|
|
4323
4468
|
justify-content: center;
|
|
4324
4469
|
margin: 0 auto;
|
|
4325
|
-
|
|
4470
|
+
`;
|
|
4471
|
+
function ListContainer(props) {
|
|
4472
|
+
const { context, ...rest } = props;
|
|
4473
|
+
return /* @__PURE__ */ jsxRuntime.jsx(StyledListContainer, { ...rest });
|
|
4474
|
+
}
|
|
4475
|
+
const AssetGridVirtualized = (props) => {
|
|
4326
4476
|
const { items, onLoadMore } = props, selectedAssets = useTypedSelector((state) => state.selected.assets), selectedIds = selectedAssets && selectedAssets.map((asset) => asset._id) || [], totalCount = items?.length;
|
|
4327
4477
|
return totalCount === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
4328
4478
|
reactVirtuoso.VirtuosoGrid,
|
|
@@ -4331,7 +4481,6 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
|
|
|
4331
4481
|
computeItemKey: (index) => items[index]?.id,
|
|
4332
4482
|
components: {
|
|
4333
4483
|
Item: ItemContainer,
|
|
4334
|
-
// @ts-expect-error - fix typings later
|
|
4335
4484
|
List: ListContainer
|
|
4336
4485
|
},
|
|
4337
4486
|
endReached: onLoadMore,
|
|
@@ -4378,12 +4527,11 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
|
|
|
4378
4527
|
}
|
|
4379
4528
|
) });
|
|
4380
4529
|
}, ContextActionContainer$1 = styledComponents.styled(ui.Flex)(
|
|
4381
|
-
|
|
4382
|
-
({ scheme }) => styledComponents.css`
|
|
4530
|
+
({ $scheme }) => styledComponents.css`
|
|
4383
4531
|
cursor: pointer;
|
|
4384
4532
|
@media (hover: hover) and (pointer: fine) {
|
|
4385
4533
|
&:hover {
|
|
4386
|
-
background: ${getSchemeColor(scheme, "bg")};
|
|
4534
|
+
background: ${getSchemeColor($scheme, "bg")};
|
|
4387
4535
|
}
|
|
4388
4536
|
}
|
|
4389
4537
|
`
|
|
@@ -4417,7 +4565,7 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
|
|
|
4417
4565
|
align: "center",
|
|
4418
4566
|
justify: "center",
|
|
4419
4567
|
onClick: handleContextActionClick,
|
|
4420
|
-
scheme,
|
|
4568
|
+
$scheme: scheme,
|
|
4421
4569
|
style: {
|
|
4422
4570
|
height: "100%",
|
|
4423
4571
|
position: "relative"
|
|
@@ -4447,39 +4595,34 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
|
|
|
4447
4595
|
]
|
|
4448
4596
|
}
|
|
4449
4597
|
);
|
|
4450
|
-
}, REFERENCE_COUNT_VISIBILITY_DELAY = 750, ContainerGrid = styledComponents.styled(ui.Grid)(
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
align-items: center;
|
|
4458
|
-
cursor: ${selected ? "default" : "pointer"};
|
|
4459
|
-
height: 100%;
|
|
4460
|
-
pointer-events: ${updating ? "none" : "auto"};
|
|
4461
|
-
user-select: none;
|
|
4462
|
-
white-space: nowrap;
|
|
4598
|
+
}, REFERENCE_COUNT_VISIBILITY_DELAY = 750, ContainerGrid = styledComponents.styled(ui.Grid)(({ $scheme, $selected, $updating }) => styledComponents.css`
|
|
4599
|
+
align-items: center;
|
|
4600
|
+
cursor: ${$selected ? "default" : "pointer"};
|
|
4601
|
+
height: 100%;
|
|
4602
|
+
pointer-events: ${$updating ? "none" : "auto"};
|
|
4603
|
+
user-select: none;
|
|
4604
|
+
white-space: nowrap;
|
|
4463
4605
|
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
}
|
|
4606
|
+
${!$updating && styledComponents.css`
|
|
4607
|
+
@media (hover: hover) and (pointer: fine) {
|
|
4608
|
+
&:hover {
|
|
4609
|
+
background: ${getSchemeColor($scheme, "bg")};
|
|
4469
4610
|
}
|
|
4470
|
-
`}
|
|
4471
|
-
`
|
|
4472
|
-
), ContextActionContainer = styledComponents.styled(ui.Flex)(({ scheme }) => styledComponents.css`
|
|
4473
|
-
cursor: pointer;
|
|
4474
|
-
@media (hover: hover) and (pointer: fine) {
|
|
4475
|
-
&:hover {
|
|
4476
|
-
background: ${getSchemeColor(scheme, "bg2")};
|
|
4477
4611
|
}
|
|
4478
|
-
}
|
|
4479
|
-
`),
|
|
4612
|
+
`}
|
|
4613
|
+
`), ContextActionContainer = styledComponents.styled(ui.Flex)(
|
|
4614
|
+
({ $scheme }) => styledComponents.css`
|
|
4615
|
+
cursor: pointer;
|
|
4616
|
+
@media (hover: hover) and (pointer: fine) {
|
|
4617
|
+
&:hover {
|
|
4618
|
+
background: ${getSchemeColor($scheme, "bg2")};
|
|
4619
|
+
}
|
|
4620
|
+
}
|
|
4621
|
+
`
|
|
4622
|
+
), StyledWarningIcon = styledComponents.styled(icons.WarningFilledIcon)(({ theme }) => ({
|
|
4480
4623
|
color: theme.sanity.color.spot.red
|
|
4481
4624
|
})), TableRowAsset = (props) => {
|
|
4482
|
-
const { id, selected } = props, scheme = sanity.useColorSchemeValue(), shiftPressed = useKeyPress("shift"), [referenceCountVisible, setReferenceCountVisible] = react.useState(!1), refCountVisibleTimeout = react.useRef(), 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(
|
|
4625
|
+
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(
|
|
4483
4626
|
(e) => {
|
|
4484
4627
|
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 })));
|
|
4485
4628
|
},
|
|
@@ -4499,21 +4642,21 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
|
|
|
4499
4642
|
ContainerGrid,
|
|
4500
4643
|
{
|
|
4501
4644
|
onClick: selected ? void 0 : handleClick,
|
|
4502
|
-
scheme,
|
|
4503
|
-
selected,
|
|
4645
|
+
$scheme: scheme,
|
|
4646
|
+
$selected: selected,
|
|
4504
4647
|
style: {
|
|
4505
4648
|
gridColumnGap: mediaIndex < 3 ? 0 : "16px",
|
|
4506
4649
|
gridRowGap: 0,
|
|
4507
4650
|
gridTemplateColumns: mediaIndex < 3 ? GRID_TEMPLATE_COLUMNS.SMALL : GRID_TEMPLATE_COLUMNS.LARGE,
|
|
4508
4651
|
gridTemplateRows: mediaIndex < 3 ? "auto" : "1fr"
|
|
4509
4652
|
},
|
|
4510
|
-
updating: item.updating,
|
|
4653
|
+
$updating: item.updating,
|
|
4511
4654
|
children: [
|
|
4512
4655
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4513
4656
|
ContextActionContainer,
|
|
4514
4657
|
{
|
|
4515
4658
|
onClick: handleContextActionClick,
|
|
4516
|
-
scheme,
|
|
4659
|
+
$scheme: scheme,
|
|
4517
4660
|
style: {
|
|
4518
4661
|
alignItems: "center",
|
|
4519
4662
|
gridColumn: 1,
|
|
@@ -4563,8 +4706,8 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
|
|
|
4563
4706
|
Image$1,
|
|
4564
4707
|
{
|
|
4565
4708
|
draggable: !1,
|
|
4566
|
-
scheme,
|
|
4567
|
-
showCheckerboard: !isOpaque,
|
|
4709
|
+
$scheme: scheme,
|
|
4710
|
+
$showCheckerboard: !isOpaque,
|
|
4568
4711
|
src: imageDprUrl(asset, { height: 100, width: 100 })
|
|
4569
4712
|
}
|
|
4570
4713
|
)
|
|
@@ -4691,6 +4834,7 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
|
|
|
4691
4834
|
children: error && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4692
4835
|
ui.Tooltip,
|
|
4693
4836
|
{
|
|
4837
|
+
animate: !0,
|
|
4694
4838
|
content: /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { padding: 2, width: 0, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: error }) }),
|
|
4695
4839
|
placement: "left",
|
|
4696
4840
|
portal: !0,
|
|
@@ -4755,7 +4899,15 @@ const TableRowUpload = (props) => {
|
|
|
4755
4899
|
width: "100px"
|
|
4756
4900
|
},
|
|
4757
4901
|
children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { style: { height: "100%", position: "relative" }, children: [
|
|
4758
|
-
item.assetType === "image" && item?.objectUrl && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4902
|
+
item.assetType === "image" && item?.objectUrl && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4903
|
+
Image$1,
|
|
4904
|
+
{
|
|
4905
|
+
draggable: !1,
|
|
4906
|
+
$scheme: scheme,
|
|
4907
|
+
src: item.objectUrl,
|
|
4908
|
+
style: { opacity: 0.25 }
|
|
4909
|
+
}
|
|
4910
|
+
),
|
|
4759
4911
|
item.assetType === "file" && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { height: "100%", opacity: 0.1 }, children: /* @__PURE__ */ jsxRuntime.jsx(FileIcon, { width: "40px" }) }),
|
|
4760
4912
|
!isComplete && percentLoaded !== 100 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4761
4913
|
ui.Flex,
|
|
@@ -5243,14 +5395,15 @@ const UploadDropzone = (props) => {
|
|
|
5243
5395
|
children
|
|
5244
5396
|
] }) });
|
|
5245
5397
|
}, BrowserContent = ({ onClose }) => {
|
|
5246
|
-
const client = useVersionedClient(), [portalElement, setPortalElement] = react.useState(null), dispatch = reactRedux.useDispatch()
|
|
5247
|
-
const { documentId, result, transition } = update;
|
|
5248
|
-
transition === "appear" && dispatch(assetsActions.listenerCreateQueue({ asset: result })), transition === "disappear" && dispatch(assetsActions.listenerDeleteQueue({ assetId: documentId })), transition === "update" && dispatch(assetsActions.listenerUpdateQueue({ asset: result }));
|
|
5249
|
-
}, handleTagUpdate = (update) => {
|
|
5250
|
-
const { documentId, result, transition } = update;
|
|
5251
|
-
transition === "appear" && dispatch(tagsActions.listenerCreateQueue({ tag: result })), transition === "disappear" && dispatch(tagsActions.listenerDeleteQueue({ tagId: documentId })), transition === "update" && dispatch(tagsActions.listenerUpdateQueue({ tag: result }));
|
|
5252
|
-
};
|
|
5398
|
+
const client = useVersionedClient(), [portalElement, setPortalElement] = react.useState(null), dispatch = reactRedux.useDispatch();
|
|
5253
5399
|
return react.useEffect(() => {
|
|
5400
|
+
const handleAssetUpdate = (update) => {
|
|
5401
|
+
const { documentId, result, transition } = update;
|
|
5402
|
+
transition === "appear" && dispatch(assetsActions.listenerCreateQueue({ asset: result })), transition === "disappear" && dispatch(assetsActions.listenerDeleteQueue({ assetId: documentId })), transition === "update" && dispatch(assetsActions.listenerUpdateQueue({ asset: result }));
|
|
5403
|
+
}, handleTagUpdate = (update) => {
|
|
5404
|
+
const { documentId, result, transition } = update;
|
|
5405
|
+
transition === "appear" && dispatch(tagsActions.listenerCreateQueue({ tag: result })), transition === "disappear" && dispatch(tagsActions.listenerDeleteQueue({ tagId: documentId })), transition === "update" && dispatch(tagsActions.listenerUpdateQueue({ tag: result }));
|
|
5406
|
+
};
|
|
5254
5407
|
dispatch(assetsActions.loadPageIndex({ pageIndex: 0 })), dispatch(tagsActions.fetchRequest());
|
|
5255
5408
|
const subscriptionAsset = client.listen(
|
|
5256
5409
|
groq__default.default`*[_type in ["sanity.fileAsset", "sanity.imageAsset"] && !(_id in path("drafts.**"))]`
|
|
@@ -5258,7 +5411,7 @@ const UploadDropzone = (props) => {
|
|
|
5258
5411
|
return () => {
|
|
5259
5412
|
subscriptionAsset?.unsubscribe(), subscriptionTag?.unsubscribe();
|
|
5260
5413
|
};
|
|
5261
|
-
}, []), /* @__PURE__ */ jsxRuntime.jsx(ui.PortalProvider, { element: portalElement, children: /* @__PURE__ */ jsxRuntime.jsxs(UploadDropzone, { children: [
|
|
5414
|
+
}, [client, dispatch]), /* @__PURE__ */ jsxRuntime.jsx(ui.PortalProvider, { element: portalElement, children: /* @__PURE__ */ jsxRuntime.jsxs(UploadDropzone, { children: [
|
|
5262
5415
|
/* @__PURE__ */ jsxRuntime.jsx(Dialogs, {}),
|
|
5263
5416
|
/* @__PURE__ */ jsxRuntime.jsx(Notifications, {}),
|
|
5264
5417
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Card, { display: "flex", height: "fill", ref: setPortalElement, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", flex: 1, children: [
|
|
@@ -5275,7 +5428,7 @@ const UploadDropzone = (props) => {
|
|
|
5275
5428
|
] }) })
|
|
5276
5429
|
] }) });
|
|
5277
5430
|
}, Browser = (props) => {
|
|
5278
|
-
const client = useVersionedClient()
|
|
5431
|
+
const client = useVersionedClient();
|
|
5279
5432
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5280
5433
|
ReduxProvider,
|
|
5281
5434
|
{
|
|
@@ -5283,10 +5436,10 @@ const UploadDropzone = (props) => {
|
|
|
5283
5436
|
client,
|
|
5284
5437
|
document: props?.document,
|
|
5285
5438
|
selectedAssets: props?.selectedAssets,
|
|
5286
|
-
children: /* @__PURE__ */ jsxRuntime.
|
|
5439
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(AssetBrowserDispatchProvider, { onSelect: props?.onSelect, children: [
|
|
5287
5440
|
/* @__PURE__ */ jsxRuntime.jsx(GlobalStyle, {}),
|
|
5288
5441
|
/* @__PURE__ */ jsxRuntime.jsx(BrowserContent, { onClose: props?.onClose })
|
|
5289
|
-
] })
|
|
5442
|
+
] })
|
|
5290
5443
|
}
|
|
5291
5444
|
);
|
|
5292
5445
|
}, FormBuilderTool = (props) => {
|