UNPKG

react-hook-currency

Version:

> This libraries propose to introduce two pseudo hooks, one capable of format currencies and another capable to simulate a cash register.

23 lines (22 loc) 942 B
import * as React from 'react'; import { Locales, Currencies } from '../constants'; export declare type PropsRegister = { style?: 'currency' | 'decimal'; precision?: number; locale?: Locales | string; currency?: Currencies | string; }; declare type ClickEvent = React.MouseEvent<HTMLInputElement, MouseEvent>; declare type ChangeEvent = React.ChangeEvent<HTMLInputElement>; declare type KeyboardEvent = React.KeyboardEvent<HTMLInputElement>; export declare type ReturnRegister = { format: (rawVal: string) => string; onClick: (e: ClickEvent) => void; onChange: (e: ChangeEvent) => void; onKeyDown: (e: KeyboardEvent) => void; triggerChange: (value: string, input?: HTMLInputElement | null) => void; toNumber: (currency: string) => number; decimalSeparator: string; }; export declare const useCurrencyRegister: (props?: PropsRegister | undefined) => ReturnRegister; export {};