@spark-web/float-input
Version:
--- title: Float Input storybookPath: forms-float-input--default isExperimentalPackage: true ---
22 lines (21 loc) • 1 kB
TypeScript
import type { AllHTMLAttributes, FocusEventHandler, FormEventHandler } from 'react';
declare type FloatInputHandlers = {
onChange: FormEventHandler<HTMLInputElement>;
onBlur: FocusEventHandler<HTMLInputElement>;
onFocus: FocusEventHandler<HTMLInputElement>;
value: string | number;
};
declare type ControlledFloatInputProps = {
onChange: (value: number | string) => void;
value: number | string;
};
declare type UncontrolledFloatInputProps = {
onChange?: never;
value?: never;
};
export declare type UseFloatInputProps = {
/** Specifies to what fraction digit will be displayed in the component. */
fractionDigits?: number;
} & Pick<AllHTMLAttributes<HTMLInputElement>, 'onBlur' | 'onFocus'> & (ControlledFloatInputProps | UncontrolledFloatInputProps);
export declare const useFloatInput: ({ fractionDigits, onBlur: consumerBlur, onFocus: consumerFocus, onChange: controlledOnChange, value: controlledValue, }: UseFloatInputProps) => FloatInputHandlers;
export {};