diff --git a/types/tabbable/index.d.ts b/types/tabbable/index.d.ts new file mode 100644 index 0000000000..abff53bb25 --- /dev/null +++ b/types/tabbable/index.d.ts @@ -0,0 +1,18 @@ +// Type definitions for tabbable 3.1 +// Project: https://github.com/davidtheclark/tabbable +// Definitions by: Michael Swiger +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function T(el: Element | Document, options?: T.Options): HTMLElement[]; + +declare namespace T { + interface Options { + includeContainer?: boolean; + } + + function isTabbable(el: HTMLElement): boolean; + + function isFocusable(el: HTMLElement): boolean; +} + +export = T; diff --git a/types/tabbable/tabbable-tests.ts b/types/tabbable/tabbable-tests.ts new file mode 100644 index 0000000000..a64032a54f --- /dev/null +++ b/types/tabbable/tabbable-tests.ts @@ -0,0 +1,11 @@ +import tabbable = require('tabbable'); + +const el = document.createElement('div'); +tabbable(el); +tabbable(el, { includeContainer: true }); + +tabbable(document); +tabbable(document, { includeContainer: true }); + +tabbable.isTabbable(el); +tabbable.isFocusable(el); diff --git a/types/tabbable/tsconfig.json b/types/tabbable/tsconfig.json new file mode 100644 index 0000000000..b40321a02a --- /dev/null +++ b/types/tabbable/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "tabbable-tests.ts" + ] +} diff --git a/types/tabbable/tslint.json b/types/tabbable/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/tabbable/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +}