mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 19:07:08 +00:00
Add types for react-numeric-input (#21151)
This commit is contained in:
parent
cbaa668281
commit
90ee6baac4
46
types/react-numeric-input/index.d.ts
vendored
Normal file
46
types/react-numeric-input/index.d.ts
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
// Type definitions for react-numeric-input 2.2
|
||||
// Project: https://github.com/vlad-ignatov/react-numeric-input#readme
|
||||
// Definitions by: Heather Booker <https://github.com/heatherbooker>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
export = NumericInput;
|
||||
|
||||
declare namespace NumericInput {
|
||||
interface NumericInputProps extends React.Props<NumericInput> {
|
||||
addLabelText?: string;
|
||||
className?: string;
|
||||
defaultValue?: number | string;
|
||||
disabled?: boolean;
|
||||
format?: ((s: string) => string);
|
||||
max?: number | ((v: number) => number);
|
||||
maxLength?: number;
|
||||
min?: number | ((v: number) => number);
|
||||
mobile?: boolean | 'auto' | ((this: NumericInput) => any); // TODO: fix `any`
|
||||
noValidate?: boolean| string;
|
||||
onBlur?: React.FocusEventHandler<HTMLDivElement | HTMLInputElement>;
|
||||
onChange?: ((v: number, s: string, i: JSX.Element) => void);
|
||||
onFocus?: React.FocusEventHandler<HTMLDivElement | HTMLInputElement>;
|
||||
onInput?: ((...args: any[]) => void);
|
||||
onInvalid?: ((err: string, v: number, s: string) => void);
|
||||
onKeyDown?: React.KeyboardEventHandler<HTMLDivElement | HTMLInputElement>;
|
||||
onSelect?: ((...args: any[]) => void);
|
||||
onValid?: ((v: number, s: string) => void);
|
||||
parse?: ((s: string) => number | string);
|
||||
pattern?: string;
|
||||
precision?: number | ((this: NumericInput) => void);
|
||||
readOnly?: boolean;
|
||||
required?: boolean;
|
||||
size?: number | string;
|
||||
snap?: boolean;
|
||||
step?: number | object; // TODO: should be `number | <some function>`
|
||||
strict?: boolean;
|
||||
style?: { [key: string]: { [key: string]: string } } | boolean;
|
||||
type?: string;
|
||||
value?: number | string;
|
||||
}
|
||||
}
|
||||
|
||||
declare class NumericInput extends React.Component<NumericInput.NumericInputProps> {}
|
||||
8
types/react-numeric-input/react-numeric-input-tests.tsx
Normal file
8
types/react-numeric-input/react-numeric-input-tests.tsx
Normal file
@ -0,0 +1,8 @@
|
||||
import { Component } from 'react';
|
||||
import * as NumericInput from 'react-numeric-input';
|
||||
|
||||
export class NumericInputTest extends Component {
|
||||
render() {
|
||||
return(<NumericInput />);
|
||||
}
|
||||
}
|
||||
24
types/react-numeric-input/tsconfig.json
Normal file
24
types/react-numeric-input/tsconfig.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"jsx": "preserve",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-numeric-input-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
types/react-numeric-input/tslint.json
Normal file
1
types/react-numeric-input/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user