UNPKG

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