1
1
import React , { type ComponentProps } from 'react'
2
+ import { type ResponsiveValue } from 'styled-system'
3
+ import type { SxProp } from '../../sx'
2
4
import type { FormValidationStatus } from '../../utils/types/FormValidationStatus'
3
5
import { clsx } from 'clsx'
4
6
@@ -22,7 +24,13 @@ type StyledTextInputBaseWrapperProps = {
22
24
style ?: React . CSSProperties
23
25
onClick ?: React . MouseEventHandler
24
26
children ?: React . ReactNode
25
- }
27
+ /** @deprecated Update `width` using CSS modules or style. */
28
+ width ?: string | number | ResponsiveValue < string | number >
29
+ /** @deprecated Update `min-width` using CSS modules or style. */
30
+ minWidth ?: string | number | ResponsiveValue < string | number >
31
+ /** @deprecated Update `max-width` using CSS modules or style. */
32
+ maxWidth ?: string | number | ResponsiveValue < string | number >
33
+ } & SxProp
26
34
27
35
type StyledTextInputWrapperProps = {
28
36
hasLeadingVisual ?: boolean
@@ -33,6 +41,7 @@ export const TextInputBaseWrapper = React.forwardRef<HTMLElement, StyledTextInpu
33
41
function TextInputBaseWrapper (
34
42
{
35
43
className,
44
+ style,
36
45
variant,
37
46
size,
38
47
isInputFocused,
@@ -42,6 +51,9 @@ export const TextInputBaseWrapper = React.forwardRef<HTMLElement, StyledTextInpu
42
51
contrast,
43
52
monospace,
44
53
block,
54
+ width,
55
+ minWidth,
56
+ maxWidth,
45
57
...restProps
46
58
} ,
47
59
forwardRef ,
@@ -60,6 +72,11 @@ export const TextInputBaseWrapper = React.forwardRef<HTMLElement, StyledTextInpu
60
72
data-trailing-action = { hasTrailingAction || undefined }
61
73
data-validation = { validationStatus || undefined }
62
74
data-variant = { variant || undefined }
75
+ style = {
76
+ typeof width === 'string' || typeof minWidth === 'string' || typeof maxWidth === 'string'
77
+ ? { width, maxWidth, minWidth, ...style }
78
+ : style
79
+ }
63
80
{ ...restProps }
64
81
/>
65
82
)
0 commit comments