From a608fa5c55abbb645adcf0469e0715d0eca29e72 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Wed, 9 Aug 2017 00:24:39 +0300 Subject: [PATCH] new definition for 'react-virtual-keyboardl' (#18517) * new definition for 'react-virtual-keyboardl' * err * err * err * add examples from https://www.npmjs.com/package/react-virtual-keyboard * err --- types/react-virtual-keyboard/index.d.ts | 31 +++++++++++++++++++ .../react-virtual-keyboard-tests.tsx | 21 +++++++++++++ types/react-virtual-keyboard/tsconfig.json | 24 ++++++++++++++ types/react-virtual-keyboard/tslint.json | 1 + 4 files changed, 77 insertions(+) create mode 100644 types/react-virtual-keyboard/index.d.ts create mode 100644 types/react-virtual-keyboard/react-virtual-keyboard-tests.tsx create mode 100644 types/react-virtual-keyboard/tsconfig.json create mode 100644 types/react-virtual-keyboard/tslint.json diff --git a/types/react-virtual-keyboard/index.d.ts b/types/react-virtual-keyboard/index.d.ts new file mode 100644 index 0000000000..20e8669c6d --- /dev/null +++ b/types/react-virtual-keyboard/index.d.ts @@ -0,0 +1,31 @@ +// Type definitions for react-virtual-keyboard 1.0 +// Project: https://www.npmjs.com/package/react-virtual-keyboard +// Definitions by: Bogdan Surai +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +import { Component } from "react"; +import { KeyboardOptions, NavigateOptions } from "virtual-keyboard"; + +export interface ReactKeyboardOptions extends KeyboardOptions { + accepted?: undefined; // You should use KeyboardProps.onAccepted event. +} + +export type kbEvents = (event?: string | Event, keyboard?: Element, el?: Element) => void; + +export interface KeyboardProps { + name?: string; + value?: string; + options?: ReactKeyboardOptions; + onAccepted?: kbEvents; + onChange?: kbEvents; + callbackParent?: kbEvents; + placeholder?: string; +} + +export interface KeyboardState { + value: string; + className: string; +} + +export default class Keyboard extends Component { } diff --git a/types/react-virtual-keyboard/react-virtual-keyboard-tests.tsx b/types/react-virtual-keyboard/react-virtual-keyboard-tests.tsx new file mode 100644 index 0000000000..eaa1b9d80e --- /dev/null +++ b/types/react-virtual-keyboard/react-virtual-keyboard-tests.tsx @@ -0,0 +1,21 @@ +import * as React from "react"; +import Keyboard from "react-virtual-keyboard"; +import { ReactKeyboardOptions } from "react-virtual-keyboard"; + +export interface KbState { + textarea: string; +} + +export default class MyKeyboard extends React.Component<{}, KbState> { + onTextareaChanged = (newState: string) => { + this.setState({ textarea: newState }); + } + + render() { + return (); + } +} diff --git a/types/react-virtual-keyboard/tsconfig.json b/types/react-virtual-keyboard/tsconfig.json new file mode 100644 index 0000000000..bd14b36324 --- /dev/null +++ b/types/react-virtual-keyboard/tsconfig.json @@ -0,0 +1,24 @@ +{ + "files": [ + "index.d.ts", + "react-virtual-keyboard-tests.tsx" + ], + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "jsx": "react", + "forceConsistentCasingInFileNames": true + } +} diff --git a/types/react-virtual-keyboard/tslint.json b/types/react-virtual-keyboard/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/react-virtual-keyboard/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file