ublo-lib 1.30.5 → 1.30.7

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.
@@ -3,6 +3,7 @@ import Button from "dt-design-system/es/button";
3
3
  import { motion } from "framer-motion";
4
4
  import * as Icons from "dt-design-system/es/icons";
5
5
  import classnames from "classnames";
6
+ import * as Cms from "../../utils/cms";
6
7
  import styles from "./collapsible.module.css";
7
8
  import { jsx as _jsx } from "react/jsx-runtime";
8
9
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -35,10 +36,12 @@ export default function Collapsible({
35
36
  };
36
37
  const messageLang = lang === "fr" ? "fr" : "en";
37
38
  const message = opened ? messages[messageLang].close : messages[messageLang].open;
39
+ const Icon = opened ? Icons.ChevronUp : Icons.ChevronDown;
38
40
  React.useEffect(() => {
39
41
  const parentHeight = parentRef.current?.offsetHeight;
40
42
  const childrenHeight = childrenRef.current?.offsetHeight;
41
- if (childrenHeight > parentHeight) {
43
+ const isConnected = Cms.isConnected();
44
+ if (!isConnected && childrenHeight > parentHeight) {
42
45
  setHasOverflow(true);
43
46
  }
44
47
  }, []);
@@ -60,7 +63,7 @@ export default function Collapsible({
60
63
  }), hasOverflow && _jsxs(Button, {
61
64
  className: styles.message,
62
65
  onClick: toggleOpen,
63
- children: [message, opened ? _jsx(Icons.ChevronUp, {}) : _jsx(Icons.ChevronDown, {})]
66
+ children: [message, _jsx(Icon, {})]
64
67
  })]
65
68
  });
66
69
  }
@@ -1,14 +1,15 @@
1
- .collapsible {
1
+ .collapsible.overflow {
2
2
  position: relative;
3
3
  overflow: hidden;
4
4
  }
5
5
 
6
- .overflow.collapsible::after {
6
+ .collapsible.overflow::after {
7
7
  content: "";
8
8
  position: absolute;
9
9
  bottom: 0;
10
10
  width: 100%;
11
11
  height: calc(100% - 70px);
12
+ /* --gradient-color is defined in the collapsible.tsx props */
12
13
  background: linear-gradient(to top, var(--gradient-color), transparent);
13
14
  transition: opacity 320ms
14
15
  var(--ds-transition-easing, cubic-bezier(0.4, 0.1, 0.2, 0.9));
@@ -16,12 +17,12 @@
16
17
  z-index: 1;
17
18
  }
18
19
 
19
- .opened.collapsible {
20
+ .collapsible.opened {
20
21
  padding-bottom: 10px;
21
22
  margin-bottom: 10px;
22
23
  }
23
24
 
24
- .opened.collapsible::after {
25
+ .collapsible.opened::after {
25
26
  content: none;
26
27
  }
27
28
 
@@ -4,7 +4,8 @@ import { MODES, PRESET_ATTRIBUTE } from "../msem-preset-linker";
4
4
  import * as UrlParams from "../services/url-params";
5
5
  import * as MseM from "../../../utils/msem-widget";
6
6
  export default function useMsemPresets({
7
- mode
7
+ mode,
8
+ defaultOptions
8
9
  }) {
9
10
  const {
10
11
  lang,
@@ -19,23 +20,27 @@ export default function useMsemPresets({
19
20
  if (!preset) return;
20
21
  const {
21
22
  widget,
22
- options,
23
+ options = {},
23
24
  presets,
24
25
  url
25
26
  } = JSON.parse(preset);
27
+ const allOptions = {
28
+ ...defaultOptions,
29
+ ...options
30
+ };
26
31
  e.preventDefault();
27
32
  e.stopPropagation();
28
33
  if (url) {
29
34
  const params = UrlParams.build({
30
- options,
35
+ options: allOptions,
31
36
  presets
32
37
  });
33
38
  const endpoint = url.concat(params);
34
39
  window.open(endpoint, "_blank");
35
40
  return;
36
41
  }
37
- MseM.loadWidget(widget, options, presets);
38
- }, []);
42
+ MseM.loadWidget(widget, allOptions, presets);
43
+ }, [defaultOptions]);
39
44
  React.useEffect(() => {
40
45
  const container = document.getElementById("__next");
41
46
  if (isEnabled && container) {
@@ -56,7 +56,8 @@ export default function MseMPresetLinker({
56
56
  });
57
57
  });
58
58
  useMsemPresets({
59
- mode
59
+ mode,
60
+ defaultOptions: options
60
61
  });
61
62
  if (!cmsMode) return null;
62
63
  return _jsxs("div", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ublo-lib",
3
- "version": "1.30.5",
3
+ "version": "1.30.7",
4
4
  "peerDependencies": {
5
5
  "dt-design-system": "^3.8.3",
6
6
  "leaflet": "^1.9.1",