Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feat/typescript' into feat/types…
Browse files Browse the repository at this point in the history
…cript--textfield
  • Loading branch information
acdvorak committed Feb 12, 2019
2 parents 730164d + b2fa9a5 commit 1d88400
Show file tree
Hide file tree
Showing 26 changed files with 684 additions and 825 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ out
.idea
*.sw*
.closure-tmp
.vscode
.site-generator-tmp
.typescript-tmp
.vscode
89 changes: 36 additions & 53 deletions packages/mdc-tab-bar/adapter.js → packages/mdc-tab-bar/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,128 +21,111 @@
* THE SOFTWARE.
*/

/* eslint no-unused-vars: [2, {"args": "none"}] */

/* eslint-disable no-unused-vars */
import {MDCTabDimensions} from '@material/tab/adapter';
/* eslint-enable no-unused-vars */
import {MDCTabDimensions} from '@material/tab/types';

/**
* Adapter for MDC Tab Bar.
*
* Defines the shape of the adapter expected by the foundation. Implement this
* adapter to integrate the Tab Bar into your framework. See
* https://github.com/material-components/material-components-web/blob/master/docs/authoring-components.md
* for more information.
*
* @record
* Defines the shape of the adapter expected by the foundation.
* 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/code/architecture.md
*/
class MDCTabBarAdapter {
interface MDCTabBarAdapter {
/**
* Scrolls to the given position
* @param {number} scrollX The position to scroll to
* @param scrollX The position to scroll to
*/
scrollTo(scrollX) {}
scrollTo(scrollX: number): void;

/**
* Increments the current scroll position by the given amount
* @param {number} scrollXIncrement The amount to increment scroll
* @param scrollXIncrement The amount to increment scroll
*/
incrementScroll(scrollXIncrement) {}
incrementScroll(scrollXIncrement: number): void;

/**
* Returns the current scroll position
* @return {number}
*/
getScrollPosition() {}
getScrollPosition(): number;

/**
* Returns the width of the scroll content
* @return {number}
*/
getScrollContentWidth() {}
getScrollContentWidth(): number;

/**
* Returns the root element's offsetWidth
* @return {number}
*/
getOffsetWidth() {}
getOffsetWidth(): number;

/**
* Returns if the Tab Bar language direction is RTL
* @return {boolean}
*/
isRTL() {}
isRTL(): boolean;

/**
* Sets the tab at the given index to be activated
* @param {number} index The index of the tab to activate
* @param index The index of the tab to activate
*/
setActiveTab(index) {}
setActiveTab(index: number): void;

/**
* Activates the tab at the given index with the given client rect
* @param {number} index The index of the tab to activate
* @param {!ClientRect} clientRect The client rect of the previously active Tab Indicator
* @param index The index of the tab to activate
* @param clientRect The client rect of the previously active Tab Indicator
*/
activateTabAtIndex(index, clientRect) {}
activateTabAtIndex(index: number, clientRect: ClientRect): void;

/**
* Deactivates the tab at the given index
* @param {number} index The index of the tab to deactivate
* @param index The index of the tab to deactivate
*/
deactivateTabAtIndex(index) {}
deactivateTabAtIndex(index: number): void;

/**
* Focuses the tab at the given index
* @param {number} index The index of the tab to focus
* @param index The index of the tab to focus
*/
focusTabAtIndex(index) {}
focusTabAtIndex(index: number): void;

/**
* Returns the client rect of the tab's indicator
* @param {number} index The index of the tab
* @return {!ClientRect}
* @param index The index of the tab
*/
getTabIndicatorClientRectAtIndex(index) {}
getTabIndicatorClientRectAtIndex(index: number): ClientRect;

/**
* Returns the tab dimensions of the tab at the given index
* @param {number} index The index of the tab
* @return {!MDCTabDimensions}
* @param index The index of the tab
*/
getTabDimensionsAtIndex(index) {}
getTabDimensionsAtIndex(index: number): MDCTabDimensions;

/**
* Returns the length of the tab list
* @return {number}
*/
getTabListLength() {}
getTabListLength(): number;

/**
* Returns the index of the previously active tab
* @return {number}
*/
getPreviousActiveTabIndex() {}
getPreviousActiveTabIndex(): number;

/**
* Returns the index of the focused tab
* @return {number}
*/
getFocusedTabIndex() {}
getFocusedTabIndex(): number;

/**
* Returns the index of the given tab
* @param {string} id The ID of the tab whose index to determine
* @return {number}
* @param id The ID of the tab whose index to determine
*/
getIndexOfTabById(id) {}
getIndexOfTabById(id: string): number;

/**
* Emits the MDCTabBar:activated event
* @param {number} index The index of the activated tab
* @param index The index of the activated tab
*/
notifyTabActivated(index) {}
notifyTabActivated(index: number): void;
}

export default MDCTabBarAdapter;
export {MDCTabBarAdapter as default, MDCTabBarAdapter};
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,26 @@
* THE SOFTWARE.
*/

/** @enum {string} */
const strings = {
TAB_ACTIVATED_EVENT: 'MDCTabBar:activated',
TAB_SCROLLER_SELECTOR: '.mdc-tab-scroller',
TAB_SELECTOR: '.mdc-tab',
ARROW_LEFT_KEY: 'ArrowLeft',
ARROW_RIGHT_KEY: 'ArrowRight',
END_KEY: 'End',
HOME_KEY: 'Home',
ENTER_KEY: 'Enter',
HOME_KEY: 'Home',
SPACE_KEY: 'Space',
TAB_ACTIVATED_EVENT: 'MDCTabBar:activated',
TAB_SCROLLER_SELECTOR: '.mdc-tab-scroller',
TAB_SELECTOR: '.mdc-tab',
};

/** @enum {number} */
const numbers = {
EXTRA_SCROLL_AMOUNT: 20,
ARROW_LEFT_KEYCODE: 37,
ARROW_RIGHT_KEYCODE: 39,
END_KEYCODE: 35,
HOME_KEYCODE: 36,
ENTER_KEYCODE: 13,
EXTRA_SCROLL_AMOUNT: 20,
HOME_KEYCODE: 36,
SPACE_KEYCODE: 32,
};

export {
numbers,
strings,
};
export {numbers, strings};
Loading

0 comments on commit 1d88400

Please sign in to comment.