@@ -10,7 +10,7 @@ import {
10
10
defaultSystem ,
11
11
Clipboard ,
12
12
Input ,
13
- NativeSelect ,
13
+ NativeSelect as ChakraNativeSelect ,
14
14
Button ,
15
15
Link ,
16
16
} from "@chakra-ui/react" ;
@@ -157,21 +157,18 @@ const ConverterBox = ({
157
157
< Box mb = "4" />
158
158
< Box display = "flex" gap = "3" alignItems = "center" >
159
159
Type
160
- < NativeSelect . Root >
161
- < NativeSelect . Field
162
- value = { inputType }
163
- onChange = { ( e ) =>
164
- onChangeState ( { inputType : e . currentTarget . value as any } )
165
- }
166
- >
167
- { Object . entries ( dataTypes ) . map ( ( [ value , name ] ) => (
168
- < option key = { value } value = { value } >
169
- { name }
170
- </ option >
171
- ) ) }
172
- </ NativeSelect . Field >
173
- < NativeSelect . Indicator />
174
- </ NativeSelect . Root >
160
+ < NativeSelect
161
+ value = { inputType }
162
+ onChange = { ( e ) =>
163
+ onChangeState ( { inputType : e . currentTarget . value as any } )
164
+ }
165
+ >
166
+ { Object . entries ( dataTypes ) . map ( ( [ value , name ] ) => (
167
+ < option key = { value } value = { value } >
168
+ { name }
169
+ </ option >
170
+ ) ) }
171
+ </ NativeSelect >
175
172
</ Box >
176
173
< Box mb = "3" />
177
174
< Box >
@@ -202,21 +199,18 @@ const ConverterBox = ({
202
199
< Box mb = "3" />
203
200
< Box display = "flex" gap = "3" alignItems = "center" >
204
201
Type
205
- < NativeSelect . Root >
206
- < NativeSelect . Field
207
- value = { outputType }
208
- onChange = { ( e ) =>
209
- onChangeState ( { outputType : e . currentTarget . value as any } )
210
- }
211
- >
212
- { Object . entries ( dataTypes ) . map ( ( [ value , name ] ) => (
213
- < option key = { value } value = { value } >
214
- { name }
215
- </ option >
216
- ) ) }
217
- </ NativeSelect . Field >
218
- < NativeSelect . Indicator />
219
- </ NativeSelect . Root >
202
+ < NativeSelect
203
+ value = { outputType }
204
+ onChange = { ( e ) =>
205
+ onChangeState ( { outputType : e . currentTarget . value as any } )
206
+ }
207
+ >
208
+ { Object . entries ( dataTypes ) . map ( ( [ value , name ] ) => (
209
+ < option key = { value } value = { value } >
210
+ { name }
211
+ </ option >
212
+ ) ) }
213
+ </ NativeSelect >
220
214
</ Box >
221
215
< Box mb = "3" />
222
216
< Box >
@@ -235,6 +229,21 @@ const ConverterBox = ({
235
229
) ;
236
230
} ;
237
231
232
+ const NativeSelect = ( {
233
+ value,
234
+ onChange,
235
+ children,
236
+ ...props
237
+ } : Omit < ChakraNativeSelect . RootProps , "value" | "onChange" | "children" > &
238
+ Pick < ChakraNativeSelect . FieldProps , "value" | "onChange" | "children" > ) => {
239
+ return (
240
+ < ChakraNativeSelect . Root { ...props } >
241
+ < ChakraNativeSelect . Field { ...{ value, onChange, children } } />
242
+ < ChakraNativeSelect . Indicator />
243
+ </ ChakraNativeSelect . Root >
244
+ ) ;
245
+ } ;
246
+
238
247
const useConverters = ( ) => {
239
248
const [ states , setStates ] = useLocalStorage < ConverterState [ ] > (
240
249
"converterStates" ,
0 commit comments