ublo-lib 1.48.7 → 1.48.9
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,7 +8,9 @@ type Props = {
|
|
|
8
8
|
options: {
|
|
9
9
|
hide_wheel_items?: boolean;
|
|
10
10
|
wheel_items_gap?: number;
|
|
11
|
-
|
|
11
|
+
scale_gap_breakpoint?: number;
|
|
12
|
+
scale_items_gap_desktop?: number;
|
|
13
|
+
scale_items_gap_mobile?: number;
|
|
12
14
|
scale_number?: number;
|
|
13
15
|
rotate_number?: number;
|
|
14
16
|
translateY_number?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"infinite-carousel.d.ts","sourceRoot":"","sources":["../../../../src/common/components/infinite-carousel/infinite-carousel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"infinite-carousel.d.ts","sourceRoot":"","sources":["../../../../src/common/components/infinite-carousel/infinite-carousel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B,KAAK,eAAe,GAAG,OAAO,GAAG,OAAO,CAAC;AAEzC,KAAK,KAAK,GAAG;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE;QACP,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,oBAAoB,CAAC,EAAE,MAAM,CAAC;QAC9B,uBAAuB,CAAC,EAAE,MAAM,CAAC;QACjC,sBAAsB,CAAC,EAAE,MAAM,CAAC;QAChC,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;KAC9B,CAAC;CACH,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,SAAS,EACT,QAAQ,EACR,OAAiB,EACjB,OAAY,EACZ,WAAW,GACZ,EAAE,KAAK,2CAiUP"}
|
|
@@ -6,6 +6,7 @@ import Button from "dt-design-system/es/button";
|
|
|
6
6
|
import ChevronLeftIcon from "dt-design-system/es/icons/chevron-left";
|
|
7
7
|
import ChevronRightIcon from "dt-design-system/es/icons/chevron-right";
|
|
8
8
|
import ScrollbarSize from "../scrollbar-size";
|
|
9
|
+
import useWindowSizes from "../../hooks/use-window-sizes";
|
|
9
10
|
import css from "./infinite-carousel.module.css";
|
|
10
11
|
export default function InfiniteCarousel({ className, children, variant = "wheel", options = {}, cloneNumber, }) {
|
|
11
12
|
const { cmsMode } = useUbloContext();
|
|
@@ -17,8 +18,9 @@ export default function InfiniteCarousel({ className, children, variant = "wheel
|
|
|
17
18
|
const [items, setItems] = React.useState([]);
|
|
18
19
|
const [currentIndex, setCurrentIndex] = React.useState(0);
|
|
19
20
|
const [isTransitioning, setIsTransitioning] = React.useState(false);
|
|
21
|
+
const { width: windowWidth } = useWindowSizes();
|
|
20
22
|
const isEditing = cmsMode === "editing";
|
|
21
|
-
const { wheel_items_gap = 100,
|
|
23
|
+
const { wheel_items_gap = 100, scale_gap_breakpoint = 580, scale_items_gap_desktop = 20, scale_items_gap_mobile = 10, hide_wheel_items = false, scale_number = 0.75, rotate_number = 25, translateY_number = 80, transition_duration = 500, } = options;
|
|
22
24
|
const cloneCount = React.useMemo(() => {
|
|
23
25
|
if (cloneNumber !== undefined)
|
|
24
26
|
return cloneNumber;
|
|
@@ -167,7 +169,9 @@ export default function InfiniteCarousel({ className, children, variant = "wheel
|
|
|
167
169
|
let scale = scale_number;
|
|
168
170
|
let opacity = 1;
|
|
169
171
|
let translateX = 0;
|
|
170
|
-
const gap =
|
|
172
|
+
const gap = windowWidth < scale_gap_breakpoint
|
|
173
|
+
? scale_items_gap_mobile
|
|
174
|
+
: scale_items_gap_desktop;
|
|
171
175
|
if (offset === 0) {
|
|
172
176
|
translateX = 0;
|
|
173
177
|
scale = 1;
|