1
- import React , { FocusEventHandler , KeyboardEventHandler , MouseEventHandler , RefObject , useRef , useState } from 'react'
2
- import { omit } from '@styled-system/props'
3
1
import { FocusKeys } from '@primer/behaviors'
2
+ import { isFocusable } from '@primer/behaviors/utils'
3
+ import { omit } from '@styled-system/props'
4
+ import React , { FocusEventHandler , KeyboardEventHandler , MouseEventHandler , RefObject , useRef , useState } from 'react'
5
+ import Box from './Box'
6
+ import { useProvidedRefOrCreate } from './hooks'
4
7
import { useCombinedRefs } from './hooks/useCombinedRefs'
5
8
import { useFocusZone } from './hooks/useFocusZone'
6
- import { ComponentProps } from './utils/types'
9
+ import Text from './Text'
10
+ import { TextInputProps } from './TextInput'
7
11
import Token from './Token/Token'
8
12
import { TokenSizeKeys } from './Token/TokenBase'
9
- import { TextInputProps } from './TextInput'
10
- import { useProvidedRefOrCreate } from './hooks'
11
- import UnstyledTextInput from './_UnstyledTextInput'
12
13
import TextInputWrapper , { textInputHorizPadding , TextInputSizes } from './_TextInputWrapper'
13
- import Box from './Box'
14
- import Text from './Text'
15
- import { isFocusable } from '@primer/behaviors/utils'
14
+ import UnstyledTextInput from './_UnstyledTextInput'
16
15
17
16
// eslint-disable-next-line @typescript-eslint/no-explicit-any
18
17
type AnyReactComponent = React . ComponentType < any >
19
18
20
19
// NOTE: if these props or their JSDoc comments are updated, be sure to also update
21
20
// the prop table in docs/content/TextInputTokens.mdx
22
- type TextInputWithTokensInternalProps < TokenComponentType extends AnyReactComponent > = {
21
+ export type TextInputWithTokensProps < TokenComponentType extends AnyReactComponent = typeof Token > = {
23
22
/**
24
23
* The array of tokens to render
25
24
*/
@@ -53,7 +52,7 @@ type TextInputWithTokensInternalProps<TokenComponentType extends AnyReactCompone
53
52
* The number of tokens to display before truncating
54
53
*/
55
54
visibleTokenCount ?: number
56
- } & TextInputProps
55
+ } & Omit < TextInputProps , 'size' >
57
56
58
57
const overflowCountFontSizeMap : Record < TokenSizeKeys , number > = {
59
58
small : 0 ,
@@ -72,7 +71,6 @@ function TextInputWithTokensInnerComponent<TokenComponentType extends AnyReactCo
72
71
className,
73
72
block,
74
73
disabled,
75
- theme,
76
74
sx : sxProp ,
77
75
tokens,
78
76
onTokenRemove,
@@ -88,10 +86,7 @@ function TextInputWithTokensInnerComponent<TokenComponentType extends AnyReactCo
88
86
variant : variantProp , // deprecated. use `size` instead
89
87
visibleTokenCount,
90
88
...rest
91
- } : TextInputWithTokensInternalProps < TokenComponentType > & {
92
- selectedTokenIndex : number | undefined
93
- setSelectedTokenIndex : React . Dispatch < React . SetStateAction < number | undefined > >
94
- } ,
89
+ } : TextInputWithTokensProps < TokenComponentType > ,
95
90
externalRef : React . ForwardedRef < HTMLInputElement >
96
91
) {
97
92
const { onBlur, onFocus, onKeyDown, ...inputPropsRest } = omit ( rest )
@@ -252,7 +247,6 @@ function TextInputWithTokensInnerComponent<TokenComponentType extends AnyReactCo
252
247
disabled = { disabled }
253
248
hasLeadingVisual = { Boolean ( LeadingVisual ) }
254
249
hasTrailingVisual = { Boolean ( TrailingVisual ) }
255
- theme = { theme }
256
250
width = { widthProp }
257
251
minWidth = { minWidthProp }
258
252
maxWidth = { maxWidthProp }
@@ -372,5 +366,4 @@ TextInputWithTokens.defaultProps = {
372
366
373
367
TextInputWithTokens . displayName = 'TextInputWithTokens'
374
368
375
- export type TextInputWithTokensProps = ComponentProps < typeof TextInputWithTokens >
376
369
export default TextInputWithTokens
0 commit comments