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.mjs CHANGED
@@ -1,8 +1,9 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { useClient, useColorSchemeValue, useSchema, Preview, useDocumentStore, WithReferringDocuments, useFormValue, definePlugin } from "sanity";
3
2
  import { ThLargeIcon, ThListIcon, SortIcon, CloseIcon, SelectIcon, AddIcon, SearchIcon, PlugIcon, ClipboardIcon, DownloadIcon, ChevronDownIcon, ErrorOutlineIcon, WarningOutlineIcon, EditIcon, ArrowUpIcon, ArrowDownIcon, TrashIcon, ComposeIcon, Icon, UploadIcon, WarningFilledIcon, CheckmarkCircleIcon, ChevronUpIcon, ImageIcon } from "@sanity/icons";
3
+ import { useClient, useColorSchemeValue, useSchema, Preview, useDocumentStore, WithReferringDocuments, useFormValue, definePlugin } from "sanity";
4
4
  import { Inline, Button, usePortal, MenuButton, Menu as Menu$2, MenuItem, MenuDivider, Box, studioTheme, rem, Flex, Label, Text, TextInput, Card, MenuGroup, useMediaIndex, Tooltip, Switch, Popover, Stack, Dialog as Dialog$1, TextArea, TabList, Tab, TabPanel, Container as Container$2, Spinner, Checkbox, Grid, useToast, PortalProvider, useLayer, Portal } from "@sanity/ui";
5
5
  import { useRef, useCallback, useEffect, createContext, useContext, useMemo, useState, forwardRef, memo, Component } from "react";
6
+ import { isHotkey } from "is-hotkey-esm";
6
7
  import { css, createGlobalStyle, styled } from "styled-components";
7
8
  import { useSelector, useDispatch, Provider } from "react-redux";
8
9
  import { createAction, createSlice, isAnyOf, createSelector, combineReducers, configureStore } from "@reduxjs/toolkit";
@@ -17,9 +18,9 @@ import { useNProgress } from "@tanem/react-nprogress";
17
18
  import { hues, white } from "@sanity/color";
18
19
  import Select, { components } from "react-select";
19
20
  import { Virtuoso, VirtuosoGrid, GroupedVirtuoso } from "react-virtuoso";
20
- import { zodResolver } from "@hookform/resolvers/zod";
21
21
  import { Controller, useForm } from "react-hook-form";
22
22
  import * as z from "zod";
23
+ import { zodResolver } from "@hookform/resolvers/zod";
23
24
  import { format, formatRelative } from "date-fns";
24
25
  import filesize from "filesize";
25
26
  import copy from "copy-to-clipboard";
@@ -27,143 +28,6 @@ import { useIntentLink } from "sanity/router";
27
28
  import { FileIcon as FileIcon$1, defaultStyles } from "react-file-icon";
28
29
  import CreatableSelect from "react-select/creatable";
29
30
  import { useDropzone } from "react-dropzone";
30
- function getDefaultExportFromCjs(x) {
31
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x.default : x;
32
- }
33
- var lib = {}, hasRequiredLib;
34
- function requireLib() {
35
- if (hasRequiredLib) return lib;
36
- hasRequiredLib = 1, Object.defineProperty(lib, "__esModule", {
37
- value: !0
38
- });
39
- for (var IS_MAC = typeof window < "u" && /Mac|iPod|iPhone|iPad/.test(window.navigator.platform), MODIFIERS = {
40
- alt: "altKey",
41
- control: "ctrlKey",
42
- meta: "metaKey",
43
- shift: "shiftKey"
44
- }, ALIASES = {
45
- add: "+",
46
- break: "pause",
47
- cmd: "meta",
48
- command: "meta",
49
- ctl: "control",
50
- ctrl: "control",
51
- del: "delete",
52
- down: "arrowdown",
53
- esc: "escape",
54
- ins: "insert",
55
- left: "arrowleft",
56
- mod: IS_MAC ? "meta" : "control",
57
- opt: "alt",
58
- option: "alt",
59
- return: "enter",
60
- right: "arrowright",
61
- space: " ",
62
- spacebar: " ",
63
- up: "arrowup",
64
- win: "meta",
65
- windows: "meta"
66
- }, CODES = {
67
- backspace: 8,
68
- tab: 9,
69
- enter: 13,
70
- shift: 16,
71
- control: 17,
72
- alt: 18,
73
- pause: 19,
74
- capslock: 20,
75
- escape: 27,
76
- " ": 32,
77
- pageup: 33,
78
- pagedown: 34,
79
- end: 35,
80
- home: 36,
81
- arrowleft: 37,
82
- arrowup: 38,
83
- arrowright: 39,
84
- arrowdown: 40,
85
- insert: 45,
86
- delete: 46,
87
- meta: 91,
88
- numlock: 144,
89
- scrolllock: 145,
90
- ";": 186,
91
- "=": 187,
92
- ",": 188,
93
- "-": 189,
94
- ".": 190,
95
- "/": 191,
96
- "`": 192,
97
- "[": 219,
98
- "\\": 220,
99
- "]": 221,
100
- "'": 222
101
- }, f = 1; f < 20; f++)
102
- CODES["f" + f] = 111 + f;
103
- function isHotkey2(hotkey, options, event) {
104
- options && !("byKey" in options) && (event = options, options = null), Array.isArray(hotkey) || (hotkey = [hotkey]);
105
- var array = hotkey.map(function(string) {
106
- return parseHotkey(string, options);
107
- }), check = function(e) {
108
- return array.some(function(object) {
109
- return compareHotkey(object, e);
110
- });
111
- }, ret = event == null ? check : check(event);
112
- return ret;
113
- }
114
- function isCodeHotkey(hotkey, event) {
115
- return isHotkey2(hotkey, event);
116
- }
117
- function isKeyHotkey(hotkey, event) {
118
- return isHotkey2(hotkey, { byKey: !0 }, event);
119
- }
120
- function parseHotkey(hotkey, options) {
121
- var byKey = options && options.byKey, ret = {};
122
- hotkey = hotkey.replace("++", "+add");
123
- var values = hotkey.split("+"), length = values.length;
124
- for (var k in MODIFIERS)
125
- ret[MODIFIERS[k]] = !1;
126
- var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
127
- try {
128
- for (var _iterator = values[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
129
- var value = _step.value, optional = value.endsWith("?") && value.length > 1;
130
- optional && (value = value.slice(0, -1));
131
- var name = toKeyName(value), modifier = MODIFIERS[name];
132
- if (value.length > 1 && !modifier && !ALIASES[value] && !CODES[name])
133
- throw new TypeError('Unknown modifier: "' + value + '"');
134
- (length === 1 || !modifier) && (byKey ? ret.key = name : ret.which = toKeyCode(value)), modifier && (ret[modifier] = optional ? null : !0);
135
- }
136
- } catch (err) {
137
- _didIteratorError = !0, _iteratorError = err;
138
- } finally {
139
- try {
140
- !_iteratorNormalCompletion && _iterator.return && _iterator.return();
141
- } finally {
142
- if (_didIteratorError)
143
- throw _iteratorError;
144
- }
145
- }
146
- return ret;
147
- }
148
- function compareHotkey(object, event) {
149
- for (var key in object) {
150
- var expected = object[key], actual = void 0;
151
- 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))
152
- return !1;
153
- }
154
- return !0;
155
- }
156
- function toKeyCode(name) {
157
- name = toKeyName(name);
158
- var code = CODES[name] || name.toUpperCase().charCodeAt(0);
159
- return code;
160
- }
161
- function toKeyName(name) {
162
- return name = name.toLowerCase(), name = ALIASES[name] || name, name;
163
- }
164
- 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;
165
- }
166
- var libExports = requireLib(), isHotkey = /* @__PURE__ */ getDefaultExportFromCjs(libExports);
167
31
  const useKeyPress = (hotkey, onPress) => {
168
32
  const keyPressed = useRef(!1), downHandler = useCallback(
169
33
  (e) => {
@@ -2708,7 +2572,13 @@ const imageDprUrl = (asset, options) => {
2708
2572
  }, sanitizeFormData = (formData) => Object.keys(formData).reduce((acc, key) => {
2709
2573
  const val = formData[key];
2710
2574
  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;
2711
- }, {}), 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 }) => {
2575
+ }, {}), isFileAsset = (asset) => asset._type === "sanity.fileAsset", isImageAsset = (asset) => asset._type === "sanity.imageAsset";
2576
+ function zodFormResolver(schema) {
2577
+ return zodResolver(
2578
+ schema
2579
+ );
2580
+ }
2581
+ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asset.metadata.dimensions.height}px`, ButtonAssetCopy = ({ disabled, url }) => {
2712
2582
  const popoverProps = usePortalPopoverProps(), refPopoverTimeout = useRef(null), [popoverVisible, setPopoverVisible] = useState(!1), handleClick = () => {
2713
2583
  refPopoverTimeout.current && clearTimeout(refPopoverTimeout.current), setPopoverVisible(!0), copy(url), refPopoverTimeout.current = setTimeout(() => {
2714
2584
  setPopoverVisible(!1);
@@ -2893,12 +2763,17 @@ const imageDprUrl = (asset, options) => {
2893
2763
  object-fit: contain;
2894
2764
 
2895
2765
  ${(props) => props.$showCheckerboard && css`
2896
- background-image: linear-gradient(45deg, var(--checkerboard-color) 25%, transparent 25%),
2766
+ background-image:
2767
+ linear-gradient(45deg, var(--checkerboard-color) 25%, transparent 25%),
2897
2768
  linear-gradient(-45deg, var(--checkerboard-color) 25%, transparent 25%),
2898
2769
  linear-gradient(45deg, transparent 75%, var(--checkerboard-color) 75%),
2899
2770
  linear-gradient(-45deg, transparent 75%, var(--checkerboard-color) 75%);
2900
2771
  background-size: 20px 20px;
2901
- background-position: 0 0, 0 10px, 10px -10px, -10px 0;
2772
+ background-position:
2773
+ 0 0,
2774
+ 0 10px,
2775
+ 10px -10px,
2776
+ -10px 0;
2902
2777
  `}
2903
2778
  `, { radius: themeRadius, space: themeSpace } = studioTheme, reactSelectStyles = (scheme) => ({
2904
2779
  control: (styles, { isFocused }) => {
@@ -3332,7 +3207,7 @@ const DialogAssetEdit = (props) => {
3332
3207
  } = useForm({
3333
3208
  defaultValues: generateDefaultValues(assetItem?.asset),
3334
3209
  mode: "onChange",
3335
- resolver: zodResolver(getAssetFormSchema(locales))
3210
+ resolver: zodFormResolver(getAssetFormSchema(locales))
3336
3211
  }), formUpdating = !assetItem || assetItem?.updating, handleClose = useCallback(() => {
3337
3212
  dispatch(dialogActions.remove({ id }));
3338
3213
  }, [dispatch, id]), handleDelete = useCallback(() => {
@@ -3650,7 +3525,7 @@ const DialogAssetEdit = (props) => {
3650
3525
  name: ""
3651
3526
  },
3652
3527
  mode: "onChange",
3653
- resolver: zodResolver(tagFormSchema)
3528
+ resolver: zodFormResolver(tagFormSchema)
3654
3529
  }), formUpdating = creating, handleClose = () => {
3655
3530
  dispatch(dialogActions.clear());
3656
3531
  }, onSubmit = (formData) => {
@@ -3700,7 +3575,7 @@ const DialogAssetEdit = (props) => {
3700
3575
  } = useForm({
3701
3576
  defaultValues: generateDefaultValues(tagItem?.tag),
3702
3577
  mode: "onChange",
3703
- resolver: zodResolver(tagFormSchema)
3578
+ resolver: zodFormResolver(tagFormSchema)
3704
3579
  }), formUpdating = !tagItem || tagItem?.updating, handleClose = () => {
3705
3580
  dispatch(dialogActions.remove({ id }));
3706
3581
  }, onSubmit = (formData) => {
@@ -4144,38 +4019,40 @@ const DialogAssetEdit = (props) => {
4144
4019
  overflow: hidden;
4145
4020
  position: relative;
4146
4021
  width: 100%;
4147
- `, CardContainer = styled(Flex)(
4148
- ({ $picked, theme, $updating }) => css`
4149
- border: 1px solid transparent;
4150
- height: 100%;
4151
- pointer-events: ${$updating ? "none" : "auto"};
4152
- position: relative;
4153
- transition: all 300ms;
4154
- user-select: none;
4155
- width: 100%;
4022
+ `, CardContainer = styled(Flex)(({
4023
+ $picked,
4024
+ theme,
4025
+ $updating
4026
+ }) => css`
4027
+ border: 1px solid transparent;
4028
+ height: 100%;
4029
+ pointer-events: ${$updating ? "none" : "auto"};
4030
+ position: relative;
4031
+ transition: all 300ms;
4032
+ user-select: none;
4033
+ width: 100%;
4156
4034
 
4157
- border: ${$picked ? `1px solid ${theme.sanity.color.spot.orange} !important` : "1px solid inherit"};
4035
+ border: ${$picked ? `1px solid ${theme.sanity.color.spot.orange} !important` : "1px solid inherit"};
4158
4036
 
4159
- ${!$updating && css`
4160
- @media (hover: hover) and (pointer: fine) {
4161
- &:hover {
4162
- border: 1px solid var(--card-border-color);
4163
- }
4164
- }
4165
- `}
4166
- `
4167
- ), ContextActionContainer$2 = styled(Flex)(
4168
- ({ $scheme }) => css`
4169
- cursor: pointer;
4170
- height: ${PANEL_HEIGHT}px;
4171
- transition: all 300ms;
4037
+ ${!$updating && css`
4172
4038
  @media (hover: hover) and (pointer: fine) {
4173
4039
  &:hover {
4174
- background: ${getSchemeColor($scheme, "bg")};
4040
+ border: 1px solid var(--card-border-color);
4175
4041
  }
4176
4042
  }
4177
- `
4178
- ), StyledWarningOutlineIcon = styled(WarningFilledIcon)(({ theme }) => ({
4043
+ `}
4044
+ `), ContextActionContainer$2 = styled(Flex)(({
4045
+ $scheme
4046
+ }) => css`
4047
+ cursor: pointer;
4048
+ height: ${PANEL_HEIGHT}px;
4049
+ transition: all 300ms;
4050
+ @media (hover: hover) and (pointer: fine) {
4051
+ &:hover {
4052
+ background: ${getSchemeColor($scheme, "bg")};
4053
+ }
4054
+ }
4055
+ `), StyledWarningOutlineIcon = styled(WarningFilledIcon)(({ theme }) => ({
4179
4056
  color: theme.sanity.color.spot.red
4180
4057
  })), CardAsset$1 = (props) => {
4181
4058
  const { id, selected } = props, scheme = useColorSchemeValue(), shiftPressed = useKeyPress("shift"), dispatch = 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();
@@ -4734,16 +4611,16 @@ const CardWrapper = styled(Flex)`
4734
4611
  ]
4735
4612
  }
4736
4613
  ) });
4737
- }, ContextActionContainer$1 = styled(Flex)(
4738
- ({ $scheme }) => css`
4739
- cursor: pointer;
4740
- @media (hover: hover) and (pointer: fine) {
4741
- &:hover {
4742
- background: ${getSchemeColor($scheme, "bg")};
4743
- }
4614
+ }, ContextActionContainer$1 = styled(Flex)(({
4615
+ $scheme
4616
+ }) => css`
4617
+ cursor: pointer;
4618
+ @media (hover: hover) and (pointer: fine) {
4619
+ &:hover {
4620
+ background: ${getSchemeColor($scheme, "bg")};
4744
4621
  }
4745
- `
4746
- ), TableHeader = () => {
4622
+ }
4623
+ `), TableHeader = () => {
4747
4624
  const scheme = useColorSchemeValue(), dispatch = useDispatch(), fetching = useTypedSelector((state) => state.assets.fetching), itemsLength = useTypedSelector(selectAssetsLength), numPickedAssets = useTypedSelector(selectAssetsPickedLength), mediaIndex = useMediaIndex(), { onSelect } = useAssetSourceActions(), allSelected = numPickedAssets === itemsLength, handleContextActionClick = (e) => {
4748
4625
  e.stopPropagation(), dispatch(allSelected ? assetsActions.pickClear() : assetsActions.pickAll());
4749
4626
  };
@@ -4818,16 +4695,16 @@ const CardWrapper = styled(Flex)`
4818
4695
  }
4819
4696
  }
4820
4697
  `}
4821
- `), ContextActionContainer = styled(Flex)(
4822
- ({ $scheme }) => css`
4823
- cursor: pointer;
4824
- @media (hover: hover) and (pointer: fine) {
4825
- &:hover {
4826
- background: ${getSchemeColor($scheme, "bg2")};
4827
- }
4698
+ `), ContextActionContainer = styled(Flex)(({
4699
+ $scheme
4700
+ }) => css`
4701
+ cursor: pointer;
4702
+ @media (hover: hover) and (pointer: fine) {
4703
+ &:hover {
4704
+ background: ${getSchemeColor($scheme, "bg2")};
4828
4705
  }
4829
- `
4830
- ), StyledWarningIcon = styled(WarningFilledIcon)(({ theme }) => ({
4706
+ }
4707
+ `), StyledWarningIcon = styled(WarningFilledIcon)(({ theme }) => ({
4831
4708
  color: theme.sanity.color.spot.red
4832
4709
  })), TableRowAsset$1 = (props) => {
4833
4710
  const { id, selected } = props, scheme = useColorSchemeValue(), shiftPressed = useKeyPress("shift"), [referenceCountVisible, setReferenceCountVisible] = useState(!1), refCountVisibleTimeout = useRef(null), dispatch = useDispatch(), lastPicked = useTypedSelector((state) => state.assets.lastPicked), item = useTypedSelector((state) => selectAssetById(state, id)), mediaIndex = useMediaIndex(), asset = item?.asset, error = item?.error, isOpaque = item?.asset?.metadata?.isOpaque, picked = item?.picked, updating = item?.updating, { onSelect } = useAssetSourceActions(), handleContextActionClick = useCallback(
@@ -5259,24 +5136,15 @@ const TableRowUpload = (props) => {
5259
5136
  ] })
5260
5137
  }
5261
5138
  );
5262
- }, initialState$1 = {
5263
- assets: [],
5264
- document: void 0,
5265
- documentAssetIds: []
5266
- }, selectedSlice = createSlice({
5267
- name: "selected",
5268
- initialState: initialState$1,
5269
- reducers: {}
5270
- });
5271
- var selectedReducer = selectedSlice.reducer;
5139
+ };
5272
5140
  function messageFromGenericErrorPayload(payload) {
5273
5141
  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";
5274
5142
  }
5275
- const initialState = {
5143
+ const initialState$1 = {
5276
5144
  items: []
5277
5145
  }, notificationsSlice = createSlice({
5278
5146
  name: "notifications",
5279
- initialState,
5147
+ initialState: initialState$1,
5280
5148
  reducers: {
5281
5149
  add(state, action) {
5282
5150
  const { asset, status, title } = action.payload;
@@ -5377,6 +5245,16 @@ const initialState = {
5377
5245
  mergeMap(() => of(notificationsSlice.actions.add({ status: "info", title: "Tag updated" })))
5378
5246
  ), notificationsActions = { ...notificationsSlice.actions };
5379
5247
  var notificationsReducer = notificationsSlice.reducer;
5248
+ const initialState = {
5249
+ assets: [],
5250
+ document: void 0,
5251
+ documentAssetIds: []
5252
+ }, selectedSlice = createSlice({
5253
+ name: "selected",
5254
+ initialState,
5255
+ reducers: {}
5256
+ });
5257
+ var selectedReducer = selectedSlice.reducer;
5380
5258
  const rootEpic = combineEpics(
5381
5259
  assetsDeleteEpic,
5382
5260
  assetsFetchEpic,
@@ -5782,7 +5660,6 @@ const plugin = {
5782
5660
  }, tool = {
5783
5661
  ...plugin,
5784
5662
  component: Tool,
5785
- // @ts-expect-error TS doesn't know about this internal field see https://github.com/sanity-io/sanity/pull/7980
5786
5663
  __internalApplicationType: "sanity/media"
5787
5664
  }, media = definePlugin((options) => ({
5788
5665
  name: "media",
@@ -5859,7 +5736,11 @@ function AutoTagInput(props) {
5859
5736
  }).catch((err) => {
5860
5737
  console.error("[sanity-plugin-media] Failed to apply auto-tags:", err);
5861
5738
  const label = mediaTags.length === 1 ? "tag" : "tags";
5862
- toast.push({ closable: !0, status: "error", title: `Failed to apply the media ${label} ${mediaTags.join(", ")}` });
5739
+ toast.push({
5740
+ closable: !0,
5741
+ status: "error",
5742
+ title: `Failed to apply the media ${label} ${mediaTags.join(", ")}`
5743
+ });
5863
5744
  });
5864
5745
  }, [currentAssetRef, mediaTags, client, createTagsOnUpload]), renderDefault(props);
5865
5746
  }