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
|
@@ -52,7 +52,7 @@ const SearchFacetNumber = ({facet}: Props) => {
|
|
|
52
52
|
<Button
|
|
53
53
|
fontSize={1}
|
|
54
54
|
iconRight={SelectIcon}
|
|
55
|
-
padding={2}
|
|
55
|
+
padding={2}
|
|
56
56
|
text={operators[selectedOperatorType].label}
|
|
57
57
|
/>
|
|
58
58
|
}
|
|
@@ -61,9 +61,10 @@ const SearchFacetNumber = ({facet}: Props) => {
|
|
|
61
61
|
<Menu>
|
|
62
62
|
{facet.operatorTypes.map((operatorType, index) => {
|
|
63
63
|
if (operatorType) {
|
|
64
|
+
const selected = operatorType === selectedOperatorType
|
|
64
65
|
return (
|
|
65
66
|
<MenuItem
|
|
66
|
-
disabled={
|
|
67
|
+
disabled={selected}
|
|
67
68
|
fontSize={1}
|
|
68
69
|
key={operatorType}
|
|
69
70
|
onClick={() => handleOperatorItemClick(operatorType)}
|
|
@@ -100,23 +101,26 @@ const SearchFacetNumber = ({facet}: Props) => {
|
|
|
100
101
|
<Button
|
|
101
102
|
fontSize={1}
|
|
102
103
|
iconRight={SelectIcon}
|
|
103
|
-
padding={2}
|
|
104
|
+
padding={2}
|
|
104
105
|
text={selectedModifier?.title}
|
|
105
106
|
/>
|
|
106
107
|
}
|
|
107
108
|
id="modifier"
|
|
108
109
|
menu={
|
|
109
110
|
<Menu>
|
|
110
|
-
{modifiers.map(modifier =>
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
111
|
+
{modifiers.map(modifier => {
|
|
112
|
+
const selected = modifier.name === facet.modifier
|
|
113
|
+
return (
|
|
114
|
+
<MenuItem
|
|
115
|
+
disabled={selected}
|
|
116
|
+
fontSize={1}
|
|
117
|
+
key={modifier.name}
|
|
118
|
+
onClick={() => handleModifierClick(modifier)}
|
|
119
|
+
padding={2}
|
|
120
|
+
text={modifier.title}
|
|
121
|
+
/>
|
|
122
|
+
)
|
|
123
|
+
})}
|
|
120
124
|
</Menu>
|
|
121
125
|
}
|
|
122
126
|
popover={popoverProps}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {SelectIcon} from '@sanity/icons'
|
|
2
|
-
import {Button, Menu, MenuButton, MenuDivider, MenuItem} from '@sanity/ui'
|
|
2
|
+
import {Box, Button, Menu, MenuButton, MenuDivider, MenuItem} from '@sanity/ui'
|
|
3
3
|
import {
|
|
4
4
|
SearchFacetInputSelectListItemProps,
|
|
5
5
|
SearchFacetInputSelectProps,
|
|
@@ -44,24 +44,24 @@ const SearchFacetSelect = ({facet}: Props) => {
|
|
|
44
44
|
{facet?.operatorTypes && (
|
|
45
45
|
<MenuButton
|
|
46
46
|
button={
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
/>
|
|
47
|
+
<Box marginRight={1}>
|
|
48
|
+
<Button
|
|
49
|
+
fontSize={1}
|
|
50
|
+
iconRight={SelectIcon}
|
|
51
|
+
padding={2}
|
|
52
|
+
text={operators[selectedOperatorType].label}
|
|
53
|
+
/>
|
|
54
|
+
</Box>
|
|
56
55
|
}
|
|
57
56
|
id="operators"
|
|
58
57
|
menu={
|
|
59
58
|
<Menu>
|
|
60
59
|
{facet.operatorTypes.map((operatorType, index) => {
|
|
61
60
|
if (operatorType) {
|
|
61
|
+
const selected = operatorType === selectedOperatorType
|
|
62
62
|
return (
|
|
63
63
|
<MenuItem
|
|
64
|
-
disabled={
|
|
64
|
+
disabled={selected}
|
|
65
65
|
fontSize={1}
|
|
66
66
|
key={operatorType}
|
|
67
67
|
onClick={() => handleOperatorItemClick(operatorType)}
|
|
@@ -82,26 +82,24 @@ const SearchFacetSelect = ({facet}: Props) => {
|
|
|
82
82
|
{/* List */}
|
|
83
83
|
<MenuButton
|
|
84
84
|
button={
|
|
85
|
-
<Button
|
|
86
|
-
fontSize={1}
|
|
87
|
-
iconRight={SelectIcon}
|
|
88
|
-
padding={2} //
|
|
89
|
-
text={selectedItem?.title}
|
|
90
|
-
/>
|
|
85
|
+
<Button fontSize={1} iconRight={SelectIcon} padding={2} text={selectedItem?.title} />
|
|
91
86
|
}
|
|
92
87
|
id="list"
|
|
93
88
|
menu={
|
|
94
89
|
<Menu>
|
|
95
|
-
{options?.map((item, index) =>
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
90
|
+
{options?.map((item, index) => {
|
|
91
|
+
const selected = item.name === selectedItem?.name
|
|
92
|
+
return (
|
|
93
|
+
<MenuItem
|
|
94
|
+
disabled={selected}
|
|
95
|
+
fontSize={1}
|
|
96
|
+
key={item.name}
|
|
97
|
+
onClick={() => handleListItemClick(options[index])}
|
|
98
|
+
padding={2}
|
|
99
|
+
text={item.title}
|
|
100
|
+
/>
|
|
101
|
+
)
|
|
102
|
+
})}
|
|
105
103
|
</Menu>
|
|
106
104
|
}
|
|
107
105
|
popover={popoverProps}
|
|
@@ -38,7 +38,7 @@ const SearchFacetString = ({facet}: Props) => {
|
|
|
38
38
|
<Button
|
|
39
39
|
fontSize={1}
|
|
40
40
|
iconRight={SelectIcon}
|
|
41
|
-
padding={2}
|
|
41
|
+
padding={2}
|
|
42
42
|
text={operators[selectedOperatorType].label}
|
|
43
43
|
/>
|
|
44
44
|
}
|
|
@@ -47,9 +47,10 @@ const SearchFacetString = ({facet}: Props) => {
|
|
|
47
47
|
<Menu>
|
|
48
48
|
{facet.operatorTypes.map((operatorType, index) => {
|
|
49
49
|
if (operatorType) {
|
|
50
|
+
const selected = operatorType === selectedOperatorType
|
|
50
51
|
return (
|
|
51
52
|
<MenuItem
|
|
52
|
-
disabled={
|
|
53
|
+
disabled={selected}
|
|
53
54
|
fontSize={1}
|
|
54
55
|
key={operatorType}
|
|
55
56
|
onClick={() => handleOperatorItemClick(operatorType)}
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
import React from 'react'
|
|
10
10
|
import {useDispatch} from 'react-redux'
|
|
11
11
|
import Select from 'react-select'
|
|
12
|
+
import {useColorScheme} from 'sanity'
|
|
12
13
|
import {operators} from '../../config/searchFacets'
|
|
13
14
|
import {usePortalPopoverProps} from '../../hooks/usePortalPopoverProps'
|
|
14
15
|
import useTypedSelector from '../../hooks/useTypedSelector'
|
|
@@ -23,6 +24,8 @@ type Props = {
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
const SearchFacetTags = ({facet}: Props) => {
|
|
27
|
+
const {scheme} = useColorScheme()
|
|
28
|
+
|
|
26
29
|
// Redux
|
|
27
30
|
const dispatch = useDispatch()
|
|
28
31
|
const tags = useTypedSelector(state => selectTags(state))
|
|
@@ -60,7 +63,7 @@ const SearchFacetTags = ({facet}: Props) => {
|
|
|
60
63
|
<Button
|
|
61
64
|
fontSize={1}
|
|
62
65
|
iconRight={SelectIcon}
|
|
63
|
-
padding={2}
|
|
66
|
+
padding={2}
|
|
64
67
|
text={operators[selectedOperatorType].label}
|
|
65
68
|
/>
|
|
66
69
|
}
|
|
@@ -69,13 +72,16 @@ const SearchFacetTags = ({facet}: Props) => {
|
|
|
69
72
|
<Menu>
|
|
70
73
|
{facet.operatorTypes.map((operatorType, index) => {
|
|
71
74
|
if (operatorType) {
|
|
75
|
+
const selected = operatorType === selectedOperatorType
|
|
72
76
|
return (
|
|
73
77
|
<MenuItem
|
|
74
|
-
disabled={
|
|
78
|
+
disabled={selected}
|
|
75
79
|
fontSize={1}
|
|
76
80
|
key={operatorType}
|
|
77
81
|
onClick={() => handleOperatorItemClick(operatorType)}
|
|
78
82
|
padding={2}
|
|
83
|
+
space={4}
|
|
84
|
+
style={{minWidth: '150px'}}
|
|
79
85
|
text={operators[operatorType].label}
|
|
80
86
|
/>
|
|
81
87
|
)
|
|
@@ -103,7 +109,7 @@ const SearchFacetTags = ({facet}: Props) => {
|
|
|
103
109
|
onChange={value => handleChange(value as TagSelectOption)}
|
|
104
110
|
options={allTagOptions}
|
|
105
111
|
placeholder={tagsFetching ? 'Loading...' : 'Select...'}
|
|
106
|
-
styles={reactSelectStyles}
|
|
112
|
+
styles={reactSelectStyles(scheme)}
|
|
107
113
|
value={facet?.value}
|
|
108
114
|
/>
|
|
109
115
|
</Box>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {Box, Flex, Inline} from '@sanity/ui'
|
|
1
|
+
import {Box, Flex, Inline, rem, Theme} from '@sanity/ui'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import styled from 'styled-components'
|
|
3
|
+
import styled, {css} from 'styled-components'
|
|
4
4
|
|
|
5
5
|
import useTypedSelector from '../../hooks/useTypedSelector'
|
|
6
6
|
import SearchFacetNumber from '../SearchFacetNumber'
|
|
@@ -12,11 +12,13 @@ type Props = {
|
|
|
12
12
|
layout?: 'inline' | 'stack'
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const StackContainer = styled(Flex)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
const StackContainer = styled(Flex)(({theme}: {theme: Theme}) => {
|
|
16
|
+
return css`
|
|
17
|
+
> * {
|
|
18
|
+
margin-bottom: ${rem(theme.sanity.space[2])};
|
|
19
|
+
}
|
|
20
|
+
`
|
|
21
|
+
})
|
|
20
22
|
|
|
21
23
|
const SearchFacets = (props: Props) => {
|
|
22
24
|
const {layout = 'inline'} = props
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {AddIcon} from '@sanity/icons'
|
|
2
2
|
import {Button, Flex, Menu, MenuButton, MenuDivider, MenuGroup, MenuItem} from '@sanity/ui'
|
|
3
3
|
import {SearchFacetDivider, SearchFacetGroup, SearchFacetInputProps} from '@types'
|
|
4
4
|
import React from 'react'
|
|
@@ -100,8 +100,9 @@ const SearchFacetsControl = () => {
|
|
|
100
100
|
<Button
|
|
101
101
|
disabled={!hasSearchFacets}
|
|
102
102
|
fontSize={1}
|
|
103
|
-
icon={
|
|
103
|
+
icon={AddIcon}
|
|
104
104
|
mode="bleed"
|
|
105
|
+
space={2}
|
|
105
106
|
text="Add filter"
|
|
106
107
|
tone="primary"
|
|
107
108
|
/>
|
|
@@ -1,26 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {Checkbox, Flex, Grid, useMediaIndex} from '@sanity/ui'
|
|
1
|
+
import {Checkbox, Flex, Grid, ThemeColorSchemeKey, useMediaIndex} from '@sanity/ui'
|
|
3
2
|
import React, {MouseEvent} from 'react'
|
|
4
3
|
import {useDispatch} from 'react-redux'
|
|
5
|
-
import styled from 'styled-components'
|
|
4
|
+
import styled, {css} from 'styled-components'
|
|
6
5
|
import {GRID_TEMPLATE_COLUMNS, PANEL_HEIGHT} from '../../constants'
|
|
7
6
|
import {useAssetSourceActions} from '../../contexts/AssetSourceDispatchContext'
|
|
8
7
|
import useTypedSelector from '../../hooks/useTypedSelector'
|
|
9
8
|
import {assetsActions, selectAssetsLength, selectAssetsPickedLength} from '../../modules/assets'
|
|
10
9
|
import TableHeaderItem from '../TableHeaderItem'
|
|
10
|
+
import {useColorScheme} from 'sanity'
|
|
11
|
+
import {getSchemeColor} from '../../utils/getSchemeColor'
|
|
11
12
|
|
|
12
13
|
// TODO: DRY
|
|
13
|
-
const ContextActionContainer = styled(Flex)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
const ContextActionContainer = styled(Flex)(({scheme}: {scheme: ThemeColorSchemeKey}) => {
|
|
15
|
+
return css`
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
@media (hover: hover) and (pointer: fine) {
|
|
18
|
+
&:hover {
|
|
19
|
+
background: ${getSchemeColor(scheme, 'bg')};
|
|
20
|
+
}
|
|
19
21
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
`
|
|
23
|
+
})
|
|
22
24
|
|
|
23
25
|
const TableHeader = () => {
|
|
26
|
+
const {scheme} = useColorScheme()
|
|
27
|
+
|
|
24
28
|
// Redux
|
|
25
29
|
const dispatch = useDispatch()
|
|
26
30
|
const fetching = useTypedSelector(state => state.assets.fetching)
|
|
@@ -50,8 +54,8 @@ const TableHeader = () => {
|
|
|
50
54
|
<Grid
|
|
51
55
|
style={{
|
|
52
56
|
alignItems: 'center',
|
|
53
|
-
background:
|
|
54
|
-
borderBottom:
|
|
57
|
+
background: 'var(--card-bg-color)',
|
|
58
|
+
borderBottom: '1px solid var(--card-border-color)',
|
|
55
59
|
gridColumnGap: mediaIndex < 3 ? 0 : '16px',
|
|
56
60
|
gridTemplateColumns: GRID_TEMPLATE_COLUMNS.LARGE,
|
|
57
61
|
height: mediaIndex < 3 ? 0 : `${PANEL_HEIGHT}px`,
|
|
@@ -71,6 +75,7 @@ const TableHeader = () => {
|
|
|
71
75
|
align="center"
|
|
72
76
|
justify="center"
|
|
73
77
|
onClick={handleContextActionClick}
|
|
78
|
+
scheme={scheme}
|
|
74
79
|
style={{
|
|
75
80
|
height: '100%',
|
|
76
81
|
position: 'relative'
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {hues} from '@sanity/color'
|
|
2
1
|
import {CheckmarkCircleIcon, EditIcon, WarningFilledIcon} from '@sanity/icons'
|
|
3
2
|
import {
|
|
4
3
|
Box,
|
|
@@ -8,6 +7,7 @@ import {
|
|
|
8
7
|
Grid,
|
|
9
8
|
Spinner,
|
|
10
9
|
Text,
|
|
10
|
+
ThemeColorSchemeKey,
|
|
11
11
|
Tooltip,
|
|
12
12
|
useMediaIndex
|
|
13
13
|
} from '@sanity/ui'
|
|
@@ -15,7 +15,7 @@ import formatRelative from 'date-fns/formatRelative'
|
|
|
15
15
|
import filesize from 'filesize'
|
|
16
16
|
import React, {memo, MouseEvent, RefObject, useCallback, useEffect, useRef, useState} from 'react'
|
|
17
17
|
import {useDispatch} from 'react-redux'
|
|
18
|
-
import {WithReferringDocuments} from 'sanity'
|
|
18
|
+
import {WithReferringDocuments, useColorScheme} from 'sanity'
|
|
19
19
|
import styled, {css} from 'styled-components'
|
|
20
20
|
import {GRID_TEMPLATE_COLUMNS} from '../../constants'
|
|
21
21
|
import {useAssetSourceActions} from '../../contexts/AssetSourceDispatchContext'
|
|
@@ -29,6 +29,7 @@ import {isFileAsset, isImageAsset} from '../../utils/typeGuards'
|
|
|
29
29
|
import FileIcon from '../FileIcon'
|
|
30
30
|
import Image from '../Image'
|
|
31
31
|
import {getUniqueDocuments} from '../../utils/getUniqueDocuments'
|
|
32
|
+
import {getSchemeColor} from '../../utils/getSchemeColor'
|
|
32
33
|
|
|
33
34
|
// Duration (ms) to wait before reference counts (and associated listeners) are rendered
|
|
34
35
|
const REFERENCE_COUNT_VISIBILITY_DELAY = 750
|
|
@@ -38,34 +39,46 @@ type Props = {
|
|
|
38
39
|
selected: boolean
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
const ContainerGrid = styled(Grid)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
css`
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
42
|
+
const ContainerGrid = styled(Grid)(
|
|
43
|
+
({
|
|
44
|
+
scheme,
|
|
45
|
+
selected,
|
|
46
|
+
updating
|
|
47
|
+
}: {
|
|
48
|
+
selected?: boolean
|
|
49
|
+
scheme: ThemeColorSchemeKey
|
|
50
|
+
updating?: boolean
|
|
51
|
+
}) => {
|
|
52
|
+
return css`
|
|
53
|
+
align-items: center;
|
|
54
|
+
cursor: ${selected ? 'default' : 'pointer'};
|
|
55
|
+
height: 100%;
|
|
56
|
+
pointer-events: ${updating ? 'none' : 'auto'};
|
|
57
|
+
user-select: none;
|
|
58
|
+
white-space: nowrap;
|
|
59
|
+
|
|
60
|
+
${!updating &&
|
|
61
|
+
css`
|
|
62
|
+
@media (hover: hover) and (pointer: fine) {
|
|
63
|
+
&:hover {
|
|
64
|
+
background: ${getSchemeColor(scheme, 'bg')};
|
|
65
|
+
}
|
|
55
66
|
}
|
|
67
|
+
`}
|
|
68
|
+
`
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
const ContextActionContainer = styled(Flex)(({scheme}: {scheme: ThemeColorSchemeKey}) => {
|
|
73
|
+
return css`
|
|
74
|
+
cursor: pointer;
|
|
75
|
+
@media (hover: hover) and (pointer: fine) {
|
|
76
|
+
&:hover {
|
|
77
|
+
background: ${getSchemeColor(scheme, 'bg2')};
|
|
56
78
|
}
|
|
57
|
-
`}
|
|
58
|
-
`
|
|
59
|
-
|
|
60
|
-
const ContextActionContainer = styled(Flex)`
|
|
61
|
-
cursor: pointer;
|
|
62
|
-
|
|
63
|
-
@media (hover: hover) and (pointer: fine) {
|
|
64
|
-
&:hover {
|
|
65
|
-
background: ${hues.gray?.[900].hex};
|
|
66
79
|
}
|
|
67
|
-
|
|
68
|
-
|
|
80
|
+
`
|
|
81
|
+
})
|
|
69
82
|
|
|
70
83
|
const StyledWarningIcon = styled(WarningFilledIcon)(({theme}) => {
|
|
71
84
|
return {
|
|
@@ -77,6 +90,8 @@ const StyledWarningIcon = styled(WarningFilledIcon)(({theme}) => {
|
|
|
77
90
|
const TableRowAsset = (props: Props) => {
|
|
78
91
|
const {id, selected} = props
|
|
79
92
|
|
|
93
|
+
const {scheme} = useColorScheme()
|
|
94
|
+
|
|
80
95
|
const shiftPressed: RefObject<boolean> = useKeyPress('shift')
|
|
81
96
|
|
|
82
97
|
const [referenceCountVisible, setReferenceCountVisible] = useState(false)
|
|
@@ -100,6 +115,7 @@ const TableRowAsset = (props: Props) => {
|
|
|
100
115
|
(e: MouseEvent<HTMLDivElement>) => {
|
|
101
116
|
e.stopPropagation()
|
|
102
117
|
|
|
118
|
+
if (!asset) return
|
|
103
119
|
if (onSelect) {
|
|
104
120
|
dispatch(dialogActions.showAssetEdit({assetId: asset._id}))
|
|
105
121
|
} else if (shiftPressed.current && !picked) {
|
|
@@ -108,13 +124,14 @@ const TableRowAsset = (props: Props) => {
|
|
|
108
124
|
dispatch(assetsActions.pick({assetId: asset._id, picked: !picked}))
|
|
109
125
|
}
|
|
110
126
|
},
|
|
111
|
-
[asset
|
|
127
|
+
[asset, dispatch, lastPicked, onSelect, picked, shiftPressed]
|
|
112
128
|
)
|
|
113
129
|
|
|
114
130
|
const handleClick = useCallback(
|
|
115
131
|
(e: MouseEvent<HTMLDivElement>) => {
|
|
116
132
|
e.stopPropagation()
|
|
117
133
|
|
|
134
|
+
if (!asset) return
|
|
118
135
|
if (onSelect) {
|
|
119
136
|
onSelect([{kind: 'assetDocumentId', value: asset._id}])
|
|
120
137
|
} else if (shiftPressed.current) {
|
|
@@ -127,7 +144,7 @@ const TableRowAsset = (props: Props) => {
|
|
|
127
144
|
dispatch(dialogActions.showAssetEdit({assetId: asset._id}))
|
|
128
145
|
}
|
|
129
146
|
},
|
|
130
|
-
[asset
|
|
147
|
+
[asset, dispatch, lastPicked, onSelect, picked, shiftPressed]
|
|
131
148
|
)
|
|
132
149
|
|
|
133
150
|
const opacityCell = updating ? 0.5 : 1
|
|
@@ -154,6 +171,7 @@ const TableRowAsset = (props: Props) => {
|
|
|
154
171
|
return (
|
|
155
172
|
<ContainerGrid
|
|
156
173
|
onClick={selected ? undefined : handleClick}
|
|
174
|
+
scheme={scheme}
|
|
157
175
|
selected={selected}
|
|
158
176
|
style={{
|
|
159
177
|
gridColumnGap: mediaIndex < 3 ? 0 : '16px',
|
|
@@ -167,6 +185,7 @@ const TableRowAsset = (props: Props) => {
|
|
|
167
185
|
{/* Picked checkbox */}
|
|
168
186
|
<ContextActionContainer
|
|
169
187
|
onClick={handleContextActionClick}
|
|
188
|
+
scheme={scheme}
|
|
170
189
|
style={{
|
|
171
190
|
alignItems: 'center',
|
|
172
191
|
gridColumn: 1,
|
|
@@ -216,6 +235,7 @@ const TableRowAsset = (props: Props) => {
|
|
|
216
235
|
{isImageAsset(asset) && (
|
|
217
236
|
<Image
|
|
218
237
|
draggable={false}
|
|
238
|
+
scheme={scheme}
|
|
219
239
|
showCheckerboard={!isOpaque}
|
|
220
240
|
src={imageDprUrl(asset, {height: 100, width: 100})}
|
|
221
241
|
/>
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {hues} from '@sanity/color'
|
|
2
1
|
import {CloseIcon} from '@sanity/icons'
|
|
3
2
|
import {Box, Button, Flex, Grid, Stack, Text, useMediaIndex} 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 {GRID_TEMPLATE_COLUMNS} from '../../constants'
|
|
8
8
|
import useTypedSelector from '../../hooks/useTypedSelector'
|
|
9
9
|
import {selectUploadById, uploadsActions} from '../../modules/uploads'
|
|
10
|
+
import {getSchemeColor} from '../../utils/getSchemeColor'
|
|
10
11
|
import FileIcon from '../FileIcon'
|
|
11
12
|
import Image from '../Image'
|
|
12
13
|
|
|
@@ -17,6 +18,8 @@ type Props = {
|
|
|
17
18
|
const TableRowUpload = (props: Props) => {
|
|
18
19
|
const {id} = props
|
|
19
20
|
|
|
21
|
+
const {scheme} = useColorScheme()
|
|
22
|
+
|
|
20
23
|
// Redux
|
|
21
24
|
const dispatch = useDispatch()
|
|
22
25
|
const item = useTypedSelector(state => selectUploadById(state, id))
|
|
@@ -54,7 +57,7 @@ const TableRowUpload = (props: Props) => {
|
|
|
54
57
|
<Grid
|
|
55
58
|
style={{
|
|
56
59
|
alignItems: 'center',
|
|
57
|
-
background:
|
|
60
|
+
background: getSchemeColor(scheme, 'bg'),
|
|
58
61
|
gridColumnGap: mediaIndex < 3 ? 0 : '16px',
|
|
59
62
|
gridRowGap: 0,
|
|
60
63
|
gridTemplateColumns:
|
|
@@ -67,7 +70,7 @@ const TableRowUpload = (props: Props) => {
|
|
|
67
70
|
{/* Progress bar */}
|
|
68
71
|
<div
|
|
69
72
|
style={{
|
|
70
|
-
background:
|
|
73
|
+
background: 'var(--card-fg-color)',
|
|
71
74
|
bottom: 0,
|
|
72
75
|
height: '1px',
|
|
73
76
|
left: 0,
|
|
@@ -91,7 +94,7 @@ const TableRowUpload = (props: Props) => {
|
|
|
91
94
|
>
|
|
92
95
|
<Box style={{height: '100%', position: 'relative'}}>
|
|
93
96
|
{item.assetType === 'image' && item?.objectUrl && (
|
|
94
|
-
<Image draggable={false} src={item.objectUrl} style={{opacity: 0.25}} />
|
|
97
|
+
<Image draggable={false} scheme={scheme} src={item.objectUrl} style={{opacity: 0.25}} />
|
|
95
98
|
)}
|
|
96
99
|
|
|
97
100
|
{item.assetType === 'file' && (
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {hues} from '@sanity/color'
|
|
2
1
|
import {ArrowDownIcon, ArrowUpIcon, CloseIcon, EditIcon, SearchIcon, TrashIcon} from '@sanity/icons'
|
|
3
2
|
import {Box, Button, Container, Flex, Text, Tooltip} from '@sanity/ui'
|
|
4
3
|
import {SearchFacetInputSearchableProps, TagActions, TagItem} from '@types'
|
|
@@ -126,9 +125,10 @@ const Tag = (props: Props) => {
|
|
|
126
125
|
<TagContainer align="center" flex={1} justify="space-between" paddingLeft={3}>
|
|
127
126
|
<Box flex={1}>
|
|
128
127
|
<Text
|
|
128
|
+
muted
|
|
129
129
|
size={1}
|
|
130
130
|
style={{
|
|
131
|
-
|
|
131
|
+
opacity: tag?.updating ? 0.5 : 1.0,
|
|
132
132
|
userSelect: 'none'
|
|
133
133
|
}}
|
|
134
134
|
textOverflow="ellipsis"
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {black, hues} from '@sanity/color'
|
|
2
1
|
import {Box, Flex, Text} from '@sanity/ui'
|
|
3
2
|
import React from 'react'
|
|
4
3
|
import useTypedSelector from '../../hooks/useTypedSelector'
|
|
@@ -17,24 +16,16 @@ const TagView = () => {
|
|
|
17
16
|
const hasPicked = !!(numPickedAssets > 0)
|
|
18
17
|
|
|
19
18
|
return (
|
|
20
|
-
<Flex
|
|
21
|
-
direction="column"
|
|
22
|
-
flex={1}
|
|
23
|
-
style={{
|
|
24
|
-
// background: hues.gray[950].hex,
|
|
25
|
-
background: black.hex,
|
|
26
|
-
height: '100%'
|
|
27
|
-
}}
|
|
28
|
-
>
|
|
19
|
+
<Flex direction="column" flex={1} height="fill">
|
|
29
20
|
<TagViewHeader
|
|
30
|
-
allowCreate
|
|
21
|
+
allowCreate
|
|
31
22
|
light={hasPicked}
|
|
32
23
|
title={hasPicked ? 'Tags (in selection)' : 'Tags'}
|
|
33
24
|
/>
|
|
34
25
|
|
|
35
26
|
{fetchComplete && !hasTags && (
|
|
36
27
|
<Box padding={3}>
|
|
37
|
-
<Text size={1}
|
|
28
|
+
<Text muted size={1}>
|
|
38
29
|
<em>No tags</em>
|
|
39
30
|
</Text>
|
|
40
31
|
</Box>
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {black, hues} from '@sanity/color'
|
|
2
1
|
import {ComposeIcon} from '@sanity/icons'
|
|
3
2
|
import {Box, Button, Flex, Inline, Label} from '@sanity/ui'
|
|
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 {DIALOG_ACTIONS} from '../../modules/dialog/actions'
|
|
9
|
+
import {getSchemeColor} from '../../utils/getSchemeColor'
|
|
9
10
|
|
|
10
11
|
type Props = {
|
|
11
12
|
allowCreate?: boolean
|
|
@@ -14,6 +15,8 @@ type Props = {
|
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
const TagViewHeader = ({allowCreate, light, title}: Props) => {
|
|
18
|
+
const {scheme} = useColorScheme()
|
|
19
|
+
|
|
17
20
|
const dispatch = useDispatch()
|
|
18
21
|
const tagsCreating = useTypedSelector(state => state.tags.creating)
|
|
19
22
|
const tagsFetching = useTypedSelector(state => state.tags.fetching)
|
|
@@ -29,15 +32,14 @@ const TagViewHeader = ({allowCreate, light, title}: Props) => {
|
|
|
29
32
|
justify="space-between"
|
|
30
33
|
paddingLeft={3}
|
|
31
34
|
style={{
|
|
32
|
-
background: light ?
|
|
33
|
-
borderBottom:
|
|
35
|
+
background: light ? getSchemeColor(scheme, 'bg') : 'inherit',
|
|
36
|
+
borderBottom: '1px solid var(--card-border-color)',
|
|
34
37
|
flexShrink: 0,
|
|
35
38
|
height: `${PANEL_HEIGHT}px`
|
|
36
39
|
}}
|
|
37
40
|
>
|
|
38
41
|
<Inline space={2}>
|
|
39
42
|
<Label size={0}>{title}</Label>
|
|
40
|
-
|
|
41
43
|
{tagsFetching && (
|
|
42
44
|
<Label size={0} style={{opacity: 0.3}}>
|
|
43
45
|
Loading...
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {hues} from '@sanity/color'
|
|
2
1
|
import {Box} from '@sanity/ui'
|
|
3
2
|
import React from 'react'
|
|
4
3
|
import {TAGS_PANEL_WIDTH} from '../../constants'
|
|
@@ -22,7 +21,7 @@ const TagsPanel = () => {
|
|
|
22
21
|
<Box
|
|
23
22
|
className="media__custom-scrollbar"
|
|
24
23
|
style={{
|
|
25
|
-
borderLeft:
|
|
24
|
+
borderLeft: '1px solid var(--card-border-color)',
|
|
26
25
|
height: '100%',
|
|
27
26
|
overflowX: 'hidden',
|
|
28
27
|
overflowY: 'auto',
|
|
@@ -86,7 +86,7 @@ export const initialState = {
|
|
|
86
86
|
title: getOrderTitle(defaultOrder.field, defaultOrder.direction)
|
|
87
87
|
},
|
|
88
88
|
pageIndex: 0,
|
|
89
|
-
pageSize:
|
|
89
|
+
pageSize: 100,
|
|
90
90
|
// totalCount: -1,
|
|
91
91
|
view: 'grid'
|
|
92
92
|
} as AssetsReducerState
|
|
@@ -791,7 +791,10 @@ export const selectAssetById = createSelector(
|
|
|
791
791
|
(state: RootReducerState) => state.assets.byIds,
|
|
792
792
|
(_state: RootReducerState, assetId: string) => assetId
|
|
793
793
|
],
|
|
794
|
-
(byIds, assetId) =>
|
|
794
|
+
(byIds, assetId) => {
|
|
795
|
+
const asset = byIds[assetId]
|
|
796
|
+
return asset ? asset : undefined
|
|
797
|
+
}
|
|
795
798
|
)
|
|
796
799
|
|
|
797
800
|
export const selectAssets: Selector<RootReducerState, AssetItem[]> = createSelector(
|