@flytedan/flytebot-design-system 0.55.2 → 0.55.3

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
@@ -5411,27 +5411,26 @@ import { jsx as jsx56 } from "react/jsx-runtime";
5411
5411
  function useInlinePanel() {
5412
5412
  const [open2, setOpen] = React35.useState(false);
5413
5413
  const ref = React35.useRef(null);
5414
- const layer = useStackedLayer({ active: open2, containerRef: ref, onEscape: () => setOpen(false) });
5415
- const zIndex = useLayerZIndex(layer);
5416
- React35.useEffect(() => {
5417
- if (!open2) return;
5418
- const away = (e) => {
5419
- if (ref.current && !ref.current.contains(e.target)) setOpen(false);
5420
- };
5421
- document.addEventListener("pointerdown", away);
5422
- return () => document.removeEventListener("pointerdown", away);
5423
- }, [open2]);
5424
- return { open: open2, setOpen, ref, zIndex, layer };
5414
+ return { open: open2, setOpen, ref };
5425
5415
  }
5426
- function InlinePanelLayers({ panel, children }) {
5427
- return /* @__PURE__ */ jsx56(StackedLayerProvider, { layer: panel.layer, children });
5416
+ function InlinePanelSurface({ panel, align = "right", ...popover }) {
5417
+ return /* @__PURE__ */ jsx56(
5418
+ Popover,
5419
+ {
5420
+ open: panel.open,
5421
+ anchorRef: panel.ref,
5422
+ onClose: () => panel.setOpen(false),
5423
+ placement: align === "left" ? "bottom-start" : "bottom-end",
5424
+ ...popover
5425
+ }
5426
+ );
5428
5427
  }
5429
5428
 
5430
5429
  // src/components/data/SortMenu.tsx
5431
5430
  import { jsx as jsx57, jsxs as jsxs49 } from "react/jsx-runtime";
5432
5431
  function SortMenu({ fields = [], sort, onSort, align = "right", size = "md", className = "", ...rest }) {
5433
5432
  const panel = useInlinePanel();
5434
- const { open: open2, setOpen, ref, zIndex } = panel;
5433
+ const { open: open2, setOpen, ref } = panel;
5435
5434
  const cur = fields.find((f) => f.key === (sort && sort.key));
5436
5435
  const dir = sort && sort.dir;
5437
5436
  const arrow = (f, d) => {
@@ -5459,12 +5458,12 @@ function SortMenu({ fields = [], sort, onSort, align = "right", size = "md", cla
5459
5458
  }
5460
5459
  );
5461
5460
  };
5462
- return /* @__PURE__ */ jsxs49("span", { className, style: { position: "relative", display: "inline-flex" }, ref, ...rest, children: [
5461
+ return /* @__PURE__ */ jsxs49("span", { className, style: { display: "inline-flex" }, ref, ...rest, children: [
5463
5462
  /* @__PURE__ */ jsxs49(Button, { size, variant: "secondary", icon: dir === "asc" ? "sort-ascending" : "sort-descending", onClick: () => setOpen(!open2), children: [
5464
5463
  cur ? cur.label : "Unsorted",
5465
5464
  /* @__PURE__ */ jsx57("i", { className: "ph ph-" + (dir === "asc" ? "arrow-up" : "arrow-down"), style: { fontSize: 12, marginLeft: 6, opacity: 0.75 } })
5466
5465
  ] }),
5467
- open2 ? /* @__PURE__ */ jsx57(InlinePanelLayers, { panel, children: /* @__PURE__ */ jsx57("span", { className: "fd-view-enter", style: { position: "absolute", top: "calc(100% + 6px)", [align]: 0, zIndex, width: 280, maxWidth: "calc(100vw - 32px)", display: "block", background: "var(--surface)", border: "1px solid var(--border)", borderRadius: 10, boxShadow: "0 16px 44px rgba(11,13,17,.18)", padding: 8 }, children: /* @__PURE__ */ jsxs49("span", { className: "fd-stack", style: { gap: 2 }, children: [
5466
+ /* @__PURE__ */ jsx57(InlinePanelSurface, { panel, align, offset: 6, width: 280, label: "Sort by", children: /* @__PURE__ */ jsxs49("span", { className: "fd-stack", style: { gap: 2, padding: 8 }, children: [
5468
5467
  /* @__PURE__ */ jsx57("span", { className: "fd-overline fd-muted", style: { padding: "4px 8px 6px" }, children: "Sort by" }),
5469
5468
  fields.map((f) => {
5470
5469
  const active = cur && cur.key === f.key;
@@ -5474,7 +5473,7 @@ function SortMenu({ fields = [], sort, onSort, align = "right", size = "md", cla
5474
5473
  arrow(f, "desc")
5475
5474
  ] }, f.key);
5476
5475
  })
5477
- ] }) }) }) : null
5476
+ ] }) })
5478
5477
  ] });
5479
5478
  }
5480
5479
 
@@ -11034,7 +11033,7 @@ import { Fragment as Fragment22, jsx as jsx84, jsxs as jsxs75 } from "react/jsx-
11034
11033
  function ModeSwitch({ canToggle = false, requestCount = 0, onClearLog, renderLog, onOpenSpec, summary }) {
11035
11034
  const mode2 = useRuntimeMode();
11036
11035
  const panel = useInlinePanel();
11037
- const { open: open2, setOpen, ref, zIndex } = panel;
11036
+ const { open: open2, setOpen, ref } = panel;
11038
11037
  if (!canToggle) return null;
11039
11038
  const test = mode2 === "test";
11040
11039
  const s = summary || RuntimeKit.summary();
@@ -11042,7 +11041,7 @@ function ModeSwitch({ canToggle = false, requestCount = 0, onClearLog, renderLog
11042
11041
  RuntimeKit.setMode(next);
11043
11042
  setOpen(false);
11044
11043
  };
11045
- return /* @__PURE__ */ jsxs75("span", { style: { position: "relative", display: "inline-flex" }, ref, children: [
11044
+ return /* @__PURE__ */ jsxs75("span", { style: { display: "inline-flex" }, ref, children: [
11046
11045
  /* @__PURE__ */ jsxs75(
11047
11046
  "button",
11048
11047
  {
@@ -11058,7 +11057,7 @@ function ModeSwitch({ canToggle = false, requestCount = 0, onClearLog, renderLog
11058
11057
  ]
11059
11058
  }
11060
11059
  ),
11061
- open2 ? /* @__PURE__ */ jsx84(InlinePanelLayers, { panel, children: /* @__PURE__ */ jsxs75("span", { className: "fd-view-enter fd-mode-pop", style: { zIndex }, children: [
11060
+ /* @__PURE__ */ jsxs75(InlinePanelSurface, { panel, align: "right", offset: 8, width: 400, className: "fd-mode-pop", label: test ? "Test mode" : "Live mode", children: [
11062
11061
  /* @__PURE__ */ jsxs75("span", { className: "fd-row", style: { gap: 10, padding: "12px 14px", borderBottom: "1px solid var(--border)" }, children: [
11063
11062
  /* @__PURE__ */ jsxs75("span", { className: "fd-badge " + (test ? "fd-badge-warning" : "fd-badge-neutral"), children: [
11064
11063
  /* @__PURE__ */ jsx84("i", { className: "ph " + (test ? "ph-flask" : "ph-lightning"), "aria-hidden": "true" }),
@@ -11116,7 +11115,7 @@ function ModeSwitch({ canToggle = false, requestCount = 0, onClearLog, renderLog
11116
11115
  ] })
11117
11116
  ] }),
11118
11117
  test && renderLog ? /* @__PURE__ */ jsx84("span", { style: { display: "block", maxHeight: 340, overflowY: "auto", borderTop: "1px solid var(--border)" }, children: renderLog() }) : null
11119
- ] }) }) : null
11118
+ ] })
11120
11119
  ] });
11121
11120
  }
11122
11121
  function TestModeBar({ onExit }) {
@@ -13509,7 +13508,7 @@ function FolderPickerMenu({
13509
13508
  onPick
13510
13509
  }) {
13511
13510
  const panel = useInlinePanel();
13512
- const { open: open2, setOpen, ref, zIndex } = panel;
13511
+ const { open: open2, setOpen, ref } = panel;
13513
13512
  return /* @__PURE__ */ jsxs90("span", { className: "fd-fb-menu-anchor", ref, children: [
13514
13513
  /* @__PURE__ */ jsx99(
13515
13514
  IconButton,
@@ -13523,7 +13522,7 @@ function FolderPickerMenu({
13523
13522
  onClick: () => setOpen((v) => !v)
13524
13523
  }
13525
13524
  ),
13526
- open2 ? /* @__PURE__ */ jsx99(InlinePanelLayers, { panel, children: /* @__PURE__ */ jsxs90("div", { className: "fd-fb-menu", role: "menu", "aria-label": label, style: { zIndex }, children: [
13525
+ /* @__PURE__ */ jsx99(InlinePanelSurface, { panel, align: "right", offset: 4, width: 220, maxHeight: 280, role: "menu", label, children: /* @__PURE__ */ jsxs90("div", { className: "fd-fb-menu", children: [
13527
13526
  /* @__PURE__ */ jsx99("span", { className: "fd-overline fd-muted fd-fb-menu-title", children: "Move to\u2026" }),
13528
13527
  destinations.map((d) => /* @__PURE__ */ jsxs90(
13529
13528
  "button",
@@ -13543,7 +13542,7 @@ function FolderPickerMenu({
13543
13542
  },
13544
13543
  d.id ?? "__root__"
13545
13544
  ))
13546
- ] }) }) : null
13545
+ ] }) })
13547
13546
  ] });
13548
13547
  }
13549
13548
  function RowShell({ icon, name, meta, onOpen, draggableId, isDropTarget, onDropPayload, actions, className = "" }) {