sanity-plugin-media 3.0.0 → 3.0.2

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.
Files changed (45) hide show
  1. package/dist/index.d.mts +7 -4
  2. package/dist/index.d.ts +7 -4
  3. package/dist/index.js +436 -265
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +455 -285
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +26 -30
  8. package/src/components/AssetGridVirtualized/index.tsx +13 -2
  9. package/src/components/Browser/index.tsx +30 -41
  10. package/src/components/ButtonViewGroup/index.tsx +0 -1
  11. package/src/components/CardAsset/index.tsx +13 -14
  12. package/src/components/CardUpload/index.tsx +1 -1
  13. package/src/components/Controls/index.tsx +0 -1
  14. package/src/components/DebugControls/index.tsx +1 -0
  15. package/src/components/DialogAssetEdit/index.tsx +10 -3
  16. package/src/components/DialogConfirm/index.tsx +8 -1
  17. package/src/components/DialogSearchFacets/index.tsx +1 -1
  18. package/src/components/DialogTagCreate/index.tsx +1 -1
  19. package/src/components/DialogTagEdit/index.tsx +1 -1
  20. package/src/components/DialogTags/index.tsx +1 -1
  21. package/src/components/Dialogs/index.tsx +1 -1
  22. package/src/components/DocumentList/index.tsx +1 -1
  23. package/src/components/FileAssetPreview/index.tsx +1 -1
  24. package/src/components/FormFieldInputLabel/index.tsx +2 -1
  25. package/src/components/FormSubmitButton/index.tsx +1 -0
  26. package/src/components/Header/index.tsx +1 -1
  27. package/src/components/Image/index.tsx +4 -4
  28. package/src/components/OrderSelect/index.tsx +0 -1
  29. package/src/components/ReduxProvider/index.tsx +0 -1
  30. package/src/components/SearchFacet/index.tsx +4 -9
  31. package/src/components/SearchFacetNumber/index.tsx +1 -1
  32. package/src/components/SearchFacetSelect/index.tsx +1 -1
  33. package/src/components/SearchFacets/index.tsx +1 -1
  34. package/src/components/SearchFacetsControl/index.tsx +1 -1
  35. package/src/components/TableHeader/index.tsx +4 -6
  36. package/src/components/TableHeaderItem/index.tsx +1 -1
  37. package/src/components/TableRowAsset/index.tsx +37 -45
  38. package/src/components/TableRowUpload/index.tsx +6 -1
  39. package/src/components/Tag/index.tsx +1 -0
  40. package/src/components/TagIcon/index.tsx +0 -2
  41. package/src/components/TagView/index.tsx +1 -1
  42. package/src/components/TagsPanel/index.tsx +1 -1
  43. package/src/components/Tool/index.tsx +1 -1
  44. package/src/hooks/usePortalPopoverProps.ts +1 -0
  45. package/src/plugin.tsx +0 -1
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"), isHotkey = require("is-hotkey"), 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");
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 isHotkey__default = /* @__PURE__ */ _interopDefaultCompat(isHotkey), 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);
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
- isHotkey__default.default(hotkey, e) && (keyPressed.current = !0, onPress && onPress());
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
- Container$1,
1814
- {
1815
- padding: [2, 2, 1],
1816
- scheme,
1817
- children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: ["flex-start", "flex-start", "center"], direction: ["column", "column", "row"], children: [
1818
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingBottom: [3, 3, 0], paddingLeft: 1, paddingRight: 2, paddingTop: [1, 1, 0], children: /* @__PURE__ */ jsxRuntime.jsx(
1819
- ui.Label,
1820
- {
1821
- size: 0,
1822
- style: {
1823
- whiteSpace: "nowrap"
1824
- },
1825
- children: facet.title
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(
@@ -2489,6 +2620,7 @@ const DebugControls = () => {
2489
2620
  /* @__PURE__ */ jsxRuntime.jsx(
2490
2621
  ui.Tooltip,
2491
2622
  {
2623
+ animate: !0,
2492
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" }) }),
2493
2625
  fallbackPlacements: ["right", "left"],
2494
2626
  placement: "bottom",
@@ -2807,6 +2939,7 @@ const imageDprUrl = (asset, options) => {
2807
2939
  error && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: /* @__PURE__ */ jsxRuntime.jsx(
2808
2940
  ui.Tooltip,
2809
2941
  {
2942
+ animate: !0,
2810
2943
  content: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { muted: !0, size: 1, children: [
2811
2944
  /* @__PURE__ */ jsxRuntime.jsx(StyledErrorOutlineIcon, { style: { marginRight: "0.1em" } }),
2812
2945
  error
@@ -2922,6 +3055,7 @@ const imageDprUrl = (asset, options) => {
2922
3055
  ] }) : content = "No unpublished changes" : content = "There are validation errors that need to be fixed before this document can be published", /* @__PURE__ */ jsxRuntime.jsx(
2923
3056
  ui.Tooltip,
2924
3057
  {
3058
+ animate: !0,
2925
3059
  content: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 3, style: { maxWidth: "185px" }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: content }) }),
2926
3060
  disabled: "ontouchstart" in window,
2927
3061
  placement: "top",
@@ -2939,14 +3073,14 @@ const imageDprUrl = (asset, options) => {
2939
3073
  }
2940
3074
  );
2941
3075
  }, Image$1 = styledComponents.styled.img`
2942
- --checkerboard-color: ${(props) => props.scheme ? getSchemeColor(props.scheme, "bg2") : "inherit"};
3076
+ --checkerboard-color: ${(props) => props.$scheme ? getSchemeColor(props.$scheme, "bg2") : "inherit"};
2943
3077
 
2944
3078
  display: block;
2945
3079
  width: 100%;
2946
3080
  height: 100%;
2947
3081
  object-fit: contain;
2948
3082
 
2949
- ${(props) => props.showCheckerboard && styledComponents.css`
3083
+ ${(props) => props.$showCheckerboard && styledComponents.css`
2950
3084
  background-image: linear-gradient(45deg, var(--checkerboard-color) 25%, transparent 25%),
2951
3085
  linear-gradient(-45deg, var(--checkerboard-color) 25%, transparent 25%),
2952
3086
  linear-gradient(45deg, transparent 75%, var(--checkerboard-color) 75%),
@@ -3073,183 +3207,205 @@ const imageDprUrl = (asset, options) => {
3073
3207
  }
3074
3208
  )
3075
3209
  ] }) });
3076
- return currentAsset ? /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { footer: /* @__PURE__ */ jsxRuntime.jsx(Footer, {}), header: "Asset details", id, onClose: handleClose, width: 3, children: [
3077
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: ["column-reverse", "column-reverse", "row-reverse"], children: [
3078
- /* @__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 }) => {
3079
- const uniqueReferringDocuments = getUniqueDocuments(referringDocuments);
3080
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3081
- /* @__PURE__ */ jsxRuntime.jsxs(ui.TabList, { space: 2, children: [
3082
- /* @__PURE__ */ jsxRuntime.jsx(
3083
- ui.Tab,
3084
- {
3085
- "aria-controls": "details-panel",
3086
- disabled: formUpdating,
3087
- id: "details-tab",
3088
- label: "Details",
3089
- onClick: () => setTabSection("details"),
3090
- selected: tabSection === "details",
3091
- size: 2
3092
- }
3093
- ),
3094
- /* @__PURE__ */ jsxRuntime.jsx(
3095
- ui.Tab,
3096
- {
3097
- "aria-controls": "references-panel",
3098
- disabled: formUpdating,
3099
- id: "references-tab",
3100
- label: `References${!isLoading && Array.isArray(uniqueReferringDocuments) ? ` (${uniqueReferringDocuments.length})` : ""}`,
3101
- onClick: () => setTabSection("references"),
3102
- selected: tabSection === "references",
3103
- size: 2
3104
- }
3105
- )
3106
- ] }),
3107
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { as: "form", marginTop: 4, onSubmit: handleSubmit(onSubmit), children: [
3108
- !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." }) }),
3109
- /* @__PURE__ */ jsxRuntime.jsx("button", { style: { display: "none" }, tabIndex: -1, type: "submit" }),
3110
- /* @__PURE__ */ jsxRuntime.jsx(
3111
- ui.TabPanel,
3112
- {
3113
- "aria-labelledby": "details",
3114
- hidden: tabSection !== "details",
3115
- id: "details-panel",
3116
- children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
3117
- /* @__PURE__ */ jsxRuntime.jsx(
3118
- FormFieldInputTags,
3119
- {
3120
- control,
3121
- disabled: formUpdating,
3122
- error: errors?.opt?.media?.tags?.message,
3123
- label: "Tags",
3124
- name: "opt.media.tags",
3125
- onCreateTag: handleCreateTag,
3126
- options: allTagOptions,
3127
- placeholder: "Select or create...",
3128
- value: assetTagOptions
3129
- }
3130
- ),
3131
- /* @__PURE__ */ jsxRuntime.jsx(
3132
- FormFieldInputText,
3133
- {
3134
- ...register("originalFilename"),
3135
- disabled: formUpdating,
3136
- error: errors?.originalFilename?.message,
3137
- label: "Filename",
3138
- name: "originalFilename",
3139
- value: currentAsset?.originalFilename
3140
- }
3141
- ),
3142
- /* @__PURE__ */ jsxRuntime.jsx(
3143
- FormFieldInputText,
3144
- {
3145
- ...register("title"),
3146
- disabled: formUpdating,
3147
- error: errors?.title?.message,
3148
- label: "Title",
3149
- name: "title",
3150
- value: currentAsset?.title
3151
- }
3152
- ),
3153
- /* @__PURE__ */ jsxRuntime.jsx(
3154
- FormFieldInputText,
3155
- {
3156
- ...register("altText"),
3157
- disabled: formUpdating,
3158
- error: errors?.altText?.message,
3159
- label: "Alt Text",
3160
- name: "altText",
3161
- value: currentAsset?.altText
3162
- }
3163
- ),
3164
- /* @__PURE__ */ jsxRuntime.jsx(
3165
- FormFieldInputTextarea,
3166
- {
3167
- ...register("description"),
3168
- disabled: formUpdating,
3169
- error: errors?.description?.message,
3170
- label: "Description",
3171
- name: "description",
3172
- rows: 5,
3173
- value: currentAsset?.description
3174
- }
3175
- ),
3176
- creditLine?.enabled && /* @__PURE__ */ jsxRuntime.jsx(
3177
- FormFieldInputText,
3178
- {
3179
- ...register("creditLine"),
3180
- error: errors?.creditLine?.message,
3181
- label: "Credit",
3182
- name: "creditLine",
3183
- value: currentAsset?.creditLine,
3184
- disabled: formUpdating || creditLine?.excludeSources?.includes(currentAsset?.source?.name)
3185
- }
3186
- )
3187
- ] })
3188
- }
3189
- ),
3190
- /* @__PURE__ */ jsxRuntime.jsx(
3191
- ui.TabPanel,
3192
- {
3193
- "aria-labelledby": "references",
3194
- hidden: tabSection !== "references",
3195
- id: "references-panel",
3196
- children: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginTop: 5, children: assetItem?.asset && /* @__PURE__ */ jsxRuntime.jsx(
3197
- 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,
3198
3227
  {
3199
- documents: uniqueReferringDocuments,
3200
- isLoading
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
3201
3235
  }
3202
- ) })
3203
- }
3204
- )
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 }) })
3205
3365
  ] })
3206
- ] });
3207
- } }) }),
3208
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { flex: 1, padding: 4, children: [
3209
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { style: { aspectRatio: "1" }, children: [
3210
- isFileAsset(currentAsset) && /* @__PURE__ */ jsxRuntime.jsx(FileAssetPreview, { asset: currentAsset }),
3211
- isImageAsset(currentAsset) && /* @__PURE__ */ jsxRuntime.jsx(
3212
- Image$1,
3213
- {
3214
- draggable: !1,
3215
- scheme,
3216
- showCheckerboard: !currentAsset?.metadata?.isOpaque,
3217
- src: imageDprUrl(currentAsset, { height: 600, width: 600 })
3218
- }
3219
- )
3220
3366
  ] }),
3221
- currentAsset && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginTop: 4, children: /* @__PURE__ */ jsxRuntime.jsx(AssetMetadata, { asset: currentAsset, item: assetItem }) })
3222
- ] })
3223
- ] }),
3224
- children
3225
- ] }) : null;
3367
+ children
3368
+ ]
3369
+ }
3370
+ ) : null;
3226
3371
  }, DialogConfirm = (props) => {
3227
3372
  const { children, dialog } = props, dispatch = reactRedux.useDispatch(), handleClose = () => {
3228
3373
  dispatch(dialogActions.remove({ id: dialog?.id }));
3229
3374
  }, handleConfirm = () => {
3230
3375
  dialog?.closeDialogId && dispatch(dialogActions.remove({ id: dialog?.closeDialogId })), dialog?.confirmCallbackAction && dispatch(dialog.confirmCallbackAction), handleClose();
3231
3376
  };
3232
- return /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { footer: /* @__PURE__ */ jsxRuntime.jsx(() => /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { justify: "space-between", children: [
3233
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { fontSize: 1, mode: "bleed", onClick: handleClose, text: "Cancel" }),
3234
- /* @__PURE__ */ jsxRuntime.jsx(
3235
- ui.Button,
3236
- {
3237
- fontSize: 1,
3238
- onClick: handleConfirm,
3239
- text: dialog?.confirmText,
3240
- tone: dialog?.tone
3241
- }
3242
- )
3243
- ] }) }), {}), header: /* @__PURE__ */ jsxRuntime.jsx(() => /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", children: [
3244
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingX: 1, children: /* @__PURE__ */ jsxRuntime.jsx(icons.WarningOutlineIcon, {}) }),
3245
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginLeft: 2, children: dialog?.headerTitle })
3246
- ] }), {}), id: "confirm", onClose: handleClose, width: 1, children: [
3247
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingX: 4, paddingY: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
3248
- dialog?.title && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: dialog.title }),
3249
- dialog?.description && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: /* @__PURE__ */ jsxRuntime.jsx("em", { children: dialog.description }) })
3250
- ] }) }),
3251
- children
3252
- ] });
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
+ );
3253
3409
  }, DialogSearchFacets = (props) => {
3254
3410
  const {
3255
3411
  children,
@@ -3257,7 +3413,7 @@ const imageDprUrl = (asset, options) => {
3257
3413
  } = props, dispatch = reactRedux.useDispatch(), handleClose = react.useCallback(() => {
3258
3414
  dispatch(dialogActions.clear());
3259
3415
  }, []);
3260
- 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: [
3261
3417
  /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { padding: 3, children: [
3262
3418
  /* @__PURE__ */ jsxRuntime.jsx(SearchFacets, { layout: "stack" }),
3263
3419
  /* @__PURE__ */ jsxRuntime.jsx(SearchFacetsControl, {})
@@ -3290,7 +3446,7 @@ const imageDprUrl = (asset, options) => {
3290
3446
  creatingError && setError("name", {
3291
3447
  message: creatingError?.message
3292
3448
  });
3293
- }, [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(
3294
3450
  FormSubmitButton,
3295
3451
  {
3296
3452
  disabled: formUpdating || !isDirty || !isValid,
@@ -3396,7 +3552,7 @@ const imageDprUrl = (asset, options) => {
3396
3552
  }
3397
3553
  )
3398
3554
  ] }) });
3399
- 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: [
3400
3556
  /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { as: "form", padding: 4, onSubmit: handleSubmit(onSubmit), children: [
3401
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." }) }),
3402
3558
  /* @__PURE__ */ jsxRuntime.jsx("button", { style: { display: "none" }, tabIndex: -1, type: "submit" }),
@@ -3430,6 +3586,7 @@ const imageDprUrl = (asset, options) => {
3430
3586
  return /* @__PURE__ */ jsxRuntime.jsx(
3431
3587
  ui.Tooltip,
3432
3588
  {
3589
+ animate: !0,
3433
3590
  content: /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { padding: 2, width: 0, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: tooltip }) }),
3434
3591
  disabled: "ontouchstart" in window,
3435
3592
  placement: "top",
@@ -3668,7 +3825,7 @@ const imageDprUrl = (asset, options) => {
3668
3825
  } = props, dispatch = reactRedux.useDispatch(), handleClose = react.useCallback(() => {
3669
3826
  dispatch(dialogActions.clear());
3670
3827
  }, []);
3671
- 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: [
3672
3829
  /* @__PURE__ */ jsxRuntime.jsx(
3673
3830
  ui.Box,
3674
3831
  {
@@ -3776,18 +3933,18 @@ const imageDprUrl = (asset, options) => {
3776
3933
  position: relative;
3777
3934
  width: 100%;
3778
3935
  `, CardContainer = styledComponents.styled(ui.Flex)(
3779
- ({ picked, theme, updating }) => styledComponents.css`
3936
+ ({ $picked, theme, $updating }) => styledComponents.css`
3780
3937
  border: 1px solid transparent;
3781
3938
  height: 100%;
3782
- pointer-events: ${updating ? "none" : "auto"};
3939
+ pointer-events: ${$updating ? "none" : "auto"};
3783
3940
  position: relative;
3784
3941
  transition: all 300ms;
3785
3942
  user-select: none;
3786
3943
  width: 100%;
3787
3944
 
3788
- 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"};
3789
3946
 
3790
- ${!updating && styledComponents.css`
3947
+ ${!$updating && styledComponents.css`
3791
3948
  @media (hover: hover) and (pointer: fine) {
3792
3949
  &:hover {
3793
3950
  border: 1px solid var(--card-border-color);
@@ -3796,14 +3953,13 @@ const imageDprUrl = (asset, options) => {
3796
3953
  `}
3797
3954
  `
3798
3955
  ), ContextActionContainer$2 = styledComponents.styled(ui.Flex)(
3799
- // @ts-expect-error - fix typings later
3800
- ({ scheme }) => styledComponents.css`
3956
+ ({ $scheme }) => styledComponents.css`
3801
3957
  cursor: pointer;
3802
3958
  height: ${PANEL_HEIGHT}px;
3803
3959
  transition: all 300ms;
3804
3960
  @media (hover: hover) and (pointer: fine) {
3805
3961
  &:hover {
3806
- background: ${getSchemeColor(scheme, "bg")};
3962
+ background: ${getSchemeColor($scheme, "bg")};
3807
3963
  }
3808
3964
  }
3809
3965
  `
@@ -3823,7 +3979,7 @@ const imageDprUrl = (asset, options) => {
3823
3979
  }, handleContextActionClick = (e) => {
3824
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 }));
3825
3981
  }, opacityContainer = updating ? 0.5 : 1, opacityPreview = selected || updating ? 0.25 : 1;
3826
- 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: [
3827
3983
  /* @__PURE__ */ jsxRuntime.jsxs(
3828
3984
  ui.Box,
3829
3985
  {
@@ -3839,8 +3995,8 @@ const imageDprUrl = (asset, options) => {
3839
3995
  Image$1,
3840
3996
  {
3841
3997
  draggable: !1,
3842
- scheme,
3843
- showCheckerboard: !isOpaque,
3998
+ $scheme: scheme,
3999
+ $showCheckerboard: !isOpaque,
3844
4000
  src: imageDprUrl(asset, { height: 250, width: 250 }),
3845
4001
  style: {
3846
4002
  draggable: !1,
@@ -3889,7 +4045,7 @@ const imageDprUrl = (asset, options) => {
3889
4045
  align: "center",
3890
4046
  onClick: handleContextActionClick,
3891
4047
  paddingX: 1,
3892
- scheme,
4048
+ $scheme: scheme,
3893
4049
  style: { opacity: opacityContainer },
3894
4050
  children: [
3895
4051
  onSelect ? /* @__PURE__ */ jsxRuntime.jsx(
@@ -3928,6 +4084,7 @@ const imageDprUrl = (asset, options) => {
3928
4084
  children: /* @__PURE__ */ jsxRuntime.jsx(
3929
4085
  ui.Tooltip,
3930
4086
  {
4087
+ animate: !0,
3931
4088
  content: /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { padding: 2, width: 0, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: error }) }),
3932
4089
  placement: "left",
3933
4090
  portal: !0,
@@ -4237,7 +4394,7 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4237
4394
  Image$1,
4238
4395
  {
4239
4396
  draggable: !1,
4240
- scheme,
4397
+ $scheme: scheme,
4241
4398
  src: item.objectUrl,
4242
4399
  style: {
4243
4400
  opacity: 0.4
@@ -4296,16 +4453,26 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4296
4453
  ) });
4297
4454
  }, CARD_HEIGHT = 220, CARD_WIDTH = 240, VirtualCell = react.memo(
4298
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
4299
- ), ItemContainer = styledComponents.styled.div`
4456
+ ), StyledItemContainer = styledComponents.styled.div`
4300
4457
  height: ${CARD_HEIGHT}px;
4301
4458
  width: ${CARD_WIDTH}px;
4302
- `, ListContainer = styledComponents.styled.div`
4459
+ `;
4460
+ function ItemContainer(props) {
4461
+ const { context, ...rest } = props;
4462
+ return /* @__PURE__ */ jsxRuntime.jsx(StyledItemContainer, { ...rest });
4463
+ }
4464
+ const StyledListContainer = styledComponents.styled.div`
4303
4465
  display: grid;
4304
4466
  grid-template-columns: repeat(auto-fill, ${CARD_WIDTH}px);
4305
4467
  grid-template-rows: repeat(auto-fill, ${CARD_HEIGHT}px);
4306
4468
  justify-content: center;
4307
4469
  margin: 0 auto;
4308
- `, AssetGridVirtualized = (props) => {
4470
+ `;
4471
+ function ListContainer(props) {
4472
+ const { context, ...rest } = props;
4473
+ return /* @__PURE__ */ jsxRuntime.jsx(StyledListContainer, { ...rest });
4474
+ }
4475
+ const AssetGridVirtualized = (props) => {
4309
4476
  const { items, onLoadMore } = props, selectedAssets = useTypedSelector((state) => state.selected.assets), selectedIds = selectedAssets && selectedAssets.map((asset) => asset._id) || [], totalCount = items?.length;
4310
4477
  return totalCount === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(
4311
4478
  reactVirtuoso.VirtuosoGrid,
@@ -4360,12 +4527,11 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4360
4527
  }
4361
4528
  ) });
4362
4529
  }, ContextActionContainer$1 = styledComponents.styled(ui.Flex)(
4363
- // @ts-expect-error - fix typings later
4364
- ({ scheme }) => styledComponents.css`
4530
+ ({ $scheme }) => styledComponents.css`
4365
4531
  cursor: pointer;
4366
4532
  @media (hover: hover) and (pointer: fine) {
4367
4533
  &:hover {
4368
- background: ${getSchemeColor(scheme, "bg")};
4534
+ background: ${getSchemeColor($scheme, "bg")};
4369
4535
  }
4370
4536
  }
4371
4537
  `
@@ -4399,7 +4565,7 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4399
4565
  align: "center",
4400
4566
  justify: "center",
4401
4567
  onClick: handleContextActionClick,
4402
- scheme,
4568
+ $scheme: scheme,
4403
4569
  style: {
4404
4570
  height: "100%",
4405
4571
  position: "relative"
@@ -4429,36 +4595,31 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4429
4595
  ]
4430
4596
  }
4431
4597
  );
4432
- }, REFERENCE_COUNT_VISIBILITY_DELAY = 750, ContainerGrid = styledComponents.styled(ui.Grid)(
4433
- // @ts-expect-error - fix typings later
4434
- ({
4435
- scheme,
4436
- selected,
4437
- updating
4438
- }) => styledComponents.css`
4439
- align-items: center;
4440
- cursor: ${selected ? "default" : "pointer"};
4441
- height: 100%;
4442
- pointer-events: ${updating ? "none" : "auto"};
4443
- user-select: none;
4444
- 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;
4445
4605
 
4446
- ${!updating && styledComponents.css`
4447
- @media (hover: hover) and (pointer: fine) {
4448
- &:hover {
4449
- background: ${getSchemeColor(scheme, "bg")};
4450
- }
4606
+ ${!$updating && styledComponents.css`
4607
+ @media (hover: hover) and (pointer: fine) {
4608
+ &:hover {
4609
+ background: ${getSchemeColor($scheme, "bg")};
4451
4610
  }
4452
- `}
4453
- `
4454
- ), ContextActionContainer = styledComponents.styled(ui.Flex)(({ scheme }) => styledComponents.css`
4455
- cursor: pointer;
4456
- @media (hover: hover) and (pointer: fine) {
4457
- &:hover {
4458
- background: ${getSchemeColor(scheme, "bg2")};
4459
4611
  }
4460
- }
4461
- `), StyledWarningIcon = styledComponents.styled(icons.WarningFilledIcon)(({ theme }) => ({
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 }) => ({
4462
4623
  color: theme.sanity.color.spot.red
4463
4624
  })), TableRowAsset = (props) => {
4464
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(
@@ -4481,21 +4642,21 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4481
4642
  ContainerGrid,
4482
4643
  {
4483
4644
  onClick: selected ? void 0 : handleClick,
4484
- scheme,
4485
- selected,
4645
+ $scheme: scheme,
4646
+ $selected: selected,
4486
4647
  style: {
4487
4648
  gridColumnGap: mediaIndex < 3 ? 0 : "16px",
4488
4649
  gridRowGap: 0,
4489
4650
  gridTemplateColumns: mediaIndex < 3 ? GRID_TEMPLATE_COLUMNS.SMALL : GRID_TEMPLATE_COLUMNS.LARGE,
4490
4651
  gridTemplateRows: mediaIndex < 3 ? "auto" : "1fr"
4491
4652
  },
4492
- updating: item.updating,
4653
+ $updating: item.updating,
4493
4654
  children: [
4494
4655
  /* @__PURE__ */ jsxRuntime.jsx(
4495
4656
  ContextActionContainer,
4496
4657
  {
4497
4658
  onClick: handleContextActionClick,
4498
- scheme,
4659
+ $scheme: scheme,
4499
4660
  style: {
4500
4661
  alignItems: "center",
4501
4662
  gridColumn: 1,
@@ -4545,8 +4706,8 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4545
4706
  Image$1,
4546
4707
  {
4547
4708
  draggable: !1,
4548
- scheme,
4549
- showCheckerboard: !isOpaque,
4709
+ $scheme: scheme,
4710
+ $showCheckerboard: !isOpaque,
4550
4711
  src: imageDprUrl(asset, { height: 100, width: 100 })
4551
4712
  }
4552
4713
  )
@@ -4673,6 +4834,7 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4673
4834
  children: error && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
4674
4835
  ui.Tooltip,
4675
4836
  {
4837
+ animate: !0,
4676
4838
  content: /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { padding: 2, width: 0, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: error }) }),
4677
4839
  placement: "left",
4678
4840
  portal: !0,
@@ -4737,7 +4899,15 @@ const TableRowUpload = (props) => {
4737
4899
  width: "100px"
4738
4900
  },
4739
4901
  children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { style: { height: "100%", position: "relative" }, children: [
4740
- item.assetType === "image" && item?.objectUrl && /* @__PURE__ */ jsxRuntime.jsx(Image$1, { draggable: !1, scheme, src: item.objectUrl, style: { opacity: 0.25 } }),
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
+ ),
4741
4911
  item.assetType === "file" && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { height: "100%", opacity: 0.1 }, children: /* @__PURE__ */ jsxRuntime.jsx(FileIcon, { width: "40px" }) }),
4742
4912
  !isComplete && percentLoaded !== 100 && /* @__PURE__ */ jsxRuntime.jsx(
4743
4913
  ui.Flex,
@@ -5225,14 +5395,15 @@ const UploadDropzone = (props) => {
5225
5395
  children
5226
5396
  ] }) });
5227
5397
  }, BrowserContent = ({ onClose }) => {
5228
- const client = useVersionedClient(), [portalElement, setPortalElement] = react.useState(null), dispatch = reactRedux.useDispatch(), handleAssetUpdate = (update) => {
5229
- const { documentId, result, transition } = update;
5230
- transition === "appear" && dispatch(assetsActions.listenerCreateQueue({ asset: result })), transition === "disappear" && dispatch(assetsActions.listenerDeleteQueue({ assetId: documentId })), transition === "update" && dispatch(assetsActions.listenerUpdateQueue({ asset: result }));
5231
- }, handleTagUpdate = (update) => {
5232
- const { documentId, result, transition } = update;
5233
- transition === "appear" && dispatch(tagsActions.listenerCreateQueue({ tag: result })), transition === "disappear" && dispatch(tagsActions.listenerDeleteQueue({ tagId: documentId })), transition === "update" && dispatch(tagsActions.listenerUpdateQueue({ tag: result }));
5234
- };
5398
+ const client = useVersionedClient(), [portalElement, setPortalElement] = react.useState(null), dispatch = reactRedux.useDispatch();
5235
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
+ };
5236
5407
  dispatch(assetsActions.loadPageIndex({ pageIndex: 0 })), dispatch(tagsActions.fetchRequest());
5237
5408
  const subscriptionAsset = client.listen(
5238
5409
  groq__default.default`*[_type in ["sanity.fileAsset", "sanity.imageAsset"] && !(_id in path("drafts.**"))]`
@@ -5240,7 +5411,7 @@ const UploadDropzone = (props) => {
5240
5411
  return () => {
5241
5412
  subscriptionAsset?.unsubscribe(), subscriptionTag?.unsubscribe();
5242
5413
  };
5243
- }, []), /* @__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: [
5244
5415
  /* @__PURE__ */ jsxRuntime.jsx(Dialogs, {}),
5245
5416
  /* @__PURE__ */ jsxRuntime.jsx(Notifications, {}),
5246
5417
  /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { display: "flex", height: "fill", ref: setPortalElement, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", flex: 1, children: [
@@ -5257,7 +5428,7 @@ const UploadDropzone = (props) => {
5257
5428
  ] }) })
5258
5429
  ] }) });
5259
5430
  }, Browser = (props) => {
5260
- const client = useVersionedClient(), scheme = sanity.useColorSchemeValue();
5431
+ const client = useVersionedClient();
5261
5432
  return /* @__PURE__ */ jsxRuntime.jsx(
5262
5433
  ReduxProvider,
5263
5434
  {
@@ -5265,10 +5436,10 @@ const UploadDropzone = (props) => {
5265
5436
  client,
5266
5437
  document: props?.document,
5267
5438
  selectedAssets: props?.selectedAssets,
5268
- children: /* @__PURE__ */ jsxRuntime.jsx(ui.ThemeProvider, { scheme, theme: ui.studioTheme, children: /* @__PURE__ */ jsxRuntime.jsx(ui.ToastProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(AssetBrowserDispatchProvider, { onSelect: props?.onSelect, children: [
5439
+ children: /* @__PURE__ */ jsxRuntime.jsxs(AssetBrowserDispatchProvider, { onSelect: props?.onSelect, children: [
5269
5440
  /* @__PURE__ */ jsxRuntime.jsx(GlobalStyle, {}),
5270
5441
  /* @__PURE__ */ jsxRuntime.jsx(BrowserContent, { onClose: props?.onClose })
5271
- ] }) }) })
5442
+ ] })
5272
5443
  }
5273
5444
  );
5274
5445
  }, FormBuilderTool = (props) => {