diff --git a/README.md b/README.md index b188982fbf..7da7d1530b 100644 --- a/README.md +++ b/README.md @@ -4,36 +4,221 @@ > The repository for *high quality* TypeScript type definitions. -For more information see the [definitelytyped.org](http://definitelytyped.org) website. +Also see the [definitelytyped.org](http://definitelytyped.org) website, although information in this README is more up-to-date. -## Usage -Include a line like this: +## What are declaration files? -```typescript -/// +See the [TypeScript handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html). + + +## How do I get them? + +### npm + +This is the preferred method. This is only available for TypeScript 2.0+ users. For example: + +```sh +npm install --save-dev @types/node ``` -## Contributions +The types should then be automatically included by the compiler. +See more in the [handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html). + +For an NPM package "foo", typings for it will be at "@types/foo". +If you can't find your package, look for it on [TypeSearch](https://microsoft.github.io/TypeSearch/). + +If you still can't find it, check if it [bundles](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) its own typings. +This is usually provided in a `"types"` or `"typings"` field in the `package.json`, +or just look for any ".d.ts" files in the package and manually include them with a `/// `. + + +### Other methods + +These can be used by TypeScript 1.0. + +* [Typings](https://github.com/typings/typings) +* [NuGet](http://nuget.org/Tpackages?q=DefinitelyTyped) +* Manually download from the `master` branch of this repository + +You may need to add manual [references](http://www.typescriptlang.org/docs/handbook/triple-slash-directives.html). + + +## How can I contribute? DefinitelyTyped only works because of contributions by users like you! -Please see the [contribution guide](http://definitelytyped.org/guides/contributing.html) on how to contribute to DefinitelyTyped. +### Test -## How to get the definitions +Before you share your improvement with the world, use it yourself. -* Directly from the GitHub repos -* [NuGet packages](http://nuget.org/packages?q=DefinitelyTyped) -* [Typings - TypeScript Definition Manager](https://github.com/typings/typings) +#### Test editing an exiting package -## List of definitions +To add new features you can use [module augmentation](http://www.typescriptlang.org/docs/handbook/declaration-merging.html). +You can also directly edit the types in `node_modules/@types/foo/index.d.ts`, +or copy them from there and paste inside of `declarations.d.ts` and follow the steps below. -* See [CONTRIBUTORS.md](CONTRIBUTORS.md) -## Requested definitions +#### Test a new package + +* Add a new file `declarations.d.ts` to your project. +* Add it to the compilation, through `"includes"` or `"files"` in your [tsconfig](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html), +or through a `/// ` declaration in your code. +* Inside `declarations.d.ts`, write `declare module "foo" { }`, then write the module declaration inside. +* Test that your code works. +* *Then*, once you've tested your definitions, make a PR contributing the definition. + + +### Make a pull request + +Once you've tested your package, you can share it on DefinitelyTyped. + +First, [fork](https://guides.github.com/activities/forking/) this repository. +Then inside your repository: + +* `git checkout types-2.0` + +New work should generally be done on the `types-2.0` branch. +If you want your changes to be available to `typings` users, then you may edit `master` instead. + + +#### Edit an existing package + +* `cd my-package-to-edit` +* Make changes. Remember to edit tests. +* You may also want to add yourself to "Definitions by" section of the package header. +* `npm install -g typescript@2.0` and run `tsc`. + +When you make a PR to edit an existing package, `dt-bot` should @-mention previous authors. +If it doesn't, you can do so yourself in the comment associated with the PR. + + +#### Create a new package + +If you are the library author, or can make a pull request to the library, [bundle](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) types instead of publishing to DefinitelyTyped. + +If you are adding typings for an NPM package, create a directory with the same name. +If the package you are adding typings for is not on NPM, make sure the name you choose for it does not conflict with the name of a package on NPM. +(You can use `npm info foo` to check for the existence of the `foo` package.) + +Your package should have this structure: + +| File | Purpose | +| --- | --- | +| index.d.ts | This contains the typings for the package. | +| foo-tests.ts | This contains sample code which tests the typings. This code does *not* run, but it is type-checked. | +| tsconfig.json | This allows you to run `tsc` within the package. | + +`index.d.ts` should start with a header looking like: + +```ts +// Type definitions for foo 1.2 +// Project: https://github.com/baz/foo +// Definitions by: My Self +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +``` + +The `Project` link does not have to be to GitHub, but prefer linking to a source code repository rather than to a project website. + +`tsconfig.json` should look like this: + +```json +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "foo-tests.ts" + ] +} +``` + +These should be identical accross projects except that `foo-tests` will be replaced with the name of your test file, +and you may also add the `"jsx"` compiler option if your library needs it. + +DefinitelyTyped members routinely monitor for new PRs, though keep in mind that the number of other PRs may slow things down. + + +#### Common mistakes + +* First, follow advice from the [handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html). +* Formatting: Either use all tabs, or always use 4 spaces. Also, always use semicolons, and use egyptian braces. +* `interface X {}`: An empty interface is essentially the `{}` type: it places no constraints on an object. +* `interface Foo { new(): Foo }`: + This defines a type of objects that are new-able. You probably want `declare class Foo { constructor(); } +* `namespace foo {}`: + Do not add a namespace just so that the `import * as foo` syntax will work. + If it is commonJs module with a single export, you should use the `import foo = require("foo")` syntax. + See more explanation [here](https://stackoverflow.com/questions/39415661/why-cant-i-import-a-class-or-function-with-import-as-x-from-y). +* `getMeAT(): T`: + If a type parameter does not appear in the types of any parameters, you don't really have a generic function, you just have a disguised type assertion. + Prefer to use a real type assertion, e.g. `getMeAT() as number`. + Example where a type parameter is acceptable: `function id(value: T): T;`. + Example where it is not acceptable: `function parseJson(json: string): T;`. + Exception: `new Map()` is OK. + + +#### Removing a package + +When a package [bundles](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) its own types, types should be removed from DefinitelyTyped to avoid confusion. +Make a PR doing the following: +* Delete the directory. +* Add a new entry to `notNeededPackages.json`. + - `libraryName`: Descriptive name of the library, e.g. "Angular 2" instead of "angular2". (May be identical to "typingsPackageName".) + - `typingsPackageName`: This is the name of the directory you just deleted. + - `sourceRepoURL`: This should point to the repository that contains the typings. + - `asOfVersion`: A stub will be published to `@types/foo` with this version. Should be higher than any currently published version. +* Any other packages in DefinitelyTyped that referenced the deleted package should be updated to reference the bundled types. + To do this, add a `package.json` with `"dependencies": { "foo": "x.y.z" }`. + + +## FAQ + +#### What exactly is the relationship between this repository and the `@types` packages on NPM? + +The `types-2.0` branch is automatically published to the `@types` scope on NPM thanks to [types-publisher](https://github.com/Microsoft/types-publisher). +This usually happens within an hour of changes being merged. + +Changes to the `master` branch are also manually merged into the `types-2.0` branch, but this takes longer. + +#### I'm writing a definition that depends on another definition. Should I use `` or an import? + +If the module you're referencing is an written as an external module (uses `export`), use an import. +If the module you're referenceing is an ambient module (uses `declare module`, or just declares globals), use ``. + +#### What do I do about older versions of typings? + +Currently we don't support this, though it is [planned](https://github.com/Microsoft/types-publisher/issues/3). +If you're adding a new major version of a library, you can copy `index.d.ts` to `foo-v2.3.d.ts` and edit `index.d.ts` to be the new version. + +#### I notice some packages having a `package.json` here. + +Usually you won't need this. When publishing a package we will normally automatically create a `package.json` for it. +A `package.json` may be included for the sake of specifying dependencies. Here's an [example](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/types-2.0/pikaday/package.json). +We do not allow other fields, such as `"description"`, to be defined manually. +Also, if you need to reference an older version of typings, you must do that by adding `"dependencies": { "@types/foo": "x.y.z" }` to the package.json. + +#### Definitions in types-2.0 seem written differently than in master. + +If you're targeting types-2.0, write it like the types-2.0 definitions. +If you're targeting master, we may change it to the new style when merging from master to types-2.0. + +#### Can I request a definition? Here are the [currently requested definitions](https://github.com/DefinitelyTyped/DefinitelyTyped/labels/Definition%3ARequest). + ## License This project is licensed under the MIT license. diff --git a/angular-material/index.d.ts b/angular-material/index.d.ts index d4020a8c2a..610dcf34d7 100644 --- a/angular-material/index.d.ts +++ b/angular-material/index.d.ts @@ -158,6 +158,7 @@ declare module 'angular' { hideDelay(delay: number): T; position(position: string): T; parent(parent?: string | Element | JQuery): T; // default: root node + toastClass(toastClass: string): T; } interface ISimpleToastPreset extends IToastPreset { diff --git a/angular-ui-router-default/angular-ui-router-default-tests.ts b/angular-ui-router-default/angular-ui-router-default-tests.ts new file mode 100644 index 0000000000..2b6bfbe61e --- /dev/null +++ b/angular-ui-router-default/angular-ui-router-default-tests.ts @@ -0,0 +1,39 @@ +/// + +angular.module("test", [ + "ui.router", + "ui.router.default" +]) + .config(function($stateProvider: angular.ui.IStateProvider) { + $stateProvider + .state('concrete', { + // no abstract or default + }) + .state('string', { + abstract: true, + default: 'concrete' + }) + .state('func_str', { + abstract: true, + default: function($rootScope): string { return $rootScope.test; } + }) + .state('func_promise', { + abstract: true, + default: function($q: ng.IQService): ng.IPromise { + return $q.when("concrete"); + } + }) + .state('injection_str', { + abstract: true, + default: ["$rootScope", function($rootScope) { + return $rootScope.test; + }] + }) + .state('injection_promise', { + abstract: true, + default: ["$q", function($q: ng.IQService) { + return $q.when("concrete"); + }] + }) + ; + }); diff --git a/angular-ui-router-default/angular-ui-router-default.d.ts b/angular-ui-router-default/angular-ui-router-default.d.ts new file mode 100644 index 0000000000..9d102681cf --- /dev/null +++ b/angular-ui-router-default/angular-ui-router-default.d.ts @@ -0,0 +1,17 @@ +// Type definitions for angular-ui-router-default 0.5+ +// Project: https://github.com/nonplus/angular-ui-router-default +// Definitions by: Stepan Riha +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace angular.ui { + export type StateDefaultSpecifier = string + | ((...args: any[]) => string) + | ((...args: any[]) => ng.IPromise) + | (string | ((...args: any[]) => string))[] + | (string | ((...args: any[]) => ng.IPromise))[]; + interface IState { + default?: StateDefaultSpecifier + } +} diff --git a/angular-ui-router-uib-modal/angular-ui-router-uib-modal-tests.ts b/angular-ui-router-uib-modal/angular-ui-router-uib-modal-tests.ts new file mode 100644 index 0000000000..3f14b2a40f --- /dev/null +++ b/angular-ui-router-uib-modal/angular-ui-router-uib-modal-tests.ts @@ -0,0 +1,30 @@ +/// + +angular.module("test", [ + "ui.bootstrap", + "ui.router", + "ui.router.default" +]) + .config(function($stateProvider: angular.ui.IStateProvider) { + $stateProvider + .state('contacts', { + // no modal + resolve: { + a: function() { + return "a"; + }, + b: function() { + return ["a", "b"]; + } + } + }) + .state('contacts.contact', { + // boolean modal + modal: true + }) + .state('contacts.contact.edit', { + // string[] modal + modal: ["a", "b"] + }) + ; + }); diff --git a/angular-ui-router-uib-modal/angular-ui-router-uib-modal.d.ts b/angular-ui-router-uib-modal/angular-ui-router-uib-modal.d.ts new file mode 100644 index 0000000000..598fe964fe --- /dev/null +++ b/angular-ui-router-uib-modal/angular-ui-router-uib-modal.d.ts @@ -0,0 +1,12 @@ +// Type definitions for angular-ui-uib-modal 0.11+ (ui.router module) +// Project: https://github.com/nonplus/angular-ui-router-uib-modal +// Definitions by: Stepan Riha +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace angular.ui { + interface IState { + modal?: boolean | string[]; + } +} diff --git a/angular/angular-tests.ts b/angular/angular-tests.ts index 639534e8be..8e0711d6f7 100644 --- a/angular/angular-tests.ts +++ b/angular/angular-tests.ts @@ -278,8 +278,14 @@ namespace TestQ { b: string; c: boolean; } + interface TValue { + e: number; + f: boolean; + } var tResult: TResult; var promiseTResult: angular.IPromise; + var tValue: TValue; + var promiseTValue: angular.IPromise; var $q: angular.IQService; var promiseAny: angular.IPromise; @@ -348,6 +354,22 @@ namespace TestQ { let result: angular.IPromise; result = $q.when(tResult); result = $q.when(promiseTResult); + + result = $q.when(tValue, (result: TValue) => tResult); + result = $q.when(tValue, (result: TValue) => tResult, (any) => any); + result = $q.when(tValue, (result: TValue) => tResult, (any) => any, (any) => any); + + result = $q.when(promiseTValue, (result: TValue) => tResult); + result = $q.when(promiseTValue, (result: TValue) => tResult, (any) => any); + result = $q.when(promiseTValue, (result: TValue) => tResult, (any) => any, (any) => any); + + result = $q.when(tValue, (result: TValue) => promiseTResult); + result = $q.when(tValue, (result: TValue) => promiseTResult, (any) => any); + result = $q.when(tValue, (result: TValue) => promiseTResult, (any) => any, (any) => any); + + result = $q.when(promiseTValue, (result: TValue) => promiseTResult); + result = $q.when(promiseTValue, (result: TValue) => promiseTResult, (any) => any); + result = $q.when(promiseTValue, (result: TValue) => promiseTResult, (any) => any, (any) => any); } } diff --git a/angular/index.d.ts b/angular/index.d.ts index 713e959d51..ede4733708 100644 --- a/angular/index.d.ts +++ b/angular/index.d.ts @@ -1043,6 +1043,7 @@ declare namespace angular { * @param value Value or a promise */ when(value: IPromise|T): IPromise; + when(value: IPromise|T, successCallback: (promiseValue: T) => IPromise|TResult, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise; /** * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. */ diff --git a/angular/legacy/angular-sanitize-1.2-tests.ts b/angular/legacy/angular-sanitize-1.2-tests.ts index 94bb6615ec..644d40b364 100644 --- a/angular/legacy/angular-sanitize-1.2-tests.ts +++ b/angular/legacy/angular-sanitize-1.2-tests.ts @@ -1,10 +1,32 @@ -var shouldBeString: string; +/////////////////////////////////////////////////////////////////////////////// +// Variables +/////////////////////////////////////////////////////////////////////////////// +let shouldBeString: string; +let testInputText: string = 'TEST'; -declare var $sanitizeService: ng.sanitize.ISanitizeService; -shouldBeString = $sanitizeService(shouldBeString); +/////////////////////////////////////////////////////////////////////////////// +// Test sanitize service +/////////////////////////////////////////////////////////////////////////////// +declare let $sanitizeService: ng.sanitize.ISanitizeService; +shouldBeString = $sanitizeService(testInputText); -declare var $linky: ng.sanitize.filter.ILinky; -shouldBeString = $linky(shouldBeString); -shouldBeString = $linky(shouldBeString, shouldBeString); +/////////////////////////////////////////////////////////////////////////////// +// Test `linky` filter +/////////////////////////////////////////////////////////////////////////////// +declare let $linky: ng.sanitize.filter.ILinky; + +// Should be string for simple text and target parameters +shouldBeString = $linky(testInputText, testInputText); + +// Should be string for simple text, target and attributes parameters +let attributesAsFunction = () => { +}; +shouldBeString = $linky(shouldBeString, testInputText, { + "attributeKey1": "attributeValue1", + "attributeKey2": "attributeValue2" +}); +shouldBeString = $linky(shouldBeString, testInputText, (url: string) => { + return {"attributeKey1": "attributeValue1"} +}); \ No newline at end of file diff --git a/archiver/archiver-tests.ts b/archiver/archiver-tests.ts index 3bef66a44c..d79b29f079 100644 --- a/archiver/archiver-tests.ts +++ b/archiver/archiver-tests.ts @@ -11,4 +11,12 @@ var readStream = FS.createReadStream('./archiver.d.ts'); archiver.pipe(writeStream); archiver.append(readStream, {name: 'archiver.d.ts'}); -archiver.finalize(); \ No newline at end of file +archiver.finalize(); + +archiver.directory('./path', './someOtherPath'); +archiver.directory('./path', { name: "testName"} ); + +archiver.directory('./', "", {}); +archiver.directory('./', {name: 'test'}, {}); + +archiver.bulk({ mappaing: {} }); \ No newline at end of file diff --git a/archiver/index.d.ts b/archiver/index.d.ts index df824c3915..d67705e2ea 100644 --- a/archiver/index.d.ts +++ b/archiver/index.d.ts @@ -25,6 +25,11 @@ interface nameInterface { interface Archiver extends STREAM.Transform { pipe(writeStream: FS.WriteStream): void; append(source: FS.ReadStream | Buffer | string, name: nameInterface): void; + + directory(dirpath: string, destpath: nameInterface | string): void; + directory(dirpath: string, destpath: nameInterface | string, data: any | Function): void; + + bulk(mappings: any): void; finalize(): void; } diff --git a/async-polling/async-polling-tests.ts b/async-polling/async-polling-tests.ts new file mode 100644 index 0000000000..ec9e5200f2 --- /dev/null +++ b/async-polling/async-polling-tests.ts @@ -0,0 +1,64 @@ +/// + +import * as AsyncPolling from "async-polling"; + +// Tests based on examples in https://github.com/cGuille/async-polling#readme + +AsyncPolling(end => { + end(); +}, 3000).run(); + +function someAsynchroneProcess(callback: (error?: Error, response?: any) => any): any { + callback(); +} + +let polling = AsyncPolling(end => { + someAsynchroneProcess(function (error, response) { + if (error) { + end(error); + return; + } + + end(null, response); + }); +}, 3000); +polling.on("error", (error: Error) => {}); +polling.on("result", (result: any) => {}); +polling.run(); +polling.stop(); + +AsyncPolling(function(end) { + this.stop(); + end(); +}, 3000).run(); + +let i = 0; + +polling = AsyncPolling(function(end) { + ++i; + if (i === 3) { + return end(new Error("i is " + i)); + } + if (i >= 5) { + this.stop(); + return end(null, `#${i} stop`); + } + end(null, `#${i} wait a second...`); +}, 1000); + +const eventNames: AsyncPolling.EventName[] = ["run", "start", "end", "schedule", "stop"]; +eventNames.forEach(eventName => { + polling.on(eventName, () => { + console.log("lifecycle:", eventName); + }); +}); + +polling.on("result", (result: any) => { + console.log("result:", result); +}); + +polling.on("error", (error: Error) => { + console.error("error:", error); +}); + +polling.run(); \ No newline at end of file diff --git a/async-polling/async-polling.d.ts b/async-polling/async-polling.d.ts new file mode 100644 index 0000000000..579d041e37 --- /dev/null +++ b/async-polling/async-polling.d.ts @@ -0,0 +1,18 @@ +// Type definitions for AsyncPolling +// Project: https://github.com/cGuille/async-polling +// Definitions by: Zlatko Andonovski +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "async-polling" { + module AsyncPolling { + export type EventName = "run"|"start"|"error"|"result"|"end"|"schedule"|"stop"; + } + + function AsyncPolling(pollingFunc: (end: (err?: Error, result?: Result) => any) => any, delay: number): { + run: () => any; + stop: () => any; + on: (eventName: AsyncPolling.EventName, listener: Function) => any; + } + + export = AsyncPolling; +} \ No newline at end of file diff --git a/awesomplete/awesomplete-tests.ts b/awesomplete/awesomplete-tests.ts new file mode 100644 index 0000000000..8132ad4555 --- /dev/null +++ b/awesomplete/awesomplete-tests.ts @@ -0,0 +1,57 @@ +/// + +var input = document.getElementById("myinput"); +new Awesomplete(input, {list: "#mylist"}); + +new Awesomplete(input, {list: document.querySelector("#mylist")}); + +new Awesomplete(input, { + list: ["Ada", "Java", "JavaScript", "LOLCODE", "Node.js", "Ruby on Rails"] +}); + +var awesomplete = new Awesomplete(input); +awesomplete.list = ["Ada", "Java", "JavaScript", "LOLCODE", "Node.js", "Ruby on Rails"]; + +new Awesomplete(input, { + list: [ + { label: "Belarus", value: "BY" }, + { label: "China", value: "CN" }, + { label: "United States", value: "US" } + ] +}); + +// Same with arrays: +new Awesomplete(input, { + list: [ + [ "Belarus", "BY" ], + [ "China", "CN" ], + [ "United States", "US" ] + ] +}); + +new Awesomplete('input[type="email"]', { + list: ["aol.com", "att.net", "comcast.net", "facebook.com", "gmail.com", "gmx.com", "googlemail.com", "google.com", "hotmail.com", "hotmail.co.uk", "mac.com", "me.com", "mail.com", "msn.com", "live.com", "sbcglobal.net", "verizon.net", "yahoo.com", "yahoo.co.uk"], + data: function (text: string, input: any) { + return input.slice(0, input.indexOf("@")) + "@" + text; + }, + filter: Awesomplete.FILTER_STARTSWITH +}); + +new Awesomplete('input[data-multiple]', { + filter: function(text: string, input: any) { + return Awesomplete.FILTER_CONTAINS(text, input.match(/[^,]*$/)[0]); + }, + + replace: function(text: string) { + var before = this.input.value.match(/^.+,\s*|/)[0]; + this.input.value = before + text + ", "; + } +}); + +var ajax = new XMLHttpRequest(); +ajax.open("GET", "https://restcountries.eu/rest/v1/lang/fr", true); +ajax.onload = function() { + var list = JSON.parse(ajax.responseText).map(function(i: any) { return i.name; }); + new Awesomplete(document.querySelector("#ajax-example input"),{ list: list }); +}; +ajax.send(); \ No newline at end of file diff --git a/awesomplete/awesomplete.d.ts b/awesomplete/awesomplete.d.ts new file mode 100644 index 0000000000..d39389f008 --- /dev/null +++ b/awesomplete/awesomplete.d.ts @@ -0,0 +1,49 @@ +// Type definitions for Awesomplete v1.1.0 +// Project: https://leaverou.github.io/awesomplete/ +// Definitions by: webbiesdk , Ben Dixon +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare class Awesomplete { + constructor(input: Element | HTMLElement | string, o?: AwesompleteOptions); + static all: Array; + static $$: (expr: string | NodeSelector, con?: any) => NodeList; + static ITEM: (text: string, input: string) => HTMLElement; + static $: { + (expr: string|Element, con?: NodeSelector): string | Element; + regExpEscape: (s: { replace: (arg0: RegExp, arg1: string) => void }) => any; + create: (tag: string, o: any) => HTMLElement; + fire: (target: EventTarget, type: string, properties: any) => any; + siblingIndex: (el: Element) => number; + }; + static FILTER_STARTSWITH: (text: string, input: string) => boolean; + static FILTER_CONTAINS: (text: string, input: string) => boolean; + static SORT_BYLENGTH: (a: number | any[], b: number | any[]) => number; + static REPLACE: (text: any) => void; + next: () => void; + container: HTMLElement; + select: (selected?: HTMLElement, originalTarget?: HTMLElement) => void; + previous: () => void; + index: number; + opened: number; + list: string | string[] | Element | { label: string, value: any }[] | [string, string][]; + input: HTMLElement | string; + goto: (i: number) => void; + ul: HTMLElement; + close: () => void; + evaluate: () => void; + selected: boolean; + open: () => void; + status: HTMLElement; +} + +interface AwesompleteOptions { + list?: string | string[] | Element | { label: string, value: any }[] | [string, string][]; + minChars?: Number; + maxItems?: Number; + autoFirst?: boolean; + data?: Function; + filter?: Function; + sort?: Function; + item?: Function; + replace?: Function; +} diff --git a/aws-lambda/aws-lambda-tests.ts b/aws-lambda/aws-lambda-tests.ts index 72c443fab1..cad44082ab 100644 --- a/aws-lambda/aws-lambda-tests.ts +++ b/aws-lambda/aws-lambda-tests.ts @@ -1,12 +1,12 @@ import lambda = require('aws-lambda'); -var str: string; -var date: Date; -var anyObj: any; -var num: number; +var str: string = "any string"; +var date: Date = new Date(); +var anyObj: any = { abc: 123 }; +var num: number = 5; var identity: lambda.CognitoIdentity; -var error: Error; -var b: boolean; +var error: Error = new Error(); +var b: boolean = true; var clientCtx: lambda.ClientContext; /* Context */ @@ -35,4 +35,13 @@ function callback(cb: lambda.Callback) { cb(null); cb(error); cb(null, anyObj); -} \ No newline at end of file +} +/* Compatibility functions */ +context.done(); +context.done(error); +context.done(error, anyObj); +context.succeed(str); +context.succeed(anyObj); +context.succeed(str, anyObj); +context.fail(error); +context.fail(str); \ No newline at end of file diff --git a/aws-lambda/index.d.ts b/aws-lambda/index.d.ts index 95bc73466d..9d91c41de5 100644 --- a/aws-lambda/index.d.ts +++ b/aws-lambda/index.d.ts @@ -23,7 +23,9 @@ interface Context { getRemainingTimeInMillis(): number; // Functions for compatibility with earlier Node.js Runtime v0.10.42 - log(message: string, object: any): void; + // For more details see http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-using-old-runtime.html#nodejs-prog-model-oldruntime-context-methods + done(error?: Error, result?: any): void; + fail(error: Error): void; fail(message: string): void; succeed(message: string): void; succeed(object: any): void; diff --git a/aws-sdk/index.d.ts b/aws-sdk/index.d.ts index 83ecb93f53..7d70edf939 100644 --- a/aws-sdk/index.d.ts +++ b/aws-sdk/index.d.ts @@ -522,7 +522,8 @@ export declare module DynamoDB { interface UpdateParam extends _DDBDC_Writer { Key: _DDBDC_Keys; - AttributeUpdates: { + UpdateExpression?: string; + AttributeUpdates?: { [someKey: string]: { Action: "PUT" | "ADD" | "DELETE"; Value: any diff --git a/aws-serverless-express/aws-serverless-express-tests.ts b/aws-serverless-express/aws-serverless-express-tests.ts new file mode 100644 index 0000000000..6a0d7694d9 --- /dev/null +++ b/aws-serverless-express/aws-serverless-express-tests.ts @@ -0,0 +1,29 @@ +/// +/// + +import * as awsServerlessExpress from 'aws-serverless-express'; +import * as express from 'express'; + +const app = express(); +const server = awsServerlessExpress.createServer(app, () => {}); + +const mockEvent = { + key: 'value' +}; + +const mockContext = { + callbackWaitsForEmptyEventLoop: true, + functionName: 'testFunction', + functionVersion: '1', + invokedFunctionArn: 'arn', + memoryLimitInMB: 128, + awsRequestId: 'id', + logGroupName: 'group', + logStreamName: 'stream', + getRemainingTimeInMillis: () => 2000, + done: () => false, + fail: (error: any) => false, + succeed: (message: string) => false +}; + +awsServerlessExpress.proxy(server, mockEvent, mockContext); diff --git a/aws-serverless-express/aws-serverless-express.d.ts b/aws-serverless-express/aws-serverless-express.d.ts new file mode 100644 index 0000000000..50aa0e1a0b --- /dev/null +++ b/aws-serverless-express/aws-serverless-express.d.ts @@ -0,0 +1,24 @@ +// Type definitions for aws-serverless-express +// Project: https://github.com/awslabs/aws-serverless-express +// Definitions by: Ben Speakman +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// + +declare module 'aws-serverless-express' { + + import * as http from 'http'; + import * as lambda from 'aws-lambda'; + + export function createServer( + requestListener: (request: http.IncomingMessage, response: http.ServerResponse) => http.Server, + serverListenCallback?: () => any + ): http.Server; + + export function proxy( + server: http.Server, + event: any, + context: lambda.Context + ): void; +} diff --git a/axios/axios-tests.ts b/axios/axios-tests.ts index 1f05653229..a321e97f19 100644 --- a/axios/axios-tests.ts +++ b/axios/axios-tests.ts @@ -69,6 +69,10 @@ axios.post("http://example.com/", { ] }); +var config: Axios.AxiosXHRConfigBase = {headers: {}}; +config.headers['X-Custom-Header'] = 'baz'; +axios.post("http://example.com/", config); + var getRepoIssue = axios.get("https://api.github.com/repos/mzabriskie/axios/issues/1"); var axiosInstance = axios.create({ diff --git a/axios/index.d.ts b/axios/index.d.ts index 9c4705d093..a2c5bfbd45 100644 --- a/axios/index.d.ts +++ b/axios/index.d.ts @@ -39,7 +39,7 @@ declare namespace Axios { /** * custom headers to be sent */ - headers?: Object; + headers?: {[key: string]: any}; /** * URL parameters to be sent with the request diff --git a/bases/bases-tests.ts b/bases/bases-tests.ts new file mode 100644 index 0000000000..5414b18764 --- /dev/null +++ b/bases/bases-tests.ts @@ -0,0 +1,10 @@ +/// +import * as bases from 'bases'; + +let bs16String: string = bases.toBase(200, 16); // => 'c8' +let bs62String: string = bases.toBase(99999, 62); // => 'q0T' +let customBaseString: string = bases.toAlphabet(300, 'aAbBcC'); // => 'Abba' + +let frombs16Int: number = bases.fromBase('c8', 16); // => 200 +let frombs62Int: number = bases.fromBase('q0T', 62); // => 99999 +let customBaseInt: number = bases.fromAlphabet('Abba', 'aAbBcC'); // => 300 diff --git a/bases/bases.d.ts b/bases/bases.d.ts new file mode 100644 index 0000000000..2e62cf685a --- /dev/null +++ b/bases/bases.d.ts @@ -0,0 +1,22 @@ +// Type definitions for bases 0.2.1 +// Project: https://github.com/aseemk/bases.js +// Definitions by: Hari Krishna +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "bases" { + export function toAlphabet(num: number, alphabet: string): string; + + export function fromAlphabet(str: string, alphabet: string): number; + + export function toBase(num: number, base: number): string; + + export function fromBase(str: string, base:number): number; + + export let KNOWN_ALPHABETS: any; + + export let NUMERALS: string; + + export let LETTERS_LOWERCASE: string; + + export let LETTERS_UPPERCASE: string; +} diff --git a/bit-array/bit-array-tests.ts b/bit-array/bit-array-tests.ts index 5e072967d9..7c1ff57b1b 100644 --- a/bit-array/bit-array-tests.ts +++ b/bit-array/bit-array-tests.ts @@ -1,3 +1,4 @@ +/// import BitArray = require("bit-array"); diff --git a/bit-array/bit-array-tests.ts.tscparams b/bit-array/bit-array-tests.ts.tscparams new file mode 100644 index 0000000000..85542607d1 --- /dev/null +++ b/bit-array/bit-array-tests.ts.tscparams @@ -0,0 +1 @@ +--noImplicitAny --module commonjs diff --git a/bit-array/bit-array.d.ts b/bit-array/bit-array.d.ts new file mode 100644 index 0000000000..bab3d98a46 --- /dev/null +++ b/bit-array/bit-array.d.ts @@ -0,0 +1,105 @@ +// Type definitions for bit-array v0.2.2 +// Project: https://github.com/bramstein/bit-array +// Definitions by: Mudkip +// Definitions: https://github.com/mudkipme/DefinitelyTyped + +declare module "bit-array" { + + class BitArray { + /** + * Creates a new empty BitArray with the given length or initialises the BitArray with the given hex representation. + */ + constructor(size: number, hex?: string); + + /** + * Returns the total number of bits in this BitArray. + */ + size(): number; + + /** + * Sets the bit at index to a value (boolean.) + */ + set(index: number, value: boolean): BitArray; + + /** + * Toggles the bit at index. If the bit is on, it is turned off. Likewise, if the bit is off it is turned on. + */ + toggle(index: number): BitArray; + + /** + * Returns the value of the bit at index (boolean.) + */ + get(index: number): boolean; + + /** + * Resets the BitArray so that it is empty and can be re-used. + */ + reset(): BitArray; + + /** + * Returns a copy of this BitArray. + */ + copy(): BitArray; + + /** + * Returns true if this BitArray equals another. Two BitArrays are considered + * equal if both have the same length and bit pattern. + */ + equals(x: BitArray): boolean; + + /** + * Returns the JSON representation of this BitArray. + */ + toJSON(): string; + + /** + * Returns a string representation of the BitArray with bits + * in mathemetical order. + */ + toBinaryString(): string; + + /** + * Returns a hexadecimal string representation of the BitArray + * with bits in logical order. + */ + toHexString(): string; + + /** + * Returns a string representation of the BitArray with bits + * in logical order. + */ + toString(): string; + + /** + * Convert the BitArray to an Array of boolean values (slow). + */ + toArray(): boolean[]; + + /** + * Returns the total number of bits set to one in this BitArray. + */ + count(): number; + + /** + * Inverts this BitArray. + */ + not(): BitArray; + + /** + * Bitwise OR on the values of this BitArray using BitArray x. + */ + or(x: BitArray): BitArray; + + /** + * Bitwise AND on the values of this BitArray using BitArray x. + */ + and(x: BitArray): BitArray; + + /** + * Bitwise XOR on the values of this BitArray using BitArray x. + */ + xor(x: BitArray): BitArray; + } + + export = BitArray; +} \ No newline at end of file diff --git a/bonjour/bonjour-tests.ts b/bonjour/bonjour-tests.ts new file mode 100644 index 0000000000..b97794b071 --- /dev/null +++ b/bonjour/bonjour-tests.ts @@ -0,0 +1,21 @@ +/// +import * as bonjour from 'bonjour'; + +var bonjourOptions: bonjour.BonjourOptions; +var bonjourInstance: bonjour.Bonjour; + +var serviceOptions: bonjour.ServiceOptions; +var service: bonjour.Service; + +var browserOptions: bonjour.BrowserOptions; +var browser: bonjour.Browser; + +bonjourOptions = { interface: '192.168.1.1', port: 5353 }; +bonjourInstance = new bonjour.Bonjour(bonjourOptions); + +serviceOptions = { name: 'My Web Server', type: 'http', port: 3000 }; +service = bonjourInstance.publish(serviceOptions); + +browserOptions = { protocol: 'tcp', type: 'http' }; +browser = bonjour.find(browserOptions); + diff --git a/bonjour/bonjour.d.ts b/bonjour/bonjour.d.ts new file mode 100644 index 0000000000..0ffd9f1171 --- /dev/null +++ b/bonjour/bonjour.d.ts @@ -0,0 +1,71 @@ +// Type definitions for bonjour v3.5.0 +// Project: https://github.com/watson/bonjour +// Definitions by: Quentin Lampin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "bonjour" { + export interface BonjourOptions { + multicast?: boolean; + interface?: string; + port?: number; + ip?: string; + ttl?: number; + loopback?: boolean; + reuseAddr?: boolean; + } + + export interface BrowserOptions { + type?: string; + subtypes?: string[]; + protocol?: string; + txt?: Object; + } + + export interface ServiceOptions { + name: string; + host?: string; + port: number; + type: string; + subtypes?: string[]; + protocol?: 'udp'|'tcp'; + txt?: Object; + } + + export interface Service { + name: string; + type: string; + subtypes: string[]; + protocol: string; + host: string; + port: number; + fqdn: string; + rawTxt: Object; + txt: Object; + published: boolean; + + stop: (cb: ()=>any) => void; + start: () => void; + } + + export class Bonjour { + + constructor(opts: BonjourOptions); + publish(options: ServiceOptions):Service; + unpublishAll(cb: ()=>any): void; + find(options:BrowserOptions, onUp: ()=>any): Browser; + findOne(options:any, cb: (service: Service)=>any): Browser; + destroy():void; + } + + export class Browser { + services: Service[]; + + start():void; + update():void; + stop():void; + } + + export function find(options: BrowserOptions, onUp?: ()=>any): Browser; + export function findOne(options: BrowserOptions): Browser; + +} diff --git a/bootbox/index.d.ts b/bootbox/index.d.ts index ea6d4d9664..40494d5ca5 100644 --- a/bootbox/index.d.ts +++ b/bootbox/index.d.ts @@ -40,6 +40,7 @@ interface BootboxConfirmOptions extends BootboxDialogOptions { interface BootboxPromptOptions extends BootboxBaseOptions { title: string; value?: string; + inputType?: string; callback: (result: string) => any; buttons?: BootboxConfirmPromptButtonMap; } diff --git a/bootstrap-datepicker/index.d.ts b/bootstrap-datepicker/index.d.ts index 39b8846cd0..1f9fd065d2 100644 --- a/bootstrap-datepicker/index.d.ts +++ b/bootstrap-datepicker/index.d.ts @@ -36,6 +36,7 @@ interface DatepickerOptions { multidateSeparator?: string; orientation?: string; assumeNearbyYear?: any; + viewMode?: string; } interface DatepickerCustomFormatOptions { diff --git a/bootstrap-table/bootstrap-table.d.ts b/bootstrap-table/bootstrap-table.d.ts new file mode 100644 index 0000000000..d0356dff84 --- /dev/null +++ b/bootstrap-table/bootstrap-table.d.ts @@ -0,0 +1,12 @@ +// Type definitions for Bootstrap Table v1.11.0 +// Project: http://bootstrap-table.wenzhixin.net.cn/ +// Definitions by: Talat Baig +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +interface JQuery { + bootstrapTable(options?: any): JQuery; +} + +declare var bootstrapTable: JQueryStatic; diff --git a/braintree-web/braintree-web-tests.ts b/braintree-web/braintree-web-tests.ts index fb7e6325c5..c9aee724c0 100644 --- a/braintree-web/braintree-web-tests.ts +++ b/braintree-web/braintree-web-tests.ts @@ -48,10 +48,18 @@ braintree.client.create({ selector: '#card-number' }, cvv: { - selector: '#cvv' + selector: '#cvv', + type: 'password' }, - expirationDate: { - selector: '#expiration-date' + expirationMonth: { + selector: '#expiration-month', + select: { + options: ["01 - Jan", "02 - Feb", "03 - Mar", "04 - Apr", "05 - May", "06 - Jun", "07 - Jul", "08 - Aug", "09 - Sep", "10 - Oct", "11 - Nov", "12 - Dec"] + } + }, + expirationYear: { + selector: '#expiration-year', + select: true } } }, function (hostedFieldsErr?: BraintreeError, hostedFieldsInstance?: any) { diff --git a/braintree-web/index.d.ts b/braintree-web/index.d.ts index 2cf2d89467..e58cf7455b 100644 --- a/braintree-web/index.d.ts +++ b/braintree-web/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Braintree-web v3.0.2 +// Type definitions for Braintree-web v3.5.0 // Project: https://github.com/braintree/braintree-web // Definitions by: Guy Shahine // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -540,12 +540,17 @@ declare namespace BraintreeWeb { * @typedef {object} field * @property {string} selector A CSS selector to find the container where the hosted field will be inserted. * @property {string} [placeholder] Will be used as the `placeholder` attribute of the input. If `placeholder` is not natively supported by the browser, it will be polyfilled. - * @property {boolean} [formatInput=true] - Enable or disable automatic formatting on this field. Note: Input formatting does not work properly on Android and iOS, so input formatting is automatically disabled on those browsers. + * @property {string} [type] Will be used as the `type` attribute of the input. To mask `cvv` input, for instance, `type: "password"` can be used. + * @property {boolean} [formatInput=true] - Enable or disable automatic formatting on this field. + * @property {object|boolean} [select] If truthy, this field becomes a ` + + + Label before} + labelPosition="before" + primary={true} + style={styles.button} + icon={} + /> + + } + /> + + +); + +const FlatButtonExampleIcon = () => ( +
+ } + style={style} + /> + } + style={style} + /> + } + style={style} + /> +
+); + + +// "http://www.material-ui.com/#/components/raised-button" +const RaisedButtonExampleSimple = () => ( +
+ + + + +
+); + +const RaisedButtonExampleComplex = () => ( +
+ + + + Label before} + labelPosition="before" + primary={true} + icon={} + style={styles.button} + /> + } + /> +
+); + +const RaisedButtonExampleIcon = () => ( +
+ } + style={style} + /> + } + style={style} + /> + } + style={style} + /> +
+); + + +// "http://www.material-ui.com/#/components/floating-action-button" +const FloatingActionButtonExampleSimple = () => ( +
+ + + + + + + + + + + + + + + + + + + + + + + +
+); + + +// "http://www.material-ui.com/#/components/icon-button" +const IconButtonExampleSimple = () => ( +
+ + +
+); + +const IconButtonExampleComplex = () => ( +
+ + + + + + + + + + home + +
+); + +const IconButtonExampleSize = () => ( +
+ + + + + + + + + + + + + + + +
+); + +const IconButtonExampleTooltip = () => ( +
+ + + + + + +
+); + +const IconButtonExampleTouch = () => ( +
+ + + + + + + + + + + + + + + + + + +
+); + + +// "http://www.material-ui.com/#/components/card" +const CardExampleWithAvatar = () => ( + + + } + > + + + + + Lorem ipsum dolor sit amet, consectetur adipiscing elit. + Donec mattis pretium massa. Aliquam erat volutpat. Nulla facilisi. + Donec vulputate interdum sollicitudin. Nunc lacinia auctor quam sed pellentesque. + Aliquam dui mauris, mattis quis lacus id, pellentesque lobortis odio. + + + + + + +); + +const CardExampleWithoutAvatar = () => ( + + + + Lorem ipsum dolor sit amet, consectetur adipiscing elit. + Donec mattis pretium massa. Aliquam erat volutpat. Nulla facilisi. + Donec vulputate interdum sollicitudin. Nunc lacinia auctor quam sed pellentesque. + Aliquam dui mauris, mattis quis lacus id, pellentesque lobortis odio. + + + + + + +); + +class CardExampleControlled extends React.Component<{}, {expanded: boolean}> { + + constructor(props) { + super(props); + this.state = { + expanded: false, + }; + } + + handleExpandChange = (expanded) => { + this.setState({expanded: expanded}); + }; + + handleToggle = (event, toggle) => { + this.setState({expanded: toggle}); + }; + + handleExpand = () => { + this.setState({expanded: true}); + }; + + handleReduce = () => { + this.setState({expanded: false}); + }; + + render() { + return ( + + + + + + } + > + + + + + Lorem ipsum dolor sit amet, consectetur adipiscing elit. + Donec mattis pretium massa. Aliquam erat volutpat. Nulla facilisi. + Donec vulputate interdum sollicitudin. Nunc lacinia auctor quam sed pellentesque. + Aliquam dui mauris, mattis quis lacus id, pellentesque lobortis odio. + + + + + + + ); + } +} + +// "http://www.material-ui.com/#/components/chip" +const ChipExampleSimple = () => ( +
+ Basic Chip + Blue Background + Blue Label Color + UI Avatar + Styled +
+); + +class ChipExampleComplex extends React.Component<{}, {}>{ + handleRequestDelete = () => { + alert('You clicked the delete button.'); + } + + handleTouchTap = () => { + alert('You clicked the Chip.'); + } + + render() { + return ( +
+ Click Me +
+ ); + } +} + + +// "http://www.material-ui.com/#/components/date-picker" +const DatePickerExampleSimple = () => ( +
+ + + +
+); + +const DatePickerExampleInline = () => ( +
+ + +
+); + +const optionsStyle = { + maxWidth: 255, + marginRight: 'auto', +}; + +interface DatePickerExampleToggleState { + minDate?: Date; + maxDate?: Date; + autoOk?: boolean; + disableYearSelection?: boolean; +} + +class DatePickerExampleToggle extends React.Component<{}, DatePickerExampleToggleState> { + constructor(props) { + super(props); + + const minDate = new Date(); + const maxDate = new Date(); + minDate.setFullYear(minDate.getFullYear() - 1); + minDate.setHours(0, 0, 0, 0); + maxDate.setFullYear(maxDate.getFullYear() + 1); + maxDate.setHours(0, 0, 0, 0); + + this.state = { + minDate: minDate, + maxDate: maxDate, + autoOk: false, + disableYearSelection: false, + }; + } + + handleChangeMinDate = (event, date) => { + this.setState({ + minDate: date, + }); + }; + + handleChangeMaxDate = (event, date) => { + this.setState({ + maxDate: date, + }); + }; + + handleToggle = (event, toggled) => { + this.setState({ + [event.target.name]: toggled, + }); + }; + + render() { + return ( +
+ +
+ + + + +
+
+ ); + } +} + +class DatePickerExampleControlled extends React.Component<{}, {controlledDate?: Date}> { + + constructor(props) { + super(props); + + this.state = { + controlledDate: null, + }; + } + + handleChange = (event, date) => { + this.setState({ + controlledDate: date, + }); + }; + + render() { + return ( + + ); + } +} + +function disableWeekends(date) { + return date.getDay() === 0 || date.getDay() === 6; +} +function disableRandomDates() { + return Math.random() > 0.7; +} +const DatePickerExampleDisableDates = () => ( +
+ + +
+); + +let DateTimeFormat = new Intl.DateTimeFormat('fr'); +const DatePickerExampleInternational = () => ( +
+ + + +
+); + + + +// "http://material-ui.com/#/components/dialog" +class DialogExampleSimple extends React.Component<{}, {open?: boolean}> { + state = { + open: false, + }; + + handleOpen = () => { + this.setState({open: true}); + }; + + handleClose = () => { + this.setState({open: false}); + }; + + render() { + const actions = [ + , + , + ]; + + return ( +
+ + + The actions in this window were passed in as an array of React objects. + +
+ ); + } +} + +class DialogExampleModal extends React.Component<{}, {open?: boolean}> { + state = { + open: false, + }; + + handleOpen = () => { + this.setState({open: true}); + }; + + handleClose = () => { + this.setState({open: false}); + }; + + render() { + const actions = [ + , + , + ]; + + return ( +
+ + + Only actions can close this dialog. + +
+ ); + } +} + +class DialogExampleCustomWidth extends React.Component<{}, {open?: boolean}> { + state = { + open: false, + }; + + handleOpen = () => { + this.setState({open: true}); + }; + + handleClose = () => { + this.setState({open: false}); + }; + + render() { + const actions = [ + , + , + ]; + + return ( +
+ + + This dialog spans the entire width of the screen. + +
+ ); + } +} + +class DialogExampleDialogDatePicker extends React.Component<{}, {open?: boolean}> { + state = { + open: false, + }; + + handleOpen = () => { + this.setState({open: true}); + }; + + handleClose = () => { + this.setState({open: false}); + }; + + render() { + const actions = [ + , + ]; + + return ( +
+ + + Open a Date Picker dialog from within a dialog. + + +
+ ); + } +} + +class DialogExampleScrollable extends React.Component<{}, {open?: boolean}> { + state = { + open: false, + }; + + handleOpen = () => { + this.setState({open: true}); + }; + + handleClose = () => { + this.setState({open: false}); + }; + + render() { + const actions = [ + , + , + ]; + + const radios = []; + for (let i = 0; i < 30; i++) { + radios.push( + + ); + } + + return ( +
+ + + + {radios} + + +
+ ); + } +} + +class DialogExampleAlert extends React.Component<{}, {open?: boolean}> { + state = { + open: false, + }; + + handleOpen = () => { + this.setState({open: true}); + }; + + handleClose = () => { + this.setState({open: false}); + }; + + render() { + const actions = [ + , + , + ]; + + return ( +
+ + + Discard draft? + +
+ ); + } +} + + +// "http://www.material-ui.com/#/components/divider" +const DividerExampleForm = () => ( + + + + + + + + + + +); + +const DividerExampleList = () => ( + + + + + + + + + + + +); + +const DividerExampleMenu = () => ( + + + + + + +); + + +// "http://www.material-ui.com/#/components/drawer" +class DrawerSimpleExample extends React.Component<{}, {open?: boolean}> { + + constructor(props) { + super(props); + this.state = {open: false}; + } + + handleToggle = () => this.setState({open: !this.state.open}); + + render() { + return ( +
+ + + Menu Item + Menu Item 2 + +
+ ); + } +} + +class DrawerUndockedExample extends React.Component<{}, {open?: boolean}> { + + constructor(props) { + super(props); + this.state = {open: false}; + } + + handleToggle = () => this.setState({open: !this.state.open}); + + handleClose = () => this.setState({open: false}); + + render() { + return ( +
+ + this.setState({open})} + > + Menu Item + Menu Item 2 + +
+ ); + } +} + +class DrawerOpenRightExample extends React.Component<{}, {open?: boolean}> { + + constructor(props) { + super(props); + this.state = {open: false}; + } + + handleToggle = () => this.setState({open: !this.state.open}); + + render() { + return ( +
+ + + + +
+ ); + } +} + + +// "http://www.material-ui.com/#/components/grid-list" +const tilesData: {img: string, title: string, author: string, featured?: boolean}[] = [ + { + img: 'images/grid-list/00-52-29-429_640.jpg', + title: 'Breakfast', + author: 'jill111', + featured: true, + }, + { + img: 'images/grid-list/burger-827309_640.jpg', + title: 'Tasty burger', + author: 'pashminu', + }, + { + img: 'images/grid-list/camera-813814_640.jpg', + title: 'Camera', + author: 'Danson67', + }, + { + img: 'images/grid-list/morning-819362_640.jpg', + title: 'Morning', + author: 'fancycrave1', + }, + { + img: 'images/grid-list/hats-829509_640.jpg', + title: 'Hats', + author: 'Hans', + }, + { + img: 'images/grid-list/honey-823614_640.jpg', + title: 'Honey', + author: 'fancycravel', + }, + { + img: 'images/grid-list/vegetables-790022_640.jpg', + title: 'Vegetables', + author: 'jill111', + }, + { + img: 'images/grid-list/water-plant-821293_640.jpg', + title: 'Water plant', + author: 'BkrmadtyaKarki', + }, +]; + +const GridListExampleSimple = () => ( +
+ + December + {tilesData.map((tile) => ( + by {tile.author}} + actionIcon={} + > + + + ))} + +
+); + +const GridListExampleComplex = () => ( +
+ + {tilesData.map((tile) => ( + } + actionPosition="left" + titlePosition="top" + titleBackground="linear-gradient(to bottom, rgba(0,0,0,0.7) 0%,rgba(0,0,0,0.3) 70%,rgba(0,0,0,0) 100%)" + cols={tile.featured ? 2 : 1} + rows={tile.featured ? 2 : 1} + > + + + ))} + +
+); + + +// "http://www.material-ui.com/#/components/font-icon" +const FontIconExampleSimple = () => ( +
+ + + + + +
+); + +const FontIconExampleIcons = () => ( +
+ home + flight_takeoff + cloud_download + videogame_asset +
+); + + +// "http://www.material-ui.com/#/components/svg-icon" +const HomeIcon = (props) => ( + + + +); + +const SvgIconExampleSimple = () => ( +
+ + + +
+); + +const SvgIconExampleIcons = () => ( +
+ + + + +
+); + + +// "http://material-ui.com/#/components/lists" +const ListExampleSimple = () => ( + + + } /> + } /> + } /> + } /> + } /> + + + + } /> + } /> + } /> + } /> + + +); + +const ListExampleChat = () => ( + + + Recent chats + } + rightIcon={} + /> + } + rightIcon={} + /> + } + rightIcon={} + /> + } + rightIcon={} + /> + } + rightIcon={} + /> + + + + Previous chats + } + /> + } + /> + + +); + +const ListExampleContacts = () => ( + + + } + rightAvatar={} + /> + } + /> + } + /> + } + /> + + + + + A + + } + rightAvatar={} + /> + } + /> + } + /> + } + /> + + +); + +const ListExampleFolder = () => ( + + + Folders + } />} + rightIcon={} + primaryText="Photos" + secondaryText="Jan 9, 2014" + /> + } />} + rightIcon={} + primaryText="Recipes" + secondaryText="Jan 17, 2014" + /> + } />} + rightIcon={} + primaryText="Work" + secondaryText="Jan 28, 2014" + /> + + + + Files + } backgroundColor={blue500} />} + rightIcon={} + primaryText="Vacation itinerary" + secondaryText="Jan 20, 2014" + /> + } backgroundColor={yellow600} />} + rightIcon={} + primaryText="Kitchen remodel" + secondaryText="Jan 10, 2014" + /> + + +); + +const ListExampleNested = () => ( + + + Nested List Items + } /> + } /> + } + initiallyOpen={true} + primaryTogglesNestedList={true} + nestedItems={[ + } + />, + } + disabled={true} + nestedItems={[ + } />, + ]} + />, + ]} + /> + + +); + +const ListExampleSettings = () => ( +
+ + + General + + + + + + Hangout Notifications + } + primaryText="Notifications" + secondaryText="Allow notifications" + /> + } + primaryText="Sounds" + secondaryText="Hangouts message" + /> + } + primaryText="Video sounds" + secondaryText="Hangouts video call" + /> + + + + + + + + + Priority Interruptions + } /> + } /> + } /> + + + + Hangout Notifications + } /> + } /> + } /> + + +
+); + +const ListExamplePhone = () => ( + + + } + rightIcon={} + primaryText="(650) 555 - 1234" + secondaryText="Mobile" + /> + } + primaryText="(323) 555 - 6789" + secondaryText="Work" + /> + + + + } + primaryText="aliconnors@example.com" + secondaryText="Personal" + /> + + + +); + +const iconButtonElement = ( + + + +); + +const rightIconMenu = ( + + Reply + Forward + Delete + +); + +const ListExampleMessages = () => ( +
+ + + Today + } + primaryText="Brunch this weekend?" + secondaryText={ +

+ Brendan Lim -- + I'll be in your neighborhood doing errands this weekend. Do you want to grab brunch? +

+ } + secondaryTextLines={2} + /> + + } + primaryText={ +

Summer BBQ  4

+ } + secondaryText={ +

+ to me, Scott, Jennifer -- + Wish I could come, but I'm out of town this weekend. +

+ } + secondaryTextLines={2} + /> + + } + primaryText="Oui oui" + secondaryText={ +

+ Grace Ng -- + Do you have Paris recommendations? Have you ever been? +

+ } + secondaryTextLines={2} + /> + + } + primaryText="Birdthday gift" + secondaryText={ +

+ Kerem Suer -- + Do you have any ideas what we can get Heidi for her birthday? How about a pony? +

+ } + secondaryTextLines={2} + /> + + } + primaryText="Recipe to try" + secondaryText={ +

+ Raquel Parrado -- + We should eat this: grated squash. Corn and tomatillo tacos. +

+ } + secondaryTextLines={2} + /> +
+
+ + + Today + } + rightIconButton={rightIconMenu} + primaryText="Brendan Lim" + secondaryText={ +

+ Brunch this weekend?
+ I'll be in your neighborhood doing errands this weekend. Do you want to grab brunch? +

+ } + secondaryTextLines={2} + /> + + } + rightIconButton={rightIconMenu} + primaryText="me, Scott, Jennifer" + secondaryText={ +

+ Summer BBQ
+ Wish I could come, but I'm out of town this weekend. +

+ } + secondaryTextLines={2} + /> + + } + rightIconButton={rightIconMenu} + primaryText="Grace Ng" + secondaryText={ +

+ Oui oui
+ Do you have any Paris recs? Have you ever been? +

+ } + secondaryTextLines={2} + /> + + } + rightIconButton={rightIconMenu} + primaryText="Kerem Suer" + secondaryText={ +

+ Birthday gift
+ Do you have any ideas what we can get Heidi for her birthday? How about a pony? +

+ } + secondaryTextLines={2} + /> + + } + rightIconButton={rightIconMenu} + primaryText="Raquel Parrado" + secondaryText={ +

+ Recipe to try
+ We should eat this: grated squash. Corn and tomatillo tacos. +

+ } + secondaryTextLines={2} + /> +
+
+
+); + +function wrapState(ComposedComponent: React.ComponentClass<__MaterialUI.List.SelectableProps>) { + return class SelectableList extends Component<{defaultValue: number}, {selectedIndex: number}> { + static propTypes = { + children: PropTypes.node.isRequired, + defaultValue: PropTypes.number.isRequired, + }; + + componentWillMount() { + this.setState({ + selectedIndex: this.props.defaultValue, + }); + } + + handleRequestChange = (event, index) => { + this.setState({ + selectedIndex: index, + }); + }; + + render() { + return ( + + {this.props.children} + + ); + } + }; +} + +let SelectableList = wrapState(MakeSelectable(List)); + +const ListExampleSelectable = () => ( + + + Selectable Contacts + } + nestedItems={[ + } + />, + ]} + /> + } + /> + } + /> + } + /> + + +); + + +// "http://www.material-ui.com/#/components/menu" +const MenuExampleSimple = () => ( +
+ + + + + + + + + + + + + + + + +
+); + +const MenuExampleDisable = () => ( +
+ + + + + + + + + + + + + + + + + + + + +
+); + +const MenuExampleIcons = () => ( +
+ + + } /> + } /> + } /> + + } /> + } /> + + } /> + + + + + + } /> + settings} /> + settings + } + /> + ¶} /> + §} /> + + +
+); + +const MenuExampleSecondary = () => ( +
+ + + + + + + + + + } /> + } /> + } /> + } /> + } /> + + + + + + + + + + + + + + + + + + +
+); + +const MenuExampleNested = () => ( +
+ + + + + + } + menuItems={[ + } + menuItems={[ + , + , + , + , + ]} + />, + , + , + , + ]} + /> + + + + + + + +
+); + + +// "http://www.material-ui.com/#/components/icon-menu" +const IconMenuExampleSimple = () => ( +
+ } + anchorOrigin={{horizontal: 'left', vertical: 'top'}} + targetOrigin={{horizontal: 'left', vertical: 'top'}} + > + + + + + + + } + anchorOrigin={{horizontal: 'left', vertical: 'bottom'}} + targetOrigin={{horizontal: 'left', vertical: 'bottom'}} + > + + + + + + + } + anchorOrigin={{horizontal: 'right', vertical: 'bottom'}} + targetOrigin={{horizontal: 'right', vertical: 'bottom'}} + > + + + + + + + } + anchorOrigin={{horizontal: 'right', vertical: 'top'}} + targetOrigin={{horizontal: 'right', vertical: 'top'}} + > + + + + + + +
+); + +interface IconMenuExampleControlledState { + valueSingle?: string; + valueMultiple?: string[]; + openMenu?: boolean; +} + +class IconMenuExampleControlled extends React.Component<{}, IconMenuExampleControlledState> { + constructor(props) { + super(props); + + this.state = { + valueSingle: '3', + valueMultiple: ['3', '5'], + }; + } + + handleChangeSingle = (event, value) => { + this.setState({ + valueSingle: value, + }); + }; + + handleChangeMultiple = (event, value) => { + this.setState({ + valueMultiple: value, + }); + }; + + handleOpenMenu = () => { + this.setState({ + openMenu: true, + }); + } + + handleOnRequestChange = (value) => { + this.setState({ + openMenu: value, + }); + } + + render() { + return ( +
+ } + onChange={this.handleChangeSingle} + value={this.state.valueSingle} + > + + + + + + + } + onChange={this.handleChangeMultiple} + value={this.state.valueMultiple} + multiple={true} + > + + + + + + + + } + open={this.state.openMenu} + onRequestChange={this.handleOnRequestChange} + > + + + + + + +
+ ); + } +} + +const IconMenuExampleScrollable = () => ( + } + anchorOrigin={{horizontal: 'left', vertical: 'top'}} + targetOrigin={{horizontal: 'left', vertical: 'top'}} + maxHeight={272} + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +); + +const IconMenuExampleNested = () => ( +
+ } + anchorOrigin={{horizontal: 'left', vertical: 'top'}} + targetOrigin={{horizontal: 'left', vertical: 'top'}} + > + } + menuItems={[ + , + , + , + , + ]} + /> + + } + menuItems={[ + , + , + , + , + ]} + /> + + } /> + + + + +
+); + + +// "http://www.material-ui.com/#/components/dropdown-menu" +class DropDownMenuSimpleExample extends React.Component<{}, {value?: number}> { + + constructor(props) { + super(props); + this.state = {value: 1}; + } + + handleChange = (event, index, value) => this.setState({value}); + + render() { + return ( +
+ + + + + + + +
+ + + + + + + +
+ ); + } +} + +class DropDownMenuOpenImmediateExample extends React.Component<{}, {value?: number}> { + + constructor(props) { + super(props); + this.state = {value: 2}; + } + + handleChange = (event, index, value) => this.setState({value}); + + render() { + return ( + + + + + + + + ); + } +} + +const items: React.ReactElement<__MaterialUI.Menus.MenuItemProps>[] = []; +for (let i = 0; i < 100; i++ ) { + items.push(); +} + +class DropDownMenuLongMenuExample extends React.Component<{}, {value?: number}> { + + constructor(props) { + super(props); + this.state = {value: 10}; + } + + handleChange = (event, index, value) => this.setState({value}); + + render() { + return ( + + {items} + + ); + } +} + +class DropDownMenuLabeledExample extends React.Component<{}, {value?: number}> { + + constructor(props) { + super(props); + this.state = {value: 2}; + } + + handleChange = (event, index, value) => this.setState({value}); + + render() { + return ( + + + + + + + ); + } +} + + +// "http://material-ui.com/#/components/paper" +const PaperExampleSimple = () => ( +
+ + + + + +
+); + +const PaperExampleRounded = () => ( +
+ + + + + +
+); + +const PaperExampleCircle = () => ( +
+ + + + + +
+); + + +// "http://www.material-ui.com/#/components/popover" +class PopoverExampleSimple extends React.Component<{}, {open?: boolean, anchorEl?: React.ReactInstance}> { + + constructor(props) { + super(props); + + this.state = { + open: false, + }; + } + + handleTouchTap = (event) => { + // This prevents ghost click. + event.preventDefault(); + + this.setState({ + open: true, + anchorEl: event.currentTarget, + }); + }; + + handleRequestClose = () => { + this.setState({ + open: false, + }); + }; + + render() { + return ( +
+ + + + + + + + + +
+ ); + } +} + +class PopoverExampleAnimation extends React.Component<{}, {open?: boolean, anchorEl?: React.ReactInstance}> { + + constructor(props) { + super(props); + + this.state = { + open: false, + }; + } + + handleTouchTap = (event) => { + // This prevents ghost click. + event.preventDefault(); + this.setState({ + open: true, + anchorEl: event.currentTarget, + }); + }; + + handleRequestClose = () => { + this.setState({ + open: false, + }); + }; + + render() { + return ( +
+ + + + + + + + + +
+ ); + } +} + +interface PopoverExampleConfigurableState { + open?: boolean; + anchorOrigin?: __MaterialUI.propTypes.origin; + targetOrigin?: __MaterialUI.propTypes.origin; + anchorEl?: React.ReactInstance; +} + +class PopoverExampleConfigurable extends React.Component<{}, PopoverExampleConfigurableState> { + + constructor(props) { + super(props); + + this.state = { + open: false, + anchorOrigin: { + horizontal: 'left', + vertical: 'bottom', + }, + targetOrigin: { + horizontal: 'left', + vertical: 'top', + }, + }; + } + + handleTouchTap = (event) => { + // This prevents ghost click. + event.preventDefault(); + this.setState({ + open: true, + anchorEl: event.currentTarget, + }); + }; + + handleRequestClose = () => { + this.setState({ + open: false, + }); + }; + + setAnchor = (positionElement, position) => { + const {anchorOrigin} = this.state; + anchorOrigin[positionElement] = position; + + this.setState({ + anchorOrigin: anchorOrigin, + }); + }; + + setTarget = (positionElement, position) => { + const {targetOrigin} = this.state; + targetOrigin[positionElement] = position; + + this.setState({ + targetOrigin: targetOrigin, + }); + }; + + render() { + return ( +
+ +

Current Settings

+
+          anchorOrigin: {JSON.stringify(this.state.anchorOrigin)}
+          
+ targetOrigin: {JSON.stringify(this.state.targetOrigin)} +
+

Position Options

+

Use the settings below to toggle the positioning of the popovers above

+

Anchor Origin

+
+
+ Vertical + + + +
+
+ Horizontal + + + +
+
+

Target Origin

+
+
+ Vertical + + + +
+
+ Horizontal + + + +
+
+ + + + + + + + +
+ ); + } +} + + +// "http://www.material-ui.com/#/components/circular-progress" +const CircularProgressExampleSimple = () => ( +
+ + + +
+); + +class CircularProgressExampleDeterminate extends React.Component<{}, {completed?: number}> { + private timer: number; + + constructor(props) { + super(props); + + this.state = { + completed: 0, + }; + } + + componentDidMount() { + this.timer = setTimeout(() => this.progress(5), 1000); + } + + componentWillUnmount() { + clearTimeout(this.timer); + } + + progress(completed) { + if (completed > 100) { + this.setState({completed: 100}); + } else { + this.setState({completed}); + const diff = Math.random() * 10; + this.timer = setTimeout(() => this.progress(completed + diff), 1000); + } + } + + render() { + return ( +
+ + + +
+ ); + } +} + + +// "http://www.material-ui.com/#/components/linear-progress" +const LinearProgressExampleSimple = () => ( + +); + +class LinearProgressExampleDeterminate extends React.Component<{}, {completed?: number}> { + private timer: number; + + constructor(props) { + super(props); + + this.state = { + completed: 0, + }; + } + + componentDidMount() { + this.timer = setTimeout(() => this.progress(5), 1000); + } + + componentWillUnmount() { + clearTimeout(this.timer); + } + + progress(completed) { + if (completed > 100) { + this.setState({completed: 100}); + } else { + this.setState({completed}); + const diff = Math.random() * 10; + this.timer = setTimeout(() => this.progress(completed + diff), 1000); + } + } + + render() { + return ( + + ); + } +} + + +// "http://www.material-ui.com/#/components/refresh-indicator" +const RefreshIndicatorExampleSimple = () => ( +
+ + + + +
+); + +const RefreshIndicatorExampleLoading = () => ( +
+ + +
+); + + +// "http://www.material-ui.com/#/components/select-field" +class SelectFieldExampleSimple extends React.Component<{}, {value?: number}> { + + constructor(props) { + super(props); + this.state = {value: 1}; + } + + handleChange = (event, index, value) => this.setState({value}); + + render() { + return ( +
+ + + + + + + +
+ + + + +
+ + + + + + + +
+ + + + + + + +
+ ); + } +} + +class SelectFieldLongMenuExample extends React.Component<{}, {value?: number}> { + + constructor(props) { + super(props); + this.state = {value: 10}; + } + + handleChange = (event, index, value) => this.setState({value}); + + render() { + return ( + + {items} + + ); + } +} + +class SelectFieldExampleCustomLabel extends React.Component<{}, {value?: number}> { + + constructor(props) { + super(props); + this.state = {value: 1}; + } + + handleChange = (event, index, value) => this.setState({value}); + + render() { + return ( + + + + + + + ); + } +} + +const itemsPeriod = [ + , + , + , + , + , +]; + +export default class SelectFieldExampleFloatingLabel extends React.Component<{}, {value?: number}> { + + constructor(props) { + super(props); + this.state = {value: null}; + } + + handleChange = (event, index, value) => this.setState({value}); + + render() { + return ( +
+ + {itemsPeriod} + +
+ + {itemsPeriod} + +
+ ); + } +} + +class SelectFieldExampleError extends React.Component<{}, {value?: number}> { + + constructor(props) { + super(props); + this.state = {value: null}; + } + + handleChange = (event, index, value) => this.setState({value}); + + render() { + const {value} = this.state; + + const night = value === 2 || value === 3; + + return ( +
+ + {itemsPeriod} + +
+ + {itemsPeriod} + +
+ ); + } +} + + +// "http://www.material-ui.com/#/components/slider" +const SliderExampleSimple = () => ( +
+ + + +
+); + +const SliderExampleDisabled = () => ( +
+ + + +
+); + +const SliderExampleStep = () => ( + +); + +class SliderExampleControlled extends React.Component<{}, {firstSlider?: number, secondSlider?: number}> { + + state = { + firstSlider: 0.5, + secondSlider: 50, + } + + handleFirstSlider(event, value) { + this.setState({firstSlider: value}); + } + + handleSecondSlider(event, value) { + this.setState({secondSlider: value}); + } + + render() { + return ( +
+ +

+ {'The value of this slider is: '} + {this.state.firstSlider} + {' from a range of 0 to 1 inclusive'} +

+ +

+ {'The value of this slider is: '} + {this.state.secondSlider} + {' from a range of 0 to 100 inclusive'} +

+
+ ); + } +} + + +// "http://www.material-ui.com/#/components/checkbox" +const CheckboxExampleSimple = () => ( +
+ + + } + uncheckedIcon={} + label="Custom icon" + style={styles.checkbox} + /> + + + +
+); + + +// "http://www.material-ui.com/#/components/radio-button" +const RadioButtonExampleSimple = () => ( +
+ + + + } + uncheckedIcon={} + style={styles.radioButton} + /> + + + + + + + + +
+); + + +// "http://www.material-ui.com/#/components/toggle" +const ToggleExampleSimple = () => ( +
+ + + + +
+); + + +// "http://material-ui.com/#/components/snackbar" +class SnackbarExampleSimple extends React.Component<{}, {open?: boolean}> { + + constructor(props) { + super(props); + this.state = { + open: false, + }; + } + + handleTouchTap = () => { + this.setState({ + open: true, + }); + }; + + handleRequestClose = () => { + this.setState({ + open: false, + }); + }; + + render() { + return ( +
+ + +
+ ); + } +} + +class SnackbarExampleAction extends React.Component<{}, {open?: boolean, autoHideDuration?: number, message?: string}> { + + constructor(props) { + super(props); + this.state = { + autoHideDuration: 4000, + message: 'Event added to your calendar', + open: false, + }; + } + + handleTouchTap = () => { + this.setState({ + open: true, + }); + }; + + handleActionTouchTap = () => { + this.setState({ + open: false, + }); + alert('Event removed from your calendar.'); + }; + + handleChangeDuration = (event) => { + const value = event.target.value; + this.setState({ + autoHideDuration: value.length > 0 ? parseInt(value) : 0, + }); + }; + + handleRequestClose = () => { + this.setState({ + open: false, + }); + }; + + render() { + return ( +
+ +
+ + +
+ ); + } +} + +class SnackbarExampleTwice extends React.Component<{}, {open?: boolean, message?: string}> { + + private timer: number; + + constructor(props) { + super(props); + this.state = { + message: 'Event 1 added to your calendar', + open: false, + }; + this.timer = undefined; + } + + componentWillUnMount() { + clearTimeout(this.timer); + } + + handleTouchTap = () => { + this.setState({ + open: true, + }); + + this.timer = setTimeout(() => { + this.setState({ + message: `Event ${Math.round(Math.random() * 100)} added to your calendar`, + }); + }, 1500); + }; + + handleRequestClose = () => { + this.setState({ + open: false, + }); + }; + + render() { + return ( +
+ + +
+ ); + } +} + + +// "http://www.material-ui.com/#/components/stepper" +class HorizontalLinearStepper extends React.Component<{}, {stepIndex?: number, finished?: boolean}> { + + state = { + finished: false, + stepIndex: 0, + }; + + handleNext = () => { + const {stepIndex} = this.state; + this.setState({ + stepIndex: stepIndex + 1, + finished: stepIndex >= 2, + }); + }; + + handlePrev = () => { + const {stepIndex} = this.state; + if (stepIndex > 0) { + this.setState({stepIndex: stepIndex - 1}); + } + }; + + getStepContent(stepIndex) { + switch (stepIndex) { + case 0: + return 'Select campaign settings...'; + case 1: + return 'What is an ad group anyways?'; + case 2: + return 'This is the bit I really care about!'; + default: + return 'You\'re a long way from home sonny jim!'; + } + } + + render() { + const {finished, stepIndex} = this.state; + const contentStyle = {margin: '0 16px'}; + + return ( +
+ + + Select campaign settings + + + Create an ad group + + + Create an ad + + +
+ {finished ? ( +

+ { + event.preventDefault(); + this.setState({stepIndex: 0, finished: false}); + }} + > + Click here + to reset the example. +

+ ) : ( +
+

{this.getStepContent(stepIndex)}

+
+ + +
+
+ )} +
+
+ ); + } +} + +class VerticalLinearStepper extends React.Component<{}, {stepIndex?: number, finished?: boolean}> { + + state = { + finished: false, + stepIndex: 0, + }; + + handleNext = () => { + const {stepIndex} = this.state; + this.setState({ + stepIndex: stepIndex + 1, + finished: stepIndex >= 2, + }); + }; + + handlePrev = () => { + const {stepIndex} = this.state; + if (stepIndex > 0) { + this.setState({stepIndex: stepIndex - 1}); + } + }; + + renderStepActions(step) { + const {stepIndex} = this.state; + + return ( +
+ + {step > 0 && ( + + )} +
+ ); + } + + render() { + const {finished, stepIndex} = this.state; + + return ( +
+ + + Select campaign settings + +

+ For each ad campaign that you create, you can control how much + you're willing to spend on clicks and conversions, which networks + and geographical locations you want your ads to show on, and more. +

+ {this.renderStepActions(0)} +
+
+ + Create an ad group + +

An ad group contains one or more ads which target a shared set of keywords.

+ {this.renderStepActions(1)} +
+
+ + Create an ad + +

+ Try out different ad text to see what brings in the most customers, + and learn how to enhance your ads using features like ad extensions. + If you run into any problems with your ads, find out how to tell if + they're running and how to resolve approval issues. +

+ {this.renderStepActions(2)} +
+
+
+ {finished && ( +

+ { + event.preventDefault(); + this.setState({stepIndex: 0, finished: false}); + }} + > + Click here + to reset the example. +

+ )} +
+ ); + } +} + +class HorizontalNonLinearStepper extends React.Component<{}, {stepIndex?: number}> { + + state = { + stepIndex: 0, + }; + + handleNext = () => { + const {stepIndex} = this.state; + if (stepIndex < 2) { + this.setState({stepIndex: stepIndex + 1}); + } + }; + + handlePrev = () => { + const {stepIndex} = this.state; + if (stepIndex > 0) { + this.setState({stepIndex: stepIndex - 1}); + } + }; + + getStepContent(stepIndex) { + switch (stepIndex) { + case 0: + return 'Select campaign settings...'; + case 1: + return 'What is an ad group anyways?'; + case 2: + return 'This is the bit I really care about!'; + default: + return 'You\'re a long way from home sonny jim!'; + } + } + + render() { + const {stepIndex} = this.state; + const contentStyle = {margin: '0 16px'}; + + return ( +
+ + + this.setState({stepIndex: 0})}> + Select campaign settings + + + + this.setState({stepIndex: 1})}> + Create an ad group + + + + this.setState({stepIndex: 2})}> + Create an ad + + + +
+

{this.getStepContent(stepIndex)}

+
+ + +
+
+
+ ); + } +} + +class VerticalNonLinear extends React.Component<{}, {stepIndex?: number}> { + + state = { + stepIndex: 0, + }; + + handleNext = () => { + const {stepIndex} = this.state; + if (stepIndex < 2) { + this.setState({stepIndex: stepIndex + 1}); + } + }; + + handlePrev = () => { + const {stepIndex} = this.state; + if (stepIndex > 0) { + this.setState({stepIndex: stepIndex - 1}); + } + }; + + renderStepActions(step) { + return ( +
+ + {step > 0 && ( + + )} +
+ ); + } + + render() { + const {stepIndex} = this.state; + + return ( +
+ + + this.setState({stepIndex: 0})}> + Select campaign settings + + +

+ For each ad campaign that you create, you can control how much + you're willing to spend on clicks and conversions, which networks + and geographical locations you want your ads to show on, and more. +

+ {this.renderStepActions(0)} +
+
+ + this.setState({stepIndex: 1})}> + Create an ad group + + +

An ad group contains one or more ads which target a shared set of keywords.

+ {this.renderStepActions(1)} +
+
+ + this.setState({stepIndex: 2})}> + Create an ad + + +

+ Try out different ad text to see what brings in the most customers, + and learn how to enhance your ads using features like ad extensions. + If you run into any problems with your ads, find out how to tell if + they're running and how to resolve approval issues. +

+ {this.renderStepActions(2)} +
+
+
+
+ ); + } +} + +const getStyles = () => { + return { + root: { + width: '100%', + maxWidth: 700, + margin: 'auto', + }, + content: { + margin: '0 16px', + }, + actions: { + marginTop: 12, + }, + backButton: { + marginRight: 12, + }, + }; +}; + +class GranularControlStepper extends React.Component<{}, {stepIndex?: number, visited?: number[]}> { + + state = { + stepIndex: null, + visited: [], + }; + + componentWillMount() { + const {stepIndex, visited} = this.state; + this.setState({visited: visited.concat(stepIndex)}); + } + + componentWillUpdate(nextProps, nextState) { + const {stepIndex, visited} = nextState; + if (visited.indexOf(stepIndex) === -1) { + this.setState({visited: visited.concat(stepIndex)}); + } + } + + handleNext = () => { + const {stepIndex} = this.state; + if (stepIndex < 2) { + this.setState({stepIndex: stepIndex + 1}); + } + }; + + handlePrev = () => { + const {stepIndex} = this.state; + if (stepIndex > 0) { + this.setState({stepIndex: stepIndex - 1}); + } + }; + + getStepContent(stepIndex) { + switch (stepIndex) { + case 0: + return 'Select campaign settings...'; + case 1: + return 'What is an ad group anyways?'; + case 2: + return 'This is the bit I really care about!'; + default: + return 'Click a step to get started.'; + } + } + + render() { + const {stepIndex, visited} = this.state; + const styles = getStyles(); + + return ( +
+

+ { + event.preventDefault(); + this.setState({stepIndex: null, visited: []}); + }} + > + Click here + to reset the example. +

+ + + this.setState({stepIndex: 0})}> + Select campaign settings + + + + this.setState({stepIndex: 1})}> + Create an ad group + + + + this.setState({stepIndex: 2})}> + Create an ad + + + +
+

{this.getStepContent(stepIndex)}

+ {stepIndex !== null && ( +
+ + +
+ )} +
+
+ ); + } +} + +class CustomIcon extends React.Component<{}, {stepIndex?: number}> { + + state = { + stepIndex: 0, + }; + + handleNext = () => { + const {stepIndex} = this.state; + if (stepIndex < 2) { + this.setState({stepIndex: stepIndex + 1}); + } + }; + + handlePrev = () => { + const {stepIndex} = this.state; + if (stepIndex > 0) { + this.setState({stepIndex: stepIndex - 1}); + } + }; + + getStepContent(stepIndex) { + switch (stepIndex) { + case 0: + return 'Select campaign settings...'; + case 1: + return 'What is an ad group anyways?'; + case 2: + return 'This is the bit I really care about!'; + default: + return 'You\'re a long way from home sonny jim!'; + } + } + + render() { + return ( +
+ + + + Select campaign settings + + + + } + style={{color: red500}} + > + Create an ad group + + + + + Create an ad + + + +
+ ); + } +} + + +// "http://www.material-ui.com/#/components/subheader" +// Included in ListExampleChat and ListExampleFolder + +// "http://www.material-ui.com/#/components/table" +const TableExampleSimple = () => ( + + + + ID + Name + Status + + + + + 1 + John Smith + Employed + + + 2 + Randal White + Unemployed + + + 3 + Stephanie Sanders + Employed + + + 4 + Steve Brown + Employed + + +
+); + +const tableData: {name: string, status: string, selected?: boolean}[] = [ + { + name: 'John Smith', + status: 'Employed', + selected: true, + }, + { + name: 'Randal White', + status: 'Unemployed', + }, + { + name: 'Stephanie Sanders', + status: 'Employed', + selected: true, + }, + { + name: 'Steve Brown', + status: 'Employed', + }, + { + name: 'Joyce Whitten', + status: 'Employed', + }, + { + name: 'Samuel Roberts', + status: 'Employed', + }, + { + name: 'Adam Moore', + status: 'Employed', + }, +]; + +interface TableExampleComplexState { + fixedHeader?: boolean, + fixedFooter?: boolean, + stripedRows?: boolean, + showRowHover?: boolean, + selectable?: boolean, + multiSelectable?: boolean, + enableSelectAll?: boolean, + deselectOnClickaway?: boolean, + showCheckboxes?: boolean, + height?: string, +} + +class TableExampleComplex extends React.Component<{}, TableExampleComplexState> { + + constructor(props) { + super(props); + + this.state = { + fixedHeader: true, + fixedFooter: true, + stripedRows: false, + showRowHover: false, + selectable: true, + multiSelectable: false, + enableSelectAll: false, + deselectOnClickaway: true, + showCheckboxes: true, + height: '300px', + }; + } + + handleToggle = (event, toggled) => { + this.setState({ + [event.target.name]: toggled, + }); + }; + + handleChange = (event) => { + this.setState({height: event.target.value}); + }; + + render() { + return ( +
+ + + + + Super Header + + + + ID + Name + Status + + + + {tableData.map( (row, index) => ( + + {index} + {row.name} + {row.status} + + ))} + + + + ID + Name + Status + + + + Super Footer + + + +
+ +
+

Table Properties

+ + + + + + +

TableBody Properties

+ + + +

Multiple Properties

+ +
+
+ ); + } +} + +// "http://www.material-ui.com/#/components/tabs" +function handleActive(tab) { + alert(`A tab with this value property ${tab.props.value} was activated.`); +} + +const TabsExampleSimple = () => ( + + +
+

Tab One

+

+ This is an example tab. +

+

+ You can put any sort of HTML or react component in here. It even keeps the component state! +

+ +
+
+ +
+

Tab Two

+

+ This is another example tab. +

+
+
+ +
+

Tab Three

+

+ This is a third example tab. +

+
+
+
+); + +class TabsExampleControlled extends React.Component<{}, {value?: string}> { + + constructor(props) { + super(props); + this.state = { + value: 'a', + }; + } + + handleChange = (value) => { + this.setState({ + value: value, + }); + }; + + render() { + return ( + + +
+

Controllable Tab A

+

+ Tabs are also controllable if you want to programmatically pass them their values. + This allows for more functionality in Tabs such as not + having any Tab selected or assigning them different values. +

+
+
+ +
+

Controllable Tab B

+

+ This is another example of a controllable tab. Remember, if you + use controllable Tabs, you need to give all of your tabs values or else + you wont be able to select them. +

+
+
+
+ ); + } +} + +const TabsExampleIcon = () => ( + + } /> + } /> + favorite} /> + +); + +const TabsExampleIconText = () => ( + + phone} + label="RECENTS" + /> + favorite} + label="FAVORITES" + /> + } + label="NEARBY" + /> + +); + + +// "http://www.material-ui.com/#/components/text-field" +const TextFieldExampleSimple = () => ( +
+
+
+
+
+
+
+
+
+
+ +
+); + +const TextFieldExampleError = () => ( +
+
+
+
+
+
+); + +const TextFieldExampleCustomize = () => ( +
+
+
+
+
+ +
+); + +const TextFieldExampleDisabled = () => ( +
+
+
+
+ +
+); + +class TextFieldExampleControlled extends React.Component<{}, {value?: string}> { + + constructor(props) { + super(props); + + this.state = { + value: 'Property Value', + }; + } + + handleChange = (event) => { + this.setState({ + value: event.target.value, + }); + }; + + render() { + return ( +
+ +
+ ); + } +} + +// "http://www.material-ui.com/#/components/time-picker" +const TimePickerExampleSimple = () => ( +
+ + + +
+); + +class TimePickerExampleComplex extends React.Component<{}, {value24?: Date, value12?: Date}> { + + constructor(props) { + super(props); + this.state = {value24: null, value12: null}; + } + + handleChangeTimePicker24 = (event, date) => { + this.setState({value24: date}); + }; + + handleChangeTimePicker12 = (event, date) => { + this.setState({value12: date}); + }; + + render() { + return ( +
+ + +
+ ); + } +} + +const TimePickerInternational = () => ( +
+ +
+); + + +// "http://www.material-ui.com/#/components/toolbar" +class ToolbarExamplesSimple extends React.Component<{}, {value?: number}> { + + constructor(props) { + super(props); + this.state = { + value: 3, + }; + } + + handleChange = (event, index, value) => this.setState({value}); + + render() { + return ( + + + + + + + + + + + + + + + + + + + + + } + > + + + + + + ); + } +} + +const componentWithWidth = withWidth()(ToolbarExamplesSimple); + + +interface MaterialUiTestsState { +} + +class MaterialUiTests extends React.Component<{}, MaterialUiTestsState> { + + render () { + return ( + + + + + ); + } +} + +// "http://www.material-ui.com/#/get-started/usage" +ReactDOM.render( + , + document.getElementById('app') +); diff --git a/material-ui/legacy/material-ui-0.15.1-tests.tsx.tscparams b/material-ui/legacy/material-ui-0.15.1-tests.tsx.tscparams new file mode 100644 index 0000000000..855355b85f --- /dev/null +++ b/material-ui/legacy/material-ui-0.15.1-tests.tsx.tscparams @@ -0,0 +1 @@ +--experimentalDecorators \ No newline at end of file diff --git a/material-ui/legacy/material-ui-0.15.1.d.ts b/material-ui/legacy/material-ui-0.15.1.d.ts new file mode 100644 index 0000000000..b5ec61b14b --- /dev/null +++ b/material-ui/legacy/material-ui-0.15.1.d.ts @@ -0,0 +1,8630 @@ +// Type definitions for material-ui v0.15.1 +// Project: https://github.com/callemall/material-ui +// Definitions by: Nathan Brown , Oliver Herrmann +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "material-ui" { + export import AppBar = __MaterialUI.AppBar; + export import AutoComplete = __MaterialUI.AutoComplete; + export import Avatar = __MaterialUI.Avatar; + export import Badge = __MaterialUI.Badge; + export import Card = __MaterialUI.Card.Card; + export import CardActions = __MaterialUI.Card.CardActions; + export import CardHeader = __MaterialUI.Card.CardHeader; + export import CardMedia = __MaterialUI.Card.CardMedia; + export import CardText = __MaterialUI.Card.CardText; + export import CardTitle = __MaterialUI.Card.CardTitle; + export import Checkbox = __MaterialUI.Switches.Checkbox; + export import Chip = __MaterialUI.Chip; + export import CircularProgress = __MaterialUI.CircularProgress; + export import DatePicker = __MaterialUI.DatePicker.DatePicker; + export import Dialog = __MaterialUI.Dialog; + export import Divider = __MaterialUI.Divider; + export import Drawer = __MaterialUI.Drawer; + export import DropDownMenu = __MaterialUI.Menus.DropDownMenu; + export import FlatButton = __MaterialUI.FlatButton; + export import FloatingActionButton = __MaterialUI.FloatingActionButton; + export import FontIcon = __MaterialUI.FontIcon; + export import GridList = __MaterialUI.GridList.GridList; + export import GridTile = __MaterialUI.GridList.GridTile; + export import IconButton = __MaterialUI.IconButton; + export import IconMenu = __MaterialUI.Menus.IconMenu; + export import LinearProgress = __MaterialUI.LinearProgress; + export import List = __MaterialUI.List.List; + export import ListItem = __MaterialUI.List.ListItem; + export import MakeSelectable = __MaterialUI.List.MakeSelectable; + export import Menu = __MaterialUI.Menus.Menu; + export import MenuItem = __MaterialUI.Menus.MenuItem; + export import Paper = __MaterialUI.Paper; + export import Popover = __MaterialUI.Popover.Popover; + export import RadioButton = __MaterialUI.Switches.RadioButton; + export import RadioButtonGroup = __MaterialUI.Switches.RadioButtonGroup; + export import RaisedButton = __MaterialUI.RaisedButton; + export import RefreshIndicator = __MaterialUI.RefreshIndicator; + export import SelectField = __MaterialUI.SelectField; + export import Slider = __MaterialUI.Slider; + export import Subheader = __MaterialUI.Subheader; + export import SvgIcon = __MaterialUI.SvgIcon; + export import Step = __MaterialUI.Stepper.Step; + export import StepButton = __MaterialUI.Stepper.StepButton; + export import StepContent = __MaterialUI.Stepper.StepContent; + export import StepLabel = __MaterialUI.Stepper.StepLabel; + export import Stepper = __MaterialUI.Stepper; + export import Snackbar = __MaterialUI.Snackbar; + export import Tab = __MaterialUI.Tabs.Tab; + export import Tabs = __MaterialUI.Tabs.Tabs; + export import Table = __MaterialUI.Table.Table; + export import TableBody = __MaterialUI.Table.TableBody; + export import TableFooter = __MaterialUI.Table.TableFooter; + export import TableHeader = __MaterialUI.Table.TableHeader; + export import TableHeaderColumn = __MaterialUI.Table.TableHeaderColumn; + export import TableRow = __MaterialUI.Table.TableRow; + export import TableRowColumn = __MaterialUI.Table.TableRowColumn; + export import TextField = __MaterialUI.TextField; + export import TimePicker = __MaterialUI.TimePicker; + export import Toggle = __MaterialUI.Switches.Toggle; + export import Toolbar = __MaterialUI.Toolbar.Toolbar; + export import ToolbarGroup = __MaterialUI.Toolbar.ToolbarGroup; + export import ToolbarSeparator = __MaterialUI.Toolbar.ToolbarSeparator; + export import ToolbarTitle = __MaterialUI.Toolbar.ToolbarTitle; + + // export type definitions + export type TouchTapEvent = __MaterialUI.TouchTapEvent; + export type TouchTapEventHandler = __MaterialUI.TouchTapEventHandler; +} + +declare namespace __MaterialUI { + export import React = __React; + + // ReactLink is from "react/addons" + interface ReactLink { + value: T; + requestChange(newValue: T): void; + } + + // What's common between React.TouchEvent and React.MouseEvent + interface TouchTapEvent extends React.SyntheticEvent { + altKey: boolean; + ctrlKey: boolean; + getModifierState(key: string): boolean; + metaKey: boolean; + shiftKey: boolean; + } + + // What's common between React.TouchEventHandler and React.MouseEventHandler + interface TouchTapEventHandler extends React.EventHandler { } + + interface ThemeWrapperProps extends React.Props { + theme: Styles.MuiTheme; + } + export class ThemeWrapper extends React.Component { + } + + export namespace Styles { + interface Spacing { + iconSize?: number; + + desktopGutter?: number; + desktopGutterMore?: number; + desktopGutterLess?: number; + desktopGutterMini?: number; + desktopKeylineIncrement?: number; + desktopDropDownMenuItemHeight?: number; + desktopDropDownMenuFontSize?: number; + desktopLeftNavMenuItemHeight?: number; + desktopSubheaderHeight?: number; + desktopToolbarHeight?: number; + } + export var Spacing: Spacing; + + interface ThemePalette { + primary1Color?: string; + primary2Color?: string; + primary3Color?: string; + accent1Color?: string; + accent2Color?: string; + accent3Color?: string; + textColor?: string; + alternateTextColor?: string; + canvasColor?: string; + borderColor?: string; + disabledColor?: string; + pickerHeaderColor?: string; + clockCircleColor?: string; + shadowColor?: string; + } + export var ThemePalette: ThemePalette; + interface MuiTheme { + spacing?: Spacing; + fontFamily?: string; + palette?: ThemePalette; + isRtl?: boolean; + userAgent?: string; + zIndex?: zIndex; + baseTheme?: RawTheme; + rawTheme?: RawTheme; + appBar?: { + color?: string; + textColor?: string; + height?: number; + titleFontWeight?: number; + padding?: number; + }; + avatar?: { + color?: string; + backgroundColor?: string; + borderColor?: string; + }; + badge?: { + color?: string; + textColor?: string; + primaryColor?: string; + primaryTextColor?: string; + secondaryColor?: string; + secondaryTextColor?: string; + fontWeight?: number; + }; + button?: { + height?: number; + minWidth?: number; + iconButtonSize?: number; + }; + card?: { + titleColor?: string; + subtitleColor?: string; + fontWeight?: number; + }; + cardMedia?: { + color?: string; + overlayContentBackground?: string; + titleColor?: string; + subtitleColor?: string; + }; + cardText?: { + textColor?: string; + }; + checkbox?: { + boxColor?: string; + checkedColor?: string; + requiredColor?: string; + disabledColor?: string; + labelColor?: string; + labelDisabledColor?: string; + }; + chip?: { + backgroundColor?: string; + deleteIconColor?: string; + textColor?: string; + fontSize?: number; + fontWeight?: number; + shadow?: string; + }; + datePicker?: { + color?: string; + textColor?: string; + calendarTextColor?: string; + selectColor?: string; + selectTextColor?: string; + calendarYearBackgroundColor?: string; + }; + dialog?: { + titleFontSize?: number; + bodyFontSize?: number; + bodyColor?: string; + }; + dropDownMenu?: { + accentColor?: string; + }; + enhancedButton?: { + tapHighlightColor?: string; + }; + flatButton?: { + color?: string; + buttonFilterColor?: string; + disabledTextColor?: string; + textColor?: string; + primaryTextColor?: string; + secondaryTextColor?: string; + fontSize?: number; + fontWeight?: number; + }; + floatingActionButton?: { + buttonSize?: number; + miniSize?: number; + color?: string; + iconColor?: string; + secondaryColor?: string; + secondaryIconColor?: string; + disabledTextColor?: string; + disabledColor?: string; + }; + gridTile?: { + textColor?: string; + }; + icon?: { + color?: string; + backgroundColor?: string; + }; + inkBar?: { + backgroundColor?: string; + }; + drawer?: { + width?: number; + color?: string; + }; + listItem?: { + nestedLevelDepth?: number; + secondaryTextColor?: string; + leftIconColor?: string; + rightIconColor?: string; + }; + menu?: { + backgroundColor?: string; + containerBackgroundColor?: string; + }; + menuItem?: { + dataHeight?: number; + height?: number; + hoverColor?: string; + padding?: number; + selectedTextColor?: string; + rightIconDesktopFill?: string; + }; + menuSubheader?: { + padding?: number; + borderColor?: string; + textColor?: string; + }; + overlay?: { + backgroundColor?: string; + }; + paper?: { + color?: string; + backgroundColor?: string; + zDepthShadows?: string[]; + }; + radioButton?: { + borderColor?: string; + backgroundColor?: string; + checkedColor?: string; + requiredColor?: string; + disabledColor?: string; + size?: number; + labelColor?: string; + labelDisabledColor?: string; + }; + raisedButton?: { + color?: string; + textColor?: string; + primaryColor?: string; + primaryTextColor?: string; + secondaryColor?: string; + secondaryTextColor?: string; + disabledColor?: string; + disabledTextColor?: string; + fontSize?: number; + fontWeight?: number; + }; + refreshIndicator?: { + strokeColor?: string; + loadingStrokeColor?: string; + }; + ripple?: { + color?: string; + }; + slider?: { + trackSize?: number; + trackColor?: string; + trackColorSelected?: string; + handleSize?: number; + handleSizeDisabled?: number; + handleSizeActive?: number; + handleColorZero?: string; + handleFillColor?: string; + selectionColor?: string; + rippleColor?: string; + }; + snackbar?: { + textColor?: string; + backgroundColor?: string; + actionColor?: string; + }; + subheader?: { + color?: string; + fontWeight?: number; + }; + stepper?: { + backgroundColor?: string; + hoverBackgroundColor?: string; + iconColor?: string; + hoveredIconColor?: string; + inactiveIconColor?: string; + textColor?: string; + disabledTextColor?: string; + connectorLineColor?: string; + }; + svgIcon?: { + color?: string, + }; + table?: { + backgroundColor?: string; + }; + tableFooter?: { + borderColor?: string; + textColor?: string; + }; + tableHeader?: { + borderColor?: string; + }; + tableHeaderColumn?: { + textColor?: string; + height?: number; + spacing?: number; + }; + tableRow?: { + hoverColor?: string; + stripeColor?: string; + selectedColor?: string; + textColor?: string; + borderColor?: string; + height?: number; + }; + tableRowColumn?: { + height?: number; + spacing?: number; + }; + tabs?: { + backgroundColor?: string; + textColor?: string; + selectedTextColor?: string; + }; + textField?: { + textColor?: string; + hintColor?: string; + floatingLabelColor?: string; + disabledTextColor?: string; + errorColor?: string; + focusColor?: string; + backgroundColor?: string; + borderColor?: string; + }; + timePicker?: { + color?: string; + textColor?: string; + accentColor?: string; + clockColor?: string; + clockCircleColor?: string; + headerColor?: string; + selectColor?: string; + selectTextColor?: string; + }; + toggle?: { + thumbOnColor?: string; + thumbOffColor?: string; + thumbDisabledColor?: string; + thumbRequiredColor?: string; + trackOnColor?: string; + trackOffColor?: string; + trackDisabledColor?: string; + labelColor?: string; + labelDisabledColor?: string; + trackRequiredColor?: string; + }; + toolbar?: { + color?: string; + hoverColor?: string; + backgroundColor?: string; + height?: number; + titleFontSize?: number; + iconColor?: string; + separatorColor?: string; + menuHoverColor?: string; + }; + tooltip?: { + color?: string; + rippleBackgroundColor?: string; + }; + } + + interface zIndex { + menu: number; + appBar: number; + drawerOverlay: number; + drawer: number; + dialogOverlay: number; + dialog: number; + layer: number; + popover: number; + snackbar: number; + tooltip: number; + } + export var zIndex: zIndex; + + interface RawTheme { + spacing?: Spacing; + fontFamily?: string; + palette?: ThemePalette; + } + var lightBaseTheme: RawTheme; + var darkBaseTheme: RawTheme; + + export function muiThemeable, P, S>(): (component: TComponent) => TComponent; + + //** @deprecated use MuiThemeProvider instead **/ + export function themeDecorator(muiTheme: Styles.MuiTheme): (Component: TFunction) => TFunction; + + interface MuiThemeProviderProps extends React.Props { + muiTheme?: Styles.MuiTheme; + } + export class MuiThemeProvider extends React.Component{ + } + + export function getMuiTheme(...muiTheme: MuiTheme[]): MuiTheme; + + interface ThemeManager { + //** @deprecated ThemeManager is deprecated. please import getMuiTheme directly from "material-ui/styles/getMuiTheme" **/ + getMuiTheme(baseTheme: RawTheme, muiTheme?: MuiTheme): MuiTheme; + + //** @deprecated modifyRawThemeSpacing is deprecated. please use getMuiTheme to modify your theme directly. http://www.material-ui.com/#/customization/themes **/ + modifyRawThemeSpacing(muiTheme: MuiTheme, newSpacing: Spacing): MuiTheme; + + //** @deprecated modifyRawThemePalette is deprecated. please use getMuiTheme to modify your theme directly. http://www.material-ui.com/#/customization/themes **/ + modifyRawThemePalette(muiTheme: MuiTheme, newPaletteKeys: ThemePalette): MuiTheme; + + //** @deprecated modifyRawThemeFontFamily is deprecated. please use getMuiTheme to modify your theme directly. http://www.material-ui.com/#/customization/themes **/ + modifyRawThemeFontFamily(muiTheme: MuiTheme, newFontFamily: string): MuiTheme; + } + export var ThemeManager: ThemeManager; + + interface Transitions { + easeOut(duration?: string, property?: string | string[], delay?: string, easeFunction?: string): string; + create(duration?: string, property?: string, delay?: string, easeFunction?: string): string; + easeOutFunction: string; + easeInOutFunction: string; + } + export var Transitions: Transitions; + + interface Typography { + textFullBlack: string; + textDarkBlack: string; + textLightBlack: string; + textMinBlack: string; + textFullWhite: string; + textDarkWhite: string; + textLightWhite: string; + + // font weight + fontWeightLight: number; + fontWeightNormal: number; + fontWeightMedium: number; + + fontStyleButtonFontSize: number; + } + export var Typography: Typography; + + //** @deprecated use darkBaseTheme instead **/ + export var DarkRawTheme: RawTheme; + + //** @deprecated use lightBaseTheme instead **/ + export var LightRawTheme: RawTheme; + } + + interface AppBarProps extends React.Props { + className?: string; + iconClassNameLeft?: string; + iconClassNameRight?: string; + iconElementLeft?: React.ReactElement; + iconElementRight?: React.ReactElement; + iconStyleRight?: React.CSSProperties; + iconStyleLeft?: React.CSSProperties; + onLeftIconButtonTouchTap?: TouchTapEventHandler; + onRightIconButtonTouchTap?: TouchTapEventHandler; + onTitleTouchTap?: TouchTapEventHandler; + showMenuIconButton?: boolean; + style?: React.CSSProperties; + title?: React.ReactNode; + titleStyle?: React.CSSProperties; + zDepth?: number; + } + export class AppBar extends React.Component{ + } + + interface AppCanvasProps extends React.Props { + } + export class AppCanvas extends React.Component { + } + + namespace propTypes { + type horizontal = 'left' | 'middle' | 'right'; + type vertical = 'top' | 'center' | 'bottom'; + type direction = 'left' | 'right' | 'up' | 'down'; + + interface origin { + horizontal: horizontal; + vertical: vertical; + } + + type corners = 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right'; + type cornersAndCenter = 'bottom-center' | 'bottom-left' | 'bottom-right' | 'top-center' | 'top-left' | 'top-right'; + } + + type AutoCompleteDataItem = { text: string, value: React.ReactNode } | string; + type AutoCompleteDataSource = { text: string, value: React.ReactNode }[] | string[]; + interface AutoCompleteProps extends React.Props { + anchorOrigin?: propTypes.origin; + animated?: boolean; + dataSource: AutoCompleteDataSource; + disableFocusRipple?: boolean; + errorStyle?: React.CSSProperties; + errorText?: string; + filter?: (searchText: string, key: string, item: AutoCompleteDataItem) => boolean; + floatingLabelText?: React.ReactNode; + fullWidth?: boolean; + hintText?: string; + listStyle?: React.CSSProperties; + maxSearchResults?: number; + menuCloseDelay?: number; + menuProps?: any; + menuStyle?: React.CSSProperties; + onBlur?: React.FocusEventHandler; + onFocus?: React.FocusEventHandler; + onKeyDown?: React.KeyboardEventHandler; + onNewRequest?: (chosenRequest: string, index: number) => void; + onUpdateInput?: (searchText: string, dataSource: AutoCompleteDataSource) => void; + open?: boolean; + openOnFocus?: boolean; + searchText?: string; + style?: React.CSSProperties; + targetOrigin?: propTypes.origin; + /** @deprecated Instead, use openOnFocus */ + triggerUpdateOnFocus?: boolean; + } + export class AutoComplete extends React.Component { + static noFilter: () => boolean; + static defaultFilter: (searchText: string, key: string) => boolean; + static caseSensitiveFilter: (searchText: string, key: string) => boolean; + static caseInsensitiveFilter: (searchText: string, key: string) => boolean; + static levenshteinDistanceFilter(distanceLessThan: number): (searchText: string, key: string) => boolean; + static fuzzyFilter: (searchText: string, key: string) => boolean; + static Item: Menus.MenuItem; + static Divider: Divider; + } + + interface AvatarProps extends React.Props { + backgroundColor?: string; + className?: string; + color?: string; + icon?: React.ReactElement; + size?: number; + src?: string; + style?: React.CSSProperties; + } + export class Avatar extends React.Component { + } + + interface BadgeProps extends React.Props { + badgeContent: React.ReactNode; + badgeStyle?: React.CSSProperties; + className?: string; + primary?: boolean; + secondary?: boolean; + style?: React.CSSProperties; + } + export class Badge extends React.Component { + } + + interface BeforeAfterWrapperProps extends React.Props { + afterElementType?: string; + afterStyle?: React.CSSProperties; + beforeElementType?: string; + beforeStyle?: React.CSSProperties; + elementType?: string; + style?: React.CSSProperties; + } + export class BeforeAfterWrapper extends React.Component { + } + + // non generally overridden elements of EnhancedButton + interface SharedEnhancedButtonProps extends React.Props { + centerRipple?: boolean; + disableFocusRipple?: boolean; + disableKeyboardFocus?: boolean; + disableTouchRipple?: boolean; + focusRippleColor?: string; + focusRippleOpacity?: number; + keyboardFocused?: boolean; + linkButton?: boolean; + onBlur?: React.FocusEventHandler; + onFocus?: React.FocusEventHandler; + onKeyboardFocus?: (e: React.FocusEvent, isKeyboardFocused: boolean) => void; + onKeyDown?: React.KeyboardEventHandler; + onKeyUp?: React.KeyboardEventHandler; + onTouchTap?: TouchTapEventHandler; + onClick?: React.MouseEventHandler; + style?: React.CSSProperties; + tabIndex?: number; + touchRippleColor?: string; + touchRippleOpacity?: number; + type?: string; + containerElement?: React.ReactNode | string; + } + + interface EnhancedButtonProps extends React.HTMLAttributes, SharedEnhancedButtonProps { + // container element,