sanity-plugin-media 3.0.0 → 3.0.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 (45) hide show
  1. package/dist/index.d.mts +7 -4
  2. package/dist/index.d.ts +7 -4
  3. package/dist/index.js +436 -265
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +455 -285
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +19 -19
  8. package/src/components/AssetGridVirtualized/index.tsx +13 -2
  9. package/src/components/Browser/index.tsx +30 -41
  10. package/src/components/ButtonViewGroup/index.tsx +0 -1
  11. package/src/components/CardAsset/index.tsx +13 -14
  12. package/src/components/CardUpload/index.tsx +1 -1
  13. package/src/components/Controls/index.tsx +0 -1
  14. package/src/components/DebugControls/index.tsx +1 -0
  15. package/src/components/DialogAssetEdit/index.tsx +10 -3
  16. package/src/components/DialogConfirm/index.tsx +8 -1
  17. package/src/components/DialogSearchFacets/index.tsx +1 -1
  18. package/src/components/DialogTagCreate/index.tsx +1 -1
  19. package/src/components/DialogTagEdit/index.tsx +1 -1
  20. package/src/components/DialogTags/index.tsx +1 -1
  21. package/src/components/Dialogs/index.tsx +1 -1
  22. package/src/components/DocumentList/index.tsx +1 -1
  23. package/src/components/FileAssetPreview/index.tsx +1 -1
  24. package/src/components/FormFieldInputLabel/index.tsx +2 -1
  25. package/src/components/FormSubmitButton/index.tsx +1 -0
  26. package/src/components/Header/index.tsx +1 -1
  27. package/src/components/Image/index.tsx +4 -4
  28. package/src/components/OrderSelect/index.tsx +0 -1
  29. package/src/components/ReduxProvider/index.tsx +0 -1
  30. package/src/components/SearchFacet/index.tsx +4 -9
  31. package/src/components/SearchFacetNumber/index.tsx +1 -1
  32. package/src/components/SearchFacetSelect/index.tsx +1 -1
  33. package/src/components/SearchFacets/index.tsx +1 -1
  34. package/src/components/SearchFacetsControl/index.tsx +1 -1
  35. package/src/components/TableHeader/index.tsx +4 -6
  36. package/src/components/TableHeaderItem/index.tsx +1 -1
  37. package/src/components/TableRowAsset/index.tsx +37 -45
  38. package/src/components/TableRowUpload/index.tsx +6 -1
  39. package/src/components/Tag/index.tsx +1 -0
  40. package/src/components/TagIcon/index.tsx +0 -2
  41. package/src/components/TagView/index.tsx +1 -1
  42. package/src/components/TagsPanel/index.tsx +1 -1
  43. package/src/components/Tool/index.tsx +1 -1
  44. package/src/hooks/usePortalPopoverProps.ts +1 -0
  45. package/src/plugin.tsx +0 -1
@@ -47,49 +47,42 @@ type Props = {
47
47
  selected: boolean
48
48
  }
49
49
 
50
- const ContainerGrid = styled(Grid)(
51
- // @ts-expect-error - fix typings later
52
- ({
53
- scheme,
54
- selected,
55
- updating
56
- }: {
57
- selected?: boolean
58
- scheme: ThemeColorSchemeKey
59
- updating?: boolean
60
- }) => {
50
+ const ContainerGrid = styled<
51
+ typeof Grid,
52
+ {$selected?: boolean; $scheme: ThemeColorSchemeKey; $updating?: boolean}
53
+ >(Grid)(({$scheme, $selected, $updating}) => {
54
+ return css`
55
+ align-items: center;
56
+ cursor: ${$selected ? 'default' : 'pointer'};
57
+ height: 100%;
58
+ pointer-events: ${$updating ? 'none' : 'auto'};
59
+ user-select: none;
60
+ white-space: nowrap;
61
+
62
+ ${!$updating &&
63
+ css`
64
+ @media (hover: hover) and (pointer: fine) {
65
+ &:hover {
66
+ background: ${getSchemeColor($scheme, 'bg')};
67
+ }
68
+ }
69
+ `}
70
+ `
71
+ })
72
+
73
+ const ContextActionContainer = styled<typeof Flex, {$scheme: ThemeColorSchemeKey}>(Flex)(
74
+ ({$scheme}) => {
61
75
  return css`
62
- align-items: center;
63
- cursor: ${selected ? 'default' : 'pointer'};
64
- height: 100%;
65
- pointer-events: ${updating ? 'none' : 'auto'};
66
- user-select: none;
67
- white-space: nowrap;
68
-
69
- ${!updating &&
70
- css`
71
- @media (hover: hover) and (pointer: fine) {
72
- &:hover {
73
- background: ${getSchemeColor(scheme, 'bg')};
74
- }
76
+ cursor: pointer;
77
+ @media (hover: hover) and (pointer: fine) {
78
+ &:hover {
79
+ background: ${getSchemeColor($scheme, 'bg2')};
75
80
  }
76
- `}
81
+ }
77
82
  `
78
83
  }
79
84
  )
80
85
 
81
- // @ts-expect-error - fix typings later
82
- const ContextActionContainer = styled(Flex)(({scheme}: {scheme: ThemeColorSchemeKey}) => {
83
- return css`
84
- cursor: pointer;
85
- @media (hover: hover) and (pointer: fine) {
86
- &:hover {
87
- background: ${getSchemeColor(scheme, 'bg2')};
88
- }
89
- }
90
- `
91
- })
92
-
93
86
  const StyledWarningIcon = styled(WarningFilledIcon)(({theme}) => {
94
87
  return {
95
88
  color: theme.sanity.color.spot.red
@@ -181,9 +174,8 @@ const TableRowAsset = (props: Props) => {
181
174
  return (
182
175
  <ContainerGrid
183
176
  onClick={selected ? undefined : handleClick}
184
- // @ts-expect-error - fix typings later
185
- scheme={scheme}
186
- selected={selected}
177
+ $scheme={scheme}
178
+ $selected={selected}
187
179
  style={{
188
180
  gridColumnGap: mediaIndex < 3 ? 0 : '16px',
189
181
  gridRowGap: 0,
@@ -191,13 +183,12 @@ const TableRowAsset = (props: Props) => {
191
183
  mediaIndex < 3 ? GRID_TEMPLATE_COLUMNS.SMALL : GRID_TEMPLATE_COLUMNS.LARGE,
192
184
  gridTemplateRows: mediaIndex < 3 ? 'auto' : '1fr'
193
185
  }}
194
- updating={item.updating}
186
+ $updating={item.updating}
195
187
  >
196
188
  {/* Picked checkbox */}
197
189
  <ContextActionContainer
198
190
  onClick={handleContextActionClick}
199
- // @ts-expect-error - fix typings later
200
- scheme={scheme}
191
+ $scheme={scheme}
201
192
  style={{
202
193
  alignItems: 'center',
203
194
  gridColumn: 1,
@@ -247,8 +238,8 @@ const TableRowAsset = (props: Props) => {
247
238
  {isImageAsset(asset) && (
248
239
  <Image
249
240
  draggable={false}
250
- scheme={scheme}
251
- showCheckerboard={!isOpaque}
241
+ $scheme={scheme}
242
+ $showCheckerboard={!isOpaque}
252
243
  src={imageDprUrl(asset, {height: 100, width: 100})}
253
244
  />
254
245
  )}
@@ -405,6 +396,7 @@ const TableRowAsset = (props: Props) => {
405
396
  {error && (
406
397
  <Box padding={2}>
407
398
  <Tooltip
399
+ animate
408
400
  content={
409
401
  <Container padding={2} width={0}>
410
402
  <Text size={1}>{error}</Text>
@@ -93,7 +93,12 @@ const TableRowUpload = (props: Props) => {
93
93
  >
94
94
  <Box style={{height: '100%', position: 'relative'}}>
95
95
  {item.assetType === 'image' && item?.objectUrl && (
96
- <Image draggable={false} scheme={scheme} src={item.objectUrl} style={{opacity: 0.25}} />
96
+ <Image
97
+ draggable={false}
98
+ $scheme={scheme}
99
+ src={item.objectUrl}
100
+ style={{opacity: 0.25}}
101
+ />
97
102
  )}
98
103
 
99
104
  {item.assetType === 'file' && (
@@ -46,6 +46,7 @@ const TagButton = (props: TagButtonProps) => {
46
46
 
47
47
  return (
48
48
  <Tooltip
49
+ animate
49
50
  content={
50
51
  <Container padding={2} width={0}>
51
52
  <Text muted size={1}>
@@ -1,5 +1,3 @@
1
- import React from 'react'
2
-
3
1
  const TagIcon = () => (
4
2
  <svg
5
3
  data-sanity-icon="media__tag" // For icon usage with @sanity/ui <Button />
@@ -1,5 +1,5 @@
1
1
  import {Box, Flex, Text} from '@sanity/ui'
2
- import React from 'react'
2
+
3
3
  import useTypedSelector from '../../hooks/useTypedSelector'
4
4
  import {selectAssetsPickedLength} from '../../modules/assets'
5
5
  import {selectTags} from '../../modules/tags'
@@ -1,5 +1,5 @@
1
1
  import {Box} from '@sanity/ui'
2
- import React from 'react'
2
+
3
3
  import {TAGS_PANEL_WIDTH} from '../../constants'
4
4
  import useTypedSelector from '../../hooks/useTypedSelector'
5
5
  import TagView from '../TagView'
@@ -1,5 +1,5 @@
1
1
  import {Flex} from '@sanity/ui'
2
- import React from 'react'
2
+
3
3
  import Browser from '../Browser'
4
4
 
5
5
  const Tool = () => {
@@ -4,6 +4,7 @@ export function usePortalPopoverProps(): PopoverProps {
4
4
  const portal = usePortal()
5
5
 
6
6
  return {
7
+ animate: true,
7
8
  constrainSize: true,
8
9
  floatingBoundary: portal.element,
9
10
  portal: true,
package/src/plugin.tsx CHANGED
@@ -1,4 +1,3 @@
1
- import React from 'react'
2
1
  import {type AssetSource, type Tool as SanityTool, definePlugin} from 'sanity'
3
2
  import {ImageIcon} from '@sanity/icons'
4
3
  import FormBuilderTool from './components/FormBuilderTool'