ublo-lib 1.48.7 → 1.48.8
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.
|
@@ -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;AAW/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,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,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;AAIF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,SAAS,EACT,QAAQ,EACR,OAAiB,EACjB,OAAY,EACZ,WAAW,GACZ,EAAE,KAAK,2CAkUP"}
|
|
@@ -6,7 +6,9 @@ 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";
|
|
11
|
+
const MOBILE_BREAKPOINT = 580;
|
|
10
12
|
export default function InfiniteCarousel({ className, children, variant = "wheel", options = {}, cloneNumber, }) {
|
|
11
13
|
const { cmsMode } = useUbloContext();
|
|
12
14
|
const zoneRef = React.useRef(null);
|
|
@@ -17,8 +19,9 @@ export default function InfiniteCarousel({ className, children, variant = "wheel
|
|
|
17
19
|
const [items, setItems] = React.useState([]);
|
|
18
20
|
const [currentIndex, setCurrentIndex] = React.useState(0);
|
|
19
21
|
const [isTransitioning, setIsTransitioning] = React.useState(false);
|
|
22
|
+
const { width: windowWidth } = useWindowSizes();
|
|
20
23
|
const isEditing = cmsMode === "editing";
|
|
21
|
-
const { wheel_items_gap = 100, scale_items_gap = 10, hide_wheel_items = false, scale_number = 0.75, rotate_number = 25, translateY_number = 80, transition_duration = 500, } = options;
|
|
24
|
+
const { wheel_items_gap = 100, scale_items_gap = 20, 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
25
|
const cloneCount = React.useMemo(() => {
|
|
23
26
|
if (cloneNumber !== undefined)
|
|
24
27
|
return cloneNumber;
|
|
@@ -167,7 +170,11 @@ export default function InfiniteCarousel({ className, children, variant = "wheel
|
|
|
167
170
|
let scale = scale_number;
|
|
168
171
|
let opacity = 1;
|
|
169
172
|
let translateX = 0;
|
|
170
|
-
const gap = scale_items_gap
|
|
173
|
+
const gap = scale_items_gap
|
|
174
|
+
? scale_items_gap
|
|
175
|
+
: windowWidth < MOBILE_BREAKPOINT
|
|
176
|
+
? scale_items_gap_mobile
|
|
177
|
+
: scale_items_gap_desktop;
|
|
171
178
|
if (offset === 0) {
|
|
172
179
|
translateX = 0;
|
|
173
180
|
scale = 1;
|