design-zystem 1.0.215 → 1.0.217

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.
package/dist/index.js CHANGED
@@ -2588,7 +2588,7 @@ var AnimatedContent = ({
2588
2588
  }) => {
2589
2589
  const innerRef = (0, import_react9.useRef)(null);
2590
2590
  const [height, setHeight] = (0, import_react9.useState)(0);
2591
- (0, import_react9.useEffect)(() => {
2591
+ const recalc = (0, import_react9.useCallback)(() => {
2592
2592
  if (open && innerRef.current) {
2593
2593
  const full = innerRef.current.scrollHeight;
2594
2594
  setHeight(maxHeight ? Math.min(full, maxHeight) : full);
@@ -2596,6 +2596,13 @@ var AnimatedContent = ({
2596
2596
  setHeight(0);
2597
2597
  }
2598
2598
  }, [open, maxHeight]);
2599
+ (0, import_react9.useEffect)(recalc, [recalc]);
2600
+ (0, import_react9.useEffect)(() => {
2601
+ if (!open || !innerRef.current) return;
2602
+ const observer = new ResizeObserver(recalc);
2603
+ observer.observe(innerRef.current);
2604
+ return () => observer.disconnect();
2605
+ }, [open, recalc]);
2599
2606
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ContentWrapper, { $height: height, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ContentInner, { ref: innerRef, $maxHeight: maxHeight, children }) });
2600
2607
  };
2601
2608
  var Accordion = ({
package/dist/index.mjs CHANGED
@@ -2508,7 +2508,7 @@ var AnimatedContent = ({
2508
2508
  }) => {
2509
2509
  const innerRef = useRef6(null);
2510
2510
  const [height, setHeight] = useState5(0);
2511
- useEffect6(() => {
2511
+ const recalc = useCallback(() => {
2512
2512
  if (open && innerRef.current) {
2513
2513
  const full = innerRef.current.scrollHeight;
2514
2514
  setHeight(maxHeight ? Math.min(full, maxHeight) : full);
@@ -2516,6 +2516,13 @@ var AnimatedContent = ({
2516
2516
  setHeight(0);
2517
2517
  }
2518
2518
  }, [open, maxHeight]);
2519
+ useEffect6(recalc, [recalc]);
2520
+ useEffect6(() => {
2521
+ if (!open || !innerRef.current) return;
2522
+ const observer = new ResizeObserver(recalc);
2523
+ observer.observe(innerRef.current);
2524
+ return () => observer.disconnect();
2525
+ }, [open, recalc]);
2519
2526
  return /* @__PURE__ */ jsx22(ContentWrapper, { $height: height, children: /* @__PURE__ */ jsx22(ContentInner, { ref: innerRef, $maxHeight: maxHeight, children }) });
2520
2527
  };
2521
2528
  var Accordion = ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "design-zystem",
3
- "version": "1.0.215",
3
+ "version": "1.0.217",
4
4
  "description": "A React design system of importable components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",