my-animated-components 1.5.0 → 1.5.2
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/dist/index.d.ts +81 -16
- package/dist/index.js +167 -0
- package/package.json +7 -2
package/dist/index.d.ts
CHANGED
|
@@ -10,18 +10,18 @@ interface WithChildren {
|
|
|
10
10
|
children: React.ReactNode;
|
|
11
11
|
}
|
|
12
12
|
type Color$e = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info';
|
|
13
|
-
type Size$
|
|
13
|
+
type Size$2 = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
14
14
|
interface ColorProps {
|
|
15
15
|
color?: Color$e;
|
|
16
16
|
}
|
|
17
17
|
interface SizeProps {
|
|
18
|
-
size?: Size$
|
|
18
|
+
size?: Size$2;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
type Color$d = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | string;
|
|
22
22
|
type ButtonVariant = 'solid' | 'outline' | 'ghost' | string;
|
|
23
|
-
type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | string;
|
|
24
|
-
type MotionVariantKey$
|
|
23
|
+
type Size$1 = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | string;
|
|
24
|
+
type MotionVariantKey$4 = keyof typeof motionVariants;
|
|
25
25
|
interface ButtonProps extends BaseProps, SizeProps, HTMLMotionProps<'button'> {
|
|
26
26
|
/**
|
|
27
27
|
* Visual style of the button
|
|
@@ -37,7 +37,7 @@ interface ButtonProps extends BaseProps, SizeProps, HTMLMotionProps<'button'> {
|
|
|
37
37
|
* Predefined motion variant from motionVariants for initial animation
|
|
38
38
|
* @default 'fadeIn'
|
|
39
39
|
*/
|
|
40
|
-
motionVariant?: MotionVariantKey$
|
|
40
|
+
motionVariant?: MotionVariantKey$4;
|
|
41
41
|
/**
|
|
42
42
|
* Custom animation variants to override default motionVariants
|
|
43
43
|
*/
|
|
@@ -45,15 +45,15 @@ interface ButtonProps extends BaseProps, SizeProps, HTMLMotionProps<'button'> {
|
|
|
45
45
|
/**
|
|
46
46
|
* Predefined motion variant for hover animation
|
|
47
47
|
*/
|
|
48
|
-
whileHoverAnimation?: MotionVariantKey$
|
|
48
|
+
whileHoverAnimation?: MotionVariantKey$4;
|
|
49
49
|
/**
|
|
50
50
|
* Predefined motion variant for tap animation
|
|
51
51
|
*/
|
|
52
|
-
whileTapAnimation?: MotionVariantKey$
|
|
52
|
+
whileTapAnimation?: MotionVariantKey$4;
|
|
53
53
|
/**
|
|
54
54
|
* Predefined motion variant for focus animation
|
|
55
55
|
*/
|
|
56
|
-
whileFocusAnimation?: MotionVariantKey$
|
|
56
|
+
whileFocusAnimation?: MotionVariantKey$4;
|
|
57
57
|
/**
|
|
58
58
|
* Custom transition for initial animation
|
|
59
59
|
*/
|
|
@@ -90,7 +90,7 @@ interface ButtonProps extends BaseProps, SizeProps, HTMLMotionProps<'button'> {
|
|
|
90
90
|
/**
|
|
91
91
|
* Custom size class mapping
|
|
92
92
|
*/
|
|
93
|
-
customSizeClasses?: Record<Size, string>;
|
|
93
|
+
customSizeClasses?: Record<Size$1, string>;
|
|
94
94
|
/**
|
|
95
95
|
* Whether to use animation on initial render
|
|
96
96
|
* @default true
|
|
@@ -323,9 +323,9 @@ interface ListProps extends BaseProps, WithChildren {
|
|
|
323
323
|
}
|
|
324
324
|
declare const List: React$1.FC<ListProps>;
|
|
325
325
|
|
|
326
|
-
type MotionVariantKey$
|
|
326
|
+
type MotionVariantKey$3 = keyof typeof motionVariants;
|
|
327
327
|
interface ListItemProps extends BaseProps, WithChildren {
|
|
328
|
-
motionVariant?: MotionVariantKey$
|
|
328
|
+
motionVariant?: MotionVariantKey$3;
|
|
329
329
|
duration?: number;
|
|
330
330
|
loop?: boolean;
|
|
331
331
|
}
|
|
@@ -349,7 +349,7 @@ declare const ModalHeader: React$1.FC<BaseProps & WithChildren>;
|
|
|
349
349
|
/**
|
|
350
350
|
* A fully customizable navigation link with motion and style props.
|
|
351
351
|
*/
|
|
352
|
-
type MotionVariantKey$
|
|
352
|
+
type MotionVariantKey$2 = keyof typeof motionVariants;
|
|
353
353
|
interface NavItemProps extends BaseProps, WithChildren {
|
|
354
354
|
/** Link destination */
|
|
355
355
|
href: string;
|
|
@@ -360,7 +360,7 @@ interface NavItemProps extends BaseProps, WithChildren {
|
|
|
360
360
|
/** Customize size classes */
|
|
361
361
|
sizeClasses?: Partial<Record<'xs' | 'sm' | 'md' | 'lg' | 'xl', string>>;
|
|
362
362
|
/** Motion variant key */
|
|
363
|
-
motionVariant?: MotionVariantKey$
|
|
363
|
+
motionVariant?: MotionVariantKey$2;
|
|
364
364
|
/** Animation duration override (seconds) */
|
|
365
365
|
duration?: number;
|
|
366
366
|
/** Loop the animation */
|
|
@@ -467,7 +467,7 @@ interface PaginationProps extends BaseProps {
|
|
|
467
467
|
}
|
|
468
468
|
declare const Pagination: React$1.FC<PaginationProps>;
|
|
469
469
|
|
|
470
|
-
type MotionVariantKey = keyof typeof motionVariants;
|
|
470
|
+
type MotionVariantKey$1 = keyof typeof motionVariants;
|
|
471
471
|
type Color$4 = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info';
|
|
472
472
|
interface ProgressBarProps extends BaseProps, ColorProps, MotionProps {
|
|
473
473
|
/** Current value */
|
|
@@ -483,7 +483,7 @@ interface ProgressBarProps extends BaseProps, ColorProps, MotionProps {
|
|
|
483
483
|
/** Bar background class override (falls back to color key) */
|
|
484
484
|
barBgClass?: string;
|
|
485
485
|
/** Motion variant key */
|
|
486
|
-
motionVariant?: MotionVariantKey;
|
|
486
|
+
motionVariant?: MotionVariantKey$1;
|
|
487
487
|
/** Animation duration in seconds */
|
|
488
488
|
duration?: number;
|
|
489
489
|
/** Loop animation */
|
|
@@ -611,4 +611,69 @@ type ImageEditorProps = {
|
|
|
611
611
|
};
|
|
612
612
|
declare const ImageEditor: ({ imageFile, onSave, onCancel, className }: ImageEditorProps) => React$1.ReactPortal;
|
|
613
613
|
|
|
614
|
-
|
|
614
|
+
type NavigationStyle = 'arrows' | 'dots' | 'thumbnails' | 'both' | 'arrows-dots' | 'none';
|
|
615
|
+
type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full' | string;
|
|
616
|
+
type Direction = 'horizontal' | 'vertical';
|
|
617
|
+
type MotionVariantKey = keyof typeof motionVariants;
|
|
618
|
+
interface CarouselImage {
|
|
619
|
+
src: string;
|
|
620
|
+
alt: string;
|
|
621
|
+
title?: string;
|
|
622
|
+
description?: string;
|
|
623
|
+
thumbnail?: string;
|
|
624
|
+
}
|
|
625
|
+
interface CustomIcons {
|
|
626
|
+
prevIcon?: React$1.ReactNode;
|
|
627
|
+
nextIcon?: React$1.ReactNode;
|
|
628
|
+
playIcon?: React$1.ReactNode;
|
|
629
|
+
pauseIcon?: React$1.ReactNode;
|
|
630
|
+
}
|
|
631
|
+
interface CarouselProps extends BaseProps {
|
|
632
|
+
images: CarouselImage[];
|
|
633
|
+
motionVariant?: MotionVariantKey;
|
|
634
|
+
navigationStyle?: NavigationStyle;
|
|
635
|
+
size?: Size;
|
|
636
|
+
autoPlay?: number;
|
|
637
|
+
autoPlayDirection?: 'forward' | 'backward';
|
|
638
|
+
showPlayPause?: boolean;
|
|
639
|
+
loop?: boolean;
|
|
640
|
+
enableSwipe?: boolean;
|
|
641
|
+
swipeThreshold?: number;
|
|
642
|
+
direction?: Direction;
|
|
643
|
+
customVariants?: Variants;
|
|
644
|
+
transitionDuration?: number;
|
|
645
|
+
customTransition?: Transition;
|
|
646
|
+
customClasses?: {
|
|
647
|
+
container?: string;
|
|
648
|
+
imageWrapper?: string;
|
|
649
|
+
image?: string;
|
|
650
|
+
navigation?: string;
|
|
651
|
+
arrows?: string;
|
|
652
|
+
dots?: string;
|
|
653
|
+
thumbnails?: string;
|
|
654
|
+
overlay?: string;
|
|
655
|
+
playPause?: string;
|
|
656
|
+
};
|
|
657
|
+
customSizeClasses?: Record<Size, string>;
|
|
658
|
+
aspectRatio?: string;
|
|
659
|
+
showOverlay?: boolean;
|
|
660
|
+
overlayPosition?: 'bottom' | 'top' | 'center';
|
|
661
|
+
onSlideChange?: (index: number) => void;
|
|
662
|
+
initialSlide?: number;
|
|
663
|
+
baseClassName?: string;
|
|
664
|
+
unstyled?: boolean;
|
|
665
|
+
lazyLoad?: boolean;
|
|
666
|
+
preloadImages?: number;
|
|
667
|
+
customIcons?: CustomIcons;
|
|
668
|
+
thumbnailSize?: 'sm' | 'md' | 'lg';
|
|
669
|
+
arrowPosition?: 'inside' | 'outside';
|
|
670
|
+
dotStyle?: 'line' | 'circle' | 'square';
|
|
671
|
+
pauseOnHover?: boolean;
|
|
672
|
+
keyboard?: boolean;
|
|
673
|
+
slidesPerView?: number;
|
|
674
|
+
spaceBetween?: number;
|
|
675
|
+
centeredSlides?: boolean;
|
|
676
|
+
}
|
|
677
|
+
declare const Carousel: React$1.FC<CarouselProps>;
|
|
678
|
+
|
|
679
|
+
export { Accordion, Alert, Avatar, Badge, Breadcrumb, Button, Card, CardBody, CardFooter, CardHeader, Carousel, Checkbox, Container, Dropdown, DropdownItem, FileUpload, Flex, Grid, Heading, IconButton, ImageEditor, Imageeditor, Input, List, ListItem, Modal, ModalBody, ModalFooter, ModalHeader, NavItem, Navbar, Offcanvas, OffcanvasBody, OffcanvasHeader, Pagination, ProgressBar, Radio, RangeSlider, Select, Skeleton, Slider, Stepper, Switch, Table, TableBody, TableCell, TableHead, TableRow, Tabs, Text, Textarea, Tooltip, motionVariants };
|
package/dist/index.js
CHANGED
|
@@ -2821,6 +2821,172 @@ const ImageEditor = ({ imageFile, onSave, onCancel, className = "" }) => {
|
|
|
2821
2821
|
!isMobile && React.createElement("span", { style: { marginLeft: 6 } }, tab.label)))))))), document.body);
|
|
2822
2822
|
};
|
|
2823
2823
|
|
|
2824
|
+
const Carousel = ({ images, navigationStyle = 'both', size = 'lg', autoPlay = 0, autoPlayDirection = 'forward', showPlayPause = true, loop = true, enableSwipe = true, swipeThreshold = 10000, direction = 'horizontal', motionVariant = 'fadeIn', customVariants, transitionDuration = 0.5, customTransition, customClasses = {}, customSizeClasses, aspectRatio = '16/9', showOverlay = true, overlayPosition = 'bottom', onSlideChange, initialSlide = 0, baseClassName, unstyled = false, className = '', lazyLoad = false, preloadImages = 2, customIcons, thumbnailSize = 'md', arrowPosition = 'inside', dotStyle = 'line', pauseOnHover = true, keyboard = true, slidesPerView = 1, spaceBetween = 0, centeredSlides = false, }) => {
|
|
2825
|
+
const [currentIndex, setCurrentIndex] = React.useState(initialSlide);
|
|
2826
|
+
const [isPlaying, setIsPlaying] = React.useState(autoPlay > 0);
|
|
2827
|
+
const [dir, setDir] = React.useState(0);
|
|
2828
|
+
const [loadedImages, setLoadedImages] = React.useState(new Set([initialSlide]));
|
|
2829
|
+
const containerRef = React.useRef(null);
|
|
2830
|
+
const autoPlayRef = React.useRef(null);
|
|
2831
|
+
const defaultSizeClasses = {
|
|
2832
|
+
xs: 'max-w-sm h-48',
|
|
2833
|
+
sm: 'max-w-md h-64',
|
|
2834
|
+
md: 'max-w-2xl h-96',
|
|
2835
|
+
lg: 'max-w-4xl h-[32rem]',
|
|
2836
|
+
xl: 'max-w-6xl h-[40rem]',
|
|
2837
|
+
full: 'w-full h-screen',
|
|
2838
|
+
};
|
|
2839
|
+
const sizeClass = unstyled ? '' : (customSizeClasses?.[size] || defaultSizeClasses[size] || size);
|
|
2840
|
+
const baseClasses = unstyled ? '' : (baseClassName || 'relative mx-auto overflow-hidden rounded-xl bg-gray-900');
|
|
2841
|
+
const variants = customVariants || motionVariants[motionVariant || 'fadeIn'];
|
|
2842
|
+
const paginate = React.useCallback((newDirection) => {
|
|
2843
|
+
const nextIndex = currentIndex + newDirection;
|
|
2844
|
+
if (loop) {
|
|
2845
|
+
const wrappedIndex = ((nextIndex % images.length) + images.length) % images.length;
|
|
2846
|
+
setCurrentIndex(wrappedIndex);
|
|
2847
|
+
}
|
|
2848
|
+
else {
|
|
2849
|
+
if (nextIndex >= 0 && nextIndex < images.length) {
|
|
2850
|
+
setCurrentIndex(nextIndex);
|
|
2851
|
+
}
|
|
2852
|
+
}
|
|
2853
|
+
setDir(newDirection);
|
|
2854
|
+
}, [currentIndex, images.length, loop]);
|
|
2855
|
+
const goToSlide = React.useCallback((index) => {
|
|
2856
|
+
const newDirection = index > currentIndex ? 1 : -1;
|
|
2857
|
+
setDir(newDirection);
|
|
2858
|
+
setCurrentIndex(index);
|
|
2859
|
+
}, [currentIndex]);
|
|
2860
|
+
React.useEffect(() => {
|
|
2861
|
+
if (lazyLoad) {
|
|
2862
|
+
const imagesToLoad = new Set(loadedImages);
|
|
2863
|
+
imagesToLoad.add(currentIndex);
|
|
2864
|
+
for (let i = 1; i <= preloadImages; i++) {
|
|
2865
|
+
const nextIndex = (currentIndex + i) % images.length;
|
|
2866
|
+
const prevIndex = (currentIndex - i + images.length) % images.length;
|
|
2867
|
+
imagesToLoad.add(nextIndex);
|
|
2868
|
+
if (loop)
|
|
2869
|
+
imagesToLoad.add(prevIndex);
|
|
2870
|
+
}
|
|
2871
|
+
setLoadedImages(imagesToLoad);
|
|
2872
|
+
}
|
|
2873
|
+
else {
|
|
2874
|
+
setLoadedImages(new Set(images.map((_, i) => i)));
|
|
2875
|
+
}
|
|
2876
|
+
}, [currentIndex, lazyLoad, preloadImages, images.length, loop]);
|
|
2877
|
+
React.useEffect(() => {
|
|
2878
|
+
if (autoPlayRef.current) {
|
|
2879
|
+
clearInterval(autoPlayRef.current);
|
|
2880
|
+
}
|
|
2881
|
+
if (autoPlay > 0 && isPlaying) {
|
|
2882
|
+
autoPlayRef.current = setInterval(() => {
|
|
2883
|
+
paginate(autoPlayDirection === 'forward' ? 1 : -1);
|
|
2884
|
+
}, autoPlay);
|
|
2885
|
+
}
|
|
2886
|
+
return () => {
|
|
2887
|
+
if (autoPlayRef.current) {
|
|
2888
|
+
clearInterval(autoPlayRef.current);
|
|
2889
|
+
}
|
|
2890
|
+
};
|
|
2891
|
+
}, [autoPlay, isPlaying, paginate, autoPlayDirection]);
|
|
2892
|
+
React.useEffect(() => {
|
|
2893
|
+
onSlideChange?.(currentIndex);
|
|
2894
|
+
}, [currentIndex, onSlideChange]);
|
|
2895
|
+
React.useEffect(() => {
|
|
2896
|
+
if (!keyboard)
|
|
2897
|
+
return;
|
|
2898
|
+
const handleKeyDown = (e) => {
|
|
2899
|
+
if (e.key === 'ArrowLeft') {
|
|
2900
|
+
paginate(-1);
|
|
2901
|
+
}
|
|
2902
|
+
else if (e.key === 'ArrowRight') {
|
|
2903
|
+
paginate(1);
|
|
2904
|
+
}
|
|
2905
|
+
};
|
|
2906
|
+
window.addEventListener('keydown', handleKeyDown);
|
|
2907
|
+
return () => window.removeEventListener('keydown', handleKeyDown);
|
|
2908
|
+
}, [keyboard, paginate]);
|
|
2909
|
+
const handleDragEnd = (e, { offset, velocity }) => {
|
|
2910
|
+
const swipe = Math.abs(offset.x) * velocity.x;
|
|
2911
|
+
if (swipe < -swipeThreshold) {
|
|
2912
|
+
paginate(1);
|
|
2913
|
+
}
|
|
2914
|
+
else if (swipe > swipeThreshold) {
|
|
2915
|
+
paginate(-1);
|
|
2916
|
+
}
|
|
2917
|
+
};
|
|
2918
|
+
const handleMouseEnter = () => {
|
|
2919
|
+
if (pauseOnHover && autoPlay > 0) {
|
|
2920
|
+
setIsPlaying(false);
|
|
2921
|
+
}
|
|
2922
|
+
};
|
|
2923
|
+
const handleMouseLeave = () => {
|
|
2924
|
+
if (pauseOnHover && autoPlay > 0) {
|
|
2925
|
+
setIsPlaying(true);
|
|
2926
|
+
}
|
|
2927
|
+
};
|
|
2928
|
+
const showArrows = navigationStyle === 'arrows' || navigationStyle === 'both' || navigationStyle === 'arrows-dots';
|
|
2929
|
+
const showDots = navigationStyle === 'dots' || navigationStyle === 'both' || navigationStyle === 'arrows-dots';
|
|
2930
|
+
const showThumbnails = navigationStyle === 'thumbnails';
|
|
2931
|
+
const DefaultPrevIcon = () => (React.createElement("svg", { className: "w-6 h-6", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24" },
|
|
2932
|
+
React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" })));
|
|
2933
|
+
const DefaultNextIcon = () => (React.createElement("svg", { className: "w-6 h-6", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24" },
|
|
2934
|
+
React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" })));
|
|
2935
|
+
const DefaultPlayIcon = () => (React.createElement("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 24 24" },
|
|
2936
|
+
React.createElement("path", { d: "M8 5v14l11-7z" })));
|
|
2937
|
+
const DefaultPauseIcon = () => (React.createElement("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 24 24" },
|
|
2938
|
+
React.createElement("path", { d: "M6 4h4v16H6V4zm8 0h4v16h-4V4z" })));
|
|
2939
|
+
const thumbnailSizeClasses = {
|
|
2940
|
+
sm: 'w-16 h-12',
|
|
2941
|
+
md: 'w-20 h-16',
|
|
2942
|
+
lg: 'w-24 h-20',
|
|
2943
|
+
};
|
|
2944
|
+
const dotStyleClasses = {
|
|
2945
|
+
line: 'w-8 h-1',
|
|
2946
|
+
circle: 'w-2 h-2 rounded-full',
|
|
2947
|
+
square: 'w-2 h-2',
|
|
2948
|
+
};
|
|
2949
|
+
const overlayPositionClasses = {
|
|
2950
|
+
bottom: 'bottom-0',
|
|
2951
|
+
top: 'top-0',
|
|
2952
|
+
center: 'top-1/2 -translate-y-1/2',
|
|
2953
|
+
};
|
|
2954
|
+
const transition = customTransition || {
|
|
2955
|
+
x: { type: "spring", stiffness: 300, damping: 30 },
|
|
2956
|
+
opacity: { duration: transitionDuration },
|
|
2957
|
+
scale: { duration: transitionDuration },
|
|
2958
|
+
rotateY: { duration: transitionDuration },
|
|
2959
|
+
z: { duration: transitionDuration },
|
|
2960
|
+
};
|
|
2961
|
+
return (React.createElement("div", { ref: containerRef, className: `${baseClasses} ${sizeClass} ${className} ${customClasses.container || ''}`, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave },
|
|
2962
|
+
React.createElement("div", { className: `relative w-full h-full ${customClasses.imageWrapper || ''}`, style: { aspectRatio } },
|
|
2963
|
+
React.createElement(framerMotion.AnimatePresence, { initial: false, custom: dir, mode: "wait" },
|
|
2964
|
+
React.createElement(framerMotion.motion.div, { key: currentIndex, custom: dir, variants: variants, initial: "enter", animate: "center", exit: "exit", transition: transition, drag: enableSwipe ? "x" : false, dragConstraints: { left: 0, right: 0 }, dragElastic: 1, onDragEnd: handleDragEnd, className: `absolute inset-0 ${customClasses.image || ''}` },
|
|
2965
|
+
lazyLoad ? (loadedImages.has(currentIndex) ? (React.createElement("img", { src: images[currentIndex].src, alt: images[currentIndex].alt, className: "w-full h-full object-cover select-none", loading: "lazy", draggable: false })) : (React.createElement("div", { className: "w-full h-full bg-gray-800 animate-pulse flex items-center justify-center" },
|
|
2966
|
+
React.createElement("div", { className: "text-gray-400" }, "Loading...")))) : (React.createElement("img", { src: images[currentIndex].src, alt: images[currentIndex].alt, className: "w-full h-full object-cover select-none", draggable: false })),
|
|
2967
|
+
showOverlay && (images[currentIndex].title || images[currentIndex].description) && (React.createElement(framerMotion.motion.div, { initial: { opacity: 0, y: 20 }, animate: { opacity: 1, y: 0 }, transition: { delay: 0.2 }, className: `absolute ${overlayPositionClasses[overlayPosition]} left-0 right-0 bg-gradient-to-t from-black/80 to-transparent p-6 ${customClasses.overlay || ''}` },
|
|
2968
|
+
images[currentIndex].title && (React.createElement("h3", { className: "text-white text-2xl font-bold mb-2" }, images[currentIndex].title)),
|
|
2969
|
+
images[currentIndex].description && (React.createElement("p", { className: "text-white/90 text-sm" }, images[currentIndex].description))))))),
|
|
2970
|
+
showArrows && (React.createElement("div", { className: customClasses.navigation || '' },
|
|
2971
|
+
React.createElement("button", { onClick: () => paginate(-1), disabled: !loop && currentIndex === 0, className: `absolute ${arrowPosition === 'outside' ? '-left-12' : 'left-4'} top-1/2 -translate-y-1/2 z-10 bg-white/90 backdrop-blur-sm rounded-full p-3 text-gray-900 hover:bg-white hover:scale-110 transition-all disabled:opacity-30 disabled:cursor-not-allowed shadow-lg ${customClasses.arrows || ''}`, "aria-label": "Previous slide" }, customIcons?.prevIcon || React.createElement(DefaultPrevIcon, null)),
|
|
2972
|
+
React.createElement("button", { onClick: () => paginate(1), disabled: !loop && currentIndex === images.length - 1, className: `absolute ${arrowPosition === 'outside' ? '-right-12' : 'right-4'} top-1/2 -translate-y-1/2 z-10 bg-white/90 backdrop-blur-sm rounded-full p-3 text-gray-900 hover:bg-white hover:scale-110 transition-all disabled:opacity-30 disabled:cursor-not-allowed shadow-lg ${customClasses.arrows || ''}`, "aria-label": "Next slide" }, customIcons?.nextIcon || React.createElement(DefaultNextIcon, null)))),
|
|
2973
|
+
autoPlay > 0 && showPlayPause && (React.createElement("button", { onClick: () => setIsPlaying(!isPlaying), className: `absolute top-4 right-4 z-10 bg-white/90 backdrop-blur-sm rounded-full p-2 text-gray-900 hover:bg-white hover:scale-110 transition-all shadow-lg ${customClasses.playPause || ''}`, "aria-label": isPlaying ? 'Pause' : 'Play' }, isPlaying
|
|
2974
|
+
? (customIcons?.pauseIcon || React.createElement(DefaultPauseIcon, null))
|
|
2975
|
+
: (customIcons?.playIcon || React.createElement(DefaultPlayIcon, null)))),
|
|
2976
|
+
showDots && (React.createElement("div", { className: `absolute bottom-4 left-1/2 -translate-x-1/2 z-10 flex gap-2 ${customClasses.dots || ''}` }, images.map((_, index) => (React.createElement("button", { key: index, onClick: () => goToSlide(index), className: `${dotStyleClasses[dotStyle]} transition-all ${index === currentIndex
|
|
2977
|
+
? 'bg-white scale-110'
|
|
2978
|
+
: 'bg-white/50 hover:bg-white/75'}`, "aria-label": `Go to slide ${index + 1}` }))))),
|
|
2979
|
+
showThumbnails && (React.createElement("div", { className: `absolute bottom-0 left-0 right-0 z-10 bg-black/80 backdrop-blur-sm p-2 ${customClasses.thumbnails || ''}` },
|
|
2980
|
+
React.createElement("div", { className: "flex gap-2 overflow-x-auto scrollbar-hide" }, images.map((image, index) => (React.createElement("button", { key: index, onClick: () => goToSlide(index), className: `flex-shrink-0 ${thumbnailSizeClasses[thumbnailSize]} rounded overflow-hidden transition-all ${index === currentIndex
|
|
2981
|
+
? 'ring-2 ring-white scale-110'
|
|
2982
|
+
: 'opacity-60 hover:opacity-100'}`, "aria-label": `Go to slide ${index + 1}` },
|
|
2983
|
+
React.createElement("img", { src: image.thumbnail || image.src, alt: image.alt, className: "w-full h-full object-cover", loading: "lazy" }))))))),
|
|
2984
|
+
React.createElement("div", { className: "absolute bottom-4 right-4 z-10 text-white/80 text-sm bg-black/50 px-2 py-1 rounded" },
|
|
2985
|
+
currentIndex + 1,
|
|
2986
|
+
" / ",
|
|
2987
|
+
images.length)));
|
|
2988
|
+
};
|
|
2989
|
+
|
|
2824
2990
|
exports.Accordion = Accordion;
|
|
2825
2991
|
exports.Alert = Alert;
|
|
2826
2992
|
exports.Avatar = Avatar;
|
|
@@ -2831,6 +2997,7 @@ exports.Card = Card;
|
|
|
2831
2997
|
exports.CardBody = CardBody;
|
|
2832
2998
|
exports.CardFooter = CardFooter;
|
|
2833
2999
|
exports.CardHeader = CardHeader;
|
|
3000
|
+
exports.Carousel = Carousel;
|
|
2834
3001
|
exports.Checkbox = Checkbox;
|
|
2835
3002
|
exports.Container = Container;
|
|
2836
3003
|
exports.Dropdown = Dropdown;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "my-animated-components",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -61,7 +61,12 @@
|
|
|
61
61
|
"reusable-components",
|
|
62
62
|
"high-performance-ui",
|
|
63
63
|
"typescript-support",
|
|
64
|
-
"my-animated-components"
|
|
64
|
+
"my-animated-components",
|
|
65
|
+
"carousel",
|
|
66
|
+
"image-editor",
|
|
67
|
+
"image-editor-component",
|
|
68
|
+
"carousel-component",
|
|
69
|
+
"image-carousel"
|
|
65
70
|
],
|
|
66
71
|
"author": "",
|
|
67
72
|
"license": "ISC",
|