@geomak/ui 6.19.0 → 6.20.0
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/index.cjs +7 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1826,10 +1826,9 @@ function RotatingCarousel({
|
|
|
1826
1826
|
const count = slides.length;
|
|
1827
1827
|
const [active, setActive] = useState(0);
|
|
1828
1828
|
const reduced = useReducedMotion();
|
|
1829
|
-
const
|
|
1830
|
-
const
|
|
1831
|
-
const
|
|
1832
|
-
const step = (dir) => setActive((a) => Math.min(Math.max(a + dir, 0), count - 1));
|
|
1829
|
+
const wrap = (n) => count > 0 ? (n % count + count) % count : 0;
|
|
1830
|
+
const idx = wrap(active);
|
|
1831
|
+
const step = (dir) => setActive((a) => wrap(a + dir));
|
|
1833
1832
|
const w = typeof itemWidth === "number" ? itemWidth : parseInt(String(itemWidth), 10) || 320;
|
|
1834
1833
|
const widthCss = typeof itemWidth === "number" ? `${itemWidth}px` : itemWidth;
|
|
1835
1834
|
const SPACING = w * 0.6;
|
|
@@ -1854,11 +1853,12 @@ function RotatingCarousel({
|
|
|
1854
1853
|
style,
|
|
1855
1854
|
onKeyDown,
|
|
1856
1855
|
children: [
|
|
1857
|
-
showArrows && /* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Previous", onClick: () => step(-1),
|
|
1856
|
+
showArrows && /* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Previous", onClick: () => step(-1), className: `${arrowBtn} left-1`, children: /* @__PURE__ */ jsx(Arrow2, { dir: "left" }) }),
|
|
1858
1857
|
/* @__PURE__ */ jsxs("div", { className: "relative mx-auto overflow-hidden py-6", children: [
|
|
1859
1858
|
count > 0 && /* @__PURE__ */ jsx("div", { className: "invisible mx-auto", style: { width: widthCss }, "aria-hidden": "true", children: slides[idx] }),
|
|
1860
1859
|
slides.map((slide, i) => {
|
|
1861
|
-
|
|
1860
|
+
let offset = wrap(i - idx);
|
|
1861
|
+
if (offset > count / 2) offset -= count;
|
|
1862
1862
|
const abs = Math.abs(offset);
|
|
1863
1863
|
if (abs > 2) return null;
|
|
1864
1864
|
const isCenter = offset === 0;
|
|
@@ -1889,7 +1889,7 @@ function RotatingCarousel({
|
|
|
1889
1889
|
);
|
|
1890
1890
|
})
|
|
1891
1891
|
] }),
|
|
1892
|
-
showArrows && /* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Next", onClick: () => step(1),
|
|
1892
|
+
showArrows && /* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Next", onClick: () => step(1), className: `${arrowBtn} right-1`, children: /* @__PURE__ */ jsx(Arrow2, { dir: "right" }) }),
|
|
1893
1893
|
showDots && count > 1 && /* @__PURE__ */ jsx(Dots, { count, active: idx, onSelect: setActive })
|
|
1894
1894
|
]
|
|
1895
1895
|
}
|