@growth-angels/ds-core 1.12.8 → 1.12.10

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.
@@ -16,9 +16,8 @@ export const Carousel = (props) => {
16
16
  const [isAtEnd, setIsAtEnd] = useState(false);
17
17
  const [isAtStart, setIsAtStart] = useState(true);
18
18
  const [totalPages, setTotalPages] = useState(0);
19
- const [isOverflowing, setIsOverflowing] = useState(false);
20
- const displayNavigation = hasNavigation && (loop || isOverflowing);
21
- const displayPagination = hasPagination && (loop || isOverflowing);
19
+ const displayNavigation = hasNavigation;
20
+ const displayPagination = hasPagination;
22
21
  useEffect(() => {
23
22
  if (loop) {
24
23
  setIsAtStart(false);
@@ -74,18 +73,6 @@ export const Carousel = (props) => {
74
73
  }
75
74
  return () => track.removeEventListener("scroll", handleScroll);
76
75
  }, [slides.length, loop]);
77
- // Check if the slides overflow the container
78
- useEffect(() => {
79
- const track = trackRef.current;
80
- if (!track)
81
- return;
82
- const handleResize = () => {
83
- setIsOverflowing(track.scrollWidth > track.clientWidth);
84
- };
85
- handleResize(); // Initial check
86
- window.addEventListener("resize", handleResize);
87
- return () => window.removeEventListener("resize", handleResize);
88
- }, [loop]);
89
76
  const style = Object.fromEntries(Object.entries(slidesPerView).map(([key, value]) => [`--ga-ds-slides-per-view-${key}`, `${value}`]));
90
77
  const goPrev = () => {
91
78
  if (!trackRef.current)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@growth-angels/ds-core",
3
- "version": "1.12.8",
3
+ "version": "1.12.10",
4
4
  "description": "Design system by Growth Angels",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -46,6 +46,9 @@
46
46
  flex: 0 0 auto;
47
47
  width: 100%;
48
48
  scroll-snap-align: start;
49
+ width: 100%;
50
+ max-width: 100%;
51
+ min-width: 0;
49
52
  }
50
53
 
51
54
  &__arrows {
@@ -29,10 +29,9 @@ export const Carousel = (props: CarouselProps) => {
29
29
  const [isAtEnd, setIsAtEnd] = useState(false)
30
30
  const [isAtStart, setIsAtStart] = useState(true)
31
31
  const [totalPages, setTotalPages] = useState(0)
32
- const [isOverflowing, setIsOverflowing] = useState(false)
33
32
 
34
- const displayNavigation = hasNavigation && (loop || isOverflowing)
35
- const displayPagination = hasPagination && (loop || isOverflowing)
33
+ const displayNavigation = hasNavigation
34
+ const displayPagination = hasPagination
36
35
 
37
36
  useEffect(() => {
38
37
  if (loop) {
@@ -95,21 +94,6 @@ export const Carousel = (props: CarouselProps) => {
95
94
  return () => track.removeEventListener("scroll", handleScroll)
96
95
  }, [slides.length, loop])
97
96
 
98
- // Check if the slides overflow the container
99
- useEffect(() => {
100
- const track = trackRef.current
101
- if (!track) return
102
-
103
- const handleResize = () => {
104
- setIsOverflowing(track.scrollWidth > track.clientWidth)
105
- }
106
-
107
- handleResize() // Initial check
108
-
109
- window.addEventListener("resize", handleResize)
110
- return () => window.removeEventListener("resize", handleResize)
111
- }, [loop])
112
-
113
97
  const style = Object.fromEntries(
114
98
  Object.entries(slidesPerView).map(([key, value]) => [`--ga-ds-slides-per-view-${key}`, `${value}`])
115
99
  )