Files
DefinitelyTyped/types/cleave.js/options.d.ts
C Lentfort cfce6f295f Add typings for cleave.js (#20550)
* Add typings for cleave.js

Add typings for cleave.js and <Cleave> react component.

* Fix lint errors

* fixup! Fix lint errors

* fixup! Fix lint errors
2017-10-13 15:16:29 -07:00

61 lines
1.4 KiB
TypeScript

// Credit Card Options
export type CreditCardType =
| "amex"
| "dankort"
| "diners"
| "discover"
| "instapayment"
| "jcb"
| "maestro"
| "mastercard"
| "uatp"
| "unknown"
| "visa";
export type CreditCardTypeChangeHandler = (owner: HTMLInputElement, type: CreditCardType) => void;
export interface CleaveOptions {
creditCard?: boolean;
creditCardStrictMode?: boolean;
creditCardType?: string;
onCreditCardTypeChanged?: CreditCardTypeChangeHandler;
}
// Phone Options
export interface CleaveOptions {
phone?: boolean;
phoneRegionCode?: string;
}
// Date Options
export interface CleaveOptions {
date?: boolean;
datePattern?: ReadonlyArray<string>;
}
// Numeral Options
export type NumeralThousandsGroupStyleType = "lakh" | "thousand" | "wan";
export interface CleaveOptions {
numeral?: boolean;
numeralDecimalMark?: string;
numeralDecimalScale?: number;
numeralIntegerScale?: number;
numeralPositiveOnly?: boolean;
numeralThousandsGroupStyle?: NumeralThousandsGroupStyleType;
stripLeadingZeroes?: boolean;
}
// Extra Options
export interface CleaveOptions {
blocks?: ReadonlyArray<number>;
copyDelimiter?: boolean;
delimiter?: string;
delimiters?: ReadonlyArray<string>;
initValue?: any;
lowercase?: boolean;
numericOnly?: boolean;
prefix?: string;
rawValueTrimPrefix?: boolean;
uppercase?: boolean;
}