@flytedan/flytebot-design-system 0.83.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
@@ -357,6 +357,8 @@ interface CollapsibleProps {
357
357
  badge?: React.ReactNode;
358
358
  /** Phosphor icon name shown in a soft brand chip on the left. */
359
359
  icon?: string;
360
+ /** Controls drawn in the header row at its right, outside the trigger button: their own tab stops, and pressing one never opens or closes the section. */
361
+ actions?: React.ReactNode;
360
362
  defaultOpen?: boolean;
361
363
  /** Pass with onToggle for controlled use. */
362
364
  open?: boolean;
@@ -364,7 +366,7 @@ interface CollapsibleProps {
364
366
  children?: React.ReactNode;
365
367
  className?: string;
366
368
  }
367
- declare function Collapsible({ title, subtitle, badge, icon, defaultOpen, open, onToggle, children, className, ...rest }: CollapsibleProps): React.JSX.Element;
369
+ declare function Collapsible({ title, subtitle, badge, icon, actions, defaultOpen, open, onToggle, children, className, ...rest }: CollapsibleProps): React.JSX.Element;
368
370
 
369
371
  /** A right-side panel for detail and editing without losing the list behind it.
370
372
  * MP-248: always modal (declares `aria-modal="true"`), so it is a trapping layer in the
@@ -375,7 +377,7 @@ interface DrawerProps {
375
377
  open?: boolean;
376
378
  title?: React.ReactNode;
377
379
  onClose?: () => void;
378
- /** 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). */
379
381
  footer?: React.ReactNode | ((close: () => void) => React.ReactNode);
380
382
  /** The drawer's content owns the whole panel: no header bar and no body padding, and the panel is the
381
383
  * full viewport height. For content that already has its own header and close control (a chat panel).
@@ -401,7 +403,7 @@ interface ModalProps {
401
403
  title?: React.ReactNode;
402
404
  description?: React.ReactNode;
403
405
  onClose?: () => void;
404
- /** 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). */
405
407
  footer?: React.ReactNode | ((close: () => void) => React.ReactNode);
406
408
  /** 760px — for tables and side-by-side comparisons. */
407
409
  wide?: boolean;
@@ -2643,6 +2645,8 @@ interface ReferenceSection {
2643
2645
  title: React.ReactNode;
2644
2646
  /** One line under the title. */
2645
2647
  subtitle?: React.ReactNode;
2648
+ /** Controls in the section's heading row, outside the open/close button, e.g. a CopyButton for the section's name. */
2649
+ actions?: React.ReactNode;
2646
2650
  entries: ReferenceEntry[];
2647
2651
  /** Uncontrolled initial state. Default closed. */
2648
2652
  defaultOpen?: boolean;
package/dist/index.d.ts CHANGED
@@ -357,6 +357,8 @@ interface CollapsibleProps {
357
357
  badge?: React.ReactNode;
358
358
  /** Phosphor icon name shown in a soft brand chip on the left. */
359
359
  icon?: string;
360
+ /** Controls drawn in the header row at its right, outside the trigger button: their own tab stops, and pressing one never opens or closes the section. */
361
+ actions?: React.ReactNode;
360
362
  defaultOpen?: boolean;
361
363
  /** Pass with onToggle for controlled use. */
362
364
  open?: boolean;
@@ -364,7 +366,7 @@ interface CollapsibleProps {
364
366
  children?: React.ReactNode;
365
367
  className?: string;
366
368
  }
367
- declare function Collapsible({ title, subtitle, badge, icon, defaultOpen, open, onToggle, children, className, ...rest }: CollapsibleProps): React.JSX.Element;
369
+ declare function Collapsible({ title, subtitle, badge, icon, actions, defaultOpen, open, onToggle, children, className, ...rest }: CollapsibleProps): React.JSX.Element;
368
370
 
369
371
  /** A right-side panel for detail and editing without losing the list behind it.
370
372
  * MP-248: always modal (declares `aria-modal="true"`), so it is a trapping layer in the
@@ -375,7 +377,7 @@ interface DrawerProps {
375
377
  open?: boolean;
376
378
  title?: React.ReactNode;
377
379
  onClose?: () => void;
378
- /** 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). */
379
381
  footer?: React.ReactNode | ((close: () => void) => React.ReactNode);
380
382
  /** The drawer's content owns the whole panel: no header bar and no body padding, and the panel is the
381
383
  * full viewport height. For content that already has its own header and close control (a chat panel).
@@ -401,7 +403,7 @@ interface ModalProps {
401
403
  title?: React.ReactNode;
402
404
  description?: React.ReactNode;
403
405
  onClose?: () => void;
404
- /** 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). */
405
407
  footer?: React.ReactNode | ((close: () => void) => React.ReactNode);
406
408
  /** 760px — for tables and side-by-side comparisons. */
407
409
  wide?: boolean;
@@ -2643,6 +2645,8 @@ interface ReferenceSection {
2643
2645
  title: React.ReactNode;
2644
2646
  /** One line under the title. */
2645
2647
  subtitle?: React.ReactNode;
2648
+ /** Controls in the section's heading row, outside the open/close button, e.g. a CopyButton for the section's name. */
2649
+ actions?: React.ReactNode;
2646
2650
  entries: ReferenceEntry[];
2647
2651
  /** Uncontrolled initial state. Default closed. */
2648
2652
  defaultOpen?: boolean;
package/dist/index.js CHANGED
@@ -1014,6 +1014,7 @@ function Collapsible({
1014
1014
  subtitle,
1015
1015
  badge,
1016
1016
  icon,
1017
+ actions,
1017
1018
  defaultOpen = false,
1018
1019
  open: open2,
1019
1020
  onToggle,
@@ -1027,16 +1028,20 @@ function Collapsible({
1027
1028
  if (open2 === void 0) setInternal(!isOpen);
1028
1029
  if (onToggle) onToggle(!isOpen);
1029
1030
  };
1030
- return /* @__PURE__ */ jsxs6("div", { className: ["fd-coll", className].filter(Boolean).join(" "), "data-open": isOpen ? "true" : "false", ...rest, children: [
1031
- /* @__PURE__ */ jsxs6("button", { type: "button", className: "fd-coll-trigger", "aria-expanded": isOpen, onClick: toggle, children: [
1032
- icon ? /* @__PURE__ */ jsx9("span", { className: "fd-coll-caret", style: { background: "var(--brand-soft)", color: "var(--brand)", transform: "none" }, children: /* @__PURE__ */ jsx9("i", { className: "ph ph-" + icon, "aria-hidden": "true" }) }) : null,
1033
- /* @__PURE__ */ jsxs6("span", { style: { flex: 1, minWidth: 0 }, children: [
1034
- /* @__PURE__ */ jsx9("span", { className: "fd-coll-title", style: { display: "block" }, children: title }),
1035
- subtitle ? /* @__PURE__ */ jsx9("span", { className: "fd-coll-sub", style: { display: "block" }, children: subtitle }) : null
1036
- ] }),
1037
- badge,
1038
- /* @__PURE__ */ jsx9("span", { className: "fd-coll-caret", children: /* @__PURE__ */ jsx9("i", { className: "ph ph-caret-down", "aria-hidden": "true" }) })
1031
+ const trigger = /* @__PURE__ */ jsxs6("button", { type: "button", className: "fd-coll-trigger", "aria-expanded": isOpen, onClick: toggle, children: [
1032
+ icon ? /* @__PURE__ */ jsx9("span", { className: "fd-coll-caret", style: { background: "var(--brand-soft)", color: "var(--brand)", transform: "none" }, children: /* @__PURE__ */ jsx9("i", { className: "ph ph-" + icon, "aria-hidden": "true" }) }) : null,
1033
+ /* @__PURE__ */ jsxs6("span", { style: { flex: 1, minWidth: 0 }, children: [
1034
+ /* @__PURE__ */ jsx9("span", { className: "fd-coll-title", style: { display: "block" }, children: title }),
1035
+ subtitle ? /* @__PURE__ */ jsx9("span", { className: "fd-coll-sub", style: { display: "block" }, children: subtitle }) : null
1039
1036
  ] }),
1037
+ badge,
1038
+ /* @__PURE__ */ jsx9("span", { className: "fd-coll-caret", children: /* @__PURE__ */ jsx9("i", { className: "ph ph-caret-down", "aria-hidden": "true" }) })
1039
+ ] });
1040
+ return /* @__PURE__ */ jsxs6("div", { className: ["fd-coll", className].filter(Boolean).join(" "), "data-open": isOpen ? "true" : "false", ...rest, children: [
1041
+ actions ? /* @__PURE__ */ jsxs6("div", { className: "fd-coll-head", children: [
1042
+ trigger,
1043
+ /* @__PURE__ */ jsx9("div", { className: "fd-coll-actions", children: actions })
1044
+ ] }) : trigger,
1040
1045
  /* @__PURE__ */ jsx9("div", { className: "fd-coll-panel", children: /* @__PURE__ */ jsx9("div", { children: /* @__PURE__ */ jsx9("div", { className: "fd-coll-content", children }) }) })
1041
1046
  ] });
1042
1047
  }
@@ -1049,40 +1054,21 @@ import { createPortal as createPortal2 } from "react-dom";
1049
1054
  import * as React8 from "react";
1050
1055
  var PANEL_EXIT_MS = 210;
1051
1056
  function useClosingAnimation(open2, onClose, durationMs) {
1052
- const [exit, setExit] = React8.useState(null);
1057
+ const [exiting, setExiting] = React8.useState(false);
1053
1058
  const [wasOpen, setWasOpen] = React8.useState(open2);
1054
- const timer = React8.useRef(null);
1055
- const cancel = React8.useCallback(() => {
1056
- if (timer.current !== null) clearTimeout(timer.current);
1057
- timer.current = null;
1058
- }, []);
1059
1059
  if (open2 !== wasOpen) {
1060
1060
  setWasOpen(open2);
1061
- setExit(open2 || exit === "self" ? null : "parent");
1061
+ setExiting(!open2);
1062
1062
  }
1063
1063
  React8.useEffect(() => {
1064
- if (exit !== "parent") return;
1065
- timer.current = setTimeout(() => {
1066
- timer.current = null;
1067
- setExit(null);
1068
- }, durationMs);
1069
- return cancel;
1070
- }, [exit, durationMs, cancel]);
1071
- React8.useEffect(() => {
1072
- if (!open2 && exit === null) cancel();
1073
- }, [open2, exit, cancel]);
1074
- React8.useEffect(() => cancel, [cancel]);
1064
+ if (!exiting) return;
1065
+ const timer = setTimeout(() => setExiting(false), durationMs);
1066
+ return () => clearTimeout(timer);
1067
+ }, [exiting, durationMs]);
1075
1068
  const close2 = React8.useCallback(() => {
1076
- if (!onClose || !open2) return;
1077
- cancel();
1078
- setExit("self");
1079
- timer.current = setTimeout(() => {
1080
- timer.current = null;
1081
- onClose();
1082
- }, durationMs);
1083
- }, [onClose, open2, durationMs, cancel]);
1084
- const exiting = exit === "parent";
1085
- 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 };
1086
1072
  }
1087
1073
 
1088
1074
  // src/kits/inertWhen.ts
@@ -7181,6 +7167,7 @@ function ReferenceList(props) {
7181
7167
  className: "fd-ref-section",
7182
7168
  title: s.title,
7183
7169
  subtitle: s.subtitle,
7170
+ actions: s.actions,
7184
7171
  badge: /* @__PURE__ */ jsx72("span", { className: "fd-badge fd-badge-count", children: searching ? `${shown.length} of ${s.entries.length}` : s.entries.length }),
7185
7172
  open: open2,
7186
7173
  onToggle: (next) => {