@@ -4,7 +4,6 @@ import {omit} from '@styled-system/props'
4
4
import type { FocusEventHandler , KeyboardEventHandler , MouseEventHandler , RefObject } from 'react'
5
5
import React , { useRef , useState } from 'react'
6
6
import { isValidElementType } from 'react-is'
7
- import Box from '../Box'
8
7
import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef'
9
8
import { useFocusZone } from '../hooks/useFocusZone'
10
9
import Text from '../Text'
@@ -14,12 +13,10 @@ import type {TokenSizeKeys} from '../Token/TokenBase'
14
13
15
14
import type { TextInputSizes } from '../internal/components/TextInputWrapper'
16
15
import 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'
18
17
import TextInputInnerVisualSlot from '../internal/components/TextInputInnerVisualSlot'
19
- import { useFeatureFlag } from '../FeatureFlags'
20
18
import styles from './TextInputWithTokens.module.css'
21
19
import { clsx } from 'clsx'
22
- import type { BetterSystemStyleObject } from '../sx'
23
20
24
21
// eslint-disable-next-line @typescript-eslint/no-explicit-any
25
22
type AnyReactComponent = React . ComponentType < React . PropsWithChildren < any > >
@@ -255,48 +252,6 @@ function TextInputWithTokensInnerComponent<TokenComponentType extends AnyReactCo
255
252
const showTrailingLoadingIndicator =
256
253
loading && ( loaderPosition === 'trailing' || ( loaderPosition === 'auto' && ! LeadingVisual ) )
257
254
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
-
300
255
return (
301
256
< TextInputWrapper
302
257
block = { block }
@@ -312,7 +267,9 @@ function TextInputWithTokensInnerComponent<TokenComponentType extends AnyReactCo
312
267
variant = { variantProp } // deprecated. use `size` prop instead
313
268
onClick = { focusInput }
314
269
data-token-wrapping = { Boolean ( preventTokenWrapping || maxHeight ) || undefined }
315
- { ...stylingProps }
270
+ className = { clsx ( className , styles . TextInputWrapper ) }
271
+ style = { maxHeight ? { maxHeight, ...style } : style }
272
+ sx = { sxProp }
316
273
>
317
274
{ IconComponent && ! LeadingVisual && < IconComponent className = "TextInput-icon" /> }
318
275
< TextInputInnerVisualSlot
@@ -322,42 +279,24 @@ function TextInputWithTokensInnerComponent<TokenComponentType extends AnyReactCo
322
279
>
323
280
{ typeof LeadingVisual !== 'string' && isValidElementType ( LeadingVisual ) ? < LeadingVisual /> : LeadingVisual }
324
281
</ TextInputInnerVisualSlot >
325
- < Box
282
+ < div
326
283
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 }
341
286
>
342
- < Box
343
- sx = { {
344
- order : 1 ,
345
- flexGrow : 1 ,
346
- } }
347
- >
287
+ < div className = { styles . InputWrapper } >
348
288
< UnstyledTextInput
349
289
ref = { ref }
350
290
disabled = { disabled }
351
291
onFocus = { handleInputFocus }
352
292
onBlur = { handleInputBlur }
353
293
onKeyDown = { handleInputKeyDown }
354
294
type = "text"
355
- sx = { enabled ? undefined : { height : '100%' } }
356
- className = { enabled ? styles . UnstyledTextInput : undefined }
295
+ className = { styles . UnstyledTextInput }
357
296
aria-invalid = { validationStatus === 'error' ? 'true' : 'false' }
358
297
{ ...inputPropsRest }
359
298
/>
360
- </ Box >
299
+ </ div >
361
300
{ visibleTokens . map ( ( { id, ...tokenRest } , i ) => (
362
301
< TokenComponent
363
302
disabled = { disabled }
@@ -381,7 +320,7 @@ function TextInputWithTokensInnerComponent<TokenComponentType extends AnyReactCo
381
320
+{ tokens . length - visibleTokens . length }
382
321
</ Text >
383
322
) : null }
384
- </ Box >
323
+ </ div >
385
324
< TextInputInnerVisualSlot
386
325
hasLoadingIndicator = { typeof loading === 'boolean' }
387
326
visualPosition = "trailing"
0 commit comments