sanity-plugin-media 2.2.1 → 2.2.3
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/package.json +21 -16
- package/src/components/AssetMetadata/index.tsx +34 -26
- package/src/components/Browser/index.tsx +3 -2
- package/src/components/CardAsset/index.tsx +52 -35
- package/src/components/CardUpload/index.tsx +8 -5
- package/src/components/Controls/index.tsx +1 -2
- package/src/components/DialogAssetEdit/index.tsx +7 -5
- package/src/components/FileIcon/index.tsx +11 -9
- package/src/components/FormFieldInputTags/index.tsx +4 -1
- package/src/components/Image/index.tsx +5 -2
- package/src/components/OrderSelect/index.tsx +8 -4
- package/src/components/PickedBar/index.tsx +6 -3
- package/src/components/SearchFacet/index.tsx +13 -7
- package/src/components/SearchFacetNumber/index.tsx +17 -13
- package/src/components/SearchFacetSelect/index.tsx +25 -27
- package/src/components/SearchFacetString/index.tsx +3 -2
- package/src/components/SearchFacetTags/index.tsx +9 -3
- package/src/components/SearchFacets/index.tsx +9 -7
- package/src/components/SearchFacetsControl/index.tsx +3 -2
- package/src/components/TableHeader/index.tsx +18 -13
- package/src/components/TableRowAsset/index.tsx +49 -29
- package/src/components/TableRowUpload/index.tsx +7 -4
- package/src/components/Tag/index.tsx +2 -2
- package/src/components/TagView/index.tsx +3 -12
- package/src/components/TagViewHeader/index.tsx +6 -4
- package/src/components/TagsPanel/index.tsx +1 -2
- package/src/modules/assets/index.ts +5 -2
- package/src/styled/GlobalStyles/index.tsx +2 -3
- package/src/styled/react-select/creatable.tsx +87 -90
- package/src/styled/react-select/single.tsx +83 -89
- package/src/utils/getSchemeColor.ts +43 -0
- package/lib/index.esm.js +0 -1
- package/lib/index.esm.js.map +0 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +0 -1
- package/lib/src/index.d.ts +0 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sanity-plugin-media",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"description": "This version of `sanity-plugin-media` is for Sanity Studio V3.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -24,18 +24,22 @@
|
|
|
24
24
|
"author": "Sanity.io <hello@sanity.io>",
|
|
25
25
|
"exports": {
|
|
26
26
|
".": {
|
|
27
|
-
"types": "./
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
28
|
"source": "./src/index.ts",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
|
|
29
|
+
"require": "./dist/index.js",
|
|
30
|
+
"node": {
|
|
31
|
+
"module": "./dist/index.esm.js",
|
|
32
|
+
"import": "./dist/index.cjs.mjs"
|
|
33
|
+
},
|
|
34
|
+
"import": "./dist/index.esm.js",
|
|
35
|
+
"default": "./dist/index.esm.js"
|
|
32
36
|
},
|
|
33
37
|
"./package.json": "./package.json"
|
|
34
38
|
},
|
|
35
|
-
"main": "./
|
|
36
|
-
"module": "./
|
|
39
|
+
"main": "./dist/index.js",
|
|
40
|
+
"module": "./dist/index.esm.js",
|
|
37
41
|
"source": "./src/index.ts",
|
|
38
|
-
"types": "./
|
|
42
|
+
"types": "./dist/index.d.ts",
|
|
39
43
|
"files": [
|
|
40
44
|
"src",
|
|
41
45
|
"lib",
|
|
@@ -43,15 +47,15 @@
|
|
|
43
47
|
"sanity.json"
|
|
44
48
|
],
|
|
45
49
|
"scripts": {
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"clean": "rimraf lib",
|
|
50
|
+
"build": "run-s clean && plugin-kit verify-package --silent && pkg-utils build --strict && pkg-utils --strict",
|
|
51
|
+
"clean": "rimraf dist",
|
|
49
52
|
"dev": "npm run watch",
|
|
53
|
+
"format": "prettier --write --cache --ignore-unknown .",
|
|
50
54
|
"link-watch": "plugin-kit link-watch",
|
|
51
55
|
"lint": "eslint .",
|
|
52
56
|
"prepare": "husky install",
|
|
53
|
-
"prepublishOnly": "
|
|
54
|
-
"watch": "pkg-utils watch"
|
|
57
|
+
"prepublishOnly": "run-s build",
|
|
58
|
+
"watch": "pkg-utils watch --strict"
|
|
55
59
|
},
|
|
56
60
|
"dependencies": {
|
|
57
61
|
"@hookform/resolvers": "^3.1.1",
|
|
@@ -66,6 +70,7 @@
|
|
|
66
70
|
"groq": "^3.0.0",
|
|
67
71
|
"is-hotkey": "^0.2.0",
|
|
68
72
|
"nanoid": "^3.3.3",
|
|
73
|
+
"npm-run-all": "^4.1.5",
|
|
69
74
|
"pluralize": "^8.0.0",
|
|
70
75
|
"react-dropzone": "^11.3.1",
|
|
71
76
|
"react-file-icon": "^1.1.0",
|
|
@@ -81,11 +86,11 @@
|
|
|
81
86
|
"devDependencies": {
|
|
82
87
|
"@commitlint/cli": "^17.2.0",
|
|
83
88
|
"@commitlint/config-conventional": "^17.2.0",
|
|
84
|
-
"@sanity/client": "^
|
|
89
|
+
"@sanity/client": "^6.7.0",
|
|
85
90
|
"@sanity/color": "^2.1.20",
|
|
86
91
|
"@sanity/icons": "^2.0.0",
|
|
87
|
-
"@sanity/pkg-utils": "^2.
|
|
88
|
-
"@sanity/plugin-kit": "^
|
|
92
|
+
"@sanity/pkg-utils": "^2.4.8",
|
|
93
|
+
"@sanity/plugin-kit": "^3.1.10",
|
|
89
94
|
"@sanity/semantic-release-preset": "^2.0.2",
|
|
90
95
|
"@types/is-hotkey": "^0.1.7",
|
|
91
96
|
"@types/pluralize": "^0.0.29",
|
|
@@ -63,32 +63,40 @@ const AssetMetadata = (props: Props) => {
|
|
|
63
63
|
</Stack>
|
|
64
64
|
</Box>
|
|
65
65
|
{/* EXIF */}
|
|
66
|
-
{exif &&
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
<Row label="
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
66
|
+
{exif &&
|
|
67
|
+
(exif.DateTimeOriginal ||
|
|
68
|
+
exif.FNumber ||
|
|
69
|
+
exif.FocalLength ||
|
|
70
|
+
exif.ExposureTime ||
|
|
71
|
+
exif.ISO) && (
|
|
72
|
+
<>
|
|
73
|
+
{/* Divider */}
|
|
74
|
+
<Box
|
|
75
|
+
marginY={4}
|
|
76
|
+
style={{
|
|
77
|
+
background: 'var(--card-border-color)',
|
|
78
|
+
height: '1px',
|
|
79
|
+
width: '100%'
|
|
80
|
+
}}
|
|
81
|
+
/>
|
|
82
|
+
<Box>
|
|
83
|
+
<Stack space={3}>
|
|
84
|
+
{exif.ISO && <Row label="ISO" value={exif.ISO} />}
|
|
85
|
+
{exif.FNumber && <Row label="Aperture" value={`ƒ/${exif.FNumber}`} />}
|
|
86
|
+
{exif.FocalLength && <Row label="Focal length" value={`${exif.FocalLength}mm`} />}
|
|
87
|
+
{exif.ExposureTime && (
|
|
88
|
+
<Row label="Exposure time" value={`1/${1 / exif.ExposureTime}`} />
|
|
89
|
+
)}
|
|
90
|
+
{exif.DateTimeOriginal && (
|
|
91
|
+
<Row
|
|
92
|
+
label="Original date"
|
|
93
|
+
value={format(new Date(exif.DateTimeOriginal), 'PPp')}
|
|
94
|
+
/>
|
|
95
|
+
)}
|
|
96
|
+
</Stack>
|
|
97
|
+
</Box>
|
|
98
|
+
</>
|
|
99
|
+
)}
|
|
92
100
|
|
|
93
101
|
{/* Asset actions */}
|
|
94
102
|
<Box marginTop={5}>
|
|
@@ -4,7 +4,7 @@ import {Asset, Tag} from '@types'
|
|
|
4
4
|
import groq from 'groq'
|
|
5
5
|
import React, {useEffect, useState} from 'react'
|
|
6
6
|
import {useDispatch} from 'react-redux'
|
|
7
|
-
import type
|
|
7
|
+
import {useColorScheme, type AssetSourceComponentProps, type SanityDocument} from 'sanity'
|
|
8
8
|
import {TAG_DOCUMENT_NAME} from '../../constants'
|
|
9
9
|
import {AssetBrowserDispatchProvider} from '../../contexts/AssetSourceDispatchContext'
|
|
10
10
|
import useVersionedClient from '../../hooks/useVersionedClient'
|
|
@@ -132,6 +132,7 @@ const BrowserContent = ({onClose}: {onClose?: AssetSourceComponentProps['onClose
|
|
|
132
132
|
|
|
133
133
|
const Browser = (props: Props) => {
|
|
134
134
|
const client = useVersionedClient()
|
|
135
|
+
const {scheme} = useColorScheme()
|
|
135
136
|
|
|
136
137
|
return (
|
|
137
138
|
<ReduxProvider
|
|
@@ -140,7 +141,7 @@ const Browser = (props: Props) => {
|
|
|
140
141
|
document={props?.document}
|
|
141
142
|
selectedAssets={props?.selectedAssets}
|
|
142
143
|
>
|
|
143
|
-
<ThemeProvider scheme=
|
|
144
|
+
<ThemeProvider scheme={scheme} theme={studioTheme}>
|
|
144
145
|
<ToastProvider>
|
|
145
146
|
<AssetBrowserDispatchProvider onSelect={props?.onSelect}>
|
|
146
147
|
<GlobalStyle />
|
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
import {hues} from '@sanity/color'
|
|
2
1
|
import {CheckmarkCircleIcon, EditIcon, WarningFilledIcon} from '@sanity/icons'
|
|
3
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Box,
|
|
4
|
+
Checkbox,
|
|
5
|
+
Container,
|
|
6
|
+
Flex,
|
|
7
|
+
Spinner,
|
|
8
|
+
Text,
|
|
9
|
+
Theme,
|
|
10
|
+
ThemeColorSchemeKey,
|
|
11
|
+
Tooltip
|
|
12
|
+
} from '@sanity/ui'
|
|
4
13
|
import React, {memo, MouseEvent, RefObject} from 'react'
|
|
5
14
|
import {useDispatch} from 'react-redux'
|
|
15
|
+
import {useColorScheme} from 'sanity'
|
|
6
16
|
import styled, {css} from 'styled-components'
|
|
7
17
|
import {PANEL_HEIGHT} from '../../constants'
|
|
8
18
|
import {useAssetSourceActions} from '../../contexts/AssetSourceDispatchContext'
|
|
@@ -14,6 +24,7 @@ import imageDprUrl from '../../utils/imageDprUrl'
|
|
|
14
24
|
import {isFileAsset, isImageAsset} from '../../utils/typeGuards'
|
|
15
25
|
import FileIcon from '../FileIcon'
|
|
16
26
|
import Image from '../Image'
|
|
27
|
+
import {getSchemeColor} from '../../utils/getSchemeColor'
|
|
17
28
|
|
|
18
29
|
type Props = {
|
|
19
30
|
id: string
|
|
@@ -24,47 +35,49 @@ const CardWrapper = styled(Flex)`
|
|
|
24
35
|
box-sizing: border-box;
|
|
25
36
|
height: 100%;
|
|
26
37
|
overflow: hidden;
|
|
27
|
-
padding: 2px;
|
|
28
38
|
position: relative;
|
|
29
39
|
width: 100%;
|
|
30
40
|
`
|
|
31
41
|
|
|
32
|
-
const CardContainer = styled(Flex)<{picked?: boolean; updating?: boolean}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
const CardContainer = styled(Flex)<{picked?: boolean; theme: Theme; updating?: boolean}>(
|
|
43
|
+
({picked, theme, updating}) => {
|
|
44
|
+
return css`
|
|
45
|
+
border: 1px solid transparent;
|
|
46
|
+
height: 100%;
|
|
47
|
+
pointer-events: ${updating ? 'none' : 'auto'};
|
|
48
|
+
position: relative;
|
|
49
|
+
transition: all 300ms;
|
|
50
|
+
user-select: none;
|
|
51
|
+
width: 100%;
|
|
40
52
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
: '1px solid inherit'};
|
|
53
|
+
border: ${picked
|
|
54
|
+
? `1px solid ${theme.sanity.color.spot.orange} !important`
|
|
55
|
+
: '1px solid inherit'};
|
|
45
56
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
57
|
+
${!updating &&
|
|
58
|
+
css`
|
|
59
|
+
@media (hover: hover) and (pointer: fine) {
|
|
60
|
+
&:hover {
|
|
61
|
+
border: 1px solid var(--card-border-color);
|
|
62
|
+
}
|
|
52
63
|
}
|
|
53
|
-
}
|
|
54
|
-
`
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const ContextActionContainer = styled(Flex)`
|
|
58
|
-
cursor: ${props => (props.selected ? 'default' : 'pointer')};
|
|
59
|
-
height: ${PANEL_HEIGHT}px;
|
|
60
|
-
transition: all 300ms;
|
|
64
|
+
`}
|
|
65
|
+
`
|
|
66
|
+
}
|
|
67
|
+
)
|
|
61
68
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
69
|
+
const ContextActionContainer = styled(Flex)(({scheme}: {scheme: ThemeColorSchemeKey}) => {
|
|
70
|
+
return css`
|
|
71
|
+
cursor: pointer;
|
|
72
|
+
height: ${PANEL_HEIGHT}px;
|
|
73
|
+
transition: all 300ms;
|
|
74
|
+
@media (hover: hover) and (pointer: fine) {
|
|
75
|
+
&:hover {
|
|
76
|
+
background: ${getSchemeColor(scheme, 'bg')};
|
|
77
|
+
}
|
|
65
78
|
}
|
|
66
|
-
|
|
67
|
-
|
|
79
|
+
`
|
|
80
|
+
})
|
|
68
81
|
|
|
69
82
|
const StyledWarningOutlineIcon = styled(WarningFilledIcon)(({theme}) => {
|
|
70
83
|
return {
|
|
@@ -75,6 +88,8 @@ const StyledWarningOutlineIcon = styled(WarningFilledIcon)(({theme}) => {
|
|
|
75
88
|
const CardAsset = (props: Props) => {
|
|
76
89
|
const {id, selected} = props
|
|
77
90
|
|
|
91
|
+
const {scheme} = useColorScheme()
|
|
92
|
+
|
|
78
93
|
// Refs
|
|
79
94
|
const shiftPressed: RefObject<boolean> = useKeyPress('shift')
|
|
80
95
|
|
|
@@ -134,7 +149,7 @@ const CardAsset = (props: Props) => {
|
|
|
134
149
|
const opacityPreview = selected || updating ? 0.25 : 1
|
|
135
150
|
|
|
136
151
|
return (
|
|
137
|
-
<CardWrapper>
|
|
152
|
+
<CardWrapper padding={1}>
|
|
138
153
|
<CardContainer direction="column" picked={picked} updating={item.updating}>
|
|
139
154
|
{/* Image */}
|
|
140
155
|
<Box
|
|
@@ -152,6 +167,7 @@ const CardAsset = (props: Props) => {
|
|
|
152
167
|
{isImageAsset(asset) && (
|
|
153
168
|
<Image
|
|
154
169
|
draggable={false}
|
|
170
|
+
scheme={scheme}
|
|
155
171
|
showCheckerboard={!isOpaque}
|
|
156
172
|
src={imageDprUrl(asset, {height: 250, width: 250})}
|
|
157
173
|
style={{
|
|
@@ -205,6 +221,7 @@ const CardAsset = (props: Props) => {
|
|
|
205
221
|
align="center"
|
|
206
222
|
onClick={handleContextActionClick}
|
|
207
223
|
paddingX={1}
|
|
224
|
+
scheme={scheme}
|
|
208
225
|
style={{opacity: opacityContainer}}
|
|
209
226
|
>
|
|
210
227
|
{onSelect ? (
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import {hues} from '@sanity/color'
|
|
2
1
|
import {CloseIcon} from '@sanity/icons'
|
|
3
2
|
import {Box, Button, Flex, Text} from '@sanity/ui'
|
|
4
3
|
import filesize from 'filesize'
|
|
5
4
|
import React from 'react'
|
|
6
5
|
import {useDispatch} from 'react-redux'
|
|
6
|
+
import {useColorScheme} from 'sanity'
|
|
7
7
|
import styled from 'styled-components'
|
|
8
8
|
import {PANEL_HEIGHT} from '../../constants'
|
|
9
9
|
import useTypedSelector from '../../hooks/useTypedSelector'
|
|
10
10
|
import {selectUploadById, uploadsActions} from '../../modules/uploads'
|
|
11
11
|
import FileIcon from '../FileIcon'
|
|
12
12
|
import Image from '../Image'
|
|
13
|
+
import {getSchemeColor} from '../../utils/getSchemeColor'
|
|
13
14
|
|
|
14
15
|
type Props = {
|
|
15
16
|
id: string
|
|
@@ -19,7 +20,6 @@ const CardWrapper = styled(Flex)`
|
|
|
19
20
|
box-sizing: border-box;
|
|
20
21
|
height: 100%;
|
|
21
22
|
overflow: hidden;
|
|
22
|
-
padding: 2px;
|
|
23
23
|
position: relative;
|
|
24
24
|
width: 100%;
|
|
25
25
|
`
|
|
@@ -27,6 +27,8 @@ const CardWrapper = styled(Flex)`
|
|
|
27
27
|
const CardUpload = (props: Props) => {
|
|
28
28
|
const {id} = props
|
|
29
29
|
|
|
30
|
+
const {scheme} = useColorScheme()
|
|
31
|
+
|
|
30
32
|
// Redux
|
|
31
33
|
const dispatch = useDispatch()
|
|
32
34
|
const item = useTypedSelector(state => selectUploadById(state, id))
|
|
@@ -59,12 +61,12 @@ const CardUpload = (props: Props) => {
|
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
return (
|
|
62
|
-
<CardWrapper>
|
|
64
|
+
<CardWrapper padding={1}>
|
|
63
65
|
<Flex
|
|
64
66
|
direction="column"
|
|
65
67
|
flex={1}
|
|
66
68
|
style={{
|
|
67
|
-
background:
|
|
69
|
+
background: getSchemeColor(scheme, 'bg'),
|
|
68
70
|
border: '1px solid transparent',
|
|
69
71
|
height: '100%',
|
|
70
72
|
position: 'relative'
|
|
@@ -73,7 +75,7 @@ const CardUpload = (props: Props) => {
|
|
|
73
75
|
{/* Progress bar */}
|
|
74
76
|
<div
|
|
75
77
|
style={{
|
|
76
|
-
background:
|
|
78
|
+
background: 'var(--card-fg-color)',
|
|
77
79
|
bottom: 0,
|
|
78
80
|
height: '1px',
|
|
79
81
|
left: 0,
|
|
@@ -89,6 +91,7 @@ const CardUpload = (props: Props) => {
|
|
|
89
91
|
{item.assetType === 'image' && item?.objectUrl && (
|
|
90
92
|
<Image
|
|
91
93
|
draggable={false}
|
|
94
|
+
scheme={scheme}
|
|
92
95
|
src={item.objectUrl}
|
|
93
96
|
style={{
|
|
94
97
|
opacity: 0.4
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {hues} from '@sanity/color'
|
|
2
1
|
import {Box, Button, Flex, Inline, useMediaIndex} from '@sanity/ui'
|
|
3
2
|
import React from 'react'
|
|
4
3
|
import {useDispatch} from 'react-redux'
|
|
@@ -40,7 +39,7 @@ const Controls = () => {
|
|
|
40
39
|
<Box
|
|
41
40
|
paddingY={2}
|
|
42
41
|
style={{
|
|
43
|
-
borderBottom:
|
|
42
|
+
borderBottom: '1px solid var(--card-border-color)',
|
|
44
43
|
zIndex: 2
|
|
45
44
|
}}
|
|
46
45
|
>
|
|
@@ -6,7 +6,7 @@ import groq from 'groq'
|
|
|
6
6
|
import React, {ReactNode, useCallback, useEffect, useRef, useState} from 'react'
|
|
7
7
|
import {SubmitHandler, useForm} from 'react-hook-form'
|
|
8
8
|
import {useDispatch} from 'react-redux'
|
|
9
|
-
import {WithReferringDocuments, useDocumentStore} from 'sanity'
|
|
9
|
+
import {WithReferringDocuments, useColorScheme, useDocumentStore} from 'sanity'
|
|
10
10
|
import {assetFormSchema} from '../../formSchema'
|
|
11
11
|
import useTypedSelector from '../../hooks/useTypedSelector'
|
|
12
12
|
import useVersionedClient from '../../hooks/useVersionedClient'
|
|
@@ -40,6 +40,7 @@ const DialogAssetEdit = (props: Props) => {
|
|
|
40
40
|
} = props
|
|
41
41
|
|
|
42
42
|
const client = useVersionedClient()
|
|
43
|
+
const {scheme} = useColorScheme()
|
|
43
44
|
|
|
44
45
|
const documentStore = useDocumentStore()
|
|
45
46
|
|
|
@@ -47,7 +48,7 @@ const DialogAssetEdit = (props: Props) => {
|
|
|
47
48
|
const assetItem = useTypedSelector(state => selectAssetById(state, String(assetId))) // TODO: check casting
|
|
48
49
|
const tags = useTypedSelector(selectTags)
|
|
49
50
|
|
|
50
|
-
const assetUpdatedPrev = useRef<string |
|
|
51
|
+
const assetUpdatedPrev = useRef<string | undefined>(undefined)
|
|
51
52
|
|
|
52
53
|
// Generate a snapshot of the current asset
|
|
53
54
|
const [assetSnapshot, setAssetSnapshot] = useState(assetItem?.asset)
|
|
@@ -222,7 +223,7 @@ const DialogAssetEdit = (props: Props) => {
|
|
|
222
223
|
<FormSubmitButton
|
|
223
224
|
disabled={formUpdating || !isDirty || !isValid}
|
|
224
225
|
isValid={isValid}
|
|
225
|
-
lastUpdated={currentAsset
|
|
226
|
+
lastUpdated={currentAsset?._updatedAt}
|
|
226
227
|
onClick={handleSubmit(onSubmit)}
|
|
227
228
|
/>
|
|
228
229
|
</Flex>
|
|
@@ -242,7 +243,7 @@ const DialogAssetEdit = (props: Props) => {
|
|
|
242
243
|
*/}
|
|
243
244
|
<Flex direction={['column-reverse', 'column-reverse', 'row-reverse']}>
|
|
244
245
|
<Box flex={1} marginTop={[5, 5, 0]} padding={4}>
|
|
245
|
-
<WithReferringDocuments documentStore={documentStore} id={
|
|
246
|
+
<WithReferringDocuments documentStore={documentStore} id={currentAsset._id}>
|
|
246
247
|
{({isLoading, referringDocuments}) => {
|
|
247
248
|
const uniqueReferringDocuments = getUniqueDocuments(referringDocuments)
|
|
248
249
|
return (
|
|
@@ -338,7 +339,7 @@ const DialogAssetEdit = (props: Props) => {
|
|
|
338
339
|
error={errors?.description?.message}
|
|
339
340
|
label="Description"
|
|
340
341
|
name="description"
|
|
341
|
-
rows={
|
|
342
|
+
rows={5}
|
|
342
343
|
value={currentAsset?.description}
|
|
343
344
|
/>
|
|
344
345
|
</Stack>
|
|
@@ -375,6 +376,7 @@ const DialogAssetEdit = (props: Props) => {
|
|
|
375
376
|
{isImageAsset(currentAsset) && (
|
|
376
377
|
<Image
|
|
377
378
|
draggable={false}
|
|
379
|
+
scheme={scheme}
|
|
378
380
|
showCheckerboard={!currentAsset?.metadata?.isOpaque}
|
|
379
381
|
src={imageDprUrl(currentAsset, {height: 600, width: 600})}
|
|
380
382
|
/>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {Box, Flex} from '@sanity/ui'
|
|
1
|
+
import {Box, Flex, Theme} from '@sanity/ui'
|
|
2
2
|
import React, {MouseEvent} from 'react'
|
|
3
3
|
import {defaultStyles, FileIcon as ReactFileIcon} from 'react-file-icon'
|
|
4
4
|
import type {DefaultExtensionType} from 'react-file-icon'
|
|
5
|
-
import styled from 'styled-components'
|
|
5
|
+
import styled, {css} from 'styled-components'
|
|
6
6
|
|
|
7
7
|
type Props = {
|
|
8
8
|
extension?: string
|
|
@@ -11,13 +11,15 @@ type Props = {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
// Force react-file-icon styles
|
|
14
|
-
const Container = styled(Box)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
const Container = styled(Box)(({theme}: {theme: Theme}) => {
|
|
15
|
+
return css`
|
|
16
|
+
text {
|
|
17
|
+
font-family: ${theme.sanity.fonts.text.family} !important;
|
|
18
|
+
font-size: 8px !important;
|
|
19
|
+
font-weight: 500 !important;
|
|
20
|
+
}
|
|
21
|
+
`
|
|
22
|
+
})
|
|
21
23
|
|
|
22
24
|
const FileIcon = (props: Props) => {
|
|
23
25
|
const {extension, onClick, width} = props
|
|
@@ -2,6 +2,7 @@ import {Box} from '@sanity/ui'
|
|
|
2
2
|
import React from 'react'
|
|
3
3
|
import {Controller} from 'react-hook-form'
|
|
4
4
|
import CreatableSelect from 'react-select/creatable'
|
|
5
|
+
import {useColorScheme} from 'sanity'
|
|
5
6
|
import useTypedSelector from '../../hooks/useTypedSelector'
|
|
6
7
|
import {reactSelectComponents, reactSelectStyles} from '../../styled/react-select/creatable'
|
|
7
8
|
import type {TagSelectOption} from '../../types'
|
|
@@ -37,6 +38,8 @@ const FormFieldInputTags = (props: Props) => {
|
|
|
37
38
|
value
|
|
38
39
|
} = props
|
|
39
40
|
|
|
41
|
+
const {scheme} = useColorScheme()
|
|
42
|
+
|
|
40
43
|
// Redux
|
|
41
44
|
const creating = useTypedSelector(state => state.tags.creating)
|
|
42
45
|
const tagsFetching = useTypedSelector(state => state.tags.fetching)
|
|
@@ -82,7 +85,7 @@ const FormFieldInputTags = (props: Props) => {
|
|
|
82
85
|
onCreateOption={onCreateTag}
|
|
83
86
|
options={options}
|
|
84
87
|
placeholder={tagsFetching ? 'Loading...' : placeholder}
|
|
85
|
-
styles={reactSelectStyles}
|
|
88
|
+
styles={reactSelectStyles(scheme)}
|
|
86
89
|
value={controllerValue}
|
|
87
90
|
/>
|
|
88
91
|
)
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {ThemeColorSchemeKey} from '@sanity/ui'
|
|
2
2
|
import {MouseEvent} from 'react'
|
|
3
3
|
import styled, {css} from 'styled-components'
|
|
4
|
+
import {getSchemeColor} from '../../utils/getSchemeColor'
|
|
4
5
|
|
|
5
6
|
type Props = {
|
|
6
7
|
onClick?: (e: MouseEvent) => void
|
|
7
8
|
showCheckerboard?: boolean
|
|
9
|
+
scheme?: ThemeColorSchemeKey
|
|
8
10
|
src: string
|
|
9
11
|
style?: any
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
const Image = styled.img<Props>`
|
|
13
|
-
--checkerboard-color: ${
|
|
15
|
+
--checkerboard-color: ${props =>
|
|
16
|
+
props.scheme ? getSchemeColor(props.scheme, 'bg2') : 'inherit'};
|
|
14
17
|
|
|
15
18
|
display: block;
|
|
16
19
|
width: 100%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {SortIcon} from '@sanity/icons'
|
|
2
2
|
import {Button, Menu, MenuButton, MenuDivider, MenuItem} from '@sanity/ui'
|
|
3
3
|
import React from 'react'
|
|
4
4
|
import {useDispatch} from 'react-redux'
|
|
@@ -21,8 +21,7 @@ const OrderSelect = () => {
|
|
|
21
21
|
<Button
|
|
22
22
|
fontSize={1}
|
|
23
23
|
icon={SortIcon}
|
|
24
|
-
|
|
25
|
-
mode="ghost"
|
|
24
|
+
mode="bleed"
|
|
26
25
|
padding={3}
|
|
27
26
|
text={getOrderTitle(order.field, order.direction)}
|
|
28
27
|
/>
|
|
@@ -32,10 +31,12 @@ const OrderSelect = () => {
|
|
|
32
31
|
<Menu>
|
|
33
32
|
{ORDER_OPTIONS?.map((item, index) => {
|
|
34
33
|
if (item) {
|
|
34
|
+
const selected = order.field === item.field && order.direction === item.direction
|
|
35
35
|
return (
|
|
36
36
|
<MenuItem
|
|
37
|
-
disabled={
|
|
37
|
+
disabled={selected}
|
|
38
38
|
fontSize={1}
|
|
39
|
+
iconRight={selected}
|
|
39
40
|
key={index}
|
|
40
41
|
onClick={() =>
|
|
41
42
|
dispatch(
|
|
@@ -45,6 +46,9 @@ const OrderSelect = () => {
|
|
|
45
46
|
)
|
|
46
47
|
}
|
|
47
48
|
padding={2}
|
|
49
|
+
selected={selected}
|
|
50
|
+
space={4}
|
|
51
|
+
style={{minWidth: '200px'}}
|
|
48
52
|
text={getOrderTitle(item.field, item.direction)}
|
|
49
53
|
/>
|
|
50
54
|
)
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import {hues} from '@sanity/color'
|
|
2
1
|
import {Box, Button, Flex, Label} from '@sanity/ui'
|
|
3
2
|
import pluralize from 'pluralize'
|
|
4
3
|
import React from 'react'
|
|
5
4
|
import {useDispatch} from 'react-redux'
|
|
5
|
+
import {useColorScheme} from 'sanity'
|
|
6
6
|
import {PANEL_HEIGHT} from '../../constants'
|
|
7
7
|
import useTypedSelector from '../../hooks/useTypedSelector'
|
|
8
8
|
import {assetsActions, selectAssetsPicked} from '../../modules/assets'
|
|
9
9
|
import {dialogActions} from '../../modules/dialog'
|
|
10
|
+
import {getSchemeColor} from '../../utils/getSchemeColor'
|
|
10
11
|
|
|
11
12
|
const PickedBar = () => {
|
|
13
|
+
const {scheme} = useColorScheme()
|
|
14
|
+
|
|
12
15
|
// Redux
|
|
13
16
|
const dispatch = useDispatch()
|
|
14
17
|
const assetsPicked = useTypedSelector(selectAssetsPicked)
|
|
@@ -31,8 +34,8 @@ const PickedBar = () => {
|
|
|
31
34
|
align="center"
|
|
32
35
|
justify="flex-start"
|
|
33
36
|
style={{
|
|
34
|
-
background:
|
|
35
|
-
borderBottom:
|
|
37
|
+
background: getSchemeColor(scheme, 'bg'),
|
|
38
|
+
borderBottom: '1px solid var(--card-border-color)',
|
|
36
39
|
height: `${PANEL_HEIGHT}px`,
|
|
37
40
|
position: 'relative',
|
|
38
41
|
width: '100%'
|
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
import {CloseIcon} from '@sanity/icons'
|
|
2
|
-
import {Box, Flex, Label, Text} from '@sanity/ui'
|
|
2
|
+
import {Box, Flex, Label, rem, Text, Theme, ThemeColorSchemeKey} from '@sanity/ui'
|
|
3
3
|
import {SearchFacetInputProps, WithId} from '@types'
|
|
4
4
|
import React, {ReactNode} from 'react'
|
|
5
5
|
import {useDispatch} from 'react-redux'
|
|
6
|
-
import
|
|
6
|
+
import {useColorScheme} from 'sanity'
|
|
7
|
+
import styled, {css} from 'styled-components'
|
|
7
8
|
import {searchActions} from '../../modules/search'
|
|
9
|
+
import {getSchemeColor} from '../../utils/getSchemeColor'
|
|
8
10
|
|
|
9
11
|
type Props = {
|
|
10
12
|
children: ReactNode
|
|
11
13
|
facet: WithId<SearchFacetInputProps>
|
|
12
14
|
}
|
|
13
15
|
|
|
14
|
-
const Container = styled(Box)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const Container = styled(Box)(({scheme, theme}: {scheme: ThemeColorSchemeKey; theme: Theme}) => {
|
|
17
|
+
return css`
|
|
18
|
+
background: ${getSchemeColor(scheme, 'bg')};
|
|
19
|
+
border-radius: ${rem(theme.sanity.radius[2])};
|
|
20
|
+
`
|
|
21
|
+
})
|
|
18
22
|
|
|
19
23
|
const SearchFacet = (props: Props) => {
|
|
20
24
|
const {children, facet} = props
|
|
21
25
|
|
|
26
|
+
const {scheme} = useColorScheme()
|
|
27
|
+
|
|
22
28
|
// Redux
|
|
23
29
|
const dispatch = useDispatch()
|
|
24
30
|
|
|
@@ -27,7 +33,7 @@ const SearchFacet = (props: Props) => {
|
|
|
27
33
|
}
|
|
28
34
|
|
|
29
35
|
return (
|
|
30
|
-
<Container padding={[2, 2, 1]}>
|
|
36
|
+
<Container padding={[2, 2, 1]} scheme={scheme}>
|
|
31
37
|
<Flex align={['flex-start', 'flex-start', 'center']} direction={['column', 'column', 'row']}>
|
|
32
38
|
{/* Title */}
|
|
33
39
|
<Box paddingBottom={[3, 3, 0]} paddingLeft={1} paddingRight={2} paddingTop={[1, 1, 0]}>
|