sanity-plugin-mux-input 2.3.1 → 2.3.2

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 (41) hide show
  1. package/lib/index.cjs +36 -25
  2. package/lib/index.cjs.map +1 -1
  3. package/lib/index.esm.js +14 -3
  4. package/lib/index.esm.js.map +1 -1
  5. package/lib/index.js +14 -3
  6. package/lib/index.js.map +1 -1
  7. package/package.json +1 -1
  8. package/src/components/ConfigureApi.styled.tsx +1 -2
  9. package/src/components/ConfigureApi.tsx +1 -0
  10. package/src/components/FileInputButton.tsx +1 -1
  11. package/src/components/FileInputMenuItem.styled.tsx +1 -1
  12. package/src/components/IconInfo.tsx +0 -1
  13. package/src/components/ImportVideosFromMux.tsx +2 -1
  14. package/src/components/Input.styled.tsx +0 -1
  15. package/src/components/InputBrowser.tsx +1 -1
  16. package/src/components/InputError.tsx +1 -1
  17. package/src/components/Player.styled.tsx +1 -1
  18. package/src/components/PlayerActionsMenu.tsx +3 -1
  19. package/src/components/SpinnerBox.tsx +0 -1
  20. package/src/components/StudioTool.tsx +2 -3
  21. package/src/components/UploadConfiguration.tsx +1 -0
  22. package/src/components/UploadPlaceholder.tsx +1 -1
  23. package/src/components/UploadProgress.tsx +1 -2
  24. package/src/components/Uploader.styled.tsx +1 -1
  25. package/src/components/VideoDetails/DeleteDialog.tsx +1 -0
  26. package/src/components/VideoDetails/VideoDetails.tsx +2 -0
  27. package/src/components/VideoDetails/VideoReferences.tsx +2 -3
  28. package/src/components/VideoInBrowser.tsx +2 -1
  29. package/src/components/VideoMetadata.tsx +1 -2
  30. package/src/components/VideoThumbnail.tsx +1 -1
  31. package/src/components/VideosBrowser.tsx +4 -4
  32. package/src/components/documentPreview/DraftStatus.tsx +1 -1
  33. package/src/components/documentPreview/MissingSchemaType.tsx +0 -1
  34. package/src/components/documentPreview/PaneItemPreview.tsx +5 -5
  35. package/src/components/documentPreview/PublishedStatus.tsx +1 -1
  36. package/src/components/documentPreview/TimeAgo.tsx +0 -1
  37. package/src/components/icons/Resolution.tsx +1 -1
  38. package/src/components/icons/StopWatch.tsx +1 -1
  39. package/src/components/icons/ToolIcon.tsx +0 -2
  40. package/src/components/withFocusRing/withFocusRing.ts +2 -2
  41. package/src/hooks/useImportMuxAssets.ts +2 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sanity-plugin-mux-input",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "An input component that integrates Sanity Studio with Mux video encoding/hosting service.",
5
5
  "keywords": [
6
6
  "sanity",
@@ -1,5 +1,4 @@
1
- import React from 'react'
2
- import styled from 'styled-components'
1
+ import {styled} from 'styled-components'
3
2
 
4
3
  import MuxLogo from './MuxLogo'
5
4
 
@@ -109,6 +109,7 @@ function ConfigureApi({secrets, setDialogState}: Props) {
109
109
 
110
110
  return (
111
111
  <Dialog
112
+ animate
112
113
  id={id}
113
114
  onClose={handleClose}
114
115
  header={<Header />}
@@ -1,6 +1,6 @@
1
1
  import {Button, type ButtonProps} from '@sanity/ui'
2
2
  import React, {useCallback, useId, useRef} from 'react'
3
- import styled from 'styled-components'
3
+ import {styled} from 'styled-components'
4
4
 
5
5
  const HiddenInput = styled.input`
6
6
  overflow: hidden;
@@ -1,5 +1,5 @@
1
1
  import {MenuItem} from '@sanity/ui'
2
- import styled, {css} from 'styled-components'
2
+ import {css, styled} from 'styled-components'
3
3
 
4
4
  import {focusRingStyle} from './withFocusRing/helpers'
5
5
 
@@ -1,5 +1,4 @@
1
1
  import {Flex, Text} from '@sanity/ui'
2
- import React from 'react'
3
2
 
4
3
  const IconInfo: React.FC<{
5
4
  text: string
@@ -13,7 +13,7 @@ import {
13
13
  Text,
14
14
  } from '@sanity/ui'
15
15
  import {truncateString, useFormattedDuration} from 'sanity'
16
- import styled from 'styled-components'
16
+ import {styled} from 'styled-components'
17
17
 
18
18
  import useImportMuxAssets from '../hooks/useImportMuxAssets'
19
19
  import {DIALOGS_Z_INDEX} from '../util/constants'
@@ -104,6 +104,7 @@ function ImportVideosDialog(props: ReturnType<typeof useImportMuxAssets>) {
104
104
 
105
105
  return (
106
106
  <Dialog
107
+ animate
107
108
  header={'Import videos from Mux'}
108
109
  zOffset={DIALOGS_Z_INDEX}
109
110
  id="video-details-dialog"
@@ -1,5 +1,4 @@
1
1
  import {Box, Card, Flex, Spinner, Text} from '@sanity/ui'
2
- import React from 'react'
3
2
 
4
3
  export const InputFallback = () => {
5
4
  return (
@@ -1,6 +1,6 @@
1
1
  import {Dialog} from '@sanity/ui'
2
2
  import React, {useCallback, useId} from 'react'
3
- import styled from 'styled-components'
3
+ import {styled} from 'styled-components'
4
4
 
5
5
  import type {SetDialogState} from '../hooks/useDialogState'
6
6
  import SelectAsset, {type Props as SelectAssetProps} from './SelectAsset'
@@ -8,7 +8,7 @@ interface Props {
8
8
  export default function InputError({onClose, error}: Props) {
9
9
  const id = `InputError${useId()}`
10
10
  return (
11
- <Dialog header={error.name} id={id} onClose={onClose}>
11
+ <Dialog animate header={error.name} id={id} onClose={onClose}>
12
12
  <Box padding={4}>
13
13
  <Text>{error.message}</Text>
14
14
  </Box>
@@ -1,5 +1,5 @@
1
1
  import {useState} from 'react'
2
- import styled from 'styled-components'
2
+ import {styled} from 'styled-components'
3
3
 
4
4
  import {useClient} from '../hooks/useClient'
5
5
  import {getStoryboardSrc} from '../util/getStoryboardSrc'
@@ -23,7 +23,7 @@ import {
23
23
  } from '@sanity/ui'
24
24
  import React, {memo, useCallback, useEffect, useMemo, useState} from 'react'
25
25
  import {PatchEvent, unset} from 'sanity'
26
- import styled from 'styled-components'
26
+ import {styled} from 'styled-components'
27
27
 
28
28
  import {type DialogState, type SetDialogState} from '../hooks/useDialogState'
29
29
  import {getPlaybackPolicy} from '../util/getPlaybackPolicy'
@@ -74,6 +74,7 @@ function PlayerActionsMenu(
74
74
  <Inline space={1} padding={2}>
75
75
  {isSigned && (
76
76
  <Tooltip
77
+ animate
77
78
  content={
78
79
  <Box padding={2}>
79
80
  <Text muted size={1}>
@@ -90,6 +91,7 @@ function PlayerActionsMenu(
90
91
  </Tooltip>
91
92
  )}
92
93
  <Popover
94
+ animate
93
95
  content={
94
96
  <Menu ref={setMenuRef}>
95
97
  <Box padding={2}>
@@ -1,5 +1,4 @@
1
1
  import {Box, Spinner} from '@sanity/ui'
2
- import React from 'react'
3
2
 
4
3
  const SpinnerBox: React.FC = () => (
5
4
  <Box
@@ -1,7 +1,6 @@
1
- import React from 'react'
2
- import {Tool} from 'sanity'
1
+ import type {Tool} from 'sanity'
3
2
 
4
- import {PluginConfig} from '../util/types'
3
+ import type {PluginConfig} from '../util/types'
5
4
  import ToolIcon from './icons/ToolIcon'
6
5
  import VideosBrowser from './VideosBrowser'
7
6
 
@@ -159,6 +159,7 @@ export default function UploadConfiguration({
159
159
  )
160
160
  return (
161
161
  <Dialog
162
+ animate
162
163
  open
163
164
  id="upload-configuration"
164
165
  zOffset={1000}
@@ -2,7 +2,7 @@ import {PlugIcon, SearchIcon, UploadIcon} from '@sanity/icons'
2
2
  import {DocumentVideoIcon} from '@sanity/icons'
3
3
  import {Box, Button, Card, Flex, Inline, Text} from '@sanity/ui'
4
4
  import React, {useCallback} from 'react'
5
- import styled from 'styled-components'
5
+ import {styled} from 'styled-components'
6
6
 
7
7
  import type {SetDialogState} from '../hooks/useDialogState'
8
8
  import {FileInputButton, type FileInputButtonProps} from './FileInputButton'
@@ -1,9 +1,8 @@
1
1
  // Lifted from sanity/form/inputs/files/common/UploadProgress
2
2
 
3
3
  import {Button, Card, Code, Flex, Inline, Stack, Text} from '@sanity/ui'
4
- import React from 'react'
5
4
  import {LinearProgress} from 'sanity'
6
- import styled from 'styled-components'
5
+ import {styled} from 'styled-components'
7
6
 
8
7
  export const CardWrapper = styled(Card)`
9
8
  min-height: 82px;
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable no-nested-ternary */
2
2
  import {Card, type CardTone} from '@sanity/ui'
3
3
  import React, {forwardRef, useCallback, useRef} from 'react'
4
- import styled from 'styled-components'
4
+ import {styled} from 'styled-components'
5
5
 
6
6
  import {withFocusRing} from './withFocusRing'
7
7
 
@@ -62,6 +62,7 @@ export default function DeleteDialog({
62
62
 
63
63
  return (
64
64
  <Dialog
65
+ animate
65
66
  header={'Delete video'}
66
67
  zOffset={DIALOGS_Z_INDEX}
67
68
  id="deleting-video-details-dialog"
@@ -84,6 +84,7 @@ const VideoDetails: React.FC<VideoDetailsProps> = (props) => {
84
84
 
85
85
  return (
86
86
  <Dialog
87
+ animate
87
88
  header={displayInfo.title}
88
89
  zOffset={DIALOGS_Z_INDEX}
89
90
  id="video-details-dialog"
@@ -138,6 +139,7 @@ const VideoDetails: React.FC<VideoDetailsProps> = (props) => {
138
139
  {/* CONFIRM CLOSING DIALOG */}
139
140
  {state === 'closing' && (
140
141
  <Dialog
142
+ animate
141
143
  header={'You have unsaved changes'}
142
144
  zOffset={DIALOGS_Z_INDEX}
143
145
  id="closing-video-details-dialog"
@@ -1,10 +1,9 @@
1
1
  import type {SanityDocument} from '@sanity/client'
2
2
  import {Box, Card, Text} from '@sanity/ui'
3
- import React from 'react'
4
3
  import {collate, useSchema} from 'sanity'
5
- import styled from 'styled-components'
4
+ import {styled} from 'styled-components'
6
5
 
7
- import {PluginPlacement} from '../../util/types'
6
+ import type {PluginPlacement} from '../../util/types'
8
7
  import {DocumentPreview} from '../documentPreview/DocumentPreview'
9
8
  import SpinnerBox from '../SpinnerBox'
10
9
 
@@ -1,7 +1,7 @@
1
1
  import {CheckmarkIcon, EditIcon, LockIcon, PlayIcon} from '@sanity/icons'
2
2
  import {Button, Card, Stack, Text, Tooltip} from '@sanity/ui'
3
3
  import React, {useState} from 'react'
4
- import styled from 'styled-components'
4
+ import {styled} from 'styled-components'
5
5
 
6
6
  import {THUMBNAIL_ASPECT_RATIO} from '../util/constants'
7
7
  import {getPlaybackPolicy} from '../util/getPlaybackPolicy'
@@ -101,6 +101,7 @@ export default function VideoInBrowser({
101
101
  >
102
102
  {playbackPolicy === 'signed' && (
103
103
  <Tooltip
104
+ animate
104
105
  content={
105
106
  <Card padding={2} radius={2}>
106
107
  <IconInfo icon={LockIcon} text="Signed playback policy" size={2} />
@@ -1,9 +1,8 @@
1
1
  import {CalendarIcon, ClockIcon, TagIcon} from '@sanity/icons'
2
2
  import {Inline, Stack, Text} from '@sanity/ui'
3
- import React from 'react'
4
3
 
5
4
  import getVideoMetadata from '../util/getVideoMetadata'
6
- import {VideoAssetDocument} from '../util/types'
5
+ import type {VideoAssetDocument} from '../util/types'
7
6
  import IconInfo from './IconInfo'
8
7
 
9
8
  const VideoMetadata = (props: {asset: VideoAssetDocument}) => {
@@ -1,7 +1,7 @@
1
1
  import {ErrorOutlineIcon} from '@sanity/icons'
2
2
  import {Box, Card, CardTone, Spinner, Stack, Text} from '@sanity/ui'
3
3
  import React, {useMemo, useState} from 'react'
4
- import styled from 'styled-components'
4
+ import {styled} from 'styled-components'
5
5
 
6
6
  import {useClient} from '../hooks/useClient'
7
7
  import useInView from '../hooks/useInView'
@@ -1,14 +1,14 @@
1
1
  import {SearchIcon} from '@sanity/icons'
2
2
  import {Card, Flex, Grid, Label, Stack, Text, TextInput} from '@sanity/ui'
3
- import React from 'react'
3
+ import {useMemo, useState} from 'react'
4
4
 
5
5
  import useAssets from '../hooks/useAssets'
6
6
  import type {VideoAssetDocument} from '../util/types'
7
7
  import ImportVideosFromMux from './ImportVideosFromMux'
8
8
  import {SelectSortOptions} from './SelectSortOptions'
9
9
  import SpinnerBox from './SpinnerBox'
10
+ import type {VideoDetailsProps} from './VideoDetails/useVideoDetails'
10
11
  import VideoDetails from './VideoDetails/VideoDetails'
11
- import {VideoDetailsProps} from './VideoDetails/useVideoDetails'
12
12
  import VideoInBrowser from './VideoInBrowser'
13
13
 
14
14
  export interface VideosBrowserProps {
@@ -17,8 +17,8 @@ export interface VideosBrowserProps {
17
17
 
18
18
  export default function VideosBrowser({onSelect}: VideosBrowserProps) {
19
19
  const {assets, isLoading, searchQuery, setSearchQuery, setSort, sort} = useAssets()
20
- const [editedAsset, setEditedAsset] = React.useState<VideoDetailsProps['asset'] | null>(null)
21
- const freshEditedAsset = React.useMemo(
20
+ const [editedAsset, setEditedAsset] = useState<VideoDetailsProps['asset'] | null>(null)
21
+ const freshEditedAsset = useMemo(
22
22
  () => assets.find((a) => a._id === editedAsset?._id) || editedAsset,
23
23
  [editedAsset, assets]
24
24
  )
@@ -1,7 +1,6 @@
1
1
  // Adapted from https://github.com/sanity-io/sanity/blob/next/packages/sanity/src/desk/components/DraftStatus.tsx
2
2
  import {EditIcon} from '@sanity/icons'
3
3
  import {Box, Text, Tooltip} from '@sanity/ui'
4
- import React from 'react'
5
4
  import type {PreviewValue, SanityDocument} from 'sanity'
6
5
  import {TextWithTone} from 'sanity'
7
6
 
@@ -13,6 +12,7 @@ export function DraftStatus(props: {document?: PreviewValue | Partial<SanityDocu
13
12
 
14
13
  return (
15
14
  <Tooltip
15
+ animate
16
16
  portal
17
17
  content={
18
18
  <Box padding={2}>
@@ -1,6 +1,5 @@
1
1
  // Adapted from https://github.com/sanity-io/sanity/blob/next/packages/sanity/src/desk/components/MissingSchemaType.tsx
2
2
  import {WarningOutlineIcon} from '@sanity/icons'
3
- import React from 'react'
4
3
  import type {SanityDocument} from 'sanity'
5
4
  import type {GeneralPreviewLayoutKey} from 'sanity'
6
5
  import {SanityDefaultPreview} from 'sanity'
@@ -2,15 +2,15 @@
2
2
  // https://github.com/sanity-io/sanity/blob/next/packages/sanity/src/desk/components/paneItem/PaneItemPreview.tsx
3
3
  import {Inline} from '@sanity/ui'
4
4
  import {isNumber, isString} from 'lodash'
5
- import React, {isValidElement} from 'react'
5
+ import {isValidElement} from 'react'
6
6
  import {useMemoObservable} from 'react-rx'
7
7
  import type {SanityDocument, SchemaType} from 'sanity'
8
- import {PreviewValue} from 'sanity'
8
+ import type {PreviewValue} from 'sanity'
9
9
  import {
10
- DocumentPresence,
10
+ type DocumentPresence,
11
11
  DocumentPreviewPresence,
12
- DocumentPreviewStore,
13
- GeneralPreviewLayoutKey,
12
+ type DocumentPreviewStore,
13
+ type GeneralPreviewLayoutKey,
14
14
  getPreviewStateObservable,
15
15
  getPreviewValueWithFallback,
16
16
  isRecord,
@@ -2,7 +2,6 @@
2
2
 
3
3
  import {PublishIcon} from '@sanity/icons'
4
4
  import {Box, Text, Tooltip} from '@sanity/ui'
5
- import React from 'react'
6
5
  import type {PreviewValue, SanityDocument} from 'sanity'
7
6
  import {TextWithTone} from 'sanity'
8
7
 
@@ -14,6 +13,7 @@ export function PublishedStatus(props: {document?: PreviewValue | Partial<Sanity
14
13
 
15
14
  return (
16
15
  <Tooltip
16
+ animate
17
17
  portal
18
18
  content={
19
19
  <Box padding={2}>
@@ -1,5 +1,4 @@
1
1
  // Adapted from https://github.com/sanity-io/sanity/blob/next/packages/sanity/src/desk/components/TimeAgo.tsx
2
- import React from 'react'
3
2
  import {useTimeAgo} from 'sanity'
4
3
 
5
4
  export interface TimeAgoProps {
@@ -1,4 +1,4 @@
1
- import React, {SVGProps} from 'react'
1
+ import type {SVGProps} from 'react'
2
2
 
3
3
  export function ResolutionIcon(props: SVGProps<SVGSVGElement>) {
4
4
  return (
@@ -1,4 +1,4 @@
1
- import React, {SVGProps} from 'react'
1
+ import type {SVGProps} from 'react'
2
2
 
3
3
  export function StopWatchIcon(props: SVGProps<SVGSVGElement>) {
4
4
  return (
@@ -1,5 +1,3 @@
1
- import React from 'react'
2
-
3
1
  /**
4
2
  * Icon of a monitor with a play button.
5
3
  * Credits: material design icons & react-icons
@@ -1,6 +1,6 @@
1
1
  import {rem} from '@sanity/ui'
2
- import {type ComponentType} from 'react'
3
- import styled, {css} from 'styled-components'
2
+ import type {ComponentType} from 'react'
3
+ import {css, styled} from 'styled-components'
4
4
 
5
5
  import {focusRingBorderStyle, focusRingStyle} from './helpers'
6
6
 
@@ -2,11 +2,12 @@ import {uuid} from '@sanity/uuid'
2
2
  import {useMemo, useState} from 'react'
3
3
  import {
4
4
  createHookFromObservableFactory,
5
+ type DocumentStore,
5
6
  truncateString,
6
7
  useClient,
7
8
  useDocumentStore,
8
- type DocumentStore,
9
9
  } from 'sanity'
10
+
10
11
  import {parseMuxDate} from '../util/parsers'
11
12
  import type {MuxAsset, VideoAssetDocument} from '../util/types'
12
13
  import {SANITY_API_VERSION} from './useClient'