@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
57 lines (56 loc) • 2.21 kB
TypeScript
import { HTMLProps, PropGetter } from "../../core/components/index.types.js";
import "../../core/index.js";
import { FieldProps } from "../field/field.js";
import { UseCounterProps } from "../../hooks/use-counter/index.js";
//#region src/components/number-input/use-number-input.d.ts
interface UseNumberInputProps extends Omit<HTMLProps<"input">, keyof UseCounterProps>, UseCounterProps, FieldProps {
/**
* If `true`, the input's value will change based on mouse wheel.
*
* @default false
*/
allowMouseWheel?: boolean;
/**
* This controls the value update when you blur out of the input.
* - If `true` and the value is greater than `max`, the value will be reset to `max`.
* - Else, the value remains the same.
*
* @default true
*/
clampValueOnBlur?: boolean;
/**
* If `true`, the input will be focused as you increment or decrement the value with the button.
*
* @default true
*/
focusInputOnChange?: boolean;
/**
* If using a custom display format, this converts the default format to the custom format.
*/
format?: (value: number | string) => string;
/**
* This is used to format the value so that screen readers
* can speak out a more human-friendly value.
*
* It is used to set the `aria-valuetext` property of the input.
*/
getAriaValueText?: (value: number | string) => string | undefined;
/**
* Whether the pressed key should be allowed in the input.
* The default behavior is to allow DOM floating point characters defined by /^[Ee0-9+\-.]$/.
*/
isValidCharacter?: (value: string) => boolean;
/**
* If using a custom display format, this converts the custom format to a format `parseFloat` understands.
*/
parse?: (value: string) => string;
}
declare const useNumberInput: (props?: UseNumberInputProps) => {
getDecrementProps: PropGetter<"button", undefined, undefined>;
getIncrementProps: PropGetter<"button", undefined, undefined>;
getInputProps: PropGetter<"input", undefined, undefined>;
};
type UseNumberInputReturn = ReturnType<typeof useNumberInput>;
//#endregion
export { UseNumberInputProps, UseNumberInputReturn, useNumberInput };
//# sourceMappingURL=use-number-input.d.ts.map