@growth-angels/ds-core 1.25.1 → 1.25.3
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.js +2 -1
- package/dist/atoms/Button/Button.types.d.ts +1 -0
- package/dist/organisms/Carousel/CarouselSwiper.js +1 -1
- package/package.json +1 -1
- package/src/atoms/Button/Button.tsx +3 -2
- package/src/atoms/Button/Button.types.ts +1 -0
- package/src/organisms/Carousel/CarouselSwiper.tsx +2 -2
|
@@ -3,7 +3,7 @@ import { useReactAdapter } from "../../hooks/useReactAdaptater";
|
|
|
3
3
|
import { Icon } from "../Icon/Icon";
|
|
4
4
|
export const Button = (props) => {
|
|
5
5
|
const React = useReactAdapter();
|
|
6
|
-
const { as, children, variant, preventDefault, icon, extraClassNames, ...restProps } = props;
|
|
6
|
+
const { as, children, variant, preventDefault, icon, extraClassNames, ariaLabel, ...restProps } = props;
|
|
7
7
|
let customVariant = variant;
|
|
8
8
|
if (icon) {
|
|
9
9
|
customVariant = "icon";
|
|
@@ -16,6 +16,7 @@ export const Button = (props) => {
|
|
|
16
16
|
};
|
|
17
17
|
return React.createElement(as || "button", {
|
|
18
18
|
...restProps,
|
|
19
|
+
"aria-label": ariaLabel,
|
|
19
20
|
className: classNames.join(" "),
|
|
20
21
|
onClick: handleClick,
|
|
21
22
|
}, _jsxs(_Fragment, { children: [icon && _jsx(Icon, { name: icon, size: "sm" }), children && children] }));
|
|
@@ -8,6 +8,7 @@ export type ButtonProps<T extends ElementType = "button"> = {
|
|
|
8
8
|
icon?: string;
|
|
9
9
|
preventDefault?: boolean;
|
|
10
10
|
children?: ReactNode;
|
|
11
|
+
ariaLabel?: string;
|
|
11
12
|
} & WordpressDefault & Omit<ComponentPropsWithoutRef<T>, "as" | "className" | "onClick"> & {
|
|
12
13
|
onClick?: MouseEventHandler<ElementRef<T>>;
|
|
13
14
|
};
|
|
@@ -74,5 +74,5 @@ export const CarouselSwiper = (props) => {
|
|
|
74
74
|
return _jsx("div", { children: "Swiper library is not loaded." });
|
|
75
75
|
};
|
|
76
76
|
const CarouselNavigation = () => {
|
|
77
|
-
return (_jsxs("div", { className: `ga-ds-carousel__arrows`, children: [_jsx(Button, { extraClassNames: ["ga-ds-carousel__button", "ga-ds-carousel__button--prev"], icon: "chevron-left",
|
|
77
|
+
return (_jsxs("div", { className: `ga-ds-carousel__arrows`, children: [_jsx(Button, { extraClassNames: ["ga-ds-carousel__button", "ga-ds-carousel__button--prev"], icon: "chevron-left", ariaLabel: "Slide pr\u00E9c\u00E9dente" }), _jsx(Button, { extraClassNames: ["ga-ds-carousel__button", "ga-ds-carousel__button--next"], icon: "chevron-right", ariaLabel: "Slide suivante" })] }));
|
|
78
78
|
};
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import { Icon } from "../Icon/Icon"
|
|
|
4
4
|
|
|
5
5
|
export const Button = <T extends React.ElementType = "button">(props: ButtonProps<T>) => {
|
|
6
6
|
const React = useReactAdapter()
|
|
7
|
-
const { as, children, variant, preventDefault, icon, extraClassNames, ...restProps } = props
|
|
7
|
+
const { as, children, variant, preventDefault, icon, extraClassNames, ariaLabel, ...restProps } = props
|
|
8
8
|
let customVariant = variant
|
|
9
9
|
if (icon) {
|
|
10
10
|
customVariant = "icon"
|
|
@@ -18,12 +18,13 @@ export const Button = <T extends React.ElementType = "button">(props: ButtonProp
|
|
|
18
18
|
as || "button",
|
|
19
19
|
{
|
|
20
20
|
...restProps,
|
|
21
|
+
"aria-label": ariaLabel,
|
|
21
22
|
className: classNames.join(" "),
|
|
22
23
|
onClick: handleClick,
|
|
23
24
|
},
|
|
24
25
|
<>
|
|
25
26
|
{icon && <Icon name={icon} size="sm" />}
|
|
26
27
|
{children && children}
|
|
27
|
-
|
|
28
|
+
</>,
|
|
28
29
|
)
|
|
29
30
|
}
|
|
@@ -10,6 +10,7 @@ export type ButtonProps<T extends ElementType = "button"> = {
|
|
|
10
10
|
icon?: string
|
|
11
11
|
preventDefault?: boolean
|
|
12
12
|
children?: ReactNode
|
|
13
|
+
ariaLabel?: string
|
|
13
14
|
} & WordpressDefault &
|
|
14
15
|
Omit<ComponentPropsWithoutRef<T>, "as" | "className" | "onClick"> & {
|
|
15
16
|
onClick?: MouseEventHandler<ElementRef<T>>
|
|
@@ -115,12 +115,12 @@ const CarouselNavigation = () => {
|
|
|
115
115
|
<Button
|
|
116
116
|
extraClassNames={["ga-ds-carousel__button", "ga-ds-carousel__button--prev"]}
|
|
117
117
|
icon="chevron-left"
|
|
118
|
-
|
|
118
|
+
ariaLabel="Slide précédente"
|
|
119
119
|
/>
|
|
120
120
|
<Button
|
|
121
121
|
extraClassNames={["ga-ds-carousel__button", "ga-ds-carousel__button--next"]}
|
|
122
122
|
icon="chevron-right"
|
|
123
|
-
|
|
123
|
+
ariaLabel="Slide suivante"
|
|
124
124
|
/>
|
|
125
125
|
</div>
|
|
126
126
|
)
|