@massds/mayflower-react
Version:
React versions of Mayflower design system UI components
71 lines (70 loc) • 2.29 kB
TypeScript
export interface NumberInputProps {
required?: boolean;
showButtons?: boolean;
unit?: string;
disabled?: boolean;
min?: string | number;
max?: string | number;
step?: string | number;
onBlur?(...args: unknown[]): unknown;
onChange?(...args: unknown[]): unknown;
name?: string;
id?: string;
maxlength?: number;
placeholder?: string;
width?: number;
}
export interface InputNumberProps {
/** Whether the label should be hidden or not */
hiddenLabel?: boolean;
/** The label text for the input field, can be a string or a component */
labelText: string | object;
/** Whether the field is required or not */
required?: boolean;
/** Whether the field is disabled or not */
disabled?: boolean;
/** The unique ID for the input field */
id: string;
/** The name for the input field */
name: string;
/** The max acceptable input length */
maxlength?: number;
/** The pattern to filter input against, e.g. "[0-9]" for numbers only */
pattern?: string;
/** The number of characters wide to make the input field */
width?: number;
/** The placeholder text for the input field */
placeholder?: string;
/** The message to be displayed in the event of an error. */
errorMsg?: string;
/** Custom change function */
onChange?(...args: unknown[]): unknown;
/** Custom onBlur function */
onBlur?(...args: unknown[]): unknown;
/** Default input value */
defaultValue?: number;
/** Max value for the field. */
max?: number;
/** Min value for the field. */
min?: number;
/** Using the up/down arrow keys will increment/decrement the input value by this number. */
step?: number;
/** Inline label and input field */
inline?: boolean;
/** A unit that is a string of no more than 2 characters renders in the input after the value, e.g. % */
unit?: unknown;
/** Whether to render up/down buttons */
showButtons?: boolean;
}
declare const InputNumber: {
(props: InputNumberProps): any;
defaultProps: {
hiddenLabel: boolean;
required: boolean;
onChange: any;
step: number;
showButtons: boolean;
unit: string;
};
};
export default InputNumber;