@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.cjs CHANGED
@@ -5669,27 +5669,26 @@ var import_jsx_runtime57 = require("react/jsx-runtime");
5669
5669
  function useInlinePanel() {
5670
5670
  const [open2, setOpen] = React35.useState(false);
5671
5671
  const ref = React35.useRef(null);
5672
- const layer = useStackedLayer({ active: open2, containerRef: ref, onEscape: () => setOpen(false) });
5673
- const zIndex = useLayerZIndex(layer);
5674
- React35.useEffect(() => {
5675
- if (!open2) return;
5676
- const away = (e) => {
5677
- if (ref.current && !ref.current.contains(e.target)) setOpen(false);
5678
- };
5679
- document.addEventListener("pointerdown", away);
5680
- return () => document.removeEventListener("pointerdown", away);
5681
- }, [open2]);
5682
- return { open: open2, setOpen, ref, zIndex, layer };
5672
+ return { open: open2, setOpen, ref };
5683
5673
  }
5684
- function InlinePanelLayers({ panel, children }) {
5685
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(StackedLayerProvider, { layer: panel.layer, children });
5674
+ function InlinePanelSurface({ panel, align = "right", ...popover }) {
5675
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
5676
+ Popover,
5677
+ {
5678
+ open: panel.open,
5679
+ anchorRef: panel.ref,
5680
+ onClose: () => panel.setOpen(false),
5681
+ placement: align === "left" ? "bottom-start" : "bottom-end",
5682
+ ...popover
5683
+ }
5684
+ );
5686
5685
  }
5687
5686
 
5688
5687
  // src/components/data/SortMenu.tsx
5689
5688
  var import_jsx_runtime58 = require("react/jsx-runtime");
5690
5689
  function SortMenu({ fields = [], sort, onSort, align = "right", size = "md", className = "", ...rest }) {
5691
5690
  const panel = useInlinePanel();
5692
- const { open: open2, setOpen, ref, zIndex } = panel;
5691
+ const { open: open2, setOpen, ref } = panel;
5693
5692
  const cur = fields.find((f) => f.key === (sort && sort.key));
5694
5693
  const dir = sort && sort.dir;
5695
5694
  const arrow = (f, d) => {
@@ -5717,12 +5716,12 @@ function SortMenu({ fields = [], sort, onSort, align = "right", size = "md", cla
5717
5716
  }
5718
5717
  );
5719
5718
  };
5720
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { className, style: { position: "relative", display: "inline-flex" }, ref, ...rest, children: [
5719
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { className, style: { display: "inline-flex" }, ref, ...rest, children: [
5721
5720
  /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Button, { size, variant: "secondary", icon: dir === "asc" ? "sort-ascending" : "sort-descending", onClick: () => setOpen(!open2), children: [
5722
5721
  cur ? cur.label : "Unsorted",
5723
5722
  /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("i", { className: "ph ph-" + (dir === "asc" ? "arrow-up" : "arrow-down"), style: { fontSize: 12, marginLeft: 6, opacity: 0.75 } })
5724
5723
  ] }),
5725
- open2 ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(InlinePanelLayers, { panel, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("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__ */ (0, import_jsx_runtime58.jsxs)("span", { className: "fd-stack", style: { gap: 2 }, children: [
5724
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(InlinePanelSurface, { panel, align, offset: 6, width: 280, label: "Sort by", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { className: "fd-stack", style: { gap: 2, padding: 8 }, children: [
5726
5725
  /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "fd-overline fd-muted", style: { padding: "4px 8px 6px" }, children: "Sort by" }),
5727
5726
  fields.map((f) => {
5728
5727
  const active = cur && cur.key === f.key;
@@ -5732,7 +5731,7 @@ function SortMenu({ fields = [], sort, onSort, align = "right", size = "md", cla
5732
5731
  arrow(f, "desc")
5733
5732
  ] }, f.key);
5734
5733
  })
5735
- ] }) }) }) : null
5734
+ ] }) })
5736
5735
  ] });
5737
5736
  }
5738
5737
 
@@ -11292,7 +11291,7 @@ var import_jsx_runtime85 = require("react/jsx-runtime");
11292
11291
  function ModeSwitch({ canToggle = false, requestCount = 0, onClearLog, renderLog, onOpenSpec, summary }) {
11293
11292
  const mode2 = useRuntimeMode();
11294
11293
  const panel = useInlinePanel();
11295
- const { open: open2, setOpen, ref, zIndex } = panel;
11294
+ const { open: open2, setOpen, ref } = panel;
11296
11295
  if (!canToggle) return null;
11297
11296
  const test = mode2 === "test";
11298
11297
  const s = summary || RuntimeKit.summary();
@@ -11300,7 +11299,7 @@ function ModeSwitch({ canToggle = false, requestCount = 0, onClearLog, renderLog
11300
11299
  RuntimeKit.setMode(next);
11301
11300
  setOpen(false);
11302
11301
  };
11303
- return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("span", { style: { position: "relative", display: "inline-flex" }, ref, children: [
11302
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("span", { style: { display: "inline-flex" }, ref, children: [
11304
11303
  /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
11305
11304
  "button",
11306
11305
  {
@@ -11316,7 +11315,7 @@ function ModeSwitch({ canToggle = false, requestCount = 0, onClearLog, renderLog
11316
11315
  ]
11317
11316
  }
11318
11317
  ),
11319
- open2 ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(InlinePanelLayers, { panel, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("span", { className: "fd-view-enter fd-mode-pop", style: { zIndex }, children: [
11318
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(InlinePanelSurface, { panel, align: "right", offset: 8, width: 400, className: "fd-mode-pop", label: test ? "Test mode" : "Live mode", children: [
11320
11319
  /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("span", { className: "fd-row", style: { gap: 10, padding: "12px 14px", borderBottom: "1px solid var(--border)" }, children: [
11321
11320
  /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("span", { className: "fd-badge " + (test ? "fd-badge-warning" : "fd-badge-neutral"), children: [
11322
11321
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("i", { className: "ph " + (test ? "ph-flask" : "ph-lightning"), "aria-hidden": "true" }),
@@ -11374,7 +11373,7 @@ function ModeSwitch({ canToggle = false, requestCount = 0, onClearLog, renderLog
11374
11373
  ] })
11375
11374
  ] }),
11376
11375
  test && renderLog ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { style: { display: "block", maxHeight: 340, overflowY: "auto", borderTop: "1px solid var(--border)" }, children: renderLog() }) : null
11377
- ] }) }) : null
11376
+ ] })
11378
11377
  ] });
11379
11378
  }
11380
11379
  function TestModeBar({ onExit }) {
@@ -13767,7 +13766,7 @@ function FolderPickerMenu({
13767
13766
  onPick
13768
13767
  }) {
13769
13768
  const panel = useInlinePanel();
13770
- const { open: open2, setOpen, ref, zIndex } = panel;
13769
+ const { open: open2, setOpen, ref } = panel;
13771
13770
  return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("span", { className: "fd-fb-menu-anchor", ref, children: [
13772
13771
  /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
13773
13772
  IconButton,
@@ -13781,7 +13780,7 @@ function FolderPickerMenu({
13781
13780
  onClick: () => setOpen((v) => !v)
13782
13781
  }
13783
13782
  ),
13784
- open2 ? /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(InlinePanelLayers, { panel, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "fd-fb-menu", role: "menu", "aria-label": label, style: { zIndex }, children: [
13783
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(InlinePanelSurface, { panel, align: "right", offset: 4, width: 220, maxHeight: 280, role: "menu", label, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "fd-fb-menu", children: [
13785
13784
  /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("span", { className: "fd-overline fd-muted fd-fb-menu-title", children: "Move to\u2026" }),
13786
13785
  destinations.map((d) => /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
13787
13786
  "button",
@@ -13801,7 +13800,7 @@ function FolderPickerMenu({
13801
13800
  },
13802
13801
  d.id ?? "__root__"
13803
13802
  ))
13804
- ] }) }) : null
13803
+ ] }) })
13805
13804
  ] });
13806
13805
  }
13807
13806
  function RowShell({ icon, name, meta, onOpen, draggableId, isDropTarget, onDropPayload, actions, className = "" }) {