mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* Restructure files and add missing declarations * Add JQuery declarations * Restructure tests * Add carousel tests * Add more tests and missing JQuery declarations * Add waves declaration and a test * Add static init methods and tests * allow jquery and cash object to be passed to init * Remove redundant reference * Clean up * Clean up * Clean up and add tests * Clean up and add tests
71 lines
1.8 KiB
TypeScript
71 lines
1.8 KiB
TypeScript
/// <reference path="./common.d.ts" />
|
|
|
|
declare namespace M {
|
|
class Tabs extends Component<TabsOptions> {
|
|
/**
|
|
* Get Instance
|
|
*/
|
|
static getInstance(elem: Element): Tabs;
|
|
|
|
/**
|
|
* Init Tabs
|
|
*/
|
|
static init(els: Element, options?: Partial<TabsOptions>): Tabs;
|
|
|
|
/**
|
|
* Init Tabses
|
|
*/
|
|
static init(els: MElements, options?: Partial<TabsOptions>): Tabs[];
|
|
|
|
/**
|
|
* Show tab content that corresponds to the tab with the id
|
|
* @param tabId The id of the tab that you want to switch to
|
|
*/
|
|
select(tabId: string): void;
|
|
|
|
/**
|
|
* The index of tab that is currently shown
|
|
*/
|
|
index: number;
|
|
|
|
/**
|
|
* Recalculate tab indicator position. This is useful when the indicator position is not correct
|
|
*/
|
|
updateTabIndicator(): void;
|
|
}
|
|
|
|
/**
|
|
* Options for the Tabs
|
|
*/
|
|
interface TabsOptions {
|
|
/**
|
|
* Transition duration in milliseconds.
|
|
* @default 300
|
|
*/
|
|
duration: number;
|
|
|
|
/**
|
|
* Callback for when a new tab content is shown
|
|
*/
|
|
onShow: (this: Tabs, newContent: Element) => void;
|
|
|
|
/**
|
|
* Set to true to enable swipeable tabs. This also uses the responsiveThreshold option
|
|
* @default false
|
|
*/
|
|
swipeable: boolean;
|
|
|
|
/**
|
|
* The maximum width of the screen, in pixels, where the swipeable functionality initializes.
|
|
* @default infinity
|
|
*/
|
|
responsiveThreshold: number;
|
|
}
|
|
}
|
|
|
|
interface JQuery {
|
|
tabs(method: keyof Pick<M.Tabs, "destroy">): JQuery;
|
|
tabs(method: keyof Pick<M.Tabs, "select">, tabId: string): JQuery;
|
|
tabs(options?: Partial<M.TabsOptions>): JQuery;
|
|
}
|