@@ -4,7 +4,6 @@ import {omit} from '@styled-system/props'
44import type { FocusEventHandler , KeyboardEventHandler , MouseEventHandler , RefObject } from 'react'
55import React , { useRef , useState } from 'react'
66import { isValidElementType } from 'react-is'
7- import Box from '../Box'
87import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef'
98import { useFocusZone } from '../hooks/useFocusZone'
109import Text from '../Text'
@@ -14,12 +13,10 @@ import type {TokenSizeKeys} from '../Token/TokenBase'
1413
1514import type { TextInputSizes } from '../internal/components/TextInputWrapper'
1615import TextInputWrapper from '../internal/components/TextInputWrapper'
17- import UnstyledTextInput , { TEXT_INPUT_CSS_MODULES_FEATURE_FLAG } from '../internal/components/UnstyledTextInput'
16+ import UnstyledTextInput from '../internal/components/UnstyledTextInput'
1817import TextInputInnerVisualSlot from '../internal/components/TextInputInnerVisualSlot'
19- import { useFeatureFlag } from '../FeatureFlags'
2018import styles from './TextInputWithTokens.module.css'
2119import { clsx } from 'clsx'
22- import type { BetterSystemStyleObject } from '../sx'
2320
2421// eslint-disable-next-line @typescript-eslint/no-explicit-any
2522type AnyReactComponent = React . ComponentType < React . PropsWithChildren < any > >
@@ -255,48 +252,6 @@ function TextInputWithTokensInnerComponent<TokenComponentType extends AnyReactCo
255252 const showTrailingLoadingIndicator =
256253 loading && ( loaderPosition === 'trailing' || ( loaderPosition === 'auto' && ! LeadingVisual ) )
257254
258- const enabled = useFeatureFlag ( TEXT_INPUT_CSS_MODULES_FEATURE_FLAG )
259-
260- const stylingProps = React . useMemo (
261- ( ) =>
262- enabled
263- ? {
264- className : clsx ( className , styles . TextInputWrapper ) ,
265- style : maxHeight ? { maxHeight, ...style } : style ,
266- sx : sxProp ,
267- }
268- : {
269- className,
270- style,
271- sx : {
272- paddingLeft : '12px' ,
273- py : '6px' ,
274- ...( block
275- ? {
276- display : 'flex' ,
277- width : '100%' ,
278- }
279- : { } ) ,
280-
281- ...( maxHeight
282- ? {
283- maxHeight,
284- overflow : 'auto' ,
285- }
286- : { } ) ,
287-
288- ...( preventTokenWrapping
289- ? {
290- overflow : 'auto' ,
291- }
292- : { } ) ,
293-
294- ...sxProp ,
295- } as BetterSystemStyleObject ,
296- } ,
297- [ block , className , enabled , maxHeight , preventTokenWrapping , style , sxProp ] ,
298- )
299-
300255 return (
301256 < TextInputWrapper
302257 block = { block }
@@ -312,7 +267,9 @@ function TextInputWithTokensInnerComponent<TokenComponentType extends AnyReactCo
312267 variant = { variantProp } // deprecated. use `size` prop instead
313268 onClick = { focusInput }
314269 data-token-wrapping = { Boolean ( preventTokenWrapping || maxHeight ) || undefined }
315- { ...stylingProps }
270+ className = { clsx ( className , styles . TextInputWrapper ) }
271+ style = { maxHeight ? { maxHeight, ...style } : style }
272+ sx = { sxProp }
316273 >
317274 { IconComponent && ! LeadingVisual && < IconComponent className = "TextInput-icon" /> }
318275 < TextInputInnerVisualSlot
@@ -322,42 +279,24 @@ function TextInputWithTokensInnerComponent<TokenComponentType extends AnyReactCo
322279 >
323280 { typeof LeadingVisual !== 'string' && isValidElementType ( LeadingVisual ) ? < LeadingVisual /> : LeadingVisual }
324281 </ TextInputInnerVisualSlot >
325- < Box
282+ < div
326283 ref = { containerRef as RefObject < HTMLDivElement > }
327- display = "flex"
328- sx = { {
329- alignItems : 'center' ,
330- flexWrap : preventTokenWrapping ? 'nowrap' : 'wrap' ,
331- marginLeft : '-0.25rem' ,
332- marginBottom : '-0.25rem' ,
333- flexGrow : 1 ,
334-
335- '> *' : {
336- flexShrink : 0 ,
337- marginLeft : '0.25rem' ,
338- marginBottom : '0.25rem' ,
339- } ,
340- } }
284+ className = { styles . Container }
285+ data-prevent-token-wrapping = { preventTokenWrapping }
341286 >
342- < Box
343- sx = { {
344- order : 1 ,
345- flexGrow : 1 ,
346- } }
347- >
287+ < div className = { styles . InputWrapper } >
348288 < UnstyledTextInput
349289 ref = { ref }
350290 disabled = { disabled }
351291 onFocus = { handleInputFocus }
352292 onBlur = { handleInputBlur }
353293 onKeyDown = { handleInputKeyDown }
354294 type = "text"
355- sx = { enabled ? undefined : { height : '100%' } }
356- className = { enabled ? styles . UnstyledTextInput : undefined }
295+ className = { styles . UnstyledTextInput }
357296 aria-invalid = { validationStatus === 'error' ? 'true' : 'false' }
358297 { ...inputPropsRest }
359298 />
360- </ Box >
299+ </ div >
361300 { visibleTokens . map ( ( { id, ...tokenRest } , i ) => (
362301 < TokenComponent
363302 disabled = { disabled }
@@ -381,7 +320,7 @@ function TextInputWithTokensInnerComponent<TokenComponentType extends AnyReactCo
381320 +{ tokens . length - visibleTokens . length }
382321 </ Text >
383322 ) : null }
384- </ Box >
323+ </ div >
385324 < TextInputInnerVisualSlot
386325 hasLoadingIndicator = { typeof loading === 'boolean' }
387326 visualPosition = "trailing"
0 commit comments