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.
Files changed (88) hide show
  1. package/LICENSE +1 -1
  2. package/dist/index.d.mts +24 -0
  3. package/dist/index.d.ts +1 -2
  4. package/dist/index.js +4258 -10783
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +5373 -0
  7. package/dist/index.mjs.map +1 -0
  8. package/package.json +23 -29
  9. package/src/components/AssetGridVirtualized/index.tsx +4 -3
  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 +19 -15
  15. package/src/components/CardUpload/index.tsx +1 -1
  16. package/src/components/DebugControls/index.tsx +1 -1
  17. package/src/components/Dialog/index.tsx +1 -1
  18. package/src/components/DialogAssetEdit/index.tsx +3 -3
  19. package/src/components/DialogConfirm/index.tsx +2 -2
  20. package/src/components/DialogSearchFacets/index.tsx +2 -2
  21. package/src/components/DialogTagCreate/index.tsx +3 -3
  22. package/src/components/DialogTagEdit/index.tsx +3 -3
  23. package/src/components/DialogTags/index.tsx +2 -2
  24. package/src/components/Dialogs/index.tsx +1 -1
  25. package/src/components/DocumentList/index.tsx +1 -1
  26. package/src/components/FileAssetPreview/index.tsx +1 -1
  27. package/src/components/FileIcon/index.tsx +3 -3
  28. package/src/components/FormBuilderTool/index.tsx +2 -2
  29. package/src/components/FormFieldInputLabel/index.tsx +1 -1
  30. package/src/components/FormFieldInputText/index.tsx +1 -1
  31. package/src/components/FormFieldInputTextarea/index.tsx +1 -1
  32. package/src/components/FormSubmitButton/index.tsx +1 -1
  33. package/src/components/Image/index.tsx +3 -3
  34. package/src/components/Items/index.tsx +1 -1
  35. package/src/components/ReduxProvider/index.tsx +4 -4
  36. package/src/components/SearchFacet/index.tsx +10 -5
  37. package/src/components/SearchFacetNumber/index.tsx +2 -2
  38. package/src/components/SearchFacetSelect/index.tsx +2 -2
  39. package/src/components/SearchFacetString/index.tsx +2 -2
  40. package/src/components/SearchFacetTags/index.tsx +2 -2
  41. package/src/components/SearchFacets/index.tsx +2 -2
  42. package/src/components/SearchFacetsControl/index.tsx +1 -1
  43. package/src/components/TableHeader/index.tsx +16 -12
  44. package/src/components/TableRowAsset/index.tsx +15 -3
  45. package/src/components/Tag/index.tsx +3 -3
  46. package/src/components/TagsVirtualized/index.tsx +2 -2
  47. package/src/components/TextInputNumber/index.tsx +1 -1
  48. package/src/components/TextInputSearch/index.tsx +1 -1
  49. package/src/components/UploadDropzone/index.tsx +3 -3
  50. package/src/config/searchFacets.ts +2 -2
  51. package/src/constants.ts +6 -1
  52. package/src/contexts/AssetSourceDispatchContext.tsx +1 -1
  53. package/src/contexts/DropzoneDispatchContext.tsx +1 -1
  54. package/src/contexts/ToolOptionsContext.tsx +3 -3
  55. package/src/hooks/useKeyPress.ts +1 -1
  56. package/src/hooks/useOnScreen.ts +1 -1
  57. package/src/hooks/usePortalPopoverProps.ts +1 -1
  58. package/src/hooks/useTypedSelector.ts +2 -2
  59. package/src/index.ts +1 -1
  60. package/src/modules/assets/actions.ts +1 -1
  61. package/src/modules/assets/index.ts +4 -4
  62. package/src/modules/debug/index.ts +1 -1
  63. package/src/modules/dialog/index.ts +2 -2
  64. package/src/modules/index.ts +3 -3
  65. package/src/modules/notifications/index.ts +2 -2
  66. package/src/modules/search/index.ts +2 -2
  67. package/src/modules/selectors.ts +2 -2
  68. package/src/modules/tags/index.ts +3 -3
  69. package/src/modules/uploads/index.ts +3 -3
  70. package/src/operators/checkTagName.ts +1 -1
  71. package/src/operators/debugThrottle.ts +1 -1
  72. package/src/plugin.tsx +5 -3
  73. package/src/styled/react-select/creatable.tsx +11 -3
  74. package/src/styled/react-select/single.tsx +10 -3
  75. package/src/types/index.ts +2 -2
  76. package/src/types/sanity-ui.d.ts +6 -0
  77. package/src/utils/blocksToText.ts +1 -1
  78. package/src/utils/constructFilter.ts +1 -1
  79. package/src/utils/getAssetResolution.ts +1 -1
  80. package/src/utils/getSchemeColor.ts +1 -1
  81. package/src/utils/getTagSelectOptions.ts +1 -1
  82. package/src/utils/getUniqueDocuments.ts +1 -1
  83. package/src/utils/imageDprUrl.ts +1 -1
  84. package/src/utils/typeGuards.ts +1 -1
  85. package/src/utils/uploadSanityAsset.ts +1 -1
  86. package/dist/index.cjs.mjs +0 -5
  87. package/dist/index.esm.js +0 -11850
  88. 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.1",
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
+ "dev": "sanity dev",
46
+ "build": "plugin-kit verify-package --silent && pkg-utils build --strict --check --clean",
51
47
  "clean": "rimraf dist",
52
- "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,25 +77,22 @@
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",
89
+ "@sanity/vision": "^3.78.1",
95
90
  "@types/is-hotkey": "^0.1.7",
96
91
  "@types/pluralize": "^0.0.29",
97
92
  "@types/react": "^18",
98
93
  "@types/react-dom": "^18",
99
94
  "@types/react-file-icon": "^1.0.1",
100
95
  "@types/react-redux": "^7.1.24",
101
- "@types/styled-components": "^5.1.7",
102
96
  "@typescript-eslint/eslint-plugin": "^5.42.0",
103
97
  "@typescript-eslint/parser": "^5.42.0",
104
98
  "conventional-changelog-conventionalcommits": "^5.0.0",
@@ -115,19 +109,19 @@
115
109
  "react": "^18",
116
110
  "react-dom": "^18",
117
111
  "rimraf": "^3.0.2",
118
- "sanity": "^3.2.0",
112
+ "sanity": "^3.78.1",
119
113
  "standard-version": "^9.5.0",
120
- "styled-components": "^5.3.3",
121
- "typescript": "^4.8.4"
114
+ "styled-components": "^6.1.15",
115
+ "typescript": "5.7.3"
122
116
  },
123
117
  "peerDependencies": {
124
118
  "@sanity/ui": "^1.0 || ^2.0",
125
119
  "react": "^18",
126
120
  "react-dom": "^18",
127
- "sanity": "^3.0.0",
121
+ "sanity": "^3",
128
122
  "styled-components": "^5.0 || ^6.0"
129
123
  },
130
124
  "engines": {
131
- "node": ">=14"
125
+ "node": ">=18"
132
126
  }
133
127
  }
@@ -1,7 +1,7 @@
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
- import styled from 'styled-components'
4
+ import {styled} from 'styled-components'
5
5
  import useTypedSelector from '../../hooks/useTypedSelector'
6
6
  import CardAsset from '../CardAsset'
7
7
  import CardUpload from '../CardUpload'
@@ -63,6 +63,7 @@ const AssetGridVirtualized = (props: Props) => {
63
63
  }}
64
64
  components={{
65
65
  Item: ItemContainer,
66
+ // @ts-expect-error - fix typings later
66
67
  List: ListContainer
67
68
  }}
68
69
  endReached={onLoadMore}
@@ -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,14 +6,14 @@ 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
- import styled, {css} from 'styled-components'
16
+ import {styled, css} from 'styled-components'
17
17
  import {PANEL_HEIGHT} from '../../constants'
18
18
  import {useAssetSourceActions} from '../../contexts/AssetSourceDispatchContext'
19
19
  import useKeyPress from '../../hooks/useKeyPress'
@@ -66,18 +66,21 @@ const CardContainer = styled(Flex)<{picked?: boolean; theme: Theme; updating?: b
66
66
  }
67
67
  )
68
68
 
69
- const ContextActionContainer = styled(Flex)(({scheme}: {scheme: ThemeColorSchemeKey}) => {
70
- return css`
71
- cursor: pointer;
72
- height: ${PANEL_HEIGHT}px;
73
- transition: all 300ms;
74
- @media (hover: hover) and (pointer: fine) {
75
- &:hover {
76
- background: ${getSchemeColor(scheme, 'bg')};
69
+ const ContextActionContainer = styled(Flex)(
70
+ // @ts-expect-error - fix typings later
71
+ ({scheme}: {scheme: ThemeColorSchemeKey}) => {
72
+ return css`
73
+ cursor: pointer;
74
+ height: ${PANEL_HEIGHT}px;
75
+ transition: all 300ms;
76
+ @media (hover: hover) and (pointer: fine) {
77
+ &:hover {
78
+ background: ${getSchemeColor(scheme, 'bg')};
79
+ }
77
80
  }
78
- }
79
- `
80
- })
81
+ `
82
+ }
83
+ )
81
84
 
82
85
  const StyledWarningOutlineIcon = styled(WarningFilledIcon)(({theme}) => {
83
86
  return {
@@ -221,6 +224,7 @@ const CardAsset = (props: Props) => {
221
224
  align="center"
222
225
  onClick={handleContextActionClick}
223
226
  paddingX={1}
227
+ // @ts-expect-error - fix typings later
224
228
  scheme={scheme}
225
229
  style={{opacity: opacityContainer}}
226
230
  >
@@ -4,7 +4,7 @@ import filesize from 'filesize'
4
4
  import React from 'react'
5
5
  import {useDispatch} from 'react-redux'
6
6
  import {useColorScheme} from 'sanity'
7
- import styled from 'styled-components'
7
+ import {styled} from 'styled-components'
8
8
  import {PANEL_HEIGHT} from '../../constants'
9
9
  import useTypedSelector from '../../hooks/useTypedSelector'
10
10
  import {selectUploadById, uploadsActions} from '../../modules/uploads'
@@ -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,8 +1,8 @@
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
- import styled, {css} from 'styled-components'
5
+ import {styled, css} from 'styled-components'
6
6
 
7
7
  type Props = {
8
8
  extension?: string
@@ -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,7 +1,7 @@
1
1
  import {ErrorOutlineIcon} from '@sanity/icons'
2
2
  import {Box, Inline, Text, Tooltip} from '@sanity/ui'
3
3
  import React from 'react'
4
- import styled from 'styled-components'
4
+ import {styled} from 'styled-components'
5
5
 
6
6
  type Props = {
7
7
  description?: string
@@ -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,6 +1,6 @@
1
- import {ThemeColorSchemeKey} from '@sanity/ui'
2
- import {MouseEvent} from 'react'
3
- import styled, {css} from 'styled-components'
1
+ import type {ThemeColorSchemeKey} from '@sanity/ui'
2
+ import type {MouseEvent} from 'react'
3
+ import {styled, css} from 'styled-components'
4
4
  import {getSchemeColor} from '../../utils/getSchemeColor'
5
5
 
6
6
  type Props = {
@@ -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,10 +1,10 @@
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
- import styled, {css} from 'styled-components'
7
+ import {styled, css} from 'styled-components'
8
8
  import {searchActions} from '../../modules/search'
9
9
  import {getSchemeColor} from '../../utils/getSchemeColor'
10
10
 
@@ -13,6 +13,7 @@ type Props = {
13
13
  facet: WithId<SearchFacetInputProps>
14
14
  }
15
15
 
16
+ // @ts-expect-error - fix typings later
16
17
  const Container = styled(Box)(({scheme, theme}: {scheme: ThemeColorSchemeKey; theme: Theme}) => {
17
18
  return css`
18
19
  background: ${getSchemeColor(scheme, 'bg')};
@@ -33,7 +34,11 @@ const SearchFacet = (props: Props) => {
33
34
  }
34
35
 
35
36
  return (
36
- <Container padding={[2, 2, 1]} scheme={scheme}>
37
+ <Container
38
+ padding={[2, 2, 1]}
39
+ // @ts-expect-error - fix typings later
40
+ scheme={scheme}
41
+ >
37
42
  <Flex align={['flex-start', 'flex-start', 'center']} direction={['column', 'column', 'row']}>
38
43
  {/* Title */}
39
44
  <Box paddingBottom={[3, 3, 0]} paddingLeft={1} paddingRight={2} paddingTop={[1, 1, 0]}>
@@ -1,11 +1,11 @@
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,
7
7
  WithId
8
- } from '@types'
8
+ } from '../../types'
9
9
  import React from 'react'
10
10
  import {useDispatch} from 'react-redux'
11
11
  import {operators} from '../../config/searchFacets'
@@ -1,11 +1,11 @@
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,
7
7
  WithId
8
- } from '@types'
8
+ } from '../../types'
9
9
  import React from 'react'
10
10
  import {useDispatch} from 'react-redux'
11
11
 
@@ -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,11 +1,11 @@
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,
7
7
  WithId
8
- } from '@types'
8
+ } from '../../types'
9
9
  import React from 'react'
10
10
  import {useDispatch} from 'react-redux'
11
11
  import Select from 'react-select'
@@ -1,6 +1,6 @@
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
- import styled, {css} 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'
@@ -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'