@phillips/seldon 1.122.0 → 1.122.2
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.
|
@@ -4,14 +4,13 @@ import { forwardRef as G, useId as L, useState as S, useRef as M, useCallback as
|
|
|
4
4
|
import { useCarousel as A } from "./utils.js";
|
|
5
5
|
import { getCommonProps as F } from "../../utils/index.js";
|
|
6
6
|
import { CarouselDot as H } from "./CarouselDot.js";
|
|
7
|
-
const
|
|
8
|
-
({ className: N, maxDots:
|
|
9
|
-
const { className: c, ...k } = F(
|
|
7
|
+
const h = 10, C = 12, J = (h + C) / 2, K = G(
|
|
8
|
+
({ className: N, maxDots: I = 9, position: v = "inline", numberOfSlides: V = 0, ...g }, b) => {
|
|
9
|
+
const { className: c, ...k } = F(g, "CarouselDots"), y = L(), { api: t, onSlideChange: a } = A(), [R, T] = S(0), [i, O] = S(
|
|
10
10
|
Array.from({ length: V }, (e, o) => o)
|
|
11
|
-
), r = M(null), [
|
|
11
|
+
), r = M(null), [D, $] = S([]), w = l((e) => {
|
|
12
12
|
r.current && r.current.scrollTo?.({
|
|
13
|
-
|
|
14
|
-
left: e * ($ + w) - r.current.offsetWidth / 2 + J,
|
|
13
|
+
left: e * (h + C) - r.current.offsetWidth / 2 + J,
|
|
15
14
|
// Center dot in container
|
|
16
15
|
behavior: "smooth"
|
|
17
16
|
});
|
|
@@ -24,9 +23,9 @@ const $ = 10, w = 10, J = 11, K = G(
|
|
|
24
23
|
O(e.scrollSnapList());
|
|
25
24
|
}, []), n = l(
|
|
26
25
|
(e) => {
|
|
27
|
-
T(e.selectedScrollSnap()),
|
|
26
|
+
T(e.selectedScrollSnap()), w(e.selectedScrollSnap());
|
|
28
27
|
},
|
|
29
|
-
[
|
|
28
|
+
[w]
|
|
30
29
|
), u = l(
|
|
31
30
|
(e) => {
|
|
32
31
|
a?.(e.selectedScrollSnap());
|
|
@@ -39,7 +38,7 @@ const $ = 10, w = 10, J = 11, K = G(
|
|
|
39
38
|
t.off("reInit", f).off("reInit", n).off("select", n).off("settle", u);
|
|
40
39
|
};
|
|
41
40
|
}, [t, f, n, u]);
|
|
42
|
-
const s = z(() =>
|
|
41
|
+
const s = z(() => D.sort((e, o) => e - o), [D]);
|
|
43
42
|
return /* @__PURE__ */ m(
|
|
44
43
|
"div",
|
|
45
44
|
{
|
|
@@ -48,12 +47,12 @@ const $ = 10, w = 10, J = 11, K = G(
|
|
|
48
47
|
"aria-roledescription": "pagination",
|
|
49
48
|
"aria-label": "pagination",
|
|
50
49
|
className: E(`${c}`, N, `${c}-${v}`),
|
|
51
|
-
...
|
|
50
|
+
...g,
|
|
52
51
|
...k,
|
|
53
52
|
children: /* @__PURE__ */ m("div", { className: `${c}-container`, children: /* @__PURE__ */ m(
|
|
54
53
|
"div",
|
|
55
54
|
{
|
|
56
|
-
style: { "--max-width": `${
|
|
55
|
+
style: { "--max-width": `${I * h + (I - 1) * C + 2}px` },
|
|
57
56
|
className: `${c}-container-inner`,
|
|
58
57
|
ref: r,
|
|
59
58
|
children: i.map((e, o) => {
|
|
@@ -71,7 +70,7 @@ const $ = 10, w = 10, J = 11, K = G(
|
|
|
71
70
|
isSelected: W,
|
|
72
71
|
scrollableContainerRef: r,
|
|
73
72
|
onInViewChange: (j) => {
|
|
74
|
-
|
|
73
|
+
$(j ? (p) => [...p, o] : (p) => p.filter((B) => B !== o));
|
|
75
74
|
},
|
|
76
75
|
variant: _ ? "sm" : "md"
|
|
77
76
|
},
|
|
@@ -93,7 +93,6 @@
|
|
|
93
93
|
&-dots {
|
|
94
94
|
align-items: center;
|
|
95
95
|
display: flex;
|
|
96
|
-
gap: 12px;
|
|
97
96
|
justify-content: center;
|
|
98
97
|
margin-top: 1rem;
|
|
99
98
|
|
|
@@ -120,14 +119,14 @@
|
|
|
120
119
|
&-container-inner {
|
|
121
120
|
align-items: center;
|
|
122
121
|
display: flex;
|
|
123
|
-
gap:
|
|
122
|
+
gap: 12px;
|
|
124
123
|
max-width: var(--max-width);
|
|
125
124
|
overflow: auto;
|
|
126
125
|
-webkit-overflow-scrolling: touch;
|
|
127
126
|
-ms-overflow-style: none; /* Internet Explorer 10+ */
|
|
127
|
+
padding: 1px 2px;
|
|
128
128
|
scroll-snap-type: x mandatory;
|
|
129
129
|
scrollbar-width: none; /* Firefox */
|
|
130
|
-
|
|
131
130
|
&::-webkit-scrollbar {
|
|
132
131
|
display: none; /* Safari and Chrome */
|
|
133
132
|
}
|
|
@@ -139,7 +138,6 @@
|
|
|
139
138
|
display: flex;
|
|
140
139
|
height: 10px;
|
|
141
140
|
justify-content: center;
|
|
142
|
-
margin: 2px;
|
|
143
141
|
min-width: 10px;
|
|
144
142
|
padding: 1px;
|
|
145
143
|
scroll-snap-align: center;
|