YM
2025-08-07 e5c64590b336221f132ed28ae4ae6dca3e03055c
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
import * as React from 'react';
 
import type { SwiperOptions, Swiper as SwiperClass } from './types/index.d.ts';
 
type SwiperProps = Omit<
  React.HTMLAttributes<HTMLElement>,
  | 'onProgress'
  | 'onClick'
  | 'onTouchEnd'
  | 'onTouchMove'
  | 'onTouchStart'
  | 'onTransitionEnd'
  | 'onKeyPress'
  | 'onDoubleClick'
  | 'onScroll'
  | 'onResize'
> &
  SwiperOptions & {
    /**
     * Swiper container tag
     *
     * @default 'div'
     */
    tag?: string;
 
    /**
     * Swiper wrapper tag
     *
     * @default 'div'
     */
    wrapperTag?: string;
 
    /**
     * Get Swiper instance
     */
    onSwiper?: (swiper: SwiperClass) => void;
 
    /**
   * Event will be fired in when autoplay started
   */
  onAutoplayStart?: (swiper: SwiperClass) => void;
  /**
   * Event will be fired when autoplay stopped
   */
  onAutoplayStop?: (swiper: SwiperClass) => void;
  /**
   * Event will be fired on autoplay pause
   */
  onAutoplayPause?: (swiper: SwiperClass) => void;
  /**
   * Event will be fired on autoplay resume
   */
  onAutoplayResume?: (swiper: SwiperClass) => void;
  /**
   * Event triggers continuously while autoplay is enabled. It contains time left (in ms) before transition to next slide and percentage of that time related to autoplay delay
   */
  onAutoplayTimeLeft?: (swiper: SwiperClass, timeLeft: number, percentage: number) => void;
  /**
   * Event will be fired when slide changed with autoplay
   */
  onAutoplay?: (swiper: SwiperClass) => void;/**
   * Event will be fired on window hash change
   */
  onHashChange?: (swiper: SwiperClass) => void;
  /**
   * Event will be fired when swiper updates the hash
   */
  onHashSet?: (swiper: SwiperClass) => void;/**
   * Event will be fired on key press
   */
  onKeyPress?: (swiper: SwiperClass, keyCode: string) => void;/**
   * Event will be fired on navigation hide
   */
  onNavigationHide?: (swiper: SwiperClass) => void;
  /**
   * Event will be fired on navigation show
   */
  onNavigationShow?: (swiper: SwiperClass) => void;
  /**
   * Event will be fired on navigation prev button click
   */
  onNavigationPrev?: (swiper: SwiperClass) => void;
  /**
   * Event will be fired on navigation next button click
   */
  onNavigationNext?: (swiper: SwiperClass) => void;/**
   * Event will be fired on mousewheel scroll
   */
  onScroll?: (swiper: SwiperClass, event: WheelEvent) => void;/**
   * Event will be fired on draggable scrollbar drag start
   */
  onScrollbarDragStart?: (swiper: SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => void;
 
  /**
   * Event will be fired on draggable scrollbar drag move
   */
  onScrollbarDragMove?: (swiper: SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => void;
 
  /**
   * Event will be fired on draggable scrollbar drag end
   */
  onScrollbarDragEnd?: (swiper: SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => void;/**
   * Event will be fired after pagination rendered
   */
  onPaginationRender?: (swiper: SwiperClass, paginationEl: HTMLElement) => void;
 
  /**
   * Event will be fired when pagination updated
   */
  onPaginationUpdate?: (swiper: SwiperClass, paginationEl: HTMLElement) => void;
 
  /**
   * Event will be fired on pagination hide
   */
  onPaginationHide?: (swiper: SwiperClass) => void;
 
  /**
   * Event will be fired on pagination show
   */
  onPaginationShow?: (swiper: SwiperClass) => void;/**
   * Event will be fired on zoom change
   */
  onZoomChange?: (swiper: SwiperClass, scale: number, imageEl: HTMLElement, slideEl: HTMLElement) => void;
    
  /**
   * Fired right after Swiper initialization.
   * @note Note that with `swiper.on('init')` syntax it will
   * work only in case you set `init: false` parameter.
   *
   * @example
   * ```js
   * const swiper = new Swiper('.swiper', {
   *   init: false,
   *   // other parameters
   * });
   * swiper.on('init', function() {
   *  // do something
   * });
   * // init Swiper
   * swiper.init();
   * ```
   *
   * @example
   * ```js
   * // Otherwise use it as the parameter:
   * const swiper = new Swiper('.swiper', {
   *   // other parameters
   *   on: {
   *     init: function () {
   *       // do something
   *     },
   *   }
   * });
   * ```
   */
  onInit?: (swiper: SwiperClass) => any;
 
  /**
   * Event will be fired right before Swiper destroyed
   */
  onBeforeDestroy?: (swiper: SwiperClass) => void;
 
  /**
   * Event will be fired after slides and their sizes are calculated and updated
   */
  onSlidesUpdated?: (swiper: SwiperClass) => void;
  /**
   * Event will be fired when currently active slide is changed
   */
  onSlideChange?: (swiper: SwiperClass) => void;
 
  /**
   * Event will be fired in the beginning of animation to other slide (next or previous).
   */
  onSlideChangeTransitionStart?: (swiper: SwiperClass) => void;
 
  /**
   * Event will be fired after animation to other slide (next or previous).
   */
  onSlideChangeTransitionEnd?: (swiper: SwiperClass) => void;
 
  /**
   * Same as "slideChangeTransitionStart" but for "forward" direction only
   */
  onSlideNextTransitionStart?: (swiper: SwiperClass) => void;
 
  /**
   * Same as "slideChangeTransitionEnd" but for "forward" direction only
   */
  onSlideNextTransitionEnd?: (swiper: SwiperClass) => void;
 
  /**
   * Same as "slideChangeTransitionStart" but for "backward" direction only
   */
  onSlidePrevTransitionStart?: (swiper: SwiperClass) => void;
 
  /**
   * Same as "slideChangeTransitionEnd" but for "backward" direction only
   */
  onSlidePrevTransitionEnd?: (swiper: SwiperClass) => void;
 
  /**
   * Event will be fired in the beginning of transition.
   */
  onTransitionStart?: (swiper: SwiperClass) => void;
 
  /**
   * Event will be fired after transition.
   */
  onTransitionEnd?: (swiper: SwiperClass) => void;
 
  /**
   * Event will be fired when user touch Swiper. Receives `pointerdown` event as an arguments.
   */
  onTouchStart?: (swiper: SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => void;
 
  /**
   * Event will be fired when user touch and move finger over Swiper. Receives `pointermove` event as an arguments.
   */
  onTouchMove?: (swiper: SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => void;
 
  /**
   * Event will be fired when user touch and move finger over Swiper in direction opposite to direction parameter. Receives `pointermove` event as an arguments.
   */
  onTouchMoveOpposite?: (swiper: SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => void;
 
  /**
   * Event will be fired when user touch and move finger over Swiper and move it. Receives `pointermove` event as an arguments.
   */
  onSliderMove?: (swiper: SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => void;
 
  /**
   * Event will be fired when user release Swiper. Receives `pointerup` event as an arguments.
   */
  onTouchEnd?: (swiper: SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => void;
 
  /**
   * Event will be fired when user click/tap on Swiper. Receives `pointerup` event as an arguments.
   */
  onClick?: (swiper: SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => void;
 
  /**
   * Event will be fired when user click/tap on Swiper. Receives `pointerup` event as an arguments.
   */
  onTap?: (swiper: SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => void;
 
  /**
   * Event will be fired when user double tap on Swiper's container. Receives `pointerup` event as an arguments
   */
  onDoubleTap?: (swiper: SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => void;
 
  /**
   * Event will be fired when Swiper progress is changed, as an arguments it receives progress that is always from 0 to 1
   */
  onProgress?: (swiper: SwiperClass, progress: number) => void;
 
  /**
   * Event will be fired when Swiper reach its beginning (initial position)
   */
  onReachBeginning?: (swiper: SwiperClass) => void;
 
  /**
   * Event will be fired when Swiper reach last slide
   */
  onReachEnd?: (swiper: SwiperClass) => void;
 
  /**
   * Event will be fired when Swiper goes to beginning or end position
   */
  onToEdge?: (swiper: SwiperClass) => void;
 
  /**
   * Event will be fired when Swiper goes from beginning or end position
   */
  onFromEdge?: (swiper: SwiperClass) => void;
 
  /**
   * Event will be fired when swiper's wrapper change its position. Receives current translate value as an arguments
   */
  onSetTranslate?: (swiper: SwiperClass, translate: number) => void;
 
  /**
   * Event will be fired everytime when swiper starts animation. Receives current transition duration (in ms) as an arguments
   */
  onSetTransition?: (swiper: SwiperClass, transition: number) => void;
 
  /**
   * Event will be fired on window resize right before swiper's onresize manipulation
   */
  onResize?: (swiper: SwiperClass) => void;
 
  /**
   * Event will be fired if observer is enabled and it detects DOM mutations
   */
  onObserverUpdate?: (swiper: SwiperClass) => void;
 
  /**
   * Event will be fired right before "loop fix"
   */
  onBeforeLoopFix?: (swiper: SwiperClass) => void;
 
  /**
   * Event will be fired after "loop fix"
   */
  onLoopFix?: (swiper: SwiperClass) => void;
 
  /**
   * Event will be fired on breakpoint change
   */
  onBreakpoint?: (swiper: SwiperClass, breakpointParams: SwiperOptions) => void;
 
  /**
   * !INTERNAL: Event will fired right before breakpoint change
   */
  _beforeBreakpoint?: (swiper: SwiperClass, breakpointParams: SwiperOptions) => void;
 
  /**
   * !INTERNAL: Event will fired after setting CSS classes on swiper container element
   */
  _containerClasses?: (swiper: SwiperClass, classNames: string) => void;
 
  /**
   * !INTERNAL: Event will fired after setting CSS classes on swiper slide element
   */
  _slideClass?: (swiper: SwiperClass, slideEl: HTMLElement, classNames: string) => void;
 
  /**
   * !INTERNAL: Event will fired after setting CSS classes on all swiper slides
   */
  _slideClasses?: (
    swiper: SwiperClass,
    slides: { slideEl: HTMLElement; classNames: string; index: number }[],
  ) => void;
 
  /**
   * !INTERNAL: Event will fired as soon as swiper instance available (before init)
   */
  _swiper?: (swiper: SwiperClass) => void;
 
  /**
   * !INTERNAL: Event will be fired on free mode touch end (release) and there will no be momentum
   */
  _freeModeNoMomentumRelease?: (swiper: SwiperClass) => void;
 
  /**
   * Event will fired on active index change
   */
  onActiveIndexChange?: (swiper: SwiperClass) => void;
  /**
   * Event will fired on snap index change
   */
  onSnapIndexChange?: (swiper: SwiperClass) => void;
  /**
   * Event will fired on real index change
   */
  onRealIndexChange?: (swiper: SwiperClass) => void;
  /**
   * Event will fired right after initialization
   */
  onAfterInit?: (swiper: SwiperClass) => void;
  /**
   * Event will fired right before initialization
   */
  onBeforeInit?: (swiper: SwiperClass) => void;
  /**
   * Event will fired before resize handler
   */
  onBeforeResize?: (swiper: SwiperClass) => void;
  /**
   * Event will fired before slide change transition start
   */
  onBeforeSlideChangeStart?: (swiper: SwiperClass) => void;
  /**
   * Event will fired before transition start
   */
  onBeforeTransitionStart?: (swiper: SwiperClass, speed: number, internal: any) => void; // what is internal?
  /**
   * Event will fired on direction change
   */
  onChangeDirection?: (swiper: SwiperClass) => void;
  /**
   * Event will be fired when user double click/tap on Swiper
   */
  onDoubleClick?: (swiper: SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => void;
  /**
   * Event will be fired on swiper destroy
   */
  onDestroy?: (swiper: SwiperClass) => void;
  /**
   * Event will be fired on momentum bounce
   */
  onMomentumBounce?: (swiper: SwiperClass) => void;
  /**
   * Event will be fired on orientation change (e.g. landscape -> portrait)
   */
  onOrientationchange?: (swiper: SwiperClass) => void;
  /**
   * Event will be fired in the beginning of animation of resetting slide to current one
   */
  onSlideResetTransitionStart?: (swiper: SwiperClass) => void;
  /**
   * Event will be fired in the end of animation of resetting slide to current one
   */
  onSlideResetTransitionEnd?: (swiper: SwiperClass) => void;
  /**
   * Event will be fired with first touch/drag move
   */
  onSliderFirstMove?: (swiper: SwiperClass, event: TouchEvent) => void;
  /**
   * Event will be fired when number of slides has changed
   */
  onSlidesLengthChange?: (swiper: SwiperClass) => void;
  /**
   * Event will be fired when slides grid has changed
   */
  onSlidesGridLengthChange?: (swiper: SwiperClass) => void;
  /**
   * Event will be fired when snap grid has changed
   */
  onSnapGridLengthChange?: (swiper: SwiperClass) => void;
  /**
   * Event will be fired after swiper.update() call
   */
  onUpdate?: (swiper: SwiperClass) => void;
  /**
   * Event will be fired when swiper is locked (when `watchOverflow` enabled)
   */
  onLock?: (swiper: SwiperClass) => void;
  /**
   * Event will be fired when swiper is unlocked (when `watchOverflow` enabled)
   */
  onUnlock?: (swiper: SwiperClass) => void;
  
  };
 
interface SlideData {
  isActive: boolean;
  isVisible: boolean;
  isPrev: boolean;
  isNext: boolean;
}
 
type SwiperSlideProps = Omit<React.HTMLAttributes<HTMLElement>, 'children'> & {
  /**
   * Slide tag
   *
   * @default 'div'
   */
  tag?: string;
 
  /**
   * Enables additional wrapper required for zoom mode
   *
   * @default false
   */
  zoom?: boolean;
 
  /**
   * Adds lazy preloader to the slide
   *
   * @default false
   */
  lazy?: boolean;
 
  /**
   * Slide's index in slides array/collection
   *
   * @default false
   */
  virtualIndex?: number;
 
  /**
   * Slide's child element or render function
   *
   * @default undefined
   */
  children?: React.ReactNode | ((slideData: SlideData) => React.ReactNode);
};
 
interface SwiperRef extends React.HTMLAttributes<HTMLElement> {
  swiper: SwiperClass;
}
 
declare const Swiper: React.FunctionComponent<
  React.RefAttributes<SwiperRef> & React.PropsWithChildren<SwiperProps>
>;
declare const SwiperSlide: React.FunctionComponent<SwiperSlideProps>;
 
declare const useSwiper: () => SwiperClass;
declare const useSwiperSlide: () => SlideData;
 
export {
  Swiper,
  SwiperSlide,
  SwiperProps,
  SwiperSlideProps,
  SwiperRef,
  useSwiper,
  useSwiperSlide,
  SwiperClass,
};