UNPKG

tdesign-react

Version:
52 lines (51 loc) 2.06 kB
import React from 'react'; import { InputNumberValue, TdInputNumberProps } from './type'; export declare const specialCode: string[]; /** * 独立一个组件 Hook 方便用户直接使用相关逻辑 自定义任何样式的数字输入框 */ export default function useInputNumber<T extends InputNumberValue = InputNumberValue>(props: TdInputNumberProps<T>): { classPrefix: string; wrapClasses: string; reduceClasses: string; addClasses: string; inputRef: React.MutableRefObject<any>; listeners: { onBlur: (value: string, ctx: { e: React.FocusEvent<HTMLDivElement, Element>; }) => void; onFocus: (_: string, ctx: { e: React.FocusEvent<HTMLDivElement, Element>; }) => void; onKeydown: (value: string, ctx: { e: React.KeyboardEvent<HTMLDivElement>; }) => void; onKeyup: (value: string, ctx: { e: React.KeyboardEvent<HTMLDivElement>; }) => void; onKeypress: (value: string, ctx: { e: React.KeyboardEvent<HTMLDivElement>; }) => void; onEnter: (value: string, ctx: { e: React.KeyboardEvent<HTMLDivElement>; }) => void; onClick: () => void; onClear: (context: { e: React.MouseEvent<SVGElement>; }) => void; }; isError: "exceed-maximum" | "below-minimum"; setIsError: React.Dispatch<React.SetStateAction<"exceed-maximum" | "below-minimum">>; userInput: string; setUserInput: React.Dispatch<React.SetStateAction<string>>; tValue: T; focus: () => void; blur: () => void; onChange: import("../hooks/useControlled").ChangeHandler<T, [context: import("./type").ChangeContext]>; handleReduce: (e: any) => void; handleAdd: (e: any) => void; onInnerInputChange: (value: import("../input").InputValue, context?: { e?: React.FormEvent<HTMLInputElement> | React.MouseEvent<any> | React.CompositionEvent<HTMLDivElement>; trigger: "input" | "initial" | "clear"; }) => void; };