sanity-plugin-media 2.4.0 → 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 (59) hide show
  1. package/dist/index.d.mts +7 -2
  2. package/dist/index.d.ts +7 -2
  3. package/dist/index.js +92 -61
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +66 -34
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +6 -6
  8. package/src/components/AssetGridVirtualized/index.tsx +3 -2
  9. package/src/components/AssetMetadata/index.tsx +1 -1
  10. package/src/components/AssetTableVirtualized/index.tsx +1 -1
  11. package/src/components/Browser/index.tsx +1 -1
  12. package/src/components/CardAsset/index.tsx +16 -12
  13. package/src/components/CardUpload/index.tsx +1 -1
  14. package/src/components/DialogAssetEdit/index.tsx +1 -1
  15. package/src/components/DialogConfirm/index.tsx +1 -1
  16. package/src/components/DialogSearchFacets/index.tsx +1 -1
  17. package/src/components/DialogTagCreate/index.tsx +1 -1
  18. package/src/components/DialogTagEdit/index.tsx +1 -1
  19. package/src/components/DialogTags/index.tsx +1 -1
  20. package/src/components/Dialogs/index.tsx +1 -1
  21. package/src/components/FileAssetPreview/index.tsx +1 -1
  22. package/src/components/FileIcon/index.tsx +1 -1
  23. package/src/components/FormFieldInputLabel/index.tsx +1 -1
  24. package/src/components/Image/index.tsx +1 -1
  25. package/src/components/SearchFacet/index.tsx +8 -3
  26. package/src/components/SearchFacetNumber/index.tsx +1 -1
  27. package/src/components/SearchFacetSelect/index.tsx +1 -1
  28. package/src/components/SearchFacetString/index.tsx +1 -1
  29. package/src/components/SearchFacetTags/index.tsx +1 -1
  30. package/src/components/SearchFacets/index.tsx +1 -1
  31. package/src/components/SearchFacetsControl/index.tsx +1 -1
  32. package/src/components/TableHeader/index.tsx +14 -10
  33. package/src/components/TableRowAsset/index.tsx +5 -1
  34. package/src/components/Tag/index.tsx +2 -2
  35. package/src/components/TagsVirtualized/index.tsx +1 -1
  36. package/src/components/UploadDropzone/index.tsx +1 -1
  37. package/src/config/searchFacets.ts +1 -1
  38. package/src/constants.ts +1 -1
  39. package/src/contexts/ToolOptionsContext.tsx +1 -1
  40. package/src/index.ts +1 -1
  41. package/src/modules/assets/index.ts +1 -1
  42. package/src/modules/dialog/index.ts +1 -1
  43. package/src/modules/notifications/index.ts +1 -1
  44. package/src/modules/search/index.ts +1 -1
  45. package/src/modules/selectors.ts +1 -1
  46. package/src/modules/tags/index.ts +1 -1
  47. package/src/modules/uploads/index.ts +1 -1
  48. package/src/operators/checkTagName.ts +1 -1
  49. package/src/plugin.tsx +1 -1
  50. package/src/styled/react-select/creatable.tsx +9 -1
  51. package/src/styled/react-select/single.tsx +8 -1
  52. package/src/types/sanity-ui.d.ts +6 -0
  53. package/src/utils/blocksToText.ts +1 -1
  54. package/src/utils/constructFilter.ts +1 -1
  55. package/src/utils/getAssetResolution.ts +1 -1
  56. package/src/utils/getTagSelectOptions.ts +1 -1
  57. package/src/utils/imageDprUrl.ts +1 -1
  58. package/src/utils/typeGuards.ts +1 -1
  59. package/src/utils/uploadSanityAsset.ts +1 -1
@@ -1,6 +1,5 @@
1
1
  import {AddIcon, ChevronDownIcon, CloseIcon} from '@sanity/icons'
2
2
  import {Box, Card, Flex, rem, studioTheme, Text, type ThemeColorSchemeKey} from '@sanity/ui'
3
- import React from 'react'
4
3
  import {components, type StylesConfig} from 'react-select'
5
4
  import {Virtuoso} from 'react-virtuoso'
6
5
  import {getSchemeColor} from '../../utils/getSchemeColor'
@@ -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,6 +1,5 @@
1
1
  import {CloseIcon} from '@sanity/icons'
2
2
  import {Box, Card, rem, studioTheme, Text, type ThemeColorSchemeKey} from '@sanity/ui'
3
- import React from 'react'
4
3
  import {components, type StylesConfig} from 'react-select'
5
4
  import {Virtuoso} from 'react-virtuoso'
6
5
  import {getSchemeColor} from '../../utils/getSchemeColor'
@@ -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,
@@ -0,0 +1,6 @@
1
+ import {type Theme} from '@sanity/ui'
2
+
3
+ declare module 'styled-components' {
4
+ // eslint-disable-next-line
5
+ interface DefaultTheme extends Theme {}
6
+ }
@@ -1,4 +1,4 @@
1
- import type {Block} from '@types'
1
+ import type {Block} from '../types'
2
2
 
3
3
  const defaults = {nonTextBehavior: 'remove'}
4
4
 
@@ -1,4 +1,4 @@
1
- import type {AssetType, SearchFacetInputProps} from '@types'
1
+ import type {AssetType, SearchFacetInputProps} from '../types'
2
2
  import groq from 'groq'
3
3
 
4
4
  import {operators} from '../config/searchFacets'
@@ -1,4 +1,4 @@
1
- import type {ImageAsset} from '@types'
1
+ import type {ImageAsset} from '../types'
2
2
 
3
3
  const getAssetResolution = (asset: ImageAsset) => {
4
4
  return `${asset.metadata.dimensions.width}x${asset.metadata.dimensions.height}px`
@@ -1,4 +1,4 @@
1
- import type {TagSelectOption, TagItem} from '@types'
1
+ import type {TagSelectOption, TagItem} from '../types'
2
2
 
3
3
  const getTagSelectOptions = (tags: TagItem[]): TagSelectOption[] => {
4
4
  return tags.reduce((acc: TagSelectOption[], val) => {
@@ -1,4 +1,4 @@
1
- import type {ImageAsset} from '@types'
1
+ import type {ImageAsset} from '../types'
2
2
 
3
3
  const imageDprUrl = (
4
4
  asset: ImageAsset,
@@ -1,4 +1,4 @@
1
- import type {Asset, FileAsset, ImageAsset} from '@types'
1
+ import type {Asset, FileAsset, ImageAsset} from '../types'
2
2
 
3
3
  export const isFileAsset = (asset: Asset): asset is FileAsset => {
4
4
  return (asset as FileAsset)._type === 'sanity.fileAsset'
@@ -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 type {HttpError} from '@types'
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'