1 | import * as React from 'react';
|
2 | import { FormControlState } from '../FormControl';
|
3 | export interface UseInputParameters {
|
4 | |
5 |
|
6 |
|
7 | defaultValue?: unknown;
|
8 | |
9 |
|
10 |
|
11 |
|
12 | disabled?: boolean;
|
13 | |
14 |
|
15 |
|
16 |
|
17 | error?: boolean;
|
18 | onBlur?: React.FocusEventHandler;
|
19 | onClick?: React.MouseEventHandler;
|
20 | onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
21 | onFocus?: React.FocusEventHandler;
|
22 | inputRef?: React.Ref<HTMLInputElement>;
|
23 | |
24 |
|
25 |
|
26 |
|
27 | required?: boolean;
|
28 | value?: unknown;
|
29 | }
|
30 | export interface UseInputRootSlotOwnProps {
|
31 | onClick: React.MouseEventHandler | undefined;
|
32 | }
|
33 | export type UseInputRootSlotProps<TOther = {}> = Omit<TOther, keyof UseInputRootSlotOwnProps | 'onBlur' | 'onChange' | 'onFocus'> & UseInputRootSlotOwnProps;
|
34 | export interface UseInputInputSlotOwnProps {
|
35 | 'aria-invalid': React.AriaAttributes['aria-invalid'];
|
36 | defaultValue: string | number | readonly string[] | undefined;
|
37 | ref: React.RefCallback<HTMLInputElement> | null;
|
38 | value: string | number | readonly string[] | undefined;
|
39 | onBlur: React.FocusEventHandler;
|
40 | onChange: React.ChangeEventHandler<HTMLInputElement>;
|
41 | onFocus: React.FocusEventHandler;
|
42 | required: boolean;
|
43 | disabled: boolean;
|
44 | }
|
45 | export type UseInputInputSlotProps<TOther = {}> = Omit<TOther, keyof UseInputInputSlotOwnProps> & UseInputInputSlotOwnProps;
|
46 | export interface UseInputReturnValue {
|
47 | |
48 |
|
49 |
|
50 | disabled: boolean;
|
51 | |
52 |
|
53 |
|
54 | error: boolean;
|
55 | |
56 |
|
57 |
|
58 | focused: boolean;
|
59 | |
60 |
|
61 |
|
62 | formControlContext: FormControlState | undefined;
|
63 | |
64 |
|
65 |
|
66 |
|
67 |
|
68 | getInputProps: <TOther extends Record<string, any> = {}>(externalProps?: TOther) => UseInputInputSlotProps<TOther>;
|
69 | |
70 |
|
71 |
|
72 |
|
73 |
|
74 | getRootProps: <TOther extends Record<string, any> = {}>(externalProps?: TOther) => UseInputRootSlotProps<TOther>;
|
75 | inputRef: React.RefCallback<HTMLInputElement> | null;
|
76 | |
77 |
|
78 |
|
79 | required: boolean;
|
80 | |
81 |
|
82 |
|
83 | value: unknown;
|
84 | }
|