1 | import BaseComponent from "./base-component";
|
2 |
|
3 | declare class Carousel extends BaseComponent {
|
4 | constructor(element: string | Element, options?: Partial<Carousel.Options>);
|
5 |
|
6 | /**
|
7 | * Cycles through the carousel items from left to right.
|
8 | */
|
9 | cycle(): void;
|
10 |
|
11 | /**
|
12 | * Stops the carousel from cycling through items.
|
13 | */
|
14 | pause(event?: any): void;
|
15 |
|
16 | /**
|
17 | * Cycles to the previous item. Returns to the caller before the previous
|
18 | * item has been shown (e.g., before the slid.bs.carousel event occurs).
|
19 | */
|
20 | prev(): void;
|
21 |
|
22 | /**
|
23 | * Cycles to the next item. Returns to the caller before the next item has
|
24 | * been shown (e.g., before the slid.bs.carousel event occurs).
|
25 | */
|
26 | next(): void;
|
27 |
|
28 | /**
|
29 | * Cycles the carousel to a particular frame (0 based, similar to an array).
|
30 | * Returns to the caller before the target item has been shown (e.g., before
|
31 | * the slid.bs.carousel event occurs).
|
32 | */
|
33 | nextWhenVisible(): void;
|
34 |
|
35 | /**
|
36 | * Cycles the carousel to a particular frame (0 based, similar to an array).
|
37 | * Returns to the caller before the target item has been shown (e.g., before
|
38 | * the slid.bs.carousel event occurs).
|
39 | */
|
40 | to(index: number): void;
|
41 |
|
42 | /**
|
43 | * Static method which allows you to get the carousel instance associated
|
44 | * with a DOM element.
|
45 | */
|
46 | static getInstance(element: Element, options?: Partial<Carousel.Options>): Carousel;
|
47 |
|
48 | static jQueryInterface: Carousel.jQueryInterface;
|
49 |
|
50 | // static NAME: 'carousel';
|
51 |
|
52 | /**
|
53 | * Default settings of this plugin
|
54 | *
|
55 | * @link https://getbootstrap.com/docs/5.0/getting-started/javascript/#default-settings
|
56 | */
|
57 | static Default: Carousel.Options;
|
58 | }
|
59 |
|
60 | declare namespace Carousel {
|
61 | interface Options {
|
62 | |
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 | interval: number;
|
69 |
|
70 | |
71 |
|
72 |
|
73 |
|
74 |
|
75 | keyboard: boolean;
|
76 |
|
77 | |
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 | pause: string | boolean;
|
88 |
|
89 | |
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 | slide: string | boolean;
|
96 |
|
97 | |
98 |
|
99 |
|
100 |
|
101 |
|
102 | wrap: boolean;
|
103 |
|
104 | |
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 | touch: boolean;
|
111 | }
|
112 |
|
113 | enum Events {
|
114 | |
115 |
|
116 |
|
117 | slide = "slide.bs.carousel",
|
118 |
|
119 | |
120 |
|
121 |
|
122 | slid = "slid.bs.carousel",
|
123 | }
|
124 |
|
125 | type Direction = "left" | "right";
|
126 |
|
127 | interface Event {
|
128 | |
129 |
|
130 |
|
131 |
|
132 | readonly direction: Direction;
|
133 |
|
134 | |
135 |
|
136 |
|
137 | readonly relatedTarget: Element;
|
138 |
|
139 | |
140 |
|
141 |
|
142 | readonly from: number;
|
143 |
|
144 | |
145 |
|
146 |
|
147 | readonly to: number;
|
148 | }
|
149 |
|
150 | type jQueryInterface = (
|
151 | config?: Partial<Options> | number | "cycle" | "pause" | "prev" | "next" | "nextWhenVisible" | "dispose",
|
152 | ) => void;
|
153 | }
|
154 |
|
155 | export default Carousel;
|