@flytedan/flytebot-design-system 0.55.3 → 0.57.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.cjs +146 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -10
- package/dist/index.d.ts +31 -10
- package/dist/index.js +166 -63
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4171,7 +4171,7 @@ function MultiSelectPanel({
|
|
|
4171
4171
|
nav.setActive(0);
|
|
4172
4172
|
}, [query, options.length]);
|
|
4173
4173
|
const activeId = hasListbox && options[nav.active] ? listId + "-opt-" + nav.active : void 0;
|
|
4174
|
-
const liveMessage = showLoading ? "Loading\u2026" : showError ? "Couldn't load options." : options.length === 0 ? "No matches" : atLimit ? "Limit reached: at most " + field.maxValues + " values" : "";
|
|
4174
|
+
const liveMessage = showLoading ? "Loading\u2026" : showError ? "Couldn't load options." : options.length === 0 ? query === "" && field.emptyText || "No matches" : atLimit ? "Limit reached: at most " + field.maxValues + " values" : "";
|
|
4175
4175
|
const [pasteText, setPasteText] = React29.useState("");
|
|
4176
4176
|
const [pasteLoading, setPasteLoading] = React29.useState(false);
|
|
4177
4177
|
const [unmatchedTokens, setUnmatchedTokens] = React29.useState([]);
|
|
@@ -5686,52 +5686,155 @@ function InlinePanelSurface({ panel, align = "right", ...popover }) {
|
|
|
5686
5686
|
|
|
5687
5687
|
// src/components/data/SortMenu.tsx
|
|
5688
5688
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
5689
|
-
|
|
5689
|
+
var directionWord = (field, dir) => dir === "asc" ? field.numeric ? "lowest first" : "A to Z" : field.numeric ? "highest first" : "Z to A";
|
|
5690
|
+
function moved(sort, from, to) {
|
|
5691
|
+
const next = [...sort];
|
|
5692
|
+
const [entry] = next.splice(from, 1);
|
|
5693
|
+
next.splice(to, 0, entry);
|
|
5694
|
+
return next;
|
|
5695
|
+
}
|
|
5696
|
+
function SortMenu({
|
|
5697
|
+
fields = [],
|
|
5698
|
+
sort = [],
|
|
5699
|
+
onSortChange,
|
|
5700
|
+
multiple = false,
|
|
5701
|
+
align = "right",
|
|
5702
|
+
size = "md",
|
|
5703
|
+
className = "",
|
|
5704
|
+
...rest
|
|
5705
|
+
}) {
|
|
5690
5706
|
const panel = useInlinePanel();
|
|
5691
5707
|
const { open: open2, setOpen, ref } = panel;
|
|
5692
|
-
const
|
|
5693
|
-
const
|
|
5694
|
-
const
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5708
|
+
const change = (next) => onSortChange && onSortChange(next);
|
|
5709
|
+
const fieldOf = (key) => fields.find((f) => f.key === key);
|
|
5710
|
+
const active = sort.filter((entry) => fieldOf(entry.key));
|
|
5711
|
+
const first = active[0];
|
|
5712
|
+
const firstField = first && fieldOf(first.key);
|
|
5713
|
+
const triggerLabel = firstField ? firstField.label + (active.length > 1 ? " +" + (active.length - 1) : "") : "Unsorted";
|
|
5714
|
+
const triggerTitle = active.map((entry) => {
|
|
5715
|
+
const field = fieldOf(entry.key);
|
|
5716
|
+
return field.label + " " + directionWord(field, entry.dir);
|
|
5717
|
+
}).join(", then ");
|
|
5718
|
+
const arrow = (field, dir, on, onClick) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
5719
|
+
"button",
|
|
5720
|
+
{
|
|
5721
|
+
type: "button",
|
|
5722
|
+
"aria-label": field.label + ", " + directionWord(field, dir),
|
|
5723
|
+
"aria-pressed": on,
|
|
5724
|
+
onClick,
|
|
5725
|
+
style: {
|
|
5726
|
+
display: "grid",
|
|
5727
|
+
placeItems: "center",
|
|
5728
|
+
width: 26,
|
|
5729
|
+
height: 26,
|
|
5730
|
+
borderRadius: 6,
|
|
5731
|
+
cursor: "pointer",
|
|
5732
|
+
flex: "none",
|
|
5733
|
+
border: "1px solid " + (on ? "var(--brand)" : "var(--border)"),
|
|
5734
|
+
background: on ? "var(--brand)" : "var(--surface)",
|
|
5735
|
+
color: on ? "#fff" : "var(--text-muted)"
|
|
5736
|
+
},
|
|
5737
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("i", { className: "ph ph-arrow-" + (dir === "asc" ? "up" : "down"), style: { fontSize: 13 } })
|
|
5738
|
+
}
|
|
5739
|
+
);
|
|
5740
|
+
const rowStyle = (highlight) => ({
|
|
5741
|
+
gap: 8,
|
|
5742
|
+
padding: "4px 8px",
|
|
5743
|
+
borderRadius: 7,
|
|
5744
|
+
background: highlight ? "var(--surface-brand)" : "transparent"
|
|
5745
|
+
});
|
|
5746
|
+
const labelStyle = (highlight) => ({
|
|
5747
|
+
flex: 1,
|
|
5748
|
+
minWidth: 0,
|
|
5749
|
+
fontWeight: highlight ? 700 : 500,
|
|
5750
|
+
color: highlight ? "var(--text-on-surface-brand)" : "var(--text)"
|
|
5751
|
+
});
|
|
5752
|
+
const singleBody = fields.map((f) => {
|
|
5753
|
+
const on = !!first && first.key === f.key;
|
|
5754
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { className: "fd-row", style: rowStyle(on), children: [
|
|
5755
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "fd-body-sm", style: labelStyle(on), children: f.label }),
|
|
5756
|
+
arrow(f, "asc", on && first.dir === "asc", () => change([{ key: f.key, dir: "asc" }])),
|
|
5757
|
+
arrow(f, "desc", on && first.dir === "desc", () => change([{ key: f.key, dir: "desc" }]))
|
|
5758
|
+
] }, f.key);
|
|
5759
|
+
});
|
|
5760
|
+
const unused = fields.filter((f) => !active.some((entry) => entry.key === f.key));
|
|
5761
|
+
const multipleBody = /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
|
|
5762
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "fd-overline fd-muted", style: { padding: "4px 8px 6px" }, children: "Sorted by" }),
|
|
5763
|
+
active.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "fd-body-sm fd-muted", style: { padding: "4px 8px" }, children: "Unsorted" }) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("ol", { className: "fd-stack", style: { gap: 2, margin: 0, padding: 0, listStyle: "none" }, "aria-label": "Sort order", children: active.map((entry, index) => {
|
|
5764
|
+
const f = fieldOf(entry.key);
|
|
5765
|
+
const flipped = entry.dir === "asc" ? "desc" : "asc";
|
|
5766
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("li", { className: "fd-row", style: rowStyle(false), children: [
|
|
5767
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "fd-body-sm fd-muted", "aria-hidden": "true", style: { width: 14, flex: "none" }, children: index + 1 }),
|
|
5768
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "fd-body-sm", style: labelStyle(false), children: f.label }),
|
|
5769
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
5770
|
+
IconButton,
|
|
5771
|
+
{
|
|
5772
|
+
size: "sm",
|
|
5773
|
+
variant: "outline",
|
|
5774
|
+
icon: entry.dir === "asc" ? "arrow-up" : "arrow-down",
|
|
5775
|
+
label: f.label + ", " + directionWord(f, entry.dir) + ". Switch to " + directionWord(f, flipped),
|
|
5776
|
+
onClick: () => change(active.map((e) => e.key === entry.key ? { key: e.key, dir: flipped } : e))
|
|
5777
|
+
}
|
|
5778
|
+
),
|
|
5779
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
5780
|
+
IconButton,
|
|
5781
|
+
{
|
|
5782
|
+
size: "sm",
|
|
5783
|
+
icon: "caret-up",
|
|
5784
|
+
label: "Sort " + f.label + " earlier",
|
|
5785
|
+
disabled: index === 0,
|
|
5786
|
+
onClick: () => change(moved(active, index, index - 1))
|
|
5787
|
+
}
|
|
5788
|
+
),
|
|
5789
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
5790
|
+
IconButton,
|
|
5791
|
+
{
|
|
5792
|
+
size: "sm",
|
|
5793
|
+
icon: "caret-down",
|
|
5794
|
+
label: "Sort " + f.label + " later",
|
|
5795
|
+
disabled: index === active.length - 1,
|
|
5796
|
+
onClick: () => change(moved(active, index, index + 1))
|
|
5797
|
+
}
|
|
5798
|
+
),
|
|
5799
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
5800
|
+
IconButton,
|
|
5801
|
+
{
|
|
5802
|
+
size: "sm",
|
|
5803
|
+
icon: "x",
|
|
5804
|
+
label: "Remove " + f.label + " from the sort",
|
|
5805
|
+
onClick: () => change(active.filter((e) => e.key !== entry.key))
|
|
5806
|
+
}
|
|
5807
|
+
)
|
|
5808
|
+
] }, entry.key);
|
|
5809
|
+
}) }),
|
|
5810
|
+
unused.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
|
|
5811
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "fd-overline fd-muted", style: { padding: "10px 8px 6px" }, children: "Add a sort" }),
|
|
5812
|
+
unused.map((f) => /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { className: "fd-row", style: rowStyle(false), children: [
|
|
5813
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "fd-body-sm", style: labelStyle(false), children: f.label }),
|
|
5814
|
+
arrow(f, "asc", false, () => change([...active, { key: f.key, dir: "asc" }])),
|
|
5815
|
+
arrow(f, "desc", false, () => change([...active, { key: f.key, dir: "desc" }]))
|
|
5816
|
+
] }, f.key))
|
|
5817
|
+
] }) : null
|
|
5818
|
+
] });
|
|
5819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { className, style: { display: "inline-flex", minWidth: 0 }, ref, ...rest, children: [
|
|
5820
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
5821
|
+
Button,
|
|
5699
5822
|
{
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
"
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
borderRadius: 6,
|
|
5710
|
-
cursor: "pointer",
|
|
5711
|
-
border: "1px solid " + (on ? "var(--brand)" : "var(--border)"),
|
|
5712
|
-
background: on ? "var(--brand)" : "var(--surface)",
|
|
5713
|
-
color: on ? "#fff" : "var(--text-muted)"
|
|
5714
|
-
},
|
|
5715
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("i", { className: "ph ph-arrow-" + (d === "asc" ? "up" : "down"), style: { fontSize: 13 } })
|
|
5823
|
+
size,
|
|
5824
|
+
variant: "secondary",
|
|
5825
|
+
icon: first && first.dir === "asc" ? "sort-ascending" : "sort-descending",
|
|
5826
|
+
title: triggerTitle || void 0,
|
|
5827
|
+
onClick: () => setOpen(!open2),
|
|
5828
|
+
children: [
|
|
5829
|
+
triggerLabel,
|
|
5830
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("i", { className: "ph ph-" + (first && first.dir === "asc" ? "arrow-up" : "arrow-down"), style: { fontSize: 12, marginLeft: 6, opacity: 0.75 } })
|
|
5831
|
+
]
|
|
5716
5832
|
}
|
|
5717
|
-
)
|
|
5718
|
-
|
|
5719
|
-
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { className, style: { display: "inline-flex" }, ref, ...rest, children: [
|
|
5720
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Button, { size, variant: "secondary", icon: dir === "asc" ? "sort-ascending" : "sort-descending", onClick: () => setOpen(!open2), children: [
|
|
5721
|
-
cur ? cur.label : "Unsorted",
|
|
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 } })
|
|
5723
|
-
] }),
|
|
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: [
|
|
5833
|
+
),
|
|
5834
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(InlinePanelSurface, { panel, align, offset: 6, width: multiple ? 340 : 280, label: "Sort by", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "fd-stack", style: { gap: 2, padding: 8 }, children: multiple ? multipleBody : /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
|
|
5725
5835
|
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "fd-overline fd-muted", style: { padding: "4px 8px 6px" }, children: "Sort by" }),
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { className: "fd-row", style: { gap: 8, padding: "4px 8px", borderRadius: 7, background: active ? "var(--surface-brand)" : "transparent" }, children: [
|
|
5729
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "fd-body-sm", style: { flex: 1, fontWeight: active ? 700 : 500, color: active ? "var(--text-on-surface-brand)" : "var(--text)" }, children: f.label }),
|
|
5730
|
-
arrow(f, "asc"),
|
|
5731
|
-
arrow(f, "desc")
|
|
5732
|
-
] }, f.key);
|
|
5733
|
-
})
|
|
5734
|
-
] }) })
|
|
5836
|
+
singleBody
|
|
5837
|
+
] }) }) })
|
|
5735
5838
|
] });
|
|
5736
5839
|
}
|
|
5737
5840
|
|
|
@@ -6269,7 +6372,7 @@ function TransferList({
|
|
|
6269
6372
|
cfg.header ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "fd-tlist-header", children: cfg.header }) : null,
|
|
6270
6373
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("span", { className: "fd-row", style: { gap: 8 }, children: [
|
|
6271
6374
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(SearchField, { value: cfg.search, onChange: cfg.onSearchChange, placeholder: "Search", "aria-label": (cfg.label || side) + " search", style: { flex: 1 } }),
|
|
6272
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(SortMenu, { fields: cfg.sortFields, sort: cfg.sort,
|
|
6375
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(SortMenu, { fields: cfg.sortFields, sort: cfg.sort ? [cfg.sort] : [], onSortChange: (next) => next[0] && cfg.onSort(next[0].key, next[0].dir), align: side === "left" ? "left" : "right" })
|
|
6273
6376
|
] }),
|
|
6274
6377
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
6275
6378
|
VirtualList,
|