@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.
- package/dist/atoms/Button/Button.types.d.ts +1 -1
- package/dist/atoms/Icon/Icon.d.ts +1 -1
- package/dist/atoms/Icon/Icon.types.d.ts +1 -1
- package/dist/atoms/Text/Text.d.ts +1 -1
- package/dist/layout/Container/Container.types.d.ts +1 -1
- package/dist/layout/FlexBlock/FlexBlock.d.ts +1 -1
- package/dist/layout/FlexBlock/FlexBlock.types.d.ts +1 -1
- package/dist/layout/FlexCol/FlexCol.d.ts +1 -1
- package/dist/layout/Grid/Grid.d.ts +1 -1
- package/dist/layout/Grid/Grid.types.d.ts +1 -1
- package/dist/layout/Grid/GridItem/GridItem.d.ts +1 -1
- package/dist/layout/Grid/GridItem/GridItem.types.d.ts +1 -1
- package/dist/lib/hydrate-carousel.js +4 -4
- package/dist/lib/hydrate-spoiler.js +3 -3
- package/dist/lib/hydrate-tabs.js +1 -1
- package/dist/lib/utils/native-child-wrapper.js +1 -1
- package/dist/molecules/ButtonGroup/ButtonGroup.d.ts +1 -1
- package/dist/molecules/ButtonGroup/ButtonGroup.types.d.ts +1 -1
- package/dist/molecules/Spoiler/Spoiler.d.ts +1 -1
- package/dist/organisms/Carousel/Carousel.d.ts +1 -1
- package/dist/organisms/Carousel/Carousel.js +1 -1
- package/dist/organisms/Carousel/Carousel.types.d.ts +1 -1
- package/dist/organisms/Carousel/CarouselSwiper.d.ts +1 -1
- package/dist/organisms/Carousel/CarouselSwiper.stories.js +7 -7
- package/dist/organisms/SpoilerList/SpoilerList.d.ts +1 -1
- package/dist/organisms/SpoilerList/SpoilerList.types.d.ts +1 -1
- package/dist/organisms/Tabs/Tabs.d.ts +1 -1
- package/dist/organisms/Tabs/Tabs.stories.js +3 -3
- package/dist/organisms/Tabs/Tabs.types.d.ts +1 -1
- package/package.json +2 -2
- package/src/atoms/Button/Button.types.ts +1 -1
- package/src/atoms/Icon/Icon.tsx +1 -1
- package/src/atoms/Icon/Icon.types.ts +1 -1
- package/src/atoms/Text/Text.tsx +1 -1
- package/src/context/SpoilerContext.tsx +1 -2
- package/src/hooks/useReactAdaptater.ts +0 -1
- package/src/layout/Container/Container.scss +27 -34
- package/src/layout/Container/Container.types.ts +1 -1
- package/src/layout/FlexBlock/FlexBlock.tsx +1 -1
- package/src/layout/FlexBlock/FlexBlock.types.ts +1 -1
- package/src/layout/FlexCol/FlexCol.tsx +1 -1
- package/src/layout/Grid/Grid.tsx +1 -1
- package/src/layout/Grid/Grid.types.ts +1 -1
- package/src/layout/Grid/GridItem/GridItem.tsx +1 -1
- package/src/layout/Grid/GridItem/GridItem.types.ts +1 -1
- package/src/lib/hydrate-carousel.tsx +4 -4
- package/src/lib/hydrate-spoiler.tsx +3 -3
- package/src/lib/hydrate-tabs.tsx +2 -2
- package/src/lib/utils/native-child-wrapper.tsx +1 -1
- package/src/molecules/ButtonGroup/ButtonGroup.tsx +1 -1
- package/src/molecules/ButtonGroup/ButtonGroup.types.ts +1 -1
- package/src/molecules/Spoiler/Spoiler.tsx +1 -1
- package/src/organisms/Carousel/Carousel.tsx +2 -2
- package/src/organisms/Carousel/Carousel.types.ts +1 -1
- package/src/organisms/Carousel/CarouselSwiper.stories.tsx +7 -7
- package/src/organisms/Carousel/CarouselSwiper.tsx +1 -1
- package/src/organisms/SpoilerList/SpoilerList.tsx +1 -1
- package/src/organisms/SpoilerList/SpoilerList.types.ts +1 -1
- package/src/organisms/Tabs/Tabs.stories.tsx +9 -3
- package/src/organisms/Tabs/Tabs.tsx +1 -1
- 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 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,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,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
|
-
|
|
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 }));
|
package/dist/lib/hydrate-tabs.js
CHANGED
|
@@ -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,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
|
-
|
|
14
|
+
const pagesArr = [];
|
|
15
15
|
for (let i = slidesPerView; i < totalSlides; i++) {
|
|
16
16
|
pagesArr.push({});
|
|
17
17
|
}
|
|
@@ -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,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
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@growth-angels/ds-core",
|
|
3
|
-
"version": "1.
|
|
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": "
|
|
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"
|
package/src/atoms/Icon/Icon.tsx
CHANGED
package/src/atoms/Text/Text.tsx
CHANGED
|
@@ -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 }) => {
|
|
@@ -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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
@
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
}
|
package/src/layout/Grid/Grid.tsx
CHANGED
|
@@ -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 = [
|
|
@@ -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
|
-
|
|
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,
|
package/src/lib/hydrate-tabs.tsx
CHANGED
|
@@ -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 { 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
|
-
|
|
25
|
+
const pagesArr = []
|
|
26
26
|
for (let i = slidesPerView; i < totalSlides; i++) {
|
|
27
27
|
pagesArr.push({})
|
|
28
28
|
}
|
|
@@ -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()
|
|
@@ -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]}>
|
|
22
|
-
|
|
23
|
-
|
|
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
|
|