@growth-angels/ds-core 1.21.0 → 1.21.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.
@@ -1,7 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  export const Container = (props) => {
3
3
  const { size, children, style, padding, margin, stretch, id, paddingPosition, marginPosition } = props;
4
- console.log("Container props", props);
5
4
  const classes = [
6
5
  "ga-ds-container",
7
6
  `ga-ds-container--${size}`,
@@ -13,6 +13,8 @@ import "swiper/css/autoplay";
13
13
  const { createElement, createRoot } = useReactAdapter();
14
14
  export function HydrateCarousel(islands) {
15
15
  islands?.forEach((carousel) => {
16
+ // first hide all carousels to prevent FOUC
17
+ carousel.setAttribute("style", "opacity: 0");
16
18
  const Component = CarouselSwiper;
17
19
  if (!Component)
18
20
  return;
@@ -25,5 +27,7 @@ export function HydrateCarousel(islands) {
25
27
  const root = createRoot(carousel);
26
28
  root.render(createElement(Component, { ...parsedProps, children }));
27
29
  carousel.setAttribute("data-hydrated", "true");
30
+ // finally show the carousel
31
+ carousel.setAttribute("style", "opacity: 1");
28
32
  });
29
33
  }
@@ -22,6 +22,7 @@ export type CarouselAttributes = {
22
22
  delay: number;
23
23
  disableOnInteraction?: boolean;
24
24
  };
25
+ speed?: number;
25
26
  };
26
27
  export interface CarouselProps extends CarouselAttributes, WordpressDefault {
27
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, autoplay, } = 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") {
@@ -64,6 +64,7 @@ export const CarouselSwiper = (props) => {
64
64
  autoplay: autoplay
65
65
  ? { delay: autoplay.delay || 5000, disableOnInteraction: autoplay.disableOnInteraction ?? false }
66
66
  : false,
67
+ speed: speed || 300,
67
68
  });
68
69
  setSwiperInstance(swiper);
69
70
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@growth-angels/ds-core",
3
- "version": "1.21.0",
3
+ "version": "1.21.2",
4
4
  "description": "Design system by Growth Angels",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -2,7 +2,6 @@ import type { ContainerProps } from "./Container.types"
2
2
 
3
3
  export const Container = (props: ContainerProps) => {
4
4
  const { size, children, style, padding, margin, stretch, id, paddingPosition, marginPosition } = props
5
- console.log("Container props", props)
6
5
  const classes = [
7
6
  "ga-ds-container",
8
7
  `ga-ds-container--${size}`,
@@ -13,6 +13,8 @@ const { createElement, createRoot } = useReactAdapter()
13
13
 
14
14
  export function HydrateCarousel(islands: NodeListOf<Element> | null) {
15
15
  islands?.forEach((carousel) => {
16
+ // first hide all carousels to prevent FOUC
17
+ carousel.setAttribute("style", "opacity: 0")
16
18
  const Component = CarouselSwiper
17
19
  if (!Component) return
18
20
  const props = carousel.getAttribute("data-props")
@@ -28,5 +30,7 @@ export function HydrateCarousel(islands: NodeListOf<Element> | null) {
28
30
 
29
31
  root.render(createElement(Component, { ...parsedProps, children }))
30
32
  carousel.setAttribute("data-hydrated", "true")
33
+ // finally show the carousel
34
+ carousel.setAttribute("style", "opacity: 1")
31
35
  })
32
36
  }
@@ -23,6 +23,7 @@ export type CarouselAttributes = {
23
23
  delay: number;
24
24
  disableOnInteraction?: boolean;
25
25
  }
26
+ speed?: number;
26
27
  }
27
28
  export interface CarouselProps extends CarouselAttributes, WordpressDefault {
28
29
  children: React.ReactNode | React.ReactNode[]
@@ -15,6 +15,7 @@ export const CarouselSwiper = (props: CarouselProps) => {
15
15
  hasNavigation,
16
16
  loop = false,
17
17
  autoplay,
18
+ speed,
18
19
  } = props
19
20
 
20
21
  const classes = ["ga-ds-carousel"]
@@ -78,6 +79,7 @@ export const CarouselSwiper = (props: CarouselProps) => {
78
79
  autoplay: autoplay
79
80
  ? { delay: autoplay.delay || 5000, disableOnInteraction: autoplay.disableOnInteraction ?? false }
80
81
  : false,
82
+ speed: speed || 300,
81
83
  })
82
84
 
83
85
  setSwiperInstance(swiper)