@growth-angels/ds-core 1.21.2 → 1.22.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.
Files changed (61) hide show
  1. package/dist/atoms/Button/Button.types.d.ts +1 -1
  2. package/dist/atoms/Icon/Icon.d.ts +1 -1
  3. package/dist/atoms/Icon/Icon.types.d.ts +1 -1
  4. package/dist/atoms/Text/Text.d.ts +1 -1
  5. package/dist/layout/Container/Container.types.d.ts +1 -1
  6. package/dist/layout/FlexBlock/FlexBlock.d.ts +1 -1
  7. package/dist/layout/FlexBlock/FlexBlock.types.d.ts +1 -1
  8. package/dist/layout/FlexCol/FlexCol.d.ts +1 -1
  9. package/dist/layout/Grid/Grid.d.ts +1 -1
  10. package/dist/layout/Grid/Grid.types.d.ts +1 -1
  11. package/dist/layout/Grid/GridItem/GridItem.d.ts +1 -1
  12. package/dist/layout/Grid/GridItem/GridItem.types.d.ts +1 -1
  13. package/dist/lib/hydrate-carousel.js +4 -4
  14. package/dist/lib/hydrate-spoiler.js +3 -3
  15. package/dist/lib/hydrate-tabs.js +1 -1
  16. package/dist/lib/utils/native-child-wrapper.js +1 -1
  17. package/dist/molecules/ButtonGroup/ButtonGroup.d.ts +1 -1
  18. package/dist/molecules/ButtonGroup/ButtonGroup.types.d.ts +1 -1
  19. package/dist/molecules/Spoiler/Spoiler.d.ts +1 -1
  20. package/dist/organisms/Carousel/Carousel.d.ts +1 -1
  21. package/dist/organisms/Carousel/Carousel.js +1 -1
  22. package/dist/organisms/Carousel/Carousel.types.d.ts +1 -1
  23. package/dist/organisms/Carousel/CarouselSwiper.d.ts +1 -1
  24. package/dist/organisms/Carousel/CarouselSwiper.stories.js +7 -7
  25. package/dist/organisms/SpoilerList/SpoilerList.d.ts +1 -1
  26. package/dist/organisms/SpoilerList/SpoilerList.types.d.ts +1 -1
  27. package/dist/organisms/Tabs/Tabs.d.ts +1 -1
  28. package/dist/organisms/Tabs/Tabs.stories.js +3 -3
  29. package/dist/organisms/Tabs/Tabs.types.d.ts +1 -1
  30. package/package.json +2 -2
  31. package/src/atoms/Button/Button.types.ts +1 -1
  32. package/src/atoms/Icon/Icon.tsx +1 -1
  33. package/src/atoms/Icon/Icon.types.ts +1 -1
  34. package/src/atoms/Text/Text.tsx +1 -1
  35. package/src/context/SpoilerContext.tsx +1 -2
  36. package/src/hooks/useReactAdaptater.ts +0 -1
  37. package/src/layout/Container/Container.scss +27 -34
  38. package/src/layout/Container/Container.types.ts +1 -1
  39. package/src/layout/FlexBlock/FlexBlock.tsx +1 -1
  40. package/src/layout/FlexBlock/FlexBlock.types.ts +1 -1
  41. package/src/layout/FlexCol/FlexCol.tsx +1 -1
  42. package/src/layout/Grid/Grid.tsx +1 -1
  43. package/src/layout/Grid/Grid.types.ts +1 -1
  44. package/src/layout/Grid/GridItem/GridItem.tsx +1 -1
  45. package/src/layout/Grid/GridItem/GridItem.types.ts +1 -1
  46. package/src/lib/hydrate-carousel.tsx +4 -4
  47. package/src/lib/hydrate-spoiler.tsx +3 -3
  48. package/src/lib/hydrate-tabs.tsx +2 -2
  49. package/src/lib/utils/native-child-wrapper.tsx +1 -1
  50. package/src/molecules/ButtonGroup/ButtonGroup.tsx +1 -1
  51. package/src/molecules/ButtonGroup/ButtonGroup.types.ts +1 -1
  52. package/src/molecules/Spoiler/Spoiler.tsx +1 -1
  53. package/src/organisms/Carousel/Carousel.tsx +2 -2
  54. package/src/organisms/Carousel/Carousel.types.ts +1 -1
  55. package/src/organisms/Carousel/CarouselSwiper.stories.tsx +7 -7
  56. package/src/organisms/Carousel/CarouselSwiper.tsx +1 -1
  57. package/src/organisms/SpoilerList/SpoilerList.tsx +1 -1
  58. package/src/organisms/SpoilerList/SpoilerList.types.ts +1 -1
  59. package/src/organisms/Tabs/Tabs.stories.tsx +9 -3
  60. package/src/organisms/Tabs/Tabs.tsx +1 -1
  61. package/src/organisms/Tabs/Tabs.types.ts +1 -1
@@ -1,4 +1,4 @@
1
- import { WordpressDefault } from "../../global.types.js";
1
+ import type { WordpressDefault } from "../../global.types.js";
2
2
  import type { ElementType, ComponentPropsWithoutRef, ReactNode, MouseEventHandler, ElementRef } from "react";
3
3
  export type ButtonVariant = "primary" | "secondary" | "tertiary" | "link" | "icon";
4
4
  export type ButtonProps<T extends ElementType = "button"> = {
@@ -1,2 +1,2 @@
1
- import { IconProps } from "./Icon.types";
1
+ import type { IconProps } from "./Icon.types";
2
2
  export declare const Icon: ({ name, size, extraClassNames }: IconProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { WordpressDefault } from "../../global.types";
1
+ import type { WordpressDefault } from "../../global.types";
2
2
  export interface IconProps extends WordpressDefault {
3
3
  name: string;
4
4
  size?: 'sm' | 'md' | 'lg';
@@ -1,4 +1,4 @@
1
- import { TextProps } from "./Text.types";
1
+ import type { TextProps } from "./Text.types";
2
2
  export declare const Text: (props: TextProps) => import("react").DetailedReactHTMLElement<{
3
3
  className: string;
4
4
  style: import("react").CSSProperties | undefined;
@@ -1,4 +1,4 @@
1
- import { WordpressDefault } from "../../global.types";
1
+ import type { WordpressDefault } from "../../global.types";
2
2
  export type ContainerSize = 'large' | 'medium' | 'small' | 'full';
3
3
  export type ContainerStretch = 'right' | 'left';
4
4
  export interface ContainerProps extends WordpressDefault, React.HTMLAttributes<HTMLDivElement> {
@@ -1,2 +1,2 @@
1
- import { FlexBlockProps } from "./FlexBlock.types";
1
+ import type { FlexBlockProps } from "./FlexBlock.types";
2
2
  export declare const FlexBlock: ({ children, gap, alignItems, justifyContent, flexDirection, extraClassNames }: FlexBlockProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { WordpressDefault } from "../../global.types";
1
+ import type { WordpressDefault } from "../../global.types";
2
2
  export type FlexBlockAttrs = {
3
3
  gap?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
4
4
  alignItems?: string;
@@ -1,4 +1,4 @@
1
- import { FlexColAttrs } from "./FlexCol.types";
1
+ import type { FlexColAttrs } from "./FlexCol.types";
2
2
  export declare const FlexCol: ({ children, gap }: {
3
3
  children: React.ReactNode;
4
4
  gap?: FlexColAttrs["gap"];
@@ -1,2 +1,2 @@
1
- import { GridProps } from "./Grid.types";
1
+ import type { GridProps } from "./Grid.types";
2
2
  export declare const Grid: (props: GridProps) => JSX.Element;
@@ -1,4 +1,4 @@
1
- import { WordpressDefault } from "../../global.types";
1
+ import type { WordpressDefault } from "../../global.types";
2
2
  export interface GridAttributes {
3
3
  alignItems: 'flex-start' | 'center' | 'flex-end' | 'none';
4
4
  justifyContent: 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'none';
@@ -1,3 +1,3 @@
1
1
  import type { JSX } from "react/jsx-runtime";
2
- import { GridItemProps } from "./GridItem.types";
2
+ import type { GridItemProps } from "./GridItem.types";
3
3
  export declare const GridItem: (props: GridItemProps) => JSX.Element;
@@ -1,4 +1,4 @@
1
- import { WordpressDefault } from "../../../global.types";
1
+ import type { WordpressDefault } from "../../../global.types";
2
2
  export type ColumnSize = '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12';
3
3
  export interface GridItemAttributes {
4
4
  sizes: {
@@ -10,11 +10,9 @@ window.Swiper = {
10
10
  };
11
11
  import "swiper/css";
12
12
  import "swiper/css/autoplay";
13
- const { createElement, createRoot } = useReactAdapter();
14
13
  export function HydrateCarousel(islands) {
14
+ const { createElement, createRoot } = useReactAdapter();
15
15
  islands?.forEach((carousel) => {
16
- // first hide all carousels to prevent FOUC
17
- carousel.setAttribute("style", "opacity: 0");
18
16
  const Component = CarouselSwiper;
19
17
  if (!Component)
20
18
  return;
@@ -28,6 +26,8 @@ export function HydrateCarousel(islands) {
28
26
  root.render(createElement(Component, { ...parsedProps, children }));
29
27
  carousel.setAttribute("data-hydrated", "true");
30
28
  // finally show the carousel
31
- carousel.setAttribute("style", "opacity: 1");
29
+ setTimeout(() => {
30
+ carousel.setAttribute("style", "opacity: 1");
31
+ }, 1000);
32
32
  });
33
33
  }
@@ -2,16 +2,16 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Spoiler } from "../molecules/molecules";
3
3
  import { SpoilerList } from "../organisms/organisms";
4
4
  import { useReactAdapter } from "../hooks/useReactAdaptater";
5
- const { createRoot } = useReactAdapter();
6
5
  export function HydrateSpoiler(islands) {
6
+ const { createRoot } = useReactAdapter();
7
7
  islands?.forEach((el) => {
8
8
  const props = el.getAttribute("data-props");
9
9
  el.removeAttribute("data-props");
10
- const items = Array.from(el.querySelectorAll('div[data-wp-island="ga-ds-spoiler"]')).map((item) => {
10
+ const items = Array.from(el.querySelectorAll('div[data-wp-island="ga-ds-spoiler"]')).map((item, i) => {
11
11
  const props = item.getAttribute("data-props");
12
12
  return (_jsx(Spoiler, { ...(props ? JSON.parse(props) : {}), children: _jsx("div", { dangerouslySetInnerHTML: {
13
13
  __html: item.innerHTML,
14
- } }) }));
14
+ } }) }, i));
15
15
  });
16
16
  const root = createRoot(el);
17
17
  root.render(_jsx(SpoilerList, { ...(props ? JSON.parse(props) : {}), children: items }));
@@ -2,8 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Tabs } from "@growth-angels/ds-core";
3
3
  import { NativeChildWrapper } from "./utils/native-child-wrapper";
4
4
  import { useReactAdapter } from "../hooks/useReactAdaptater";
5
- const { createRoot } = useReactAdapter();
6
5
  export function HydrateTabs(els) {
6
+ const { createRoot } = useReactAdapter();
7
7
  els?.forEach((el) => {
8
8
  const props = el.getAttribute("data-props");
9
9
  el.removeAttribute("data-props");
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useReactAdapter } from "../../hooks/useReactAdaptater";
3
- const { useRef, useEffect } = useReactAdapter();
4
3
  export function NativeChildWrapper({ child, id }) {
4
+ const { useRef, useEffect } = useReactAdapter();
5
5
  const ref = useRef(null);
6
6
  useEffect(() => {
7
7
  if (ref.current) {
@@ -1,2 +1,2 @@
1
- import { ButtonGroupProps } from "./ButtonGroup.types";
1
+ import type { ButtonGroupProps } from "./ButtonGroup.types";
2
2
  export declare const ButtonGroup: ({ alignment, children, extraClassNames }: ButtonGroupProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { WordpressDefault } from "../../global.types";
1
+ import type { WordpressDefault } from "../../global.types";
2
2
  export interface ButtonGroupProps extends WordpressDefault {
3
3
  alignment?: 'center' | 'right';
4
4
  children?: React.ReactNode;
@@ -1,2 +1,2 @@
1
- import { SpoilerProps } from "./Spoiler.types";
1
+ import type { SpoilerProps } from "./Spoiler.types";
2
2
  export declare const Spoiler: (props: SpoilerProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,2 @@
1
- import { CarouselProps } from "./Carousel.types";
1
+ import type { CarouselProps } from "./Carousel.types";
2
2
  export declare const Carousel: (props: CarouselProps) => import("react/jsx-runtime").JSX.Element;
@@ -11,7 +11,7 @@ export const Carousel = (props) => {
11
11
  const slides = Children.toArray(children);
12
12
  const totalSlides = slides.length;
13
13
  const calculatePages = (slidesPerView = 0) => {
14
- let pagesArr = [];
14
+ const pagesArr = [];
15
15
  for (let i = slidesPerView; i < totalSlides; i++) {
16
16
  pagesArr.push({});
17
17
  }
@@ -1,4 +1,4 @@
1
- import { WordpressDefault } from "../../global.types";
1
+ import type { WordpressDefault } from "../../global.types";
2
2
  export type CarouselAttributes = {
3
3
  context?: 'wp-editor';
4
4
  slidesPerView?: {
@@ -1,2 +1,2 @@
1
- import { CarouselProps } from "./Carousel.types";
1
+ import type { CarouselProps } from "./Carousel.types";
2
2
  export declare const CarouselSwiper: (props: CarouselProps) => import("react/jsx-runtime").JSX.Element;
@@ -9,13 +9,13 @@ export default meta;
9
9
  export const Primary = {
10
10
  args: {
11
11
  children: [
12
- _jsx("div", { children: "Slide 1" }),
13
- _jsx("div", { children: "Slide 2" }),
14
- _jsx("div", { children: "Slide 3" }),
15
- _jsx("div", { children: "Slide 4" }),
16
- _jsx("div", { children: "Slide 5" }),
17
- _jsx("div", { children: "Slide 6" }),
18
- _jsx("div", { children: "Slide 7" }),
12
+ _jsx("div", { children: "Slide 1" }, 1),
13
+ _jsx("div", { children: "Slide 2" }, 2),
14
+ _jsx("div", { children: "Slide 3" }, 3),
15
+ _jsx("div", { children: "Slide 4" }, 4),
16
+ _jsx("div", { children: "Slide 5" }, 5),
17
+ _jsx("div", { children: "Slide 6" }, 6),
18
+ _jsx("div", { children: "Slide 7" }, 7),
19
19
  ],
20
20
  slidesPerView: { sm: 1, md: 2, lg: 3, xl: 4 },
21
21
  spaceBetween: 16,
@@ -1,2 +1,2 @@
1
- import { SpoilerListProps } from "./SpoilerList.types";
1
+ import type { SpoilerListProps } from "./SpoilerList.types";
2
2
  export declare const SpoilerList: ({ children, extraClassNames }: SpoilerListProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { WordpressDefault } from "../../global.types";
1
+ import type { WordpressDefault } from "../../global.types";
2
2
  export interface SpoilerListProps extends WordpressDefault {
3
3
  children?: React.ReactNode;
4
4
  }
@@ -1,2 +1,2 @@
1
- import { TabsProps } from "./Tabs.types";
1
+ import type { TabsProps } from "./Tabs.types";
2
2
  export declare const Tabs: ({ tabs, children, extraClassNames, edit }: TabsProps) => import("react/jsx-runtime").JSX.Element;
@@ -15,9 +15,9 @@ export const Primary = {
15
15
  { id: ids[2], label: "Tab 3" },
16
16
  ],
17
17
  children: [
18
- _jsx("div", { id: ids[0], children: "Content for Tab 1" }),
19
- _jsx("div", { id: ids[1], children: "Content for Tab 2" }),
20
- _jsx("div", { id: ids[2], children: "Content for Tab 3" }),
18
+ _jsx("div", { id: ids[0], children: "Content for Tab 1" }, 0),
19
+ _jsx("div", { id: ids[1], children: "Content for Tab 2" }, 1),
20
+ _jsx("div", { id: ids[2], children: "Content for Tab 3" }, 2),
21
21
  ],
22
22
  },
23
23
  };
@@ -1,4 +1,4 @@
1
- import { WordpressDefault } from "../../global.types";
1
+ import type { WordpressDefault } from "../../global.types";
2
2
  export interface TabsProps extends WordpressDefault {
3
3
  tabs: Array<{
4
4
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@growth-angels/ds-core",
3
- "version": "1.21.2",
3
+ "version": "1.22.1",
4
4
  "description": "Design system by Growth Angels",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -37,7 +37,7 @@
37
37
  "build-storybook": "storybook build"
38
38
  },
39
39
  "dependencies": {
40
- "@growth-angels/foundation": "^1.4.1",
40
+ "@growth-angels/foundation": "workspace:*",
41
41
  "swiper": "^12.0.3"
42
42
  },
43
43
  "peerDependencies": {
@@ -1,4 +1,4 @@
1
- import { WordpressDefault } from "../../global.types.js"
1
+ import type { WordpressDefault } from "../../global.types.js"
2
2
  import type { ElementType, ComponentPropsWithoutRef, ReactNode, MouseEventHandler, ElementRef } from "react"
3
3
 
4
4
  export type ButtonVariant = "primary" | "secondary" | "tertiary" | "link" | "icon"
@@ -1,5 +1,5 @@
1
1
  import { useThemeAssets } from "../../hooks/useThemeAssets"
2
- import { IconProps } from "./Icon.types"
2
+ import type { IconProps } from "./Icon.types"
3
3
 
4
4
  export const Icon = ({ name, size, extraClassNames }: IconProps) => {
5
5
  const { iconsSprite } = useThemeAssets()
@@ -1,4 +1,4 @@
1
- import { WordpressDefault } from "../../global.types"
1
+ import type { WordpressDefault } from "../../global.types"
2
2
 
3
3
  export interface IconProps extends WordpressDefault {
4
4
  name: string
@@ -1,5 +1,5 @@
1
1
  import { useReactAdapter } from "../../hooks/useReactAdaptater"
2
- import { TextProps } from "./Text.types"
2
+ import type { TextProps } from "./Text.types"
3
3
 
4
4
  export const Text = (props: TextProps) => {
5
5
  const React = useReactAdapter()
@@ -1,12 +1,11 @@
1
1
  import { useReactAdapter } from "../hooks/useReactAdaptater"
2
2
 
3
- const { createContext, useContext, useState } = useReactAdapter()
4
-
5
3
  interface SpoilerContextProps {
6
4
  activeIndex: number | null
7
5
  setActiveIndex: (index: number | null) => void
8
6
  }
9
7
 
8
+ const { createContext, useContext, useState } = useReactAdapter()
10
9
  const SpoilerContext = createContext<SpoilerContextProps | undefined>(undefined)
11
10
 
12
11
  export const SpoilerProvider = ({ children }: { children: React.ReactNode }) => {
@@ -1,4 +1,3 @@
1
- // @ts-ignore - React types from window.wp.element
2
1
  type ReactType = typeof import('react')
3
2
 
4
3
  type ExtendedReactType = ReactType & {
@@ -6,6 +6,7 @@
6
6
  display: flex;
7
7
  flex-direction: column;
8
8
  align-items: stretch;
9
+ --ga-container-safe-zone: 2.4rem;
9
10
 
10
11
  &:not(.ga-ds-container--full) {
11
12
  padding-left: var(--ga-container-safe-zone, 2.4rem);
@@ -29,43 +30,35 @@
29
30
  }
30
31
  }
31
32
 
32
- .ga-ds-container--small {
33
- @include bp-up("lg", $ga-breakpoints) {
34
- &:not(.ga-ds-container-stretch--right) {
35
- padding-right: calc((100% - (#{map.get($ga-containers, "sm")} / 0.8)) / 2);
36
- }
37
- &:not(.ga-ds-container-stretch--left) {
38
- padding-left: calc((100% - (#{map.get($ga-containers, "sm")} / 0.8)) / 2);
39
- }
40
- }
41
- @include bp-up("xxl", $ga-breakpoints) {
42
- &:not(.ga-ds-container-stretch--right) {
43
- padding-right: calc((100% - #{map.get($ga-containers, "sm")}) / 2);
44
- }
45
- &:not(.ga-ds-container-stretch--left) {
46
- padding-left: calc((100% - #{map.get($ga-containers, "sm")}) / 2);
47
- }
48
- }
49
- }
33
+ @each $key, $config in $ga-containers {
34
+ $breakpoint: map.get($config, "breakpoint");
35
+ $size: map.get($config, "size");
36
+ $class: map.get($config, "key");
50
37
 
51
- @include bp-up("xxl", $ga-breakpoints) {
52
- .ga-ds-container--medium {
53
- &:not(.ga-ds-container-stretch--right) {
54
- padding-right: calc((100% - #{map.get($ga-containers, "md")}) / 2);
55
- }
56
- &:not(.ga-ds-container-stretch--left) {
57
- padding-left: calc((100% - #{map.get($ga-containers, "md")}) / 2);
38
+ @if $key == null {
39
+ @warn "Unknown container key: #{$key}";
40
+ } @else if $key != "max" {
41
+ @include bp-up($breakpoint, $ga-breakpoints) {
42
+ .ga-ds-container--#{$class} {
43
+ &:not(.ga-ds-container-stretch--right) {
44
+ padding-right: calc((100% - (#{$size})) / 2);
45
+ }
46
+ &:not(.ga-ds-container-stretch--left) {
47
+ padding-left: calc((100% - (#{$size})) / 2);
48
+ }
49
+ }
58
50
  }
59
51
  }
60
- }
61
-
62
- @include bp-up("xxl", $ga-breakpoints) {
63
- .ga-ds-container--large {
64
- &:not(.ga-ds-container-stretch--right) {
65
- padding-right: calc((100% - #{map.get($ga-containers, "lg")}) / 2);
66
- }
67
- &:not(.ga-ds-container-stretch--left) {
68
- padding-left: calc((100% - #{map.get($ga-containers, "lg")}) / 2);
52
+ @if $key == "max" {
53
+ @include bp-up($breakpoint, $ga-breakpoints) {
54
+ .ga-ds-container--large {
55
+ &:not(.ga-ds-container-stretch--right) {
56
+ padding-right: calc((100% - (#{$size})) / 2);
57
+ }
58
+ &:not(.ga-ds-container-stretch--left) {
59
+ padding-left: calc((100% - (#{$size})) / 2);
60
+ }
61
+ }
69
62
  }
70
63
  }
71
64
  }
@@ -1,4 +1,4 @@
1
- import { WordpressDefault } from "../../global.types";
1
+ import type { WordpressDefault } from "../../global.types";
2
2
 
3
3
  export type ContainerSize = 'large' | 'medium' | 'small' | 'full';
4
4
  export type ContainerStretch = 'right' | 'left'
@@ -1,4 +1,4 @@
1
- import { FlexBlockProps } from "./FlexBlock.types"
1
+ import type { FlexBlockProps } from "./FlexBlock.types"
2
2
 
3
3
  export const FlexBlock = ({ children, gap, alignItems, justifyContent, flexDirection, extraClassNames }: FlexBlockProps) => {
4
4
  const styles = []
@@ -1,4 +1,4 @@
1
- import { WordpressDefault } from "../../global.types";
1
+ import type { WordpressDefault } from "../../global.types";
2
2
 
3
3
  export type FlexBlockAttrs = {
4
4
  gap?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
@@ -1,4 +1,4 @@
1
- import { FlexColAttrs } from "./FlexCol.types"
1
+ import type { FlexColAttrs } from "./FlexCol.types"
2
2
 
3
3
  export const FlexCol = ({ children, gap }: { children: React.ReactNode; gap?: FlexColAttrs["gap"] }) => {
4
4
  return (
@@ -1,4 +1,4 @@
1
- import { GridProps } from "./Grid.types"
1
+ import type { GridProps } from "./Grid.types"
2
2
  export const Grid = (props: GridProps): JSX.Element => {
3
3
  const { children, alignItems, justifyContent, extraClassNames, padding, margin, paddingPosition, marginPosition } = props
4
4
  const classNames = [
@@ -1,4 +1,4 @@
1
- import { WordpressDefault } from "../../global.types";
1
+ import type { WordpressDefault } from "../../global.types";
2
2
 
3
3
  export interface GridAttributes {
4
4
  alignItems: 'flex-start' | 'center' | 'flex-end' | 'none'
@@ -1,5 +1,5 @@
1
1
  import type { JSX } from "react/jsx-runtime"
2
- import { GridItemProps } from "./GridItem.types"
2
+ import type { GridItemProps } from "./GridItem.types"
3
3
  export const GridItem = (props: GridItemProps): JSX.Element => {
4
4
  const {
5
5
  children,
@@ -1,4 +1,4 @@
1
- import { WordpressDefault } from "../../../global.types";
1
+ import type { WordpressDefault } from "../../../global.types";
2
2
 
3
3
  export type ColumnSize = '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12'
4
4
 
@@ -9,12 +9,10 @@ import * as modules from "swiper/modules"
9
9
  }
10
10
  import "swiper/css"
11
11
  import "swiper/css/autoplay"
12
- const { createElement, createRoot } = useReactAdapter()
13
12
 
14
13
  export function HydrateCarousel(islands: NodeListOf<Element> | null) {
14
+ const { createElement, createRoot } = useReactAdapter()
15
15
  islands?.forEach((carousel) => {
16
- // first hide all carousels to prevent FOUC
17
- carousel.setAttribute("style", "opacity: 0")
18
16
  const Component = CarouselSwiper
19
17
  if (!Component) return
20
18
  const props = carousel.getAttribute("data-props")
@@ -31,6 +29,8 @@ export function HydrateCarousel(islands: NodeListOf<Element> | null) {
31
29
  root.render(createElement(Component, { ...parsedProps, children }))
32
30
  carousel.setAttribute("data-hydrated", "true")
33
31
  // finally show the carousel
34
- carousel.setAttribute("style", "opacity: 1")
32
+ setTimeout(() => {
33
+ carousel.setAttribute("style", "opacity: 1")
34
+ }, 1000)
35
35
  })
36
36
  }
@@ -1,16 +1,16 @@
1
1
  import { Spoiler } from "../molecules/molecules"
2
2
  import { SpoilerList } from "../organisms/organisms"
3
3
  import { useReactAdapter } from "../hooks/useReactAdaptater"
4
- const { createRoot } = useReactAdapter()
5
4
 
6
5
  export function HydrateSpoiler(islands: NodeListOf<Element> | null) {
6
+ const { createRoot } = useReactAdapter()
7
7
  islands?.forEach((el) => {
8
8
  const props = el.getAttribute("data-props")
9
9
  el.removeAttribute("data-props")
10
- const items = Array.from(el.querySelectorAll('div[data-wp-island="ga-ds-spoiler"]')).map((item) => {
10
+ const items = Array.from(el.querySelectorAll('div[data-wp-island="ga-ds-spoiler"]')).map((item, i) => {
11
11
  const props = item.getAttribute("data-props")
12
12
  return (
13
- <Spoiler {...(props ? JSON.parse(props) : {})}>
13
+ <Spoiler key={i} {...(props ? JSON.parse(props) : {})}>
14
14
  <div
15
15
  dangerouslySetInnerHTML={{
16
16
  __html: item.innerHTML,
@@ -1,9 +1,9 @@
1
1
  import { Tabs } from "@growth-angels/ds-core"
2
2
  import { NativeChildWrapper } from "./utils/native-child-wrapper"
3
3
  import { useReactAdapter } from "../hooks/useReactAdaptater"
4
- const { createRoot } = useReactAdapter()
5
4
 
6
5
  export function HydrateTabs(els: NodeListOf<Element> | null) {
6
+ const { createRoot } = useReactAdapter()
7
7
  els?.forEach((el) => {
8
8
  const props = el.getAttribute("data-props")
9
9
  el.removeAttribute("data-props")
@@ -26,7 +26,7 @@ export function HydrateTabs(els: NodeListOf<Element> | null) {
26
26
  root.render(
27
27
  <Tabs tabs={tabs} extraClassNames={extraClassNames}>
28
28
  {tabPanels}
29
- </Tabs>
29
+ </Tabs>,
30
30
  )
31
31
  })
32
32
  }
@@ -1,7 +1,7 @@
1
1
  import { useReactAdapter } from "../../hooks/useReactAdaptater"
2
- const { useRef, useEffect } = useReactAdapter()
3
2
 
4
3
  export function NativeChildWrapper({ child, id }: { child: Element; id?: string }) {
4
+ const { useRef, useEffect } = useReactAdapter()
5
5
  const ref = useRef<HTMLDivElement | null>(null)
6
6
 
7
7
  useEffect(() => {
@@ -1,4 +1,4 @@
1
- import { ButtonGroupProps } from "./ButtonGroup.types"
1
+ import type { ButtonGroupProps } from "./ButtonGroup.types"
2
2
 
3
3
  export const ButtonGroup = ({ alignment, children, extraClassNames }: ButtonGroupProps) => {
4
4
  const style = {} as React.CSSProperties & Record<string, string | number | undefined>
@@ -1,4 +1,4 @@
1
- import { WordpressDefault } from "../../global.types";
1
+ import type { WordpressDefault } from "../../global.types";
2
2
 
3
3
  export interface ButtonGroupProps extends WordpressDefault {
4
4
  alignment?: 'center' | 'right';
@@ -1,4 +1,4 @@
1
- import { SpoilerProps } from "./Spoiler.types"
1
+ import type { SpoilerProps } from "./Spoiler.types"
2
2
  import { useReactAdapter } from "../../hooks/useReactAdaptater"
3
3
  import { Icon } from "../../atoms/Icon/Icon"
4
4
  import { useSpoilerContext } from "../../context/SpoilerContext"
@@ -1,7 +1,7 @@
1
1
  import { Button } from "../../atoms/atoms"
2
2
  import { useBreakpointObserver } from "../../hooks/useBreakPointObserver"
3
3
  import { useReactAdapter } from "../../hooks/useReactAdaptater"
4
- import { CarouselProps } from "./Carousel.types"
4
+ import type { CarouselProps } from "./Carousel.types"
5
5
 
6
6
  export const Carousel = (props: CarouselProps) => {
7
7
  const {
@@ -22,7 +22,7 @@ export const Carousel = (props: CarouselProps) => {
22
22
  const slides = Children.toArray(children)
23
23
  const totalSlides = slides.length
24
24
  const calculatePages = (slidesPerView = 0) => {
25
- let pagesArr = []
25
+ const pagesArr = []
26
26
  for (let i = slidesPerView; i < totalSlides; i++) {
27
27
  pagesArr.push({})
28
28
  }
@@ -1,4 +1,4 @@
1
- import { WordpressDefault } from "../../global.types"
1
+ import type { WordpressDefault } from "../../global.types"
2
2
 
3
3
  export type CarouselAttributes = {
4
4
  context?: 'wp-editor'
@@ -13,13 +13,13 @@ type Story = StoryObj<typeof CarouselSwiper>
13
13
  export const Primary: Story = {
14
14
  args: {
15
15
  children: [
16
- <div>Slide 1</div>,
17
- <div>Slide 2</div>,
18
- <div>Slide 3</div>,
19
- <div>Slide 4</div>,
20
- <div>Slide 5</div>,
21
- <div>Slide 6</div>,
22
- <div>Slide 7</div>,
16
+ <div key={1}>Slide 1</div>,
17
+ <div key={2}>Slide 2</div>,
18
+ <div key={3}>Slide 3</div>,
19
+ <div key={4}>Slide 4</div>,
20
+ <div key={5}>Slide 5</div>,
21
+ <div key={6}>Slide 6</div>,
22
+ <div key={7}>Slide 7</div>,
23
23
  ],
24
24
  slidesPerView: { sm: 1, md: 2, lg: 3, xl: 4 },
25
25
  spaceBetween: 16,
@@ -1,5 +1,5 @@
1
1
  import { useReactAdapter } from "../../hooks/useReactAdaptater"
2
- import { CarouselProps } from "./Carousel.types"
2
+ import type { CarouselProps } from "./Carousel.types"
3
3
  import { Button } from "../../atoms/atoms"
4
4
  import Swiper from "swiper"
5
5
  import { Autoplay, Navigation, Pagination } from "swiper/modules"
@@ -1,6 +1,6 @@
1
1
  import { SpoilerProvider } from "../../context/SpoilerContext"
2
2
  import { useReactAdapter } from "../../hooks/useReactAdaptater"
3
- import { SpoilerListProps } from "./SpoilerList.types"
3
+ import type { SpoilerListProps } from "./SpoilerList.types"
4
4
 
5
5
  export const SpoilerList = ({ children, extraClassNames }: SpoilerListProps) => {
6
6
  const { Children, cloneElement } = useReactAdapter()
@@ -1,4 +1,4 @@
1
- import { WordpressDefault } from "../../global.types";
1
+ import type { WordpressDefault } from "../../global.types";
2
2
 
3
3
  export interface SpoilerListProps extends WordpressDefault {
4
4
  children?: React.ReactNode
@@ -18,9 +18,15 @@ export const Primary: Story = {
18
18
  { id: ids[2], label: "Tab 3" },
19
19
  ],
20
20
  children: [
21
- <div id={ids[0]}>Content for Tab 1</div>,
22
- <div id={ids[1]}>Content for Tab 2</div>,
23
- <div id={ids[2]}>Content for Tab 3</div>,
21
+ <div key={0} id={ids[0]}>
22
+ Content for Tab 1
23
+ </div>,
24
+ <div key={1} id={ids[1]}>
25
+ Content for Tab 2
26
+ </div>,
27
+ <div key={2} id={ids[2]}>
28
+ Content for Tab 3
29
+ </div>,
24
30
  ],
25
31
  },
26
32
  }
@@ -1,5 +1,5 @@
1
1
  import { useReactAdapter } from "../../hooks/useReactAdaptater"
2
- import { TabsProps } from "./Tabs.types"
2
+ import type { TabsProps } from "./Tabs.types"
3
3
  export const Tabs = ({ tabs, children, extraClassNames, edit }: TabsProps) => {
4
4
  const { useState, useRef, Children } = useReactAdapter()
5
5
 
@@ -1,4 +1,4 @@
1
- import { WordpressDefault } from "../../global.types"
1
+ import type { WordpressDefault } from "../../global.types"
2
2
 
3
3
  export interface TabsProps extends WordpressDefault {
4
4
  tabs: Array<{