@growth-angels/ds-core 1.15.0 → 1.15.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.
@@ -8,8 +8,10 @@ export const Carousel = (props) => {
8
8
  const trackRef = useRef(null);
9
9
  const isNavigatingRef = useRef(false);
10
10
  const slides = Children.toArray(children);
11
- const calculatePages = (totalSlides = 0, slidesPerView = 0, step = 1) => {
12
- return Math.max(1, Math.ceil((totalSlides - slidesPerView) / step) + 1);
11
+ const calculatePages = (totalSlides = 0, slidesPerView = 0) => {
12
+ if (slidesPerView <= 0)
13
+ return 1;
14
+ return Math.ceil(totalSlides / slidesPerView);
13
15
  };
14
16
  const [activeSlideIndex, setActiveSlideIndex] = useState(0);
15
17
  const [activeDOMIndex, setActiveDOMIndex] = useState(0);
@@ -33,8 +35,8 @@ export const Carousel = (props) => {
33
35
  useEffect(() => {
34
36
  const currentSlidesPerView = slidesPerView[breakpoint] ??
35
37
  (typeof slidesPerView === "number" ? slidesPerView : slidesPerView.xl ?? 1);
36
- setTotalPages(calculatePages(slides.length, currentSlidesPerView, 1));
37
- }, [breakpoint, slidesPerView]);
38
+ setTotalPages(calculatePages(slides.length, currentSlidesPerView));
39
+ }, [breakpoint, slidesPerView, slides.length]);
38
40
  useEffect(() => {
39
41
  const track = trackRef.current;
40
42
  if (!track)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@growth-angels/ds-core",
3
- "version": "1.15.0",
3
+ "version": "1.15.1",
4
4
  "description": "Design system by Growth Angels",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -20,8 +20,9 @@ export const Carousel = (props: CarouselProps) => {
20
20
  const isNavigatingRef = useRef(false)
21
21
  const slides = Children.toArray(children)
22
22
 
23
- const calculatePages = (totalSlides = 0, slidesPerView = 0, step = 1) => {
24
- return Math.max(1, Math.ceil((totalSlides - slidesPerView) / step) + 1)
23
+ const calculatePages = (totalSlides = 0, slidesPerView = 0) => {
24
+ if (slidesPerView <= 0) return 1
25
+ return Math.ceil(totalSlides / slidesPerView)
25
26
  }
26
27
 
27
28
  const [activeSlideIndex, setActiveSlideIndex] = useState(0)
@@ -51,8 +52,8 @@ export const Carousel = (props: CarouselProps) => {
51
52
  (slidesPerView as Record<string, number>)[breakpoint] ??
52
53
  (typeof slidesPerView === "number" ? slidesPerView : (slidesPerView as any).xl ?? 1)
53
54
 
54
- setTotalPages(calculatePages(slides.length, currentSlidesPerView, 1))
55
- }, [breakpoint, slidesPerView])
55
+ setTotalPages(calculatePages(slides.length, currentSlidesPerView))
56
+ }, [breakpoint, slidesPerView, slides.length])
56
57
 
57
58
  useEffect(() => {
58
59
  const track = trackRef.current
@@ -1,10 +1,15 @@
1
1
  .ga-ds-tabs {
2
2
  $this: &;
3
-
3
+ &__list-wrapper {
4
+ max-width: 100%;
5
+ overflow: hidden;
6
+ }
4
7
  &__list {
5
8
  overflow-x: auto;
9
+ overflow-y: hidden;
10
+ white-space: nowrap;
6
11
  -webkit-overflow-scrolling: touch;
7
- scrollbar-width: none; // Firefox
12
+ max-width: 100%;
8
13
  &::-webkit-scrollbar {
9
14
  display: none; // Safari and Chrome
10
15
  }
@@ -12,6 +17,7 @@
12
17
  &__list-container {
13
18
  display: flex;
14
19
  flex-wrap: nowrap;
20
+ width: fit-content;
15
21
 
16
22
  #{$this}__tab {
17
23
  background: none;
@@ -19,7 +25,7 @@
19
25
  font-size: inherit;
20
26
  padding: inherit;
21
27
  cursor: pointer;
22
- width: fit-content;
28
+ width: max-content;
23
29
  }
24
30
  }
25
31