sanity-plugin-media 2.3.2 → 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/LICENSE +1 -1
- package/dist/index.d.mts +24 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.js +4258 -10783
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5373 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +23 -29
- package/src/components/AssetGridVirtualized/index.tsx +4 -3
- package/src/components/AssetMetadata/index.tsx +2 -2
- package/src/components/AssetTableVirtualized/index.tsx +2 -2
- package/src/components/Browser/index.tsx +2 -2
- package/src/components/ButtonAssetCopy/index.tsx +1 -1
- package/src/components/CardAsset/index.tsx +19 -15
- package/src/components/CardUpload/index.tsx +1 -1
- package/src/components/DebugControls/index.tsx +1 -1
- package/src/components/Dialog/index.tsx +1 -1
- package/src/components/DialogAssetEdit/index.tsx +3 -3
- package/src/components/DialogConfirm/index.tsx +2 -2
- package/src/components/DialogSearchFacets/index.tsx +2 -2
- package/src/components/DialogTagCreate/index.tsx +3 -3
- package/src/components/DialogTagEdit/index.tsx +3 -3
- package/src/components/DialogTags/index.tsx +2 -2
- 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/FileIcon/index.tsx +3 -3
- package/src/components/FormBuilderTool/index.tsx +2 -2
- package/src/components/FormFieldInputLabel/index.tsx +1 -1
- package/src/components/FormFieldInputText/index.tsx +1 -1
- package/src/components/FormFieldInputTextarea/index.tsx +1 -1
- package/src/components/FormSubmitButton/index.tsx +1 -1
- package/src/components/Image/index.tsx +3 -3
- package/src/components/Items/index.tsx +1 -1
- package/src/components/ReduxProvider/index.tsx +4 -4
- package/src/components/SearchFacet/index.tsx +10 -5
- package/src/components/SearchFacetNumber/index.tsx +2 -2
- package/src/components/SearchFacetSelect/index.tsx +2 -2
- package/src/components/SearchFacetString/index.tsx +2 -2
- package/src/components/SearchFacetTags/index.tsx +2 -2
- package/src/components/SearchFacets/index.tsx +2 -2
- package/src/components/SearchFacetsControl/index.tsx +1 -1
- package/src/components/TableHeader/index.tsx +16 -12
- package/src/components/TableRowAsset/index.tsx +15 -3
- package/src/components/Tag/index.tsx +3 -3
- package/src/components/TagsVirtualized/index.tsx +2 -2
- package/src/components/TextInputNumber/index.tsx +1 -1
- package/src/components/TextInputSearch/index.tsx +1 -1
- package/src/components/UploadDropzone/index.tsx +3 -3
- package/src/config/searchFacets.ts +2 -2
- package/src/constants.ts +6 -1
- package/src/contexts/AssetSourceDispatchContext.tsx +1 -1
- package/src/contexts/DropzoneDispatchContext.tsx +1 -1
- package/src/contexts/ToolOptionsContext.tsx +3 -3
- package/src/hooks/useKeyPress.ts +1 -1
- package/src/hooks/useOnScreen.ts +1 -1
- package/src/hooks/usePortalPopoverProps.ts +1 -1
- package/src/hooks/useTypedSelector.ts +2 -2
- package/src/index.ts +1 -1
- package/src/modules/assets/actions.ts +1 -1
- package/src/modules/assets/index.ts +4 -4
- package/src/modules/debug/index.ts +1 -1
- package/src/modules/dialog/index.ts +2 -2
- package/src/modules/index.ts +3 -3
- package/src/modules/notifications/index.ts +2 -2
- package/src/modules/search/index.ts +2 -2
- package/src/modules/selectors.ts +2 -2
- package/src/modules/tags/index.ts +3 -3
- package/src/modules/uploads/index.ts +3 -3
- package/src/operators/checkTagName.ts +1 -1
- package/src/operators/debugThrottle.ts +1 -1
- package/src/plugin.tsx +5 -3
- package/src/styled/react-select/creatable.tsx +11 -3
- package/src/styled/react-select/single.tsx +10 -3
- package/src/types/index.ts +2 -2
- 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/getSchemeColor.ts +1 -1
- package/src/utils/getTagSelectOptions.ts +1 -1
- package/src/utils/getUniqueDocuments.ts +1 -1
- package/src/utils/imageDprUrl.ts +1 -1
- package/src/utils/typeGuards.ts +1 -1
- package/src/utils/uploadSanityAsset.ts +1 -1
- package/dist/index.cjs.mjs +0 -5
- package/dist/index.esm.js +0 -11850
- package/dist/index.esm.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {Checkbox, Flex, Grid, ThemeColorSchemeKey, useMediaIndex} from '@sanity/ui'
|
|
2
|
-
import
|
|
1
|
+
import {Checkbox, Flex, Grid, type ThemeColorSchemeKey, useMediaIndex} from '@sanity/ui'
|
|
2
|
+
import {type MouseEvent} from 'react'
|
|
3
3
|
import {useDispatch} from 'react-redux'
|
|
4
|
-
import styled,
|
|
4
|
+
import {styled, css} from 'styled-components'
|
|
5
5
|
import {GRID_TEMPLATE_COLUMNS, PANEL_HEIGHT} from '../../constants'
|
|
6
6
|
import {useAssetSourceActions} from '../../contexts/AssetSourceDispatchContext'
|
|
7
7
|
import useTypedSelector from '../../hooks/useTypedSelector'
|
|
@@ -11,16 +11,19 @@ import {useColorScheme} from 'sanity'
|
|
|
11
11
|
import {getSchemeColor} from '../../utils/getSchemeColor'
|
|
12
12
|
|
|
13
13
|
// TODO: DRY
|
|
14
|
-
const ContextActionContainer = styled(Flex)(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
const ContextActionContainer = styled(Flex)(
|
|
15
|
+
// @ts-expect-error - fix typings later
|
|
16
|
+
({scheme}: {scheme: ThemeColorSchemeKey}) => {
|
|
17
|
+
return css`
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
@media (hover: hover) and (pointer: fine) {
|
|
20
|
+
&:hover {
|
|
21
|
+
background: ${getSchemeColor(scheme, 'bg')};
|
|
22
|
+
}
|
|
20
23
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
`
|
|
25
|
+
}
|
|
26
|
+
)
|
|
24
27
|
|
|
25
28
|
const TableHeader = () => {
|
|
26
29
|
const {scheme} = useColorScheme()
|
|
@@ -75,6 +78,7 @@ const TableHeader = () => {
|
|
|
75
78
|
align="center"
|
|
76
79
|
justify="center"
|
|
77
80
|
onClick={handleContextActionClick}
|
|
81
|
+
// @ts-expect-error - fix typings later
|
|
78
82
|
scheme={scheme}
|
|
79
83
|
style={{
|
|
80
84
|
height: '100%',
|
|
@@ -7,16 +7,24 @@ import {
|
|
|
7
7
|
Grid,
|
|
8
8
|
Spinner,
|
|
9
9
|
Text,
|
|
10
|
-
ThemeColorSchemeKey,
|
|
10
|
+
type ThemeColorSchemeKey,
|
|
11
11
|
Tooltip,
|
|
12
12
|
useMediaIndex
|
|
13
13
|
} from '@sanity/ui'
|
|
14
14
|
import formatRelative from 'date-fns/formatRelative'
|
|
15
15
|
import filesize from 'filesize'
|
|
16
|
-
import
|
|
16
|
+
import {
|
|
17
|
+
memo,
|
|
18
|
+
type MouseEvent,
|
|
19
|
+
type RefObject,
|
|
20
|
+
useCallback,
|
|
21
|
+
useEffect,
|
|
22
|
+
useRef,
|
|
23
|
+
useState
|
|
24
|
+
} from 'react'
|
|
17
25
|
import {useDispatch} from 'react-redux'
|
|
18
26
|
import {WithReferringDocuments, useColorScheme} from 'sanity'
|
|
19
|
-
import styled,
|
|
27
|
+
import {styled, css} from 'styled-components'
|
|
20
28
|
import {GRID_TEMPLATE_COLUMNS} from '../../constants'
|
|
21
29
|
import {useAssetSourceActions} from '../../contexts/AssetSourceDispatchContext'
|
|
22
30
|
import useKeyPress from '../../hooks/useKeyPress'
|
|
@@ -40,6 +48,7 @@ type Props = {
|
|
|
40
48
|
}
|
|
41
49
|
|
|
42
50
|
const ContainerGrid = styled(Grid)(
|
|
51
|
+
// @ts-expect-error - fix typings later
|
|
43
52
|
({
|
|
44
53
|
scheme,
|
|
45
54
|
selected,
|
|
@@ -69,6 +78,7 @@ const ContainerGrid = styled(Grid)(
|
|
|
69
78
|
}
|
|
70
79
|
)
|
|
71
80
|
|
|
81
|
+
// @ts-expect-error - fix typings later
|
|
72
82
|
const ContextActionContainer = styled(Flex)(({scheme}: {scheme: ThemeColorSchemeKey}) => {
|
|
73
83
|
return css`
|
|
74
84
|
cursor: pointer;
|
|
@@ -171,6 +181,7 @@ const TableRowAsset = (props: Props) => {
|
|
|
171
181
|
return (
|
|
172
182
|
<ContainerGrid
|
|
173
183
|
onClick={selected ? undefined : handleClick}
|
|
184
|
+
// @ts-expect-error - fix typings later
|
|
174
185
|
scheme={scheme}
|
|
175
186
|
selected={selected}
|
|
176
187
|
style={{
|
|
@@ -185,6 +196,7 @@ const TableRowAsset = (props: Props) => {
|
|
|
185
196
|
{/* Picked checkbox */}
|
|
186
197
|
<ContextActionContainer
|
|
187
198
|
onClick={handleContextActionClick}
|
|
199
|
+
// @ts-expect-error - fix typings later
|
|
188
200
|
scheme={scheme}
|
|
189
201
|
style={{
|
|
190
202
|
alignItems: 'center',
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {ArrowDownIcon, ArrowUpIcon, CloseIcon, EditIcon, SearchIcon, TrashIcon} from '@sanity/icons'
|
|
2
2
|
import {Box, Button, Container, Flex, Text, Tooltip} from '@sanity/ui'
|
|
3
|
-
import {SearchFacetInputSearchableProps, TagActions, TagItem} from '
|
|
4
|
-
import
|
|
3
|
+
import type {SearchFacetInputSearchableProps, TagActions, TagItem} from '../../types'
|
|
4
|
+
import {type ReactNode} from 'react'
|
|
5
5
|
import {useDispatch} from 'react-redux'
|
|
6
|
-
import styled from 'styled-components'
|
|
6
|
+
import {styled} from 'styled-components'
|
|
7
7
|
import {inputs} from '../../config/searchFacets'
|
|
8
8
|
import {PANEL_HEIGHT} from '../../constants'
|
|
9
9
|
import useTypedSelector from '../../hooks/useTypedSelector'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {Flex, Label} from '@sanity/ui'
|
|
2
|
-
import {TagActions, TagItem} from '
|
|
3
|
-
import
|
|
2
|
+
import type {TagActions, TagItem} from '../../types'
|
|
3
|
+
import {memo, useState} from 'react'
|
|
4
4
|
import {Virtuoso} from 'react-virtuoso'
|
|
5
5
|
import {PANEL_HEIGHT} from '../../constants'
|
|
6
6
|
import useTypedSelector from '../../hooks/useTypedSelector'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {CloseIcon, SearchIcon} from '@sanity/icons'
|
|
2
2
|
import {Box, Flex, TextInput} from '@sanity/ui'
|
|
3
|
-
import
|
|
3
|
+
import {type ChangeEvent} from 'react'
|
|
4
4
|
import {useDispatch} from 'react-redux'
|
|
5
5
|
import useTypedSelector from '../../hooks/useTypedSelector'
|
|
6
6
|
import {searchActions} from '../../modules/search'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {white} from '@sanity/color'
|
|
2
2
|
import {Flex, Text} from '@sanity/ui'
|
|
3
|
-
import
|
|
4
|
-
import {DropEvent, DropzoneOptions, useDropzone} from 'react-dropzone'
|
|
3
|
+
import {type ReactNode} from 'react'
|
|
4
|
+
import {type DropEvent, type DropzoneOptions, useDropzone} from 'react-dropzone'
|
|
5
5
|
import {useDispatch} from 'react-redux'
|
|
6
|
-
import styled from 'styled-components'
|
|
6
|
+
import {styled} from 'styled-components'
|
|
7
7
|
import {useAssetSourceActions} from '../../contexts/AssetSourceDispatchContext'
|
|
8
8
|
import {DropzoneDispatchProvider} from '../../contexts/DropzoneDispatchContext'
|
|
9
9
|
import useTypedSelector from '../../hooks/useTypedSelector'
|
package/src/constants.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
|
+
SearchFacetInputProps,
|
|
3
|
+
SearchFacetDivider,
|
|
4
|
+
SearchFacetGroup,
|
|
5
|
+
OrderDirection
|
|
6
|
+
} from './types'
|
|
2
7
|
import {divider, inputs} from './config/searchFacets'
|
|
3
8
|
|
|
4
9
|
// Sort order dropdown options
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {MediaToolOptions} from '
|
|
2
|
-
import
|
|
3
|
-
import {DropzoneOptions} from 'react-dropzone'
|
|
1
|
+
import type {MediaToolOptions} from '../types'
|
|
2
|
+
import {type PropsWithChildren, createContext, useContext, useMemo} from 'react'
|
|
3
|
+
import type {DropzoneOptions} from 'react-dropzone'
|
|
4
4
|
|
|
5
5
|
type ContextProps = {
|
|
6
6
|
dropzone: Pick<DropzoneOptions, 'maxSize'>
|
package/src/hooks/useKeyPress.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import isHotkey from 'is-hotkey'
|
|
2
|
-
import {RefObject, useCallback, useEffect, useRef} from 'react'
|
|
2
|
+
import {type RefObject, useCallback, useEffect, useRef} from 'react'
|
|
3
3
|
|
|
4
4
|
const useKeyPress = (hotkey: string, onPress?: () => void): RefObject<boolean> => {
|
|
5
5
|
const keyPressed = useRef(false)
|
package/src/hooks/useOnScreen.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {TypedUseSelectorHook, useSelector} from 'react-redux'
|
|
1
|
+
import {type TypedUseSelectorHook, useSelector} from 'react-redux'
|
|
2
2
|
|
|
3
|
-
import {RootReducerState} from '../modules/types'
|
|
3
|
+
import type {RootReducerState} from '../modules/types'
|
|
4
4
|
|
|
5
5
|
const useTypedSelector: TypedUseSelectorHook<RootReducerState> = useSelector
|
|
6
6
|
|
package/src/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export {media, mediaAssetSource} from './plugin'
|
|
2
|
-
export type {MediaToolOptions} from '
|
|
2
|
+
export type {MediaToolOptions} from './types'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {createSelector, createSlice, PayloadAction} from '@reduxjs/toolkit'
|
|
1
|
+
import {createSelector, createSlice, type PayloadAction} from '@reduxjs/toolkit'
|
|
2
2
|
import type {ClientError, Patch, Transaction} from '@sanity/client'
|
|
3
|
-
import {
|
|
3
|
+
import type {
|
|
4
4
|
Asset,
|
|
5
5
|
AssetItem,
|
|
6
6
|
AssetType,
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
Order,
|
|
11
11
|
OrderDirection,
|
|
12
12
|
Tag
|
|
13
|
-
} from '
|
|
13
|
+
} from '../../types'
|
|
14
14
|
import groq from 'groq'
|
|
15
15
|
import {nanoid} from 'nanoid'
|
|
16
|
-
import {Selector} from 'react-redux'
|
|
16
|
+
import type {Selector} from 'react-redux'
|
|
17
17
|
import {ofType} from 'redux-observable'
|
|
18
18
|
import {empty, from, of} from 'rxjs'
|
|
19
19
|
import {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {createSlice, PayloadAction} from '@reduxjs/toolkit'
|
|
2
|
-
import {AssetItem, Dialog, MyEpic, Tag} from '
|
|
1
|
+
import {createSlice, type PayloadAction} from '@reduxjs/toolkit'
|
|
2
|
+
import type {AssetItem, Dialog, MyEpic, Tag} from '../../types'
|
|
3
3
|
import pluralize from 'pluralize'
|
|
4
4
|
import {ofType} from 'redux-observable'
|
|
5
5
|
import {empty, of} from 'rxjs'
|
package/src/modules/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {PayloadAction, createSlice} from '@reduxjs/toolkit'
|
|
2
|
-
import type {ImageAsset, MyEpic} from '
|
|
1
|
+
import {type PayloadAction, createSlice} from '@reduxjs/toolkit'
|
|
2
|
+
import type {ImageAsset, MyEpic} from '../../types'
|
|
3
3
|
import pluralize from 'pluralize'
|
|
4
4
|
import {ofType} from 'redux-observable'
|
|
5
5
|
import {of} from 'rxjs'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {PayloadAction, createSelector, createSlice} from '@reduxjs/toolkit'
|
|
2
|
-
import type {MyEpic, SearchFacetInputProps, SearchFacetOperatorType, WithId} from '
|
|
1
|
+
import {type PayloadAction, createSelector, createSlice} from '@reduxjs/toolkit'
|
|
2
|
+
import type {MyEpic, SearchFacetInputProps, SearchFacetOperatorType, WithId} from '../../types'
|
|
3
3
|
import {empty, of} from 'rxjs'
|
|
4
4
|
import {filter, mergeMap, withLatestFrom} from 'rxjs/operators'
|
|
5
5
|
import {uuid} from '@sanity/uuid'
|
package/src/modules/selectors.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {createSelector} from '@reduxjs/toolkit'
|
|
2
|
-
import {CardAssetData, CardUploadData} from '
|
|
2
|
+
import type {CardAssetData, CardUploadData} from '../types'
|
|
3
3
|
|
|
4
|
-
import {RootReducerState} from './types'
|
|
4
|
+
import type {RootReducerState} from './types'
|
|
5
5
|
|
|
6
6
|
export const selectCombinedItems = createSelector(
|
|
7
7
|
[
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {createSelector, createSlice, PayloadAction} from '@reduxjs/toolkit'
|
|
1
|
+
import {createSelector, createSlice, type PayloadAction} from '@reduxjs/toolkit'
|
|
2
2
|
import type {ClientError, Transaction} from '@sanity/client'
|
|
3
|
-
import type {Asset, HttpError, MyEpic, TagSelectOption, Tag, TagItem} from '
|
|
3
|
+
import type {Asset, HttpError, MyEpic, TagSelectOption, Tag, TagItem} from '../../types'
|
|
4
4
|
import groq from 'groq'
|
|
5
|
-
import {Selector} from 'react-redux'
|
|
5
|
+
import type {Selector} from 'react-redux'
|
|
6
6
|
import {ofType} from 'redux-observable'
|
|
7
7
|
import {from, Observable, of} from 'rxjs'
|
|
8
8
|
import {bufferTime, catchError, filter, mergeMap, switchMap, withLatestFrom} from 'rxjs/operators'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {createSelector, createSlice, PayloadAction} from '@reduxjs/toolkit'
|
|
1
|
+
import {createSelector, createSlice, type PayloadAction} from '@reduxjs/toolkit'
|
|
2
2
|
import type {ClientError, SanityAssetDocument, SanityImageAssetDocument} from '@sanity/client'
|
|
3
|
-
import type {HttpError, MyEpic, SanityUploadProgressEvent, UploadItem} from '
|
|
3
|
+
import type {HttpError, MyEpic, SanityUploadProgressEvent, UploadItem} from '../../types'
|
|
4
4
|
import groq from 'groq'
|
|
5
|
-
import {Selector} from 'react-redux'
|
|
5
|
+
import type {Selector} from 'react-redux'
|
|
6
6
|
import {empty, merge, of} from 'rxjs'
|
|
7
7
|
import {catchError, delay, filter, mergeMap, takeUntil, withLatestFrom} from 'rxjs/operators'
|
|
8
8
|
import constructFilter from '../../utils/constructFilter'
|
package/src/plugin.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {AssetSource, Tool as SanityTool, definePlugin} from 'sanity'
|
|
2
|
+
import {type AssetSource, type Tool as SanityTool, definePlugin} from 'sanity'
|
|
3
3
|
import {ImageIcon} from '@sanity/icons'
|
|
4
4
|
import FormBuilderTool from './components/FormBuilderTool'
|
|
5
5
|
import Tool from './components/Tool'
|
|
6
6
|
import mediaTag from './schemas/tag'
|
|
7
|
-
import {MediaToolOptions} from '
|
|
7
|
+
import type {MediaToolOptions} from './types'
|
|
8
8
|
import {ToolOptionsProvider} from './contexts/ToolOptionsContext'
|
|
9
9
|
|
|
10
10
|
const plugin = {
|
|
@@ -20,7 +20,9 @@ export const mediaAssetSource = {
|
|
|
20
20
|
|
|
21
21
|
const tool = {
|
|
22
22
|
...plugin,
|
|
23
|
-
component: Tool
|
|
23
|
+
component: Tool,
|
|
24
|
+
// @ts-expect-error TS doesn't know about this internal field see https://github.com/sanity-io/sanity/pull/7980
|
|
25
|
+
__internalApplicationType: 'sanity/media'
|
|
24
26
|
} satisfies SanityTool
|
|
25
27
|
|
|
26
28
|
export const media = definePlugin<MediaToolOptions | void>(options => ({
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {AddIcon, ChevronDownIcon, CloseIcon} from '@sanity/icons'
|
|
2
|
-
import {Box, Card, Flex, rem, studioTheme, Text, ThemeColorSchemeKey} from '@sanity/ui'
|
|
3
|
-
import
|
|
4
|
-
import {components, StylesConfig} from 'react-select'
|
|
2
|
+
import {Box, Card, Flex, rem, studioTheme, Text, type ThemeColorSchemeKey} from '@sanity/ui'
|
|
3
|
+
import {components, type StylesConfig} from 'react-select'
|
|
5
4
|
import {Virtuoso} from 'react-virtuoso'
|
|
6
5
|
import {getSchemeColor} from '../../utils/getSchemeColor'
|
|
7
6
|
|
|
@@ -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,7 +1,6 @@
|
|
|
1
1
|
import {CloseIcon} from '@sanity/icons'
|
|
2
|
-
import {Box, Card, rem, studioTheme, Text, ThemeColorSchemeKey} from '@sanity/ui'
|
|
3
|
-
import
|
|
4
|
-
import {components, StylesConfig} from 'react-select'
|
|
2
|
+
import {Box, Card, rem, studioTheme, Text, type ThemeColorSchemeKey} from '@sanity/ui'
|
|
3
|
+
import {components, type StylesConfig} from 'react-select'
|
|
5
4
|
import {Virtuoso} from 'react-virtuoso'
|
|
6
5
|
import {getSchemeColor} from '../../utils/getSchemeColor'
|
|
7
6
|
|
|
@@ -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/types/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {AnyAction} from '@reduxjs/toolkit'
|
|
1
|
+
import type {AnyAction} from '@reduxjs/toolkit'
|
|
2
2
|
import type {
|
|
3
3
|
SanityAssetDocument,
|
|
4
4
|
SanityClient,
|
|
@@ -8,7 +8,7 @@ import type {
|
|
|
8
8
|
import type {Epic} from 'redux-observable'
|
|
9
9
|
import * as z from 'zod'
|
|
10
10
|
import {assetFormSchema, tagFormSchema, tagOptionSchema} from '../formSchema'
|
|
11
|
-
import {RootReducerState} from '../modules/types'
|
|
11
|
+
import type {RootReducerState} from '../modules/types'
|
|
12
12
|
|
|
13
13
|
export type MediaToolOptions = {
|
|
14
14
|
maximumUploadSize?: number
|
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 {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'
|