forked from Dogfalo/materialize
-
-
Notifications
You must be signed in to change notification settings - Fork 106
/
Copy pathmaterialize.d.ts
2593 lines (2563 loc) · 77 KB
/
materialize.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* Base options for component initialization.
*/
interface BaseOptions$1 {
}
type MElement = HTMLElement | Element;
type InitElements<T extends MElement> = NodeListOf<T> | HTMLCollectionOf<T>;
type ComponentConstructor<T extends Component<O>, O extends BaseOptions$1> = {
new (el: HTMLElement, options: Partial<O>): T;
};
type ComponentType<C extends Component<O>, O extends BaseOptions$1> = ComponentConstructor<C, O> & typeof Component<O>;
interface I18nOptions {
cancel: string;
clear: string;
done: string;
}
interface Openable {
isOpen: boolean;
open(): void;
close(): void;
}
/**
* Base class implementation for Materialize components.
*/
declare class Component<O extends BaseOptions$1> {
/**
* The DOM element the plugin was initialized with.
*/
el: HTMLElement;
/**
* The options the instance was initialized with.
*/
options: O;
/**
* Constructs component instance and set everything up.
*/
constructor(el: HTMLElement, options: Partial<O>, classDef: ComponentType<Component<O>, O>);
/**
* Initializes component instance.
* @param el HTML element.
* @param options Component options.
* @param classDef Class definition.
*/
protected static init<I extends HTMLElement, O extends BaseOptions$1, C extends Component<O>>(el: I, options: O, classDef: ComponentType<C, O>): C;
/**
* Initializes component instances.
* @param els HTML elements.
* @param options Component options.
* @param classDef Class definition.
*/
protected static init<I extends MElement, O extends BaseOptions$1, C extends Component<O>>(els: InitElements<I>, options: Partial<O>, classDef: ComponentType<C, O>): C[];
/**
* Initializes component instances.
* @param els HTML elements.
* @param options Component options.
* @param classDef Class definition.
*/
protected static init<I extends MElement, O extends BaseOptions$1, C extends Component<O>>(els: I | InitElements<I>, options: Partial<O>, classDef: ComponentType<C, O>): C | C[];
/**
* @returns default options for component instance.
*/
static get defaults(): BaseOptions$1;
/**
* Retrieves component instance for the given element.
* @param el Associated HTML Element.
*/
static getInstance(el: HTMLElement): Component<BaseOptions$1>;
/**
* Destroy plugin instance and teardown.
*/
destroy(): void;
}
interface DropdownOptions extends BaseOptions$1 {
/**
* Defines the edge the menu is aligned to.
* @default 'left'
*/
alignment: 'left' | 'right';
/**
* If true, automatically focus dropdown el for keyboard.
* @default true
*/
autoFocus: 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: (el: HTMLElement) => void;
/**
* Function called when dropdown finishes entering.
* @default null
*/
onOpenEnd: (el: HTMLElement) => void;
/**
* Function called when dropdown starts exiting.
* @default null
*/
onCloseStart: (el: HTMLElement) => void;
/**
* Function called when dropdown finishes exiting.
* @default null
*/
onCloseEnd: (el: HTMLElement) => void;
/**
* Function called when item is clicked.
* @default null
*/
onItemClick: (el: HTMLLIElement) => void;
}
declare class Dropdown extends Component<DropdownOptions> implements Openable {
static _dropdowns: Dropdown[];
/** ID of the dropdown element. */
id: string;
/** The DOM element of the dropdown. */
dropdownEl: HTMLElement;
/** If the dropdown is open. */
isOpen: boolean;
/** If the dropdown content is scrollable. */
isScrollable: boolean;
isTouchMoving: boolean;
/** The index of the item focused. */
focusedIndex: number;
filterQuery: string[];
filterTimeout: NodeJS.Timeout | number;
constructor(el: HTMLElement, options: Partial<DropdownOptions>);
static get defaults(): DropdownOptions;
/**
* Initializes instance of Dropdown.
* @param el HTML element.
* @param options Component options.
*/
static init(el: HTMLElement, options?: Partial<DropdownOptions>): Dropdown;
/**
* Initializes instances of Dropdown.
* @param els HTML elements.
* @param options Component options.
*/
static init(els: InitElements<MElement>, options?: Partial<DropdownOptions>): Dropdown[];
static getInstance(el: HTMLElement): Dropdown;
destroy(): void;
_setupEventHandlers(): void;
_removeEventHandlers(): void;
_setupTemporaryEventHandlers(): void;
_removeTemporaryEventHandlers(): void;
_handleClick: (e: MouseEvent) => void;
_handleMouseEnter: () => void;
_handleMouseLeave: (e: MouseEvent) => void;
_handleDocumentClick: (e: MouseEvent) => void;
_handleTriggerKeydown: (e: KeyboardEvent) => void;
_handleDocumentTouchmove: (e: TouchEvent) => void;
_handleDropdownClick: (e: MouseEvent) => void;
_handleDropdownKeydown: (e: KeyboardEvent) => void;
_handleWindowResize: () => void;
_resetFilterQuery: () => void;
_resetDropdownStyles(): void;
_resetDropdownPositioningStyles(): void;
_moveDropdownToElement(containerEl?: HTMLElement): void;
_makeDropdownFocusable(): void;
_focusFocusedItem(): void;
_getDropdownPosition(closestOverflowParent: HTMLElement): {
x: number;
y: number;
verticalAlignment: string;
horizontalAlignment: "left" | "right";
height: number;
width: number;
};
_animateIn(): void;
_animateOut(): void;
private _getClosestAncestor;
_placeDropdown(): void;
/**
* 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 AutocompleteData {
/**
* A primitive value that can be converted to string.
* If "text" is not provided, it will also be used as "option text" as well
*/
id: string | number;
/**
* This optional attribute is used as "display value" for the current entry.
* When provided, it will also be taken into consideration by the standard search function.
*/
text?: string;
/**
* This optional attribute is used to provide a valid image URL to the current option.
*/
image?: string;
/**
* Optional attributes which describes the option.
*/
description?: string;
}
interface AutocompleteOptions extends BaseOptions$1 {
/**
* Data object defining autocomplete options with
* optional icon strings.
*/
data: AutocompleteData[];
/**
* Flag which can be set if multiple values can be selected. The Result will be an Array.
* @default false
*/
isMultiSelect: boolean;
/**
* Callback for when autocompleted.
*/
onAutocomplete: (entries: AutocompleteData[]) => void;
/**
* Minimum number of characters before autocomplete starts.
* @default 1
*/
minLength: number;
/**
* The height of the Menu which can be set via css-property.
* @default '300px'
*/
maxDropDownHeight: string;
/**
* Function is called when the input text is altered and data can also be loaded asynchronously.
* If the results are collected the items in the list can be updated via the function setMenuItems(collectedItems).
* @param text Searched text.
* @param autocomplete Current autocomplete instance.
*/
onSearch: (text: string, autocomplete: Autocomplete) => void;
/**
* If true will render the key from each item directly as HTML.
* User input MUST be properly sanitized first.
* @default false
*/
allowUnsafeHTML: boolean;
/**
* Pass options object to select dropdown initialization.
* @default {}
*/
dropdownOptions: Partial<DropdownOptions>;
/**
* Predefined selected values
*/
selected: number[] | string[];
}
declare class Autocomplete extends Component<AutocompleteOptions> {
el: HTMLInputElement;
/** If the autocomplete is open. */
isOpen: boolean;
/** Number of matching autocomplete options. */
count: number;
/** Index of the current selected option. */
activeIndex: number;
private oldVal;
private $active;
private _mousedown;
container: HTMLElement;
/** Instance of the dropdown plugin for this autocomplete. */
dropdown: Dropdown;
static _keydown: boolean;
selectedValues: AutocompleteData[];
menuItems: AutocompleteData[];
constructor(el: HTMLInputElement, options: Partial<AutocompleteOptions>);
static get defaults(): AutocompleteOptions;
/**
* Initializes instance of Autocomplete.
* @param el HTML element.
* @param options Component options.
*/
static init(el: HTMLInputElement, options?: Partial<AutocompleteOptions>): Autocomplete;
/**
* Initializes instances of Autocomplete.
* @param els HTML elements.
* @param options Component options.
*/
static init(els: InitElements<HTMLInputElement | MElement>, options?: Partial<AutocompleteOptions>): Autocomplete[];
static getInstance(el: HTMLElement): Autocomplete;
destroy(): void;
_setupEventHandlers(): void;
_removeEventHandlers(): void;
_setupDropdown(): void;
_removeDropdown(): void;
_handleInputBlur: () => void;
_handleInputKeyup: (e: KeyboardEvent) => void;
_handleInputFocus: () => void;
_inputChangeDetection: (value: string) => void;
_handleInputKeydown: (e: KeyboardEvent) => void;
_handleInputClick: () => void;
_handleContainerMousedownAndTouchstart: () => void;
_handleContainerMouseupAndTouchend: () => void;
_resetCurrentElementPosition(): void;
_resetAutocomplete(): void;
_highlightPartialText(input: string, label: string): string[];
_createDropdownItem(entry: AutocompleteData): HTMLLIElement;
_renderDropdown(): void;
_setStatusLoading(): void;
_updateSelectedInfo(): void;
_refreshInputText(): void;
_triggerChanged(): void;
/**
* Show autocomplete.
*/
open: () => void;
/**
* Hide autocomplete.
*/
close: () => void;
/**
* Updates the visible or selectable items shown in the menu.
* @param menuItems Items to be available.
* @param selected Selected item ids
* @param open Option to conditionally open dropdown
*/
setMenuItems(menuItems: AutocompleteData[], selected?: number[] | string[], open?: boolean): void;
/**
* Sets selected values.
* @deprecated @see https://github.com/materializecss/materialize/issues/552
* @param entries
*/
setValues(entries: AutocompleteData[]): void;
/**
* Select a specific autocomplete option via id-property.
* @param id The id of a data-entry.
*/
selectOption(id: number | string): void;
selectOptions(ids: []): void;
}
interface FloatingActionButtonOptions extends BaseOptions$1 {
/**
* Direction FAB menu opens.
* @default "top"
*/
direction: 'top' | 'right' | 'bottom' | '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;
}
declare class FloatingActionButton extends Component<FloatingActionButtonOptions> implements Openable {
/**
* Describes open/close state of FAB.
*/
isOpen: boolean;
private _anchor;
private _menu;
private _floatingBtns;
private _floatingBtnsReverse;
offsetY: number;
offsetX: number;
btnBottom: number;
btnLeft: number;
btnWidth: number;
constructor(el: HTMLElement, options: Partial<FloatingActionButtonOptions>);
static get defaults(): FloatingActionButtonOptions;
/**
* Initializes instance of FloatingActionButton.
* @param el HTML element.
* @param options Component options.
*/
static init(el: HTMLElement, options?: Partial<FloatingActionButtonOptions>): FloatingActionButton;
/**
* Initializes instances of FloatingActionButton.
* @param els HTML elements.
* @param options Component options.
*/
static init(els: InitElements<MElement>, options?: Partial<FloatingActionButtonOptions>): FloatingActionButton[];
static getInstance(el: HTMLElement): FloatingActionButton;
destroy(): void;
_setupEventHandlers(): void;
_removeEventHandlers(): void;
_handleFABClick: () => void;
_handleFABKeyPress: (e: any) => void;
_handleFABToggle: () => void;
_handleDocumentClick: (e: MouseEvent) => void;
/**
* Open FAB.
*/
open: () => void;
/**
* Close FAB.
*/
close: () => void;
_animateInFAB(): void;
_animateOutFAB(): void;
_animateInToolbar(): void;
}
interface CardsOptions extends BaseOptions$1 {
onOpen: (el: Element) => void;
onClose: (el: Element) => void;
inDuration: number;
outDuration: number;
}
declare class Cards extends Component<CardsOptions> implements Openable {
isOpen: boolean;
private readonly cardReveal;
private readonly initialOverflow;
private _activators;
private cardRevealClose;
constructor(el: HTMLElement, options: Partial<CardsOptions>);
static get defaults(): CardsOptions;
/**
* Initializes instance of Cards.
* @param el HTML element.
* @param options Component options.
*/
static init(el: HTMLElement, options?: Partial<CardsOptions>): Cards;
/**
* Initializes instances of Cards.
* @param els HTML elements.
* @param options Component options.
*/
static init(els: InitElements<MElement>, options?: Partial<CardsOptions>): Cards[];
static getInstance(el: HTMLElement): Cards;
/**
* {@inheritDoc}
*/
destroy(): void;
_setupEventHandlers: () => void;
_removeEventHandlers: () => void;
_handleClickInteraction: () => void;
_handleKeypressEvent: (e: KeyboardEvent) => void;
_handleRevealEvent: () => void;
_setupRevealCloseEventHandlers: () => void;
_removeRevealCloseEventHandlers: () => void;
_handleKeypressCloseEvent: (e: KeyboardEvent) => void;
/**
* Show card reveal.
*/
open: () => void;
/**
* Hide card reveal.
*/
close: () => void;
static Init(): void;
}
interface CarouselOptions extends BaseOptions$1 {
/**
* 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: (current: Element, dragged: boolean) => void;
}
declare class Carousel extends Component<CarouselOptions> {
hasMultipleSlides: boolean;
showIndicators: boolean;
noWrap: boolean;
/** If the carousel is being clicked or tapped. */
pressed: boolean;
/** If the carousel is currently being dragged. */
dragged: boolean;
offset: number;
target: number;
images: HTMLElement[];
itemWidth: number;
itemHeight: number;
dim: number;
_indicators: HTMLUListElement;
count: number;
xform: string;
verticalDragged: boolean;
reference: number;
referenceY: number;
velocity: number;
frame: number;
timestamp: number;
ticker: string | number | NodeJS.Timeout;
amplitude: number;
/** The index of the center carousel item. */
center: number;
imageHeight: number;
scrollingTimeout: number | NodeJS.Timeout;
oneTimeCallback: (current: Element, dragged: boolean) => void | null;
constructor(el: HTMLElement, options: Partial<CarouselOptions>);
static get defaults(): CarouselOptions;
/**
* Initializes instance of Carousel.
* @param el HTML element.
* @param options Component options.
*/
static init(el: HTMLElement, options?: Partial<CarouselOptions>): Carousel;
/**
* Initializes instances of Carousel.
* @param els HTML elements.
* @param options Component options.
*/
static init(els: InitElements<MElement>, options?: Partial<CarouselOptions>): Carousel[];
static getInstance(el: HTMLElement): Carousel;
destroy(): void;
_setupEventHandlers(): void;
_removeEventHandlers(): void;
_handleThrottledResize: () => void;
_handleCarouselTap: (e: MouseEvent | TouchEvent) => void;
_handleCarouselDrag: (e: MouseEvent | TouchEvent) => boolean;
_handleCarouselRelease: (e: MouseEvent | TouchEvent) => boolean;
_handleCarouselClick: (e: MouseEvent | TouchEvent) => boolean;
_handleIndicatorClick: (e: Event) => void;
_handleIndicatorKeyPress: (e: KeyboardEvent) => void;
_handleIndicatorInteraction: (e: Event) => void;
_handleResize: () => void;
_setCarouselHeight(imageOnly?: boolean): void;
_xpos(e: MouseEvent | TouchEvent): number;
_ypos(e: MouseEvent | TouchEvent): number;
_wrap(x: number): any;
_track: () => void;
_autoScroll: () => void;
_scroll(x?: number): void;
_updateItemStyle(el: HTMLElement, opacity: number, zIndex: number, transform: string): void;
_cycleTo(n: number, callback?: CarouselOptions['onCycleTo']): void;
/**
* 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.
* @param callback "onCycleTo" optional callback.
*/
set(n: number, callback?: CarouselOptions['onCycleTo']): void;
}
interface ChipData {
/**
* Unique identifier.
*/
id: number | string;
/**
* Chip text. If not specified, "id" will be used.
*/
text?: string;
/**
* Chip image (URL).
*/
image?: string;
}
interface ChipsOptions extends BaseOptions$1 {
/**
* 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>;
/**
* Toggles abililty to add custom value not in autocomplete list.
* @default false
*/
autocompleteOnly: boolean;
/**
* Set chips limit.
* @default Infinity
*/
limit: number;
/**
* Specifies class to be used in "close" button (useful when working with Material Symbols icon set).
* @default 'material-icons'
*/
closeIconClass: string;
/**
* Specifies option to render user input field
* @default false;
*/
allowUserInput: boolean;
/**
* Callback for chip add.
* @default null
*/
onChipAdd: (element: HTMLElement, chip: HTMLElement) => void;
/**
* Callback for chip select.
* @default null
*/
onChipSelect: (element: HTMLElement, chip: HTMLElement) => void;
/**
* Callback for chip delete.
* @default null
*/
onChipDelete: (element: HTMLElement, chip: HTMLElement) => void;
}
declare class Chips extends Component<ChipsOptions> {
/** Array of the current chips data. */
chipsData: ChipData[];
/** If the chips has autocomplete enabled. */
hasAutocomplete: boolean;
/** Autocomplete instance, if any. */
autocomplete: Autocomplete;
_input: HTMLInputElement;
_label: HTMLLabelElement;
_chips: HTMLElement[];
static _keydown: boolean;
private _selectedChip;
constructor(el: HTMLElement, options: Partial<ChipsOptions>);
static get defaults(): ChipsOptions;
/**
* Initializes instance of Chips.
* @param el HTML element.
* @param options Component options.
*/
static init(el: HTMLElement, options?: Partial<ChipsOptions>): Chips;
/**
* Initializes instances of Chips.
* @param els HTML elements.
* @param options Component options.
*/
static init(els: InitElements<MElement>, options?: Partial<ChipsOptions>): Chips[];
static getInstance(el: HTMLElement): Chips;
getData(): ChipData[];
destroy(): void;
_setupEventHandlers(): void;
_removeEventHandlers(): void;
_handleChipClick: (e: MouseEvent) => void;
static _handleChipsKeydown(e: KeyboardEvent): void;
static _handleChipsKeyup(): void;
static _handleChipsBlur(e: Event): void;
_handleInputFocus: () => void;
_handleInputBlur: () => void;
_handleInputKeydown: (e: KeyboardEvent) => void;
_renderChip(chip: ChipData): HTMLDivElement;
_renderChips(): void;
_setupAutocomplete(): void;
_setupInput(): void;
_setupLabel(): void;
_setPlaceholder(): void;
_isValidAndNotExist(chip: ChipData): boolean;
/**
* Add chip to input.
* @param chip Chip data object
*/
addChip(chip: ChipData): void;
/**
* Delete nth chip.
* @param chipIndex Index of chip
*/
deleteChip(chipIndex: number): void;
/**
* Select nth chip.
* @param chipIndex Index of chip
*/
selectChip(chipIndex: number): void;
static Init(): void;
}
interface CollapsibleOptions extends BaseOptions$1 {
/**
* 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 collapsible is opened.
* @default null
*/
onOpenStart: (el: Element) => void;
/**
* Callback function called after collapsible is opened.
* @default null
*/
onOpenEnd: (el: Element) => void;
/**
* Callback function called before collapsible is closed.
* @default null
*/
onCloseStart: (el: Element) => void;
/**
* Callback function called after collapsible is closed.
* @default null
*/
onCloseEnd: (el: Element) => void;
}
declare class Collapsible extends Component<CollapsibleOptions> {
private _headers;
constructor(el: HTMLElement, options: Partial<CollapsibleOptions>);
static get defaults(): CollapsibleOptions;
/**
* Initializes instance of Collapsible.
* @param el HTML element.
* @param options Component options.
*/
static init(el: HTMLElement, options?: Partial<CollapsibleOptions>): Collapsible;
/**
* Initializes instances of Collapsible.
* @param els HTML elements.
* @param options Component options.
*/
static init(els: InitElements<MElement>, options?: Partial<CollapsibleOptions>): Collapsible[];
static getInstance(el: HTMLElement): Collapsible;
destroy(): void;
_setupEventHandlers(): void;
_removeEventHandlers(): void;
_handleCollapsibleClick: (e: MouseEvent | KeyboardEvent) => void;
_handleCollapsibleKeydown: (e: KeyboardEvent) => void;
private _setExpanded;
_animateIn(index: number): void;
_animateOut(index: number): void;
/**
* Open collapsible section.
* @param n Nth section to open.
*/
open: (index: number) => void;
/**
* Close collapsible section.
* @param n Nth section to close.
*/
close: (index: number) => void;
}
interface DateI18nOptions extends I18nOptions {
previousMonth: string;
nextMonth: string;
months: string[];
monthsShort: string[];
weekdays: string[];
weekdaysShort: string[];
weekdaysAbbrev: string[];
}
interface DatepickerOptions extends BaseOptions$1 {
/**
* The date output format for the input field value
* or a function taking the date and outputting the
* formatted date string.
* @default 'mmm dd, yyyy'
*/
format: string | ((d: Date) => string);
/**
* Used to create date object from current input string.
* @default null
*/
parse: ((value: string, format: string) => Date) | null;
/**
* The initial condition if the datepicker is based on date range.
* @default false
*/
isDateRange: boolean;
/**
* The selector of the user specified date range end element
*/
dateRangeEndEl: string | null;
/**
* The initial condition if the datepicker is based on multiple date selection.
* @default false
*/
isMultipleSelection: boolean;
/**
* The initial date to view when first opened.
* @default null
*/
defaultDate: Date | null;
/**
* The initial end date to view when first opened.
* @default null
*/
defaultEndDate: Date | null;
/**
* Make the `defaultDate` the initial selected value.
* @default false
*/
setDefaultDate: boolean;
/**
* Make the `defaultEndDate` the initial selected value.
* @default false
*/
setDefaultEndDate: boolean;
/**
* Prevent selection of any date on the weekend.
* @default false
*/
disableWeekends: boolean;
/**
* Custom function to disable certain days.
* @default null
*/
disableDayFn: ((day: Date) => boolean) | null;
/**
* First day of week (0: Sunday, 1: Monday etc).
* @default 0
*/
firstDay: number;
/**
* The earliest date that can be selected.
* @default null
*/
minDate: Date | null;
/**
* The latest date that can be selected.
* @default null
*/
maxDate: Date | null;
/**
* Number of years either side, or array of upper/lower range.
* @default 10
*/
yearRange: number | number[];
/**
* Sort year range in reverse order.
* @default false
*/
yearRangeReverse: boolean;
/**
* 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 if the docked datepicker is in open state by default
*/
openByDefault: boolean;
/**
* Specify a DOM element OR selector for a DOM element to render
* the calendar in, by default it will be placed before the input.
* @default null
*/
container: HTMLElement | string | null;
/**
* Show the clear button in the datepicker.
* @default false
*/
showClearBtn: boolean;
/**
* Autosubmit calendar day select to input field
* @default false
*/
autoSubmit: true;
/**
* Internationalization options.
*/
i18n: Partial<DateI18nOptions>;
/**
* 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.
* @default null
*/
onSelect: ((selectedDate: Date) => void) | null;
/**
* Callback function when Datepicker is closed.
* @default null
*/
/**
* Callback function when Datepicker HTML is refreshed.
* @default null
*/
onDraw: (() => void) | null;
/**
* Callback function for interaction with input field.
* @default null
*/
onInputInteraction: (() => void) | null;
/**
* Callback function for interaction with confirm button.
* @default null
*/
onConfirm: (() => void) | null;
/**
* Callback function for interaction with close button.
* @default null
*/
onCancel: (() => void) | null;
/** Field used for internal calculations DO NOT CHANGE IT */
minYear?: number;
/** Field used for internal calculations DO NOT CHANGE IT */
maxYear?: number;
/** Field used for internal calculations DO NOT CHANGE IT */
minMonth?: number;