UNPKG

@yamada-ui/react

Version:

React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion

83 lines (82 loc) 2.1 kB
import * as react1 from "react"; //#region src/hooks/use-counter/index.d.ts interface UseCounterProps { /** * The initial value of the counter. * Should be less than `max` and greater than `min`. */ defaultValue?: number | string; /** * This controls the value update behavior in general. * * - If `true` and you use the stepper or up/down arrow keys, * the value will not exceed the `max` or go lower than `min`. * * - If `false`, the value will be allowed to go out of range. * * @default true */ keepWithinRange?: boolean; /** * The maximum value of the counter * * @default Number.MAX_SAFE_INTEGER */ max?: number; /** * The minimum value of the counter * * @default Number.MIN_SAFE_INTEGER */ min?: number; /** * The number of decimal points used to round the value. */ precision?: number; /** * The step used to increment or decrement the value. * * @default 1 */ step?: number; /** * The value of the counter. * Should be less than `max` and greater than `min`. */ value?: number | string; /** * The callback fired when the value changes. */ onChange?: (valueAsString: string, valueAsNumber: number) => void; } /** * `useCounter` is a custom hook that returns the current counter value. * * @see https://yamada-ui.com/docs/hooks/use-counter */ declare const useCounter: ({ keepWithinRange, max: maxValue, min: minValue, step: stepProp, ...props }?: UseCounterProps) => { cast: (value: number | string) => void; clamp: (value: number) => string; decrement: (step?: number) => void; increment: (step?: number) => void; max: boolean; min: boolean; out: boolean; precision: number; reset: () => void; setValue: react1.Dispatch<react1.SetStateAction<string | number>>; step: number; update: (next: number | string) => void; value: string | number; valueAsNumber: number; }; type UseCounterReturn = ReturnType<typeof useCounter>; //#endregion export { UseCounterProps, UseCounterReturn, useCounter }; //# sourceMappingURL=index.d.ts.map