materialize-css: Add missing declarations and tests (#25492)

* 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
This commit is contained in:
Max 2018-05-08 04:00:18 +10:00 committed by Sheetal Nandi
parent 74d3e6b86d
commit a355d32369
55 changed files with 2905 additions and 1345 deletions

88
types/materialize-css/autocomplete.d.ts vendored Normal file
View File

@ -0,0 +1,88 @@
/// <reference path="./common.d.ts" />
declare namespace M {
class Autocomplete extends Component<AutocompleteOptions> {
/**
* Get Instance
*/
static getInstance(elem: Element): Autocomplete;
/**
* Init autocomplete
*/
static init(els: Element, options?: Partial<AutocompleteOptions>): Autocomplete;
/**
* Init autocompletes
*/
static init(els: MElements, options?: Partial<AutocompleteOptions>): Autocomplete[];
/**
* Select a specific autocomplete options.
* @param el Element of the autocomplete option.
*/
selectOption(el: Element): void;
/**
* Update autocomplete options data.
* @param data Autocomplete options data object.
*/
updateData(data: AutocompleteData): void;
/**
* If the autocomplete is open.
*/
isOpen: boolean;
/**
* Number of matching autocomplete options.
*/
count: number;
/**
* Index of the current selected option.
*/
activeIndex: number;
}
interface AutocompleteData {
[key: string]: string | null;
}
interface AutocompleteOptions {
/**
* Data object defining autocomplete options with optional icon strings.
*/
data: AutocompleteData;
/**
* Limit of results the autocomplete shows.
* @default infinity
*/
limit: number;
/**
* Callback for when autocompleted.
*/
onAutocomplete: (this: Autocomplete, text: string) => void;
/**
* Minimum number of characters before autocomplete starts.
* @default 1
*/
minLength: number;
/**
* Sort function that defines the order of the list of autocomplete options.
*/
sortFunction: (a: string, b: string, inputText: string) => number;
}
}
interface JQuery {
// Pick<T,K> to check methods exist.
autocomplete(method: keyof Pick<M.Autocomplete, "destroy">): JQuery;
autocomplete(method: keyof Pick<M.Autocomplete, "selectOption">, el: Element): JQuery;
autocomplete(method: keyof Pick<M.Autocomplete, "updateData">, data: M.AutocompleteData): JQuery;
autocomplete(options?: Partial<M.AutocompleteOptions>): JQuery;
}

117
types/materialize-css/carousel.d.ts vendored Normal file
View File

@ -0,0 +1,117 @@
/// <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">, n?: number): JQuery;
carousel(method: keyof Pick<M.Carousel, "prev">, n?: number): JQuery;
carousel(method: keyof Pick<M.Carousel, "set">, n?: number): JQuery;
carousel(options?: Partial<M.CarouselOptions>): JQuery;
}

View File

@ -0,0 +1,25 @@
/// <reference path="./common.d.ts" />
declare namespace M {
class CharacterCounter extends Component<undefined> {
/**
* Get Instance
*/
static getInstance(elem: Element): CharacterCounter;
/**
* Init CharacterCounter
*/
static init(els: Element, options?: Partial<undefined>): CharacterCounter;
/**
* Init CharacterCounters
*/
static init(els: MElements, options?: Partial<undefined>): CharacterCounter[];
}
}
interface JQuery {
characterCounter(method: keyof Pick<M.CharacterCounter, "destroy">): JQuery;
characterCounter(): JQuery;
}

124
types/materialize-css/chips.d.ts vendored Normal file
View File

@ -0,0 +1,124 @@
/// <reference path="./common.d.ts" />
/// <reference path="./autocomplete.d.ts" />
declare namespace M {
class Chips extends Component<ChipsOptions> {
/**
* Get Instance
*/
static getInstance(elem: Element): Chips;
/**
* Init Chips
*/
static init(els: Element, options?: Partial<ChipsOptions>): Chips;
/**
* Init Chipses
*/
static init(els: MElements, options?: Partial<ChipsOptions>): Chips[];
/**
* Array of the current chips data
*/
chipsData: ChipData[];
/**
* If the chips has autocomplete enabled
*/
hasAutocomplete: boolean;
/**
* Autocomplete instance, if any
*/
autocomplete: Autocomplete;
/**
* Add chip to input
* @param data Chip data object
*/
addChip(chip: ChipData): void;
/**
* Delete nth chip
* @param n Index of chip
*/
deleteChip(n?: number): void;
/**
* Select nth chip
* @param n Index of chip
*/
selectChip(n: number): void;
}
interface ChipData {
/**
* Chip tag
*/
tag: string;
/**
* Chip image
*/
img?: string;
}
interface ChipsOptions {
/**
* Set the chip data
* @default []
*/
data: ChipData[];
/**
* Set first placeholder when there are no tags
* @default ''
*/
placeholder: string;
/**
* Set second placeholder when adding additional tags
* @default ''
*/
secondaryPlaceholder: string;
/**
* Set autocomplete options
* @default {}
*/
autocompleteOptions: Partial<AutocompleteOptions>;
/**
* Set chips limit
* @default Infinity
*/
limit: number;
/**
* Callback for chip add
* @default null
*/
onChipAdd: (this: Chips, element: Element, chip: Element) => void;
/**
* Callback for chip select
* @default null
*/
onChipSelect: (this: Chips, element: Element, chip: Element) => void;
/**
* Callback for chip delete
* @default null
*/
onChipDelete: (this: Chips, element: Element, chip: Element) => void;
}
}
interface JQuery {
chips(method: keyof Pick<M.Chips, "destroy">): JQuery;
chips(method: keyof Pick<M.Chips, "addChip">, chip: M.ChipData): JQuery;
chips(method: keyof Pick<M.Chips, "deleteChip">, n?: number): JQuery;
chips(method: keyof Pick<M.Chips, "selectChip">, n: number): JQuery;
chips(options?: Partial<M.ChipsOptions>): JQuery;
}

83
types/materialize-css/collapsible.d.ts vendored Normal file
View File

@ -0,0 +1,83 @@
/// <reference path="./common.d.ts" />
declare namespace M {
class Collapsible extends Component<CollapsibleOptions> {
/**
* Get Instance
*/
static getInstance(elem: Element): Collapsible;
/**
* Init Collapsible
*/
static init(els: Element, options?: Partial<CollapsibleOptions>): Collapsible;
/**
* Init Collapsibles
*/
static init(els: MElements, options?: Partial<CollapsibleOptions>): Collapsible[];
/**
* Open collapsible section
* @param n Nth section to open
*/
open(n: number): void;
/**
* Close collapsible section
* @param n Nth section to close
*/
close(n: number): void;
}
interface CollapsibleOptions {
/**
* If accordion versus collapsible
* @default true
*/
accordion: boolean;
/**
* Transition in duration in milliseconds.
* @default 300
*/
inDuration: number;
/**
* Transition out duration in milliseconds.
* @default 300
*/
outDuration: number;
/**
* Callback function called before modal is opened
* @default null
*/
onOpenStart: (this: Collapsible, el: Element) => void;
/**
* Callback function called after modal is opened
* @default null
*/
onOpenEnd: (this: Collapsible, el: Element) => void;
/**
* Callback function called before modal is closed
* @default null
*/
onCloseStart: (this: Collapsible, el: Element) => void;
/**
* Callback function called after modal is closed
* @default null
*/
onCloseEnd: (this: Collapsible, el: Element) => void;
}
}
interface JQuery {
collapsible(method: keyof Pick<M.Collapsible, "destroy">): JQuery;
collapsible(method: keyof Pick<M.Collapsible, "open">, n: number): JQuery;
collapsible(method: keyof Pick<M.Collapsible, "close">, n: number): JQuery;
collapsible(options?: Partial<M.CollapsibleOptions>): JQuery;
}

51
types/materialize-css/common.d.ts vendored Normal file
View File

@ -0,0 +1,51 @@
/// <reference types="jquery"/>
/// <reference types="cash"/>
type MElements = NodeListOf<Element> | JQuery | Cash;
declare namespace M {
abstract class Component<TOptions> extends ComponentBase<TOptions> {
/**
* Construct component instance and set everything up
*/
constructor(elem: Element, options?: Partial<TOptions>);
/**
* Destroy plugin instance and teardown
*/
destroy(): void;
}
abstract class ComponentBase<TOptions> {
constructor(options?: Partial<TOptions>);
/**
* The DOM element the plugin was initialized with
*/
el: Element;
/**
* The options the instance was initialized with
*/
options: TOptions;
}
interface Openable {
isOpen: boolean;
open(): void;
close(): void;
}
interface InternationalizationOptions {
cancel: string;
clear: string;
done: string;
previousMonth: string;
nextMonth: string;
months: string[];
monthsShort: string;
weekdays: string[];
weekdaysShort: string[];
weekdaysAbbrev: string[];
}
}

201
types/materialize-css/datepicker.d.ts vendored Normal file
View File

@ -0,0 +1,201 @@
/// <reference path="./common.d.ts" />
declare namespace M {
class Datepicker extends Component<DatepickerOptions> implements Openable {
/**
* Get Instance
*/
static getInstance(elem: Element): Datepicker;
/**
* Init Datepicker
*/
static init(els: Element, options?: Partial<DatepickerOptions>): Datepicker;
/**
* Init Datepickers
*/
static init(els: MElements, options?: Partial<DatepickerOptions>): Datepicker[];
/**
* If the picker is open.
*/
isOpen: boolean;
/**
* The selected Date.
*/
date: Date;
/**
* DONE button instance (undocumented!).
*/
doneBtn: HTMLButtonElement;
/**
* CLEAR button instance (undocumented!).
*/
clearBtn: HTMLButtonElement;
/**
* Open datepicker
*/
open(): void;
/**
* Close datepicker
*/
close(): void;
/**
* Gets a string representation of the selected date
*/
toString(): string;
/**
* Set a date on the datepicker
* @param date Date to set on the datepicker.
* @param preventOnSelect Undocumented as of 5 March 2018
*/
setDate(date?: Date | string, preventOnSelect?: boolean): void;
/**
* Change date view to a specific date on the datepicker
* @param date Date to show on the datepicker.
*/
gotoDate(date: Date): void;
setInputValue(): void;
}
interface DatepickerOptions {
/**
* Automatically close picker when date is selected
* @default false
*/
autoClose: boolean;
/**
* The date output format for the input field value.
* @default 'mmm dd, yyyy'
*/
format: string;
/**
* Used to create date object from current input string.
*/
parse: (value: string, format: string) => Date;
/**
* The initial date to view when first opened.
*/
defaultDate: Date;
/**
* Make the `defaultDate` the initial selected value
* @default false
*/
setDefaultDate: boolean;
/**
* Prevent selection of any date on the weekend.
* @default false
*/
disableWeekends: boolean;
/**
* Custom function to disable certain days.
*/
disableDayFn: (day: Date) => boolean;
/**
* First day of week (0: Sunday, 1: Monday etc).
* @default 0
*/
firstDay: number;
/**
* The earliest date that can be selected.
*/
minDate: Date;
/**
* The latest date that can be selected.
*/
maxDate: Date;
/**
* Number of years either side, or array of upper/lower range.
* @default 10
*/
yearRange: number | number[];
/**
* Changes Datepicker to RTL.
* @default false
*/
isRTL: boolean;
/**
* Show month after year in Datepicker title.
* @default false
*/
showMonthAfterYear: boolean;
/**
* Render days of the calendar grid that fall in the next or previous month.
* @default false
*/
showDaysInNextAndPreviousMonths: boolean;
/**
* Specify a DOM element to render the calendar in, by default it will be placed before the input
* @default null
*/
container: Element;
/**
* Show the clear button in the datepicker
* @default false
*/
showClearBtn: boolean;
/**
* Internationalization options
*/
i18n: Partial<InternationalizationOptions>;
/**
* An array of string returned by `Date.toDateString()`, indicating there are events in the specified days.
* @default []
*/
events: string[];
/**
* Callback function when date is selected, first parameter is the newly selected date.
*/
onSelect: (this: Datepicker, selectedDate: Date) => void;
/**
* Callback function when Datepicker is opened
*/
onOpen: (this: Datepicker) => void;
/**
* Callback function when Datepicker is closed
*/
onClose: (this: Datepicker) => void;
/**
* Callback function when Datepicker HTML is refreshed
*/
onDraw: (this: Datepicker) => void;
}
}
interface JQuery {
datepicker(method: keyof Pick<M.Datepicker, "open" | "close" | "destroy">): JQuery;
datepicker(method: keyof Pick<M.Datepicker, "setDate">, date?: Date): JQuery;
datepicker(method: keyof Pick<M.Datepicker, "gotoDate">, date: Date): JQuery;
datepicker(options?: Partial<M.DatepickerOptions>): JQuery;
}

145
types/materialize-css/dropdown.d.ts vendored Normal file
View File

@ -0,0 +1,145 @@
/// <reference path="./common.d.ts" />
declare namespace M {
class Dropdown extends Component<DropdownOptions> {
/**
* Get Instance
*/
static getInstance(elem: Element): Dropdown;
/**
* Init Dropdown
*/
static init(els: Element, options?: Partial<DropdownOptions>): Dropdown;
/**
* Init Dropdowns
*/
static init(els: MElements, options?: Partial<DropdownOptions>): Dropdown[];
/**
* ID of the dropdown element
*/
id: string;
/**
* The DOM element of the dropdown
*/
dropdownEl: Element;
/**
* If the dropdown is open
*/
isOpen: boolean;
/**
* If the dropdown content is scrollable
*/
isScrollable: boolean;
/**
* The index of the item focused
*/
focusedIndex: number;
/**
* Open dropdown
*/
open(): void;
/**
* Close dropdown
*/
close(): void;
/**
* While dropdown is open, you can recalculate its dimensions if its contents have changed
*/
recalculateDimensions(): void;
}
interface DropdownOptions {
/**
* Defines the edge the menu is aligned to
* @default 'left'
*/
alignment: 'left' | 'right';
/**
* If true, automatically focus dropdown el for keyboard
* @default true
*/
autoTrigger: boolean;
/**
* If true, constrainWidth to the size of the dropdown activator
* @default true
*/
constrainWidth: boolean;
/**
* Provide an element that will be the bounding container of the dropdown
* @default null
*/
container: Element;
/**
* If false, the dropdown will show below the trigger
* @default true
*/
coverTrigger: boolean;
/**
* If true, close dropdown on item click
* @default true
*/
closeOnClick: boolean;
/**
* If true, the dropdown will open on hover
* @default false
*/
hover: boolean;
/**
* The duration of the transition enter in milliseconds
* @default 150
*/
inDuration: number;
/**
* The duration of the transition out in milliseconds
* @default 250
*/
outDuration: number;
/**
* Function called when dropdown starts entering
* @default null
*/
onOpenStart: (this: Dropdown, el: Element) => void;
/**
* Function called when dropdown finishes entering
* @default null
*/
onOpenEnd: (this: Dropdown, el: Element) => void;
/**
* Function called when dropdown starts exiting
* @default null
*/
onCloseStart: (this: Dropdown, el: Element) => void;
/**
* Function called when dropdown finishes exiting
* @default null
*/
onCloseEnd: (this: Dropdown, el: Element) => void;
}
}
interface JQuery {
dropdown(method: keyof Pick<M.Dropdown, "recalculateDimensions" | "open" | "close" | "destroy">): JQuery;
dropdown(options?: Partial<M.DropdownOptions>): JQuery;
}

60
types/materialize-css/fab.d.ts vendored Normal file
View File

@ -0,0 +1,60 @@
/// <reference path="./common.d.ts" />
declare namespace M {
class FloatingActionButton extends Component<FloatingActionButtonOptions> implements Openable {
/**
* Get Instance
*/
static getInstance(elem: Element): FloatingActionButton;
/**
* Init FloatingActionButton
*/
static init(els: Element, options?: Partial<FloatingActionButtonOptions>): FloatingActionButton;
/**
* Init FloatingActionButtons
*/
static init(els: MElements, options?: Partial<FloatingActionButtonOptions>): FloatingActionButton[];
/**
* Open FAB
*/
open(): void;
/**
* Close FAB
*/
close(): void;
/**
* Describes open/close state of FAB.
*/
isOpen: boolean;
}
interface FloatingActionButtonOptions {
/**
* Direction FAB menu opens
* @default "top"
*/
direction: "top" | "right" | "buttom" | "left";
/**
* true: FAB menu appears on hover, false: FAB menu appears on click
* @default true
*/
hoverEnabled: boolean;
/**
* Enable transit the FAB into a toolbar on click
* @default false
*/
toolbarEnabled: boolean;
}
}
interface JQuery {
floatingActionButton(method: keyof Pick<M.FloatingActionButton, "open" | "close" | "destroy">): JQuery;
floatingActionButton(options?: Partial<M.FloatingActionButtonOptions>): JQuery;
}

70
types/materialize-css/formselect.d.ts vendored Normal file
View File

@ -0,0 +1,70 @@
/// <reference path="./common.d.ts" />
/// <reference path="./dropdown.d.ts" />
declare namespace M {
class FormSelect extends Component<FormSelectOptions> {
/**
* Get Instance
*/
static getInstance(elem: Element): FormSelect;
/**
* Init FormSelect
*/
static init(els: Element, options?: Partial<FormSelectOptions>): FormSelect;
/**
* Init FormSelects
*/
static init(els: MElements, options?: Partial<FormSelectOptions>): FormSelect[];
/**
* If this is a multiple select
*/
isMultiple: boolean;
/**
* The select wrapper element
*/
wrapper: Element;
/**
* Dropdown UL element
*/
dropdownOptions: HTMLUListElement;
/**
* Text input that shows current selected option
*/
input: HTMLInputElement;
/**
* Instance of the dropdown plugin for this select
*/
dropdown: Dropdown;
/**
* Get selected values in an array
*/
getSelectedValues(): string[];
}
interface FormSelectOptions {
/**
* Classes to be added to the select wrapper element
* @default ''
*/
classes: string;
/**
* Pass options object to select dropdown initialization
* @default {}
*/
dropdownOptions: Partial<DropdownOptions>;
}
}
interface JQuery {
formSelect(method: keyof Pick<M.FormSelect, "getSelectedValues" | "destroy">): JQuery;
formSelect(options?: Partial<M.FormSelectOptions>): JQuery;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
/// <reference path="./common.d.ts" />
declare namespace M {
function updateTextFields(): void;
function textareaAutoResize(textarea: Element | JQuery | Cash): void;
}

98
types/materialize-css/materialbox.d.ts vendored Normal file
View File

@ -0,0 +1,98 @@
/// <reference path="./common.d.ts" />
declare namespace M {
class Materialbox extends Component<MaterialboxOptions> {
/**
* Get Instance
*/
static getInstance(elem: Element): Materialbox;
/**
* Init Materialbox
*/
static init(els: Element, options?: Partial<MaterialboxOptions>): Materialbox;
/**
* Init Materialboxes
*/
static init(els: MElements, options?: Partial<MaterialboxOptions>): Materialbox[];
/**
* If the materialbox overlay is showing
*/
overlayActive: boolean;
/**
* If the materialbox is no longer being animated
*/
doneAnimating: boolean;
/**
* Caption if specified
*/
caption: string;
/**
* Original width of image
*/
originalWidth: number;
/**
* Original height of image
*/
originalHeight: number;
/**
* Open materialbox
*/
open(): void;
/**
* Close materialbox
*/
close(): void;
}
interface MaterialboxOptions {
/**
* Transition in duration in milliseconds
* @default 275
*/
inDuration: number;
/**
* Transition out duration in milliseconds
* @default 200
*/
outDuration: number;
/**
* Callback function called before materialbox is opened
* @default null
*/
onOpenStart: (this: Materialbox, el: Element) => void;
/**
* Callback function called after materialbox is opened
* @default null
*/
onOpenEnd: (this: Materialbox, el: Element) => void;
/**
* Callback function called before materialbox is closed
* @default null
*/
onCloseStart: (this: Materialbox, el: Element) => void;
/**
* Callback function called after materialbox is closed
* @default null
*/
onCloseEnd: (this: Materialbox, el: Element) => void;
}
}
interface JQuery {
materialbox(method: keyof Pick<M.Materialbox, "destroy" | "open" | "close">): JQuery;
materialbox(options?: Partial<M.MaterialboxOptions>): JQuery;
}

116
types/materialize-css/modal.d.ts vendored Normal file
View File

@ -0,0 +1,116 @@
/// <reference path="./common.d.ts" />
declare namespace M {
class Modal extends Component<ModalOptions> implements Openable {
/**
* Get Instance
*/
static getInstance(elem: Element): Modal;
/**
* Init Modal
*/
static init(els: Element, options?: Partial<ModalOptions>): Modal;
/**
* Init Modals
*/
static init(els: MElements, options?: Partial<ModalOptions>): Modal[];
/**
* Open modal
*/
open(): void;
/**
* Close modal
*/
close(): void;
/**
* If the modal is open.
*/
isOpen: boolean;
/**
* ID of the modal element
*/
id: string;
}
/**
* Options for the Modal
*/
interface ModalOptions {
/**
* Opacity of the modal overlay.
* @default 0.5
*/
opacity: number;
/**
* Transition in duration in milliseconds.
* @default 250
*/
inDuration: number;
/**
* Transition out duration in milliseconds.
* @default 250
*/
outDuration: number;
/**
* Prevent page from scrolling while modal is open
* @default true
*/
preventScrolling: boolean;
/**
* Callback function called before modal is opened
* @default null
*/
onOpenStart: (this: Modal, el: Element) => void;
/**
* Callback function called after modal is opened
* @default null
*/
onOpenEnd: (this: Modal, el: Element) => void;
/**
* Callback function called before modal is closed
* @default null
*/
onCloseStart: (this: Modal, el: Element) => void;
/**
* Callback function called after modal is closed
* @default null
*/
onCloseEnd: (this: Modal, el: Element) => void;
/**
* Allow modal to be dismissed by keyboard or overlay click.
* @default true
*/
dismissible: boolean;
/**
* Starting top offset
* @default '4%'
*/
startingTop: string;
/**
* Ending top offset
* @default '10%'
*/
endingTop: string;
}
}
interface JQuery {
modal(method: keyof Pick<M.Modal, "open" | "close" | "destroy">): JQuery;
modal(options?: Partial<M.ModalOptions>): JQuery;
}

33
types/materialize-css/parallax.d.ts vendored Normal file
View File

@ -0,0 +1,33 @@
/// <reference path="./common.d.ts" />
declare namespace M {
class Parallax extends Component<ParallaxOptions> {
/**
* Get Instance
*/
static getInstance(elem: Element): Parallax;
/**
* Init Parallax
*/
static init(els: Element, options?: Partial<ParallaxOptions>): Parallax;
/**
* Init Parallaxs
*/
static init(els: MElements, options?: Partial<ParallaxOptions>): Parallax[];
}
interface ParallaxOptions {
/**
* The minimum width of the screen, in pixels, where the parallax functionality starts working
* @default 0
*/
responsiveThreshold: number;
}
}
interface JQuery {
parallax(options?: Partial<M.ParallaxOptions>): JQuery;
parallax(method: keyof Pick<M.Parallax, "destroy">): JQuery;
}

56
types/materialize-css/pushpin.d.ts vendored Normal file
View File

@ -0,0 +1,56 @@
/// <reference path="./common.d.ts" />
declare namespace M {
class Pushpin extends Component<PushpinOptions> {
/**
* Get Instance
*/
static getInstance(elem: Element): Pushpin;
/**
* Init Pushpin
*/
static init(els: Element, options?: Partial<PushpinOptions>): Pushpin;
/**
* Init Pushpins
*/
static init(els: MElements, options?: Partial<PushpinOptions>): Pushpin[];
/**
* Original offsetTop of element
*/
originalOffset: number;
}
interface PushpinOptions {
/**
* The distance in pixels from the top of the page where the element becomes fixed
* @default 0
*/
top: number;
/**
* The distance in pixels from the top of the page where the elements stops being fixed
* @default Infinity
*/
bottom: number;
/**
* The offset from the top the element will be fixed at
* @default 0
*/
offset: number;
/**
* Callback function called when pushpin position changes. You are provided with a position string
* @default null
*/
onPositionChange: (this: Pushpin, position: "pinned" | "pin-top" | "pin-bottom") => void;
}
}
interface JQuery {
pushpin(options?: Partial<M.PushpinOptions>): JQuery;
pushpin(method: keyof Pick<M.Pushpin, "destroy">): JQuery;
}

25
types/materialize-css/range.d.ts vendored Normal file
View File

@ -0,0 +1,25 @@
/// <reference path="./common.d.ts" />
declare namespace M {
class Range extends Component<undefined> {
/**
* Get Instance
*/
static getInstance(elem: Element): Range;
/**
* Init Range
*/
static init(els: Element, options?: Partial<undefined>): Range;
/**
* Init Ranges
*/
static init(els: MElements, options?: Partial<undefined>): Range[];
}
}
interface JQuery {
range(): JQuery;
range(method: keyof Pick<M.Range, "destroy">): JQuery;
}

51
types/materialize-css/scrollspy.d.ts vendored Normal file
View File

@ -0,0 +1,51 @@
/// <reference path="./common.d.ts" />
declare namespace M {
class ScrollSpy extends Component<ScrollSpyOptions> {
/**
* Get Instance
*/
static getInstance(elem: Element): ScrollSpy;
/**
* Init ScrollSpy
*/
static init(els: Element, options?: Partial<ScrollSpyOptions>): ScrollSpy;
/**
* Init ScrollSpies
*/
static init(els: MElements, options?: Partial<ScrollSpyOptions>): ScrollSpy[];
}
interface ScrollSpyOptions {
/**
* Throttle of scroll handler
* @default 100
*/
throttle: number;
/**
* Offset for centering element when scrolled to
* @default 200
*/
scrollOffset: number;
/**
* Class applied to active elements
* @default 'active'
*/
activeClass: string;
/**
* Used to find active element
* @default id => 'a[href="#' + id + '"]'
*/
getActiveElement: (id: string) => string;
}
}
interface JQuery {
scrollSpy(options?: Partial<M.ScrollSpyOptions>): JQuery;
scrollSpy(method: keyof Pick<M.ScrollSpy, "destroy">): JQuery;
}

99
types/materialize-css/sidenav.d.ts vendored Normal file
View File

@ -0,0 +1,99 @@
/// <reference path="./common.d.ts" />
declare namespace M {
class Sidenav extends Component<SidenavOptions> implements Openable {
/**
* Get Instance
*/
static getInstance(elem: Element): Sidenav;
/**
* Init Sidenav
*/
static init(els: Element, options?: Partial<SidenavOptions>): Sidenav;
/**
* Init Sidenavs
*/
static init(els: MElements, options?: Partial<SidenavOptions>): Sidenav[];
/**
* Opens Sidenav
*/
open(): void;
/**
* Closes Sidenav
*/
close(): void;
/**
* Describes open/close state of Sidenav
*/
isOpen: boolean;
/**
* Describes if sidenav is fixed
*/
isFixed: boolean;
/**
* Describes if Sidenav is being dragged
*/
isDragged: boolean;
}
/**
* Options for the Sidenav
*/
interface SidenavOptions {
/**
* Side of screen on which Sidenav appears
* @default 'left'
*/
edge: 'left' | 'right';
/**
* Allow swipe gestures to open/close Sidenav
* @default true
*/
draggable: boolean;
/**
* Length in ms of enter transition
* @default 250
*/
inDuration: number;
/**
* Length in ms of exit transition
* @default 200
*/
outDuration: number;
/**
* Function called when sidenav starts entering
*/
onOpenStart: (this: Sidenav, elem: Element) => void;
/**
* Function called when sidenav finishes entering
*/
onOpenEnd: (this: Sidenav, elem: Element) => void;
/**
* Function called when sidenav starts exiting
*/
onCloseStart: (this: Sidenav, elem: Element) => void;
/**
* Function called when sidenav finishes exiting
*/
onCloseEnd: (this: Sidenav, elem: Element) => void;
}
}
interface JQuery {
sidenav(method: keyof Pick<M.Sidenav, "open" | "close" | "destroy">): JQuery;
sidenav(options?: Partial<M.SidenavOptions>): JQuery;
}

86
types/materialize-css/slider.d.ts vendored Normal file
View File

@ -0,0 +1,86 @@
/// <reference path="./common.d.ts" />
declare namespace M {
class Slider extends Component<SliderOptions> {
/**
* Get Instance
*/
static getInstance(elem: Element): Slider;
/**
* Init Slider
*/
static init(els: Element, options?: Partial<SliderOptions>): Slider;
/**
* Init Sliders
*/
static init(els: MElements, options?: Partial<SliderOptions>): Slider[];
/**
* ID of the dropdown element
*/
el: Element;
/**
* ID of the dropdown element
*/
options: SliderOptions;
/**
* Index of current slide
*/
activeIndex: number;
/**
* Pause slider autoslide
*/
pause(): void;
/**
* Start slider autoslide
*/
start(): void;
/**
* Move to next slider
*/
next(): void;
/**
* Move to prev slider
*/
prev(): void;
}
interface SliderOptions {
/**
* Set to false to hide slide indicators
* @default true
*/
indicators: boolean;
/**
* Set height of slider
* @default 400
*/
height: number;
/**
* Set the duration of the transition animation in ms
* @default 500
*/
duration: number;
/**
* Set the duration between transitions in ms
* @default 6000
*/
interval: number;
}
}
interface JQuery {
slider(method: keyof Pick<M.Slider, "pause" | "start" | "next" | "prev" | "destroy">): JQuery;
slider(options?: Partial<M.SliderOptions>): JQuery;
}

70
types/materialize-css/tabs.d.ts vendored Normal file
View File

@ -0,0 +1,70 @@
/// <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;
}

54
types/materialize-css/taptarget.d.ts vendored Normal file
View File

@ -0,0 +1,54 @@
/// <reference path="./common.d.ts" />
declare namespace M {
class TapTarget extends Component<TapTargetOptions> {
/**
* Get Instance
*/
static getInstance(elem: Element): TapTarget;
/**
* Init TapTarget
*/
static init(els: Element, options?: Partial<TapTargetOptions>): TapTarget;
/**
* Init TapTargets
*/
static init(els: MElements, options?: Partial<TapTargetOptions>): TapTarget[];
/**
* If the tap target is open
*/
isOpen: boolean;
/**
* Open Tap Target
*/
open(): void;
/**
* Close Tap Target
*/
close(): void;
}
interface TapTargetOptions {
/**
* Callback function called when Tap Target is opened
* @default null
*/
onOpen: (this: TapTarget, origin: Element) => void;
/**
* Callback function called when Tap Target is closed
* @default null
*/
onClose: (this: TapTarget, origin: Element) => void;
}
}
interface JQuery {
tapTarget(method: keyof Pick<M.TapTarget, "open" | "close" | "destroy">): JQuery;
tapTarget(options?: Partial<M.TapTargetOptions>): JQuery;
}

View File

@ -0,0 +1,55 @@
import * as materialize from "materialize-css";
const elem = document.querySelector('.whatever')!;
// $ExpectType Autocomplete
const _autocomplete = new M.Autocomplete(elem);
// $ExpectType Autocomplete
const el = M.Autocomplete.init(elem);
// $ExpectType Autocomplete[]
const els = M.Autocomplete.init(document.querySelectorAll('.whatever'));
// $ExpectType Autocomplete
new materialize.Autocomplete(elem);
// $ExpectType Autocomplete
const autocomplete = new materialize.Autocomplete(elem, {
data: {
Apple: null,
Google: "https://placehold.it/250x250"
},
minLength: 3,
limit: 3,
onAutocomplete(text) {
// $ExpectType Autocomplete
this;
// $ExpectType string
text;
},
sortFunction(a, b, input) {
// $ExpectType string
a;
// $ExpectType string
b;
// $ExpectType string
input;
return 0;
}
});
// $ExpectType void
autocomplete.updateData({ Microsoft: null });
// $ExpectType void
autocomplete.destroy();
// $ExpectType AutocompleteOptions
autocomplete.options;
// $ExpectType Element
autocomplete.el;
// $ExpectType boolean
autocomplete.isOpen;
$(".whatever").autocomplete({
data: {
Apple: null,
Google: "https://placehold.it/250x250"
}
});
$(".whatever").autocomplete("updateData", { Microsoft: null });

View File

@ -0,0 +1,53 @@
import * as materialize from "materialize-css";
const elem = document.querySelector('.whatever')!;
// $ExpectType Carousel
const _carousel = new M.Carousel(elem);
// $ExpectType Carousel
const el = M.Carousel.init(elem);
// $ExpectType Carousel[]
const els = M.Carousel.init(document.querySelectorAll('.whatever'));
// $ExpectType Carousel
const carousel = new materialize.Carousel(elem, {
dist: 1,
duration: 1,
fullWidth: true,
indicators: true,
noWrap: true,
numVisible: 10,
onCycleTo(current, dragged) {
// $ExpectType Element
current;
// $ExpectType boolean
dragged;
},
padding: 1,
shift: 1
});
// $ExpectType number
carousel.center;
// $ExpectType number
carousel.dragged;
// $ExpectType Element
carousel.el;
// $ExpectType CarouselOptions
carousel.options;
// $ExpectType boolean
carousel.pressed;
// $ExpectType void
carousel.destroy();
// $ExpectType void
carousel.next(1);
// $ExpectType void
carousel.prev(1);
// $ExpectType void
carousel.set(2);
$(".whatever").carousel();
$(".whatever").carousel("destroy");
$(".whatever").carousel("next", 1);
$(".whatever").carousel("prev", 1);
$(".whatever").carousel("set", 1);

View File

@ -0,0 +1,20 @@
import * as materialize from "materialize-css";
const elem = document.querySelector('.whatever')!;
// $ExpectType CharacterCounter
const _characterCounter = new M.CharacterCounter(elem);
// $ExpectType CharacterCounter
const el = M.CharacterCounter.init(elem);
// $ExpectType CharacterCounter[]
const els = M.CharacterCounter.init(document.querySelectorAll('.whatever'));
// $ExpectType CharacterCounter
const characterCounter = new materialize.CharacterCounter(elem);
// $ExpectType void
characterCounter.destroy();
// $ExpectType Element
characterCounter.el;
$(".whatever").characterCounter();
$(".whatever").characterCounter("destroy");

View File

@ -0,0 +1,40 @@
import * as materialize from "materialize-css";
const elem = document.querySelector('.whatever')!;
// $ExpectType Chips
const _chips = new M.Chips(elem);
// $ExpectType Chips
const el = M.Chips.init(elem);
// $ExpectType Chips[]
const els = M.Chips.init(document.querySelectorAll('.whatever'));
// $ExpectType Chips
const chips = new materialize.Chips(elem, {
data: [{ tag: "tag" }],
onChipAdd() { },
onChipDelete() { },
onChipSelect() { }
});
// $ExpectType void
chips.addChip({ tag: "tag" });
// $ExpectType void
chips.deleteChip(1);
// $ExpectType void
chips.destroy();
// $ExpectType void
chips.selectChip(1);
// $ExpectType Autocomplete
chips.autocomplete;
// $ExpectType ChipData[]
chips.chipsData;
// $ExpectType Element
chips.el;
// $ExpectType boolean
chips.hasAutocomplete;
// $ExpectType ChipsOptions
chips.options;
$(".whatever").chips({ data: [{ tag: "tag" }] });
$(".whatever").chips("destroy");

View File

@ -0,0 +1,49 @@
import * as materialize from "materialize-css";
const elem = document.querySelector('.whatever')!;
// $ExpectType Collapsible
const _collapsible = new M.Collapsible(elem);
// $ExpectType Collapsible
const el = M.Collapsible.init(elem);
// $ExpectType Collapsible[]
const els = M.Collapsible.init(document.querySelectorAll('.whatever'));
// $ExpectType Collapsible
const collapsible = new materialize.Collapsible(elem, {
accordion: true,
inDuration: 1,
outDuration: 1,
onCloseEnd(el) {
// $ExpectType Element
el;
},
onCloseStart(el) {
// $ExpectType Element
el;
},
onOpenEnd(el) {
// $ExpectType Element
el;
},
onOpenStart(el) {
// $ExpectType Element
el;
}
});
// $ExpectType void
collapsible.close(1);
// $ExpectType void
collapsible.destroy();
// $ExpectType void
collapsible.open(1);
// $ExpectType Element
collapsible.el;
// $ExpectType CollapsibleOptions
collapsible.options;
$(".whatever").collapsible();
$(".whatever").collapsible("destroy");
$(".whatever").collapsible("open", 1);
$(".whatever").collapsible("close", 1);

View File

@ -0,0 +1,13 @@
import * as M from "materialize-css";
import * as jQuery from "jquery";
// Test Component Initialization
// $ExpectType Autocomplete
M.Autocomplete.init(document.querySelector('.whatever')!);
// $ExpectType Autocomplete[]
M.Autocomplete.init(document.querySelectorAll('.whatever'));
// $ExpectType Autocomplete[]
M.Autocomplete.init(jQuery('.whatever'));
// $ExpectType Autocomplete[]
M.Autocomplete.init(cash('.whatever'));

View File

@ -0,0 +1,42 @@
import * as materialize from "materialize-css";
const elem = document.querySelector('.whatever')!;
// $ExpectType Datepicker
const _datePicker = new M.Datepicker(elem);
// $ExpectType Datepicker
const el = M.Datepicker.init(elem);
// $ExpectType Datepicker[]
const els = M.Datepicker.init(document.querySelectorAll('.whatever'));
// $ExpectType Datepicker
new materialize.Datepicker(elem);
// $ExpectType Datepicker
const datePicker = new materialize.Datepicker(elem, {
defaultDate: new Date(),
onSelect(date) {
// $ExpectType Datepicker
this;
// $ExpectType Date
date;
}
});
// $ExpectType void
datePicker.open();
// $ExpectType void
datePicker.setDate(new Date());
// $ExpectType void
datePicker.destroy();
// $ExpectType DatepickerOptions
datePicker.options;
// $ExpectType Element
datePicker.el;
// $ExpectType boolean
datePicker.isOpen;
$(".whatever").datepicker();
$(".whatever").datepicker({ defaultDate: new Date() });
$(".whatever").datepicker("open");
$(".whatever").datepicker("destroy");
$(".whatever").datepicker("setDate", new Date());
$(".whatever").datepicker("gotoDate", new Date());

View File

@ -0,0 +1,46 @@
import * as materialize from "materialize-css";
const elem = document.querySelector('.whatever')!;
// $ExpectType Dropdown
const _dropdown = new M.Dropdown(elem);
// $ExpectType Dropdown
const el = M.Dropdown.init(elem);
// $ExpectType Dropdown[]
const els = M.Dropdown.init(document.querySelectorAll('.whatever'));
// $ExpectType Dropdown
new materialize.Dropdown(elem);
// $ExpectType Dropdown
const dropdown = new materialize.Dropdown(elem, {
alignment: "left"
});
// $ExpectType void
dropdown.open();
// $ExpectType void
dropdown.close();
// $ExpectType void
dropdown.destroy();
// $ExpectType void
dropdown.recalculateDimensions();
// $ExpectType Element
dropdown.dropdownEl;
// $ExpectType Element
dropdown.el;
// $ExpectType number
dropdown.focusedIndex;
// $ExpectType string
dropdown.id;
// $ExpectType boolean
dropdown.isOpen;
// $ExpectType boolean
dropdown.isScrollable;
// $ExpectType DropdownOptions
dropdown.options;
$(".whatever").dropdown();
$(".whatever").dropdown({ alignment: "left" });
$(".whatever").dropdown("open");
$(".whatever").dropdown("close");
$(".whatever").dropdown("destroy");
$(".whatever").dropdown("recalculateDimensions");

View File

@ -0,0 +1,32 @@
import * as materialize from "materialize-css";
const elem = document.querySelector('.whatever')!;
// $ExpectType FloatingActionButton
const _fab = new M.FloatingActionButton(elem);
// $ExpectType FloatingActionButton
const el = M.FloatingActionButton.init(elem);
// $ExpectType FloatingActionButton[]
const els = M.FloatingActionButton.init(document.querySelectorAll('.whatever'));
// $ExpectType FloatingActionButton
new materialize.FloatingActionButton(elem);
// $ExpectType FloatingActionButton
const fab = new materialize.FloatingActionButton(elem, {
direction: 'left'
});
// $ExpectType void
fab.open();
// $ExpectType void
fab.destroy();
// $ExpectType FloatingActionButtonOptions
fab.options;
// $ExpectType Element
fab.el;
// $ExpectType boolean
fab.isOpen;
$(".whatever").floatingActionButton();
$(".whatever").floatingActionButton({ direction: "left" });
$(".whatever").floatingActionButton("open");
$(".whatever").floatingActionButton("destroy");

View File

@ -0,0 +1,42 @@
import * as materialize from "materialize-css";
const elem = document.querySelector('.whatever')!;
// $ExpectType FormSelect
const _formselect = new M.FormSelect(elem);
// $ExpectType FormSelect
const el = M.FormSelect.init(elem);
// $ExpectType FormSelect[]
const els = M.FormSelect.init(document.querySelectorAll('.whatever'));
// $ExpectType FormSelect
new materialize.FormSelect(elem);
// $ExpectType FormSelect
const formSelect = new materialize.FormSelect(elem, {
classes: "whatever",
dropdownOptions: {
alignment: "left"
}
});
// $ExpectType string[]
formSelect.getSelectedValues();
// $ExpectType void
formSelect.destroy();
// $ExpectType FormSelectOptions
formSelect.options;
// $ExpectType Element
formSelect.el;
// $ExpectType Dropdown
formSelect.dropdown;
// $ExpectType HTMLUListElement
formSelect.dropdownOptions;
// $ExpectType HTMLInputElement
formSelect.input;
// $ExpectType boolean
formSelect.isMultiple;
// $ExpectType Element
formSelect.wrapper;
$(".whatever").formSelect();
$(".whatever").formSelect({ classes: "whatever" });
$(".whatever").formSelect("destroy");

View File

@ -0,0 +1,7 @@
import * as materialize from "materialize-css";
const elem = document.querySelector('.whatever')!;
M.textareaAutoResize(elem);
M.textareaAutoResize($(elem));
M.textareaAutoResize(cash(elem));

View File

@ -0,0 +1,49 @@
import * as materialize from "materialize-css";
const elem = document.querySelector('.whatever')!;
// $ExpectType Materialbox
const _materialbox = new M.Materialbox(elem);
// $ExpectType Materialbox
const el = M.Materialbox.init(elem);
// $ExpectType Materialbox[]
const els = M.Materialbox.init(document.querySelectorAll('.whatever'));
// $ExpectType Materialbox
const materialbox = new materialize.Materialbox(elem, {
inDuration: 1,
outDuration: 1,
onCloseEnd(el) {
// $ExpectType Element
el;
},
onCloseStart(el) {
// $ExpectType Element
el;
},
onOpenEnd(el) {
// $ExpectType Element
el;
},
onOpenStart(el) {
// $ExpectType Element
el;
}
});
// $ExpectType void
materialbox.close();
// $ExpectType void
materialbox.destroy();
// $ExpectType void
materialbox.open();
// $ExpectType Element
materialbox.el;
// $ExpectType MaterialboxOptions
materialbox.options;
$(".whatever").materialbox();
$(".whatever").materialbox({ inDuration: 2 });
$(".whatever").materialbox("open");
$(".whatever").materialbox("destroy");
$(".whatever").materialbox("close");

View File

@ -1,36 +0,0 @@
const elem = document.querySelector('.whatever')!;
// $ExpectType Sidenav
const sidenav = new M.Sidenav(elem);
// $ExpectType Tabs
const tabs = new M.Tabs(elem);
// $ExpectType Modal
const modal = new M.Modal(elem);
// $ExpectType Autocomplete
const autocomplete = new M.Autocomplete(elem);
// $ExpectType CharacterCounter
const characterCounter = new M.CharacterCounter(elem);
// $ExpectType Tooltip
const tooltips = new M.Tooltip(elem);
// $ExpectType FloatingActionButton
const fab = new M.FloatingActionButton(elem);
// $ExpectType Toast
const toast = M.toast({ html: 'I am a toast!' });
// $ExpectType DatePicker
const datePicker = new M.DatePicker(elem);
// $ExpectType TimePicker
const timePicker = new M.TimePicker(elem);
// $ExpectType Dropdown
const dropdown = new M.Dropdown(elem);
// $ExpectType FormSelect
const formSelect = new M.FormSelect(elem);

View File

@ -1,61 +0,0 @@
$(".whatever").sidenav();
$(".whatever").sidenav({ inDuration: 200 });
$(".whatever").sidenav("open");
$(".whatever").sidenav("destroy");
$(".whatever").tabs();
$(".whatever").tabs({ duration: 200 });
$(".whatever").tabs("destroy");
$(".whatever").tabs("select", "id");
$(".whatever").modal();
$(".whatever").modal({ inDuration: 200 });
$(".whatever").modal("open");
$(".whatever").modal("destroy");
$(".whatever").characterCounter();
$(".whatever").characterCounter("destroy");
$(".whatever").autocomplete({
data: {
Apple: null,
Google: "https://placehold.it/250x250"
}
});
$(".whatever").autocomplete("updateData", { Microsoft: null });
$(".whatever").tooltip();
$(".whatever").tooltip({ html: "<img/>" });
$(".whatever").tooltip("open");
$(".whatever").tooltip("destroy");
$(".whatever").floatingActionButton();
$(".whatever").floatingActionButton({ direction: "left" });
$(".whatever").floatingActionButton("open");
$(".whatever").floatingActionButton("destroy");
// Toast can not be invoked using jQuery.
$(".whatever").datepicker();
$(".whatever").datepicker({ defaultDate: new Date() });
$(".whatever").datepicker("open");
$(".whatever").datepicker("destroy");
$(".whatever").datepicker("setDate", new Date());
$(".whatever").datepicker("gotoDate", new Date());
$(".whatever").timepicker();
$(".whatever").timepicker({ defaultTime: "13:14" });
$(".whatever").timepicker("open");
$(".whatever").timepicker("destroy");
$(".whatever").timepicker("showView", "hours");
$(".whatever").formSelect();
$(".whatever").formSelect({ classes: "whatever" });
$(".whatever").formSelect("destroy");
$(".whatever").dropdown();
$(".whatever").dropdown({ alignment: "left" });
$(".whatever").dropdown("open");
$(".whatever").dropdown("close");
$(".whatever").dropdown("destroy");
$(".whatever").dropdown("recalculateDimensions");

View File

@ -1,277 +0,0 @@
import * as materialize from "materialize-css";
const elem = document.querySelector('.whatever')!;
// Sidenav
// $ExpectType Sidenav
new materialize.Sidenav(elem);
// $ExpectType Sidenav
const sidenav = new materialize.Sidenav(elem, {
edge: "left",
inDuration: 300,
onCloseStart(el) {
// $ExpectType Sidenav
this;
// $ExpectType Element
el;
}
});
// $ExpectType void
sidenav.open();
// $ExpectType void
sidenav.destroy();
// $ExpectType SidenavOptions
sidenav.options;
// $ExpectType Element
sidenav.el;
// $ExpectType boolean
sidenav.isOpen;
// Tabs
// $ExpectType Tabs
new materialize.Tabs(elem);
// $ExpectType Tabs
const tabs = new materialize.Tabs(elem, {
duration: 200,
onShow(content) {
// $ExpectType Tabs
this;
// $ExpectType Element
content;
}
});
// $ExpectType void
tabs.destroy();
// $ExpectType void
tabs.select("id");
// $ExpectType TabsOptions
tabs.options;
// $ExpectType Element
tabs.el;
// $ExpectType number
tabs.index;
// Modal
// $ExpectType Modal
new materialize.Modal(elem);
// $ExpectType Modal
const modal = new materialize.Modal(elem, {
inDuration: 300,
ready(el, trigger) {
// $ExpectType Modal
this;
// $ExpectType Element
el;
// $ExpectType Element
trigger;
}
});
// $ExpectType void
modal.open();
// $ExpectType void
modal.destroy();
// $ExpectType ModalOptions
modal.options;
// $ExpectType Element
modal.el;
// $ExpectType boolean
modal.isOpen;
// CharacterCounter
// $ExpectType CharacterCounter
const characterCounter = new materialize.CharacterCounter(elem);
// $ExpectType void
characterCounter.destroy();
// $ExpectType Element
characterCounter.el;
// Autocomplete
// $ExpectType Autocomplete
new materialize.Autocomplete(elem);
// $ExpectType Autocomplete
const autocomplete = new materialize.Autocomplete(elem, {
data: {
Apple: null,
Google: "https://placehold.it/250x250"
},
minLength: 3,
onAutocomplete(text) {
// $ExpectType Autocomplete
this;
// $ExpectType string
text;
},
sortFunction(a, b, input) {
// $ExpectType string
a;
// $ExpectType string
b;
// $ExpectType string
input;
return 0;
}
});
// $ExpectType void
autocomplete.updateData({ Microsoft: null });
// $ExpectType void
autocomplete.destroy();
// $ExpectType AutocompleteOptions
autocomplete.options;
// $ExpectType Element
autocomplete.el;
// $ExpectType boolean
autocomplete.isOpen;
// Tooltip
// $ExpectType Tooltip
new materialize.Tooltip(elem);
// $ExpectType Tooltip
const tooltip = new materialize.Tooltip(elem, {
inDuration: 300,
position: "right"
});
// $ExpectType void
tooltip.open();
// $ExpectType void
tooltip.destroy();
// $ExpectType TooltipOptions
tooltip.options;
// $ExpectType Element
tooltip.el;
// $ExpectType boolean
tooltip.isOpen;
// FloatingActionButton
// $ExpectType FloatingActionButton
new materialize.FloatingActionButton(elem);
// $ExpectType FloatingActionButton
const fab = new materialize.FloatingActionButton(elem, {
direction: 'left'
});
// $ExpectType void
fab.open();
// $ExpectType void
fab.destroy();
// $ExpectType FloatingActionButtonOptions
fab.options;
// $ExpectType Element
fab.el;
// $ExpectType boolean
fab.isOpen;
// Toasts
// $ExpectType Toast
const toast = materialize.toast({ html: 'I am a toast!' });
// $ExpectType ToastOptions
toast.options;
// $ExpectType Element
fab.el;
// $ExpectType void
toast.dismiss();
// $ExpectType void
materialize.Toast.dismissAll();
// DatePicker
// $ExpectType DatePicker
new materialize.DatePicker(elem);
// $ExpectType DatePicker
const datePicker = new materialize.DatePicker(elem, {
defaultDate: new Date(),
onSelect(date) {
// $ExpectType DatePicker
this;
// $ExpectType Date
date;
}
});
// $ExpectType void
datePicker.open();
// $ExpectType void
datePicker.setDate(new Date());
// $ExpectType void
datePicker.destroy();
// $ExpectType DatePickerOptions
datePicker.options;
// $ExpectType Element
datePicker.el;
// $ExpectType boolean
datePicker.isOpen;
// TimePicker
// $ExpectType TimePicker
new materialize.TimePicker(elem);
// $ExpectType TimePicker
const timePicker = new materialize.TimePicker(elem, {
defaultTime: "13:14"
});
// $ExpectType void
timePicker.open();
// $ExpectType void
timePicker.showView("hours");
// $ExpectType void
timePicker.destroy();
// $ExpectType TimePickerOptions
timePicker.options;
// $ExpectType Element
timePicker.el;
// $ExpectType boolean
timePicker.isOpen;
// Dropdown
// $ExpectType Dropdown
new materialize.Dropdown(elem);
// $ExpectType Dropdown
const dropdown = new materialize.Dropdown(elem, {
alignment: "left"
});
// $ExpectType void
dropdown.open();
// $ExpectType void
dropdown.close();
// $ExpectType void
dropdown.destroy();
// $ExpectType void
dropdown.recalculateDimensions();
// $ExpectType Element
dropdown.dropdownEl;
// $ExpectType Element
dropdown.el;
// $ExpectType number
dropdown.focusedIndex;
// $ExpectType string
dropdown.id;
// $ExpectType boolean
dropdown.isOpen;
// $ExpectType boolean
dropdown.isScrollable;
// $ExpectType DropdownOptions
dropdown.options;
// FormSelect
// $ExpectType FormSelect
new materialize.FormSelect(elem);
// $ExpectType FormSelect
const formSelect = new materialize.FormSelect(elem, {
classes: "whatever",
dropdownOptions: {
alignment: "left"
}
});
// $ExpectType string[]
formSelect.getSelectedValues();
// $ExpectType void
formSelect.destroy();
// $ExpectType FormSelectOptions
formSelect.options;
// $ExpectType Element
formSelect.el;
// $ExpectType Dropdown
formSelect.dropdown;
// $ExpectType HTMLUListElement
formSelect.dropdownOptions;
// $ExpectType HTMLInputElement
formSelect.input;
// $ExpectType boolean
formSelect.isMultiple;
// $ExpectType Element
formSelect.wrapper;

View File

@ -0,0 +1,38 @@
import * as materialize from "materialize-css";
const elem = document.querySelector('.whatever')!;
// $ExpectType Modal
const _modal = new M.Modal(elem);
// $ExpectType Modal
const el = M.Modal.init(elem);
// $ExpectType Modal[]
const els = M.Modal.init(document.querySelectorAll('.whatever'));
// $ExpectType Modal
new materialize.Modal(elem);
// $ExpectType Modal
const modal = new materialize.Modal(elem, {
inDuration: 300,
onOpenStart(el) {
// $ExpectType Modal
this;
// $ExpectType Element
el;
}
});
// $ExpectType void
modal.open();
// $ExpectType void
modal.destroy();
// $ExpectType ModalOptions
modal.options;
// $ExpectType Element
modal.el;
// $ExpectType boolean
modal.isOpen;
$(".whatever").modal();
$(".whatever").modal({ inDuration: 200 });
$(".whatever").modal("open");
$(".whatever").modal("destroy");

View File

@ -0,0 +1,24 @@
import * as materialize from "materialize-css";
const elem = document.querySelector('.whatever')!;
// $ExpectType Parallax
const _parallax = new M.Parallax(elem);
// $ExpectType Parallax
const el = M.Parallax.init(elem);
// $ExpectType Parallax[]
const els = M.Parallax.init(document.querySelectorAll('.whatever'));
// $ExpectType Parallax
const parallax = new materialize.Parallax(elem, { responsiveThreshold: 1 });
// $ExpectType void
parallax.destroy();
// $ExpectType Element
parallax.el;
// $ExpectType ParallaxOptions
parallax.options;
$(".whatever").parallax();
$(".whatever").parallax({ responsiveThreshold: 2 });
$(".whatever").parallax("destroy");

View File

@ -0,0 +1,34 @@
import * as materialize from "materialize-css";
const elem = document.querySelector('.whatever')!;
// $ExpectType Pushpin
const _pushpin = new M.Pushpin(elem);
// $ExpectType Pushpin
const el = M.Pushpin.init(elem);
// $ExpectType Pushpin[]
const els = M.Pushpin.init(document.querySelectorAll('.whatever'));
// $ExpectType Pushpin
const pushpin = new materialize.Pushpin(elem, {
bottom: 1,
offset: 1,
onPositionChange(position) {
// $ExpectType "pinned" | "pin-top" | "pin-bottom"
position;
},
top: 1
});
// $ExpectType void
pushpin.destroy();
// $ExpectType Element
pushpin.el;
// $ExpectType PushpinOptions
pushpin.options;
// $ExpectType number
pushpin.originalOffset;
$(".whatever").pushpin();
$(".whatever").pushpin({ top: 2 });
$(".whatever").pushpin("destroy");

View File

@ -0,0 +1,22 @@
import * as materialize from "materialize-css";
const elem = document.querySelector('.whatever')!;
// $ExpectType Range
const _range = new M.Range(elem);
// $ExpectType Range
const el = M.Range.init(elem);
// $ExpectType Range[]
const els = M.Range.init(document.querySelectorAll('.whatever'));
// $ExpectType Range
const range = new materialize.Range(elem);
// $ExpectType void
range.destroy();
// $ExpectType Element
range.el;
// $ExpectType undefined
range.options;
$(".whatever").range();
$(".whatever").range("destroy");

View File

@ -0,0 +1,32 @@
import * as materialize from "materialize-css";
const elem = document.querySelector('.whatever')!;
// $ExpectType ScrollSpy
const _scrollspy = new M.ScrollSpy(elem);
// $ExpectType ScrollSpy
const el = M.ScrollSpy.init(elem);
// $ExpectType ScrollSpy[]
const els = M.ScrollSpy.init(document.querySelectorAll('.whatever'));
// $ExpectType ScrollSpy
const scrollspy = new materialize.ScrollSpy(elem, {
activeClass: "class",
getActiveElement(id) {
// $ExpectType string
id;
return "string";
},
scrollOffset: 1,
throttle: 1
});
// $ExpectType void
scrollspy.destroy();
// $ExpectType Element
scrollspy.el;
// $ExpectType ScrollSpyOptions
scrollspy.options;
$(".whatever").scrollSpy();
$(".whatever").scrollSpy("destroy");

View File

@ -0,0 +1,39 @@
import * as materialize from "materialize-css";
const elem = document.querySelector('.whatever')!;
// $ExpectType Sidenav
const _sidenav = new M.Sidenav(elem);
// $ExpectType Sidenav
const el = M.Sidenav.init(elem);
// $ExpectType Sidenav[]
const els = M.Sidenav.init(document.querySelectorAll('.whatever'));
// $ExpectType Sidenav
new materialize.Sidenav(elem);
// $ExpectType Sidenav
const sidenav = new materialize.Sidenav(elem, {
edge: "left",
inDuration: 300,
onCloseStart(el) {
// $ExpectType Sidenav
this;
// $ExpectType Element
el;
}
});
// $ExpectType void
sidenav.open();
// $ExpectType void
sidenav.destroy();
// $ExpectType SidenavOptions
sidenav.options;
// $ExpectType Element
sidenav.el;
// $ExpectType boolean
sidenav.isOpen;
$(".whatever").sidenav();
$(".whatever").sidenav({ inDuration: 200 });
$(".whatever").sidenav("open");
$(".whatever").sidenav("destroy");

View File

@ -0,0 +1,43 @@
import * as materialize from "materialize-css";
const elem = document.querySelector('.whatever')!;
// $ExpectType Slider
const _slider = new M.Slider(elem);
// $ExpectType Slider
const el = M.Slider.init(elem);
// $ExpectType Slider[]
const els = M.Slider.init(document.querySelectorAll('.whatever'));
// $ExpectType Slider
const slider = new materialize.Slider(elem, {
duration: 1,
height: 1,
indicators: true,
interval: 1
});
// $ExpectType void
slider.destroy();
// $ExpectType Element
slider.el;
// $ExpectType SliderOptions
slider.options;
// $ExpectType number
slider.activeIndex;
// $ExpectType void
slider.next();
// $ExpectType void
slider.pause();
// $ExpectType void
slider.prev();
// $ExpectType void
slider.start();
$(".whatever").slider();
$(".whatever").slider({ duration: 1 });
$(".whatever").slider("destroy");
$(".whatever").slider("next");
$(".whatever").slider("pause");
$(".whatever").slider("prev");
$(".whatever").slider("start");

View File

@ -0,0 +1,38 @@
import * as materialize from "materialize-css";
const elem = document.querySelector('.whatever')!;
// $ExpectType Tabs
const _tabs = new M.Tabs(elem);
// $ExpectType Tabs
const el = M.Tabs.init(elem);
// $ExpectType Tabs[]
const els = M.Tabs.init(document.querySelectorAll('.whatever'));
// $ExpectType Tabs
new materialize.Tabs(elem);
// $ExpectType Tabs
const tabs = new materialize.Tabs(elem, {
duration: 200,
onShow(content) {
// $ExpectType Tabs
this;
// $ExpectType Element
content;
}
});
// $ExpectType void
tabs.destroy();
// $ExpectType void
tabs.select("id");
// $ExpectType TabsOptions
tabs.options;
// $ExpectType Element
tabs.el;
// $ExpectType number
tabs.index;
$(".whatever").tabs();
$(".whatever").tabs({ duration: 200 });
$(".whatever").tabs("destroy");
$(".whatever").tabs("select", "id");

View File

@ -0,0 +1,38 @@
import * as materialize from "materialize-css";
const elem = document.querySelector('.whatever')!;
// $ExpectType TapTarget
const _taptarget = new M.TapTarget(elem);
// $ExpectType TapTarget
const el = M.TapTarget.init(elem);
// $ExpectType TapTarget[]
const els = M.TapTarget.init(document.querySelectorAll('.whatever'));
// $ExpectType TapTarget
const taptarget = new materialize.TapTarget(elem, {
onClose(origin) {
// $ExpectType Element
origin;
},
onOpen(origin) {
// $ExpectType Element
origin;
}
});
// $ExpectType void
taptarget.destroy();
// $ExpectType void
taptarget.close();
// $ExpectType void
taptarget.open();
// $ExpectType Element
taptarget.el;
// $ExpectType TapTargetOptions
taptarget.options;
$(".whatever").tapTarget();
$(".whatever").tapTarget("destroy");
$(".whatever").tapTarget("close");
$(".whatever").tapTarget("open");

View File

@ -0,0 +1,65 @@
import * as materialize from "materialize-css";
const elem = document.querySelector('.whatever')!;
// $ExpectType Timepicker
const _timePicker = new M.Timepicker(elem);
// $ExpectType Timepicker
const el = M.Timepicker.init(elem);
// $ExpectType Timepicker[]
const els = M.Timepicker.init(document.querySelectorAll('.whatever'));
// $ExpectType Timepicker
new materialize.Timepicker(elem);
// $ExpectType Timepicker
const timePicker = new materialize.Timepicker(elem, {
duration: 1,
container: "selector",
showClearBtn: true,
defaultTime: "13:14",
fromNow: 1,
i18n: { done: "Ok, Mate" },
autoClose: true,
twelveHour: true,
vibrate: true,
onOpenStart(el) {
// $ExpectType Element
el;
},
onOpenEnd(el) {
// $ExpectType Element
el;
},
onCloseStart(el) {
// $ExpectType Element
el;
},
onCloseEnd(el) {
// $ExpectType Element
el;
},
onSelect(hour, minute) {
// $ExpectType number
hour;
// $ExpectType number
minute;
}
});
// $ExpectType void
timePicker.open();
// $ExpectType void
timePicker.showView("hours");
// $ExpectType void
timePicker.destroy();
// $ExpectType TimepickerOptions
timePicker.options;
// $ExpectType Element
timePicker.el;
// $ExpectType boolean
timePicker.isOpen;
$(".whatever").timepicker();
$(".whatever").timepicker({ defaultTime: "13:14" });
$(".whatever").timepicker("open");
$(".whatever").timepicker("destroy");
$(".whatever").timepicker("showView", "hours");

View File

@ -0,0 +1,17 @@
import * as materialize from "materialize-css";
const elem = document.querySelector('.whatever')!;
// $ExpectType Toast
const _toast = M.toast({ html: 'I am a toast!' });
// $ExpectType Toast
const toast = materialize.toast({ html: 'I am a toast!' });
// $ExpectType ToastOptions
toast.options;
// $ExpectType Element
toast.el;
// $ExpectType void
toast.dismiss();
// $ExpectType void
materialize.Toast.dismissAll();

View File

@ -0,0 +1,33 @@
import * as materialize from "materialize-css";
const elem = document.querySelector('.whatever')!;
// $ExpectType Tooltip
const _tooltip = new M.Tooltip(elem);
// $ExpectType Tooltip
const el = M.Tooltip.init(elem);
// $ExpectType Tooltip[]
const els = M.Tooltip.init(document.querySelectorAll('.whatever'));
// $ExpectType Tooltip
new materialize.Tooltip(elem);
// $ExpectType Tooltip
const tooltip = new materialize.Tooltip(elem, {
inDuration: 300,
position: "right"
});
// $ExpectType void
tooltip.open();
// $ExpectType void
tooltip.destroy();
// $ExpectType TooltipOptions
tooltip.options;
// $ExpectType Element
tooltip.el;
// $ExpectType boolean
tooltip.isOpen;
$(".whatever").tooltip();
$(".whatever").tooltip({ html: "<img/>" });
$(".whatever").tooltip("open");
$(".whatever").tooltip("destroy");

View File

@ -0,0 +1,4 @@
const elem = document.querySelector('.whatever')!;
// $ExpectType void
Waves.attach(elem);

136
types/materialize-css/timepicker.d.ts vendored Normal file
View File

@ -0,0 +1,136 @@
/// <reference path="./common.d.ts" />
declare namespace M {
class Timepicker extends Component<TimepickerOptions> {
/**
* Get Instance
*/
static getInstance(elem: Element): Timepicker;
/**
* Init Timepicker
*/
static init(els: Element, options?: Partial<TimepickerOptions>): Timepicker;
/**
* Init Timepickers
*/
static init(els: MElements, options?: Partial<TimepickerOptions>): Timepicker[];
/**
* If the picker is open.
*/
isOpen: boolean;
/**
* The selected time.
*/
time: string;
/**
* Open timepicker
*/
open(): void;
/**
* Close timepicker
*/
close(): void;
/**
* Show hours or minutes view on timepicker
* @param view The name of the view you want to switch to, 'hours' or 'minutes'.
*/
showView(view: "hours" | "minutes"): void;
}
interface TimepickerOptions {
/**
* Duration of the transition from/to the hours/minutes view.
* @default 350
*/
duration: number;
/**
* Specify a selector for a DOM element to render the calendar in, by default it will be placed before the input.
*/
container: string;
/**
* Show the clear button in the Timepicker
* @default false
*/
showClearBtn: boolean;
/**
* Default time to set on the timepicker 'now' or '13:14'
* @default 'now';
*/
defaultTime: string;
/**
* Millisecond offset from the defaultTime.
* @default 0
*/
fromNow: number;
/**
* Internationalization options
*/
i18n: Partial<InternationalizationOptions>;
/**
* Automatically close picker when minute is selected.
* @default false;
*/
autoClose: boolean;
/**
* Use 12 hour AM/PM clock instead of 24 hour clock.
* @default true
*/
twelveHour: boolean;
/**
* Vibrate device when dragging clock hand.
* @default true
*/
vibrate: boolean;
/**
* Callback function called before modal is opened
* @default null
*/
onOpenStart: (this: Modal, el: Element) => void;
/**
* Callback function called after modal is opened
* @default null
*/
onOpenEnd: (this: Modal, el: Element) => void;
/**
* Callback function called before modal is closed
* @default null
*/
onCloseStart: (this: Modal, el: Element) => void;
/**
* Callback function called after modal is closed
* @default null
*/
onCloseEnd: (this: Modal, el: Element) => void;
/**
* Callback function when a time is selected
* @default null
*/
onSelect: (this: Modal, hour: number, minute: number) => void;
}
}
interface JQuery {
timepicker(method: keyof Pick<M.Timepicker, "open" | "close" | "destroy">): JQuery;
timepicker(method: keyof Pick<M.Timepicker, "showView">, view: "hours" | "minutes"): JQuery;
timepicker(options?: Partial<M.TimepickerOptions>): JQuery;
}

76
types/materialize-css/toast.d.ts vendored Normal file
View File

@ -0,0 +1,76 @@
/// <reference path="./common.d.ts" />
declare namespace M {
class Toast extends ComponentBase<ToastOptions> {
/**
* Get Instance
*/
static getInstance(elem: Element): Toast;
/**
* Describes the current pan state of the Toast.
*/
panning: boolean;
/**
* The remaining amount of time in ms that the toast will stay before dismissal.
*/
timeRemaining: number;
/**
* remove a specific toast
*/
dismiss(): void;
/**
* dismiss all toasts
*/
static dismissAll(): void;
}
interface ToastOptions {
/**
* The HTML content of the Toast.
*/
html: string;
/**
* Length in ms the Toast stays before dismissal.
* @default 4000
*/
displayLength: number;
/**
* Transition in duration in milliseconds.
* @default 300
*/
inDuration: number;
/**
* Transition out duration in milliseconds.
* @default 375
*/
outDuration: number;
/**
* Classes to be added to the toast element.
*/
classes: string;
/**
* Callback function called when toast is dismissed.
*/
completeCallback: () => void;
/**
* The percentage of the toast's width it takes for a drag to dismiss a Toast.
* @default 0.8
*/
activationPercent: number;
}
/**
* Create a toast
*/
function toast(options: Partial<ToastOptions>): Toast;
}

95
types/materialize-css/tooltip.d.ts vendored Normal file
View File

@ -0,0 +1,95 @@
/// <reference path="./common.d.ts" />
declare namespace M {
class Tooltip extends Component<TooltipOptions> implements Openable {
/**
* Get Instance
*/
static getInstance(elem: Element): Tooltip;
/**
* Init Tooltip
*/
static init(els: Element, options?: Partial<TooltipOptions>): Tooltip;
/**
* Init Tooltips
*/
static init(els: MElements, options?: Partial<TooltipOptions>): Tooltip[];
/**
* Show tooltip.
*/
open(): void;
/**
* Hide tooltip.
*/
close(): void;
/**
* If tooltip is open.
*/
isOpen: boolean;
/**
* If tooltip is hovered.
*/
isHovered: boolean;
}
interface TooltipOptions {
/**
* Delay time before tooltip disappears.
* @default 0
*/
exitDelay: number;
/**
* Delay time before tooltip appears.
* @default 200
*/
enterDelay: number;
/**
* Can take regular text or HTML strings.
* @default null
*/
html: string;
/**
* Set distance tooltip appears away from its activator excluding transitionMovement.
* @default 5
*/
margin: number;
/**
* Enter transition duration.
* @default 300
*/
inDuration: number;
/**
* Exit transition duration.
* @default 250
*/
outDuration: number;
/**
* Set the direction of the tooltip.
* @default 'bottom'
*/
position: 'top' | 'right' | 'bottom' | 'left';
/**
* Amount in px that the tooltip moves during its transition.
* @default 10
*/
transitionMovement: number;
}
}
interface JQuery {
tooltip(method: keyof Pick<M.Tooltip, "open" | "close" | "destroy">): JQuery;
tooltip(options?: Partial<M.TooltipOptions>): JQuery;
}

View File

@ -19,8 +19,30 @@
},
"files": [
"index.d.ts",
"test/materialize-css-global.test.ts",
"test/materialize-css-module.test.ts",
"test/materialize-css-jquery.test.ts"
"test/autocomplete.test.ts",
"test/carousel.test.ts",
"test/character-counter.test.ts",
"test/chips.test.ts",
"test/collapsible.test.ts",
"test/common.test.ts",
"test/datepicker.test.ts",
"test/dropdown.test.ts",
"test/fab.test.ts",
"test/formselect.test.ts",
"test/inputfields.test.ts",
"test/materialbox.test.ts",
"test/modal.test.ts",
"test/parallax.test.ts",
"test/pushpin.test.ts",
"test/range.test.ts",
"test/scrollspy.test.ts",
"test/sidenav.test.ts",
"test/slider.test.ts",
"test/tabs.test.ts",
"test/taptarget.test.ts",
"test/timepicker.test.ts",
"test/toast.test.ts",
"test/tooltip.test.ts",
"test/waves.test.ts"
]
}
}

9
types/materialize-css/waves.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
declare namespace Waves {
/**
* Attach Waves to an input element (or any element which doesn't
* bubble mouseup/mousedown events).
* Intended to be used with dynamically loaded forms/inputs, or
* where the user doesn't want a delegated click handler.
*/
function attach(element: Element): void;
}