1 |
|
2 | import { Simplify } from '@mui/types';
|
3 | import { FormControlState } from '../FormControl';
|
4 | import { UseNumberInputParameters, UseNumberInputRootSlotProps, UseNumberInputIncrementButtonSlotProps, UseNumberInputDecrementButtonSlotProps } from '../unstable_useNumberInput/useNumberInput.types';
|
5 | import { PolymorphicProps, SlotComponentProps } from '../utils';
|
6 | export interface NumberInputRootSlotPropsOverrides {
|
7 | }
|
8 | export interface NumberInputInputSlotPropsOverrides {
|
9 | }
|
10 | export interface NumberInputStepperButtonSlotPropsOverrides {
|
11 | }
|
12 | export type NumberInputOwnProps = Omit<UseNumberInputParameters, 'error' | 'inputId' | 'inputRef'> & {
|
13 | |
14 |
|
15 |
|
16 | endAdornment?: React.ReactNode;
|
17 | |
18 |
|
19 |
|
20 | error?: boolean;
|
21 | |
22 |
|
23 |
|
24 | id?: string;
|
25 | |
26 |
|
27 |
|
28 | placeholder?: React.InputHTMLAttributes<HTMLInputElement>['placeholder'];
|
29 | |
30 |
|
31 |
|
32 |
|
33 | slotProps?: {
|
34 | root?: SlotComponentProps<'div', NumberInputRootSlotPropsOverrides, NumberInputOwnerState>;
|
35 | input?: SlotComponentProps<'input', NumberInputInputSlotPropsOverrides, NumberInputOwnerState>;
|
36 | incrementButton?: SlotComponentProps<'button', NumberInputStepperButtonSlotPropsOverrides, NumberInputOwnerState>;
|
37 | decrementButton?: SlotComponentProps<'button', NumberInputStepperButtonSlotPropsOverrides, NumberInputOwnerState>;
|
38 | };
|
39 | |
40 |
|
41 |
|
42 |
|
43 |
|
44 | slots?: NumberInputSlots;
|
45 | |
46 |
|
47 |
|
48 | startAdornment?: React.ReactNode;
|
49 | };
|
50 | export interface NumberInputSlots {
|
51 | |
52 |
|
53 |
|
54 |
|
55 | root?: React.ElementType;
|
56 | |
57 |
|
58 |
|
59 |
|
60 | input?: React.ElementType;
|
61 | |
62 |
|
63 |
|
64 |
|
65 | incrementButton?: React.ElementType;
|
66 | |
67 |
|
68 |
|
69 |
|
70 | decrementButton?: React.ElementType;
|
71 | }
|
72 | export interface NumberInputTypeMap<AdditionalProps = {}, RootComponentType extends React.ElementType = 'div'> {
|
73 | props: AdditionalProps & NumberInputOwnProps;
|
74 | defaultComponent: RootComponentType;
|
75 | }
|
76 | export type NumberInputProps<RootComponentType extends React.ElementType = NumberInputTypeMap['defaultComponent']> = PolymorphicProps<NumberInputTypeMap<{}, RootComponentType>, RootComponentType>;
|
77 | export type NumberInputOwnerState = Simplify<NumberInputOwnProps & {
|
78 | formControlContext: FormControlState | undefined;
|
79 | focused: boolean;
|
80 | isIncrementDisabled: boolean;
|
81 | isDecrementDisabled: boolean;
|
82 | }>;
|
83 | export type NumberInputRootSlotProps = Simplify<UseNumberInputRootSlotProps & {
|
84 | ownerState: NumberInputOwnerState;
|
85 | className?: string;
|
86 | children?: React.ReactNode;
|
87 | ref?: React.Ref<Element>;
|
88 | }>;
|
89 | export type NumberInputInputSlotProps = Simplify<Omit<UseNumberInputRootSlotProps, 'onClick'> & {
|
90 | id: string | undefined;
|
91 | ownerState: NumberInputOwnerState;
|
92 | placeholder: string | undefined;
|
93 | ref: React.Ref<HTMLInputElement>;
|
94 | }>;
|
95 | export type NumberInputIncrementButtonSlotProps = Simplify<UseNumberInputIncrementButtonSlotProps & {
|
96 | ownerState: NumberInputOwnerState;
|
97 | }>;
|
98 | export type NumberInputDecrementButtonSlotProps = Simplify<UseNumberInputDecrementButtonSlotProps & {
|
99 | ownerState: NumberInputOwnerState;
|
100 | }>;
|