@growth-angels/ds-core 1.20.0 → 1.21.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.
@@ -24,5 +24,6 @@ export function HydrateCarousel(islands) {
24
24
  });
25
25
  const root = createRoot(carousel);
26
26
  root.render(createElement(Component, { ...parsedProps, children }));
27
+ carousel.setAttribute("data-hydrated", "true");
27
28
  });
28
29
  }
@@ -18,6 +18,11 @@ export type CarouselAttributes = {
18
18
  navigation?: {
19
19
  positionY: 'bottom' | 'top';
20
20
  };
21
+ autoplay?: {
22
+ delay: number;
23
+ disableOnInteraction?: boolean;
24
+ };
25
+ speed?: number;
21
26
  };
22
27
  export interface CarouselProps extends CarouselAttributes, WordpressDefault {
23
28
  children: React.ReactNode | React.ReactNode[];
@@ -4,7 +4,7 @@ import { Button } from "../../atoms/atoms";
4
4
  import Swiper from "swiper";
5
5
  import { Autoplay, Navigation, Pagination } from "swiper/modules";
6
6
  export const CarouselSwiper = (props) => {
7
- const { children, slidesPerView: slidesPerViewDefault, spaceBetween = 48, navigation, pagination, hasPagination, hasNavigation, loop = false, } = props;
7
+ const { children, slidesPerView: slidesPerViewDefault, spaceBetween = 48, navigation, pagination, hasPagination, hasNavigation, loop = false, autoplay, speed, } = props;
8
8
  const classes = ["ga-ds-carousel"];
9
9
  if (props.extraClassNames) {
10
10
  if (typeof props.extraClassNames === "string") {
@@ -61,6 +61,10 @@ export const CarouselSwiper = (props) => {
61
61
  bulletActiveClass: "ga-ds-carousel__dot--active",
62
62
  }
63
63
  : false,
64
+ autoplay: autoplay
65
+ ? { delay: autoplay.delay || 5000, disableOnInteraction: autoplay.disableOnInteraction ?? false }
66
+ : false,
67
+ speed: speed || 300,
64
68
  });
65
69
  setSwiperInstance(swiper);
66
70
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@growth-angels/ds-core",
3
- "version": "1.20.0",
3
+ "version": "1.21.1",
4
4
  "description": "Design system by Growth Angels",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -27,5 +27,6 @@ export function HydrateCarousel(islands: NodeListOf<Element> | null) {
27
27
  const root = createRoot(carousel)
28
28
 
29
29
  root.render(createElement(Component, { ...parsedProps, children }))
30
+ carousel.setAttribute("data-hydrated", "true")
30
31
  })
31
32
  }
@@ -19,6 +19,11 @@ export type CarouselAttributes = {
19
19
  navigation?: {
20
20
  positionY: 'bottom' | 'top';
21
21
  }
22
+ autoplay?: {
23
+ delay: number;
24
+ disableOnInteraction?: boolean;
25
+ }
26
+ speed?: number;
22
27
  }
23
28
  export interface CarouselProps extends CarouselAttributes, WordpressDefault {
24
29
  children: React.ReactNode | React.ReactNode[]
@@ -14,6 +14,8 @@ export const CarouselSwiper = (props: CarouselProps) => {
14
14
  hasPagination,
15
15
  hasNavigation,
16
16
  loop = false,
17
+ autoplay,
18
+ speed,
17
19
  } = props
18
20
 
19
21
  const classes = ["ga-ds-carousel"]
@@ -74,6 +76,10 @@ export const CarouselSwiper = (props: CarouselProps) => {
74
76
  bulletActiveClass: "ga-ds-carousel__dot--active",
75
77
  }
76
78
  : false,
79
+ autoplay: autoplay
80
+ ? { delay: autoplay.delay || 5000, disableOnInteraction: autoplay.disableOnInteraction ?? false }
81
+ : false,
82
+ speed: speed || 300,
77
83
  })
78
84
 
79
85
  setSwiperInstance(swiper)