ublo-lib 1.34.4 → 1.34.5

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,6 +1,6 @@
1
1
  declare const _default: React.MemoExoticComponent<typeof Carousel>;
2
2
  export default _default;
3
- declare function Carousel({ delay, fade, controls, dots, thumbnails, alwaysShowControls, allowDragOnDesktop, children, onChange, }: {
3
+ declare function Carousel({ delay, fade, controls, dots, thumbnails, alwaysShowControls, allowDragOnDesktop, children, onChange, currentSlide, }: {
4
4
  delay?: number;
5
5
  fade?: boolean;
6
6
  controls: any;
@@ -10,6 +10,7 @@ declare function Carousel({ delay, fade, controls, dots, thumbnails, alwaysShowC
10
10
  allowDragOnDesktop: any;
11
11
  children: any;
12
12
  onChange: any;
13
+ currentSlide: any;
13
14
  }): import("react/jsx-runtime").JSX.Element;
14
15
  import * as React from "react";
15
16
  //# sourceMappingURL=carousel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../../../src/common/components/carousel.js"],"names":[],"mappings":";;AAUA;;;;;;;;;;4CA4SC;uBAtTsB,OAAO"}
1
+ {"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../../../src/common/components/carousel.js"],"names":[],"mappings":";;AAUA;;;;;;;;;;;4CAmTC;uBA7TsB,OAAO"}
@@ -6,11 +6,11 @@ import * as Icons from "dt-design-system/es/icons";
6
6
  const TARGETS = "section[data-class]";
7
7
  const UNDRAGGABLE_TAGS = "img, a, button";
8
8
  export default React.memo(Carousel);
9
- function Carousel({ delay = 4000, fade = false, controls, dots, thumbnails, alwaysShowControls, allowDragOnDesktop, children, onChange, }) {
9
+ function Carousel({ delay = 4000, fade = false, controls, dots, thumbnails, alwaysShowControls, allowDragOnDesktop, children, onChange, currentSlide, }) {
10
10
  const carouselRef = React.useRef();
11
11
  const { cmsMode, lang, path } = useUbloContext();
12
12
  const [sections, setSections] = React.useState([]);
13
- const [current, setCurrent] = React.useState(0);
13
+ const [current, setCurrent] = React.useState(currentSlide ?? 0);
14
14
  const [touchStartPosition, setTouchStartPosition] = React.useState();
15
15
  const [dragging, setDragging] = React.useState(0);
16
16
  const editing = cmsMode === "editing";
@@ -120,6 +120,11 @@ function Carousel({ delay = 4000, fade = false, controls, dots, thumbnails, alwa
120
120
  const sections = getSections();
121
121
  setSections(sections);
122
122
  }, [getSections]);
123
+ React.useEffect(() => {
124
+ if (!delay && currentSlide !== undefined) {
125
+ setCurrent(currentSlide);
126
+ }
127
+ }, [currentSlide, delay]);
123
128
  React.useEffect(() => {
124
129
  const zone = carouselRef.current?.querySelector(".cms");
125
130
  if (zone) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ublo-lib",
3
- "version": "1.34.4",
3
+ "version": "1.34.5",
4
4
  "peerDependencies": {
5
5
  "dt-design-system": "^3.8.5",
6
6
  "leaflet": "^1.9.1",