@growth-angels/ds-core 0.0.5 → 1.0.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.
Files changed (129) hide show
  1. package/dist/atoms/Button/Button.stories.d.ts +2 -2
  2. package/dist/atoms/Button/Button.stories.js +15 -15
  3. package/dist/atoms/Button/Button.types.d.ts +2 -2
  4. package/dist/atoms/Icon/Icon.d.ts +1 -1
  5. package/dist/atoms/Icon/Icon.js +3 -3
  6. package/dist/atoms/Icon/Icon.types.d.ts +2 -1
  7. package/dist/atoms/Text/Text.d.ts +1 -0
  8. package/dist/atoms/Text/Text.js +4 -3
  9. package/dist/atoms/Text/Text.types.d.ts +5 -1
  10. package/dist/atoms/atoms.d.ts +3 -0
  11. package/dist/atoms/atoms.js +3 -0
  12. package/dist/context/SpoilerContext.d.ts +9 -0
  13. package/dist/context/SpoilerContext.js +15 -0
  14. package/dist/global.types.d.ts +4 -0
  15. package/dist/hooks/useReactAdaptater.d.ts +10 -2
  16. package/dist/hooks/useReactAdaptater.js +6 -3
  17. package/dist/hooks/useSpoilerContext.d.ts +4 -0
  18. package/dist/hooks/useSpoilerContext.js +12 -0
  19. package/dist/index.d.ts +1 -0
  20. package/dist/index.js +1 -0
  21. package/dist/layout/Container/Container.d.ts +2 -3
  22. package/dist/layout/Container/Container.js +10 -3
  23. package/dist/layout/Container/Container.types.d.ts +3 -0
  24. package/dist/layout/FlexBlock/FlexBlock.d.ts +2 -0
  25. package/dist/layout/FlexBlock/FlexBlock.js +21 -0
  26. package/dist/layout/FlexBlock/FlexBlock.types.d.ts +10 -0
  27. package/dist/layout/FlexBlock/FlexBlock.types.js +1 -0
  28. package/dist/layout/FlexCol/FlexCol.d.ts +5 -0
  29. package/dist/layout/FlexCol/FlexCol.js +4 -0
  30. package/dist/layout/FlexCol/FlexCol.types.d.ts +3 -0
  31. package/dist/layout/FlexCol/FlexCol.types.js +1 -0
  32. package/dist/layout/Grid/Grid.d.ts +1 -2
  33. package/dist/layout/Grid/Grid.js +3 -3
  34. package/dist/layout/Grid/Grid.types.d.ts +4 -4
  35. package/dist/layout/Grid/GridItem/GridItem.d.ts +2 -2
  36. package/dist/layout/Grid/GridItem/GridItem.js +10 -3
  37. package/dist/layout/Grid/GridItem/GridItem.types.d.ts +3 -2
  38. package/dist/layout/layout.d.ts +7 -0
  39. package/dist/layout/layout.js +7 -0
  40. package/dist/molecules/ButtonGroup/ButtonGroup.d.ts +2 -0
  41. package/dist/molecules/ButtonGroup/ButtonGroup.js +16 -0
  42. package/dist/molecules/ButtonGroup/ButtonGroup.types.d.ts +5 -0
  43. package/dist/molecules/ButtonGroup/ButtonGroup.types.js +1 -0
  44. package/dist/molecules/Spoiler/Spoiler.d.ts +2 -0
  45. package/dist/molecules/Spoiler/Spoiler.js +13 -0
  46. package/dist/molecules/Spoiler/Spoiler.stories.d.ts +7 -0
  47. package/dist/molecules/Spoiler/Spoiler.stories.js +25 -0
  48. package/dist/molecules/Spoiler/Spoiler.types.d.ts +6 -0
  49. package/dist/molecules/Spoiler/Spoiler.types.js +1 -0
  50. package/dist/molecules/molecules.d.ts +2 -0
  51. package/dist/molecules/molecules.js +2 -0
  52. package/dist/organisms/Card/Card.d.ts +3 -3
  53. package/dist/organisms/Card/Card.js +4 -4
  54. package/dist/organisms/Card/Card.types.d.ts +12 -3
  55. package/dist/organisms/Card/CardDefault.stories.d.ts +2 -2
  56. package/dist/organisms/Card/CardDefault.stories.js +17 -17
  57. package/dist/organisms/Carousel/Carousel.js +5 -1
  58. package/dist/organisms/Carousel/Carousel.types.d.ts +2 -1
  59. package/dist/organisms/SpoilerList/SpoilerList.d.ts +2 -0
  60. package/dist/organisms/SpoilerList/SpoilerList.js +11 -0
  61. package/dist/organisms/SpoilerList/SpoilerList.types.d.ts +4 -0
  62. package/dist/organisms/SpoilerList/SpoilerList.types.js +1 -0
  63. package/dist/organisms/organisms.d.ts +2 -0
  64. package/dist/organisms/organisms.js +2 -0
  65. package/dist/styles.d.ts +1 -0
  66. package/dist/styles.js +1 -0
  67. package/package.json +10 -9
  68. package/src/atoms/Button/Button.scss +18 -19
  69. package/src/atoms/Button/Button.stories.tsx +17 -17
  70. package/src/atoms/Button/Button.types.ts +2 -2
  71. package/src/atoms/Icon/Icon.scss +9 -9
  72. package/src/atoms/Icon/Icon.tsx +10 -8
  73. package/src/atoms/Icon/Icon.types.ts +3 -1
  74. package/src/atoms/Text/Text.scss +33 -2
  75. package/src/atoms/Text/Text.tsx +13 -8
  76. package/src/atoms/Text/Text.types.ts +5 -1
  77. package/src/atoms/atoms.scss +3 -3
  78. package/src/atoms/atoms.ts +3 -0
  79. package/src/context/SpoilerContext.tsx +24 -0
  80. package/src/global.types.ts +4 -0
  81. package/src/hooks/useReactAdaptater.ts +20 -4
  82. package/src/hooks/useSpoilerContext.ts +17 -0
  83. package/src/index.scss +2 -0
  84. package/src/index.ts +1 -0
  85. package/src/layout/Container/Container.scss +55 -13
  86. package/src/layout/Container/Container.tsx +17 -9
  87. package/src/layout/Container/Container.types.ts +3 -1
  88. package/src/layout/FlexBlock/FlexBlock.scss +4 -0
  89. package/src/layout/FlexBlock/FlexBlock.tsx +31 -0
  90. package/src/layout/FlexBlock/FlexBlock.types.ts +12 -0
  91. package/src/layout/FlexCol/FlexCol.scss +5 -0
  92. package/src/layout/FlexCol/FlexCol.tsx +12 -0
  93. package/src/layout/FlexCol/FlexCol.types.ts +3 -0
  94. package/src/layout/Grid/Grid.scss +8 -4
  95. package/src/layout/Grid/Grid.tsx +12 -8
  96. package/src/layout/Grid/Grid.types.ts +4 -4
  97. package/src/layout/Grid/GridItem/GridItem.scss +17 -4
  98. package/src/layout/Grid/GridItem/GridItem.tsx +28 -13
  99. package/src/layout/Grid/GridItem/GridItem.types.ts +3 -2
  100. package/src/layout/layout.scss +5 -3
  101. package/src/layout/layout.ts +8 -1
  102. package/src/molecules/ButtonGroup/ButtonGroup.scss +5 -0
  103. package/src/molecules/ButtonGroup/ButtonGroup.tsx +23 -0
  104. package/src/molecules/ButtonGroup/ButtonGroup.types.ts +6 -0
  105. package/src/molecules/Spoiler/Spoiler.scss +47 -0
  106. package/src/molecules/Spoiler/Spoiler.stories.tsx +44 -0
  107. package/src/molecules/Spoiler/Spoiler.tsx +30 -0
  108. package/src/molecules/Spoiler/Spoiler.types.ts +6 -0
  109. package/src/molecules/molecules.scss +2 -0
  110. package/src/molecules/molecules.ts +2 -0
  111. package/src/organisms/Card/Card.scss +50 -10
  112. package/src/organisms/Card/Card.tsx +17 -6
  113. package/src/organisms/Card/Card.types.ts +12 -3
  114. package/src/organisms/Card/CardDefault.stories.tsx +40 -37
  115. package/src/organisms/Carousel/Carousel.scss +3 -0
  116. package/src/organisms/Carousel/Carousel.tsx +7 -1
  117. package/src/organisms/Carousel/Carousel.types.ts +3 -1
  118. package/src/organisms/SpoilerList/SpoilerList.scss +5 -0
  119. package/src/organisms/SpoilerList/SpoilerList.tsx +19 -0
  120. package/src/organisms/SpoilerList/SpoilerList.types.ts +5 -0
  121. package/src/organisms/organisms.scss +3 -2
  122. package/src/organisms/organisms.ts +3 -1
  123. package/src/scss.d.ts +4 -0
  124. package/src/styles.ts +1 -0
  125. package/src/utils/_spacings.scss +17 -0
  126. package/src/utils/utils.scss +1 -0
  127. package/dist/utils.d.ts +0 -0
  128. package/dist/utils.js +0 -1
  129. package/src/utils.ts +0 -0
@@ -1,32 +1,32 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Card } from './Card';
3
- import { Button } from '../../atoms/atoms';
4
- import CardDefaultHeader600x400 from '../../../assets/600x400.svg';
5
- import CardDefaultHeader50x50 from '../../../assets/50x50.svg';
2
+ import { Card } from "./Card";
3
+ import { Button } from "../../atoms/atoms";
4
+ import CardDefaultHeader600x400 from "../../../assets/600x400.svg";
5
+ import CardDefaultHeader50x50 from "../../../assets/50x50.svg";
6
6
  const meta = {
7
- title: 'Organisms/Card/Default',
7
+ title: "Organisms/Card/Default",
8
8
  component: Card,
9
- tags: ['autodocs'],
9
+ tags: ["autodocs"],
10
10
  };
11
11
  export default meta;
12
12
  const CardChildren = ({ image }) => {
13
13
  const images = {
14
- '400x600': CardDefaultHeader600x400,
15
- '50x50': CardDefaultHeader50x50
14
+ "400x600": CardDefaultHeader600x400,
15
+ "50x50": CardDefaultHeader50x50,
16
16
  };
17
- return _jsxs(_Fragment, { children: [_jsx("div", { className: "ga-ds-card__header", children: _jsx("img", { src: images[image], alt: "Card header" }) }), _jsx("div", { className: "ga-ds-card__title", children: _jsx("h2", { children: "Card title" }) }), _jsx("div", { className: 'ga-ds-card__content', children: _jsx("p", { children: "Lorem ipsum dolor sit amet consectetur, adipisicing elit. Porro temporibus quam ex consequatur est laboriosam nam quisquam doloremque perferendis quo ut, tempora error neque modi delectus assumenda! A, doloremque nulla." }) }), _jsx("div", { className: "ga-ds-card__footer", children: _jsx(Button, { as: "a", variant: 'primary', children: "Read more" }) })] });
17
+ return (_jsxs(_Fragment, { children: [_jsx("div", { className: "ga-ds-card__header", children: _jsx("img", { src: images[image], alt: "Card header" }) }), _jsx("div", { className: "ga-ds-card__title", children: _jsx("h2", { children: "Card title" }) }), _jsx("div", { className: "ga-ds-card__content", children: _jsx("p", { children: "Lorem ipsum dolor sit amet consectetur, adipisicing elit. Porro temporibus quam ex consequatur est laboriosam nam quisquam doloremque perferendis quo ut, tempora error neque modi delectus assumenda! A, doloremque nulla." }) }), _jsx("div", { className: "ga-ds-card__footer", children: _jsx(Button, { as: "a", variant: "primary", children: "Read more" }) })] }));
18
18
  };
19
19
  export const Primary = {
20
20
  args: {
21
- variant: 'primary',
22
- type: 'default',
23
- children: _jsx(CardChildren, { image: '400x600' })
24
- }
21
+ variant: "primary",
22
+ type: "image",
23
+ children: _jsx(CardChildren, { image: "400x600" }),
24
+ },
25
25
  };
26
26
  export const Secondary = {
27
27
  args: {
28
- variant: 'secondary',
29
- type: 'default',
30
- children: _jsx(CardChildren, { image: '400x600' })
31
- }
28
+ variant: "secondary",
29
+ type: "image",
30
+ children: _jsx(CardChildren, { image: "400x600" }),
31
+ },
32
32
  };
@@ -65,7 +65,11 @@ export const Carousel = (props) => {
65
65
  });
66
66
  setActiveSlideIndex(nextIndex);
67
67
  };
68
- return (_jsxs("div", { className: "ga-ds-carousel", style: style, children: [navigation?.positionY === "top" && hasNavigation && (_jsx(CarouselNavigation, { goPrev: goPrev, goNext: goNext, isAtStart: isAtStart, isAtEnd: isAtEnd })), _jsx("div", { className: "ga-ds-carousel__track", ref: trackRef, style: {
68
+ const classes = ["ga-ds-carousel"];
69
+ if (props.extraClassNames) {
70
+ classes.push(...props.extraClassNames);
71
+ }
72
+ return (_jsxs("div", { className: classes.join(" "), style: style, children: [navigation?.positionY === "top" && hasNavigation && (_jsx(CarouselNavigation, { goPrev: goPrev, goNext: goNext, isAtStart: isAtStart, isAtEnd: isAtEnd })), _jsx("div", { className: "ga-ds-carousel__track", ref: trackRef, style: {
69
73
  "--ga-ds-space-between": `${spaceBetween / 10}rem`,
70
74
  }, children: context === "wp-editor"
71
75
  ? children
@@ -1,3 +1,4 @@
1
+ import { WordpressDefault } from "../../global.types";
1
2
  export type Attributes = {
2
3
  context?: 'wp-editor';
3
4
  slidesPerView?: {
@@ -15,6 +16,6 @@ export type Attributes = {
15
16
  positionY: 'bottom' | 'top';
16
17
  };
17
18
  };
18
- export interface CarouselProps extends Attributes {
19
+ export interface CarouselProps extends Attributes, WordpressDefault {
19
20
  children: React.ReactNode | React.ReactNode[];
20
21
  }
@@ -0,0 +1,2 @@
1
+ import { SpoilerListProps } from "./SpoilerList.types";
2
+ export declare const SpoilerList: ({ children, extraClassNames }: SpoilerListProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { SpoilerProvider } from "../../context/SpoilerContext";
3
+ import { useReactAdapter } from "../../hooks/useReactAdaptater";
4
+ export const SpoilerList = ({ children, extraClassNames }) => {
5
+ const { Children, cloneElement } = useReactAdapter();
6
+ const classes = ["ga-ds-spoiler-list"];
7
+ if (extraClassNames) {
8
+ classes.push(...extraClassNames);
9
+ }
10
+ return (_jsx("div", { className: classes.join(" "), children: _jsx(SpoilerProvider, { children: Children.toArray(children).map((child, index) => cloneElement(child, { index })) }) }));
11
+ };
@@ -0,0 +1,4 @@
1
+ import { WordpressDefault } from "../../global.types";
2
+ export interface SpoilerListProps extends WordpressDefault {
3
+ children?: React.ReactNode;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,4 @@
1
1
  export * from './Card/Card';
2
+ export * from './Card/Card.types';
2
3
  export * from './Carousel/Carousel';
4
+ export * from './SpoilerList/SpoilerList';
@@ -1,2 +1,4 @@
1
1
  export * from './Card/Card';
2
+ export * from './Card/Card.types';
2
3
  export * from './Carousel/Carousel';
4
+ export * from './SpoilerList/SpoilerList';
@@ -0,0 +1 @@
1
+ import './index.scss';
package/dist/styles.js ADDED
@@ -0,0 +1 @@
1
+ import './index.scss';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@growth-angels/ds-core",
3
- "version": "0.0.5",
3
+ "version": "1.0.0",
4
4
  "description": "Design system by Growth Angels",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -16,7 +16,8 @@
16
16
  "import": "./dist/index.js",
17
17
  "types": "./dist/index.d.ts"
18
18
  },
19
- "./styles": "./src/index.scss"
19
+ "./styles": "./src/styles.ts",
20
+ "./styles/scss": "./src/index.scss"
20
21
  },
21
22
  "files": [
22
23
  "dist",
@@ -31,24 +32,24 @@
31
32
  "build-storybook": "storybook build"
32
33
  },
33
34
  "dependencies": {
34
- "@growth-angels/foundation": "0.0.3"
35
+ "@growth-angels/foundation": "1.0.0"
35
36
  },
36
37
  "peerDependencies": {
37
38
  "react": ">=18"
38
39
  },
39
40
  "devDependencies": {
40
- "@chromatic-com/storybook": "^4.1.1",
41
- "@storybook/addon-a11y": "^9.1.13",
42
- "@storybook/addon-docs": "^9.1.13",
43
- "@storybook/addon-vitest": "^9.1.13",
44
- "@storybook/react-vite": "^9.1.13",
41
+ "@chromatic-com/storybook": "^4.1.2",
42
+ "@storybook/addon-a11y": "^10.0.4",
43
+ "@storybook/addon-docs": "^10.0.4",
44
+ "@storybook/addon-vitest": "^10.0.4",
45
+ "@storybook/react-vite": "^10.0.4",
45
46
  "@types/react": "^18.0.0",
46
47
  "@vitest/browser": "^3.2.4",
47
48
  "@vitest/coverage-v8": "^3.2.4",
48
49
  "concurrently": "^9.2.1",
49
50
  "playwright": "^1.56.1",
50
51
  "sass": "^1.93.2",
51
- "storybook": "^9.1.13",
52
+ "storybook": "^10.0.4",
52
53
  "typescript": "^5.4.0",
53
54
  "vitest": "^3.2.4"
54
55
  }
@@ -1,31 +1,30 @@
1
- .ga-ds-btn {
1
+ .ga-ds-button > * {
2
2
  padding: var(--ga-button-padding);
3
- display: inline-flex;
4
3
  border: none;
5
4
  font-size: var(--ga-font-sizes-base);
6
5
  font-weight: var(--ga-font-weight-base);
7
6
  font-family: var(--ga-font-family-button);
8
7
  border-radius: var(--ga-button-radius, 0);
9
8
  cursor: pointer;
9
+ }
10
10
 
11
- &--primary {
12
- background-color: var(--ga-button-background-primary, #eee);
13
- color: var(--ga-button-color-primary, #000);
14
- }
11
+ .ga-ds-button--primary > * {
12
+ background-color: var(--ga-button-background-primary, #eee);
13
+ color: var(--ga-button-color-primary, #000);
14
+ }
15
15
 
16
- &--secondary {
17
- background-color: var(--ga-button-background-secondary, #424242);
18
- color: var(--ga-button-color-secondary, #fff);
19
- }
16
+ .ga-ds-button--secondary > * {
17
+ background-color: var(--ga-button-background-secondary, #424242);
18
+ color: var(--ga-button-color-secondary, #fff);
19
+ }
20
20
 
21
- &--link {
22
- color: var(--ga-button-color-link, purple);
23
- padding: 0;
24
- }
21
+ .ga-ds-button--link > * {
22
+ color: var(--ga-button-color-link, purple);
23
+ padding: 0;
24
+ }
25
25
 
26
- &--icon {
27
- --ga-button-padding: 0.8rem 1.2rem;
28
- justify-content: center;
29
- align-items: center;
30
- }
26
+ .ga-ds-button--icon > * {
27
+ --ga-button-padding: 0.8rem 1.2rem;
28
+ justify-content: center;
29
+ align-items: center;
31
30
  }
@@ -1,10 +1,10 @@
1
- import type { Meta, StoryObj } from '@storybook/react-vite';
2
- import { Button } from './Button'
1
+ import type { Meta, StoryObj } from "@storybook/react-vite"
2
+ import { Button } from "./Button"
3
3
 
4
4
  const meta: Meta<typeof Button> = {
5
- title: 'Atoms/Button',
5
+ title: "Atoms/Button",
6
6
  component: Button,
7
- tags: ['autodocs'],
7
+ tags: ["autodocs"],
8
8
  }
9
9
 
10
10
  export default meta
@@ -12,27 +12,27 @@ type Story = StoryObj<typeof Button>
12
12
 
13
13
  export const Primary: Story = {
14
14
  args: {
15
- variant: 'primary',
16
- children: 'Button',
17
- as: 'a',
18
- href: '#',
15
+ variant: "primary",
16
+ children: "Button",
17
+ as: "a",
18
+ href: "#",
19
19
  },
20
20
  }
21
21
 
22
22
  export const Secondary: Story = {
23
23
  args: {
24
- variant: 'secondary',
25
- children: 'Button',
26
- as: 'a',
27
- href: '#',
24
+ variant: "secondary",
25
+ children: "Button",
26
+ as: "a",
27
+ href: "#",
28
28
  },
29
29
  }
30
30
 
31
31
  export const Link: Story = {
32
32
  args: {
33
- variant: 'link',
34
- children: 'Button',
35
- as: 'a',
36
- href: '#',
33
+ variant: "link",
34
+ children: "Button",
35
+ as: "a",
36
+ href: "#",
37
37
  },
38
- }
38
+ }
@@ -1,11 +1,11 @@
1
1
  import { WordpressDefault } from "../../global.types.js"
2
2
  import React, { ElementType, ComponentPropsWithoutRef } from "react"
3
3
 
4
- export type Variant = "primary" | "secondary" | "tertiary" | "link" | "icon"
4
+ export type ButtonVariant = "primary" | "secondary" | "tertiary" | "link" | "icon"
5
5
 
6
6
  export type ButtonProps<T extends ElementType = "button"> = {
7
7
  as?: T
8
- variant?: Variant
8
+ variant?: ButtonVariant
9
9
  hasIcon?: "left" | "right"
10
10
  icon?: "chevron-left" | "chevron-right"
11
11
  preventDefault?: boolean
@@ -1,19 +1,19 @@
1
1
  .ga-ds-icon {
2
- width: 2.4rem;
3
- height: 2.4rem;
2
+ width: var(--icon-size, 2.4rem);
3
+ height: var(--icon-size, 2.4rem);
4
4
 
5
5
  &--sm {
6
- width: 1.8rem;
7
- height: 1.8rem;
6
+ width: var(--icon-size-sm, 1.8rem);
7
+ height: var(--icon-size-sm, 1.8rem);
8
8
  }
9
9
 
10
10
  &--md {
11
- width: 3rem;
12
- height: 3rem;
11
+ width: var(--icon-size-md, 3rem);
12
+ height: var(--icon-size-md, 3rem);
13
13
  }
14
14
 
15
15
  &--lg {
16
- width: 4rem;
17
- height: 4rem;
16
+ width: var(--icon-size-lg, 4rem);
17
+ height: var(--icon-size-lg, 4rem);
18
18
  }
19
- }
19
+ }
@@ -1,10 +1,12 @@
1
- import { useThemeAssets } from "../../hooks/useThemeAssets";
2
- import { IconProps } from "./Icon.types";
1
+ import { useThemeAssets } from "../../hooks/useThemeAssets"
2
+ import { IconProps } from "./Icon.types"
3
3
 
4
- export const Icon = ({ name, size }: IconProps) => {
4
+ export const Icon = ({ name, size, extraClassNames }: IconProps) => {
5
5
  const { iconsSprite } = useThemeAssets()
6
- const classeNames = ['ga-ds-icon', ...(size ? [`ga-ds-icon--${size}`] : [])]
7
- return <svg className={classeNames.join(' ')} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
8
- <use xlinkHref={`${iconsSprite}#${name}`} />
9
- </svg>
10
- }
6
+ const classNames = ["ga-ds-icon", ...(size ? [`ga-ds-icon--${size}`] : []), ...(extraClassNames || [])]
7
+ return (
8
+ <svg className={classNames.join(" ")} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
9
+ <use xlinkHref={`${iconsSprite}#${name}`} />
10
+ </svg>
11
+ )
12
+ }
@@ -1,4 +1,6 @@
1
- export interface IconProps {
1
+ import { WordpressDefault } from "../../global.types"
2
+
3
+ export interface IconProps extends WordpressDefault {
2
4
  name: string
3
5
  size?: 'sm' | 'md' | 'lg'
4
6
  spriteFile?: string
@@ -1,4 +1,35 @@
1
- .ga-ds-heading {
1
+ .ga-ds-text {
2
+ font-size: var(--font-size, 1.6rem);
3
+ }
4
+
5
+ .ga-ds-text--heading {
2
6
  font-weight: var(--ga-font-weight-heading);
3
7
  font-family: var(--ga-font-family-heading);
4
- }
8
+ }
9
+
10
+ .ga-ds-text--paragraph {
11
+ font-weight: var(--ga-font-weight-body);
12
+ }
13
+
14
+ .ga-ds-text--center {
15
+ text-align: center;
16
+ }
17
+
18
+ .ga-ds-text--right {
19
+ text-align: right;
20
+ }
21
+
22
+ $sizes: (88, 64, 56, 48, 40, 32, 24, 20, 18, 16);
23
+
24
+ @each $size in $sizes {
25
+ .ga-ds-text--size-#{$size} {
26
+ font-size: calc(#{$size} / 10 * 1rem);
27
+ }
28
+ }
29
+
30
+ $weights: (400, 500, 600, 700);
31
+ @each $weight in $weights {
32
+ .ga-ds-text--weight-#{$weight} {
33
+ font-weight: #{$weight};
34
+ }
35
+ }
@@ -1,12 +1,17 @@
1
- import React from "react";
2
- import { TextProps } from "./Text.types";
1
+ import React from "react"
2
+ import { TextProps } from "./Text.types"
3
3
 
4
4
  export const Text = (props: TextProps) => {
5
- const { as, children, classNames, type = "paragraph" } = props
5
+ const { as, children, classNames, type = "paragraph", size, style } = props
6
6
 
7
- const className = typeof classNames === 'string' ? classNames : classNames?.join(' ') || ''
7
+ const className = typeof classNames === "string" ? classNames : classNames?.join(" ") || ""
8
8
 
9
- return React.createElement(as, {
10
- className: `ga-ds-${type} ${className}`,
11
- }, children)
12
- }
9
+ return React.createElement(
10
+ as,
11
+ {
12
+ className: `ga-ds-${type} ga-ds-text--${size} ${className}`,
13
+ style: style || undefined,
14
+ },
15
+ children
16
+ )
17
+ }
@@ -1,6 +1,10 @@
1
- export interface TextProps {
1
+ export interface Attributes {
2
+ size: '64' | '56' | '48' | '40' | '32' | '24' | '20' | '16' | '14' | '12'
2
3
  as: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span'
4
+ }
5
+ export interface TextProps extends Attributes {
3
6
  classNames?: string[] | string
4
7
  type?: 'heading' | 'paragraph'
8
+ style?: React.CSSProperties
5
9
  children: string
6
10
  }
@@ -1,3 +1,3 @@
1
- @use './Button/Button.scss';
2
- @use './Text/Text.scss';
3
- @use './Icon/Icon.scss';
1
+ @use "./Button/Button.scss";
2
+ @use "./Text/Text.scss";
3
+ @use "./Icon/Icon.scss";
@@ -1 +1,4 @@
1
1
  export * from './Button/Button'
2
+ export * from './Button/Button.types'
3
+ export * from './Icon/Icon'
4
+ export * from './Icon/Icon.types'
@@ -0,0 +1,24 @@
1
+ import { useReactAdapter } from "../hooks/useReactAdaptater"
2
+
3
+ const { createContext, useContext, useState } = useReactAdapter()
4
+
5
+ interface SpoilerContextProps {
6
+ activeIndex: number | null
7
+ setActiveIndex: (index: number | null) => void
8
+ }
9
+
10
+ const SpoilerContext = createContext<SpoilerContextProps | undefined>(undefined)
11
+
12
+ export const SpoilerProvider = ({ children }: { children: React.ReactNode }) => {
13
+ const [activeIndex, setActiveIndex] = useState<number | null>(0)
14
+
15
+ return <SpoilerContext.Provider value={{ activeIndex, setActiveIndex }}>{children}</SpoilerContext.Provider>
16
+ }
17
+
18
+ export const useSpoilerContext = (): SpoilerContextProps => {
19
+ const context = useContext(SpoilerContext)
20
+ if (!context) {
21
+ throw new Error("useSpoilerContext must be used within a SpoilerProvider")
22
+ }
23
+ return context
24
+ }
@@ -1,3 +1,7 @@
1
+ export type Padding = "xsmall" | "small" | "medium" | "large" | "xlarge"
2
+ export type Margin = "small" | "medium" | "large"
1
3
  export interface WordpressDefault {
2
4
  extraClassNames?: string[]
5
+ padding?: Padding
6
+ margin?: Margin
3
7
  }
@@ -1,8 +1,24 @@
1
1
  import React from 'react'
2
2
 
3
- export const useReactAdapter = () => {
4
- if (typeof window === 'undefined' || !(window as typeof window & { wp: { element: typeof React } }).wp || !(window as typeof window & { wp: { element: typeof React } }).wp.element) {
5
- return React
3
+ // @ts-ignore - React types from window.wp.element
4
+ type ReactType = typeof import('react')
5
+
6
+ declare global {
7
+ interface Window {
8
+ wp?: {
9
+ element?: ReactType
10
+ }
6
11
  }
7
- return (window as typeof window & { wp: { element: typeof React } }).wp.element
8
12
  }
13
+
14
+ export const useReactAdapter = (): ReactType => {
15
+ // Check if WordPress element is available (WordPress context)
16
+ if (typeof window !== 'undefined' && window.wp?.element) {
17
+ return window.wp.element
18
+ }
19
+
20
+ // Fallback for non-WordPress environments (Storybook, tests, SSR)
21
+ // This will bundle React only in non-WordPress builds
22
+ return React
23
+ }
24
+
@@ -0,0 +1,17 @@
1
+ import { useReactAdapter } from "./useReactAdaptater";
2
+
3
+ export default function() {
4
+ const { useState} = useReactAdapter();
5
+ const [activeIndex, setActiveIndex] = useState<number | null>(null);
6
+
7
+ const toggleIndex = (index: number) => {
8
+ setActiveIndex((currentIndex) =>
9
+ currentIndex === index ? null : index
10
+ );
11
+ };
12
+
13
+ return {
14
+ activeIndex,
15
+ toggleIndex,
16
+ };
17
+ }
package/src/index.scss CHANGED
@@ -1,3 +1,5 @@
1
1
  @use "./atoms/atoms";
2
+ @use "./molecules/molecules";
2
3
  @use "./organisms/organisms";
3
4
  @use "./layout/layout";
5
+ @use "./utils/utils";
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './atoms/atoms'
2
2
  export * from './organisms/organisms'
3
+ export * from './molecules/molecules'
3
4
  export * from './layout/layout'
4
5
  export { setThemeAssets } from './hooks/useThemeAssets'
@@ -1,13 +1,55 @@
1
- @use 'sass:map';
2
- $sizes: (
3
- "large": "var(--ga-container-large)",
4
- "medium": "var(--ga-container-medium)",
5
- "small": "var(--ga-container-small)",
6
- );
7
-
8
- @each $key, $value in $sizes {
9
- .ga-ds-container--#{$key} {
10
- padding-left: calc((100% - #{$value}) / 2);
11
- padding-right: calc((100% - #{$value}) / 2);
12
- }
13
- }
1
+ @use "@growth-angels/foundation/config" as *;
2
+ @use "sass:map";
3
+
4
+ .ga-ds-container {
5
+ display: flex;
6
+ flex-direction: column;
7
+ align-items: stretch;
8
+ padding-left: var(--ga-container-safe-zone, 2.4rem);
9
+ padding-right: var(--ga-container-safe-zone, 2.4rem);
10
+
11
+ &.ga-ds-container-stretch--right {
12
+ @include bp-up("lg") {
13
+ padding-right: 0;
14
+ }
15
+ }
16
+
17
+ &.ga-ds-container-stretch--left {
18
+ @include bp-up("lg") {
19
+ padding-left: 0;
20
+ }
21
+ }
22
+ }
23
+
24
+ @include bp-up("sm") {
25
+ .ga-ds-container--small {
26
+ &:not(.ga-ds-container-stretch--right) {
27
+ padding-right: calc((100% - #{map.get($ga-containers, "sm")}) / 2);
28
+ }
29
+ &:not(.ga-ds-container-stretch--left) {
30
+ padding-left: calc((100% - #{map.get($ga-containers, "sm")}) / 2);
31
+ }
32
+ }
33
+ }
34
+
35
+ @include bp-up("md") {
36
+ .ga-ds-container--medium {
37
+ &:not(.ga-ds-container-stretch--right) {
38
+ padding-right: calc((100% - #{map.get($ga-containers, "md")}) / 2);
39
+ }
40
+ &:not(.ga-ds-container-stretch--left) {
41
+ padding-left: calc((100% - #{map.get($ga-containers, "md")}) / 2);
42
+ }
43
+ }
44
+ }
45
+
46
+ @include bp-up("lg") {
47
+ .ga-ds-container--large {
48
+ &:not(.ga-ds-container-stretch--right) {
49
+ padding-right: calc((100% - #{map.get($ga-containers, "lg")}) / 2);
50
+ }
51
+ &:not(.ga-ds-container-stretch--left) {
52
+ padding-left: calc((100% - #{map.get($ga-containers, "lg")}) / 2);
53
+ }
54
+ }
55
+ }
@@ -1,10 +1,18 @@
1
- import type { JSX } from 'react/jsx-runtime'
2
- import type { ContainerProps } from './Container.types'
1
+ import type { ContainerProps } from "./Container.types"
3
2
 
4
- export const Container = (props: ContainerProps): JSX.Element => {
5
- const { size, children } = props
6
- const classes = ['ga-ds-container', `ga-ds-container--${size}`, ...(props.extraClassNames || [])]
7
- return <div className={classes.join(' ')}>
8
- {children}
9
- </div>
10
- }
3
+ export const Container = (props: ContainerProps) => {
4
+ const { size, children, style, padding, margin, stretch } = props
5
+ const classes = [
6
+ "ga-ds-container",
7
+ `ga-ds-container--${size}`,
8
+ ...(padding ? [`ga-ds-util-padding--${padding}`] : []),
9
+ ...(margin ? [`ga-ds-util-margin--${margin}`] : []),
10
+ ...(stretch ? [`ga-ds-container-stretch--${stretch}`] : []),
11
+ ...(props.extraClassNames || []),
12
+ ]
13
+ return (
14
+ <div className={classes.join(" ")} style={style}>
15
+ {children}
16
+ </div>
17
+ )
18
+ }