sanity-plugin-media 2.4.2 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.js +438 -285
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +457 -305
- package/dist/index.mjs.map +1 -1
- package/package.json +39 -33
- package/src/components/AssetGridVirtualized/index.tsx +13 -3
- package/src/components/Browser/index.tsx +30 -41
- package/src/components/ButtonAssetCopy/index.tsx +1 -1
- package/src/components/ButtonViewGroup/index.tsx +0 -1
- package/src/components/CardAsset/index.tsx +13 -14
- package/src/components/CardUpload/index.tsx +1 -1
- package/src/components/Controls/index.tsx +0 -1
- package/src/components/DebugControls/index.tsx +1 -0
- package/src/components/DialogAssetEdit/index.tsx +10 -3
- package/src/components/DialogConfirm/index.tsx +8 -1
- package/src/components/DialogSearchFacets/index.tsx +1 -1
- package/src/components/DialogTagCreate/index.tsx +1 -1
- package/src/components/DialogTagEdit/index.tsx +1 -1
- package/src/components/DialogTags/index.tsx +1 -1
- package/src/components/Dialogs/index.tsx +1 -1
- package/src/components/DocumentList/index.tsx +1 -1
- package/src/components/FileAssetPreview/index.tsx +1 -1
- package/src/components/FormFieldInputLabel/index.tsx +2 -1
- package/src/components/FormSubmitButton/index.tsx +1 -0
- package/src/components/Header/index.tsx +1 -1
- package/src/components/Image/index.tsx +4 -4
- package/src/components/OrderSelect/index.tsx +0 -1
- package/src/components/Progress/index.tsx +0 -1
- package/src/components/ReduxProvider/index.tsx +0 -1
- package/src/components/SearchFacet/index.tsx +4 -9
- package/src/components/SearchFacetNumber/index.tsx +1 -1
- package/src/components/SearchFacetSelect/index.tsx +1 -1
- package/src/components/SearchFacetTags/index.tsx +1 -1
- package/src/components/SearchFacets/index.tsx +1 -1
- package/src/components/SearchFacetsControl/index.tsx +1 -1
- package/src/components/TableHeader/index.tsx +4 -6
- package/src/components/TableHeaderItem/index.tsx +1 -1
- package/src/components/TableRowAsset/index.tsx +38 -46
- package/src/components/TableRowUpload/index.tsx +6 -1
- package/src/components/Tag/index.tsx +1 -0
- package/src/components/TagIcon/index.tsx +0 -2
- package/src/components/TagView/index.tsx +1 -1
- package/src/components/TagsPanel/index.tsx +1 -1
- package/src/components/Tool/index.tsx +1 -1
- package/src/hooks/usePortalPopoverProps.ts +1 -0
- package/src/plugin.tsx +0 -1
- package/src/styled/react-select/creatable.tsx +0 -9
- package/src/styled/react-select/single.tsx +0 -8
|
@@ -105,7 +105,7 @@ const SearchFacetTags = ({facet}: Props) => {
|
|
|
105
105
|
isSearchable
|
|
106
106
|
name="tags"
|
|
107
107
|
noOptionsMessage={() => 'No tags'}
|
|
108
|
-
onChange={value => handleChange(value as TagSelectOption)}
|
|
108
|
+
onChange={(value: any) => handleChange(value as TagSelectOption)}
|
|
109
109
|
options={allTagOptions}
|
|
110
110
|
placeholder={tagsFetching ? 'Loading...' : 'Select...'}
|
|
111
111
|
styles={reactSelectStyles(scheme)}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {AddIcon} from '@sanity/icons'
|
|
2
2
|
import {Button, Flex, Menu, MenuButton, MenuDivider, MenuGroup, MenuItem} from '@sanity/ui'
|
|
3
3
|
import type {SearchFacetDivider, SearchFacetGroup, SearchFacetInputProps} from '../../types'
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
import {useDispatch} from 'react-redux'
|
|
6
6
|
import {FACETS} from '../../constants'
|
|
7
7
|
import {usePortalPopoverProps} from '../../hooks/usePortalPopoverProps'
|
|
@@ -11,14 +11,13 @@ import {useColorSchemeValue} from 'sanity'
|
|
|
11
11
|
import {getSchemeColor} from '../../utils/getSchemeColor'
|
|
12
12
|
|
|
13
13
|
// TODO: DRY
|
|
14
|
-
const ContextActionContainer = styled(Flex)(
|
|
15
|
-
|
|
16
|
-
({scheme}: {scheme: ThemeColorSchemeKey}) => {
|
|
14
|
+
const ContextActionContainer = styled<typeof Flex, {$scheme: ThemeColorSchemeKey}>(Flex)(
|
|
15
|
+
({$scheme}) => {
|
|
17
16
|
return css`
|
|
18
17
|
cursor: pointer;
|
|
19
18
|
@media (hover: hover) and (pointer: fine) {
|
|
20
19
|
&:hover {
|
|
21
|
-
background: ${getSchemeColor(scheme, 'bg')};
|
|
20
|
+
background: ${getSchemeColor($scheme, 'bg')};
|
|
22
21
|
}
|
|
23
22
|
}
|
|
24
23
|
`
|
|
@@ -78,8 +77,7 @@ const TableHeader = () => {
|
|
|
78
77
|
align="center"
|
|
79
78
|
justify="center"
|
|
80
79
|
onClick={handleContextActionClick}
|
|
81
|
-
|
|
82
|
-
scheme={scheme}
|
|
80
|
+
$scheme={scheme}
|
|
83
81
|
style={{
|
|
84
82
|
height: '100%',
|
|
85
83
|
position: 'relative'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {ChevronDownIcon, ChevronUpIcon} from '@sanity/icons'
|
|
2
2
|
import {Box, Label} from '@sanity/ui'
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import {useDispatch} from 'react-redux'
|
|
5
5
|
import useTypedSelector from '../../hooks/useTypedSelector'
|
|
6
6
|
import {assetsActions} from '../../modules/assets'
|
|
@@ -47,49 +47,42 @@ type Props = {
|
|
|
47
47
|
selected: boolean
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
const ContainerGrid = styled
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
50
|
+
const ContainerGrid = styled<
|
|
51
|
+
typeof Grid,
|
|
52
|
+
{$selected?: boolean; $scheme: ThemeColorSchemeKey; $updating?: boolean}
|
|
53
|
+
>(Grid)(({$scheme, $selected, $updating}) => {
|
|
54
|
+
return css`
|
|
55
|
+
align-items: center;
|
|
56
|
+
cursor: ${$selected ? 'default' : 'pointer'};
|
|
57
|
+
height: 100%;
|
|
58
|
+
pointer-events: ${$updating ? 'none' : 'auto'};
|
|
59
|
+
user-select: none;
|
|
60
|
+
white-space: nowrap;
|
|
61
|
+
|
|
62
|
+
${!$updating &&
|
|
63
|
+
css`
|
|
64
|
+
@media (hover: hover) and (pointer: fine) {
|
|
65
|
+
&:hover {
|
|
66
|
+
background: ${getSchemeColor($scheme, 'bg')};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
`}
|
|
70
|
+
`
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
const ContextActionContainer = styled<typeof Flex, {$scheme: ThemeColorSchemeKey}>(Flex)(
|
|
74
|
+
({$scheme}) => {
|
|
61
75
|
return css`
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
user-select: none;
|
|
67
|
-
white-space: nowrap;
|
|
68
|
-
|
|
69
|
-
${!updating &&
|
|
70
|
-
css`
|
|
71
|
-
@media (hover: hover) and (pointer: fine) {
|
|
72
|
-
&:hover {
|
|
73
|
-
background: ${getSchemeColor(scheme, 'bg')};
|
|
74
|
-
}
|
|
76
|
+
cursor: pointer;
|
|
77
|
+
@media (hover: hover) and (pointer: fine) {
|
|
78
|
+
&:hover {
|
|
79
|
+
background: ${getSchemeColor($scheme, 'bg2')};
|
|
75
80
|
}
|
|
76
|
-
|
|
81
|
+
}
|
|
77
82
|
`
|
|
78
83
|
}
|
|
79
84
|
)
|
|
80
85
|
|
|
81
|
-
// @ts-expect-error - fix typings later
|
|
82
|
-
const ContextActionContainer = styled(Flex)(({scheme}: {scheme: ThemeColorSchemeKey}) => {
|
|
83
|
-
return css`
|
|
84
|
-
cursor: pointer;
|
|
85
|
-
@media (hover: hover) and (pointer: fine) {
|
|
86
|
-
&:hover {
|
|
87
|
-
background: ${getSchemeColor(scheme, 'bg2')};
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
`
|
|
91
|
-
})
|
|
92
|
-
|
|
93
86
|
const StyledWarningIcon = styled(WarningFilledIcon)(({theme}) => {
|
|
94
87
|
return {
|
|
95
88
|
color: theme.sanity.color.spot.red
|
|
@@ -105,7 +98,7 @@ const TableRowAsset = (props: Props) => {
|
|
|
105
98
|
const shiftPressed: RefObject<boolean> = useKeyPress('shift')
|
|
106
99
|
|
|
107
100
|
const [referenceCountVisible, setReferenceCountVisible] = useState(false)
|
|
108
|
-
const refCountVisibleTimeout = useRef<ReturnType<typeof window.setTimeout>>()
|
|
101
|
+
const refCountVisibleTimeout = useRef<ReturnType<typeof window.setTimeout>>(null)
|
|
109
102
|
|
|
110
103
|
const dispatch = useDispatch()
|
|
111
104
|
const lastPicked = useTypedSelector(state => state.assets.lastPicked)
|
|
@@ -181,9 +174,8 @@ const TableRowAsset = (props: Props) => {
|
|
|
181
174
|
return (
|
|
182
175
|
<ContainerGrid
|
|
183
176
|
onClick={selected ? undefined : handleClick}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
selected={selected}
|
|
177
|
+
$scheme={scheme}
|
|
178
|
+
$selected={selected}
|
|
187
179
|
style={{
|
|
188
180
|
gridColumnGap: mediaIndex < 3 ? 0 : '16px',
|
|
189
181
|
gridRowGap: 0,
|
|
@@ -191,13 +183,12 @@ const TableRowAsset = (props: Props) => {
|
|
|
191
183
|
mediaIndex < 3 ? GRID_TEMPLATE_COLUMNS.SMALL : GRID_TEMPLATE_COLUMNS.LARGE,
|
|
192
184
|
gridTemplateRows: mediaIndex < 3 ? 'auto' : '1fr'
|
|
193
185
|
}}
|
|
194
|
-
updating={item.updating}
|
|
186
|
+
$updating={item.updating}
|
|
195
187
|
>
|
|
196
188
|
{/* Picked checkbox */}
|
|
197
189
|
<ContextActionContainer
|
|
198
190
|
onClick={handleContextActionClick}
|
|
199
|
-
|
|
200
|
-
scheme={scheme}
|
|
191
|
+
$scheme={scheme}
|
|
201
192
|
style={{
|
|
202
193
|
alignItems: 'center',
|
|
203
194
|
gridColumn: 1,
|
|
@@ -247,8 +238,8 @@ const TableRowAsset = (props: Props) => {
|
|
|
247
238
|
{isImageAsset(asset) && (
|
|
248
239
|
<Image
|
|
249
240
|
draggable={false}
|
|
250
|
-
scheme={scheme}
|
|
251
|
-
showCheckerboard={!isOpaque}
|
|
241
|
+
$scheme={scheme}
|
|
242
|
+
$showCheckerboard={!isOpaque}
|
|
252
243
|
src={imageDprUrl(asset, {height: 100, width: 100})}
|
|
253
244
|
/>
|
|
254
245
|
)}
|
|
@@ -405,6 +396,7 @@ const TableRowAsset = (props: Props) => {
|
|
|
405
396
|
{error && (
|
|
406
397
|
<Box padding={2}>
|
|
407
398
|
<Tooltip
|
|
399
|
+
animate
|
|
408
400
|
content={
|
|
409
401
|
<Container padding={2} width={0}>
|
|
410
402
|
<Text size={1}>{error}</Text>
|
|
@@ -93,7 +93,12 @@ const TableRowUpload = (props: Props) => {
|
|
|
93
93
|
>
|
|
94
94
|
<Box style={{height: '100%', position: 'relative'}}>
|
|
95
95
|
{item.assetType === 'image' && item?.objectUrl && (
|
|
96
|
-
<Image
|
|
96
|
+
<Image
|
|
97
|
+
draggable={false}
|
|
98
|
+
$scheme={scheme}
|
|
99
|
+
src={item.objectUrl}
|
|
100
|
+
style={{opacity: 0.25}}
|
|
101
|
+
/>
|
|
97
102
|
)}
|
|
98
103
|
|
|
99
104
|
{item.assetType === 'file' && (
|
package/src/plugin.tsx
CHANGED
|
@@ -8,7 +8,6 @@ const {radius: themeRadius, space: themeSpace} = studioTheme
|
|
|
8
8
|
|
|
9
9
|
export const reactSelectStyles = (scheme: ThemeColorSchemeKey): StylesConfig => {
|
|
10
10
|
return {
|
|
11
|
-
// @ts-expect-error - fix typings later
|
|
12
11
|
control: (styles, {isFocused}) => {
|
|
13
12
|
let boxShadow = `inset 0 0 0 1px var(--card-border-color)`
|
|
14
13
|
if (isFocused) {
|
|
@@ -34,12 +33,10 @@ export const reactSelectStyles = (scheme: ThemeColorSchemeKey): StylesConfig =>
|
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
35
|
},
|
|
37
|
-
// @ts-expect-error - fix typings later
|
|
38
36
|
indicatorsContainer: (styles, {isDisabled}) => ({
|
|
39
37
|
...styles,
|
|
40
38
|
opacity: isDisabled ? 0.25 : 1
|
|
41
39
|
}),
|
|
42
|
-
// @ts-expect-error - fix typings later
|
|
43
40
|
input: styles => ({
|
|
44
41
|
...styles,
|
|
45
42
|
color: 'var(--card-fg-color)',
|
|
@@ -49,7 +46,6 @@ export const reactSelectStyles = (scheme: ThemeColorSchemeKey): StylesConfig =>
|
|
|
49
46
|
menuList: styles => ({
|
|
50
47
|
...styles
|
|
51
48
|
}),
|
|
52
|
-
// @ts-expect-error - fix typings later
|
|
53
49
|
multiValue: (styles, {isDisabled}) => ({
|
|
54
50
|
...styles,
|
|
55
51
|
backgroundColor: getSchemeColor(scheme, 'mutedHoveredBg'),
|
|
@@ -61,7 +57,6 @@ export const reactSelectStyles = (scheme: ThemeColorSchemeKey): StylesConfig =>
|
|
|
61
57
|
fontSize: 'inherit',
|
|
62
58
|
padding: 0
|
|
63
59
|
}),
|
|
64
|
-
// @ts-expect-error - fix typings later
|
|
65
60
|
multiValueRemove: styles => ({
|
|
66
61
|
...styles,
|
|
67
62
|
borderTopLeftRadius: 0,
|
|
@@ -71,13 +66,11 @@ export const reactSelectStyles = (scheme: ThemeColorSchemeKey): StylesConfig =>
|
|
|
71
66
|
backgroundColor: getSchemeColor(scheme, 'mutedSelectedBg')
|
|
72
67
|
}
|
|
73
68
|
}),
|
|
74
|
-
// @ts-expect-error - fix typings later
|
|
75
69
|
noOptionsMessage: styles => ({
|
|
76
70
|
...styles,
|
|
77
71
|
fontFamily: studioTheme.fonts.text.family,
|
|
78
72
|
lineHeight: '1em'
|
|
79
73
|
}),
|
|
80
|
-
// @ts-expect-error - fix typings later
|
|
81
74
|
option: (styles, {isFocused}) => ({
|
|
82
75
|
...styles,
|
|
83
76
|
backgroundColor: isFocused ? getSchemeColor(scheme, 'spotBlue') : 'transparent',
|
|
@@ -89,12 +82,10 @@ export const reactSelectStyles = (scheme: ThemeColorSchemeKey): StylesConfig =>
|
|
|
89
82
|
color: getSchemeColor(scheme, 'bg')
|
|
90
83
|
}
|
|
91
84
|
}),
|
|
92
|
-
// @ts-expect-error - fix typings later
|
|
93
85
|
placeholder: styles => ({
|
|
94
86
|
...styles,
|
|
95
87
|
marginLeft: rem(themeSpace[2])
|
|
96
88
|
}),
|
|
97
|
-
// @ts-expect-error - fix typings later
|
|
98
89
|
valueContainer: styles => ({
|
|
99
90
|
...styles,
|
|
100
91
|
margin: 0,
|
|
@@ -14,7 +14,6 @@ const {
|
|
|
14
14
|
|
|
15
15
|
export const reactSelectStyles = (scheme: ThemeColorSchemeKey): StylesConfig => {
|
|
16
16
|
return {
|
|
17
|
-
// @ts-expect-error - fix typings later
|
|
18
17
|
control: (styles, {isDisabled, isFocused}) => {
|
|
19
18
|
let boxShadow = `inset 0 0 0 1px var(--card-border-color)`
|
|
20
19
|
if (isFocused) {
|
|
@@ -40,7 +39,6 @@ export const reactSelectStyles = (scheme: ThemeColorSchemeKey): StylesConfig =>
|
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
41
|
},
|
|
43
|
-
// @ts-expect-error - fix typings later
|
|
44
42
|
input: styles => ({
|
|
45
43
|
...styles,
|
|
46
44
|
color: 'var(--card-fg-color)',
|
|
@@ -48,19 +46,16 @@ export const reactSelectStyles = (scheme: ThemeColorSchemeKey): StylesConfig =>
|
|
|
48
46
|
fontSize: themeTextSizes[1].fontSize,
|
|
49
47
|
marginLeft: rem(themeSpace[2])
|
|
50
48
|
}),
|
|
51
|
-
// @ts-expect-error - fix typings later
|
|
52
49
|
menuList: styles => ({
|
|
53
50
|
...styles,
|
|
54
51
|
padding: 0
|
|
55
52
|
}),
|
|
56
|
-
// @ts-expect-error - fix typings later
|
|
57
53
|
noOptionsMessage: styles => ({
|
|
58
54
|
...styles,
|
|
59
55
|
fontFamily: studioTheme.fonts.text.family,
|
|
60
56
|
fontSize: themeTextSizes[1].fontSize,
|
|
61
57
|
lineHeight: '1em'
|
|
62
58
|
}),
|
|
63
|
-
// @ts-expect-error - fix typings later
|
|
64
59
|
option: (styles, {isFocused}) => ({
|
|
65
60
|
...styles,
|
|
66
61
|
backgroundColor: isFocused ? getSchemeColor(scheme, 'spotBlue') : 'transparent',
|
|
@@ -75,14 +70,12 @@ export const reactSelectStyles = (scheme: ThemeColorSchemeKey): StylesConfig =>
|
|
|
75
70
|
color: getSchemeColor(scheme, 'bg')
|
|
76
71
|
}
|
|
77
72
|
}),
|
|
78
|
-
// @ts-expect-error - fix typings later
|
|
79
73
|
placeholder: styles => ({
|
|
80
74
|
...styles,
|
|
81
75
|
fontSize: themeTextSizes[1].fontSize,
|
|
82
76
|
marginLeft: rem(themeSpace[2]),
|
|
83
77
|
paddingLeft: 0
|
|
84
78
|
}),
|
|
85
|
-
// @ts-expect-error - fix typings later
|
|
86
79
|
singleValue: styles => ({
|
|
87
80
|
...styles,
|
|
88
81
|
alignItems: 'center',
|
|
@@ -90,7 +83,6 @@ export const reactSelectStyles = (scheme: ThemeColorSchemeKey): StylesConfig =>
|
|
|
90
83
|
height: '100%',
|
|
91
84
|
marginLeft: rem(themeSpace[2])
|
|
92
85
|
}),
|
|
93
|
-
// @ts-expect-error - fix typings later
|
|
94
86
|
valueContainer: styles => ({
|
|
95
87
|
...styles,
|
|
96
88
|
margin: 0,
|