sanity-plugin-media 2.3.1 → 2.4.0
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/README.md +23 -0
- package/dist/index.d.mts +19 -0
- package/dist/index.d.ts +3 -5
- package/dist/index.js +4181 -10697
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5341 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +18 -24
- package/src/components/AssetGridVirtualized/index.tsx +2 -2
- 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 +3 -3
- package/src/components/DebugControls/index.tsx +1 -1
- package/src/components/Dialog/index.tsx +1 -1
- package/src/components/DialogAssetEdit/index.tsx +22 -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 +2 -2
- package/src/components/FormBuilderTool/index.tsx +2 -2
- 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 +2 -2
- package/src/components/Items/index.tsx +1 -1
- package/src/components/ReduxProvider/index.tsx +4 -4
- package/src/components/SearchFacet/index.tsx +3 -3
- package/src/components/SearchFacetNumber/index.tsx +1 -1
- package/src/components/SearchFacetSelect/index.tsx +1 -1
- package/src/components/SearchFacetString/index.tsx +2 -2
- package/src/components/SearchFacetTags/index.tsx +1 -1
- package/src/components/SearchFacets/index.tsx +1 -1
- package/src/components/SearchFacetsControl/index.tsx +9 -1
- package/src/components/TableHeader/index.tsx +2 -2
- package/src/components/TableRowAsset/index.tsx +10 -2
- package/src/components/Tag/index.tsx +2 -2
- 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 +2 -2
- package/src/config/searchFacets.ts +11 -1
- package/src/constants.ts +7 -1
- package/src/contexts/AssetSourceDispatchContext.tsx +1 -1
- package/src/contexts/DropzoneDispatchContext.tsx +1 -1
- package/src/contexts/ToolOptionsContext.tsx +25 -7
- package/src/formSchema/index.ts +1 -0
- 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/modules/assets/actions.ts +1 -1
- package/src/modules/assets/index.ts +7 -3
- 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 +1 -1
- package/src/modules/search/index.ts +1 -1
- package/src/modules/selectors.ts +2 -2
- package/src/modules/tags/index.ts +2 -2
- package/src/modules/uploads/index.ts +2 -2
- package/src/operators/debugThrottle.ts +1 -1
- package/src/plugin.tsx +5 -3
- package/src/styled/react-select/creatable.tsx +2 -2
- package/src/styled/react-select/single.tsx +2 -2
- package/src/types/index.ts +8 -2
- package/src/utils/blocksToText.ts +1 -1
- package/src/utils/constructFilter.ts +2 -2
- 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 -11810
- package/dist/index.esm.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sanity-plugin-media",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "This version of `sanity-plugin-media` is for Sanity Studio V3.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -20,25 +20,20 @@
|
|
|
20
20
|
"type": "git",
|
|
21
21
|
"url": "git@github.com:sanity-io/sanity-plugin-media.git"
|
|
22
22
|
},
|
|
23
|
+
"type": "commonjs",
|
|
23
24
|
"license": "MIT",
|
|
24
25
|
"author": "Sanity.io <hello@sanity.io>",
|
|
25
26
|
"exports": {
|
|
26
27
|
".": {
|
|
27
|
-
"types": "./dist/index.d.ts",
|
|
28
28
|
"source": "./src/index.ts",
|
|
29
29
|
"require": "./dist/index.js",
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
"import": "./dist/index.cjs.mjs"
|
|
33
|
-
},
|
|
34
|
-
"import": "./dist/index.esm.js",
|
|
35
|
-
"default": "./dist/index.esm.js"
|
|
30
|
+
"import": "./dist/index.mjs",
|
|
31
|
+
"default": "./dist/index.mjs"
|
|
36
32
|
},
|
|
37
33
|
"./package.json": "./package.json"
|
|
38
34
|
},
|
|
39
35
|
"main": "./dist/index.js",
|
|
40
|
-
"module": "./dist/index.
|
|
41
|
-
"source": "./src/index.ts",
|
|
36
|
+
"module": "./dist/index.mjs",
|
|
42
37
|
"types": "./dist/index.d.ts",
|
|
43
38
|
"files": [
|
|
44
39
|
"dist",
|
|
@@ -47,21 +42,24 @@
|
|
|
47
42
|
"v2-incompatible.js"
|
|
48
43
|
],
|
|
49
44
|
"scripts": {
|
|
50
|
-
"build": "
|
|
45
|
+
"build": "plugin-kit verify-package --silent && pkg-utils build --strict --check --clean",
|
|
51
46
|
"clean": "rimraf dist",
|
|
52
47
|
"dev": "npm run watch",
|
|
53
48
|
"format": "prettier --write --cache --ignore-unknown .",
|
|
54
49
|
"link-watch": "plugin-kit link-watch",
|
|
55
50
|
"lint": "eslint .",
|
|
56
51
|
"prepare": "husky install",
|
|
57
|
-
"prepublishOnly": "run
|
|
52
|
+
"prepublishOnly": "npm run build",
|
|
58
53
|
"watch": "pkg-utils watch --strict"
|
|
59
54
|
},
|
|
60
55
|
"dependencies": {
|
|
61
56
|
"@hookform/resolvers": "^3.1.1",
|
|
62
57
|
"@reduxjs/toolkit": "^1.9.0",
|
|
63
|
-
"@sanity/
|
|
64
|
-
"@sanity/
|
|
58
|
+
"@sanity/client": "^6.28.3",
|
|
59
|
+
"@sanity/color": "^3.0.6",
|
|
60
|
+
"@sanity/icons": "^3.7.0",
|
|
61
|
+
"@sanity/incompatible-plugin": "^1.0.5",
|
|
62
|
+
"@sanity/ui": "^1.0 || ^2.0",
|
|
65
63
|
"@sanity/uuid": "^3.0.1",
|
|
66
64
|
"@tanem/react-nprogress": "^5.0.0",
|
|
67
65
|
"copy-to-clipboard": "^3.3.1",
|
|
@@ -69,8 +67,7 @@
|
|
|
69
67
|
"filesize": "^9.0.0",
|
|
70
68
|
"groq": "^3.0.0",
|
|
71
69
|
"is-hotkey": "^0.2.0",
|
|
72
|
-
"nanoid": "^3.3.
|
|
73
|
-
"npm-run-all": "^4.1.5",
|
|
70
|
+
"nanoid": "^3.3.8",
|
|
74
71
|
"pluralize": "^8.0.0",
|
|
75
72
|
"react-dropzone": "^11.3.1",
|
|
76
73
|
"react-file-icon": "^1.1.0",
|
|
@@ -80,17 +77,14 @@
|
|
|
80
77
|
"react-virtuoso": "^4.3.11",
|
|
81
78
|
"redux": "^4.2.0",
|
|
82
79
|
"redux-observable": "^2.0.0",
|
|
83
|
-
"rxjs": "^7.
|
|
80
|
+
"rxjs": "^7.8.1",
|
|
84
81
|
"zod": "^3.21.4"
|
|
85
82
|
},
|
|
86
83
|
"devDependencies": {
|
|
87
84
|
"@commitlint/cli": "^17.2.0",
|
|
88
85
|
"@commitlint/config-conventional": "^17.2.0",
|
|
89
|
-
"@sanity/
|
|
90
|
-
"@sanity/
|
|
91
|
-
"@sanity/icons": "^2.0.0",
|
|
92
|
-
"@sanity/pkg-utils": "^2.4.8",
|
|
93
|
-
"@sanity/plugin-kit": "^3.1.10",
|
|
86
|
+
"@sanity/pkg-utils": "^7.0.3",
|
|
87
|
+
"@sanity/plugin-kit": "^4.0.19",
|
|
94
88
|
"@sanity/semantic-release-preset": "^2.0.2",
|
|
95
89
|
"@types/is-hotkey": "^0.1.7",
|
|
96
90
|
"@types/pluralize": "^0.0.29",
|
|
@@ -118,7 +112,7 @@
|
|
|
118
112
|
"sanity": "^3.2.0",
|
|
119
113
|
"standard-version": "^9.5.0",
|
|
120
114
|
"styled-components": "^5.3.3",
|
|
121
|
-
"typescript": "
|
|
115
|
+
"typescript": "5.7.3"
|
|
122
116
|
},
|
|
123
117
|
"peerDependencies": {
|
|
124
118
|
"@sanity/ui": "^1.0 || ^2.0",
|
|
@@ -128,6 +122,6 @@
|
|
|
128
122
|
"styled-components": "^5.0 || ^6.0"
|
|
129
123
|
},
|
|
130
124
|
"engines": {
|
|
131
|
-
"node": ">=
|
|
125
|
+
"node": ">=18"
|
|
132
126
|
}
|
|
133
127
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {CardAssetData, CardUploadData} from '@types'
|
|
2
|
-
import
|
|
1
|
+
import type {CardAssetData, CardUploadData} from '@types'
|
|
2
|
+
import {memo} from 'react'
|
|
3
3
|
import {VirtuosoGrid} from 'react-virtuoso'
|
|
4
4
|
import styled from 'styled-components'
|
|
5
5
|
import useTypedSelector from '../../hooks/useTypedSelector'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {DownloadIcon} from '@sanity/icons'
|
|
2
2
|
import {Box, Button, Flex, Inline, Stack, Text} from '@sanity/ui'
|
|
3
|
-
import {Asset, AssetItem} from '@types'
|
|
3
|
+
import type {Asset, AssetItem} from '@types'
|
|
4
4
|
import format from 'date-fns/format'
|
|
5
5
|
import filesize from 'filesize'
|
|
6
|
-
import
|
|
6
|
+
import {type ReactNode} from 'react'
|
|
7
7
|
import getAssetResolution from '../../utils/getAssetResolution'
|
|
8
8
|
import {isImageAsset} from '../../utils/typeGuards'
|
|
9
9
|
import ButtonAssetCopy from '../ButtonAssetCopy'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {CardAssetData, CardUploadData} from '@types'
|
|
1
|
+
import type {CardAssetData, CardUploadData} from '@types'
|
|
2
2
|
import {Box} from '@sanity/ui'
|
|
3
|
-
import
|
|
3
|
+
import {memo} from 'react'
|
|
4
4
|
import {GroupedVirtuoso} from 'react-virtuoso'
|
|
5
5
|
import useTypedSelector from '../../hooks/useTypedSelector'
|
|
6
6
|
import TableHeader from '../TableHeader'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type {MutationEvent} from '@sanity/client'
|
|
2
2
|
import {Card, Flex, PortalProvider, studioTheme, ThemeProvider, ToastProvider} from '@sanity/ui'
|
|
3
|
-
import {Asset, Tag} from '@types'
|
|
3
|
+
import type {Asset, Tag} from '@types'
|
|
4
4
|
import groq from 'groq'
|
|
5
|
-
import
|
|
5
|
+
import {useEffect, useState} from 'react'
|
|
6
6
|
import {useDispatch} from 'react-redux'
|
|
7
7
|
import {useColorScheme, type AssetSourceComponentProps, type SanityDocument} from 'sanity'
|
|
8
8
|
import {TAG_DOCUMENT_NAME} from '../../constants'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {ClipboardIcon} from '@sanity/icons'
|
|
2
2
|
import {Button, Popover, Text} from '@sanity/ui'
|
|
3
3
|
import copy from 'copy-to-clipboard'
|
|
4
|
-
import
|
|
4
|
+
import {useEffect, useRef, useState} from 'react'
|
|
5
5
|
import {usePortalPopoverProps} from '../../hooks/usePortalPopoverProps'
|
|
6
6
|
|
|
7
7
|
type Props = {
|
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
Flex,
|
|
7
7
|
Spinner,
|
|
8
8
|
Text,
|
|
9
|
-
Theme,
|
|
10
|
-
ThemeColorSchemeKey,
|
|
9
|
+
type Theme,
|
|
10
|
+
type ThemeColorSchemeKey,
|
|
11
11
|
Tooltip
|
|
12
12
|
} from '@sanity/ui'
|
|
13
|
-
import
|
|
13
|
+
import {memo, type MouseEvent, type RefObject} from 'react'
|
|
14
14
|
import {useDispatch} from 'react-redux'
|
|
15
15
|
import {useColorScheme} from 'sanity'
|
|
16
16
|
import styled, {css} from 'styled-components'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {PlugIcon} from '@sanity/icons'
|
|
2
2
|
import {Box, Flex, Switch, Text, Tooltip} from '@sanity/ui'
|
|
3
|
-
import
|
|
3
|
+
import {type ChangeEvent} from 'react'
|
|
4
4
|
import {useDispatch} from 'react-redux'
|
|
5
5
|
import useKeyPress from '../../hooks/useKeyPress'
|
|
6
6
|
import useTypedSelector from '../../hooks/useTypedSelector'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {Dialog as SanityDialog} from '@sanity/ui'
|
|
2
|
-
import
|
|
2
|
+
import {type ComponentProps} from 'react'
|
|
3
3
|
|
|
4
4
|
const Dialog = (props: ComponentProps<typeof SanityDialog>) => {
|
|
5
5
|
// HACK: Temporarily force fixed positioning on all @sanity/ui <Dialog /> components.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {zodResolver} from '@hookform/resolvers/zod'
|
|
2
2
|
import type {MutationEvent} from '@sanity/client'
|
|
3
3
|
import {Box, Button, Card, Flex, Stack, Tab, TabList, TabPanel, Text} from '@sanity/ui'
|
|
4
|
-
import {Asset, AssetFormData, DialogAssetEditProps, TagSelectOption} from '@types'
|
|
4
|
+
import type {Asset, AssetFormData, DialogAssetEditProps, TagSelectOption} from '@types'
|
|
5
5
|
import groq from 'groq'
|
|
6
|
-
import
|
|
7
|
-
import {SubmitHandler, useForm} from 'react-hook-form'
|
|
6
|
+
import {type ReactNode, useCallback, useEffect, useRef, useState} from 'react'
|
|
7
|
+
import {type SubmitHandler, useForm} from 'react-hook-form'
|
|
8
8
|
import {useDispatch} from 'react-redux'
|
|
9
9
|
import {WithReferringDocuments, useColorScheme, useDocumentStore} from 'sanity'
|
|
10
10
|
import {assetFormSchema} from '../../formSchema'
|
|
@@ -27,6 +27,7 @@ import FormFieldInputText from '../FormFieldInputText'
|
|
|
27
27
|
import FormFieldInputTextarea from '../FormFieldInputTextarea'
|
|
28
28
|
import FormSubmitButton from '../FormSubmitButton'
|
|
29
29
|
import Image from '../Image'
|
|
30
|
+
import {useToolOptions} from '../../contexts/ToolOptionsContext'
|
|
30
31
|
|
|
31
32
|
type Props = {
|
|
32
33
|
children: ReactNode
|
|
@@ -59,10 +60,14 @@ const DialogAssetEdit = (props: Props) => {
|
|
|
59
60
|
|
|
60
61
|
const assetTagOptions = useTypedSelector(selectTagSelectOptions(currentAsset))
|
|
61
62
|
|
|
63
|
+
// Check if credit line options are configured
|
|
64
|
+
const {creditLine} = useToolOptions()
|
|
65
|
+
|
|
62
66
|
const generateDefaultValues = useCallback(
|
|
63
67
|
(asset?: Asset): AssetFormData => {
|
|
64
68
|
return {
|
|
65
69
|
altText: asset?.altText || '',
|
|
70
|
+
creditLine: asset?.creditLine || '',
|
|
66
71
|
description: asset?.description || '',
|
|
67
72
|
originalFilename: asset?.originalFilename || '',
|
|
68
73
|
opt: {media: {tags: assetTagOptions}},
|
|
@@ -342,6 +347,20 @@ const DialogAssetEdit = (props: Props) => {
|
|
|
342
347
|
rows={5}
|
|
343
348
|
value={currentAsset?.description}
|
|
344
349
|
/>
|
|
350
|
+
{/* CreditLine */}
|
|
351
|
+
{creditLine?.enabled && (
|
|
352
|
+
<FormFieldInputText
|
|
353
|
+
{...register('creditLine')}
|
|
354
|
+
error={errors?.creditLine?.message}
|
|
355
|
+
label="Credit"
|
|
356
|
+
name="creditLine"
|
|
357
|
+
value={currentAsset?.creditLine}
|
|
358
|
+
disabled={
|
|
359
|
+
formUpdating ||
|
|
360
|
+
creditLine?.excludeSources?.includes(currentAsset?.source?.name)
|
|
361
|
+
}
|
|
362
|
+
/>
|
|
363
|
+
)}
|
|
345
364
|
</Stack>
|
|
346
365
|
</TabPanel>
|
|
347
366
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {WarningOutlineIcon} from '@sanity/icons'
|
|
2
2
|
import {Box, Button, Flex, Stack, Text} from '@sanity/ui'
|
|
3
|
-
import {DialogConfirmProps} from '@types'
|
|
4
|
-
import
|
|
3
|
+
import type {DialogConfirmProps} from '@types'
|
|
4
|
+
import {type ReactNode} from 'react'
|
|
5
5
|
import {useDispatch} from 'react-redux'
|
|
6
6
|
import {dialogActions} from '../../modules/dialog'
|
|
7
7
|
import Dialog from '../Dialog'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {Box} from '@sanity/ui'
|
|
2
|
-
import {DialogSearchFacetsProps} from '@types'
|
|
3
|
-
import
|
|
2
|
+
import type {DialogSearchFacetsProps} from '@types'
|
|
3
|
+
import {type ReactNode, useCallback} from 'react'
|
|
4
4
|
import {useDispatch} from 'react-redux'
|
|
5
5
|
import {dialogActions} from '../../modules/dialog'
|
|
6
6
|
import Dialog from '../Dialog'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {zodResolver} from '@hookform/resolvers/zod'
|
|
2
2
|
import {Box, Flex} from '@sanity/ui'
|
|
3
|
-
import {DialogTagCreateProps, TagFormData} from '@types'
|
|
4
|
-
import
|
|
5
|
-
import {SubmitHandler, useForm} from 'react-hook-form'
|
|
3
|
+
import type {DialogTagCreateProps, TagFormData} from '@types'
|
|
4
|
+
import {type ReactNode, useEffect} from 'react'
|
|
5
|
+
import {type SubmitHandler, useForm} from 'react-hook-form'
|
|
6
6
|
import {useDispatch} from 'react-redux'
|
|
7
7
|
import {tagFormSchema} from '../../formSchema'
|
|
8
8
|
import useTypedSelector from '../../hooks/useTypedSelector'
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {zodResolver} from '@hookform/resolvers/zod'
|
|
2
2
|
import type {MutationEvent} from '@sanity/client'
|
|
3
3
|
import {Box, Button, Card, Flex, Text} from '@sanity/ui'
|
|
4
|
-
import {DialogTagEditProps, Tag, TagFormData} from '@types'
|
|
4
|
+
import type {DialogTagEditProps, Tag, TagFormData} from '@types'
|
|
5
5
|
import groq from 'groq'
|
|
6
|
-
import
|
|
7
|
-
import {SubmitHandler, useForm} from 'react-hook-form'
|
|
6
|
+
import {type ReactNode, useCallback, useEffect, useState} from 'react'
|
|
7
|
+
import {type SubmitHandler, useForm} from 'react-hook-form'
|
|
8
8
|
import {useDispatch} from 'react-redux'
|
|
9
9
|
import {tagFormSchema} from '../../formSchema'
|
|
10
10
|
import useTypedSelector from '../../hooks/useTypedSelector'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {Box} from '@sanity/ui'
|
|
2
|
-
import {DialogTagsProps} from '@types'
|
|
3
|
-
import
|
|
2
|
+
import type {DialogTagsProps} from '@types'
|
|
3
|
+
import {type ReactNode, useCallback} from 'react'
|
|
4
4
|
import {useDispatch} from 'react-redux'
|
|
5
5
|
import {dialogActions} from '../../modules/dialog'
|
|
6
6
|
import Dialog from '../Dialog'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type {SanityDocument} from '@sanity/client'
|
|
2
2
|
import {Box, Button, Card, Stack, Text} from '@sanity/ui'
|
|
3
3
|
import React from 'react'
|
|
4
|
-
import {Preview, SchemaType, useSchema} from 'sanity'
|
|
4
|
+
import {Preview, type SchemaType, useSchema} from 'sanity'
|
|
5
5
|
import {useIntentLink} from 'sanity/router'
|
|
6
6
|
|
|
7
7
|
type Props = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {Box, Flex, Theme} from '@sanity/ui'
|
|
2
|
-
import
|
|
1
|
+
import {Box, Flex, type Theme} from '@sanity/ui'
|
|
2
|
+
import {type MouseEvent} from 'react'
|
|
3
3
|
import {defaultStyles, FileIcon as ReactFileIcon} from 'react-file-icon'
|
|
4
4
|
import type {DefaultExtensionType} from 'react-file-icon'
|
|
5
5
|
import styled, {css} from 'styled-components'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {Box, Portal, PortalProvider, useLayer} from '@sanity/ui'
|
|
2
|
-
import
|
|
3
|
-
import {AssetSourceComponentProps, SanityDocument, useFormValue} from 'sanity'
|
|
2
|
+
import {type SyntheticEvent, useEffect, useState} from 'react'
|
|
3
|
+
import {type AssetSourceComponentProps, type SanityDocument, useFormValue} from 'sanity'
|
|
4
4
|
import useKeyPress from '../../hooks/useKeyPress'
|
|
5
5
|
import Browser from '../Browser'
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {ThemeColorSchemeKey} from '@sanity/ui'
|
|
2
|
-
import {MouseEvent} from 'react'
|
|
1
|
+
import type {ThemeColorSchemeKey} from '@sanity/ui'
|
|
2
|
+
import type {MouseEvent} from 'react'
|
|
3
3
|
import styled, {css} from 'styled-components'
|
|
4
4
|
import {getSchemeColor} from '../../utils/getSchemeColor'
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {Box, Text} from '@sanity/ui'
|
|
2
|
-
import
|
|
2
|
+
import {useEffect} from 'react'
|
|
3
3
|
import {useDispatch} from 'react-redux'
|
|
4
4
|
import useBreakpointIndex from '../../hooks/useBreakpointIndex'
|
|
5
5
|
import useTypedSelector from '../../hooks/useTypedSelector'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {AnyAction, configureStore, Store} from '@reduxjs/toolkit'
|
|
1
|
+
import {type AnyAction, configureStore, type Store} from '@reduxjs/toolkit'
|
|
2
2
|
import type {SanityClient} from '@sanity/client'
|
|
3
3
|
import type {AssetSourceComponentProps, SanityDocument} from 'sanity'
|
|
4
|
-
import
|
|
4
|
+
import {Component, type ReactNode} from 'react'
|
|
5
5
|
import {Provider} from 'react-redux'
|
|
6
6
|
import {createEpicMiddleware} from 'redux-observable'
|
|
7
7
|
import {rootEpic, rootReducer} from '../../modules'
|
|
@@ -9,7 +9,7 @@ import {initialState as assetsInitialState} from '../../modules/assets'
|
|
|
9
9
|
// import {assetsActions} from '../../modules/assets'
|
|
10
10
|
// import {searchActions} from '../../modules/search'
|
|
11
11
|
// import {uploadsActions} from '../../modules/uploads'
|
|
12
|
-
import {RootReducerState} from '../../modules/types'
|
|
12
|
+
import type {RootReducerState} from '../../modules/types'
|
|
13
13
|
import getDocumentAssetIds from '../../utils/getDocumentAssetIds'
|
|
14
14
|
|
|
15
15
|
type Props = {
|
|
@@ -65,7 +65,7 @@ class ReduxProvider extends Component<Props> {
|
|
|
65
65
|
epicMiddleware.run(rootEpic)
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
render() {
|
|
68
|
+
override render() {
|
|
69
69
|
// @ts-ignore
|
|
70
70
|
return <Provider store={this.store}>{this.props.children}</Provider>
|
|
71
71
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {CloseIcon} from '@sanity/icons'
|
|
2
|
-
import {Box, Flex, Label, rem, Text, Theme, ThemeColorSchemeKey} from '@sanity/ui'
|
|
3
|
-
import {SearchFacetInputProps, WithId} from '@types'
|
|
4
|
-
import
|
|
2
|
+
import {Box, Flex, Label, rem, Text, type Theme, type ThemeColorSchemeKey} from '@sanity/ui'
|
|
3
|
+
import type {SearchFacetInputProps, WithId} from '@types'
|
|
4
|
+
import {type ReactNode} from 'react'
|
|
5
5
|
import {useDispatch} from 'react-redux'
|
|
6
6
|
import {useColorScheme} from 'sanity'
|
|
7
7
|
import styled, {css} from 'styled-components'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {SelectIcon} from '@sanity/icons'
|
|
2
2
|
import {Box, Button, Menu, MenuButton, MenuDivider, MenuItem, TextInput} from '@sanity/ui'
|
|
3
|
-
import {SearchFacetInputStringProps, SearchFacetOperatorType, WithId} from '@types'
|
|
4
|
-
import
|
|
3
|
+
import type {SearchFacetInputStringProps, SearchFacetOperatorType, WithId} from '@types'
|
|
4
|
+
import {type ChangeEvent} from 'react'
|
|
5
5
|
import {useDispatch} from 'react-redux'
|
|
6
6
|
|
|
7
7
|
import {operators} from '../../config/searchFacets'
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {AddIcon} from '@sanity/icons'
|
|
2
2
|
import {Button, Flex, Menu, MenuButton, MenuDivider, MenuGroup, MenuItem} from '@sanity/ui'
|
|
3
|
-
import {SearchFacetDivider, SearchFacetGroup, SearchFacetInputProps} from '@types'
|
|
3
|
+
import type {SearchFacetDivider, SearchFacetGroup, SearchFacetInputProps} from '@types'
|
|
4
4
|
import React from 'react'
|
|
5
5
|
import {useDispatch} from 'react-redux'
|
|
6
6
|
import {FACETS} from '../../constants'
|
|
7
7
|
import {usePortalPopoverProps} from '../../hooks/usePortalPopoverProps'
|
|
8
8
|
import useTypedSelector from '../../hooks/useTypedSelector'
|
|
9
9
|
import {searchActions} from '../../modules/search'
|
|
10
|
+
import {useToolOptions} from '../../contexts/ToolOptionsContext'
|
|
10
11
|
|
|
11
12
|
const SearchFacetsControl = () => {
|
|
12
13
|
// Redux
|
|
@@ -17,11 +18,18 @@ const SearchFacetsControl = () => {
|
|
|
17
18
|
|
|
18
19
|
const popoverProps = usePortalPopoverProps()
|
|
19
20
|
|
|
21
|
+
const {creditLine} = useToolOptions()
|
|
22
|
+
|
|
20
23
|
const isTool = !selectedDocument
|
|
21
24
|
|
|
22
25
|
const filteredFacets = FACETS
|
|
23
26
|
// Filter facets based on current context, whether it's invoked as a tool, or via selection through via custom asset source.
|
|
24
27
|
.filter(facet => {
|
|
28
|
+
// Remove credit line filter if it's not enabled
|
|
29
|
+
if (!creditLine?.enabled && facet?.type === 'string' && facet?.name === 'creditLine') {
|
|
30
|
+
return false
|
|
31
|
+
}
|
|
32
|
+
|
|
25
33
|
if (facet.type === 'group' || facet.type === 'divider') {
|
|
26
34
|
return true
|
|
27
35
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
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
4
|
import styled, {css} from 'styled-components'
|
|
5
5
|
import {GRID_TEMPLATE_COLUMNS, PANEL_HEIGHT} from '../../constants'
|
|
@@ -7,13 +7,21 @@ 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
27
|
import styled, {css} from 'styled-components'
|
|
@@ -1,7 +1,7 @@
|
|
|
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 '@types'
|
|
4
|
-
import
|
|
3
|
+
import type {SearchFacetInputSearchableProps, TagActions, TagItem} from '@types'
|
|
4
|
+
import {type ReactNode} from 'react'
|
|
5
5
|
import {useDispatch} from 'react-redux'
|
|
6
6
|
import styled from 'styled-components'
|
|
7
7
|
import {inputs} from '../../config/searchFacets'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {Flex, Label} from '@sanity/ui'
|
|
2
|
-
import {TagActions, TagItem} from '@types'
|
|
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,7 +1,7 @@
|
|
|
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
6
|
import styled from 'styled-components'
|
|
7
7
|
import {useAssetSourceActions} from '../../contexts/AssetSourceDispatchContext'
|