react-image-gallery 1.4.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -21
- package/build/image-gallery.cjs +1 -0
- package/build/image-gallery.css +1 -0
- package/build/image-gallery.es.js +1 -1
- package/build/types/types.d.ts +408 -0
- package/package.json +30 -13
- package/styles/image-gallery.css +701 -0
- package/build/image-gallery.js +0 -1
- package/build/image-gallery.umd.js +0 -1
- package/styles/css/image-gallery.css +0 -1
- package/styles/scss/image-gallery.scss +0 -514
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
import { CSSProperties, KeyboardEvent, MouseEvent, ReactNode, SyntheticEvent, TouchEvent } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Image set for responsive images
|
|
4
|
+
*/
|
|
5
|
+
export interface ImageSet {
|
|
6
|
+
srcSet: string;
|
|
7
|
+
media: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Individual gallery item configuration
|
|
11
|
+
*/
|
|
12
|
+
export interface GalleryItem {
|
|
13
|
+
/** URL of the main image */
|
|
14
|
+
original: string;
|
|
15
|
+
/** URL of the thumbnail image */
|
|
16
|
+
thumbnail?: string;
|
|
17
|
+
/** URL of the fullscreen image (defaults to original) */
|
|
18
|
+
fullscreen?: string;
|
|
19
|
+
/** Original image width for aspect ratio (as string for img attribute) */
|
|
20
|
+
originalWidth?: string;
|
|
21
|
+
/** Original image height for aspect ratio (as string for img attribute) */
|
|
22
|
+
originalHeight?: string;
|
|
23
|
+
/** Thumbnail image width */
|
|
24
|
+
thumbnailWidth?: string | number;
|
|
25
|
+
/** Thumbnail image height */
|
|
26
|
+
thumbnailHeight?: string | number;
|
|
27
|
+
/** Alt text for the main image */
|
|
28
|
+
originalAlt?: string;
|
|
29
|
+
/** Alt text for the thumbnail */
|
|
30
|
+
thumbnailAlt?: string;
|
|
31
|
+
/** Title attribute for the main image */
|
|
32
|
+
originalTitle?: string;
|
|
33
|
+
/** Title attribute for the thumbnail */
|
|
34
|
+
thumbnailTitle?: string;
|
|
35
|
+
/** Description text shown below the image */
|
|
36
|
+
description?: string;
|
|
37
|
+
/** Label shown on the thumbnail */
|
|
38
|
+
thumbnailLabel?: string;
|
|
39
|
+
/** Additional CSS class for the slide */
|
|
40
|
+
originalClass?: string;
|
|
41
|
+
/** Additional CSS class for the thumbnail */
|
|
42
|
+
thumbnailClass?: string;
|
|
43
|
+
/** Additional CSS class for the bullet */
|
|
44
|
+
bulletClass?: string;
|
|
45
|
+
/** Loading strategy for the main image */
|
|
46
|
+
loading?: "eager" | "lazy";
|
|
47
|
+
/** Loading strategy for the thumbnail */
|
|
48
|
+
thumbnailLoading?: "eager" | "lazy";
|
|
49
|
+
/** srcSet for responsive main images */
|
|
50
|
+
srcSet?: string;
|
|
51
|
+
/** sizes attribute for responsive images */
|
|
52
|
+
sizes?: string;
|
|
53
|
+
/** Array of image sets for picture element */
|
|
54
|
+
imageSet?: ImageSet[];
|
|
55
|
+
/** Custom render function for this item */
|
|
56
|
+
renderItem?: (item: GalleryItem) => ReactNode;
|
|
57
|
+
/** Custom render function for this thumbnail */
|
|
58
|
+
renderThumbInner?: (item: GalleryItem) => ReactNode;
|
|
59
|
+
/** Click handler for bullet */
|
|
60
|
+
bulletOnClick?: (event: MouseEvent<HTMLButtonElement>, index: number) => void;
|
|
61
|
+
}
|
|
62
|
+
export type ThumbnailPosition = "top" | "bottom" | "left" | "right";
|
|
63
|
+
export type SlideEvent = MouseEvent | KeyboardEvent | TouchEvent | Event | SyntheticEvent | undefined;
|
|
64
|
+
export type OnSlideCallback = (currentIndex: number) => void;
|
|
65
|
+
export type OnBeforeSlideCallback = (nextIndex: number) => void;
|
|
66
|
+
export type OnScreenChangeCallback = (fullscreen: boolean) => void;
|
|
67
|
+
export type OnPauseCallback = (currentIndex: number) => void;
|
|
68
|
+
export type OnPlayCallback = (currentIndex: number) => void;
|
|
69
|
+
export type OnClickCallback = (event: MouseEvent<HTMLDivElement> | KeyboardEvent<HTMLDivElement>) => void;
|
|
70
|
+
export type OnImageLoadCallback = (event: SyntheticEvent<HTMLImageElement>) => void;
|
|
71
|
+
export type OnImageErrorCallback = (event: SyntheticEvent<HTMLImageElement>) => void;
|
|
72
|
+
export type OnTouchCallback = (event: TouchEvent<HTMLDivElement>) => void;
|
|
73
|
+
export type OnMouseCallback = (event: MouseEvent<HTMLDivElement>) => void;
|
|
74
|
+
export type OnBulletClickCallback = (event: MouseEvent<HTMLButtonElement>, index: number) => void;
|
|
75
|
+
export type OnThumbnailClickCallback = (event: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>, index: number) => void;
|
|
76
|
+
export type OnThumbnailErrorCallback = (event: SyntheticEvent<HTMLImageElement>) => void;
|
|
77
|
+
export type RenderNavCallback = (onClick: (event?: SlideEvent) => void, disabled: boolean) => ReactNode;
|
|
78
|
+
export type RenderPlayPauseCallback = (onClick: () => void, isPlaying: boolean) => ReactNode;
|
|
79
|
+
export type RenderFullscreenCallback = (onClick: () => void, isFullscreen: boolean) => ReactNode;
|
|
80
|
+
export type RenderItemCallback = (item: GalleryItem) => ReactNode;
|
|
81
|
+
export type RenderThumbInnerCallback = (item: GalleryItem) => ReactNode;
|
|
82
|
+
export type RenderCustomControlsCallback = () => ReactNode;
|
|
83
|
+
export interface ImageGalleryProps {
|
|
84
|
+
/** Array of gallery items to display */
|
|
85
|
+
items: GalleryItem[];
|
|
86
|
+
/** Additional CSS class for the gallery container */
|
|
87
|
+
additionalClass?: string;
|
|
88
|
+
/** Auto-play slideshow on mount */
|
|
89
|
+
autoPlay?: boolean;
|
|
90
|
+
/** Disable keyboard navigation */
|
|
91
|
+
disableKeyDown?: boolean;
|
|
92
|
+
/** Disable swipe gestures on main slides */
|
|
93
|
+
disableSwipe?: boolean;
|
|
94
|
+
/** Disable thumbnail auto-scroll to active thumbnail */
|
|
95
|
+
disableThumbnailScroll?: boolean;
|
|
96
|
+
/** Disable swipe gestures on thumbnails */
|
|
97
|
+
disableThumbnailSwipe?: boolean;
|
|
98
|
+
/** Velocity threshold for flick detection (0-1) */
|
|
99
|
+
flickThreshold?: number;
|
|
100
|
+
/** Separator between current and total in index indicator */
|
|
101
|
+
indexSeparator?: string;
|
|
102
|
+
/** Enable infinite loop sliding */
|
|
103
|
+
infinite?: boolean;
|
|
104
|
+
/** Enable right-to-left layout */
|
|
105
|
+
isRTL?: boolean;
|
|
106
|
+
/** Enable lazy loading of images */
|
|
107
|
+
lazyLoad?: boolean;
|
|
108
|
+
/** Fallback image URL on error */
|
|
109
|
+
onErrorImageURL?: string;
|
|
110
|
+
/** Show bullet navigation */
|
|
111
|
+
showBullets?: boolean;
|
|
112
|
+
/** Maximum number of bullets to show (minimum 3) */
|
|
113
|
+
maxBullets?: number;
|
|
114
|
+
/** Show fullscreen toggle button */
|
|
115
|
+
showFullscreenButton?: boolean;
|
|
116
|
+
/** Show current/total index indicator */
|
|
117
|
+
showIndex?: boolean;
|
|
118
|
+
/** Show left/right navigation arrows */
|
|
119
|
+
showNav?: boolean;
|
|
120
|
+
/** Show play/pause button */
|
|
121
|
+
showPlayButton?: boolean;
|
|
122
|
+
/** Show thumbnail strip */
|
|
123
|
+
showThumbnails?: boolean;
|
|
124
|
+
/** Slide animation duration in milliseconds */
|
|
125
|
+
slideDuration?: number;
|
|
126
|
+
/** Auto-play interval in milliseconds */
|
|
127
|
+
slideInterval?: number;
|
|
128
|
+
/** Slide to image on thumbnail hover */
|
|
129
|
+
slideOnThumbnailOver?: boolean;
|
|
130
|
+
/** Enable vertical sliding instead of horizontal */
|
|
131
|
+
slideVertically?: boolean;
|
|
132
|
+
/** Initial slide index */
|
|
133
|
+
startIndex?: number;
|
|
134
|
+
/** Stop event propagation on swipe */
|
|
135
|
+
stopPropagation?: boolean;
|
|
136
|
+
/** Minimum swipe distance to trigger slide change */
|
|
137
|
+
swipeThreshold?: number;
|
|
138
|
+
/** Transition duration during swiping */
|
|
139
|
+
swipingTransitionDuration?: number;
|
|
140
|
+
/** Position of thumbnail strip */
|
|
141
|
+
thumbnailPosition?: ThumbnailPosition;
|
|
142
|
+
/** Use browser fullscreen API vs modal fullscreen */
|
|
143
|
+
useBrowserFullscreen?: boolean;
|
|
144
|
+
/** Use translate3d for GPU acceleration */
|
|
145
|
+
useTranslate3D?: boolean;
|
|
146
|
+
/** Attach keyboard listener to window vs gallery element */
|
|
147
|
+
useWindowKeyDown?: boolean;
|
|
148
|
+
/** Called before slide transition starts */
|
|
149
|
+
onBeforeSlide?: OnBeforeSlideCallback;
|
|
150
|
+
/** Called when a bullet is clicked */
|
|
151
|
+
onBulletClick?: OnBulletClickCallback;
|
|
152
|
+
/** Called when the gallery is clicked */
|
|
153
|
+
onClick?: OnClickCallback;
|
|
154
|
+
/** Called on main image error */
|
|
155
|
+
onImageError?: OnImageErrorCallback;
|
|
156
|
+
/** Called when main image loads */
|
|
157
|
+
onImageLoad?: OnImageLoadCallback;
|
|
158
|
+
/** Called on mouse leave from gallery */
|
|
159
|
+
onMouseLeave?: OnMouseCallback;
|
|
160
|
+
/** Called on mouse over gallery */
|
|
161
|
+
onMouseOver?: OnMouseCallback;
|
|
162
|
+
/** Called when auto-play pauses */
|
|
163
|
+
onPause?: OnPauseCallback;
|
|
164
|
+
/** Called when auto-play starts */
|
|
165
|
+
onPlay?: OnPlayCallback;
|
|
166
|
+
/** Called when fullscreen state changes */
|
|
167
|
+
onScreenChange?: OnScreenChangeCallback;
|
|
168
|
+
/** Called after slide transition completes */
|
|
169
|
+
onSlide?: OnSlideCallback;
|
|
170
|
+
/** Called when a thumbnail is clicked */
|
|
171
|
+
onThumbnailClick?: OnThumbnailClickCallback;
|
|
172
|
+
/** Called on thumbnail image error */
|
|
173
|
+
onThumbnailError?: OnThumbnailErrorCallback;
|
|
174
|
+
/** Called on touch end */
|
|
175
|
+
onTouchEnd?: OnTouchCallback;
|
|
176
|
+
/** Called on touch move */
|
|
177
|
+
onTouchMove?: OnTouchCallback;
|
|
178
|
+
/** Called on touch start */
|
|
179
|
+
onTouchStart?: OnTouchCallback;
|
|
180
|
+
/** Custom renderer for bottom navigation (vertical mode) */
|
|
181
|
+
renderBottomNav?: RenderNavCallback;
|
|
182
|
+
/** Custom renderer for additional controls */
|
|
183
|
+
renderCustomControls?: RenderCustomControlsCallback;
|
|
184
|
+
/** Custom renderer for fullscreen button */
|
|
185
|
+
renderFullscreenButton?: RenderFullscreenCallback;
|
|
186
|
+
/** Custom renderer for slide items */
|
|
187
|
+
renderItem?: RenderItemCallback;
|
|
188
|
+
/** Custom renderer for left navigation */
|
|
189
|
+
renderLeftNav?: RenderNavCallback;
|
|
190
|
+
/** Custom renderer for play/pause button */
|
|
191
|
+
renderPlayPauseButton?: RenderPlayPauseCallback;
|
|
192
|
+
/** Custom renderer for right navigation */
|
|
193
|
+
renderRightNav?: RenderNavCallback;
|
|
194
|
+
/** Custom renderer for thumbnail inner content */
|
|
195
|
+
renderThumbInner?: RenderThumbInnerCallback;
|
|
196
|
+
/** Custom renderer for top navigation (vertical mode) */
|
|
197
|
+
renderTopNav?: RenderNavCallback;
|
|
198
|
+
}
|
|
199
|
+
export interface ImageGalleryRef {
|
|
200
|
+
/** Start auto-play */
|
|
201
|
+
play: () => void;
|
|
202
|
+
/** Stop auto-play */
|
|
203
|
+
pause: () => void;
|
|
204
|
+
/** Toggle auto-play */
|
|
205
|
+
togglePlay: () => void;
|
|
206
|
+
/** Enter fullscreen mode */
|
|
207
|
+
fullScreen: () => void;
|
|
208
|
+
/** Exit fullscreen mode */
|
|
209
|
+
exitFullScreen: () => void;
|
|
210
|
+
/** Toggle fullscreen mode */
|
|
211
|
+
toggleFullScreen: () => void;
|
|
212
|
+
/** Navigate to specific slide index */
|
|
213
|
+
slideToIndex: (index: number, event?: SlideEvent) => void;
|
|
214
|
+
/** Get current slide index */
|
|
215
|
+
getCurrentIndex: () => number;
|
|
216
|
+
}
|
|
217
|
+
export interface UseGalleryNavigationProps {
|
|
218
|
+
items: GalleryItem[];
|
|
219
|
+
startIndex: number;
|
|
220
|
+
infinite: boolean;
|
|
221
|
+
isRTL: boolean;
|
|
222
|
+
slideDuration: number;
|
|
223
|
+
onSlide?: OnSlideCallback | null;
|
|
224
|
+
onBeforeSlide?: OnBeforeSlideCallback | null;
|
|
225
|
+
}
|
|
226
|
+
export interface UseGalleryNavigationReturn {
|
|
227
|
+
currentIndex: number;
|
|
228
|
+
previousIndex: number;
|
|
229
|
+
isTransitioning: boolean;
|
|
230
|
+
currentSlideOffset: number;
|
|
231
|
+
canSlideLeft: () => boolean;
|
|
232
|
+
canSlideRight: () => boolean;
|
|
233
|
+
slideToIndex: (index: number, event?: SlideEvent) => void;
|
|
234
|
+
slideToIndexCore: (index: number, event?: SlideEvent, isPlayPause?: boolean) => void;
|
|
235
|
+
slideToIndexWithStyleReset: (index: number, event?: SlideEvent) => void;
|
|
236
|
+
slideLeft: (event?: SlideEvent) => void;
|
|
237
|
+
slideRight: (event?: SlideEvent) => void;
|
|
238
|
+
getContainerStyle: (options?: ContainerStyleOptions) => CSSProperties;
|
|
239
|
+
getExtendedSlides: () => ExtendedSlidesResult;
|
|
240
|
+
getAlignmentClass: (displayIndex: number) => string;
|
|
241
|
+
setCurrentSlideOffset: (offset: number) => void;
|
|
242
|
+
setSlideStyle: (style: CSSProperties) => void;
|
|
243
|
+
}
|
|
244
|
+
export interface ContainerStyleOptions {
|
|
245
|
+
useTranslate3D?: boolean;
|
|
246
|
+
slideVertically?: boolean;
|
|
247
|
+
}
|
|
248
|
+
export interface ExtendedSlidesResult {
|
|
249
|
+
extendedItems: GalleryItem[];
|
|
250
|
+
getSlideKey: (displayIndex: number) => string;
|
|
251
|
+
getRealIndex: (displayIndex: number) => number;
|
|
252
|
+
}
|
|
253
|
+
export interface UseThumbnailsProps {
|
|
254
|
+
currentIndex: number;
|
|
255
|
+
items: GalleryItem[];
|
|
256
|
+
thumbnailPosition: ThumbnailPosition;
|
|
257
|
+
disableThumbnailScroll: boolean;
|
|
258
|
+
slideDuration: number;
|
|
259
|
+
isRTL: boolean;
|
|
260
|
+
useTranslate3D: boolean;
|
|
261
|
+
}
|
|
262
|
+
export interface UseThumbnailsReturn {
|
|
263
|
+
thumbsTranslate: number;
|
|
264
|
+
setThumbsTranslate: (value: number) => void;
|
|
265
|
+
thumbsSwipedTranslate: number;
|
|
266
|
+
setThumbsSwipedTranslate: (value: number) => void;
|
|
267
|
+
setThumbsStyle: (style: CSSProperties) => void;
|
|
268
|
+
thumbnailsWrapperWidth: number;
|
|
269
|
+
thumbnailsWrapperHeight: number;
|
|
270
|
+
isSwipingThumbnail: boolean;
|
|
271
|
+
setIsSwipingThumbnail: (value: boolean) => void;
|
|
272
|
+
thumbnailsWrapperRef: React.RefObject<HTMLDivElement | null>;
|
|
273
|
+
thumbnailsRef: React.RefObject<HTMLDivElement | null>;
|
|
274
|
+
isThumbnailVertical: () => boolean;
|
|
275
|
+
getThumbnailStyle: () => CSSProperties;
|
|
276
|
+
getThumbnailBarHeight: (gallerySlideWrapperHeight: number) => number | undefined;
|
|
277
|
+
initResizeObserver: (element: React.RefObject<HTMLElement | null>) => void;
|
|
278
|
+
removeResizeObserver: () => void;
|
|
279
|
+
}
|
|
280
|
+
export interface UseFullscreenProps {
|
|
281
|
+
useBrowserFullscreen: boolean;
|
|
282
|
+
onScreenChange?: OnScreenChangeCallback | null;
|
|
283
|
+
galleryRef: React.RefObject<HTMLDivElement | null>;
|
|
284
|
+
}
|
|
285
|
+
export interface UseFullscreenReturn {
|
|
286
|
+
isFullscreen: boolean;
|
|
287
|
+
modalFullscreen: boolean;
|
|
288
|
+
fullScreen: () => void;
|
|
289
|
+
exitFullScreen: () => void;
|
|
290
|
+
toggleFullScreen: () => void;
|
|
291
|
+
handleScreenChange: () => void;
|
|
292
|
+
}
|
|
293
|
+
export interface UseAutoPlayProps {
|
|
294
|
+
autoPlay: boolean;
|
|
295
|
+
slideInterval: number;
|
|
296
|
+
slideDuration: number;
|
|
297
|
+
infinite: boolean;
|
|
298
|
+
totalSlides: number;
|
|
299
|
+
currentIndex: number;
|
|
300
|
+
canSlideRight: () => boolean;
|
|
301
|
+
slideToIndexCore: (index: number, event?: SlideEvent, isPlayPause?: boolean) => void;
|
|
302
|
+
slideToIndexWithStyleReset: (index: number, event?: SlideEvent) => void;
|
|
303
|
+
onPlay?: OnPlayCallback | null;
|
|
304
|
+
onPause?: OnPauseCallback | null;
|
|
305
|
+
}
|
|
306
|
+
export interface UseAutoPlayReturn {
|
|
307
|
+
isPlaying: boolean;
|
|
308
|
+
playPauseIntervalRef: React.MutableRefObject<NodeJS.Timeout | null>;
|
|
309
|
+
play: () => void;
|
|
310
|
+
pause: () => void;
|
|
311
|
+
togglePlay: () => void;
|
|
312
|
+
}
|
|
313
|
+
export interface SlideProps {
|
|
314
|
+
alignment: string;
|
|
315
|
+
index: number;
|
|
316
|
+
originalClass: string;
|
|
317
|
+
onClick?: OnClickCallback | null;
|
|
318
|
+
onKeyUp?: (event: KeyboardEvent<HTMLDivElement>) => void;
|
|
319
|
+
onMouseLeave?: OnMouseCallback | null;
|
|
320
|
+
onMouseOver?: OnMouseCallback | null;
|
|
321
|
+
onTouchEnd?: OnTouchCallback | null;
|
|
322
|
+
onTouchMove?: OnTouchCallback | null;
|
|
323
|
+
onTouchStart?: OnTouchCallback | null;
|
|
324
|
+
children: ReactNode;
|
|
325
|
+
}
|
|
326
|
+
export interface ItemProps {
|
|
327
|
+
description?: string;
|
|
328
|
+
fullscreen?: string;
|
|
329
|
+
handleImageLoaded: (event: SyntheticEvent<HTMLImageElement>, original: string) => void;
|
|
330
|
+
isFullscreen: boolean;
|
|
331
|
+
loading?: "eager" | "lazy";
|
|
332
|
+
original: string;
|
|
333
|
+
originalAlt?: string;
|
|
334
|
+
originalHeight?: number;
|
|
335
|
+
originalTitle?: string;
|
|
336
|
+
originalWidth?: number;
|
|
337
|
+
sizes?: string;
|
|
338
|
+
srcSet?: string;
|
|
339
|
+
onImageError?: OnImageErrorCallback;
|
|
340
|
+
}
|
|
341
|
+
export interface ThumbnailProps {
|
|
342
|
+
index: number;
|
|
343
|
+
isActive: boolean;
|
|
344
|
+
thumbnailClass: string;
|
|
345
|
+
onClick: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
346
|
+
onFocus: (event: React.FocusEvent<HTMLButtonElement>) => void;
|
|
347
|
+
onKeyUp: (event: KeyboardEvent<HTMLButtonElement>) => void;
|
|
348
|
+
onMouseLeave?: ((event: MouseEvent<HTMLButtonElement>) => void) | null;
|
|
349
|
+
onMouseOver: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
350
|
+
children: ReactNode;
|
|
351
|
+
}
|
|
352
|
+
export interface ThumbnailBarProps {
|
|
353
|
+
disableThumbnailSwipe: boolean;
|
|
354
|
+
isRTL: boolean;
|
|
355
|
+
thumbnailBarHeight?: number;
|
|
356
|
+
thumbnailPosition: ThumbnailPosition;
|
|
357
|
+
thumbnails: ReactNode[];
|
|
358
|
+
thumbnailsRef: React.RefObject<HTMLDivElement | null>;
|
|
359
|
+
thumbnailStyle: CSSProperties;
|
|
360
|
+
thumbnailsWrapperRef: React.RefObject<HTMLDivElement | null>;
|
|
361
|
+
onSwiped: () => void;
|
|
362
|
+
onSwiping: (data: SwipeEventData) => void;
|
|
363
|
+
}
|
|
364
|
+
export interface BulletProps {
|
|
365
|
+
bulletClass?: string;
|
|
366
|
+
index: number;
|
|
367
|
+
isActive: boolean;
|
|
368
|
+
onClick: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
369
|
+
}
|
|
370
|
+
export interface BulletNavProps {
|
|
371
|
+
bullets: ReactNode[];
|
|
372
|
+
slideVertically: boolean;
|
|
373
|
+
}
|
|
374
|
+
export interface IndexIndicatorProps {
|
|
375
|
+
currentIndex: number;
|
|
376
|
+
indexSeparator: string;
|
|
377
|
+
totalItems: number;
|
|
378
|
+
}
|
|
379
|
+
export interface NavButtonProps {
|
|
380
|
+
disabled: boolean;
|
|
381
|
+
onClick: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
382
|
+
}
|
|
383
|
+
export interface PlayPauseProps {
|
|
384
|
+
isPlaying: boolean;
|
|
385
|
+
onClick: () => void;
|
|
386
|
+
}
|
|
387
|
+
export interface FullscreenProps {
|
|
388
|
+
isFullscreen: boolean;
|
|
389
|
+
onClick: () => void;
|
|
390
|
+
}
|
|
391
|
+
export interface SwipeWrapperProps {
|
|
392
|
+
className?: string;
|
|
393
|
+
delta?: number;
|
|
394
|
+
onSwiped: (data: SwipeEventData) => void;
|
|
395
|
+
onSwiping: (data: SwipeEventData) => void;
|
|
396
|
+
children: ReactNode;
|
|
397
|
+
}
|
|
398
|
+
export interface SwipeEventData {
|
|
399
|
+
event: TouchEvent | MouseEvent;
|
|
400
|
+
absX: number;
|
|
401
|
+
absY: number;
|
|
402
|
+
dir: SwipeDirection;
|
|
403
|
+
velocity: number;
|
|
404
|
+
}
|
|
405
|
+
export type SwipeDirection = "Left" | "Right" | "Up" | "Down";
|
|
406
|
+
export interface SVGProps {
|
|
407
|
+
strokeWidth?: number;
|
|
408
|
+
}
|
package/package.json
CHANGED
|
@@ -1,32 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-image-gallery",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "React carousel image gallery component with thumbnail and mobile support",
|
|
5
|
-
"main": "./build/image-gallery.
|
|
5
|
+
"main": "./build/image-gallery.cjs",
|
|
6
6
|
"module": "./build/image-gallery.es.js",
|
|
7
|
+
"types": "./build/types/types.d.ts",
|
|
7
8
|
"type": "module",
|
|
8
9
|
"files": [
|
|
9
|
-
"build",
|
|
10
|
+
"build/image-gallery.css",
|
|
11
|
+
"build/image-gallery.es.js",
|
|
12
|
+
"build/image-gallery.cjs",
|
|
13
|
+
"build/types/types.d.ts",
|
|
10
14
|
"styles"
|
|
11
15
|
],
|
|
12
16
|
"scripts": {
|
|
13
17
|
"test": "jest",
|
|
18
|
+
"test:package": "bash scripts/test-package.sh",
|
|
14
19
|
"lint": "eslint src",
|
|
15
|
-
"start": "webpack serve --
|
|
16
|
-
"build": "webpack --config webpack.build.cjs"
|
|
20
|
+
"start": "webpack serve --hot --mode development --static ./example",
|
|
21
|
+
"build": "webpack --config webpack.build.cjs && rm -rf build/types/components",
|
|
22
|
+
"publish:dry-run": "npm publish --dry-run",
|
|
23
|
+
"prepublish:check": "npm run lint && npm test && npm run build && npm run publish:dry-run",
|
|
24
|
+
"release": "npm login && npm publish"
|
|
17
25
|
},
|
|
18
26
|
"repository": {
|
|
19
27
|
"type": "git",
|
|
20
|
-
"url": "https://github.com/xiaolin/react-image-gallery.git"
|
|
28
|
+
"url": "git+https://github.com/xiaolin/react-image-gallery.git"
|
|
21
29
|
},
|
|
22
30
|
"exports": {
|
|
23
31
|
".": {
|
|
24
32
|
"import": "./build/image-gallery.es.js",
|
|
25
|
-
"require": "./build/image-gallery.
|
|
33
|
+
"require": "./build/image-gallery.cjs"
|
|
26
34
|
},
|
|
27
|
-
"./
|
|
35
|
+
"./package.json": "./package.json",
|
|
36
|
+
"./build/image-gallery.css": "./build/image-gallery.css",
|
|
37
|
+
"./styles/image-gallery.css": "./styles/image-gallery.css"
|
|
28
38
|
},
|
|
29
|
-
"style": "
|
|
39
|
+
"style": "build/image-gallery.css",
|
|
30
40
|
"keywords": [
|
|
31
41
|
"react",
|
|
32
42
|
"carousel",
|
|
@@ -61,10 +71,17 @@
|
|
|
61
71
|
"@testing-library/dom": "^10.4.0",
|
|
62
72
|
"@testing-library/jest-dom": "^6.6.3",
|
|
63
73
|
"@testing-library/react": "^16.2.0",
|
|
74
|
+
"@types/jest": "^30.0.0",
|
|
75
|
+
"@types/node": "^25.1.0",
|
|
76
|
+
"@types/react": "^19.2.10",
|
|
77
|
+
"@types/react-dom": "^19.2.3",
|
|
78
|
+
"@typescript-eslint/eslint-plugin": "^8.54.0",
|
|
79
|
+
"@typescript-eslint/parser": "^8.54.0",
|
|
64
80
|
"babel-jest": "^29.7.0",
|
|
65
81
|
"babel-loader": "^9.2.1",
|
|
66
82
|
"clsx": "^2.1.1",
|
|
67
83
|
"css-loader": "^7.1.2",
|
|
84
|
+
"css-minimizer-webpack-plugin": "^7.0.4",
|
|
68
85
|
"eslint": "9.19.0",
|
|
69
86
|
"eslint-config-prettier": "^10.0.1",
|
|
70
87
|
"eslint-import-resolver-alias": "^1.1.2",
|
|
@@ -79,7 +96,6 @@
|
|
|
79
96
|
"identity-obj-proxy": "^3.0.0",
|
|
80
97
|
"jest": "29.7.0",
|
|
81
98
|
"jest-environment-jsdom": "29.7.0",
|
|
82
|
-
"lodash-es": "^4.17.21",
|
|
83
99
|
"mini-css-extract-plugin": "^2.9.2",
|
|
84
100
|
"postcss": "^8.5.1",
|
|
85
101
|
"postcss-loader": "^8.1.1",
|
|
@@ -90,10 +106,11 @@
|
|
|
90
106
|
"react-fast-compare": "^3.2.2",
|
|
91
107
|
"react-swipeable": "7.0.2",
|
|
92
108
|
"remove-files-webpack-plugin": "^1.5.0",
|
|
93
|
-
"resize-observer-polyfill": "^1.5.1",
|
|
94
|
-
"sass": "^1.83.4",
|
|
95
|
-
"sass-loader": "^16.0.4",
|
|
96
109
|
"style-loader": "^4.0.0",
|
|
110
|
+
"ts-jest": "^29.4.6",
|
|
111
|
+
"ts-loader": "^9.5.4",
|
|
112
|
+
"typescript": "^5.9.3",
|
|
113
|
+
"typescript-eslint": "^8.54.0",
|
|
97
114
|
"url-loader": "^4.1.1",
|
|
98
115
|
"webpack": "^5.97.1",
|
|
99
116
|
"webpack-cli": "^6.0.1",
|