sanity-plugin-media 2.0.4 → 2.0.6

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.
@@ -0,0 +1,12 @@
1
+ import {PopoverProps, usePortal} from '@sanity/ui'
2
+
3
+ export function usePortalPopoverProps(): PopoverProps {
4
+ const portal = usePortal()
5
+
6
+ return {
7
+ constrainSize: true,
8
+ floatingBoundary: portal.element,
9
+ portal: true,
10
+ referenceBoundary: portal.element
11
+ }
12
+ }
@@ -1,4 +1,9 @@
1
- import {combineReducers} from '@reduxjs/toolkit'
1
+ import {
2
+ ActionFromReducersMapObject,
3
+ Reducer,
4
+ StateFromReducersMapObject,
5
+ combineReducers
6
+ } from '@reduxjs/toolkit'
2
7
  import {combineEpics} from 'redux-observable'
3
8
 
4
9
  import assetsReducer, {
@@ -97,7 +102,7 @@ export const rootEpic = combineEpics(
97
102
  uploadsCompleteQueueEpic
98
103
  )
99
104
 
100
- const reducers = combineReducers({
105
+ const reducers = {
101
106
  assets: assetsReducer,
102
107
  debug: debugReducer,
103
108
  dialog: dialogReducer,
@@ -106,5 +111,14 @@ const reducers = combineReducers({
106
111
  selected: selectedReducer,
107
112
  tags: tagsReducer,
108
113
  uploads: uploadsReducer
109
- })
110
- export const rootReducer = reducers
114
+ }
115
+
116
+ type ReducersMapObject = typeof reducers
117
+
118
+ // Workaround to avoid `$CombinedState` ts errors
119
+ // source: https://github.com/reduxjs/redux-toolkit/issues/2068#issuecomment-1130796500
120
+ // TODO: remove once we use `redux-toolkit` v2
121
+ export const rootReducer: Reducer<
122
+ StateFromReducersMapObject<ReducersMapObject>,
123
+ ActionFromReducersMapObject<ReducersMapObject>
124
+ > = combineReducers(reducers)
@@ -1,50 +0,0 @@
1
- import {Box, Flex, TextInput} from '@sanity/ui'
2
- import React, {forwardRef} from 'react'
3
- import {FieldError} from 'react-hook-form'
4
-
5
- import FormFieldInputLabel from '../FormFieldInputLabel'
6
-
7
- type Props = {
8
- description?: string
9
- extension: string
10
- disabled?: boolean
11
- error?: FieldError
12
- label: string
13
- name: string
14
- placeholder?: string
15
- value?: string
16
- }
17
-
18
- type Ref = HTMLInputElement
19
-
20
- const FormFieldInputText = forwardRef<Ref, Props>((props: Props, ref) => {
21
- const {description, disabled, error, extension, label, name, placeholder, value} = props
22
-
23
- return (
24
- <Box>
25
- {/* Label */}
26
- <FormFieldInputLabel description={description} error={error} label={label} name={name} />
27
-
28
- {/* Input */}
29
- <Flex>
30
- <Box style={{flexGrow: 1}}>
31
- <TextInput
32
- autoComplete="off"
33
- autoFocus
34
- defaultValue={value}
35
- disabled={disabled}
36
- id={name}
37
- name={name}
38
- placeholder={placeholder}
39
- ref={ref}
40
- />
41
- </Box>
42
- <Box style={{width: '70px'}}>
43
- <TextInput defaultValue={`.${extension}`} disabled />
44
- </Box>
45
- </Flex>
46
- </Box>
47
- )
48
- })
49
-
50
- export default FormFieldInputText