@flytedan/flytebot-design-system 0.84.0 → 0.85.0

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.cjs CHANGED
@@ -2235,40 +2235,21 @@ var import_react_dom3 = require("react-dom");
2235
2235
  var React8 = __toESM(require("react"), 1);
2236
2236
  var PANEL_EXIT_MS = 210;
2237
2237
  function useClosingAnimation(open2, onClose, durationMs) {
2238
- const [exit, setExit] = React8.useState(null);
2238
+ const [exiting, setExiting] = React8.useState(false);
2239
2239
  const [wasOpen, setWasOpen] = React8.useState(open2);
2240
- const timer = React8.useRef(null);
2241
- const cancel = React8.useCallback(() => {
2242
- if (timer.current !== null) clearTimeout(timer.current);
2243
- timer.current = null;
2244
- }, []);
2245
2240
  if (open2 !== wasOpen) {
2246
2241
  setWasOpen(open2);
2247
- setExit(open2 || exit === "self" ? null : "parent");
2242
+ setExiting(!open2);
2248
2243
  }
2249
2244
  React8.useEffect(() => {
2250
- if (exit !== "parent") return;
2251
- timer.current = setTimeout(() => {
2252
- timer.current = null;
2253
- setExit(null);
2254
- }, durationMs);
2255
- return cancel;
2256
- }, [exit, durationMs, cancel]);
2257
- React8.useEffect(() => {
2258
- if (!open2 && exit === null) cancel();
2259
- }, [open2, exit, cancel]);
2260
- React8.useEffect(() => cancel, [cancel]);
2245
+ if (!exiting) return;
2246
+ const timer = setTimeout(() => setExiting(false), durationMs);
2247
+ return () => clearTimeout(timer);
2248
+ }, [exiting, durationMs]);
2261
2249
  const close2 = React8.useCallback(() => {
2262
- if (!onClose || !open2) return;
2263
- cancel();
2264
- setExit("self");
2265
- timer.current = setTimeout(() => {
2266
- timer.current = null;
2267
- onClose();
2268
- }, durationMs);
2269
- }, [onClose, open2, durationMs, cancel]);
2270
- const exiting = exit === "parent";
2271
- return { closing: exit !== null, close: close2, rendered: open2 || exiting, exiting };
2250
+ if (onClose && open2) onClose();
2251
+ }, [onClose, open2]);
2252
+ return { closing: exiting, close: close2, rendered: open2 || exiting, exiting };
2272
2253
  }
2273
2254
 
2274
2255
  // src/kits/inertWhen.ts