UNPKG

1.98 kBTypeScriptView Raw
1import BaseComponent from './base-component';
2
3declare class Tab extends BaseComponent {
4 /**
5 * Selects the given list item and shows its associated pane. Any other
6 * list item that was previously selected becomes unselected and its
7 * associated pane is hidden. Returns to the caller before the tab pane
8 * has actually been shown (for example, before the shown.bs.tab event
9 * occurs).
10 */
11 show(): void;
12
13 /**
14 * Static method which allows you to get the tab instance associated with a
15 * DOM element
16 */
17 static getInstance(element: Element): Tab;
18
19 static jQueryInterface: Tab.jQueryInterface;
20
21 // static NAME: 'tab';
22}
23
24declare namespace Tab {
25 enum Events {
26 /**
27 * This event fires on tab show, but before the new tab has been shown.
28 * Use event.target and event.relatedTarget to target the active tab and
29 * the previous active tab (if available) respectively.
30 */
31 show = 'show.bs.tab',
32
33 /**
34 * This event fires on tab show after a tab has been shown. Use
35 * event.target and event.relatedTarget to target the active tab and the
36 * previous active tab (if available) respectively.
37 */
38 shown = 'shown.bs.tab',
39
40 /**
41 * This event fires when a new tab is to be shown (and thus the previous
42 * active tab is to be hidden). Use event.target and event.relatedTarget
43 * to target the current active tab and the new soon-to-be-active tab,
44 * respectively.
45 */
46 hide = 'hide.bs.tab',
47
48 /**
49 * This event fires after a new tab is shown (and thus the previous
50 * active tab is hidden). Use event.target and event.relatedTarget to
51 * target the previous active tab and the new active tab, respectively.
52 */
53 hidden = 'hidden.bs.tab',
54 }
55
56 type jQueryInterface = (config?: 'show' | 'dispose') => void;
57}
58
59export default Tab;