mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Add Types for package react-otp-input (#47108)
* Add Types for package react-otp-input * ReactOTPInput -New line added and extra lines removed * Add react-otp-input to package.json * Add react-otp-input test import modified * Change in export OTPInput * Change in import OTPInput * Remove path from tsconfig.json * Change types for style props * Remove minor version from top definitions * Revert package.json
This commit is contained in:
parent
6a47fa33ad
commit
537d3c1655
23
types/react-otp-input/index.d.ts
vendored
Normal file
23
types/react-otp-input/index.d.ts
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
// Type definitions for react-otp-input 2.0
|
||||
// Project: https://github.com/devfolioco/react-otp-input
|
||||
// Definitions by: Anup Bhatkhande <https://github.com/anupbui>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
import * as React from 'react';
|
||||
|
||||
export interface OTPInputProps {
|
||||
value: number | string;
|
||||
onChange: any;
|
||||
numInputs: number;
|
||||
separator?: JSX.Element;
|
||||
isDisabled?: boolean;
|
||||
shouldAutoFocus?: boolean;
|
||||
hasErrored?: boolean;
|
||||
isInputNum?: boolean;
|
||||
containerStyle?: string | React.CSSProperties;
|
||||
inputStyle?: string | React.CSSProperties;
|
||||
focusStyle?: string | React.CSSProperties;
|
||||
disabledStyle?: string | React.CSSProperties;
|
||||
errorStyle?: string | React.CSSProperties;
|
||||
}
|
||||
|
||||
export default class extends React.Component<OTPInputProps> { }
|
||||
35
types/react-otp-input/react-otp-input-tests.tsx
Normal file
35
types/react-otp-input/react-otp-input-tests.tsx
Normal file
@ -0,0 +1,35 @@
|
||||
import * as React from "react";
|
||||
import OTPInput from "react-otp-input";
|
||||
|
||||
interface InputOtpProps {
|
||||
inputCount: number;
|
||||
}
|
||||
|
||||
interface OtpInputState {
|
||||
otp: number;
|
||||
}
|
||||
|
||||
class OtpInputPage extends React.Component<InputOtpProps, OtpInputState> {
|
||||
state = {
|
||||
otp: 123456
|
||||
};
|
||||
|
||||
handleChange = (otp: number) => {
|
||||
this.setState({ otp });
|
||||
}
|
||||
|
||||
render() {
|
||||
const { otp } = this.state;
|
||||
|
||||
return (
|
||||
<>
|
||||
<OTPInput
|
||||
value={otp}
|
||||
onChange={this.handleChange}
|
||||
numInputs={6}
|
||||
separator={<span>-</span>}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
25
types/react-otp-input/tsconfig.json
Normal file
25
types/react-otp-input/tsconfig.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"jsx": "react",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-otp-input-tests.tsx"
|
||||
]
|
||||
}
|
||||
3
types/react-otp-input/tslint.json
Normal file
3
types/react-otp-input/tslint.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user