@flytedan/flytebot-design-system 0.12.13 → 0.12.14

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,
@@ -1162,7 +1199,6 @@ function Toast({ title, children, tone = "success", onUndo, onDismiss, className
1162
1199
  // src/components/feedback/Tooltip.tsx
1163
1200
  import * as React7 from "react";
1164
1201
  import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
1165
- var TOOLTIP_BASE = 150;
1166
1202
  var CLOSE_DELAY_MS = 120;
1167
1203
  function Tooltip({ label, placement = "top", children, className = "" }) {
1168
1204
  const anchorRef = React7.useRef(null);
@@ -1206,7 +1242,7 @@ function Tooltip({ label, placement = "top", children, className = "" }) {
1206
1242
  layerRef: bubbleRef,
1207
1243
  onDetach: hide
1208
1244
  });
1209
- const zIndex = useOverlayLayer(TOOLTIP_BASE);
1245
+ const zIndex = useOverlayLayer(open);
1210
1246
  React7.useEffect(() => {
1211
1247
  if (!open) return;
1212
1248
  const key = (e) => {
@@ -1449,11 +1485,10 @@ function DataTable({
1449
1485
  // src/components/data/FilterBar.tsx
1450
1486
  import * as React9 from "react";
1451
1487
  import { jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
1452
- var FILTER_BAR_BASE = 120;
1453
1488
  var isSet = (v) => !(v == null || v === "" || v === false);
1454
1489
  function FilterBar({ fields = [], filters, onFilterChange, onFilterRemove, align = "left", className = "", ...rest }) {
1455
1490
  const [panel, setPanel] = React9.useState(null);
1456
- const zIndex = useOverlayLayer(FILTER_BAR_BASE);
1491
+ const zIndex = useOverlayLayer(!!panel);
1457
1492
  const rootRef = React9.useRef(null);
1458
1493
  const textInputRef = React9.useRef(null);
1459
1494
  const optionsRef = React9.useRef(null);
@@ -2649,10 +2684,9 @@ function ScoreMeter({
2649
2684
  // src/components/data/SortMenu.tsx
2650
2685
  import * as React15 from "react";
2651
2686
  import { jsx as jsx36, jsxs as jsxs33 } from "react/jsx-runtime";
2652
- var SORT_MENU_BASE = 120;
2653
2687
  function SortMenu({ fields = [], sort, onSort, align = "right", size = "md", className = "", ...rest }) {
2654
2688
  const [open, setOpen] = React15.useState(false);
2655
- const zIndex = useOverlayLayer(SORT_MENU_BASE);
2689
+ const zIndex = useOverlayLayer(open);
2656
2690
  const ref = React15.useRef(null);
2657
2691
  React15.useEffect(() => {
2658
2692
  if (!open) return;
@@ -2746,7 +2780,7 @@ function StepList({
2746
2780
  return /* @__PURE__ */ jsxs34("div", { className: ["fd-steps", dense ? "is-dense" : "", open ? "is-open" : "", className].filter(Boolean).join(" "), children: [
2747
2781
  /* @__PURE__ */ jsxs34("button", { type: "button", className: "fd-steps-head", onClick: toggle, "aria-expanded": open, children: [
2748
2782
  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 }),
2783
+ /* @__PURE__ */ jsx37("span", { className: "fd-steps-title", title: truncationTitle(summary), children: summary }),
2750
2784
  /* @__PURE__ */ jsxs34("span", { className: "fd-steps-count fd-tabular", children: [
2751
2785
  steps.length,
2752
2786
  " step",
@@ -2774,11 +2808,11 @@ function StepList({
2774
2808
  "aria-expanded": isOpen,
2775
2809
  onClick: () => setExpanded((m) => Object.assign({}, m, { [id]: !isOpen })),
2776
2810
  children: [
2777
- /* @__PURE__ */ jsx37("span", { children: s.label }),
2811
+ /* @__PURE__ */ jsx37("span", { title: truncationTitle(s.label), children: s.label }),
2778
2812
  /* @__PURE__ */ jsx37("i", { className: "ph ph-caret-" + (isOpen ? "up" : "down"), "aria-hidden": "true" })
2779
2813
  ]
2780
2814
  }
2781
- ) : /* @__PURE__ */ jsx37("span", { className: "fd-step-label is-static", children: s.label }),
2815
+ ) : /* @__PURE__ */ jsx37("span", { className: "fd-step-label is-static", title: truncationTitle(s.label), children: s.label }),
2782
2816
  s.status === "error" ? /* @__PURE__ */ jsx37("span", { className: "fd-step-badge is-error", children: "failed" }) : null,
2783
2817
  showDurations && s.durationMs ? /* @__PURE__ */ jsx37("span", { className: "fd-step-dur fd-tabular", children: formatDuration(s.durationMs) }) : null
2784
2818
  ] }),
@@ -3004,7 +3038,7 @@ function EntityRow({
3004
3038
  // `title` is the exposure mechanism, same rule as every other identifier.
3005
3039
  /* @__PURE__ */ jsx39("span", { className: "fd-erow-title fd-body-sm", title: truncationTitle(title), children: title })
3006
3040
  ),
3007
- meta ? /* @__PURE__ */ jsx39("span", { className: "fd-erow-meta", children: meta }) : null
3041
+ meta ? /* @__PURE__ */ jsx39("span", { className: "fd-erow-meta", title: truncationTitle(meta), children: meta }) : null
3008
3042
  ] }),
3009
3043
  hasStrip ? /* @__PURE__ */ jsxs36("span", { className: "fd-erow-strip", children: [
3010
3044
  metrics && metrics.length ? /* @__PURE__ */ jsx39(EntityRowMetrics, { metrics }) : null,
@@ -3340,7 +3374,7 @@ function TransferList({
3340
3374
  height: drag.height,
3341
3375
  transform: `translate(${drag.x - drag.offsetX}px, ${drag.y - drag.offsetY}px) rotate(-3deg)`,
3342
3376
  pointerEvents: "none",
3343
- zIndex: 1e3
3377
+ zIndex: OVERLAY_CEILING
3344
3378
  },
3345
3379
  children: /* @__PURE__ */ jsx43(EntityRow, { ...renderRow(drag.item), draggable: true, className: "fd-erow-dragging" })
3346
3380
  }
@@ -3685,7 +3719,7 @@ function Select({
3685
3719
  style: { all: "unset", flex: 1, minWidth: 0, display: "flex", alignItems: "center", gap: 8, cursor: "inherit", overflow: "hidden" },
3686
3720
  children: [
3687
3721
  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 }),
3722
+ /* @__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
3723
  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
3724
  ]
3691
3725
  }
@@ -3957,6 +3991,7 @@ function DatePicker({ label, help, error, required = false, disabled = false, ra
3957
3991
  type: "button",
3958
3992
  id: fieldId,
3959
3993
  "aria-labelledby": ariaLabelledBy,
3994
+ title: truncationTitle(display),
3960
3995
  disabled,
3961
3996
  onKeyDown: (e) => {
3962
3997
  if (e.key === "Enter" || e.key === " ") {
@@ -6781,7 +6816,7 @@ function AccountMenu({
6781
6816
  /* @__PURE__ */ jsx57(Avatar, { name: user.name }),
6782
6817
  /* @__PURE__ */ jsxs53("span", { className: "fd-stack", style: { gap: 1, minWidth: 0, flex: 1 }, children: [
6783
6818
  /* @__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 })
6819
+ /* @__PURE__ */ jsx57("span", { className: "fd-body-sm fd-muted fd-table-trunc", title: truncationTitle(user.email), children: user.email })
6785
6820
  ] })
6786
6821
  ] }),
6787
6822
  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 +7631,6 @@ function RoadmapTimeline({ onOpenFlag, title = "Roadmap", lede }) {
7596
7631
  import * as React36 from "react";
7597
7632
  import { createPortal as createPortal5 } from "react-dom";
7598
7633
  import { Fragment as Fragment16, jsx as jsx61, jsxs as jsxs57 } from "react/jsx-runtime";
7599
- var SOON_HOVERCARD_BASE = 220;
7600
7634
  var BYPASS_STORE = "fd.soon.bypass.v1";
7601
7635
  function readBypassed() {
7602
7636
  try {
@@ -7791,7 +7825,7 @@ function ComingSoon({
7791
7825
  function InlineSoon({ label, detail, backend, eta, effort, onRoadmap, allowed, onBypass, blur, tip, className, rest, children }) {
7792
7826
  const [open, setOpen] = React36.useState(false);
7793
7827
  const [anchor, pos] = useHoverCard(open);
7794
- const zIndex = useOverlayLayer(SOON_HOVERCARD_BASE);
7828
+ const zIndex = useOverlayLayer(open);
7795
7829
  const close = React36.useRef(null);
7796
7830
  const show = () => {
7797
7831
  if (close.current) {
@@ -7980,11 +8014,10 @@ function PermissionHint({ perm, children }) {
7980
8014
  // src/components/platform/ModeSwitch.tsx
7981
8015
  import * as React37 from "react";
7982
8016
  import { Fragment as Fragment17, jsx as jsx63, jsxs as jsxs59 } from "react/jsx-runtime";
7983
- var MODE_SWITCH_BASE = 140;
7984
8017
  function ModeSwitch({ canToggle = false, requestCount = 0, onClearLog, renderLog, onOpenSpec, summary }) {
7985
8018
  const mode2 = useRuntimeMode();
7986
8019
  const [open, setOpen] = React37.useState(false);
7987
- const zIndex = useOverlayLayer(MODE_SWITCH_BASE);
8020
+ const zIndex = useOverlayLayer(open);
7988
8021
  const ref = React37.useRef(null);
7989
8022
  React37.useEffect(() => {
7990
8023
  if (!open) return;
@@ -9091,7 +9124,7 @@ function PacketCard({ packet, schema, render, onApply, applied }) {
9091
9124
  return /* @__PURE__ */ jsxs68("section", { className: "fdc-packet" + (invalid ? " is-invalid" : ""), "aria-label": title, children: [
9092
9125
  /* @__PURE__ */ jsxs68("header", { className: "fdc-packet-head", children: [
9093
9126
  /* @__PURE__ */ jsx72("i", { className: "ph ph-" + (s.icon || "package"), "aria-hidden": "true" }),
9094
- /* @__PURE__ */ jsx72("span", { className: "fdc-packet-title", children: title }),
9127
+ /* @__PURE__ */ jsx72("span", { className: "fdc-packet-title", title: truncationTitle(title), children: title }),
9095
9128
  packet.repaired ? /* @__PURE__ */ jsx72("span", { className: "fdc-packet-badge", children: "Repaired" }) : null,
9096
9129
  invalid ? /* @__PURE__ */ jsx72("span", { className: "fdc-packet-badge is-danger", children: "Invalid" }) : null
9097
9130
  ] }),
@@ -9596,7 +9629,7 @@ function ChatComposer({
9596
9629
  return /* @__PURE__ */ jsxs70("div", { className: "fdc-composer" + (disabled ? " is-disabled" : "") + (narrow ? " is-narrow" : ""), children: [
9597
9630
  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
9631
  /* @__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)" : "") }),
9632
+ /* @__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
9633
  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
9634
  ] }, q.id)) }) : null,
9602
9635
  sessionBar,
@@ -9724,7 +9757,7 @@ function ChatSessionBar({ sessionStats, contextUsage, usageLimits, onClear, extr
9724
9757
  "aria-label": expandable ? "Usage details" : void 0,
9725
9758
  children: [
9726
9759
  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 ") }),
9760
+ /* @__PURE__ */ jsx75("span", { className: "fdc-bar-text", title: truncationTitle(bits.join(" \xB7 ")), children: bits.join(" \xB7 ") }),
9728
9761
  expandable ? /* @__PURE__ */ jsx75("i", { className: "ph ph-caret-right fdc-bar-caret", "aria-hidden": "true" }) : null
9729
9762
  ]
9730
9763
  }
@@ -10118,8 +10151,8 @@ function AgentChatPanel({
10118
10151
  showHeader ? /* @__PURE__ */ jsxs72("header", { className: "fdc-head", children: [
10119
10152
  /* @__PURE__ */ jsx76("span", { className: "fdc-head-mark", "aria-hidden": "true", children: /* @__PURE__ */ jsx76("i", { className: "ph ph-" + assistantIcon }) }),
10120
10153
  /* @__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
10154
+ /* @__PURE__ */ jsx76("span", { className: "fdc-head-title", title: truncationTitle(title), children: title }),
10155
+ subtitle ? /* @__PURE__ */ jsx76("span", { className: "fdc-head-sub", title: truncationTitle(subtitle), children: subtitle }) : null
10123
10156
  ] }),
10124
10157
  /* @__PURE__ */ jsxs72("span", { className: "fdc-head-acts", children: [
10125
10158
  headerActions,