@flytedan/flytebot-design-system 0.12.13 → 0.12.15

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
@@ -197,14 +197,48 @@ var portal = (node) => {
197
197
  };
198
198
  var ROOT_LAYER = 0;
199
199
  var LAYER_STEP = 10;
200
+ var ROOT_STEP = 100;
201
+ var OVERLAY_CEILING = 1e4;
200
202
  var LayerContext = React2.createContext(ROOT_LAYER);
203
+ var openRootIds = [];
204
+ var rootListeners = /* @__PURE__ */ new Set();
205
+ var notifyRootListeners = () => {
206
+ rootListeners.forEach((listener) => listener());
207
+ };
208
+ var subscribeRootOverlays = (listener) => {
209
+ rootListeners.add(listener);
210
+ return () => {
211
+ rootListeners.delete(listener);
212
+ };
213
+ };
214
+ var getRootOverlaysSnapshot = () => openRootIds;
215
+ var registerRootOverlay = (id) => {
216
+ if (openRootIds.includes(id)) return;
217
+ openRootIds = [...openRootIds, id];
218
+ notifyRootListeners();
219
+ };
220
+ var unregisterRootOverlay = (id) => {
221
+ if (!openRootIds.includes(id)) return;
222
+ openRootIds = openRootIds.filter((existing) => existing !== id);
223
+ notifyRootListeners();
224
+ };
201
225
  var useLayer = () => React2.useContext(LayerContext);
202
- var useOverlayLayer = (base) => {
226
+ var useOverlayLayer = (isOpen) => {
203
227
  const parent = useLayer();
204
- return parent === ROOT_LAYER ? base : parent + LAYER_STEP;
228
+ const isRoot = parent === ROOT_LAYER;
229
+ const id = React2.useId();
230
+ const openIds = React2.useSyncExternalStore(subscribeRootOverlays, getRootOverlaysSnapshot, getRootOverlaysSnapshot);
231
+ React2.useLayoutEffect(() => {
232
+ if (!isRoot || !isOpen) return;
233
+ registerRootOverlay(id);
234
+ return () => unregisterRootOverlay(id);
235
+ }, [isRoot, isOpen, id]);
236
+ if (!isRoot) return parent + LAYER_STEP;
237
+ if (!isOpen) return ROOT_LAYER;
238
+ const index = openIds.indexOf(id);
239
+ return index === -1 ? ROOT_LAYER : (index + 1) * ROOT_STEP;
205
240
  };
206
241
  var LayerProvider = ({ zIndex, children }) => /* @__PURE__ */ jsx3(LayerContext.Provider, { value: zIndex, children });
207
- var POPOVER_BASE = 140;
208
242
  function Popover({
209
243
  open,
210
244
  anchorRef,
@@ -241,7 +275,7 @@ function Popover({
241
275
  layerRef: ref
242
276
  });
243
277
  const restore = React2.useRef(null);
244
- const zIndex = useOverlayLayer(POPOVER_BASE);
278
+ const zIndex = useOverlayLayer(!!open);
245
279
  React2.useEffect(() => {
246
280
  if (!open) return;
247
281
  restore.current = typeof document !== "undefined" ? document.activeElement : null;
@@ -570,7 +604,9 @@ function SegmentedControl({ options = [], value, onChange, className = "", ...re
570
604
 
571
605
  // src/components/textExposure.ts
572
606
  function truncationTitle(content) {
573
- return typeof content === "string" || typeof content === "number" ? String(content) : void 0;
607
+ if (typeof content !== "string" && typeof content !== "number") return void 0;
608
+ const text = String(content);
609
+ return text === "" ? void 0 : text;
574
610
  }
575
611
 
576
612
  // src/components/surfaces/Card.tsx
@@ -647,9 +683,8 @@ function Collapsible({
647
683
  import * as React4 from "react";
648
684
  import { createPortal as createPortal2 } from "react-dom";
649
685
  import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
650
- var DRAWER_BASE = 90;
651
686
  function Drawer({ open = true, title, onClose, footer, children, className = "", ...rest }) {
652
- const zIndex = useOverlayLayer(DRAWER_BASE);
687
+ const zIndex = useOverlayLayer(open);
653
688
  const [closing, setClosing] = React4.useState(false);
654
689
  const close = React4.useCallback(() => {
655
690
  if (!onClose) return;
@@ -687,6 +722,7 @@ import { createPortal as createPortal3 } from "react-dom";
687
722
  import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
688
723
  function Modal({ open = true, title, description, onClose, footer, wide = false, children, className = "", ...rest }) {
689
724
  const [closing, setClosing] = React5.useState(false);
725
+ const zIndex = useOverlayLayer(!!open);
690
726
  const close = React5.useCallback(() => {
691
727
  if (!onClose) return;
692
728
  setClosing(true);
@@ -702,10 +738,11 @@ function Modal({ open = true, title, description, onClose, footer, wide = false,
702
738
  }, [open, onClose, close]);
703
739
  if (!open) return null;
704
740
  return createPortal3(
705
- /* @__PURE__ */ jsx8(
741
+ /* @__PURE__ */ jsx8(LayerProvider, { zIndex, children: /* @__PURE__ */ jsx8(
706
742
  "div",
707
743
  {
708
744
  className: "fd-scrim" + (closing ? " is-closing" : ""),
745
+ style: { zIndex: zIndex - LAYER_STEP },
709
746
  onClick: onClose ? (e) => {
710
747
  if (e.target === e.currentTarget) close();
711
748
  } : void 0,
@@ -731,7 +768,7 @@ function Modal({ open = true, title, description, onClose, footer, wide = false,
731
768
  }
732
769
  )
733
770
  }
734
- ),
771
+ ) }),
735
772
  document.body
736
773
  );
737
774
  }
@@ -866,7 +903,7 @@ function SidebarNav({ brand, groups = [], current: current2, onNavigate, footer,
866
903
  onClick: onNavigate ? () => onNavigate(it.value) : void 0,
867
904
  children: [
868
905
  /* @__PURE__ */ jsx13("span", { className: "fd-side-item-icon", children: /* @__PURE__ */ jsx13("i", { className: "ph ph-" + it.icon, "aria-hidden": "true" }) }),
869
- /* @__PURE__ */ jsx13("span", { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: it.label }),
906
+ /* @__PURE__ */ jsx13("span", { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, title: truncationTitle(it.label), children: it.label }),
870
907
  it.preview ? /* @__PURE__ */ jsx13(Tip, { label: "Designed, backend not wired yet", children: /* @__PURE__ */ jsx13("i", { className: "ph ph-traffic-cone", style: { fontSize: 13, color: "var(--warn-solid)", flex: "none" } }) }) : null,
871
908
  it.locked ? /* @__PURE__ */ jsx13(Tip, { label: "You do not have permission for this", children: /* @__PURE__ */ jsx13("i", { className: "ph ph-lock-simple", style: { fontSize: 13, color: "var(--text-muted)", flex: "none" } }) }) : null,
872
909
  it.count !== void 0 ? /* @__PURE__ */ jsx13("span", { className: "fd-side-item-count", children: it.count }) : null,
@@ -969,7 +1006,6 @@ function Topbar({
969
1006
  }
970
1007
  )
971
1008
  ] }, i)) }),
972
- /* @__PURE__ */ jsx16("span", { style: { flex: 1 } }),
973
1009
  overflowActions != null ? narrow ? /* @__PURE__ */ jsxs13(Fragment3, { children: [
974
1010
  /* @__PURE__ */ jsx16(
975
1011
  "button",
@@ -1162,7 +1198,6 @@ function Toast({ title, children, tone = "success", onUndo, onDismiss, className
1162
1198
  // src/components/feedback/Tooltip.tsx
1163
1199
  import * as React7 from "react";
1164
1200
  import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
1165
- var TOOLTIP_BASE = 150;
1166
1201
  var CLOSE_DELAY_MS = 120;
1167
1202
  function Tooltip({ label, placement = "top", children, className = "" }) {
1168
1203
  const anchorRef = React7.useRef(null);
@@ -1206,7 +1241,7 @@ function Tooltip({ label, placement = "top", children, className = "" }) {
1206
1241
  layerRef: bubbleRef,
1207
1242
  onDetach: hide
1208
1243
  });
1209
- const zIndex = useOverlayLayer(TOOLTIP_BASE);
1244
+ const zIndex = useOverlayLayer(open);
1210
1245
  React7.useEffect(() => {
1211
1246
  if (!open) return;
1212
1247
  const key = (e) => {
@@ -1449,11 +1484,10 @@ function DataTable({
1449
1484
  // src/components/data/FilterBar.tsx
1450
1485
  import * as React9 from "react";
1451
1486
  import { jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
1452
- var FILTER_BAR_BASE = 120;
1453
1487
  var isSet = (v) => !(v == null || v === "" || v === false);
1454
1488
  function FilterBar({ fields = [], filters, onFilterChange, onFilterRemove, align = "left", className = "", ...rest }) {
1455
1489
  const [panel, setPanel] = React9.useState(null);
1456
- const zIndex = useOverlayLayer(FILTER_BAR_BASE);
1490
+ const zIndex = useOverlayLayer(!!panel);
1457
1491
  const rootRef = React9.useRef(null);
1458
1492
  const textInputRef = React9.useRef(null);
1459
1493
  const optionsRef = React9.useRef(null);
@@ -2649,10 +2683,9 @@ function ScoreMeter({
2649
2683
  // src/components/data/SortMenu.tsx
2650
2684
  import * as React15 from "react";
2651
2685
  import { jsx as jsx36, jsxs as jsxs33 } from "react/jsx-runtime";
2652
- var SORT_MENU_BASE = 120;
2653
2686
  function SortMenu({ fields = [], sort, onSort, align = "right", size = "md", className = "", ...rest }) {
2654
2687
  const [open, setOpen] = React15.useState(false);
2655
- const zIndex = useOverlayLayer(SORT_MENU_BASE);
2688
+ const zIndex = useOverlayLayer(open);
2656
2689
  const ref = React15.useRef(null);
2657
2690
  React15.useEffect(() => {
2658
2691
  if (!open) return;
@@ -2746,7 +2779,7 @@ function StepList({
2746
2779
  return /* @__PURE__ */ jsxs34("div", { className: ["fd-steps", dense ? "is-dense" : "", open ? "is-open" : "", className].filter(Boolean).join(" "), children: [
2747
2780
  /* @__PURE__ */ jsxs34("button", { type: "button", className: "fd-steps-head", onClick: toggle, "aria-expanded": open, children: [
2748
2781
  running ? /* @__PURE__ */ jsx37("span", { className: "fd-steps-spin", "aria-hidden": "true" }) : /* @__PURE__ */ jsx37("i", { className: "ph ph-" + (failed ? "warning-circle" : "check-circle"), "aria-hidden": "true" }),
2749
- /* @__PURE__ */ jsx37("span", { className: "fd-steps-title", children: summary }),
2782
+ /* @__PURE__ */ jsx37("span", { className: "fd-steps-title", title: truncationTitle(summary), children: summary }),
2750
2783
  /* @__PURE__ */ jsxs34("span", { className: "fd-steps-count fd-tabular", children: [
2751
2784
  steps.length,
2752
2785
  " step",
@@ -2774,11 +2807,11 @@ function StepList({
2774
2807
  "aria-expanded": isOpen,
2775
2808
  onClick: () => setExpanded((m) => Object.assign({}, m, { [id]: !isOpen })),
2776
2809
  children: [
2777
- /* @__PURE__ */ jsx37("span", { children: s.label }),
2810
+ /* @__PURE__ */ jsx37("span", { title: truncationTitle(s.label), children: s.label }),
2778
2811
  /* @__PURE__ */ jsx37("i", { className: "ph ph-caret-" + (isOpen ? "up" : "down"), "aria-hidden": "true" })
2779
2812
  ]
2780
2813
  }
2781
- ) : /* @__PURE__ */ jsx37("span", { className: "fd-step-label is-static", children: s.label }),
2814
+ ) : /* @__PURE__ */ jsx37("span", { className: "fd-step-label is-static", title: truncationTitle(s.label), children: s.label }),
2782
2815
  s.status === "error" ? /* @__PURE__ */ jsx37("span", { className: "fd-step-badge is-error", children: "failed" }) : null,
2783
2816
  showDurations && s.durationMs ? /* @__PURE__ */ jsx37("span", { className: "fd-step-dur fd-tabular", children: formatDuration(s.durationMs) }) : null
2784
2817
  ] }),
@@ -3004,7 +3037,7 @@ function EntityRow({
3004
3037
  // `title` is the exposure mechanism, same rule as every other identifier.
3005
3038
  /* @__PURE__ */ jsx39("span", { className: "fd-erow-title fd-body-sm", title: truncationTitle(title), children: title })
3006
3039
  ),
3007
- meta ? /* @__PURE__ */ jsx39("span", { className: "fd-erow-meta", children: meta }) : null
3040
+ meta ? /* @__PURE__ */ jsx39("span", { className: "fd-erow-meta", title: truncationTitle(meta), children: meta }) : null
3008
3041
  ] }),
3009
3042
  hasStrip ? /* @__PURE__ */ jsxs36("span", { className: "fd-erow-strip", children: [
3010
3043
  metrics && metrics.length ? /* @__PURE__ */ jsx39(EntityRowMetrics, { metrics }) : null,
@@ -3340,7 +3373,7 @@ function TransferList({
3340
3373
  height: drag.height,
3341
3374
  transform: `translate(${drag.x - drag.offsetX}px, ${drag.y - drag.offsetY}px) rotate(-3deg)`,
3342
3375
  pointerEvents: "none",
3343
- zIndex: 1e3
3376
+ zIndex: OVERLAY_CEILING
3344
3377
  },
3345
3378
  children: /* @__PURE__ */ jsx43(EntityRow, { ...renderRow(drag.item), draggable: true, className: "fd-erow-dragging" })
3346
3379
  }
@@ -3685,7 +3718,7 @@ function Select({
3685
3718
  style: { all: "unset", flex: 1, minWidth: 0, display: "flex", alignItems: "center", gap: 8, cursor: "inherit", overflow: "hidden" },
3686
3719
  children: [
3687
3720
  selected && selected.icon ? /* @__PURE__ */ jsx49("i", { className: "ph ph-" + selected.icon, style: { flex: "none", color: "var(--text-2)" } }) : null,
3688
- /* @__PURE__ */ jsx49("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", color: (multiple ? chosen.length : selected) ? "var(--text)" : "var(--text-muted)" }, children: boxText }),
3721
+ /* @__PURE__ */ jsx49("span", { title: truncationTitle(boxText), style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", color: (multiple ? chosen.length : selected) ? "var(--text)" : "var(--text-muted)" }, children: boxText }),
3689
3722
  multiple && chosen.length > 1 ? /* @__PURE__ */ jsx49("span", { className: "fd-mono", style: { flex: "none", fontSize: 11, fontWeight: 700, padding: "1px 6px", borderRadius: 99, background: "var(--brand)", color: "#fff" }, children: chosen.length }) : null
3690
3723
  ]
3691
3724
  }
@@ -3957,6 +3990,7 @@ function DatePicker({ label, help, error, required = false, disabled = false, ra
3957
3990
  type: "button",
3958
3991
  id: fieldId,
3959
3992
  "aria-labelledby": ariaLabelledBy,
3993
+ title: truncationTitle(display),
3960
3994
  disabled,
3961
3995
  onKeyDown: (e) => {
3962
3996
  if (e.key === "Enter" || e.key === " ") {
@@ -6781,7 +6815,7 @@ function AccountMenu({
6781
6815
  /* @__PURE__ */ jsx57(Avatar, { name: user.name }),
6782
6816
  /* @__PURE__ */ jsxs53("span", { className: "fd-stack", style: { gap: 1, minWidth: 0, flex: 1 }, children: [
6783
6817
  /* @__PURE__ */ jsx57("span", { className: "fd-body-sm", style: { fontWeight: 700 }, children: user.name }),
6784
- /* @__PURE__ */ jsx57("span", { className: "fd-body-sm fd-muted fd-table-trunc", children: user.email })
6818
+ /* @__PURE__ */ jsx57("span", { className: "fd-body-sm fd-muted fd-table-trunc", title: truncationTitle(user.email), children: user.email })
6785
6819
  ] })
6786
6820
  ] }),
6787
6821
  showRoles && session.roles.length ? /* @__PURE__ */ jsx57("div", { className: "fd-row", style: { gap: 6, padding: "10px 14px", flexWrap: "wrap", borderBottom: "1px solid var(--border)" }, children: session.roles.map((r) => /* @__PURE__ */ jsx57(Badge, { tone: r.id === "owner" ? "success" : "neutral", children: r.name }, r.id)) }) : null,
@@ -7596,7 +7630,6 @@ function RoadmapTimeline({ onOpenFlag, title = "Roadmap", lede }) {
7596
7630
  import * as React36 from "react";
7597
7631
  import { createPortal as createPortal5 } from "react-dom";
7598
7632
  import { Fragment as Fragment16, jsx as jsx61, jsxs as jsxs57 } from "react/jsx-runtime";
7599
- var SOON_HOVERCARD_BASE = 220;
7600
7633
  var BYPASS_STORE = "fd.soon.bypass.v1";
7601
7634
  function readBypassed() {
7602
7635
  try {
@@ -7791,7 +7824,7 @@ function ComingSoon({
7791
7824
  function InlineSoon({ label, detail, backend, eta, effort, onRoadmap, allowed, onBypass, blur, tip, className, rest, children }) {
7792
7825
  const [open, setOpen] = React36.useState(false);
7793
7826
  const [anchor, pos] = useHoverCard(open);
7794
- const zIndex = useOverlayLayer(SOON_HOVERCARD_BASE);
7827
+ const zIndex = useOverlayLayer(open);
7795
7828
  const close = React36.useRef(null);
7796
7829
  const show = () => {
7797
7830
  if (close.current) {
@@ -7980,11 +8013,10 @@ function PermissionHint({ perm, children }) {
7980
8013
  // src/components/platform/ModeSwitch.tsx
7981
8014
  import * as React37 from "react";
7982
8015
  import { Fragment as Fragment17, jsx as jsx63, jsxs as jsxs59 } from "react/jsx-runtime";
7983
- var MODE_SWITCH_BASE = 140;
7984
8016
  function ModeSwitch({ canToggle = false, requestCount = 0, onClearLog, renderLog, onOpenSpec, summary }) {
7985
8017
  const mode2 = useRuntimeMode();
7986
8018
  const [open, setOpen] = React37.useState(false);
7987
- const zIndex = useOverlayLayer(MODE_SWITCH_BASE);
8019
+ const zIndex = useOverlayLayer(open);
7988
8020
  const ref = React37.useRef(null);
7989
8021
  React37.useEffect(() => {
7990
8022
  if (!open) return;
@@ -9091,7 +9123,7 @@ function PacketCard({ packet, schema, render, onApply, applied }) {
9091
9123
  return /* @__PURE__ */ jsxs68("section", { className: "fdc-packet" + (invalid ? " is-invalid" : ""), "aria-label": title, children: [
9092
9124
  /* @__PURE__ */ jsxs68("header", { className: "fdc-packet-head", children: [
9093
9125
  /* @__PURE__ */ jsx72("i", { className: "ph ph-" + (s.icon || "package"), "aria-hidden": "true" }),
9094
- /* @__PURE__ */ jsx72("span", { className: "fdc-packet-title", children: title }),
9126
+ /* @__PURE__ */ jsx72("span", { className: "fdc-packet-title", title: truncationTitle(title), children: title }),
9095
9127
  packet.repaired ? /* @__PURE__ */ jsx72("span", { className: "fdc-packet-badge", children: "Repaired" }) : null,
9096
9128
  invalid ? /* @__PURE__ */ jsx72("span", { className: "fdc-packet-badge is-danger", children: "Invalid" }) : null
9097
9129
  ] }),
@@ -9596,7 +9628,7 @@ function ChatComposer({
9596
9628
  return /* @__PURE__ */ jsxs70("div", { className: "fdc-composer" + (disabled ? " is-disabled" : "") + (narrow ? " is-narrow" : ""), children: [
9597
9629
  queue.length ? /* @__PURE__ */ jsx74("div", { className: "fdc-queue", "aria-label": "Queued messages", children: queue.map((q) => /* @__PURE__ */ jsxs70("div", { className: "fdc-queue-row", children: [
9598
9630
  /* @__PURE__ */ jsx74("i", { className: "ph ph-clock-countdown", "aria-hidden": "true" }),
9599
- /* @__PURE__ */ jsx74("span", { className: "fdc-queue-text", children: q.text || (q.attachments ? q.attachments.length + " file(s)" : "") }),
9631
+ /* @__PURE__ */ jsx74("span", { className: "fdc-queue-text", title: truncationTitle(q.text || (q.attachments ? q.attachments.length + " file(s)" : "")), children: q.text || (q.attachments ? q.attachments.length + " file(s)" : "") }),
9600
9632
  onRemoveQueued ? /* @__PURE__ */ jsx74("button", { type: "button", className: "fdc-queue-x", onClick: () => onRemoveQueued(q.id), "aria-label": "Remove queued message", children: /* @__PURE__ */ jsx74("i", { className: "ph ph-x", "aria-hidden": "true" }) }) : null
9601
9633
  ] }, q.id)) }) : null,
9602
9634
  sessionBar,
@@ -9724,7 +9756,7 @@ function ChatSessionBar({ sessionStats, contextUsage, usageLimits, onClear, extr
9724
9756
  "aria-label": expandable ? "Usage details" : void 0,
9725
9757
  children: [
9726
9758
  cu ? /* @__PURE__ */ jsx75("span", { className: "fdc-bar-mini", "aria-hidden": "true", children: /* @__PURE__ */ jsx75(SegmentedMeter, { total, segments: cu.segments, height: 4, showTotal: false }) }) : null,
9727
- /* @__PURE__ */ jsx75("span", { className: "fdc-bar-text", children: bits.join(" \xB7 ") }),
9759
+ /* @__PURE__ */ jsx75("span", { className: "fdc-bar-text", title: truncationTitle(bits.join(" \xB7 ")), children: bits.join(" \xB7 ") }),
9728
9760
  expandable ? /* @__PURE__ */ jsx75("i", { className: "ph ph-caret-right fdc-bar-caret", "aria-hidden": "true" }) : null
9729
9761
  ]
9730
9762
  }
@@ -10118,8 +10150,8 @@ function AgentChatPanel({
10118
10150
  showHeader ? /* @__PURE__ */ jsxs72("header", { className: "fdc-head", children: [
10119
10151
  /* @__PURE__ */ jsx76("span", { className: "fdc-head-mark", "aria-hidden": "true", children: /* @__PURE__ */ jsx76("i", { className: "ph ph-" + assistantIcon }) }),
10120
10152
  /* @__PURE__ */ jsxs72("span", { className: "fdc-head-titles", children: [
10121
- /* @__PURE__ */ jsx76("span", { className: "fdc-head-title", children: title }),
10122
- subtitle ? /* @__PURE__ */ jsx76("span", { className: "fdc-head-sub", children: subtitle }) : null
10153
+ /* @__PURE__ */ jsx76("span", { className: "fdc-head-title", title: truncationTitle(title), children: title }),
10154
+ subtitle ? /* @__PURE__ */ jsx76("span", { className: "fdc-head-sub", title: truncationTitle(subtitle), children: subtitle }) : null
10123
10155
  ] }),
10124
10156
  /* @__PURE__ */ jsxs72("span", { className: "fdc-head-acts", children: [
10125
10157
  headerActions,