@postenbring/hedwig-react 0.0.61 → 0.0.62

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.
@@ -148,7 +148,7 @@ import "./chunk-33JD5XDW.mjs";
148
148
  import "./chunk-DZNH5JHY.mjs";
149
149
  import {
150
150
  AutoAnimateHeight
151
- } from "./chunk-2LKUHKL4.mjs";
151
+ } from "./chunk-Q6REETZD.mjs";
152
152
  import "./chunk-R4SQKVDQ.mjs";
153
153
  export {
154
154
  AccordionComponent as Accordion,
package/dist/index.js CHANGED
@@ -1517,6 +1517,7 @@ var AutoAnimateHeight = (0, import_react24.forwardRef)(
1517
1517
  "animationDuration",
1518
1518
  "animationEasing"
1519
1519
  ]);
1520
+ const timeoutRef = (0, import_react24.useRef)(null);
1520
1521
  const measurementRef = (0, import_react24.useRef)(null);
1521
1522
  const [height, setHeight] = (0, import_react24.useState)(void 0);
1522
1523
  const [clonedChildren, setClonedChildren] = (0, import_react24.useState)(
@@ -1525,13 +1526,18 @@ var AutoAnimateHeight = (0, import_react24.forwardRef)(
1525
1526
  (0, import_react24.useEffect)(() => {
1526
1527
  if (measurementRef.current) {
1527
1528
  const { height: newHeight } = measurementRef.current.getBoundingClientRect();
1529
+ if (timeoutRef.current) {
1530
+ clearTimeout(timeoutRef.current);
1531
+ }
1528
1532
  if (newHeight < (height != null ? height : 0)) {
1529
- (0, import_react_dom.flushSync)(() => {
1530
- setHeight(newHeight);
1531
- });
1532
1533
  setTimeout(() => {
1533
- setClonedChildren((0, import_react24.cloneElement)(/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children }), {}));
1534
- }, animationDurationToValue[animationDuration]);
1534
+ (0, import_react_dom.flushSync)(() => {
1535
+ setHeight(newHeight);
1536
+ });
1537
+ timeoutRef.current = setTimeout(() => {
1538
+ setClonedChildren((0, import_react24.cloneElement)(/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children }), {}));
1539
+ }, animationDurationToValue[animationDuration]);
1540
+ });
1535
1541
  } else {
1536
1542
  setHeight(newHeight);
1537
1543
  setClonedChildren((0, import_react24.cloneElement)(/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children }), {}));