sanity-plugin-media 2.3.2 → 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.
Files changed (83) hide show
  1. package/LICENSE +1 -1
  2. package/dist/index.d.mts +19 -0
  3. package/dist/index.d.ts +3 -9
  4. package/dist/index.js +4228 -10784
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +5341 -0
  7. package/dist/index.mjs.map +1 -0
  8. package/package.json +18 -24
  9. package/src/components/AssetGridVirtualized/index.tsx +2 -2
  10. package/src/components/AssetMetadata/index.tsx +2 -2
  11. package/src/components/AssetTableVirtualized/index.tsx +2 -2
  12. package/src/components/Browser/index.tsx +2 -2
  13. package/src/components/ButtonAssetCopy/index.tsx +1 -1
  14. package/src/components/CardAsset/index.tsx +3 -3
  15. package/src/components/DebugControls/index.tsx +1 -1
  16. package/src/components/Dialog/index.tsx +1 -1
  17. package/src/components/DialogAssetEdit/index.tsx +3 -3
  18. package/src/components/DialogConfirm/index.tsx +2 -2
  19. package/src/components/DialogSearchFacets/index.tsx +2 -2
  20. package/src/components/DialogTagCreate/index.tsx +3 -3
  21. package/src/components/DialogTagEdit/index.tsx +3 -3
  22. package/src/components/DialogTags/index.tsx +2 -2
  23. package/src/components/Dialogs/index.tsx +1 -1
  24. package/src/components/DocumentList/index.tsx +1 -1
  25. package/src/components/FileAssetPreview/index.tsx +1 -1
  26. package/src/components/FileIcon/index.tsx +2 -2
  27. package/src/components/FormBuilderTool/index.tsx +2 -2
  28. package/src/components/FormFieldInputText/index.tsx +1 -1
  29. package/src/components/FormFieldInputTextarea/index.tsx +1 -1
  30. package/src/components/FormSubmitButton/index.tsx +1 -1
  31. package/src/components/Image/index.tsx +2 -2
  32. package/src/components/Items/index.tsx +1 -1
  33. package/src/components/ReduxProvider/index.tsx +4 -4
  34. package/src/components/SearchFacet/index.tsx +3 -3
  35. package/src/components/SearchFacetNumber/index.tsx +1 -1
  36. package/src/components/SearchFacetSelect/index.tsx +1 -1
  37. package/src/components/SearchFacetString/index.tsx +2 -2
  38. package/src/components/SearchFacetTags/index.tsx +1 -1
  39. package/src/components/SearchFacets/index.tsx +1 -1
  40. package/src/components/SearchFacetsControl/index.tsx +1 -1
  41. package/src/components/TableHeader/index.tsx +2 -2
  42. package/src/components/TableRowAsset/index.tsx +10 -2
  43. package/src/components/Tag/index.tsx +2 -2
  44. package/src/components/TagsVirtualized/index.tsx +2 -2
  45. package/src/components/TextInputNumber/index.tsx +1 -1
  46. package/src/components/TextInputSearch/index.tsx +1 -1
  47. package/src/components/UploadDropzone/index.tsx +2 -2
  48. package/src/config/searchFacets.ts +1 -1
  49. package/src/constants.ts +6 -1
  50. package/src/contexts/AssetSourceDispatchContext.tsx +1 -1
  51. package/src/contexts/DropzoneDispatchContext.tsx +1 -1
  52. package/src/contexts/ToolOptionsContext.tsx +3 -3
  53. package/src/hooks/useKeyPress.ts +1 -1
  54. package/src/hooks/useOnScreen.ts +1 -1
  55. package/src/hooks/usePortalPopoverProps.ts +1 -1
  56. package/src/hooks/useTypedSelector.ts +2 -2
  57. package/src/modules/assets/actions.ts +1 -1
  58. package/src/modules/assets/index.ts +3 -3
  59. package/src/modules/debug/index.ts +1 -1
  60. package/src/modules/dialog/index.ts +2 -2
  61. package/src/modules/index.ts +3 -3
  62. package/src/modules/notifications/index.ts +1 -1
  63. package/src/modules/search/index.ts +1 -1
  64. package/src/modules/selectors.ts +2 -2
  65. package/src/modules/tags/index.ts +2 -2
  66. package/src/modules/uploads/index.ts +2 -2
  67. package/src/operators/debugThrottle.ts +1 -1
  68. package/src/plugin.tsx +5 -3
  69. package/src/styled/react-select/creatable.tsx +2 -2
  70. package/src/styled/react-select/single.tsx +2 -2
  71. package/src/types/index.ts +2 -2
  72. package/src/utils/blocksToText.ts +1 -1
  73. package/src/utils/constructFilter.ts +1 -1
  74. package/src/utils/getAssetResolution.ts +1 -1
  75. package/src/utils/getSchemeColor.ts +1 -1
  76. package/src/utils/getTagSelectOptions.ts +1 -1
  77. package/src/utils/getUniqueDocuments.ts +1 -1
  78. package/src/utils/imageDprUrl.ts +1 -1
  79. package/src/utils/typeGuards.ts +1 -1
  80. package/src/utils/uploadSanityAsset.ts +1 -1
  81. package/dist/index.cjs.mjs +0 -5
  82. package/dist/index.esm.js +0 -11850
  83. 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.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
- "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"
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.esm.js",
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": "run-s clean && plugin-kit verify-package --silent && pkg-utils build --strict && pkg-utils --strict",
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-s build",
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/incompatible-plugin": "^1.0.4",
64
- "@sanity/ui": "^1.9.3",
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.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.0.0",
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/client": "^6.7.0",
90
- "@sanity/color": "^2.1.20",
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": "^4.8.4"
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": ">=14"
125
+ "node": ">=18"
132
126
  }
133
127
  }
@@ -1,5 +1,5 @@
1
- import {CardAssetData, CardUploadData} from '@types'
2
- import React, {memo} from 'react'
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 React, {ReactNode} from 'react'
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 React, {memo} from 'react'
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 React, {useEffect, useState} from 'react'
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 React, {useEffect, useRef, useState} from 'react'
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 React, {memo, MouseEvent, RefObject} from 'react'
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 React, {ChangeEvent} from 'react'
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 React, {ComponentProps} from 'react'
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 React, {ReactNode, useCallback, useEffect, useRef, useState} from 'react'
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'
@@ -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 React, {ReactNode} from 'react'
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 React, {ReactNode, useCallback} from 'react'
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 React, {ReactNode, useEffect} from 'react'
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 React, {ReactNode, useCallback, useEffect, useState} from 'react'
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 React, {ReactNode, useCallback} from 'react'
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,4 +1,4 @@
1
- import {Dialog} from '@types'
1
+ import type {Dialog} from '@types'
2
2
  import React from 'react'
3
3
  import useTypedSelector from '../../hooks/useTypedSelector'
4
4
  import DialogAssetEdit from '../DialogAssetEdit'
@@ -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
1
  import {Flex} from '@sanity/ui'
2
- import {Asset} from '@types'
2
+ import type {Asset} from '@types'
3
3
  import React from 'react'
4
4
  import FileIcon from '../FileIcon'
5
5
 
@@ -1,5 +1,5 @@
1
- import {Box, Flex, Theme} from '@sanity/ui'
2
- import React, {MouseEvent} from 'react'
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 React, {SyntheticEvent, useEffect, useState} from 'react'
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
1
  import {Box, TextInput} from '@sanity/ui'
2
- import React, {forwardRef} from 'react'
2
+ import {forwardRef} from 'react'
3
3
 
4
4
  import FormFieldInputLabel from '../FormFieldInputLabel'
5
5
 
@@ -1,5 +1,5 @@
1
1
  import {Box, TextArea} from '@sanity/ui'
2
- import React, {forwardRef} from 'react'
2
+ import {forwardRef} from 'react'
3
3
 
4
4
  import FormFieldInputLabel from '../FormFieldInputLabel'
5
5
 
@@ -1,6 +1,6 @@
1
1
  import {Box, Button, Text, Tooltip} from '@sanity/ui'
2
2
  import format from 'date-fns/format'
3
- import React, {ReactNode} from 'react'
3
+ import {type ReactNode} from 'react'
4
4
 
5
5
  type Props = {
6
6
  disabled: boolean
@@ -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 React, {useEffect} from 'react'
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 React, {Component, ReactNode} from 'react'
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 React, {ReactNode} from 'react'
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,6 +1,6 @@
1
1
  import {SelectIcon} from '@sanity/icons'
2
2
  import {Box, Button, Menu, MenuButton, MenuDivider, MenuItem} from '@sanity/ui'
3
- import {
3
+ import type {
4
4
  SearchFacetInputNumberModifier,
5
5
  SearchFacetInputNumberProps,
6
6
  SearchFacetOperatorType,
@@ -1,6 +1,6 @@
1
1
  import {SelectIcon} from '@sanity/icons'
2
2
  import {Box, Button, Menu, MenuButton, MenuDivider, MenuItem} from '@sanity/ui'
3
- import {
3
+ import type {
4
4
  SearchFacetInputSelectListItemProps,
5
5
  SearchFacetInputSelectProps,
6
6
  SearchFacetOperatorType,
@@ -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 React, {ChangeEvent} from 'react'
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,6 +1,6 @@
1
1
  import {SelectIcon} from '@sanity/icons'
2
2
  import {Box, Button, Menu, MenuButton, MenuDivider, MenuItem} from '@sanity/ui'
3
- import {
3
+ import type {
4
4
  TagSelectOption,
5
5
  SearchFacetInputSearchableProps,
6
6
  SearchFacetOperatorType,
@@ -1,4 +1,4 @@
1
- import {Box, Flex, Inline, rem, Theme} from '@sanity/ui'
1
+ import {Box, Flex, Inline, rem, type Theme} from '@sanity/ui'
2
2
  import React from 'react'
3
3
  import styled, {css} from 'styled-components'
4
4
 
@@ -1,6 +1,6 @@
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'
@@ -1,5 +1,5 @@
1
- import {Checkbox, Flex, Grid, ThemeColorSchemeKey, useMediaIndex} from '@sanity/ui'
2
- import React, {MouseEvent} from 'react'
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 React, {memo, MouseEvent, RefObject, useCallback, useEffect, useRef, useState} from 'react'
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 React, {ReactNode} from 'react'
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 React, {memo, useState} from 'react'
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,5 +1,5 @@
1
1
  import {TextInput} from '@sanity/ui'
2
- import React, {ChangeEvent} from 'react'
2
+ import {type ChangeEvent} from 'react'
3
3
 
4
4
  // TODO: use correct type
5
5
  type Props = any & {
@@ -1,6 +1,6 @@
1
1
  import {CloseIcon, SearchIcon} from '@sanity/icons'
2
2
  import {Box, Flex, TextInput} from '@sanity/ui'
3
- import React, {ChangeEvent} from 'react'
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 React, {ReactNode} from 'react'
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'
@@ -1,4 +1,4 @@
1
- import {
1
+ import type {
2
2
  SearchFacetDivider,
3
3
  SearchFacetInputProps,
4
4
  SearchFacetName,
package/src/constants.ts CHANGED
@@ -1,4 +1,9 @@
1
- import {SearchFacetInputProps, SearchFacetDivider, SearchFacetGroup, OrderDirection} from '@types'
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,4 +1,4 @@
1
- import React, {ReactNode, createContext, useContext} from 'react'
1
+ import {type ReactNode, createContext, useContext} from 'react'
2
2
  import type {AssetSourceComponentProps} from 'sanity'
3
3
 
4
4
  type ContextProps = {
@@ -1,4 +1,4 @@
1
- import React, {ReactNode, createContext, useContext} from 'react'
1
+ import {type ReactNode, createContext, useContext} from 'react'
2
2
 
3
3
  type ContextProps = {
4
4
  open: () => void
@@ -1,6 +1,6 @@
1
- import {MediaToolOptions} from '@types'
2
- import React, {PropsWithChildren, createContext, useContext, useMemo} from 'react'
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'>
@@ -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)
@@ -1,4 +1,4 @@
1
- import {RefObject, useEffect, useState} from 'react'
1
+ import {type RefObject, useEffect, useState} from 'react'
2
2
 
3
3
  const useOnScreen = (ref: RefObject<HTMLElement>, options = {}, once: boolean) => {
4
4
  const [isIntersecting, setIntersecting] = useState(false)
@@ -1,4 +1,4 @@
1
- import {PopoverProps, usePortal} from '@sanity/ui'
1
+ import {type PopoverProps, usePortal} from '@sanity/ui'
2
2
 
3
3
  export function usePortalPopoverProps(): PopoverProps {
4
4
  const portal = usePortal()
@@ -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