Skip to content

Commit f716276

Browse files
ishan-chhabraapollonian
authored andcommitted
🏷️ Add TypeScript typings
1 parent 703dc7a commit f716276

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"react": "^16.2.0",
2626
"react-dom": "^16.2.0"
2727
},
28+
"typings": "./src/lib/index.d.ts",
2829
"devDependencies": {
2930
"babel-cli": "^6.26.0",
3031
"babel-core": "^6.26.3",

src/lib/index.d.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
export default OtpInput;
2+
declare class OtpInput {
3+
static defaultProps: {
4+
numInputs: number;
5+
onChange: (otp: number) => void;
6+
isDisabled: boolean;
7+
shouldAutoFocus: boolean;
8+
value: string;
9+
};
10+
state: {
11+
activeInput: number;
12+
};
13+
getOtpValue: () => any;
14+
getPlaceholderValue: () => any;
15+
handleOtpChange: (otp: string[]) => void;
16+
isInputValueValid: (value: any) => boolean;
17+
focusInput: (input: number) => void;
18+
focusNextInput: () => void;
19+
focusPrevInput: () => void;
20+
changeCodeAtFocus: (value: string) => void;
21+
handleOnPaste: (e: Object) => void;
22+
handleOnChange: (e: Object) => void;
23+
handleOnKeyDown: (e: Object) => void;
24+
handleOnInput: (e: Object) => void;
25+
renderInputs: () => any[];
26+
render(): any;
27+
}

0 commit comments

Comments
 (0)