@growth-angels/ds-core 1.19.0 → 1.21.0

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,3 +1,2 @@
1
- import type { JSX } from "react/jsx-runtime";
2
1
  import type { ButtonProps } from "./Button.types";
3
- export declare const Button: <T extends React.ElementType = "button">(props: ButtonProps<T>) => JSX.Element;
2
+ export declare const Button: <T extends React.ElementType = "button">(props: ButtonProps<T>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
@@ -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
  }
@@ -1,3 +1,2 @@
1
- import type { JSX } from "react/jsx-runtime";
2
1
  import type { CardProps } from "./Card.types";
3
- export declare const Card: ({ children, variant, extraClassNames, type, style, backgroundImage, }: CardProps) => JSX.Element;
2
+ export declare const Card: ({ children, variant, extraClassNames, type, style, backgroundImage }: CardProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- export const Card = ({ children, variant = "primary", extraClassNames, type = "image", style, backgroundImage, }) => {
2
+ export const Card = ({ children, variant = "primary", extraClassNames, type = "image", style, backgroundImage }) => {
3
3
  const classNames = ["ga-ds-card", `ga-ds-card--${variant}`, `ga-ds-card--${type}`, ...(extraClassNames || [])];
4
4
  return (_jsxs("div", { ...(style && { style }), className: classNames.join(" "), children: [backgroundImage && _jsx("img", { src: backgroundImage.sizes?.full?.url, alt: backgroundImage?.alt }), children] }));
5
5
  };
@@ -18,6 +18,10 @@ export type CarouselAttributes = {
18
18
  navigation?: {
19
19
  positionY: 'bottom' | 'top';
20
20
  };
21
+ autoplay?: {
22
+ delay: number;
23
+ disableOnInteraction?: boolean;
24
+ };
21
25
  };
22
26
  export interface CarouselProps extends CarouselAttributes, WordpressDefault {
23
27
  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, } = props;
8
8
  const classes = ["ga-ds-carousel"];
9
9
  if (props.extraClassNames) {
10
10
  if (typeof props.extraClassNames === "string") {
@@ -61,6 +61,9 @@ 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,
64
67
  });
65
68
  setSwiperInstance(swiper);
66
69
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@growth-angels/ds-core",
3
- "version": "1.19.0",
3
+ "version": "1.21.0",
4
4
  "description": "Design system by Growth Angels",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -1,9 +1,8 @@
1
- import type { JSX } from "react/jsx-runtime"
2
1
  import type { ButtonProps } from "./Button.types"
3
2
  import { useReactAdapter } from "../../hooks/useReactAdaptater"
4
3
  import { Icon } from "../Icon/Icon"
5
4
 
6
- export const Button = <T extends React.ElementType = "button">(props: ButtonProps<T>): JSX.Element => {
5
+ export const Button = <T extends React.ElementType = "button">(props: ButtonProps<T>) => {
7
6
  const React = useReactAdapter()
8
7
  const { as, children, variant, preventDefault, icon, extraClassNames, ...restProps } = props
9
8
  let customVariant = variant
@@ -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
  }
@@ -1,14 +1,6 @@
1
- import type { JSX } from "react/jsx-runtime"
2
1
  import type { CardProps } from "./Card.types"
3
2
 
4
- export const Card = ({
5
- children,
6
- variant = "primary",
7
- extraClassNames,
8
- type = "image",
9
- style,
10
- backgroundImage,
11
- }: CardProps): JSX.Element => {
3
+ export const Card = ({ children, variant = "primary", extraClassNames, type = "image", style, backgroundImage }: CardProps) => {
12
4
  const classNames = ["ga-ds-card", `ga-ds-card--${variant}`, `ga-ds-card--${type}`, ...(extraClassNames || [])]
13
5
  return (
14
6
  <div {...(style && { style })} className={classNames.join(" ")}>
@@ -19,6 +19,10 @@ export type CarouselAttributes = {
19
19
  navigation?: {
20
20
  positionY: 'bottom' | 'top';
21
21
  }
22
+ autoplay?: {
23
+ delay: number;
24
+ disableOnInteraction?: boolean;
25
+ }
22
26
  }
23
27
  export interface CarouselProps extends CarouselAttributes, WordpressDefault {
24
28
  children: React.ReactNode | React.ReactNode[]
@@ -14,6 +14,7 @@ export const CarouselSwiper = (props: CarouselProps) => {
14
14
  hasPagination,
15
15
  hasNavigation,
16
16
  loop = false,
17
+ autoplay,
17
18
  } = props
18
19
 
19
20
  const classes = ["ga-ds-carousel"]
@@ -74,6 +75,9 @@ export const CarouselSwiper = (props: CarouselProps) => {
74
75
  bulletActiveClass: "ga-ds-carousel__dot--active",
75
76
  }
76
77
  : false,
78
+ autoplay: autoplay
79
+ ? { delay: autoplay.delay || 5000, disableOnInteraction: autoplay.disableOnInteraction ?? false }
80
+ : false,
77
81
  })
78
82
 
79
83
  setSwiperInstance(swiper)