@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.d.cts CHANGED
@@ -377,7 +377,7 @@ interface DrawerProps {
377
377
  open?: boolean;
378
378
  title?: React.ReactNode;
379
379
  onClose?: () => void;
380
- /** Plain content, or a render function receiving `close` — call it to trigger the closing animation before onClose fires. */
380
+ /** Plain content, or a render function receiving `close` — call it to ask the app to close (it calls `onClose` at once; the exit animation plays when the app sets `open` false). */
381
381
  footer?: React.ReactNode | ((close: () => void) => React.ReactNode);
382
382
  /** The drawer's content owns the whole panel: no header bar and no body padding, and the panel is the
383
383
  * full viewport height. For content that already has its own header and close control (a chat panel).
@@ -403,7 +403,7 @@ interface ModalProps {
403
403
  title?: React.ReactNode;
404
404
  description?: React.ReactNode;
405
405
  onClose?: () => void;
406
- /** Plain content, or a render function receiving `close` — call it to trigger the closing animation before onClose fires. */
406
+ /** Plain content, or a render function receiving `close` — call it to ask the app to close (it calls `onClose` at once; the exit animation plays when the app sets `open` false). */
407
407
  footer?: React.ReactNode | ((close: () => void) => React.ReactNode);
408
408
  /** 760px — for tables and side-by-side comparisons. */
409
409
  wide?: boolean;
package/dist/index.d.ts CHANGED
@@ -377,7 +377,7 @@ interface DrawerProps {
377
377
  open?: boolean;
378
378
  title?: React.ReactNode;
379
379
  onClose?: () => void;
380
- /** Plain content, or a render function receiving `close` — call it to trigger the closing animation before onClose fires. */
380
+ /** Plain content, or a render function receiving `close` — call it to ask the app to close (it calls `onClose` at once; the exit animation plays when the app sets `open` false). */
381
381
  footer?: React.ReactNode | ((close: () => void) => React.ReactNode);
382
382
  /** The drawer's content owns the whole panel: no header bar and no body padding, and the panel is the
383
383
  * full viewport height. For content that already has its own header and close control (a chat panel).
@@ -403,7 +403,7 @@ interface ModalProps {
403
403
  title?: React.ReactNode;
404
404
  description?: React.ReactNode;
405
405
  onClose?: () => void;
406
- /** Plain content, or a render function receiving `close` — call it to trigger the closing animation before onClose fires. */
406
+ /** Plain content, or a render function receiving `close` — call it to ask the app to close (it calls `onClose` at once; the exit animation plays when the app sets `open` false). */
407
407
  footer?: React.ReactNode | ((close: () => void) => React.ReactNode);
408
408
  /** 760px — for tables and side-by-side comparisons. */
409
409
  wide?: boolean;
package/dist/index.js CHANGED
@@ -1054,40 +1054,21 @@ import { createPortal as createPortal2 } from "react-dom";
1054
1054
  import * as React8 from "react";
1055
1055
  var PANEL_EXIT_MS = 210;
1056
1056
  function useClosingAnimation(open2, onClose, durationMs) {
1057
- const [exit, setExit] = React8.useState(null);
1057
+ const [exiting, setExiting] = React8.useState(false);
1058
1058
  const [wasOpen, setWasOpen] = React8.useState(open2);
1059
- const timer = React8.useRef(null);
1060
- const cancel = React8.useCallback(() => {
1061
- if (timer.current !== null) clearTimeout(timer.current);
1062
- timer.current = null;
1063
- }, []);
1064
1059
  if (open2 !== wasOpen) {
1065
1060
  setWasOpen(open2);
1066
- setExit(open2 || exit === "self" ? null : "parent");
1061
+ setExiting(!open2);
1067
1062
  }
1068
1063
  React8.useEffect(() => {
1069
- if (exit !== "parent") return;
1070
- timer.current = setTimeout(() => {
1071
- timer.current = null;
1072
- setExit(null);
1073
- }, durationMs);
1074
- return cancel;
1075
- }, [exit, durationMs, cancel]);
1076
- React8.useEffect(() => {
1077
- if (!open2 && exit === null) cancel();
1078
- }, [open2, exit, cancel]);
1079
- React8.useEffect(() => cancel, [cancel]);
1064
+ if (!exiting) return;
1065
+ const timer = setTimeout(() => setExiting(false), durationMs);
1066
+ return () => clearTimeout(timer);
1067
+ }, [exiting, durationMs]);
1080
1068
  const close2 = React8.useCallback(() => {
1081
- if (!onClose || !open2) return;
1082
- cancel();
1083
- setExit("self");
1084
- timer.current = setTimeout(() => {
1085
- timer.current = null;
1086
- onClose();
1087
- }, durationMs);
1088
- }, [onClose, open2, durationMs, cancel]);
1089
- const exiting = exit === "parent";
1090
- return { closing: exit !== null, close: close2, rendered: open2 || exiting, exiting };
1069
+ if (onClose && open2) onClose();
1070
+ }, [onClose, open2]);
1071
+ return { closing: exiting, close: close2, rendered: open2 || exiting, exiting };
1091
1072
  }
1092
1073
 
1093
1074
  // src/kits/inertWhen.ts