sanity-plugin-media 2.4.0 → 2.4.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 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +92 -61
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +66 -34
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
- package/src/components/AssetGridVirtualized/index.tsx +3 -2
- package/src/components/AssetMetadata/index.tsx +1 -1
- package/src/components/AssetTableVirtualized/index.tsx +1 -1
- package/src/components/Browser/index.tsx +1 -1
- package/src/components/CardAsset/index.tsx +16 -12
- package/src/components/CardUpload/index.tsx +1 -1
- package/src/components/DialogAssetEdit/index.tsx +1 -1
- package/src/components/DialogConfirm/index.tsx +1 -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/FileAssetPreview/index.tsx +1 -1
- package/src/components/FileIcon/index.tsx +1 -1
- package/src/components/FormFieldInputLabel/index.tsx +1 -1
- package/src/components/Image/index.tsx +1 -1
- package/src/components/SearchFacet/index.tsx +8 -3
- package/src/components/SearchFacetNumber/index.tsx +1 -1
- package/src/components/SearchFacetSelect/index.tsx +1 -1
- package/src/components/SearchFacetString/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 +14 -10
- package/src/components/TableRowAsset/index.tsx +5 -1
- package/src/components/Tag/index.tsx +2 -2
- package/src/components/TagsVirtualized/index.tsx +1 -1
- package/src/components/UploadDropzone/index.tsx +1 -1
- package/src/config/searchFacets.ts +1 -1
- package/src/constants.ts +1 -1
- package/src/contexts/ToolOptionsContext.tsx +1 -1
- package/src/index.ts +1 -1
- package/src/modules/assets/index.ts +1 -1
- package/src/modules/dialog/index.ts +1 -1
- package/src/modules/notifications/index.ts +1 -1
- package/src/modules/search/index.ts +1 -1
- package/src/modules/selectors.ts +1 -1
- package/src/modules/tags/index.ts +1 -1
- package/src/modules/uploads/index.ts +1 -1
- package/src/operators/checkTagName.ts +1 -1
- package/src/plugin.tsx +1 -1
- package/src/styled/react-select/creatable.tsx +9 -1
- package/src/styled/react-select/single.tsx +8 -1
- package/src/types/sanity-ui.d.ts +6 -0
- package/src/utils/blocksToText.ts +1 -1
- package/src/utils/constructFilter.ts +1 -1
- package/src/utils/getAssetResolution.ts +1 -1
- package/src/utils/getTagSelectOptions.ts +1 -1
- package/src/utils/imageDprUrl.ts +1 -1
- package/src/utils/typeGuards.ts +1 -1
- package/src/utils/uploadSanityAsset.ts +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {AddIcon, ChevronDownIcon, CloseIcon} from '@sanity/icons'
|
|
2
2
|
import {Box, Card, Flex, rem, studioTheme, Text, type ThemeColorSchemeKey} from '@sanity/ui'
|
|
3
|
-
import React from 'react'
|
|
4
3
|
import {components, type StylesConfig} from 'react-select'
|
|
5
4
|
import {Virtuoso} from 'react-virtuoso'
|
|
6
5
|
import {getSchemeColor} from '../../utils/getSchemeColor'
|
|
@@ -9,6 +8,7 @@ const {radius: themeRadius, space: themeSpace} = studioTheme
|
|
|
9
8
|
|
|
10
9
|
export const reactSelectStyles = (scheme: ThemeColorSchemeKey): StylesConfig => {
|
|
11
10
|
return {
|
|
11
|
+
// @ts-expect-error - fix typings later
|
|
12
12
|
control: (styles, {isFocused}) => {
|
|
13
13
|
let boxShadow = `inset 0 0 0 1px var(--card-border-color)`
|
|
14
14
|
if (isFocused) {
|
|
@@ -34,10 +34,12 @@ export const reactSelectStyles = (scheme: ThemeColorSchemeKey): StylesConfig =>
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
|
+
// @ts-expect-error - fix typings later
|
|
37
38
|
indicatorsContainer: (styles, {isDisabled}) => ({
|
|
38
39
|
...styles,
|
|
39
40
|
opacity: isDisabled ? 0.25 : 1
|
|
40
41
|
}),
|
|
42
|
+
// @ts-expect-error - fix typings later
|
|
41
43
|
input: styles => ({
|
|
42
44
|
...styles,
|
|
43
45
|
color: 'var(--card-fg-color)',
|
|
@@ -47,6 +49,7 @@ export const reactSelectStyles = (scheme: ThemeColorSchemeKey): StylesConfig =>
|
|
|
47
49
|
menuList: styles => ({
|
|
48
50
|
...styles
|
|
49
51
|
}),
|
|
52
|
+
// @ts-expect-error - fix typings later
|
|
50
53
|
multiValue: (styles, {isDisabled}) => ({
|
|
51
54
|
...styles,
|
|
52
55
|
backgroundColor: getSchemeColor(scheme, 'mutedHoveredBg'),
|
|
@@ -58,6 +61,7 @@ export const reactSelectStyles = (scheme: ThemeColorSchemeKey): StylesConfig =>
|
|
|
58
61
|
fontSize: 'inherit',
|
|
59
62
|
padding: 0
|
|
60
63
|
}),
|
|
64
|
+
// @ts-expect-error - fix typings later
|
|
61
65
|
multiValueRemove: styles => ({
|
|
62
66
|
...styles,
|
|
63
67
|
borderTopLeftRadius: 0,
|
|
@@ -67,11 +71,13 @@ export const reactSelectStyles = (scheme: ThemeColorSchemeKey): StylesConfig =>
|
|
|
67
71
|
backgroundColor: getSchemeColor(scheme, 'mutedSelectedBg')
|
|
68
72
|
}
|
|
69
73
|
}),
|
|
74
|
+
// @ts-expect-error - fix typings later
|
|
70
75
|
noOptionsMessage: styles => ({
|
|
71
76
|
...styles,
|
|
72
77
|
fontFamily: studioTheme.fonts.text.family,
|
|
73
78
|
lineHeight: '1em'
|
|
74
79
|
}),
|
|
80
|
+
// @ts-expect-error - fix typings later
|
|
75
81
|
option: (styles, {isFocused}) => ({
|
|
76
82
|
...styles,
|
|
77
83
|
backgroundColor: isFocused ? getSchemeColor(scheme, 'spotBlue') : 'transparent',
|
|
@@ -83,10 +89,12 @@ export const reactSelectStyles = (scheme: ThemeColorSchemeKey): StylesConfig =>
|
|
|
83
89
|
color: getSchemeColor(scheme, 'bg')
|
|
84
90
|
}
|
|
85
91
|
}),
|
|
92
|
+
// @ts-expect-error - fix typings later
|
|
86
93
|
placeholder: styles => ({
|
|
87
94
|
...styles,
|
|
88
95
|
marginLeft: rem(themeSpace[2])
|
|
89
96
|
}),
|
|
97
|
+
// @ts-expect-error - fix typings later
|
|
90
98
|
valueContainer: styles => ({
|
|
91
99
|
...styles,
|
|
92
100
|
margin: 0,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {CloseIcon} from '@sanity/icons'
|
|
2
2
|
import {Box, Card, rem, studioTheme, Text, type ThemeColorSchemeKey} from '@sanity/ui'
|
|
3
|
-
import React from 'react'
|
|
4
3
|
import {components, type StylesConfig} from 'react-select'
|
|
5
4
|
import {Virtuoso} from 'react-virtuoso'
|
|
6
5
|
import {getSchemeColor} from '../../utils/getSchemeColor'
|
|
@@ -15,6 +14,7 @@ const {
|
|
|
15
14
|
|
|
16
15
|
export const reactSelectStyles = (scheme: ThemeColorSchemeKey): StylesConfig => {
|
|
17
16
|
return {
|
|
17
|
+
// @ts-expect-error - fix typings later
|
|
18
18
|
control: (styles, {isDisabled, isFocused}) => {
|
|
19
19
|
let boxShadow = `inset 0 0 0 1px var(--card-border-color)`
|
|
20
20
|
if (isFocused) {
|
|
@@ -40,6 +40,7 @@ export const reactSelectStyles = (scheme: ThemeColorSchemeKey): StylesConfig =>
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
|
+
// @ts-expect-error - fix typings later
|
|
43
44
|
input: styles => ({
|
|
44
45
|
...styles,
|
|
45
46
|
color: 'var(--card-fg-color)',
|
|
@@ -47,16 +48,19 @@ export const reactSelectStyles = (scheme: ThemeColorSchemeKey): StylesConfig =>
|
|
|
47
48
|
fontSize: themeTextSizes[1].fontSize,
|
|
48
49
|
marginLeft: rem(themeSpace[2])
|
|
49
50
|
}),
|
|
51
|
+
// @ts-expect-error - fix typings later
|
|
50
52
|
menuList: styles => ({
|
|
51
53
|
...styles,
|
|
52
54
|
padding: 0
|
|
53
55
|
}),
|
|
56
|
+
// @ts-expect-error - fix typings later
|
|
54
57
|
noOptionsMessage: styles => ({
|
|
55
58
|
...styles,
|
|
56
59
|
fontFamily: studioTheme.fonts.text.family,
|
|
57
60
|
fontSize: themeTextSizes[1].fontSize,
|
|
58
61
|
lineHeight: '1em'
|
|
59
62
|
}),
|
|
63
|
+
// @ts-expect-error - fix typings later
|
|
60
64
|
option: (styles, {isFocused}) => ({
|
|
61
65
|
...styles,
|
|
62
66
|
backgroundColor: isFocused ? getSchemeColor(scheme, 'spotBlue') : 'transparent',
|
|
@@ -71,12 +75,14 @@ export const reactSelectStyles = (scheme: ThemeColorSchemeKey): StylesConfig =>
|
|
|
71
75
|
color: getSchemeColor(scheme, 'bg')
|
|
72
76
|
}
|
|
73
77
|
}),
|
|
78
|
+
// @ts-expect-error - fix typings later
|
|
74
79
|
placeholder: styles => ({
|
|
75
80
|
...styles,
|
|
76
81
|
fontSize: themeTextSizes[1].fontSize,
|
|
77
82
|
marginLeft: rem(themeSpace[2]),
|
|
78
83
|
paddingLeft: 0
|
|
79
84
|
}),
|
|
85
|
+
// @ts-expect-error - fix typings later
|
|
80
86
|
singleValue: styles => ({
|
|
81
87
|
...styles,
|
|
82
88
|
alignItems: 'center',
|
|
@@ -84,6 +90,7 @@ export const reactSelectStyles = (scheme: ThemeColorSchemeKey): StylesConfig =>
|
|
|
84
90
|
height: '100%',
|
|
85
91
|
marginLeft: rem(themeSpace[2])
|
|
86
92
|
}),
|
|
93
|
+
// @ts-expect-error - fix typings later
|
|
87
94
|
valueContainer: styles => ({
|
|
88
95
|
...styles,
|
|
89
96
|
margin: 0,
|
package/src/utils/imageDprUrl.ts
CHANGED
package/src/utils/typeGuards.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// https://github.com/sanity-io/sanity/blob/ccb777e115a8cdf20d81a9a2bc9d8c228568faff/packages/%40sanity/form-builder/src/sanity/inputs/client-adapters/assets.ts
|
|
3
3
|
|
|
4
4
|
import type {SanityAssetDocument, SanityClient, SanityImageAssetDocument} from '@sanity/client'
|
|
5
|
-
import type {HttpError} from '
|
|
5
|
+
import type {HttpError} from '../types'
|
|
6
6
|
import {Observable, of, throwError} from 'rxjs'
|
|
7
7
|
import {map, mergeMap} from 'rxjs/operators'
|
|
8
8
|
import {withMaxConcurrency} from './withMaxConcurrency'
|