Updated types for @material group to v0.35.0

This commit is contained in:
Collin Kostichuk
2018-05-10 14:21:45 -06:00
parent 63b0e8b632
commit 23ca115b22
133 changed files with 2095 additions and 792 deletions

View File

@@ -1,6 +1,6 @@
// Type definitions for Material Components Web 0.26
// Type definitions for Material Components Web 0.35
// Project: https://material.io/components/
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>, Collin Kostichuk <https://github.com/ckosti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -23,13 +23,17 @@
import autoInit from 'material__auto-init';
import * as base from 'material__base';
import * as checkbox from 'material__checkbox';
import * as chips from 'material__chips';
import * as dialog from 'material__dialog';
import * as drawer from 'material__drawer';
import * as floatingLabel from 'material__floating-label';
import * as formField from 'material__form-field';
import * as gridList from 'material__grid-list';
import * as iconToggle from 'material__icon-toggle';
import * as linearProgress from 'material__linear-progress';
import * as lineRipple from 'material__line-ripple';
import * as menu from 'material__menu';
import * as notchedOutline from 'material__notched-outline';
import * as radio from 'material__radio';
import * as ripple from 'material__ripple';
import * as select from 'material__select';
@@ -39,19 +43,23 @@ import * as snackbar from 'material__snackbar';
import * as tabs from 'material__tabs';
import * as textField from 'material__textfield';
import * as toolbar from 'material__toolbar';
import * as topAppBar from 'material__top-app-bar';
// Export all components.
export {
autoInit,
base,
checkbox,
chips,
dialog,
drawer,
floatingLabel,
formField,
gridList,
iconToggle,
lineRipple,
linearProgress,
menu,
notchedOutline,
radio,
ripple,
select,
@@ -61,4 +69,5 @@ export {
tabs,
textField,
toolbar,
topAppBar
};

View File

@@ -1,6 +1,6 @@
// Type definitions for Material Components Web 0.26
// Type definitions for Material Components Web 0.35
// Project: https://material.io/components/
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>, Collin Kostichuk <https://github.com/ckosti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6

View File

@@ -1,6 +1,6 @@
// Type definitions for Material Components Web 0.26
// Type definitions for Material Components Web 0.35
// Project: https://material.io/components/
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>, Collin Kostichuk <https://github.com/ckosti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -32,6 +32,8 @@ export interface MDCAutoInit {
/**
* Auto-initializes all mdc components on a page.
*/
// tslint:disable-next-line:strict-export-declare-modifiers
declare const mdcAutoInit: MDCAutoInit;
// tslint:disable-next-line:strict-export-declare-modifiers
export default mdcAutoInit;

View File

@@ -6,7 +6,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,7 +17,7 @@
import MDCFoundation from './foundation';
export class MDCComponent<A, F extends MDCFoundation<A>> {
export default class MDCComponent<A, F extends MDCFoundation<A>> {
static attachTo(root: Element): MDCComponent<any, MDCFoundation<any>>;
constructor(root: Element, foundation?: F, ...args: any[]);
@@ -45,13 +45,13 @@ export class MDCComponent<A, F extends MDCFoundation<A>> {
* Wrapper method to add an event listener to the component's root element. This is most useful when
* listening for custom events.
*/
listen(evtType: string, handler: EventListenerOrEventListenerObject): void;
listen(evtType: string, handler: EventListener): void;
/**
* Wrapper method to remove an event listener to the component's root element. This is most useful when
* unlistening for custom events.
*/
unlisten(evtType: string, handler: EventListenerOrEventListenerObject): void;
unlisten(evtType: string, handler: EventListener): void;
/**
* Fires a cross-browser-compatible custom event from the component root of the given type,
@@ -59,5 +59,3 @@ export class MDCComponent<A, F extends MDCFoundation<A>> {
*/
emit(evtType: string, evtData: any, shouldBubble?: boolean): void;
}
export default MDCComponent;

View File

@@ -23,7 +23,7 @@ export interface MDCNumbers {
[key: string]: number;
}
export class MDCFoundation<A> {
export default class MDCFoundation<A> {
static readonly cssClasses: MDCStrings;
static readonly strings: MDCStrings;
@@ -40,5 +40,3 @@ export class MDCFoundation<A> {
// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.)
destroy(): void;
}
export default MDCFoundation;

View File

@@ -1,6 +1,6 @@
// Type definitions for Material Components Web 0.26
// Type definitions for Material Components Web 0.35
// Project: https://material.io/components/
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>, Collin Kostichuk <https://github.com/ckosti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -21,7 +21,7 @@
* limitations under the License.
*/
import { MDCNumbers, MDCStrings, MDCFoundation } from './foundation';
import MDCFoundation, { MDCNumbers, MDCStrings } from './foundation';
import MDCComponent from './component';
export {MDCNumbers, MDCStrings, MDCFoundation, MDCComponent};

View File

@@ -6,7 +6,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -29,13 +29,17 @@ import { MDCSelectionControlState } from 'material__selection-control';
* Implement this adapter for your framework of choice to delegate updates to
* the component in your framework of choice. See architecture documentation
* for more details.
* https://github.com/material-components/material-components-web/blob/master/docs/architecture.md
* https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md
*/
export class MDCCheckboxAdapter {
export default interface MDCCheckboxAdapter {
addClass(className: string): void;
removeClass(className: string): void;
setNativeControlAttr(attr: string, value: string): void;
removeNativeControlAttr(attr: string): void;
registerAnimationEndHandler(handler: EventListener): void;
deregisterAnimationEndHandler(handler: EventListener): void;
@@ -50,5 +54,3 @@ export class MDCCheckboxAdapter {
isAttachedToDOM(): boolean;
}
export default MDCCheckboxAdapter;

View File

@@ -6,7 +6,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MDCStrings, MDCNumbers } from 'material__base';
import { MDCStrings, MDCNumbers } from 'material__base';
export interface cssClasses extends MDCStrings {
UPGRADED: 'mdc-checkbox--upgraded';
@@ -35,8 +35,10 @@ export interface strings extends MDCStrings {
TRANSITION_STATE_CHECKED: 'checked';
TRANSITION_STATE_UNCHECKED: 'unchecked';
TRANSITION_STATE_INDETERMINATE: 'indeterminate';
ARIA_CHECKED_ATTR: 'aria-checked';
ARIA_CHECKED_INDETERMINATE_VALUE: 'mixed';
}
export interface numbers extends MDCNumbers {
ANIM_END_LATCH_MS: 100;
ANIM_END_LATCH_MS: 250;
}

View File

@@ -19,7 +19,7 @@ import MDCFoundation from 'material__base/foundation';
import MDCCheckboxAdapter from './adapter';
import { cssClasses, strings, numbers } from './constants';
export class MDCCheckboxFoundation extends MDCFoundation<MDCCheckboxAdapter> {
export default class MDCCheckboxFoundation extends MDCFoundation<MDCCheckboxAdapter> {
static readonly cssClasses: cssClasses;
static readonly strings: strings;
@@ -30,7 +30,7 @@ export class MDCCheckboxFoundation extends MDCFoundation<MDCCheckboxAdapter> {
isChecked(): boolean;
setChecked(checked: boolean): boolean;
setChecked(checked: boolean): void;
isIndeterminate(): boolean;
@@ -43,6 +43,8 @@ export class MDCCheckboxFoundation extends MDCFoundation<MDCCheckboxAdapter> {
getValue(): string;
setValue(value: string): void;
}
export default MDCCheckboxFoundation;
handleAnimationEnd(): void;
handleChange(): void;
}

View File

@@ -1,6 +1,6 @@
// Type definitions for Material Components Web 0.26
// Type definitions for Material Components Web 0.35
// Project: https://material.io/components/
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>, Collin Kostichuk <https://github.com/ckosti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -32,8 +32,6 @@ export {MDCCheckboxAdapter, MDCCheckboxFoundation};
export class MDCCheckbox extends MDCComponent<MDCCheckboxAdapter, MDCCheckboxFoundation> implements MDCSelectionControl {
static attachTo(root: Element): MDCCheckbox;
getDefaultFoundation(): MDCCheckboxFoundation;
readonly ripple: MDCRipple;
checked: boolean;
@@ -43,6 +41,4 @@ export class MDCCheckbox extends MDCComponent<MDCCheckboxAdapter, MDCCheckboxFou
disabled: boolean;
value: string;
destroy(): void;
}

View File

@@ -0,0 +1,50 @@
/**
* @license
* Copyright 2017 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Adapter for MDC Chip Set.
*
* Defines the shape of the adapter expected by the foundation. Implement this
* adapter to integrate the Chip Set into your framework. See
* https://github.com/material-components/material-components-web/blob/master/docs/authoring-components.md
* for more information.
*
*/
import { MDCChip } from '../chip';
export default interface MDCChipSetAdapter {
/**
* Returns true if the root element contains the given class name.
*/
hasClass(className: string): boolean;
/**
* Registers an event handler on the root element for a given event.
*/
registerInteractionHandler(evtType: string, handler: EventListener): void;
/**
* Deregisters an event handler on the root element for a given event.
*/
deregisterInteractionHandler(evtType: string, handler: EventListener): void;
/**
* Appends and returns a new chip element with the given text, leading icon, and trailing icon.
*/
appendChip(text: string, leadingIcon?: Element | null, trailingIcon?: Element | null): Element;
/**
* Removes the chip object from the chip set.
*/
removeChip(chip: MDCChip): void;
}

View File

@@ -1,6 +1,6 @@
/**
* @license
* Copyright 2017 Google Inc. All Rights Reserved.
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,13 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MDCStrings } from 'material__base';
export interface strings extends MDCStrings {
ANIMATION_END_EVENT: 'MDCTextFieldBottomLine:animation-end';
CHIP_SELECTOR: '.mdc-chip';
}
export interface cssClasses extends MDCStrings {
BOTTOM_LINE_ACTIVE: 'mdc-text-field__bottom-line--active';
CHOICE: 'mdc-chip-set--choice';
FILTER: 'mdc-chip-set--filter';
}

View File

@@ -0,0 +1,44 @@
/**
* @license
* Copyright 2017 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import MDCFoundation from 'material__base/foundation';
import MDCChipFoundation from './foundation';
import MDCChipSetAdapter from './adapter';
import { strings, cssClasses } from './constants';
export default class MDCChipSetFoundation extends MDCFoundation<MDCChipSetAdapter> {
static readonly strings: strings;
static readonly cssClasses: cssClasses;
static readonly defaultAdapter: MDCChipSetAdapter;
/**
* Returns a new chip element with the given text, leading icon, and trailing icon,
* added to the root chip set element.
*/
addChip(text: string, leadingIcon?: Element | null, trailingIcon?: Element | null): Element;
/**
* Selects the given chip. Deselects all other chips if the chip set is of the choice variant.
*/
select(chipFoundation: MDCChipFoundation): void;
/**
* Deselects the given chip.
*/
deselect(chipFoundation: MDCChipFoundation): void;
}

View File

@@ -0,0 +1,35 @@
/**
* @license
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import MDCComponent from 'material__base/component';
import MDCChipSetFoundation from './foundation';
import MDCChipSetAdapter from './adapter';
import { MDCChip } from '../chip';
export { MDCChipSetFoundation, MDCChipSetAdapter };
export class MDCChipSet extends MDCComponent<MDCChipSetAdapter, MDCChipSetFoundation> {
static attachTo(root: any): MDCChipSet;
initialize(chipFactory?: (el: Element) => MDCChip): void;
initialSyncWithDOM(): void;
/**
* Creates a new chip in the chip set with the given text, leading icon, and trailing icon.
*/
addChip(text: string, leadingIcon?: Element | null, trailingIcon?: Element | null): void;
}

77
types/material__chips/chip/adapter.d.ts vendored Normal file
View File

@@ -0,0 +1,77 @@
/**
* @license
* Copyright 2017 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Adapter for MDC Chip.
*
* Defines the shape of the adapter expected by the foundation. Implement this
* adapter to integrate the Chip into your framework. See
* https://github.com/material-components/material-components-web/blob/master/docs/authoring-components.md
* for more information.
*/
export default interface MDCChipAdapter {
addClass(className: string): void;
removeClass(className: string): void;
hasClass(className: string): boolean;
addClassToLeadingIcon(className: string): void;
removeClassFromLeadingIcon(className: string): void;
/**
* Returns true if target has className, false otherwise.
*/
eventTargetHasClass(target: EventTarget, className: string): boolean;
/**
* Registers an event listener on the root element for a given event.
*/
registerEventHandler(evtType: string, handler: EventListener): void;
/**
* Deregisters an event listener on the root element for a given event.
*/
deregisterEventHandler(evtType: string, handler: EventListener): void;
/**
* Registers an event listener on the trailing icon element for a given event.
*/
registerTrailingIconInteractionHandler(evtType: string, handler: EventListener): void;
/**
* Deregisters an event listener on the trailing icon element for a given event.
*/
deregisterTrailingIconInteractionHandler(evtType: string, handler: EventListener): void;
/**
* Emits a custom "MDCChip:interaction" event denoting the chip has been
* interacted with (typically on click or keydown).
*/
notifyInteraction(): void;
/**
* Emits a custom "MDCChip:trailingIconInteraction" event denoting the trailing icon has been
* interacted with (typically on click or keydown).
*/
notifyTrailingIconInteraction(): void;
/**
* Emits a custom event "MDCChip:removal" denoting the chip will be removed.
*/
notifyRemoval(): void;
/**
* Returns the computed property value of the given style property on the root element.
*/
getComputedStyleValue(propertyName: string): string;
/**
* Sets the property value of the given style property on the root element.
*/
setStyleProperty(propertyName: string, value: string): void;
}

View File

@@ -0,0 +1,38 @@
/**
* @license
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MDCStrings } from 'material__base';
export interface strings extends MDCStrings {
ENTRY_ANIMATION_NAME: 'mdc-chip-entry';
INTERACTION_EVENT: 'MDCChip:interaction';
TRAILING_ICON_INTERACTION_EVENT: 'MDCChip:trailingIconInteraction';
REMOVAL_EVENT: 'MDCChip:removal';
CHECKMARK_SELECTOR: '.mdc-chip__checkmark';
LEADING_ICON_SELECTOR: '.mdc-chip__icon--leading';
TRAILING_ICON_SELECTOR: '.mdc-chip__icon--trailing';
}
export interface cssClasses extends MDCStrings {
CHECKMARK: 'mdc-chip__checkmark';
CHIP: 'mdc-chip';
CHIP_EXIT: 'mdc-chip--exit';
HIDDEN_LEADING_ICON: 'mdc-chip__icon--leading-hidden';
LEADING_ICON: 'mdc-chip__icon--leading';
TRAILING_ICON: 'mdc-chip__icon--trailing';
SELECTED: 'mdc-chip--selected';
TEXT: 'mdc-chip__text';
}

View File

@@ -0,0 +1,32 @@
/**
* @license
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import MDCFoundation from 'material__base/foundation';
import MDCChipAdapter from './adapter';
import { cssClasses, strings } from './constants';
export default class MDCChipFoundation extends MDCFoundation<MDCChipAdapter> {
static readonly strings: strings;
static readonly cssClasses: cssClasses;
static readonly defaultAdapter: MDCChipAdapter;
isSelected(): boolean;
setSelected(selected: boolean): void;
}

39
types/material__chips/chip/index.d.ts vendored Normal file
View File

@@ -0,0 +1,39 @@
/**
* @license
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import MDCComponent from 'material__base/component';
import MDCChipFoundation from './foundation';
import MDCChipAdapter from './adapter';
import { MDCRipple } from 'material__ripple';
export { MDCChipFoundation, MDCChipAdapter };
export class MDCChip extends MDCComponent<MDCChipAdapter, MDCChipFoundation> {
static attachTo(root: Element): MDCChip;
/**
* Returns true if the chip is selected.
*/
isSelected(): boolean;
/**
* Destroys the chip and removes the root element from the DOM.
*/
remove(): void;
readonly foundation: MDCChipFoundation;
readonly ripple: MDCRipple;
}

24
types/material__chips/index.d.ts vendored Normal file
View File

@@ -0,0 +1,24 @@
// Type definitions for Material Components Web 0.35
// Project: https://material.io/components/
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>, Collin Kostichuk <https://github.com/ckosti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
/**
* Copyright 2017 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MDCChipFoundation, MDCChip, MDCChipAdapter } from './chip';
import { MDCChipSetFoundation, MDCChipSet, MDCChipSetAdapter } from './chip-set';
export { MDCChipFoundation, MDCChip, MDCChipAdapter, MDCChipSetFoundation, MDCChipSet, MDCChipSetAdapter };

View File

@@ -0,0 +1,32 @@
{
"files": [
"chip/adapter.d.ts",
"chip/constants.d.ts",
"chip/foundation.d.ts",
"chip/index.d.ts",
"chip-set/adapter.d.ts",
"chip-set/constants.d.ts",
"chip-set/foundation.d.ts",
"chip-set/index.d.ts",
"index.d.ts"
],
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
}
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
export interface MSDDialogAdapter {
export default interface MDCDialogAdapter {
addClass(className: string): void;
removeClass(className: string): void;
@@ -50,6 +50,4 @@ export interface MSDDialogAdapter {
untrapFocusOnSurface(): void;
isDialog(el: Element): boolean;
layoutFooterRipples(): void;
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
import { MDCStrings } from 'material__base';
import { MDCStrings } from 'material__base';
export interface cssClasses extends MDCStrings {
ROOT: 'mdc-dialog';

View File

@@ -16,14 +16,14 @@
import { MDCFoundation } from 'material__base';
import { cssClasses, strings } from './constants';
import { MSDDialogAdapter } from './adapter';
import MDCDialogAdapter from './adapter';
export class MDCDialogFoundation extends MDCFoundation<MSDDialogAdapter> {
export default class MDCDialogFoundation extends MDCFoundation<MDCDialogAdapter> {
static readonly cssClasses: cssClasses;
static readonly strings: strings;
static readonly defaultAdapter: MSDDialogAdapter;
static readonly defaultAdapter: MDCDialogAdapter;
open(): void;
@@ -35,5 +35,3 @@ export class MDCDialogFoundation extends MDCFoundation<MSDDialogAdapter> {
cancel(shouldNotify: boolean): void;
}
export default MDCDialogFoundation;

View File

@@ -1,6 +1,6 @@
// Type definitions for Material Components Web 0.26
// Type definitions for Material Components Web 0.35
// Project: https://material.io/components/
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>, Collin Kostichuk <https://github.com/ckosti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -21,26 +21,17 @@
*/
import { MDCComponent } from 'material__base';
import { MDCRipple } from 'material__ripple';
import MDCDialogFoundation from './foundation';
import { MSDDialogAdapter } from './adapter';
import MDCDialogAdapter from './adapter';
import * as util from './util';
export {MSDDialogAdapter, MDCDialogFoundation, util};
export {MDCDialogAdapter, MDCDialogFoundation, util};
export class MDCDialog extends MDCComponent<MSDDialogAdapter, MDCDialogFoundation> {
export class MDCDialog extends MDCComponent<MDCDialogAdapter, MDCDialogFoundation> {
static attachTo(root: Element): MDCDialog;
readonly open: boolean;
initialize(): void;
destroy(): void;
show(): void;
close(): void;
getDefaultFoundation(): MDCDialogFoundation;
}

View File

@@ -1,6 +1,6 @@
// Type definitions for Material Components Web 0.26
// Type definitions for Material Components Web 0.35
// Project: https://material.io/components/
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>, Collin Kostichuk <https://github.com/ckosti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -21,7 +21,7 @@
*/
import * as util from './util';
export {MDCSlidableDrawerAdapter} from './slidable';
export {MDCTemporaryDrawer, MDCTemporaryDrawerFoundation} from './temporary';
export {MDCPersistentDrawer, MDCPersistentDrawerFoundation} from './persistent';
export {util};
export { MDCSlidableDrawerAdapter } from './slidable';
export { MDCTemporaryDrawer, MDCTemporaryDrawerFoundation } from './temporary';
export { MDCPersistentDrawer, MDCPersistentDrawerFoundation } from './persistent';
export { util };

View File

@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,13 +17,13 @@
import { MDCStrings } from 'material__base';
export interface cssClasses extends MDCStrings {
ROOT: 'mdc-persistent-drawer';
OPEN: 'mdc-persistent-drawer--open';
ANIMATING: 'mdc-persistent-drawer--animating';
ROOT: 'mdc-drawer--persistent';
OPEN: 'mdc-drawer--open';
ANIMATING: 'mdc-drawer--animating';
}
export interface strings extends MDCStrings {
DRAWER_SELECTOR: '.mdc-persistent-drawer__drawer';
DRAWER_SELECTOR: '.mdc-drawer--persistent .mdc-drawer__drawer';
FOCUSABLE_ELEMENTS: 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [tabindex], [contenteditable]';
OPEN_EVENT: 'MDCPersistentDrawer:open';
CLOSE_EVENT: 'MDCPersistentDrawer:close';

View File

@@ -17,12 +17,10 @@
import { MDCSlidableDrawerAdapter, MDCSlidableDrawerFoundation } from '../slidable';
import { cssClasses, strings } from './constants';
export class MDCPersistentDrawerFoundation extends MDCSlidableDrawerFoundation {
export default class MDCPersistentDrawerFoundation extends MDCSlidableDrawerFoundation {
static readonly cssClasses: cssClasses;
static readonly strings: strings;
static readonly defaultAdapter: MDCSlidableDrawerAdapter;
}
export default MDCPersistentDrawerFoundation;

View File

@@ -15,7 +15,7 @@
*/
import { MDCComponent } from 'material__base';
import { MDCPersistentDrawerFoundation } from './foundation';
import MDCPersistentDrawerFoundation from './foundation';
import { MDCSlidableDrawerAdapter } from '../slidable';
import * as util from '../util';
@@ -28,6 +28,4 @@ export class MDCPersistentDrawer extends MDCComponent<MDCSlidableDrawerAdapter,
// Return the drawer element inside the component.
readonly drawer: Element | null;
getDefaultFoundation(): MDCPersistentDrawerFoundation;
}

View File

@@ -14,6 +14,6 @@
* limitations under the License.
*/
export {FOCUSABLE_ELEMENTS} from './constants';
export {MDCSlidableDrawerFoundation} from './foundation';
export {MDCSlidableDrawerAdapter} from './adapter';
export { FOCUSABLE_ELEMENTS } from './constants';
export { MDCSlidableDrawerFoundation } from './foundation';
export { MDCSlidableDrawerAdapter } from './adapter';

View File

@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,14 +17,14 @@
import { MDCStrings } from 'material__base';
export interface cssClasses extends MDCStrings {
ROOT: 'mdc-temporary-drawer';
OPEN: 'mdc-temporary-drawer--open';
ANIMATING: 'mdc-temporary-drawer--animating';
ROOT: 'mdc-drawer--temporary';
OPEN: 'mdc-drawer--open';
ANIMATING: 'mdc-drawer--animating';
SCROLL_LOCK: 'mdc-drawer-scroll-lock';
}
export interface strings extends MDCStrings {
DRAWER_SELECTOR: '.mdc-temporary-drawer__drawer';
DRAWER_SELECTOR: '.mdc-drawer--temporary .mdc-drawer__drawer';
OPACITY_VAR_NAME: '--mdc-temporary-drawer-opacity';
FOCUSABLE_ELEMENTS: 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [tabindex], [contenteditable]';
OPEN_EVENT: 'MDCTemporaryDrawer:open';

View File

@@ -17,7 +17,7 @@
import { MDCSlidableDrawerFoundation, MDCSlidableDrawerAdapter } from '../slidable';
import { cssClasses, strings } from './constants';
export class MDCTemporaryDrawerFoundation extends MDCSlidableDrawerFoundation {
export default class MDCTemporaryDrawerFoundation extends MDCSlidableDrawerFoundation {
static readonly cssClasses: cssClasses;
static readonly strings: strings;
@@ -28,5 +28,3 @@ export class MDCTemporaryDrawerFoundation extends MDCSlidableDrawerFoundation {
close(): void;
}
export default MDCTemporaryDrawerFoundation;

View File

@@ -28,6 +28,4 @@ export class MDCTemporaryDrawer extends MDCComponent<MDCSlidableDrawerAdapter, M
/* Return the drawer element inside the component. */
readonly drawer: Element | null;
getDefaultFoundation(): MDCTemporaryDrawerFoundation;
}

View File

@@ -24,10 +24,12 @@ export function getTransformPropertyName(globalObj?: Window, forceRefresh?: bool
export function supportsCssCustomProperties(globalObj?: Window): boolean;
// Determine whether the current browser supports passive event listeners, and if so, use them.
export function applyPassive(globalObj?: Window, forceRefresh?: boolean): boolean;
export function applyPassive(globalObj?: Window, forceRefresh?: boolean): boolean | { passive: boolean; };
// Save the tab state for an element.
// tslint:disable-next-line:void-return
export function saveElementTabState(el: Element): void;
// Restore the tab state for an element, if it was saved.
// tslint:disable-next-line:void-return
export function restoreElementTabState(el: Element): void;

View File

@@ -0,0 +1,51 @@
/**
* @license
* Copyright 2017 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Adapter for MDC Floating Label.
*
* Defines the shape of the adapter expected by the foundation. Implement this
* adapter to integrate the floating label into your framework. See
* https://github.com/material-components/material-components-web/blob/master/docs/authoring-components.md
* for more information.
*/
export default interface MDCFloatingLabelAdapter {
/**
* Adds a class to the label element.
*/
addClass(className: string): void;
/**
* Removes a class from the label element.
*/
removeClass(className: string): void;
/**
* Returns the width of the label element.
*/
getWidth(): number;
/**
* Registers an event listener on the root element for a given event.
*/
registerInteractionHandler(evtType: string, handler: EventListener): void;
/**
* Deregisters an event listener on the root element for a given event.
*/
deregisterInteractionHandler(evtType: string, handler: EventListener): void;
}

View File

@@ -0,0 +1,23 @@
/**
* @license
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MDCStrings } from 'material__base';
export interface cssClasses extends MDCStrings {
LABEL_FLOAT_ABOVE: 'mdc-floating-label--float-above';
LABEL_SHAKE: 'mdc-floating-label--shake';
}

View File

@@ -0,0 +1,40 @@
/**
* @license
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import MDCFoundation from 'material__base/foundation';
import MDCFloatingLabelAdapter from './adapter';
import { cssClasses } from './constants';
export default class MDCFloatingLabelFoundation extends MDCFoundation<MDCFloatingLabelAdapter> {
static readonly cssClasses: cssClasses;
static readonly defaultAdapter: MDCFloatingLabelAdapter;
/**
* Returns the width of the label element.
*/
getWidth(): number;
/**
* Styles the label to produce the label shake for errors.
*/
shake(shouldShake: boolean): void;
/**
* Styles the label to float or dock.
*/
float(shouldFloat: boolean): void;
}

View File

@@ -0,0 +1,48 @@
// Type definitions for Material Components Web 0.35
// Project: https://material.io/components/
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>, Collin Kostichuk <https://github.com/ckosti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
/**
* @license
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import MDCComponent from 'material__base/component';
import MDCFloatingLabelFoundation from './foundation';
import MDCFloatingLabelAdapter from './adapter';
export { MDCFloatingLabelFoundation, MDCFloatingLabelAdapter };
export class MDCFloatingLabel extends MDCComponent<MDCFloatingLabelAdapter, MDCFloatingLabelFoundation> {
static attachTo(root: Element): MDCFloatingLabel;
/**
* Styles the label to produce the label shake for errors.
* @param shouldShake styles the label to shake by adding shake class
* if true, otherwise will stop shaking by removing shake class.
*/
shake(shouldShake: boolean): void;
/**
* Styles label to float/dock.
* @param shouldFloat styles the label to float by adding float class
* if true, otherwise docks the label by removing the float class.
*/
float(shouldFloat: boolean): void;
getWidth(): number;
}

View File

@@ -0,0 +1,27 @@
{
"files": [
"constants.d.ts",
"adapter.d.ts",
"index.d.ts",
"foundation.d.ts"
],
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
}
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -26,11 +26,9 @@
* Implement this adapter for your framework of choice to delegate updates to
* the component in your framework of choice. See architecture documentation
* for more details.
* https://github.com/material-components/material-components-web/blob/master/docs/architecture.md
*
* @record
* https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md
*/
export class MDCFormFieldAdapter {
export default interface MDCFormFieldAdapter {
registerInteractionHandler(type: string, handler: EventListener): void;
deregisterInteractionHandler(type: string, handler: EventListener): void;
@@ -39,5 +37,3 @@ export class MDCFormFieldAdapter {
deactivateInputRipple(): void;
}
export default MDCFormFieldAdapter;

View File

@@ -18,7 +18,7 @@
import { MDCStrings } from 'material__base';
export interface cssClasses extends MDCStrings {
ROOT: 'mdc-form-field';
ROOT: 'mdc-form-field';
}
export interface strings extends MDCStrings {

View File

@@ -19,12 +19,10 @@ import MDCFoundation from 'material__base/foundation';
import MDCFormFieldAdapter from './adapter';
import { cssClasses, strings } from './constants';
export class MDCFormFieldFoundation extends MDCFoundation<MDCFormFieldAdapter> {
export default class MDCFormFieldFoundation extends MDCFoundation<MDCFormFieldAdapter> {
static readonly cssClasses: cssClasses;
static readonly strings: strings;
static readonly defaultAdapter: MDCFormFieldAdapter;
}
export default MDCFormFieldFoundation;

View File

@@ -1,6 +1,6 @@
// Type definitions for Material Components Web 0.26
// Type definitions for Material Components Web 0.35
// Project: https://material.io/components/
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>, Collin Kostichuk <https://github.com/ckosti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -32,6 +32,4 @@ export class MDCFormField extends MDCComponent<MDCFormFieldAdapter, MDCFormField
static attachTo(root: Element): MDCFormField;
input: MDCSelectionControl;
getDefaultFoundation(): MDCFormFieldFoundation;
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
export interface MDCGridListAdapter {
export default interface MDCGridListAdapter {
getOffsetWidth(): number;
getNumberOfTiles(): number;

View File

@@ -16,14 +16,12 @@
import { MDCFoundation } from 'material__base';
import { strings } from './constants';
import { MDCGridListAdapter } from './adapter';
import MDCGridListAdapter from './adapter';
export class MDCGridListFoundation extends MDCFoundation<MDCGridListAdapter> {
export default class MDCGridListFoundation extends MDCFoundation<MDCGridListAdapter> {
static readonly strings: strings;
static readonly defaultAdapter: MDCGridListAdapter;
alignCenter(): void;
}
export default MDCGridListFoundation;

View File

@@ -1,6 +1,6 @@
// Type definitions for Material Components Web 0.26
// Type definitions for Material Components Web 0.35
// Project: https://material.io/components/
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>, Collin Kostichuk <https://github.com/ckosti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -21,13 +21,11 @@
*/
import { MDCComponent } from 'material__base';
import { MDCGridListAdapter } from './adapter';
import MDCGridListAdapter from './adapter';
import MDCGridListFoundation from './foundation';
export {MDCGridListAdapter, MDCGridListFoundation};
export { MDCGridListAdapter, MDCGridListFoundation };
export class MDCGridList extends MDCComponent<MDCGridListAdapter, MDCGridListFoundation> {
static attachTo(root: Element): MDCGridList;
getDefaultFoundation(): MDCGridListFoundation;
static attachTo(root: Element): MDCGridList;
}

View File

@@ -29,33 +29,30 @@
* Implement this adapter for your framework of choice to delegate updates to
* the component in your framework of choice. See architecture documentation
* for more details.
* https://github.com/material-components/material-components-web/blob/master/docs/architecture.md
*
* @record
* https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md
*/
export default interface MDCIconToggleAdapter {
addClass(className: string): void;
export class MDCIconToggleAdapter {
addClass(className: string): void;
removeClass(className: string): void;
removeClass(className: string): void;
registerInteractionHandler(type: string, handler: EventListener): void;
registerInteractionHandler(type: string, handler: EventListener): void;
deregisterInteractionHandler(type: string, handler: EventListener): void;
deregisterInteractionHandler(type: string, handler: EventListener): void;
setText(text: string): void;
setText(text: string): void;
getTabIndex(): number;
getTabIndex(): number;
setTabIndex(tabIndex: number): void;
setTabIndex(tabIndex: number): void;
getAttr(name: string): string;
getAttr(name: string): string;
setAttr(name: string, value: string): void;
setAttr(name: string, value: string): void;
rmAttr(name: string): void;
rmAttr(name: string): void;
notifyChange(evtData: IconToggleEvent): void;
notifyChange(evtData: IconToggleEvent): void;
}
export interface IconToggleEvent {

View File

@@ -16,10 +16,10 @@
*/
import MDCFoundation from 'material__base/foundation';
import { MDCIconToggleAdapter, IconToggleEvent } from './adapter';
import MDCIconToggleAdapter from './adapter';
import { cssClasses, strings } from './constants';
export class MDCIconToggleFoundation extends MDCFoundation<MDCIconToggleAdapter> {
export default class MDCIconToggleFoundation extends MDCFoundation<MDCIconToggleAdapter> {
static readonly cssClasses: cssClasses;
static readonly strings: strings;
@@ -38,27 +38,3 @@ export class MDCIconToggleFoundation extends MDCFoundation<MDCIconToggleAdapter>
isKeyboardActivated(): boolean;
}
export interface KeyboardKey {
key: string;
keyCode: number;
}
export function isSpace(keyboardKey: KeyboardKey): boolean;
export class IconToggleState {
/**
* The aria-label value of the icon toggle, or undefined if there is no aria-label.
*/
label: string|undefined;
/**
* The text for the icon toggle, or undefined if there is no text.
*/
content: string|undefined;
/**
* The CSS class to add to the icon toggle, or undefined if there is no CSS class.
*/
cssClass: string|undefined;
}
export default MDCIconToggleFoundation;

View File

@@ -1,6 +1,6 @@
// Type definitions for Material Components Web 0.26
// Type definitions for Material Components Web 0.35
// Project: https://material.io/components/
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>, Collin Kostichuk <https://github.com/ckosti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -23,18 +23,14 @@
import MDCComponent from 'material__base/component';
import MDCIconToggleFoundation from './foundation';
import { MDCIconToggleAdapter } from './adapter';
import { MDCRipple, MDCRippleFoundation } from 'material__ripple';
import MDCIconToggleAdapter from './adapter';
import { MDCRipple } from 'material__ripple';
export {MDCIconToggleAdapter, MDCIconToggleFoundation};
export class MDCIconToggle extends MDCComponent<MDCIconToggleAdapter, MDCIconToggleFoundation> {
static attachTo(root: Element): MDCIconToggle;
destroy(): void;
getDefaultFoundation(): MDCIconToggleFoundation;
initialSyncWithDOM(): void;
readonly ripple: MDCRipple;

View File

@@ -0,0 +1,53 @@
/**
* @license
* Copyright 2018 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Adapter for MDC TextField Line Ripple.
*
* Defines the shape of the adapter expected by the foundation. Implement this
* adapter to integrate the line ripple into your framework. See
* https://github.com/material-components/material-components-web/blob/master/docs/authoring-components.md
* for more information.
*/
export default interface MDCLineRippleAdapter {
/**
* Adds a class to the line ripple element.
*/
addClass(className: string): void;
/**
* Removes a class from the line ripple element.
*/
removeClass(className: string): void;
hasClass(className: string): boolean;
/**
* Sets the style property with propertyName to value on the root element.
*/
setStyle(propertyName: string, value: string): void;
/**
* Registers an event listener on the line ripple element for a given event.
*/
registerEventHandler(evtType: string, handler: EventListener): void;
/**
* Deregisters an event listener on the line ripple element for a given event.
*/
deregisterEventHandler(evtType: string, handler: EventListener): void;
}

View File

@@ -0,0 +1,23 @@
/**
* @license
* Copyright 2018 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MDCStrings } from 'material__base';
export interface cssClasses extends MDCStrings {
LINE_RIPPLE_ACTIVE: 'mdc-line-ripple--active';
LINE_RIPPLE_DEACTIVATING: 'mdc-line-ripple--deactivating';
}

View File

@@ -0,0 +1,45 @@
/**
* @license
* Copyright 2018 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import MDCFoundation from 'material__base/foundation';
import { cssClasses } from './constants';
import MDCLineRippleAdapter from './adapter';
export default class MDCLineRippleFoundation extends MDCFoundation<MDCLineRippleAdapter> {
static readonly cssClasses: cssClasses;
static readonly defaultAdapter: MDCLineRippleAdapter;
/**
* Activates the line ripple
*/
activate(): void;
/**
* Sets the center of the ripple animation to the given X coordinate.
*/
setRippleCenter(xCoordinate: number): void;
/**
* Deactivates the line ripple
*/
deactivate(): void;
/**
* Handles a transition end event
*/
handleTransitionEnd(evt: Event): void;
}

47
types/material__line-ripple/index.d.ts vendored Normal file
View File

@@ -0,0 +1,47 @@
// Type definitions for Material Components Web 0.35
// Project: https://material.io/components/
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>, Collin Kostichuk <https://github.com/ckosti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
/**
* @license
* Copyright 2018 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import MDCComponent from 'material__base/component';
import MDCLineRippleFoundation from './foundation';
import MDCLineRippleAdapter from './adapter';
export { MDCLineRippleFoundation, MDCLineRippleAdapter };
export class MDCLineRipple extends MDCComponent<MDCLineRippleAdapter, MDCLineRippleFoundation> {
static attachTo(root: Element): MDCLineRipple;
/**
* Activates the line ripple
*/
activate(): void;
/**
* Deactivates the line ripple
*/
deactivate(): void;
/**
* Sets the transform origin given a user's click location. The `rippleCenter` is the
* x-coordinate of the middle of the ripple.
*/
setRippleCenter(xCoordinate: number): void;
}

View File

@@ -0,0 +1,27 @@
{
"files": [
"constants.d.ts",
"adapter.d.ts",
"index.d.ts",
"foundation.d.ts"
],
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
}
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
export interface MDCLinearProgressAdapter {
export default interface MDCLinearProgressAdapter {
addClass(className: string): void;
getPrimaryBar(): Element;

View File

@@ -14,12 +14,11 @@
* limitations under the License.
*/
import { MDCFoundation } from 'material__base';
import { transformStyleProperties } from 'material__animation';
import { MDCLinearProgressAdapter } from './adapter';
import MDCFoundation from 'material__base/foundation';
import MDCLinearProgressAdapter from './adapter';
import { cssClasses, strings } from './constants';
export class MDCLinearProgressFoundation extends MDCFoundation<MDCLinearProgressAdapter> {
export default class MDCLinearProgressFoundation extends MDCFoundation<MDCLinearProgressAdapter> {
static readonly cssClasses: cssClasses;
static readonly strings: strings;

View File

@@ -1,6 +1,6 @@
// Type definitions for Material Components Web 0.26
// Type definitions for Material Components Web 0.35
// Project: https://material.io/components/
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>, Collin Kostichuk <https://github.com/ckosti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -21,10 +21,10 @@
*/
import { MDCComponent } from 'material__base';
import { MDCLinearProgressAdapter } from './adapter';
import { MDCLinearProgressFoundation } from './foundation';
import MDCLinearProgressAdapter from './adapter';
import MDCLinearProgressFoundation from './foundation';
export {MDCLinearProgressAdapter, MDCLinearProgressFoundation};
export { MDCLinearProgressAdapter, MDCLinearProgressFoundation };
export class MDCLinearProgress extends MDCComponent<MDCLinearProgressAdapter, MDCLinearProgressFoundation> {
static attachTo(root: Element): MDCLinearProgress;
@@ -40,6 +40,4 @@ export class MDCLinearProgress extends MDCComponent<MDCLinearProgressAdapter, MD
open(): void;
close(): void;
getDefaultFoundation(): MDCLinearProgressFoundation;
}

View File

@@ -14,9 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Adapter for MDC Simple Menu. Provides an interface for managing
* Adapter for MDC Menu. Provides an interface for managing
* - classes
* - dom
* - focus
@@ -30,11 +29,10 @@
* Implement this adapter for your framework of choice to delegate updates to
* the component in your framework of choice. See architecture documentation
* for more details.
* https://github.com/material-components/material-components-web/blob/master/docs/architecture.md
*
* @record
* https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md
*/
export default class MDCSimpleMenuAdapter {
export default interface MDCMenuAdapter {
addClass(className: string): void;
removeClass(className: string): void;
@@ -45,17 +43,13 @@ export default class MDCSimpleMenuAdapter {
getAttributeForEventTarget(target: EventTarget, attributeName: string): string;
getInnerDimensions(): {width: number, height: number};
getInnerDimensions(): { width: number; height: number; };
hasAnchor(): boolean;
getAnchorDimensions(): {width: number, height: number, top: number, right: number, bottom: number, left: number};
getAnchorDimensions(): { width: number; height: number; top: number; right: number; bottom: number; left: number; };
getWindowDimensions(): {width: number, height: number};
setScale(x: number, y: number): void;
setInnerScale(x: number, y: number): void;
getWindowDimensions(): { width: number; height: number; };
getNumberOfItems(): number;
@@ -67,13 +61,9 @@ export default class MDCSimpleMenuAdapter {
deregisterBodyClickHandler(handler: EventListener): void;
getYParamsForItemAtIndex(index: number): {top: number, height: number};
setTransitionDelayForItemAtIndex(index: number, value: string|null): void;
getIndexForEventTarget(target: EventTarget): number;
notifySelected(evtData: {index: number}): void;
notifySelected(evtData: { index: number; }): void;
notifyCancel(): void;
@@ -94,11 +84,19 @@ export default class MDCSimpleMenuAdapter {
setTransformOrigin(origin: string): void;
setPosition(position: {
top: string|undefined,
right: string|undefined,
bottom: string|undefined,
left: string|undefined
top: (string|undefined),
right: (string|undefined),
bottom: (string|undefined),
left: (string|undefined)
}): void;
getAccurateTime(): number;
setMaxHeight(height: number): void;
setAttrForOptionAtIndex(index: number, attr: string, value: string): void;
rmAttrForOptionAtIndex(index: number, attr: string): void;
addClassForOptionAtIndex(index: number, className: string): void;
rmClassForOptionAtIndex(index: number, className: string): void;
}

77
types/material__menu/constants.d.ts vendored Normal file
View File

@@ -0,0 +1,77 @@
/**
* @license
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MDCStrings, MDCNumbers } from 'material__base';
export interface cssClasses extends MDCStrings {
ROOT: 'mdc-menu';
OPEN: 'mdc-menu--open';
ANIMATING_OPEN: 'mdc-menu--animating-open';
ANIMATING_CLOSED: 'mdc-menu--animating-closed';
SELECTED_LIST_ITEM: 'mdc-list-item--selected';
}
export interface strings extends MDCStrings {
ITEMS_SELECTOR: '.mdc-menu__items';
SELECTED_EVENT: 'MDCMenu:selected';
CANCEL_EVENT: 'MDCMenu:cancel';
ARIA_DISABLED_ATTR: 'aria-disabled';
}
export interface numbers extends MDCNumbers {
// Amount of time to wait before triggering a selected event on the menu. Note that this time
// will most likely be bumped up once interactive lists are supported to allow for the ripple to
// animate before closing the menu
SELECTED_TRIGGER_DELAY: 50;
// Total duration of menu open animation.
TRANSITION_OPEN_DURATION: 120;
// Total duration of menu close animation.
TRANSITION_CLOSE_DURATION: 75;
// Margin left to the edge of the viewport when menu is at maximum possible height.
MARGIN_TO_EDGE: 32;
// Ratio of anchor width to menu width for switching from corner positioning to center positioning.
ANCHOR_TO_MENU_WIDTH_RATIO: 0.67;
// Ratio of vertical offset to menu height for switching from corner to mid-way origin positioning.
OFFSET_TO_MENU_HEIGHT_RATIO: 0.1;
}
/**
* Enum for bits in the {@see Corner) bitmap.
*/
export interface CornerBit extends MDCNumbers {
BOTTOM: 1;
CENTER: 2;
RIGHT: 4;
FLIP_RTL: 8;
}
/**
* Enum for representing an element corner for positioning the menu.
*
* The START constants map to LEFT if element directionality is left
* to right and RIGHT if the directionality is right to left.
* Likewise END maps to RIGHT or LEFT depending on the directionality.
*/
export interface Corner extends MDCNumbers {
TOP_LEFT: 0;
TOP_RIGHT: CornerBit["RIGHT"];
BOTTOM_LEFT: CornerBit["BOTTOM"];
BOTTOM_RIGHT: CornerBit["BOTTOM"] | CornerBit["RIGHT"];
TOP_START: CornerBit["FLIP_RTL"];
TOP_END: CornerBit["FLIP_RTL"] | CornerBit["RIGHT"];
BOTTOM_START: CornerBit["BOTTOM"] | CornerBit["FLIP_RTL"];
BOTTOM_END: CornerBit["BOTTOM"] | CornerBit["RIGHT"] | CornerBit["FLIP_RTL"];
}

68
types/material__menu/foundation.d.ts vendored Normal file
View File

@@ -0,0 +1,68 @@
/**
* @license
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import MDCFoundation from 'material__base/foundation';
import { cssClasses, strings, numbers, CornerBit, Corner } from './constants';
import MDCMenuAdapter from './adapter';
export interface AnchorMargin {
top: number;
right: number;
bottom: number;
left: number;
}
export default class MDCMenuFoundation extends MDCFoundation<MDCMenuFoundation> {
static readonly cssClasses: cssClasses;
static readonly strings: strings;
static readonly numbers: numbers;
static readonly Corner: Corner;
static readonly defaultAdapter: MDCMenuAdapter;
/**
* @param corner Default anchor corner alignment of top-left menu corner.
*/
setAnchorCorner(corner: Corner): void;
/**
* @param margin 4-plet of margins from anchor.
*/
setAnchorMargin(margin: AnchorMargin): void;
setRememberSelection(rememberSelection: boolean): void;
setQuickOpen(quickOpen: boolean): void;
open({focusIndex}?: {
focusIndex?: null;
}): void;
close(evt?: Event): void;
isOpen(): boolean;
getSelectedIndex(): number;
/**
* @param index Index of the item to set as selected.
*/
setSelectedIndex(index: number): void;
}

View File

@@ -1,6 +1,6 @@
// Type definitions for Material Components Web 0.26
// Type definitions for Material Components Web 0.35
// Project: https://material.io/components/
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>, Collin Kostichuk <https://github.com/ckosti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -20,7 +20,44 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import MDCComponent from 'material__base/component';
import MDCMenuFoundation, { AnchorMargin } from './foundation';
import MDCMenuAdapter from './adapter';
import { Corner, CornerBit } from './constants';
import * as util from './util';
import { MDCSimpleMenu, MDCSimpleMenuAdapter, MDCSimpleMenuFoundation } from './simple/index';
export { MDCSimpleMenu, MDCSimpleMenuAdapter, MDCSimpleMenuFoundation, util };
export { MDCMenuFoundation, MDCMenuAdapter, AnchorMargin, Corner, CornerBit };
export class MDCMenu extends MDCComponent<MDCMenuAdapter, MDCMenuFoundation> {
static attachTo(root: Element): MDCMenu;
open: boolean;
show(options?: { focusIndex?: number | null; }): void;
hide(): void;
/**
* @param corner Default anchor corner alignment of top-left menu corner.
*/
setAnchorCorner(corner: Corner): void;
setAnchorMargin(margin: AnchorMargin): void;
/**
* Return the items within the menu. Note that this only contains the set of elements within
* the items container that are proper list items, and not supplemental / presentational DOM
* elements.
*/
readonly items: Element[];
/**
* Return the item within the menu that is selected.
*/
getOptionByIndex(index: number): Element | null;
selectedItemIndex: number;
rememberSelection: boolean;
quickOpen: boolean;
}

View File

@@ -1,52 +0,0 @@
/**
* @license
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MDCStrings, MDCNumbers } from 'material__base';
export interface cssClasses extends MDCStrings {
ROOT: 'mdc-simple-menu';
OPEN: 'mdc-simple-menu--open';
ANIMATING: 'mdc-simple-menu--animating';
TOP_RIGHT: 'mdc-simple-menu--open-from-top-right';
BOTTOM_LEFT: 'mdc-simple-menu--open-from-bottom-left';
BOTTOM_RIGHT: 'mdc-simple-menu--open-from-bottom-right';
}
export interface strings extends MDCStrings {
ITEMS_SELECTOR: '.mdc-simple-menu__items';
SELECTED_EVENT: 'MDCSimpleMenu:selected';
CANCEL_EVENT: 'MDCSimpleMenu:cancel';
ARIA_DISABLED_ATTR: 'aria-disabled';
}
export interface numbers extends MDCNumbers {
// Amount of time to wait before triggering a selected event on the menu. Note that this time
// will most likely be bumped up once interactive lists are supported to allow for the ripple to
// animate before closing the menu
SELECTED_TRIGGER_DELAY: 50;
// Total duration of the menu animation.
TRANSITION_DURATION_MS: 300;
// The menu starts its open animation with the X axis at this time value (0 - 1).
TRANSITION_SCALE_ADJUSTMENT_X: 0.5;
// The time value the menu waits until the animation starts on the Y axis (0 - 1).
TRANSITION_SCALE_ADJUSTMENT_Y: 0.2;
// The cubic bezier control points for the animation (cubic-bezier(0, 0, 0.2, 1)).
TRANSITION_X1: 0;
TRANSITION_Y1: 0;
TRANSITION_X2: 0.2;
TRANSITION_Y2: 1;
}

View File

@@ -1,42 +0,0 @@
/**
* @license
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import MDCComponent from 'material__base/component';
import MDCSimpleMenuFoundation from './foundation';
import MDCSimpleMenuAdapter from './adapter';
import { getTransformPropertyName } from '../util';
export {MDCSimpleMenuAdapter, MDCSimpleMenuFoundation};
export class MDCSimpleMenu extends MDCComponent<MDCSimpleMenuAdapter, MDCSimpleMenuFoundation> {
static attachTo(root: Element): MDCSimpleMenu;
open: boolean;
show(options?: {focusIndex?: number}): void;
hide(): void;
/**
* Return the items within the menu. Note that this only contains the set of elements within
* the items container that are proper list items, and not supplemental / presentational DOM
* elements.
*/
readonly items: Element[];
getDefaultFoundation(): MDCSimpleMenuFoundation;
}

View File

@@ -1,11 +1,10 @@
{
"files": [
"simple/constants.d.ts",
"simple/adapter.d.ts",
"simple/index.d.ts",
"simple/foundation.d.ts",
"util.d.ts",
"index.d.ts"
"constants.d.ts",
"adapter.d.ts",
"index.d.ts",
"foundation.d.ts",
"util.d.ts"
],
"compilerOptions": {
"module": "commonjs",

View File

@@ -0,0 +1,57 @@
/**
* @license
* Copyright 2017 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Adapter for MDC Notched Outline.
*
* Defines the shape of the adapter expected by the foundation. Implement this
* adapter to integrate the Notched Outline into your framework. See
* https://github.com/material-components/material-components-web/blob/master/docs/authoring-components.md
* for more information.
*/
export default interface MDCNotchedOutlineAdapter {
/**
* Returns the width of the root element.
*/
getWidth(): number;
/**
* Returns the height of the root element.
*/
getHeight(): number;
/**
* Adds a class to the root element.
*/
addClass(className: string): void;
/**
* Removes a class from the root element.
*/
removeClass(className: string): void;
/**
* Sets the "d" attribute of the outline element's SVG path.
*/
setOutlinePathAttr(value: string): void;
/**
* Returns the idle outline element's computed style value of the given css property `propertyName`.
* We achieve this via `getComputedStyle(...).getPropertyValue(propertyName)`.
*/
getIdleOutlineStyleValue(propertyName: string): string;
}

View File

@@ -0,0 +1,27 @@
/**
* @license
* Copyright 2018 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MDCStrings } from 'material__base';
export interface strings extends MDCStrings {
PATH_SELECTOR: '.mdc-notched-outline__path';
IDLE_OUTLINE_SELECTOR: '.mdc-notched-outline__idle';
}
export interface cssClasses extends MDCStrings {
OUTLINE_NOTCHED: 'mdc-notched-outline--notched';
}

View File

@@ -0,0 +1,38 @@
/**
* @license
* Copyright 2017 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import MDCFoundation from 'material__base/foundation';
import { cssClasses, strings } from './constants';
import MDCNotchedOutlineAdapter from './adapter';
export default class MDCNotchedOutlineFoundation extends MDCFoundation<MDCNotchedOutlineAdapter> {
static readonly strings: strings;
static readonly cssClasses: cssClasses;
static readonly defaultAdapter: MDCNotchedOutlineAdapter;
/**
* Adds the outline notched selector and updates the notch width
* calculated based off of notchWidth and isRtl.
*/
notch(notchWidth: number, isRtl?: boolean): void;
/**
* Removes notched outline selector to close the notch in the outline.
*/
closeNotch(): void;
}

View File

@@ -0,0 +1,41 @@
// Type definitions for Material Components Web 0.35
// Project: https://material.io/components/
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>, Collin Kostichuk <https://github.com/ckosti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
/**
* @license
* Copyright 2017 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import MDCComponent from 'material__base/component';
import MDCNotchedOutlineFoundation from './foundation';
import MDCNotchedOutlineAdapter from './adapter';
export { MDCNotchedOutlineFoundation, MDCNotchedOutlineAdapter };
export class MDCNotchedOutline extends MDCComponent<MDCNotchedOutlineAdapter, MDCNotchedOutlineFoundation> {
static attachTo(root: Element): MDCNotchedOutline;
/**
* Updates outline selectors and SVG path to open notch.
*/
notch(notchWidth: number, isRtl?: boolean): void;
/**
* Updates the outline selectors to close notch and return it to idle state.
*/
closeNotch(): void;
}

View File

@@ -0,0 +1,27 @@
{
"files": [
"constants.d.ts",
"adapter.d.ts",
"index.d.ts",
"foundation.d.ts"
],
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
}
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -27,14 +27,12 @@ import { MDCSelectionControlState } from 'material__selection-control';
* Implement this adapter for your framework of choice to delegate updates to
* the component in your framework of choice. See architecture documentation
* for more details.
* https://github.com/material-components/material-components-web/blob/master/docs/architecture.md
* https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md
*/
export class MDCRadioAdapter {
export default interface MDCRadioAdapter {
addClass(className: string): void;
removeClass(className: string): void;
getNativeControl(): MDCSelectionControlState;
}
export default MDCRadioAdapter;

View File

@@ -15,28 +15,25 @@
*/
import MDCFoundation from 'material__base/foundation';
import { MDCSelectionControlState } from 'material__selection-control';
import MDCRadioAdapter from './adapter';
import { cssClasses, strings } from './constants';
export class MDCRadioFoundation extends MDCFoundation<MDCRadioAdapter> {
static readonly cssClasses: cssClasses;
export default class MDCRadioFoundation extends MDCFoundation<MDCRadioAdapter> {
static readonly cssClasses: cssClasses;
static readonly strings: strings;
static readonly strings: strings;
static readonly defaultAdapter: MDCRadioAdapter;
static readonly defaultAdapter: MDCRadioAdapter;
isChecked(): boolean;
isChecked(): boolean;
setChecked(checked: boolean): void;
setChecked(checked: boolean): void;
isDisabled(): boolean;
isDisabled(): boolean;
setDisabled(disabled: boolean): void;
setDisabled(disabled: boolean): void;
getValue(): string;
getValue(): string;
setValue(value?: string): void;
setValue(value?: string): void;
}
export default MDCRadioFoundation;

View File

@@ -1,6 +1,6 @@
// Type definitions for Material Components Web 0.26
// Type definitions for Material Components Web 0.35
// Project: https://material.io/components/
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>, Collin Kostichuk <https://github.com/ckosti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -25,7 +25,7 @@ import MDCComponent from 'material__base/component';
import { MDCSelectionControl } from 'material__selection-control';
import MDCRadioAdapter from './adapter';
import MDCRadioFoundation from './foundation';
import { MDCRipple, MDCRippleFoundation } from 'material__ripple';
import { MDCRipple } from 'material__ripple';
export {MDCRadioAdapter, MDCRadioFoundation};
@@ -39,8 +39,4 @@ export class MDCRadio extends MDCComponent<MDCRadioAdapter, MDCRadioFoundation>
value: string;
readonly ripple: MDCRipple;
destroy(): void;
getDefaultFoundation(): MDCRadioFoundation;
}

View File

@@ -32,11 +32,9 @@
* Implement this adapter for your framework of choice to delegate updates to
* the component in your framework of choice. See architecture documentation
* for more details.
* https://github.com/material-components/material-components-web/blob/master/docs/architecture.md
*
* @record
* https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md
*/
export default class MDCRippleAdapter {
export default interface MDCRippleAdapter {
browserSupportsCssVars(): boolean;
isUnbounded(): boolean;
@@ -49,17 +47,23 @@ export default class MDCRippleAdapter {
removeClass(className: string): void;
containsEventTarget(target: EventTarget): void;
registerInteractionHandler(evtType: string, handler: EventListener): void;
deregisterInteractionHandler(evtType: string, handler: EventListener): void;
registerDocumentInteractionHandler(evtType: string, handler: EventListener): void;
deregisterDocumentInteractionHandler(evtType: string, handler: EventListener): void;
registerResizeHandler(handler: EventListener): void;
deregisterResizeHandler(handler: EventListener): void;
updateCssVariable(varName: string, value: number|string): void;
updateCssVariable(varName: string, value: number | string | null): void;
computeBoundingRect(): ClientRect;
getWindowPageOffset(): {x: number, y: number};
getWindowPageOffset(): { x: number; y: number; };
}

View File

@@ -24,15 +24,14 @@ export interface cssClasses extends MDCStrings {
ROOT: 'mdc-ripple-upgraded';
UNBOUNDED: 'mdc-ripple-upgraded--unbounded';
BG_FOCUSED: 'mdc-ripple-upgraded--background-focused';
BG_ACTIVE_FILL: 'mdc-ripple-upgraded--background-active-fill';
FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation';
FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation';
}
export interface strings extends MDCStrings {
VAR_FG_SIZE: '--mdc-ripple-fg-size';
VAR_LEFT: '--mdc-ripple-left';
VAR_TOP: '--mdc-ripple-top';
VAR_FG_SIZE: '--mdc-ripple-fg-size';
VAR_FG_SCALE: '--mdc-ripple-fg-scale';
VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start';
VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end';
@@ -41,6 +40,7 @@ export interface strings extends MDCStrings {
export interface numbers extends MDCNumbers {
PADDING: 10;
INITIAL_ORIGIN_SCALE: 0.6;
DEACTIVATION_TIMEOUT_MS: 300;
FG_DEACTIVATION_MS: 83;
DEACTIVATION_TIMEOUT_MS: 225; // Corresponds to $mdc-ripple-translate-duration (i.e. activation animation duration)
FG_DEACTIVATION_MS: 150; // Corresponds to $mdc-ripple-fade-out-duration (i.e. deactivation animation duration)
TAP_DELAY_MS: 300; // Delay between touch and simulated mouse events on touch devices
}

View File

@@ -18,39 +18,6 @@
import MDCFoundation from 'material__base/foundation';
import MDCRippleAdapter from './adapter';
import { cssClasses, strings, numbers } from './constants';
import { getNormalizedEventCoords } from './util';
export interface ActivationStateType {
isActivated: boolean|undefined;
hasDeactivationUXRun: boolean|undefined;
wasActivatedByPointer: boolean|undefined;
wasElementMadeActive: boolean|undefined;
activationStartTime: number|undefined;
activationEvent: Event;
isProgrammatic: boolean|undefined;
}
export interface ListenerInfoType {
activate: string|undefined;
deactivate: string|undefined;
focus: string|undefined;
blur: string|undefined;
}
export interface ListenersType {
activate(e: Event): void;
deactivate(e: Event): void;
focus(): void;
blur(): void;
}
export interface PointType {
x: number;
y: number;
}
export default class MDCRippleFoundation extends MDCFoundation<MDCRippleAdapter> {
static readonly cssClasses: cssClasses;
@@ -66,4 +33,6 @@ export default class MDCRippleFoundation extends MDCFoundation<MDCRippleAdapter>
deactivate(event?: Event): void;
layout(): void;
setUnbounded(unbounded: boolean): void;
}

View File

@@ -1,6 +1,6 @@
// Type definitions for Material Components Web 0.26
// Type definitions for Material Components Web 0.35
// Project: https://material.io/components/
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>, Collin Kostichuk <https://github.com/ckosti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -29,21 +29,19 @@ import * as util from './util';
export {MDCRippleAdapter, MDCRippleFoundation, util};
export class MDCRipple extends MDCComponent<MDCRippleAdapter, MDCRippleFoundation> {
static attachTo(root: Element, bound?: {isUnbounded: boolean|undefined}): MDCRipple;
static attachTo(root: Element, options?: { isUnbounded?: boolean; }): MDCRipple;
static createAdapter(instance: RippleCapableSurface): MDCRippleAdapter;
static createAdapter(instance: RippleCapableSurface): MDCRippleAdapter;
unbounded: boolean;
unbounded: boolean;
activate(): void;
activate(): void;
deactivate(): void;
deactivate(): void;
layout(): void;
layout(): void;
getDefaultFoundation(): MDCRippleFoundation;
initialSyncWithDOM(): void;
initialSyncWithDOM(): void;
}
/**
@@ -57,10 +55,10 @@ export class RippleCapableSurface {
/**
* Whether or not the ripple bleeds out of the bounds of the element.
*/
unbounded: boolean|undefined;
unbounded: boolean | undefined;
/**
* Whether or not the ripple is attached to a disabled component.
*/
disabled: boolean|undefined;
disabled: boolean | undefined;
}

View File

@@ -14,68 +14,28 @@
* limitations under the License.
*/
export interface MDCSelectAdapter {
export default interface MDCSelectAdapter {
addClass(className: string): void;
removeClass(className: string): void;
addBodyClass(className: string): void;
floatLabel(value: boolean): void;
removeBodyClass(className: string): void;
activateBottomLine(): void;
setAttr(attr: string, value: string): void;
rmAttr(attr: string): void;
computeBoundingRect(): {left: number, top: number};
deactivateBottomLine(): void;
registerInteractionHandler(type: string, handler: EventListener): void;
deregisterInteractionHandler(type: string, handler: EventListener): void;
focus(): void;
getSelectedIndex(): number;
makeTabbable(): void;
setSelectedIndex(index: number): void;
makeUntabbable(): void;
setDisabled(disabled: boolean): void;
getComputedStyleValue(propertyName: string): string;
getValue(): string;
setStyle(propertyName: string, value: string): void;
create2dRenderingContext(): {font: string, measureText: (val: string) => {width: number}};
setMenuElStyle(propertyName: string, value: string): void;
setMenuElAttr(attr: string, value: string): void;
rmMenuElAttr(attr: string): void;
getMenuElOffsetHeight(): number;
openMenu(focusIndex: number): void;
isMenuOpen(): boolean;
setSelectedTextContent(textContent: string): void;
getNumberOfOptions(): number;
getTextForOptionAtIndex(index: number): string;
getValueForOptionAtIndex(index: number): string;
setAttrForOptionAtIndex(index: number, attr: string, value: string): void;
rmAttrForOptionAtIndex(index: number, attr: string): void;
getOffsetTopForOptionAtIndex(index: number): number;
registerMenuInteractionHandler(type: string, handler: EventListener): void;
deregisterMenuInteractionHandler(type: string, handler: EventListener): void;
notifyChange(): void;
getWindowInnerHeight(): number;
setValue(value: string): void;
}

View File

@@ -17,12 +17,14 @@
import { MDCStrings } from 'material__base';
export interface cssClasses extends MDCStrings {
ROOT: 'mdc-select';
OPEN: 'mdc-select--open';
BOX: 'mdc-select--box';
DISABLED: 'mdc-select--disabled';
SCROLL_LOCK: 'mdc-select-scroll-lock';
ROOT: 'mdc-select';
}
export interface strings extends MDCStrings {
CHANGE_EVENT: 'MDCSelect:change';
LINE_RIPPLE_SELECTOR: '.mdc-line-ripple';
LABEL_SELECTOR: '.mdc-floating-label';
NATIVE_CONTROL_SELECTOR: '.mdc-select__native-control';
}

View File

@@ -16,25 +16,18 @@
import { MDCFoundation } from 'material__base';
import { cssClasses, strings } from './constants';
import { MDCSimpleMenuFoundation } from 'material__menu';
import { MDCSelectAdapter } from './adapter';
import MDCSelectAdapter from './adapter';
export default class MDCSelectFoundation extends MDCFoundation<MDCSelectAdapter> {
static readonly cssClasses: cssClasses;
static readonly cssClasses: cssClasses;
static readonly strings: strings;
static readonly strings: strings;
static readonly defaultAdapter: MDCSelectAdapter;
static readonly defaultAdapter: MDCSelectAdapter;
getValue(): string;
setSelectedIndex(index: number): void;
getSelectedIndex(): number;
setValue(value: string): void;
setSelectedIndex(index: number): void;
isDisabled(): boolean;
setDisabled(disabled: boolean): void;
resize(): void;
setDisabled(disabled: boolean): void;
}

View File

@@ -1,6 +1,6 @@
// Type definitions for Material Components Web 0.26
// Type definitions for Material Components Web 0.35
// Project: https://material.io/components/
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>, Collin Kostichuk <https://github.com/ckosti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -21,33 +21,23 @@
*/
import { MDCComponent } from 'material__base';
import { MDCSimpleMenu } from 'material__menu';
import { MDCSelectAdapter } from './adapter';
import MDCSelectFoundation from './foundation';
import MDCSelectAdapter from './adapter';
import { MDCFloatingLabel } from 'material__floating-label';
import { MDCLineRipple } from 'material__line-ripple';
export {MDCSelectAdapter, MDCSelectFoundation};
export class MDCSelect extends MDCComponent<MDCSelectAdapter, MDCSelectFoundation> {
static attachTo(root: Element): MDCSelect;
readonly value: string;
readonly options: Element[];
readonly selectedOptions: NodeListOf<Element>;
value: string;
selectedIndex: number;
disabled: boolean;
item(index: number): Element|null;
nameditem(key: string): Element|null;
initialize(menuFactory?: (el: Element) => MDCSimpleMenu): void;
getDefaultFoundation(): MDCSelectFoundation;
initialize(labelFactory?: (el: Element) => MDCFloatingLabel, lineRippleFactory?: (el: Element) => MDCLineRipple): void;
initialSyncWithDOM(): void;
}

View File

@@ -1,6 +1,6 @@
// Type definitions for Material Components Web 0.26
// Type definitions for Material Components Web 0.35
// Project: https://material.io/components/
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>, Collin Kostichuk <https://github.com/ckosti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6

View File

@@ -14,14 +14,14 @@
* limitations under the License.
*/
export interface MDCSliderAdapter {
export default interface MDCSliderAdapter {
hasClass(className: string): boolean;
addClass(className: string): void;
removeClass(className: string): void;
getAttribute(name: string): string|null;
getAttribute(name: string): string | null;
setAttribute(name: string, value: string): void;

View File

@@ -16,9 +16,8 @@
import { cssClasses, strings, numbers } from './constants';
import { getCorrectEventName, getCorrectPropertyName } from 'material__animation';
import MDCFoundation from 'material__base/foundation';
import { MDCSliderAdapter } from './adapter';
import MDCSliderAdapter from './adapter';
export default class MDCSliderFoundation extends MDCFoundation<MDCSliderAdapter> {
static readonly cssClasses: cssClasses;

View File

@@ -1,6 +1,6 @@
// Type definitions for Material Components Web 0.26
// Type definitions for Material Components Web 0.35
// Project: https://material.io/components/
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>, Collin Kostichuk <https://github.com/ckosti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -23,32 +23,30 @@
import MDCComponent from 'material__base/component';
import MDCSliderFoundation from './foundation';
import { MDCSliderAdapter } from './adapter';
import MDCSliderAdapter from './adapter';
export {MDCSliderAdapter, MDCSliderFoundation};
export class MDCSlider extends MDCComponent<MDCSliderAdapter, MDCSliderFoundation> {
static attachTo(root: Element): MDCSlider;
static attachTo(root: Element): MDCSlider;
value: number;
value: number;
min: number;
min: number;
max: number;
max: number;
step: number;
step: number;
disabled: boolean;
disabled: boolean;
initialize(): void;
initialize(): void;
getDefaultFoundation(): MDCSliderFoundation;
initialSyncWithDOM(): void;
initialSyncWithDOM(): void;
layout(): void;
layout(): void;
stepUp(amount?: number): void;
stepUp(amount?: number): void;
stepDown(amount?: number): void;
stepDown(amount?: number): void;
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
export interface MDCSnackbarAdapter {
export default interface MDCSnackbarAdapter {
addClass(className: string): void;
removeClass(className: string): void;
setAriaHidden(): void;
@@ -35,4 +35,6 @@ export interface MDCSnackbarAdapter {
deregisterActionClickHandler(handler: EventListener): void;
registerTransitionEndHandler(handler: EventListener): void;
deregisterTransitionEndHandler(handler: EventListener): void;
notifyShow(): void;
notifyHide(): void;
}

View File

@@ -30,6 +30,8 @@ export interface strings extends MDCStrings {
TEXT_SELECTOR: '.mdc-snackbar__text';
ACTION_WRAPPER_SELECTOR: '.mdc-snackbar__action-wrapper';
ACTION_BUTTON_SELECTOR: '.mdc-snackbar__action-button';
SHOW_EVENT: 'MDCSnackbar:show';
HIDE_EVENT: 'MDCSnackbar:hide';
}
export interface numbers extends MDCNumbers {

View File

@@ -14,9 +14,9 @@
* limitations under the License.
*/
import { MDCFoundation } from 'material__base';
import MDCFoundation from 'material__base/foundation';
import { cssClasses, strings, numbers } from './constants';
import { MDCSnackbarAdapter } from './adapter';
import MDCSnackbarAdapter from './adapter';
export interface MDCSnackbarData {
message: string;
@@ -27,18 +27,18 @@ export interface MDCSnackbarData {
timeout?: number;
}
export class MDCSnackbarFoundation extends MDCFoundation<MDCSnackbarAdapter> {
static readonly cssClasses: cssClasses;
export default class MDCSnackbarFoundation extends MDCFoundation<MDCSnackbarAdapter> {
static readonly cssClasses: cssClasses;
static readonly strings: strings;
static readonly strings: strings;
static readonly defaultAdapter: MDCSnackbarAdapter;
static readonly defaultAdapter: MDCSnackbarAdapter;
readonly active: boolean;
readonly active: boolean;
dismissesOnAction(): boolean;
dismissesOnAction(): boolean;
setDismissOnAction(dismissOnAction: boolean): void;
setDismissOnAction(dismissOnAction: boolean): void;
show(data: MDCSnackbarData): void;
show(data: MDCSnackbarData): void;
}

View File

@@ -1,6 +1,6 @@
// Type definitions for Material Components Web 0.26
// Type definitions for Material Components Web 0.35
// Project: https://material.io/components/
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>, Collin Kostichuk <https://github.com/ckosti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -21,18 +21,15 @@
*/
import { MDCComponent } from 'material__base';
import { MDCSnackbarAdapter } from './adapter';
import { MDCSnackbarFoundation, MDCSnackbarData } from './foundation';
import { getCorrectEventName } from 'material__animation';
import MDCSnackbarAdapter from './adapter';
import MDCSnackbarFoundation, { MDCSnackbarData } from './foundation';
export {MDCSnackbarAdapter, MDCSnackbarFoundation};
export class MDCSnackbar extends MDCComponent<MDCSnackbarAdapter, MDCSnackbarFoundation> {
static attachTo(root: Element): MDCSnackbar;
static attachTo(root: Element): MDCSnackbar;
show(data: MDCSnackbarData): void;
show(data: MDCSnackbarData): void;
getDefaultFoundation(): MDCSnackbarFoundation;
dismissesOnAction: boolean;
dismissesOnAction: boolean;
}

View File

@@ -1,6 +1,6 @@
/**
* @license
* Copyright 2017 Google Inc. All Rights Reserved.
* Copyright 2018 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,47 +14,41 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Adapter for MDC TextField Bottom Line.
* Adapter for MDC Tab.
*
* Defines the shape of the adapter expected by the foundation. Implement this
* adapter to integrate the TextField bottom line into your framework. See
* adapter to integrate the Tab into your framework. See
* https://github.com/material-components/material-components-web/blob/master/docs/authoring-components.md
* for more information.
*
* @record
*/
export default class MDCTextFieldBottomLineAdapter {
export default interface MDCTabAdapter {
/**
* Adds a class to the bottom line element.
*/
addClass(className: string): void;
/**
* Removes a class from the bottom line element.
*/
removeClass(className: string): void;
/**
* Sets an attribute with a given value on the bottom line element.
*/
setAttr(attr: string, value: string): void;
/**
* Registers an event listener on the bottom line element for a given event.
* Registers an event listener on the root element for a given event.
*/
registerEventHandler(evtType: string, handler: EventListener): void;
/**
* Deregisters an event listener on the bottom line element for a given event.
* Deregisters an event listener on the root element for a given event.
*/
deregisterEventHandler(evtType: string, handler: EventListener): void;
/**
* Emits a custom event "MDCTextFieldBottomLine:animation-end" denoting the
* bottom line has finished its animation; either the activate or
* deactivate animation
* Adds the given className to the root element.
*/
notifyAnimationEnd(): void;
addClass(className: string): void;
/**
* Removes the given className from the root element.
*/
removeClass(className: string): void;
/**
* Returns whether the root element has the given className.
*/
hasClass(className: string): boolean;
/**
* Sets the given attrName of the root element to the given value.
*/
setAttr(attr: string, value: string): void;
}

27
types/material__tab/constants.d.ts vendored Normal file
View File

@@ -0,0 +1,27 @@
/**
* @license
* Copyright 2018 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MDCStrings } from 'material__base';
export interface cssClasses extends MDCStrings {
ACTIVE: 'mdc-tab--active';
ANIMATING_ACTIVATE: 'mdc-tab--animating-activate';
ANIMATING_DEACTIVATE: 'mdc-tab--animating-deactivate';
}
export interface strings extends MDCStrings {
ARIA_SELECTED: 'aria-selected';
}

View File

@@ -1,6 +1,6 @@
/**
* @license
* Copyright 2017 Google Inc. All Rights Reserved.
* Copyright 2018 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,35 +14,31 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import MDCFoundation from 'material__base/foundation';
import MDCTextFieldBottomLineAdapter from './adapter';
import { cssClasses, strings } from './constants';
import MDCTabAdapter from './adapter';
export default class MDCTextFieldBottomLineFoundation extends MDCFoundation<MDCTextFieldBottomLineAdapter> {
export default class MDCTabFoundation extends MDCFoundation<MDCTabAdapter> {
static readonly cssClasses: cssClasses;
static readonly strings: strings;
static readonly defaultAdapter: MDCTextFieldBottomLineAdapter;
static readonly defaultAdapter: MDCTabAdapter;
handleTransitionEnd(evt: Event): void;
/**
* Activates the bottom line
* Returns the Tab's active state
*/
isActive(): boolean;
/**
* Activates the Tab
*/
activate(): void;
/**
* Sets the transform origin given a user's click location.
*/
setTransformOrigin(evt: Event): void;
/**
* Deactivates the bottom line
* Deactivates the Tab
*/
deactivate(): void;
/**
* Handles a transition end event
*/
handleTransitionEnd(evt: Event): void;
}

33
types/material__tab/index.d.ts vendored Normal file
View File

@@ -0,0 +1,33 @@
// Type definitions for Material Components Web 0.35
// Project: https://material.io/components/
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>, Collin Kostichuk <https://github.com/ckosti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
/**
* @license
* Copyright 2018 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import MDCComponent from 'material__base/component';
import MDCTabFoundation from './foundation';
import MDCTabAdapter from './adapter';
export { MDCTabFoundation, MDCTabAdapter };
export class MDCTab extends MDCComponent<MDCTabAdapter, MDCTabFoundation> {
static attachTo(root: Element): MDCTab;
active: boolean;
}

View File

@@ -0,0 +1,27 @@
{
"files": [
"constants.d.ts",
"adapter.d.ts",
"index.d.ts",
"foundation.d.ts"
],
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
}
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -1,6 +1,6 @@
// Type definitions for Material Components Web 0.26
// Type definitions for Material Components Web 0.35
// Project: https://material.io/components/
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>
// Definitions by: Brent Douglas <https://github.com/BrentDouglas>, Collin Kostichuk <https://github.com/ckosti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -20,6 +20,6 @@
* limitations under the License.
*/
export {MDCTabFoundation, MDCTab} from './tab/index';
export {MDCTabBarAdapter, MDCTabBarFoundation, MDCTabBar} from './tab-bar/index';
export {MDCTabBarScrollerAdapter, MDCTabBarScrollerFoundation, MDCTabBarScroller} from './tab-bar-scroller/index';
export { MDCTabFoundation, MDCTab, MDCTabAdapter } from './tab';
export { MDCTabBarFoundation, MDCTabBar, MDCTabBarAdapter } from './tab-bar';
export { MDCTabBarScrollerFoundation, MDCTabBarScroller, MDCTabBarScrollerAdapter } from './tab-bar-scroller';

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
export interface MDCTabBarScrollerAdapter {
export default interface MDCTabBarScrollerAdapter {
addClass(className: string): void;
removeClass(className: string): void;

View File

@@ -17,7 +17,7 @@
import MDCFoundation from 'material__base/foundation';
import { cssClasses, strings } from './constants';
import { MDCTabBarScrollerAdapter } from './adapter';
import MDCTabBarScrollerAdapter from './adapter';
export default class MDCTabBarScrollerFoundation extends MDCFoundation<MDCTabBarScrollerAdapter> {
static readonly cssClasses: cssClasses;

Some files were not shown because too many files have changed in this diff Show More