sanity-plugin-media 4.3.1 → 4.3.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 (145) hide show
  1. package/LICENSE +4 -4
  2. package/README.md +12 -12
  3. package/dist/index.d.mts +263 -195
  4. package/dist/index.d.ts +263 -195
  5. package/dist/index.js +83 -203
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +84 -203
  8. package/dist/index.mjs.map +1 -1
  9. package/package.json +41 -63
  10. package/src/__tests__/fixtures/createEpicTestStore.ts +5 -4
  11. package/src/__tests__/fixtures/mockSanityClient.ts +8 -8
  12. package/src/__tests__/fixtures/renderWithProviders.tsx +8 -7
  13. package/src/__tests__/fixtures/rootState.ts +4 -4
  14. package/src/components/AssetGridVirtualized/index.tsx +8 -7
  15. package/src/components/AssetMetadata/index.tsx +6 -5
  16. package/src/components/AssetTableVirtualized/index.tsx +7 -6
  17. package/src/components/AutoTagInputWrapper/index.tsx +9 -4
  18. package/src/components/Browser/Browser.test.tsx +9 -8
  19. package/src/components/Browser/index.tsx +2 -1
  20. package/src/components/Browser/useBrowserInit.ts +9 -9
  21. package/src/components/ButtonAssetCopy/index.tsx +1 -0
  22. package/src/components/ButtonViewGroup/index.tsx +4 -3
  23. package/src/components/CardAsset/CardAsset.test.tsx +53 -52
  24. package/src/components/CardAsset/index.tsx +52 -49
  25. package/src/components/CardUpload/index.tsx +7 -6
  26. package/src/components/Controls/index.tsx +7 -6
  27. package/src/components/DebugControls/index.tsx +5 -4
  28. package/src/components/DialogAssetEdit/Details.tsx +3 -2
  29. package/src/components/DialogAssetEdit/DialogAssetEdit.test.tsx +28 -27
  30. package/src/components/DialogAssetEdit/index.tsx +37 -37
  31. package/src/components/DialogConfirm/index.tsx +2 -1
  32. package/src/components/DialogSearchFacets/index.tsx +3 -2
  33. package/src/components/DialogTagCreate/DialogTagCreate.test.tsx +16 -15
  34. package/src/components/DialogTagCreate/index.tsx +11 -10
  35. package/src/components/DialogTagEdit/DialogTagEdit.test.tsx +28 -27
  36. package/src/components/DialogTagEdit/index.tsx +17 -16
  37. package/src/components/DialogTags/index.tsx +4 -3
  38. package/src/components/Dialogs/index.tsx +2 -3
  39. package/src/components/DocumentList/index.tsx +2 -3
  40. package/src/components/FileAssetPreview/index.tsx +2 -2
  41. package/src/components/FormBuilderTool/FormBuilderTool.test.tsx +12 -11
  42. package/src/components/FormBuilderTool/index.tsx +2 -1
  43. package/src/components/FormFieldInputLabel/index.tsx +1 -2
  44. package/src/components/FormFieldInputTags/index.tsx +4 -3
  45. package/src/components/FormSubmitButton/index.tsx +1 -1
  46. package/src/components/Header/index.tsx +3 -3
  47. package/src/components/Image/index.tsx +10 -4
  48. package/src/components/Items/index.tsx +5 -4
  49. package/src/components/Notifications/index.tsx +3 -2
  50. package/src/components/OrderSelect/index.tsx +4 -3
  51. package/src/components/PickedBar/index.tsx +2 -1
  52. package/src/components/Progress/index.tsx +3 -3
  53. package/src/components/ReduxProvider/index.tsx +15 -12
  54. package/src/components/SearchFacet/index.tsx +3 -2
  55. package/src/components/SearchFacetNumber/index.tsx +8 -8
  56. package/src/components/SearchFacetSelect/index.tsx +7 -8
  57. package/src/components/SearchFacetString/index.tsx +1 -1
  58. package/src/components/SearchFacetTags/index.tsx +13 -12
  59. package/src/components/SearchFacets/index.tsx +2 -3
  60. package/src/components/SearchFacetsControl/index.tsx +13 -12
  61. package/src/components/TableHeader/index.tsx +18 -17
  62. package/src/components/TableHeaderItem/index.tsx +4 -4
  63. package/src/components/TableRowAsset/index.tsx +37 -36
  64. package/src/components/TableRowUpload/index.tsx +7 -6
  65. package/src/components/Tag/index.tsx +8 -7
  66. package/src/components/TagView/index.tsx +2 -2
  67. package/src/components/TagViewHeader/index.tsx +5 -4
  68. package/src/components/TagsPanel/index.tsx +3 -3
  69. package/src/components/TagsVirtualized/index.tsx +25 -24
  70. package/src/components/TextInputSearch/index.tsx +3 -2
  71. package/src/components/UploadDropzone/UploadDropzone.test.tsx +8 -7
  72. package/src/components/UploadDropzone/index.tsx +14 -13
  73. package/src/config/orders.ts +6 -6
  74. package/src/config/searchFacets.ts +56 -55
  75. package/src/constants.ts +15 -14
  76. package/src/contexts/AssetSourceDispatchContext.tsx +1 -1
  77. package/src/contexts/ToolOptionsContext.tsx +6 -5
  78. package/src/formSchema/index.test.ts +6 -5
  79. package/src/formSchema/index.ts +5 -5
  80. package/src/hooks/useBreakpointIndex.ts +6 -6
  81. package/src/hooks/useKeyPress.ts +2 -2
  82. package/src/hooks/usePortalPopoverProps.ts +1 -1
  83. package/src/modules/assets/actions.ts +8 -7
  84. package/src/modules/assets/deleteAndUpdateEpics.test.ts +18 -17
  85. package/src/modules/assets/fetchEpic.test.ts +12 -11
  86. package/src/modules/assets/index.ts +134 -133
  87. package/src/modules/assets/reducer.test.ts +9 -8
  88. package/src/modules/assets/tagsAndListenerEpics.test.ts +36 -35
  89. package/src/modules/debug/index.ts +3 -3
  90. package/src/modules/dialog/actions.ts +2 -2
  91. package/src/modules/dialog/epics.test.ts +29 -28
  92. package/src/modules/dialog/index.ts +36 -35
  93. package/src/modules/dialog/reducer.test.ts +31 -30
  94. package/src/modules/index.ts +9 -9
  95. package/src/modules/notifications/epics.test.ts +71 -70
  96. package/src/modules/notifications/index.ts +50 -49
  97. package/src/modules/notifications/reducer.test.ts +8 -7
  98. package/src/modules/search/index.test.ts +2 -1
  99. package/src/modules/search/index.ts +22 -22
  100. package/src/modules/selected/index.ts +2 -2
  101. package/src/modules/selectors.test.ts +4 -3
  102. package/src/modules/selectors.ts +5 -5
  103. package/src/modules/tags/epics.test.ts +16 -15
  104. package/src/modules/tags/index.test.ts +2 -1
  105. package/src/modules/tags/index.ts +82 -81
  106. package/src/modules/uploads/actions.ts +3 -3
  107. package/src/modules/uploads/epics.test.ts +13 -12
  108. package/src/modules/uploads/index.test.ts +8 -7
  109. package/src/modules/uploads/index.ts +48 -47
  110. package/src/operators/checkTagName.test.ts +7 -6
  111. package/src/operators/checkTagName.ts +6 -5
  112. package/src/operators/debugThrottle.ts +4 -4
  113. package/src/plugin.tsx +18 -18
  114. package/src/schemas/tag.ts +7 -7
  115. package/src/styled/react-select/creatable.tsx +40 -39
  116. package/src/styled/react-select/single.tsx +39 -38
  117. package/src/types/index.ts +4 -3
  118. package/src/utils/applyMediaTags.ts +11 -10
  119. package/src/utils/blocksToText.test.ts +5 -4
  120. package/src/utils/blocksToText.ts +2 -2
  121. package/src/utils/constructFilter.test.ts +15 -14
  122. package/src/utils/constructFilter.ts +7 -7
  123. package/src/utils/generatePreviewBlobUrl.test.ts +6 -5
  124. package/src/utils/generatePreviewBlobUrl.ts +2 -2
  125. package/src/utils/getAssetResolution.test.ts +3 -2
  126. package/src/utils/getDocumentAssetIds.test.ts +7 -6
  127. package/src/utils/getDocumentAssetIds.ts +2 -2
  128. package/src/utils/getSchemeColor.test.ts +1 -0
  129. package/src/utils/getSchemeColor.ts +9 -9
  130. package/src/utils/getTagSelectOptions.test.ts +6 -5
  131. package/src/utils/getTagSelectOptions.ts +1 -1
  132. package/src/utils/getUniqueDocuments.test.ts +4 -3
  133. package/src/utils/getUniqueDocuments.ts +2 -2
  134. package/src/utils/imageDprUrl.test.ts +4 -3
  135. package/src/utils/imageDprUrl.ts +1 -1
  136. package/src/utils/isSupportedAssetType.test.ts +1 -0
  137. package/src/utils/mediaField.ts +4 -3
  138. package/src/utils/sanitizeFormData.test.ts +14 -13
  139. package/src/utils/typeGuards.test.ts +2 -1
  140. package/src/utils/uploadSanityAsset.test.ts +5 -4
  141. package/src/utils/uploadSanityAsset.ts +17 -16
  142. package/src/utils/withMaxConcurrency.test.ts +5 -4
  143. package/src/utils/withMaxConcurrency.ts +4 -4
  144. package/src/utils/zodFormResolver.ts +17 -0
  145. package/v2-incompatible.js +2 -2
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"), styledComponents = require("styled-components"), reactRedux = require("react-redux"), toolkit = require("@reduxjs/toolkit"), pluralize = require("pluralize"), reduxObservable = require("redux-observable"), rxjs = require("rxjs"), operators$1 = require("rxjs/operators"), groq = require("groq"), nanoid = require("nanoid"), uuid = require("@sanity/uuid"), 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"), dateFns = require("date-fns"), filesize = require("filesize"), copy = require("copy-to-clipboard"), router = require("sanity/router"), reactFileIcon = require("react-file-icon"), CreatableSelect = require("react-select/creatable"), reactDropzone = require("react-dropzone");
3
+ var jsxRuntime = require("react/jsx-runtime"), icons = require("@sanity/icons"), sanity = require("sanity"), ui = require("@sanity/ui"), react = require("react"), isHotkeyEsm = require("is-hotkey-esm"), styledComponents = require("styled-components"), reactRedux = require("react-redux"), toolkit = require("@reduxjs/toolkit"), pluralize = require("pluralize"), reduxObservable = require("redux-observable"), rxjs = require("rxjs"), operators$1 = require("rxjs/operators"), groq = require("groq"), nanoid = require("nanoid"), uuid = require("@sanity/uuid"), reactNprogress = require("@tanem/react-nprogress"), color = require("@sanity/color"), Select = require("react-select"), reactVirtuoso = require("react-virtuoso"), reactHookForm = require("react-hook-form"), z = require("zod"), zod = require("@hookform/resolvers/zod"), dateFns = require("date-fns"), filesize = require("filesize"), copy = require("copy-to-clipboard"), router = require("sanity/router"), reactFileIcon = require("react-file-icon"), CreatableSelect = require("react-select/creatable"), reactDropzone = require("react-dropzone");
4
4
  function _interopDefaultCompat(e) {
5
5
  return e && typeof e == "object" && "default" in e ? e : { default: e };
6
6
  }
@@ -20,147 +20,10 @@ function _interopNamespaceCompat(e) {
20
20
  }), n.default = e, Object.freeze(n);
21
21
  }
22
22
  var pluralize__default = /* @__PURE__ */ _interopDefaultCompat(pluralize), groq__default = /* @__PURE__ */ _interopDefaultCompat(groq), Select__default = /* @__PURE__ */ _interopDefaultCompat(Select), z__namespace = /* @__PURE__ */ _interopNamespaceCompat(z), filesize__default = /* @__PURE__ */ _interopDefaultCompat(filesize), copy__default = /* @__PURE__ */ _interopDefaultCompat(copy), CreatableSelect__default = /* @__PURE__ */ _interopDefaultCompat(CreatableSelect);
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);
160
23
  const useKeyPress = (hotkey, onPress) => {
161
24
  const keyPressed = react.useRef(!1), downHandler = react.useCallback(
162
25
  (e) => {
163
- isHotkey(hotkey, e) && (keyPressed.current = !0, onPress && onPress());
26
+ isHotkeyEsm.isHotkey(hotkey, e) && (keyPressed.current = !0, onPress && onPress());
164
27
  },
165
28
  [hotkey, onPress]
166
29
  ), upHandler = react.useCallback(() => {
@@ -2701,7 +2564,13 @@ const imageDprUrl = (asset, options) => {
2701
2564
  }, sanitizeFormData = (formData) => Object.keys(formData).reduce((acc, key) => {
2702
2565
  const val = formData[key];
2703
2566
  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;
2704
- }, {}), 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 }) => {
2567
+ }, {}), isFileAsset = (asset) => asset._type === "sanity.fileAsset", isImageAsset = (asset) => asset._type === "sanity.imageAsset";
2568
+ function zodFormResolver(schema) {
2569
+ return zod.zodResolver(
2570
+ schema
2571
+ );
2572
+ }
2573
+ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asset.metadata.dimensions.height}px`, ButtonAssetCopy = ({ disabled, url }) => {
2705
2574
  const popoverProps = usePortalPopoverProps(), refPopoverTimeout = react.useRef(null), [popoverVisible, setPopoverVisible] = react.useState(!1), handleClick = () => {
2706
2575
  refPopoverTimeout.current && clearTimeout(refPopoverTimeout.current), setPopoverVisible(!0), copy__default.default(url), refPopoverTimeout.current = setTimeout(() => {
2707
2576
  setPopoverVisible(!1);
@@ -2886,12 +2755,17 @@ const imageDprUrl = (asset, options) => {
2886
2755
  object-fit: contain;
2887
2756
 
2888
2757
  ${(props) => props.$showCheckerboard && styledComponents.css`
2889
- background-image: linear-gradient(45deg, var(--checkerboard-color) 25%, transparent 25%),
2758
+ background-image:
2759
+ linear-gradient(45deg, var(--checkerboard-color) 25%, transparent 25%),
2890
2760
  linear-gradient(-45deg, var(--checkerboard-color) 25%, transparent 25%),
2891
2761
  linear-gradient(45deg, transparent 75%, var(--checkerboard-color) 75%),
2892
2762
  linear-gradient(-45deg, transparent 75%, var(--checkerboard-color) 75%);
2893
2763
  background-size: 20px 20px;
2894
- background-position: 0 0, 0 10px, 10px -10px, -10px 0;
2764
+ background-position:
2765
+ 0 0,
2766
+ 0 10px,
2767
+ 10px -10px,
2768
+ -10px 0;
2895
2769
  `}
2896
2770
  `, { radius: themeRadius, space: themeSpace } = ui.studioTheme, reactSelectStyles = (scheme) => ({
2897
2771
  control: (styles, { isFocused }) => {
@@ -3325,7 +3199,7 @@ const DialogAssetEdit = (props) => {
3325
3199
  } = reactHookForm.useForm({
3326
3200
  defaultValues: generateDefaultValues(assetItem?.asset),
3327
3201
  mode: "onChange",
3328
- resolver: zod.zodResolver(getAssetFormSchema(locales))
3202
+ resolver: zodFormResolver(getAssetFormSchema(locales))
3329
3203
  }), formUpdating = !assetItem || assetItem?.updating, handleClose = react.useCallback(() => {
3330
3204
  dispatch(dialogActions.remove({ id }));
3331
3205
  }, [dispatch, id]), handleDelete = react.useCallback(() => {
@@ -3643,7 +3517,7 @@ const DialogAssetEdit = (props) => {
3643
3517
  name: ""
3644
3518
  },
3645
3519
  mode: "onChange",
3646
- resolver: zod.zodResolver(tagFormSchema)
3520
+ resolver: zodFormResolver(tagFormSchema)
3647
3521
  }), formUpdating = creating, handleClose = () => {
3648
3522
  dispatch(dialogActions.clear());
3649
3523
  }, onSubmit = (formData) => {
@@ -3693,7 +3567,7 @@ const DialogAssetEdit = (props) => {
3693
3567
  } = reactHookForm.useForm({
3694
3568
  defaultValues: generateDefaultValues(tagItem?.tag),
3695
3569
  mode: "onChange",
3696
- resolver: zod.zodResolver(tagFormSchema)
3570
+ resolver: zodFormResolver(tagFormSchema)
3697
3571
  }), formUpdating = !tagItem || tagItem?.updating, handleClose = () => {
3698
3572
  dispatch(dialogActions.remove({ id }));
3699
3573
  }, onSubmit = (formData) => {
@@ -4139,38 +4013,40 @@ const DialogAssetEdit = (props) => {
4139
4013
  overflow: hidden;
4140
4014
  position: relative;
4141
4015
  width: 100%;
4142
- `, CardContainer = styledComponents.styled(ui.Flex)(
4143
- ({ $picked, theme, $updating }) => styledComponents.css`
4144
- border: 1px solid transparent;
4145
- height: 100%;
4146
- pointer-events: ${$updating ? "none" : "auto"};
4147
- position: relative;
4148
- transition: all 300ms;
4149
- user-select: none;
4150
- width: 100%;
4016
+ `, CardContainer = styledComponents.styled(ui.Flex)(({
4017
+ $picked,
4018
+ theme,
4019
+ $updating
4020
+ }) => styledComponents.css`
4021
+ border: 1px solid transparent;
4022
+ height: 100%;
4023
+ pointer-events: ${$updating ? "none" : "auto"};
4024
+ position: relative;
4025
+ transition: all 300ms;
4026
+ user-select: none;
4027
+ width: 100%;
4151
4028
 
4152
- border: ${$picked ? `1px solid ${theme.sanity.color.spot.orange} !important` : "1px solid inherit"};
4029
+ border: ${$picked ? `1px solid ${theme.sanity.color.spot.orange} !important` : "1px solid inherit"};
4153
4030
 
4154
- ${!$updating && styledComponents.css`
4155
- @media (hover: hover) and (pointer: fine) {
4156
- &:hover {
4157
- border: 1px solid var(--card-border-color);
4158
- }
4159
- }
4160
- `}
4161
- `
4162
- ), ContextActionContainer$2 = styledComponents.styled(ui.Flex)(
4163
- ({ $scheme }) => styledComponents.css`
4164
- cursor: pointer;
4165
- height: ${PANEL_HEIGHT}px;
4166
- transition: all 300ms;
4031
+ ${!$updating && styledComponents.css`
4167
4032
  @media (hover: hover) and (pointer: fine) {
4168
4033
  &:hover {
4169
- background: ${getSchemeColor($scheme, "bg")};
4034
+ border: 1px solid var(--card-border-color);
4170
4035
  }
4171
4036
  }
4172
- `
4173
- ), StyledWarningOutlineIcon = styledComponents.styled(icons.WarningFilledIcon)(({ theme }) => ({
4037
+ `}
4038
+ `), ContextActionContainer$2 = styledComponents.styled(ui.Flex)(({
4039
+ $scheme
4040
+ }) => styledComponents.css`
4041
+ cursor: pointer;
4042
+ height: ${PANEL_HEIGHT}px;
4043
+ transition: all 300ms;
4044
+ @media (hover: hover) and (pointer: fine) {
4045
+ &:hover {
4046
+ background: ${getSchemeColor($scheme, "bg")};
4047
+ }
4048
+ }
4049
+ `), StyledWarningOutlineIcon = styledComponents.styled(icons.WarningFilledIcon)(({ theme }) => ({
4174
4050
  color: theme.sanity.color.spot.red
4175
4051
  })), CardAsset$1 = (props) => {
4176
4052
  const { id, selected } = props, scheme = sanity.useColorSchemeValue(), shiftPressed = useKeyPress("shift"), dispatch = reactRedux.useDispatch(), lastPicked = useTypedSelector((state) => state.assets.lastPicked), item = useTypedSelector((state) => selectAssetById(state, id)), asset = item?.asset, error = item?.error, isOpaque = item?.asset?.metadata?.isOpaque, picked = item?.picked, updating = item?.updating, { onSelect } = useAssetSourceActions();
@@ -4729,16 +4605,16 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4729
4605
  ]
4730
4606
  }
4731
4607
  ) });
4732
- }, ContextActionContainer$1 = styledComponents.styled(ui.Flex)(
4733
- ({ $scheme }) => styledComponents.css`
4734
- cursor: pointer;
4735
- @media (hover: hover) and (pointer: fine) {
4736
- &:hover {
4737
- background: ${getSchemeColor($scheme, "bg")};
4738
- }
4608
+ }, ContextActionContainer$1 = styledComponents.styled(ui.Flex)(({
4609
+ $scheme
4610
+ }) => styledComponents.css`
4611
+ cursor: pointer;
4612
+ @media (hover: hover) and (pointer: fine) {
4613
+ &:hover {
4614
+ background: ${getSchemeColor($scheme, "bg")};
4739
4615
  }
4740
- `
4741
- ), TableHeader = () => {
4616
+ }
4617
+ `), TableHeader = () => {
4742
4618
  const scheme = sanity.useColorSchemeValue(), dispatch = reactRedux.useDispatch(), fetching = useTypedSelector((state) => state.assets.fetching), itemsLength = useTypedSelector(selectAssetsLength), numPickedAssets = useTypedSelector(selectAssetsPickedLength), mediaIndex = ui.useMediaIndex(), { onSelect } = useAssetSourceActions(), allSelected = numPickedAssets === itemsLength, handleContextActionClick = (e) => {
4743
4619
  e.stopPropagation(), dispatch(allSelected ? assetsActions.pickClear() : assetsActions.pickAll());
4744
4620
  };
@@ -4813,16 +4689,16 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4813
4689
  }
4814
4690
  }
4815
4691
  `}
4816
- `), ContextActionContainer = styledComponents.styled(ui.Flex)(
4817
- ({ $scheme }) => styledComponents.css`
4818
- cursor: pointer;
4819
- @media (hover: hover) and (pointer: fine) {
4820
- &:hover {
4821
- background: ${getSchemeColor($scheme, "bg2")};
4822
- }
4692
+ `), ContextActionContainer = styledComponents.styled(ui.Flex)(({
4693
+ $scheme
4694
+ }) => styledComponents.css`
4695
+ cursor: pointer;
4696
+ @media (hover: hover) and (pointer: fine) {
4697
+ &:hover {
4698
+ background: ${getSchemeColor($scheme, "bg2")};
4823
4699
  }
4824
- `
4825
- ), StyledWarningIcon = styledComponents.styled(icons.WarningFilledIcon)(({ theme }) => ({
4700
+ }
4701
+ `), StyledWarningIcon = styledComponents.styled(icons.WarningFilledIcon)(({ theme }) => ({
4826
4702
  color: theme.sanity.color.spot.red
4827
4703
  })), TableRowAsset$1 = (props) => {
4828
4704
  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(
@@ -5254,24 +5130,15 @@ const TableRowUpload = (props) => {
5254
5130
  ] })
5255
5131
  }
5256
5132
  );
5257
- }, initialState$1 = {
5258
- assets: [],
5259
- document: void 0,
5260
- documentAssetIds: []
5261
- }, selectedSlice = toolkit.createSlice({
5262
- name: "selected",
5263
- initialState: initialState$1,
5264
- reducers: {}
5265
- });
5266
- var selectedReducer = selectedSlice.reducer;
5133
+ };
5267
5134
  function messageFromGenericErrorPayload(payload) {
5268
5135
  return !payload || typeof payload != "object" ? "Unknown error" : "error" in payload && payload.error && typeof payload.error == "object" && payload.error !== null && "message" in payload.error ? String(payload.error.message) : "message" in payload && typeof payload.message == "string" ? String(payload.message) : "Unknown error";
5269
5136
  }
5270
- const initialState = {
5137
+ const initialState$1 = {
5271
5138
  items: []
5272
5139
  }, notificationsSlice = toolkit.createSlice({
5273
5140
  name: "notifications",
5274
- initialState,
5141
+ initialState: initialState$1,
5275
5142
  reducers: {
5276
5143
  add(state, action) {
5277
5144
  const { asset, status, title } = action.payload;
@@ -5372,6 +5239,16 @@ const initialState = {
5372
5239
  operators$1.mergeMap(() => rxjs.of(notificationsSlice.actions.add({ status: "info", title: "Tag updated" })))
5373
5240
  ), notificationsActions = { ...notificationsSlice.actions };
5374
5241
  var notificationsReducer = notificationsSlice.reducer;
5242
+ const initialState = {
5243
+ assets: [],
5244
+ document: void 0,
5245
+ documentAssetIds: []
5246
+ }, selectedSlice = toolkit.createSlice({
5247
+ name: "selected",
5248
+ initialState,
5249
+ reducers: {}
5250
+ });
5251
+ var selectedReducer = selectedSlice.reducer;
5375
5252
  const rootEpic = reduxObservable.combineEpics(
5376
5253
  assetsDeleteEpic,
5377
5254
  assetsFetchEpic,
@@ -5777,7 +5654,6 @@ const plugin = {
5777
5654
  }, tool = {
5778
5655
  ...plugin,
5779
5656
  component: Tool,
5780
- // @ts-expect-error TS doesn't know about this internal field see https://github.com/sanity-io/sanity/pull/7980
5781
5657
  __internalApplicationType: "sanity/media"
5782
5658
  }, media = sanity.definePlugin((options) => ({
5783
5659
  name: "media",
@@ -5854,7 +5730,11 @@ function AutoTagInput(props) {
5854
5730
  }).catch((err) => {
5855
5731
  console.error("[sanity-plugin-media] Failed to apply auto-tags:", err);
5856
5732
  const label = mediaTags.length === 1 ? "tag" : "tags";
5857
- toast.push({ closable: !0, status: "error", title: `Failed to apply the media ${label} ${mediaTags.join(", ")}` });
5733
+ toast.push({
5734
+ closable: !0,
5735
+ status: "error",
5736
+ title: `Failed to apply the media ${label} ${mediaTags.join(", ")}`
5737
+ });
5858
5738
  });
5859
5739
  }, [currentAssetRef, mediaTags, client, createTagsOnUpload]), renderDefault(props);
5860
5740
  }