1 | import * as React from 'react';
|
2 | import { Simplify } from '@mui/types';
|
3 | import { FormControlState } from '../FormControl';
|
4 | import { UseInputParameters, UseInputRootSlotProps } from '../useInput';
|
5 | import { PolymorphicProps, SlotComponentProps } from '../utils';
|
6 | export interface InputRootSlotPropsOverrides {
|
7 | }
|
8 | export interface InputInputSlotPropsOverrides {
|
9 | }
|
10 | export interface SingleLineInputProps {
|
11 | |
12 |
|
13 |
|
14 | maxRows?: undefined;
|
15 | |
16 |
|
17 |
|
18 | minRows?: undefined;
|
19 | |
20 |
|
21 |
|
22 |
|
23 | multiline?: false;
|
24 | |
25 |
|
26 |
|
27 | rows?: undefined;
|
28 | |
29 |
|
30 |
|
31 |
|
32 | type?: React.HTMLInputTypeAttribute;
|
33 | }
|
34 | export interface MultiLineInputProps {
|
35 | |
36 |
|
37 |
|
38 | maxRows?: number;
|
39 | |
40 |
|
41 |
|
42 | minRows?: number;
|
43 | |
44 |
|
45 |
|
46 |
|
47 | multiline: true;
|
48 | |
49 |
|
50 |
|
51 | rows?: number;
|
52 | |
53 |
|
54 |
|
55 |
|
56 | type?: undefined;
|
57 | }
|
58 | export type InputOwnProps = (SingleLineInputProps | MultiLineInputProps) & Omit<UseInputParameters, 'error'> & {
|
59 | 'aria-describedby'?: string;
|
60 | 'aria-label'?: string;
|
61 | 'aria-labelledby'?: string;
|
62 | |
63 |
|
64 |
|
65 |
|
66 |
|
67 | autoComplete?: string;
|
68 | |
69 |
|
70 |
|
71 | autoFocus?: boolean;
|
72 | |
73 |
|
74 |
|
75 | className?: string;
|
76 | |
77 |
|
78 |
|
79 | endAdornment?: React.ReactNode;
|
80 | |
81 |
|
82 |
|
83 |
|
84 | error?: boolean;
|
85 | |
86 |
|
87 |
|
88 | id?: string;
|
89 | |
90 |
|
91 |
|
92 | name?: string;
|
93 | onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
|
94 | onKeyUp?: React.KeyboardEventHandler<HTMLInputElement>;
|
95 | |
96 |
|
97 |
|
98 | placeholder?: string;
|
99 | |
100 |
|
101 |
|
102 |
|
103 | readOnly?: boolean;
|
104 | |
105 |
|
106 |
|
107 |
|
108 | slotProps?: {
|
109 | root?: SlotComponentProps<'div', InputRootSlotPropsOverrides, InputOwnerState>;
|
110 | input?: SlotComponentProps<'input', InputInputSlotPropsOverrides, InputOwnerState>;
|
111 | };
|
112 | |
113 |
|
114 |
|
115 |
|
116 |
|
117 | slots?: InputSlots;
|
118 | |
119 |
|
120 |
|
121 | startAdornment?: React.ReactNode;
|
122 | |
123 |
|
124 |
|
125 | value?: unknown;
|
126 | };
|
127 | export interface InputSlots {
|
128 | |
129 |
|
130 |
|
131 |
|
132 | root?: React.ElementType;
|
133 | |
134 |
|
135 |
|
136 |
|
137 | input?: React.ElementType;
|
138 | |
139 |
|
140 |
|
141 |
|
142 | textarea?: React.ElementType;
|
143 | }
|
144 | export interface InputTypeMap<AdditionalProps = {}, RootComponentType extends React.ElementType = 'div'> {
|
145 | props: InputOwnProps & AdditionalProps;
|
146 | defaultComponent: RootComponentType;
|
147 | }
|
148 | export type InputProps<RootComponentType extends React.ElementType = InputTypeMap['defaultComponent']> = PolymorphicProps<InputTypeMap<{}, RootComponentType>, RootComponentType>;
|
149 | export type InputOwnerState = Simplify<InputOwnProps & {
|
150 | formControlContext: FormControlState | undefined;
|
151 | focused: boolean;
|
152 | type: React.InputHTMLAttributes<HTMLInputElement>['type'] | undefined;
|
153 | }>;
|
154 | export type InputRootSlotProps = Simplify<UseInputRootSlotProps & {
|
155 | ownerState: InputOwnerState;
|
156 | className?: string;
|
157 | children?: React.ReactNode;
|
158 | ref?: React.Ref<HTMLDivElement>;
|
159 | }>;
|
160 | export type InputInputSlotProps = Simplify<Omit<UseInputRootSlotProps, 'onClick'> & {
|
161 | 'aria-describedby': React.AriaAttributes['aria-describedby'];
|
162 | 'aria-label': React.AriaAttributes['aria-label'];
|
163 | 'aria-labelledby': React.AriaAttributes['aria-labelledby'];
|
164 | autoComplete: string | undefined;
|
165 | autoFocus: boolean | undefined;
|
166 | className?: string;
|
167 | id: string | undefined;
|
168 | name: string | undefined;
|
169 | onKeyDown: React.KeyboardEventHandler<HTMLInputElement> | undefined;
|
170 | onKeyUp: React.KeyboardEventHandler<HTMLInputElement> | undefined;
|
171 | ownerState: InputOwnerState;
|
172 | placeholder: string | undefined;
|
173 | readOnly: boolean | undefined;
|
174 | ref: React.Ref<HTMLInputElement>;
|
175 | type: React.HTMLInputTypeAttribute | undefined;
|
176 | }>;
|