@growth-angels/ds-core 1.24.0 → 1.25.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.
|
@@ -37,7 +37,7 @@ export const Carousel = (props) => {
|
|
|
37
37
|
const breakpoint = useBreakpointObserver({ xs: 375, sm: 576, md: 768, lg: 992, xl: 1200, xxl: 1440 });
|
|
38
38
|
useEffect(() => {
|
|
39
39
|
const currentSlidesPerView = slidesPerView[breakpoint] ??
|
|
40
|
-
(typeof slidesPerView === "number" ? slidesPerView : slidesPerView.xl ?? 1);
|
|
40
|
+
(typeof slidesPerView === "number" ? slidesPerView : (slidesPerView.xl ?? 1));
|
|
41
41
|
setTotalPages(calculatePages(currentSlidesPerView));
|
|
42
42
|
}, [breakpoint, slidesPerView, slides.length]);
|
|
43
43
|
useEffect(() => {
|
|
@@ -167,7 +167,7 @@ export const Carousel = (props) => {
|
|
|
167
167
|
}) }), _jsxs("div", { className: "ga-ds-carousel__navigation", children: [pagination && displayPagination && (_jsx(CarouselPagination, { totalPages: totalPages, activeSlideIndex: activeSlideIndex, goTo: goTo, clickable: pagination.clickable })), displayNavigation && navigation?.positionY === "bottom" && (_jsx(CarouselNavigation, { goPrev: goPrev, goNext: goNext, isAtStart: isAtStart, isAtEnd: isAtEnd }))] })] }));
|
|
168
168
|
};
|
|
169
169
|
const CarouselNavigation = ({ goPrev, goNext, isAtStart, isAtEnd, }) => {
|
|
170
|
-
return (_jsxs("div", { className: `ga-ds-carousel__arrows`, children: [_jsx(Button, { extraClassNames: ["ga-ds-carousel__button", "ga-ds-carousel__button--prev"], icon: "chevron-left", onClick: goPrev, disabled: isAtStart }), _jsx(Button, { extraClassNames: ["ga-ds-carousel__button", "ga-ds-carousel__button--next"], icon: "chevron-right", onClick: goNext, disabled: isAtEnd })] }));
|
|
170
|
+
return (_jsxs("div", { className: `ga-ds-carousel__arrows`, children: [_jsx(Button, { extraClassNames: ["ga-ds-carousel__button", "ga-ds-carousel__button--prev"], icon: "chevron-left", onClick: goPrev, disabled: isAtStart, "aria-label": "Slide pr\u00E9c\u00E9dente" }), _jsx(Button, { extraClassNames: ["ga-ds-carousel__button", "ga-ds-carousel__button--next"], icon: "chevron-right", onClick: goNext, disabled: isAtEnd, "aria-label": "Slide suivante" })] }));
|
|
171
171
|
};
|
|
172
172
|
const CarouselPagination = ({ totalPages, activeSlideIndex, goTo, clickable, }) => {
|
|
173
173
|
return (_jsx("div", { className: "ga-ds-carousel__dots", children: Array.from({ length: totalPages }, (_, index) => index).map((_, index) => (_jsx("span", { className: `ga-ds-carousel__dot ${index === activeSlideIndex ? "ga-ds-carousel__dot--active" : ""}`, onClick: () => clickable && goTo(index), style: {
|
|
@@ -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" }), _jsx(Button, { extraClassNames: ["ga-ds-carousel__button", "ga-ds-carousel__button--next"], icon: "chevron-right" })] }));
|
|
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", "aria-label": "Slide pr\u00E9c\u00E9dente" }), _jsx(Button, { extraClassNames: ["ga-ds-carousel__button", "ga-ds-carousel__button--next"], icon: "chevron-right", "aria-label": "Slide suivante" })] }));
|
|
78
78
|
};
|
package/package.json
CHANGED
|
@@ -53,7 +53,7 @@ export const Carousel = (props: CarouselProps) => {
|
|
|
53
53
|
useEffect(() => {
|
|
54
54
|
const currentSlidesPerView =
|
|
55
55
|
(slidesPerView as Record<string, number>)[breakpoint] ??
|
|
56
|
-
(typeof slidesPerView === "number" ? slidesPerView : (slidesPerView as any).xl ?? 1)
|
|
56
|
+
(typeof slidesPerView === "number" ? slidesPerView : ((slidesPerView as any).xl ?? 1))
|
|
57
57
|
|
|
58
58
|
setTotalPages(calculatePages(currentSlidesPerView))
|
|
59
59
|
}, [breakpoint, slidesPerView, slides.length])
|
|
@@ -104,7 +104,7 @@ export const Carousel = (props: CarouselProps) => {
|
|
|
104
104
|
}, [slides.length, loop])
|
|
105
105
|
|
|
106
106
|
const style = Object.fromEntries(
|
|
107
|
-
Object.entries(slidesPerView).map(([key, value]) => [`--ga-ds-slides-per-view-${key}`, `${value}`])
|
|
107
|
+
Object.entries(slidesPerView).map(([key, value]) => [`--ga-ds-slides-per-view-${key}`, `${value}`]),
|
|
108
108
|
)
|
|
109
109
|
|
|
110
110
|
const goPrev = () => {
|
|
@@ -249,12 +249,14 @@ const CarouselNavigation = ({
|
|
|
249
249
|
icon="chevron-left"
|
|
250
250
|
onClick={goPrev}
|
|
251
251
|
disabled={isAtStart}
|
|
252
|
+
aria-label="Slide précédente"
|
|
252
253
|
/>
|
|
253
254
|
<Button
|
|
254
255
|
extraClassNames={["ga-ds-carousel__button", "ga-ds-carousel__button--next"]}
|
|
255
256
|
icon="chevron-right"
|
|
256
257
|
onClick={goNext}
|
|
257
258
|
disabled={isAtEnd}
|
|
259
|
+
aria-label="Slide suivante"
|
|
258
260
|
/>
|
|
259
261
|
</div>
|
|
260
262
|
)
|
|
@@ -112,8 +112,16 @@ export const CarouselSwiper = (props: CarouselProps) => {
|
|
|
112
112
|
const CarouselNavigation = () => {
|
|
113
113
|
return (
|
|
114
114
|
<div className={`ga-ds-carousel__arrows`}>
|
|
115
|
-
<Button
|
|
116
|
-
|
|
115
|
+
<Button
|
|
116
|
+
extraClassNames={["ga-ds-carousel__button", "ga-ds-carousel__button--prev"]}
|
|
117
|
+
icon="chevron-left"
|
|
118
|
+
aria-label="Slide précédente"
|
|
119
|
+
/>
|
|
120
|
+
<Button
|
|
121
|
+
extraClassNames={["ga-ds-carousel__button", "ga-ds-carousel__button--next"]}
|
|
122
|
+
icon="chevron-right"
|
|
123
|
+
aria-label="Slide suivante"
|
|
124
|
+
/>
|
|
117
125
|
</div>
|
|
118
126
|
)
|
|
119
127
|
}
|