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<HTMLInputElement | HTMLTextAreaElement>;
|
19 | onClick?: React.MouseEventHandler;
|
20 | onChange?: React.ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
21 | onFocus?: React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
22 | inputRef?: React.Ref<HTMLInputElement | HTMLTextAreaElement>;
|
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<ExternalProps = {}> = Omit<ExternalProps, 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 | HTMLTextAreaElement> | null;
|
38 | value: string | number | readonly string[] | undefined;
|
39 | onBlur: React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
40 | onChange: React.ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
41 | onFocus: React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
42 | required: boolean;
|
43 | disabled: boolean;
|
44 | }
|
45 | export type UseInputInputSlotProps<ExternalProps = {}> = Omit<ExternalProps, 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: <ExternalProps extends Record<string, any> = {}>(externalProps?: ExternalProps) => UseInputInputSlotProps<ExternalProps>;
|
69 | |
70 |
|
71 |
|
72 |
|
73 |
|
74 | getRootProps: <ExternalProps extends Record<string, any> = {}>(externalProps?: ExternalProps) => UseInputRootSlotProps<ExternalProps>;
|
75 | inputRef: React.RefCallback<HTMLInputElement | HTMLTextAreaElement> | null;
|
76 | |
77 |
|
78 |
|
79 | required: boolean;
|
80 | |
81 |
|
82 |
|
83 | value: unknown;
|
84 | }
|