ublo-lib 1.38.23 → 1.38.25

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,10 +1,11 @@
1
1
  import * as React from "react";
2
2
  type Props = {
3
- children: React.ReactNode;
4
3
  height: number;
5
4
  lang: string;
6
5
  gradientColor: string;
6
+ path: string;
7
+ children: React.ReactNode;
7
8
  };
8
- export default function Collapsible({ gradientColor, height, children, lang, }: Props): import("react/jsx-runtime").JSX.Element;
9
+ export default function Collapsible({ gradientColor, height, lang, path, children, }: Props): import("react/jsx-runtime").JSX.Element;
9
10
  export {};
10
11
  //# sourceMappingURL=collapsible.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"collapsible.d.ts","sourceRoot":"","sources":["../../../../src/common/components/collapsible/collapsible.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,KAAK,KAAK,GAAG;IACX,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAaF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,aAAsB,EACtB,MAAY,EACZ,QAAQ,EACR,IAAI,GACL,EAAE,KAAK,2CAkDP"}
1
+ {"version":3,"file":"collapsible.d.ts","sourceRoot":"","sources":["../../../../src/common/components/collapsible/collapsible.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAaF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,aAAsB,EACtB,MAAY,EACZ,IAAI,EACJ,IAAI,EACJ,QAAQ,GACT,EAAE,KAAK,2CAuDP"}
@@ -16,9 +16,10 @@ const messages = {
16
16
  close: "Close",
17
17
  },
18
18
  };
19
- export default function Collapsible({ gradientColor = "#fff", height = 150, children, lang, }) {
19
+ export default function Collapsible({ gradientColor = "#fff", height = 150, lang, path, children, }) {
20
20
  const [opened, setOpened] = React.useState(false);
21
21
  const [hasOverflow, setHasOverflow] = React.useState(false);
22
+ const [isConnected, setIsConnected] = React.useState(false);
22
23
  const classes = classnames(styles.collapsible, {
23
24
  [styles.opened]: opened,
24
25
  [styles.overflow]: hasOverflow,
@@ -37,11 +38,13 @@ export default function Collapsible({ gradientColor = "#fff", height = 150, chil
37
38
  const parentHeight = parentRef.current?.offsetHeight;
38
39
  const childrenHeight = childrenRef.current?.offsetHeight;
39
40
  const isConnected = Cms.isConnected();
40
- if (!isConnected && childrenHeight > parentHeight) {
41
- setHasOverflow(true);
41
+ setIsConnected(isConnected);
42
+ if (!isConnected) {
43
+ setHasOverflow(childrenHeight > parentHeight);
42
44
  }
43
- }, []);
45
+ }, [lang, path]);
46
+ const key = !isConnected ? lang + path : undefined;
44
47
  return (_jsxs(motion.div, { ref: parentRef, animate: {
45
48
  height: opened || !hasOverflow ? "auto" : height,
46
- }, initial: { height }, className: classes, style: { "--gradient-color": gradientColor }, children: [_jsx("div", { ref: childrenRef, children: children }), hasOverflow && (_jsxs(Button, { className: styles.message, onClick: toggleOpen, children: [message, _jsx(Icon, {})] }))] }));
49
+ }, initial: { height }, className: classes, style: { "--gradient-color": gradientColor }, children: [_jsx("div", { ref: childrenRef, children: children }), hasOverflow && (_jsxs(Button, { className: styles.message, onClick: toggleOpen, children: [message, _jsx(Icon, {})] }))] }, key));
47
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ublo-lib",
3
- "version": "1.38.23",
3
+ "version": "1.38.25",
4
4
  "peerDependencies": {
5
5
  "dt-design-system": "^3.10.8",
6
6
  "leaflet": "^1.9.1",