@growth-angels/ds-core 1.17.1 → 1.19.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.
- package/dist/atoms/Button/Button.d.ts +1 -2
- package/dist/atoms/Button/Button.js +2 -1
- package/dist/atoms/Button/Button.types.d.ts +3 -3
- package/dist/atoms/Text/Text.d.ts +2 -3
- package/dist/atoms/Text/Text.js +2 -1
- package/dist/hooks/useReactAdaptater.d.ts +0 -1
- package/dist/hooks/useReactAdaptater.js +6 -7
- package/dist/layout/Container/Container.js +4 -3
- package/dist/layout/Container/Container.types.d.ts +2 -0
- package/dist/layout/Grid/Grid.js +3 -3
- package/dist/layout/Grid/Grid.types.d.ts +2 -0
- package/dist/organisms/Card/Card.d.ts +1 -1
- package/package.json +1 -1
- package/src/atoms/Button/Button.tsx +3 -2
- package/src/atoms/Button/Button.types.ts +3 -3
- package/src/atoms/Text/Text.tsx +2 -1
- package/src/hooks/useReactAdaptater.ts +7 -7
- package/src/layout/Container/Container.tsx +4 -3
- package/src/layout/Container/Container.types.ts +2 -0
- package/src/layout/Grid/Grid.tsx +3 -3
- package/src/layout/Grid/Grid.types.ts +2 -0
- package/src/organisms/Card/Card.tsx +1 -1
- package/src/organisms/Carousel/Carousel.scss +4 -3
- package/src/utils/_spacings.scss +14 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { JSX } from "react/jsx-runtime";
|
|
1
|
+
import type { JSX } from "react/jsx-runtime";
|
|
2
2
|
import type { ButtonProps } from "./Button.types";
|
|
3
|
-
import React from "react";
|
|
4
3
|
export declare const Button: <T extends React.ElementType = "button">(props: ButtonProps<T>) => JSX.Element;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import { useReactAdapter } from "../../hooks/useReactAdaptater";
|
|
3
3
|
import { Icon } from "../Icon/Icon";
|
|
4
4
|
export const Button = (props) => {
|
|
5
|
+
const React = useReactAdapter();
|
|
5
6
|
const { as, children, variant, preventDefault, icon, extraClassNames, ...restProps } = props;
|
|
6
7
|
let customVariant = variant;
|
|
7
8
|
if (icon) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WordpressDefault } from "../../global.types.js";
|
|
2
|
-
import
|
|
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"> = {
|
|
5
5
|
as?: T;
|
|
@@ -7,7 +7,7 @@ export type ButtonProps<T extends ElementType = "button"> = {
|
|
|
7
7
|
hasIcon?: "left" | "right";
|
|
8
8
|
icon?: string;
|
|
9
9
|
preventDefault?: boolean;
|
|
10
|
-
children?:
|
|
10
|
+
children?: ReactNode;
|
|
11
11
|
} & WordpressDefault & Omit<ComponentPropsWithoutRef<T>, "as" | "className" | "onClick"> & {
|
|
12
|
-
onClick?:
|
|
12
|
+
onClick?: MouseEventHandler<ElementRef<T>>;
|
|
13
13
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { TextProps } from "./Text.types";
|
|
3
|
-
export declare const Text: (props: TextProps) =>
|
|
2
|
+
export declare const Text: (props: TextProps) => import("react").DetailedReactHTMLElement<{
|
|
4
3
|
className: string;
|
|
5
|
-
style:
|
|
4
|
+
style: import("react").CSSProperties | undefined;
|
|
6
5
|
}, HTMLElement>;
|
package/dist/atoms/Text/Text.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useReactAdapter } from "../../hooks/useReactAdaptater";
|
|
2
2
|
export const Text = (props) => {
|
|
3
|
+
const React = useReactAdapter();
|
|
3
4
|
const { as, children, classNames, type = "paragraph", size, style } = props;
|
|
4
5
|
const className = typeof classNames === "string" ? classNames : classNames?.join(" ") || "";
|
|
5
6
|
return React.createElement(as, {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
export const useReactAdapter = () => {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return window.wp.element;
|
|
2
|
+
if (typeof window === 'undefined') {
|
|
3
|
+
throw new Error('useReactAdapter requires a browser environment with window.wp.element');
|
|
6
4
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
if (!window.wp?.element) {
|
|
6
|
+
throw new Error('window.wp.element is not available. Make sure wp-element is loaded.');
|
|
7
|
+
}
|
|
8
|
+
return window.wp.element;
|
|
10
9
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
export const Container = (props) => {
|
|
3
|
-
const { size, children, style, padding, margin, stretch, id } = props;
|
|
3
|
+
const { size, children, style, padding, margin, stretch, id, paddingPosition, marginPosition } = props;
|
|
4
|
+
console.log("Container props", props);
|
|
4
5
|
const classes = [
|
|
5
6
|
"ga-ds-container",
|
|
6
7
|
`ga-ds-container--${size}`,
|
|
7
|
-
...(padding ? [`ga-ds-util-padding--${padding}`] : []),
|
|
8
|
-
...(margin ? [`ga-ds-util-margin--${margin}`] : []),
|
|
8
|
+
...(padding ? [`ga-ds-util-padding${paddingPosition ? `-${paddingPosition}` : ""}--${padding}`] : []),
|
|
9
|
+
...(margin ? [`ga-ds-util-margin${marginPosition ? `-${marginPosition}` : ""}--${margin}`] : []),
|
|
9
10
|
...(stretch ? [`ga-ds-container-stretch--${stretch}`] : []),
|
|
10
11
|
...(props.extraClassNames || []),
|
|
11
12
|
];
|
package/dist/layout/Grid/Grid.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
export const Grid = (props) => {
|
|
3
|
-
const { children, alignItems, justifyContent, extraClassNames, padding, margin } = props;
|
|
3
|
+
const { children, alignItems, justifyContent, extraClassNames, padding, margin, paddingPosition, marginPosition } = props;
|
|
4
4
|
const classNames = [
|
|
5
5
|
"ga-ds-grid",
|
|
6
|
-
...(padding ? [`ga-ds-util-padding--${padding}`] : []),
|
|
7
|
-
...(margin ? [`ga-ds-util-margin--${margin}`] : []),
|
|
6
|
+
...(padding ? [`ga-ds-util-padding${paddingPosition ? `-${paddingPosition}` : ""}--${padding}`] : []),
|
|
7
|
+
...(margin ? [`ga-ds-util-margin${marginPosition ? `-${marginPosition}` : ""}--${margin}`] : []),
|
|
8
8
|
...(extraClassNames || []),
|
|
9
9
|
];
|
|
10
10
|
return (_jsx("div", { className: classNames.join(" "), style: { ...(alignItems !== "none" && { alignItems }), ...(justifyContent !== "none" && { justifyContent }) }, children: children }));
|
|
@@ -2,6 +2,8 @@ import { 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';
|
|
5
|
+
paddingPosition?: 'top' | 'bottom';
|
|
6
|
+
marginPosition?: 'top' | 'bottom';
|
|
5
7
|
}
|
|
6
8
|
export interface GridProps extends WordpressDefault, GridAttributes {
|
|
7
9
|
children: React.ReactNode | React.ReactNode[];
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { JSX } from "react/jsx-runtime"
|
|
1
|
+
import type { JSX } from "react/jsx-runtime"
|
|
2
2
|
import type { ButtonProps } from "./Button.types"
|
|
3
|
-
import
|
|
3
|
+
import { useReactAdapter } from "../../hooks/useReactAdaptater"
|
|
4
4
|
import { Icon } from "../Icon/Icon"
|
|
5
5
|
|
|
6
6
|
export const Button = <T extends React.ElementType = "button">(props: ButtonProps<T>): JSX.Element => {
|
|
7
|
+
const React = useReactAdapter()
|
|
7
8
|
const { as, children, variant, preventDefault, icon, extraClassNames, ...restProps } = props
|
|
8
9
|
let customVariant = variant
|
|
9
10
|
if (icon) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WordpressDefault } from "../../global.types.js"
|
|
2
|
-
import
|
|
2
|
+
import type { ElementType, ComponentPropsWithoutRef, ReactNode, MouseEventHandler, ElementRef } from "react"
|
|
3
3
|
|
|
4
4
|
export type ButtonVariant = "primary" | "secondary" | "tertiary" | "link" | "icon"
|
|
5
5
|
|
|
@@ -9,8 +9,8 @@ export type ButtonProps<T extends ElementType = "button"> = {
|
|
|
9
9
|
hasIcon?: "left" | "right"
|
|
10
10
|
icon?: string
|
|
11
11
|
preventDefault?: boolean
|
|
12
|
-
children?:
|
|
12
|
+
children?: ReactNode
|
|
13
13
|
} & WordpressDefault &
|
|
14
14
|
Omit<ComponentPropsWithoutRef<T>, "as" | "className" | "onClick"> & {
|
|
15
|
-
onClick?:
|
|
15
|
+
onClick?: MouseEventHandler<ElementRef<T>>
|
|
16
16
|
}
|
package/src/atoms/Text/Text.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useReactAdapter } from "../../hooks/useReactAdaptater"
|
|
2
2
|
import { TextProps } from "./Text.types"
|
|
3
3
|
|
|
4
4
|
export const Text = (props: TextProps) => {
|
|
5
|
+
const React = useReactAdapter()
|
|
5
6
|
const { as, children, classNames, type = "paragraph", size, style } = props
|
|
6
7
|
|
|
7
8
|
const className = typeof classNames === "string" ? classNames : classNames?.join(" ") || ""
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
1
|
// @ts-ignore - React types from window.wp.element
|
|
3
2
|
type ReactType = typeof import('react')
|
|
4
3
|
|
|
@@ -21,13 +20,14 @@ declare global {
|
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
export const useReactAdapter = (): ExtendedReactType => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return window.wp.element
|
|
23
|
+
if (typeof window === 'undefined') {
|
|
24
|
+
throw new Error('useReactAdapter requires a browser environment with window.wp.element')
|
|
27
25
|
}
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
if (!window.wp?.element) {
|
|
28
|
+
throw new Error('window.wp.element is not available. Make sure wp-element is loaded.')
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return window.wp.element
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { ContainerProps } from "./Container.types"
|
|
2
2
|
|
|
3
3
|
export const Container = (props: ContainerProps) => {
|
|
4
|
-
const { size, children, style, padding, margin, stretch, id } = props
|
|
4
|
+
const { size, children, style, padding, margin, stretch, id, paddingPosition, marginPosition } = props
|
|
5
|
+
console.log("Container props", props)
|
|
5
6
|
const classes = [
|
|
6
7
|
"ga-ds-container",
|
|
7
8
|
`ga-ds-container--${size}`,
|
|
8
|
-
...(padding ? [`ga-ds-util-padding--${padding}`] : []),
|
|
9
|
-
...(margin ? [`ga-ds-util-margin--${margin}`] : []),
|
|
9
|
+
...(padding ? [`ga-ds-util-padding${paddingPosition ? `-${paddingPosition}` : ""}--${padding}`] : []),
|
|
10
|
+
...(margin ? [`ga-ds-util-margin${marginPosition ? `-${marginPosition}` : ""}--${margin}`] : []),
|
|
10
11
|
...(stretch ? [`ga-ds-container-stretch--${stretch}`] : []),
|
|
11
12
|
...(props.extraClassNames || []),
|
|
12
13
|
]
|
|
@@ -8,4 +8,6 @@ export interface ContainerProps extends WordpressDefault, React.HTMLAttributes<H
|
|
|
8
8
|
stretch?:ContainerStretch
|
|
9
9
|
children: React.ReactNode | React.ReactNode[];
|
|
10
10
|
style?: React.CSSProperties;
|
|
11
|
+
paddingPosition?: "top" | "bottom";
|
|
12
|
+
marginPosition?: "top" | "bottom";
|
|
11
13
|
}
|
package/src/layout/Grid/Grid.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { GridProps } from "./Grid.types"
|
|
2
2
|
export const Grid = (props: GridProps): JSX.Element => {
|
|
3
|
-
const { children, alignItems, justifyContent, extraClassNames, padding, margin } = props
|
|
3
|
+
const { children, alignItems, justifyContent, extraClassNames, padding, margin, paddingPosition, marginPosition } = props
|
|
4
4
|
const classNames = [
|
|
5
5
|
"ga-ds-grid",
|
|
6
|
-
...(padding ? [`ga-ds-util-padding--${padding}`] : []),
|
|
7
|
-
...(margin ? [`ga-ds-util-margin--${margin}`] : []),
|
|
6
|
+
...(padding ? [`ga-ds-util-padding${paddingPosition ? `-${paddingPosition}` : ""}--${padding}`] : []),
|
|
7
|
+
...(margin ? [`ga-ds-util-margin${marginPosition ? `-${marginPosition}` : ""}--${margin}`] : []),
|
|
8
8
|
...(extraClassNames || []),
|
|
9
9
|
]
|
|
10
10
|
|
|
@@ -3,6 +3,8 @@ import { WordpressDefault } from "../../global.types";
|
|
|
3
3
|
export interface GridAttributes {
|
|
4
4
|
alignItems: 'flex-start' | 'center' | 'flex-end' | 'none'
|
|
5
5
|
justifyContent: 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'none'
|
|
6
|
+
paddingPosition?: 'top' | 'bottom'
|
|
7
|
+
marginPosition?: 'top' | 'bottom'
|
|
6
8
|
}
|
|
7
9
|
|
|
8
10
|
export interface GridProps extends WordpressDefault, GridAttributes {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
&__track {
|
|
12
12
|
--ga-ds-slides-per-view: 1;
|
|
13
13
|
display: grid;
|
|
14
|
-
grid-auto-flow: column;
|
|
14
|
+
grid-auto-flow: column;
|
|
15
15
|
grid-auto-columns: calc(
|
|
16
16
|
(100% - (var(--ga-ds-space-between, 1rem) * (var(--ga-ds-slides-per-view, 3) - 1))) / var(--ga-ds-slides-per-view, 3)
|
|
17
17
|
);
|
|
@@ -72,13 +72,14 @@
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
&__dots {
|
|
75
|
+
--dot-size: 1rem;
|
|
75
76
|
display: flex;
|
|
76
77
|
gap: var(--ga-ds-gap, 1rem);
|
|
77
78
|
|
|
78
79
|
.ga-ds-carousel__dot {
|
|
79
80
|
display: block;
|
|
80
|
-
width:
|
|
81
|
-
height:
|
|
81
|
+
width: var(--dot-size);
|
|
82
|
+
height: var(--dot-size);
|
|
82
83
|
border-radius: 50%;
|
|
83
84
|
background-color: #e2e2e2;
|
|
84
85
|
|
package/src/utils/_spacings.scss
CHANGED
|
@@ -5,6 +5,14 @@ $spacingsMap: ("xsmall", "small", "medium", "large", "xlarge");
|
|
|
5
5
|
padding-top: var(--ga-spacings-padding-#{$value});
|
|
6
6
|
padding-bottom: var(--ga-spacings-padding-#{$value});
|
|
7
7
|
}
|
|
8
|
+
|
|
9
|
+
.ga-ds-util-padding-top--#{$value} {
|
|
10
|
+
padding-top: var(--ga-spacings-padding-#{$value});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.ga-ds-util-padding-bottom--#{$value} {
|
|
14
|
+
padding-bottom: var(--ga-spacings-padding-#{$value});
|
|
15
|
+
}
|
|
8
16
|
}
|
|
9
17
|
|
|
10
18
|
$marginsMap: ("small", "medium", "large");
|
|
@@ -14,4 +22,10 @@ $marginsMap: ("small", "medium", "large");
|
|
|
14
22
|
margin-top: var(--ga-spacings-margin-#{$value});
|
|
15
23
|
margin-bottom: var(--ga-spacings-margin-#{$value});
|
|
16
24
|
}
|
|
25
|
+
.ga-ds-util-margin-top--#{$value} {
|
|
26
|
+
margin-top: var(--ga-spacings-margin-#{$value});
|
|
27
|
+
}
|
|
28
|
+
.ga-ds-util-margin-bottom--#{$value} {
|
|
29
|
+
margin-bottom: var(--ga-spacings-margin-#{$value});
|
|
30
|
+
}
|
|
17
31
|
}
|