DefinitelyTyped/types/materialize-css/carousel.d.ts
Leonard Thieu c3cbb348e2 [jquery] Add includeMargin parameter to .outerHeight() and .outerWidth() setters. (#29756)
* [jquery] Add `includeMargin` parameter to `.outerHeight()` and `.outerWidth()` setters.

See 354f6036f2/test/unit/dimensions.js (L477-L484).

* [jquery-awesome-cursor] Add missing `dom` lib target.

* [jquery-toast-plugin] Add missing `dom` lib target.

* [jquery.growl] Add missing `dom` lib target.

* [materialize-css] Disable `unified-signatures` rule for plugin overloads.

These overloads follow the jQuery plugin pattern and are effectively separate methods.

* [ng-cordova] Update promise types to be compatible with changes from `ng.IPromise`.

Ref: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/23115

* [ng-tags-input] Add missing `dom` lib target.

* [p-loading] Add missing `dom` lib target.

* [summernote] Add missing `dom` lib target.

* [swig-email-templates] Add missing `dom` lib target.

* [materialize-css] Unify signatures according to feedback.

See https://github.com/DefinitelyTyped/DefinitelyTyped/pull/29756#pullrequestreview-165249412.
2018-10-16 10:15:06 -07:00

116 lines
2.8 KiB
TypeScript

/// <reference path="./common.d.ts" />
declare namespace M {
class Carousel extends Component<CarouselOptions> {
/**
* Get Instance
*/
static getInstance(elem: Element): Carousel;
/**
* Init carousel
*/
static init(els: Element, options?: Partial<CarouselOptions>): Carousel;
/**
* Init carousels
*/
static init(els: MElements, options?: Partial<CarouselOptions>): Carousel[];
/**
* If the carousel is being clicked or tapped
*/
pressed: boolean;
/**
* If the carousel is currently being dragged
*/
dragged: number;
/**
* The index of the center carousel item
*/
center: number;
/**
* Move carousel to next slide or go forward a given amount of slides
* @param n How many times the carousel slides
*/
next(n?: number): void;
/**
* Move carousel to previous slide or go back a given amount of slides
* @param n How many times the carousel slides
*/
prev(n?: number): void;
/**
* Move carousel to nth slide
* @param n Index of slide
*/
set(n?: number): void;
}
interface CarouselOptions {
/**
* Transition duration in milliseconds
* @default 200
*/
duration: number;
/**
* Perspective zoom. If 0, all items are the same size
* @default -100
*/
dist: number;
/**
* Set the spacing of the center item
* @default 0
*/
shift: number;
/**
* Set the padding between non center items
* @default 0
*/
padding: number;
/**
* Set the number of visible items
* @default 5
*/
numVisible: number;
/**
* Make the carousel a full width slider like the second example
* @default false
*/
fullWidth: boolean;
/**
* Set to true to show indicators
* @default false
*/
indicators: boolean;
/**
* Don't wrap around and cycle through items
* @default false
*/
noWrap: boolean;
/**
* Callback for when a new slide is cycled to
* @default null
*/
onCycleTo: (this: Carousel, current: Element, dragged: boolean) => void;
}
}
interface JQuery {
carousel(method: keyof Pick<M.Carousel, "destroy">): JQuery;
carousel(method: keyof Pick<M.Carousel, "next"> | keyof Pick<M.Carousel, "prev"> | keyof Pick<M.Carousel, "set">, n?: number): JQuery;
carousel(options?: Partial<M.CarouselOptions>): JQuery;
}