@ai-matrx/associations 0.11.4 → 0.13.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/CHANGELOG.md +60 -0
- package/dist/{CommentThread-DDeqHgTk.d.cts → CommentThread-DP4sEzb2.d.cts} +25 -8
- package/dist/{CommentThread-DDeqHgTk.d.ts → CommentThread-DP4sEzb2.d.ts} +25 -8
- package/dist/core/index.cjs +9 -4
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +20 -7
- package/dist/core/index.d.ts +20 -7
- package/dist/core/index.js +9 -4
- package/dist/core/index.js.map +1 -1
- package/dist/react/index.cjs +740 -545
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +48 -6
- package/dist/react/index.d.ts +48 -6
- package/dist/react/index.js +723 -528
- package/dist/react/index.js.map +1 -1
- package/dist/react/lazy/index.d.cts +1 -1
- package/dist/react/lazy/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/react/index.cjs
CHANGED
|
@@ -42,11 +42,13 @@ __export(react_exports, {
|
|
|
42
42
|
DoorControlsSlot: () => DoorControlsSlot,
|
|
43
43
|
DoorRef: () => DoorRef,
|
|
44
44
|
PrimaryEntityProvider: () => PrimaryEntityProvider,
|
|
45
|
+
SearchFailureNotice: () => SearchFailureNotice,
|
|
45
46
|
UniversalAssociationPicker: () => UniversalAssociationPicker,
|
|
46
47
|
UnresolvedRef: () => UnresolvedRef,
|
|
47
48
|
attachedKey: () => attachedKey,
|
|
48
49
|
buildCommentTree: () => buildCommentTree,
|
|
49
50
|
containerLinksArgs: () => containerLinksArgs,
|
|
51
|
+
describeSearchFailures: () => describeSearchFailures,
|
|
50
52
|
getContentRoleMeta: () => getContentRoleMeta,
|
|
51
53
|
lazyPickerOverride: () => lazyPickerOverride,
|
|
52
54
|
lazyWindowShell: () => lazyWindowShell,
|
|
@@ -1682,7 +1684,6 @@ function useUniversalEntitySearch(args) {
|
|
|
1682
1684
|
const {
|
|
1683
1685
|
query,
|
|
1684
1686
|
tokens,
|
|
1685
|
-
ownerId,
|
|
1686
1687
|
enabled = true,
|
|
1687
1688
|
perTokenLimit = 5,
|
|
1688
1689
|
emptyQueryMode = "recents"
|
|
@@ -1690,7 +1691,14 @@ function useUniversalEntitySearch(args) {
|
|
|
1690
1691
|
const store = useAssociationsStore();
|
|
1691
1692
|
const [results, setResults] = (0, import_react6.useState)([]);
|
|
1692
1693
|
const [loading, setLoading] = (0, import_react6.useState)(false);
|
|
1693
|
-
const [
|
|
1694
|
+
const [failures, setFailures] = (0, import_react6.useState)([]);
|
|
1695
|
+
const [error, setError] = (0, import_react6.useState)(null);
|
|
1696
|
+
const [status, setStatus] = (0, import_react6.useState)(
|
|
1697
|
+
enabled ? "loading" : "ready"
|
|
1698
|
+
);
|
|
1699
|
+
const [source, setSource] = (0, import_react6.useState)(
|
|
1700
|
+
emptyQueryMode === "candidates" ? "candidates" : "recents"
|
|
1701
|
+
);
|
|
1694
1702
|
const runRef = (0, import_react6.useRef)(0);
|
|
1695
1703
|
const tokensKey = (tokens ?? []).join(",");
|
|
1696
1704
|
(0, import_react6.useEffect)(() => {
|
|
@@ -1700,30 +1708,72 @@ function useUniversalEntitySearch(args) {
|
|
|
1700
1708
|
const timer = setTimeout(async () => {
|
|
1701
1709
|
if (runRef.current !== run) return;
|
|
1702
1710
|
setLoading(true);
|
|
1711
|
+
setStatus("loading");
|
|
1703
1712
|
const activeTokens = tokensKey ? tokensKey.split(",") : store.registry.listableTokens();
|
|
1713
|
+
const browse = () => store.candidates.searchCandidatesAcrossTokens({
|
|
1714
|
+
tokens: activeTokens,
|
|
1715
|
+
search: trimmed,
|
|
1716
|
+
perTokenLimit
|
|
1717
|
+
});
|
|
1718
|
+
const allFailed = (r) => activeTokens.length > 0 && r.failures.length >= activeTokens.length;
|
|
1704
1719
|
let next = [];
|
|
1720
|
+
let nextSource;
|
|
1721
|
+
const nextFailures = [];
|
|
1722
|
+
let nextError = null;
|
|
1705
1723
|
if (trimmed || emptyQueryMode === "candidates") {
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
});
|
|
1724
|
+
const r = await browse();
|
|
1725
|
+
next = r.results;
|
|
1726
|
+
nextFailures.push(...r.failures);
|
|
1727
|
+
nextSource = trimmed ? "search" : "candidates";
|
|
1728
|
+
if (allFailed(r)) nextError = totalFailureMessage(store, r);
|
|
1712
1729
|
} else {
|
|
1713
|
-
|
|
1730
|
+
const recents = await loadRecents(store, activeTokens);
|
|
1731
|
+
nextSource = "recents";
|
|
1732
|
+
if (recents.ok) {
|
|
1733
|
+
next = recents.data;
|
|
1734
|
+
} else {
|
|
1735
|
+
nextFailures.push({ token: null, error: recents.error });
|
|
1736
|
+
}
|
|
1737
|
+
if (next.length === 0 && runRef.current === run) {
|
|
1738
|
+
const r = await browse();
|
|
1739
|
+
next = r.results;
|
|
1740
|
+
nextFailures.push(...r.failures);
|
|
1741
|
+
nextSource = "candidates";
|
|
1742
|
+
if (allFailed(r)) {
|
|
1743
|
+
nextError = recents.ok ? totalFailureMessage(store, r) : `Couldn't load recent items (${recents.error}) or browse: ${totalFailureMessage(store, r)}`;
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1714
1746
|
}
|
|
1715
1747
|
if (runRef.current !== run) return;
|
|
1716
1748
|
setResults(next);
|
|
1717
|
-
|
|
1749
|
+
setSource(nextSource);
|
|
1750
|
+
setFailures(nextFailures);
|
|
1751
|
+
setError(nextError);
|
|
1752
|
+
setStatus(nextError ? "error" : "ready");
|
|
1718
1753
|
setLoading(false);
|
|
1719
1754
|
}, DEBOUNCE_MS);
|
|
1720
1755
|
return () => clearTimeout(timer);
|
|
1721
|
-
}, [query, tokensKey,
|
|
1722
|
-
return {
|
|
1756
|
+
}, [query, tokensKey, enabled, perTokenLimit, emptyQueryMode, store]);
|
|
1757
|
+
return {
|
|
1758
|
+
results,
|
|
1759
|
+
loading,
|
|
1760
|
+
isRecents: source === "recents",
|
|
1761
|
+
source,
|
|
1762
|
+
failures,
|
|
1763
|
+
error,
|
|
1764
|
+
status
|
|
1765
|
+
};
|
|
1766
|
+
}
|
|
1767
|
+
function totalFailureMessage(store, r) {
|
|
1768
|
+
const labels = r.failures.map(
|
|
1769
|
+
(f) => store.registry.getEntityInfo(f.token).labelPlural
|
|
1770
|
+
);
|
|
1771
|
+
const first = r.failures[0]?.error;
|
|
1772
|
+
return `Couldn't search ${labels.join(", ")}${first ? `: ${first}` : ""}`;
|
|
1723
1773
|
}
|
|
1724
1774
|
async function loadRecents(store, tokens) {
|
|
1725
1775
|
const res = await store.favorites.list();
|
|
1726
|
-
if (!res.ok) return
|
|
1776
|
+
if (!res.ok) return { ok: false, error: res.error.message };
|
|
1727
1777
|
const tokenSet = new Set(tokens);
|
|
1728
1778
|
const rows = res.data.items.filter(
|
|
1729
1779
|
(i) => tokenSet.has(i.entityType) && isEntityTypeToken(i.entityType) && (i.isFavorite || i.lastViewedAt)
|
|
@@ -1731,7 +1781,7 @@ async function loadRecents(store, tokens) {
|
|
|
1731
1781
|
if (a.isFavorite !== b.isFavorite) return a.isFavorite ? -1 : 1;
|
|
1732
1782
|
return (b.lastViewedAt ?? "").localeCompare(a.lastViewedAt ?? "");
|
|
1733
1783
|
}).slice(0, RECENTS_LIMIT);
|
|
1734
|
-
if (rows.length === 0) return [];
|
|
1784
|
+
if (rows.length === 0) return { ok: true, data: [] };
|
|
1735
1785
|
const byToken = /* @__PURE__ */ new Map();
|
|
1736
1786
|
for (const r of rows) {
|
|
1737
1787
|
const list = byToken.get(r.entityType) ?? [];
|
|
@@ -1754,7 +1804,72 @@ async function loadRecents(store, tokens) {
|
|
|
1754
1804
|
title
|
|
1755
1805
|
});
|
|
1756
1806
|
}
|
|
1757
|
-
return out;
|
|
1807
|
+
return { ok: true, data: out };
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1810
|
+
// src/react/components/SearchFailureNotice.tsx
|
|
1811
|
+
var import_design_system = require("@ai-matrx/design-system");
|
|
1812
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
1813
|
+
function describeSearchFailures(failures, labelFor) {
|
|
1814
|
+
const recentsFailed = failures.some((f) => f.token === null);
|
|
1815
|
+
const labels = [];
|
|
1816
|
+
for (const f of failures) {
|
|
1817
|
+
if (f.token === null) continue;
|
|
1818
|
+
const label = labelFor(f.token);
|
|
1819
|
+
if (!labels.includes(label)) labels.push(label);
|
|
1820
|
+
}
|
|
1821
|
+
const parts = [];
|
|
1822
|
+
if (recentsFailed) parts.push("Couldn't load recent items");
|
|
1823
|
+
if (labels.length > 0) {
|
|
1824
|
+
parts.push(
|
|
1825
|
+
`${recentsFailed ? "couldn't" : "Couldn't"} search ${labels.join(", ")}`
|
|
1826
|
+
);
|
|
1827
|
+
}
|
|
1828
|
+
return parts.join("; ");
|
|
1829
|
+
}
|
|
1830
|
+
function SearchFailureNotice(props) {
|
|
1831
|
+
const {
|
|
1832
|
+
error,
|
|
1833
|
+
failures,
|
|
1834
|
+
operation = "Search",
|
|
1835
|
+
origin = "associations/SearchFailureNotice",
|
|
1836
|
+
className
|
|
1837
|
+
} = props;
|
|
1838
|
+
const store = useAssociationsStore();
|
|
1839
|
+
if (error) {
|
|
1840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1841
|
+
import_design_system.ErrorBox,
|
|
1842
|
+
{
|
|
1843
|
+
as: "div",
|
|
1844
|
+
className: (0, import_design_system.cn)(
|
|
1845
|
+
"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px] text-destructive",
|
|
1846
|
+
className
|
|
1847
|
+
),
|
|
1848
|
+
message: error,
|
|
1849
|
+
operation,
|
|
1850
|
+
origin,
|
|
1851
|
+
children: [
|
|
1852
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "font-medium", children: "Couldn\u2019t load items" }),
|
|
1853
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "opacity-80", children: error })
|
|
1854
|
+
]
|
|
1855
|
+
}
|
|
1856
|
+
);
|
|
1857
|
+
}
|
|
1858
|
+
if (failures.length === 0) return null;
|
|
1859
|
+
const summary = describeSearchFailures(
|
|
1860
|
+
failures,
|
|
1861
|
+
(token) => store.registry.getEntityInfo(token).labelPlural
|
|
1862
|
+
);
|
|
1863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1864
|
+
import_design_system.ErrorBox,
|
|
1865
|
+
{
|
|
1866
|
+
className: (0, import_design_system.cn)("px-1 text-[11px] text-destructive", className),
|
|
1867
|
+
message: summary,
|
|
1868
|
+
error: failures.map((f) => `${f.token ?? "recents"}: ${f.error}`).join("\n"),
|
|
1869
|
+
operation,
|
|
1870
|
+
origin
|
|
1871
|
+
}
|
|
1872
|
+
);
|
|
1758
1873
|
}
|
|
1759
1874
|
|
|
1760
1875
|
// src/react/hooks/useAssociationCandidates.ts
|
|
@@ -1762,7 +1877,6 @@ var import_react7 = require("react");
|
|
|
1762
1877
|
function useAssociationCandidates(args) {
|
|
1763
1878
|
const { token, enabled = true, search, limit } = args;
|
|
1764
1879
|
const store = useAssociationsStore();
|
|
1765
|
-
const userId = currentUserIdOrNull(store);
|
|
1766
1880
|
const [candidates, setCandidates] = (0, import_react7.useState)([]);
|
|
1767
1881
|
const [loading, setLoading] = (0, import_react7.useState)(false);
|
|
1768
1882
|
const [error, setError] = (0, import_react7.useState)(null);
|
|
@@ -1775,7 +1889,6 @@ function useAssociationCandidates(args) {
|
|
|
1775
1889
|
setError(null);
|
|
1776
1890
|
const res = await store.candidates.listAssociationCandidates({
|
|
1777
1891
|
token,
|
|
1778
|
-
ownerId: userId,
|
|
1779
1892
|
...search !== void 0 ? { search } : {},
|
|
1780
1893
|
...limit !== void 0 ? { limit } : {}
|
|
1781
1894
|
});
|
|
@@ -1791,7 +1904,7 @@ function useAssociationCandidates(args) {
|
|
|
1791
1904
|
return () => {
|
|
1792
1905
|
cancelled = true;
|
|
1793
1906
|
};
|
|
1794
|
-
}, [token, enabled,
|
|
1907
|
+
}, [token, enabled, search, limit, tick, store]);
|
|
1795
1908
|
return {
|
|
1796
1909
|
candidates,
|
|
1797
1910
|
loading,
|
|
@@ -1799,13 +1912,6 @@ function useAssociationCandidates(args) {
|
|
|
1799
1912
|
reload: () => setTick((t) => t + 1)
|
|
1800
1913
|
};
|
|
1801
1914
|
}
|
|
1802
|
-
function currentUserIdOrNull(store) {
|
|
1803
|
-
try {
|
|
1804
|
-
return store.identity.requireUserId();
|
|
1805
|
-
} catch {
|
|
1806
|
-
return null;
|
|
1807
|
-
}
|
|
1808
|
-
}
|
|
1809
1915
|
|
|
1810
1916
|
// src/react/hooks/useComments.ts
|
|
1811
1917
|
var import_react8 = require("react");
|
|
@@ -1949,13 +2055,13 @@ function useAssociationEntitySelectAdapter(args) {
|
|
|
1949
2055
|
|
|
1950
2056
|
// src/react/components/PrimaryEntityContext.tsx
|
|
1951
2057
|
var import_react10 = require("react");
|
|
1952
|
-
var
|
|
2058
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1953
2059
|
var PrimaryEntityCtx = (0, import_react10.createContext)(null);
|
|
1954
2060
|
function PrimaryEntityProvider({
|
|
1955
2061
|
value,
|
|
1956
2062
|
children
|
|
1957
2063
|
}) {
|
|
1958
|
-
return /* @__PURE__ */ (0,
|
|
2064
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PrimaryEntityCtx.Provider, { value, children });
|
|
1959
2065
|
}
|
|
1960
2066
|
function usePrimaryEntity() {
|
|
1961
2067
|
return (0, import_react10.useContext)(PrimaryEntityCtx);
|
|
@@ -1967,10 +2073,10 @@ var import_react12 = require("react");
|
|
|
1967
2073
|
// src/react/components/DefaultWindowShell.tsx
|
|
1968
2074
|
var import_react11 = require("react");
|
|
1969
2075
|
var import_react_dom = require("react-dom");
|
|
1970
|
-
var
|
|
2076
|
+
var import_design_system2 = require("@ai-matrx/design-system");
|
|
1971
2077
|
|
|
1972
2078
|
// src/react/icons.tsx
|
|
1973
|
-
var
|
|
2079
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1974
2080
|
function base(props) {
|
|
1975
2081
|
return {
|
|
1976
2082
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1987,129 +2093,129 @@ function base(props) {
|
|
|
1987
2093
|
};
|
|
1988
2094
|
}
|
|
1989
2095
|
function SpinnerIcon(props) {
|
|
1990
|
-
return /* @__PURE__ */ (0,
|
|
2096
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { ...base(props), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }) });
|
|
1991
2097
|
}
|
|
1992
2098
|
function PlusIcon(props) {
|
|
1993
|
-
return /* @__PURE__ */ (0,
|
|
1994
|
-
/* @__PURE__ */ (0,
|
|
1995
|
-
/* @__PURE__ */ (0,
|
|
2099
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
|
|
2100
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M5 12h14" }),
|
|
2101
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M12 5v14" })
|
|
1996
2102
|
] });
|
|
1997
2103
|
}
|
|
1998
2104
|
function XIcon(props) {
|
|
1999
|
-
return /* @__PURE__ */ (0,
|
|
2000
|
-
/* @__PURE__ */ (0,
|
|
2001
|
-
/* @__PURE__ */ (0,
|
|
2105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
|
|
2106
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M18 6 6 18" }),
|
|
2107
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "m6 6 12 12" })
|
|
2002
2108
|
] });
|
|
2003
2109
|
}
|
|
2004
2110
|
function CheckIcon(props) {
|
|
2005
|
-
return /* @__PURE__ */ (0,
|
|
2111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { ...base(props), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M20 6 9 17l-5-5" }) });
|
|
2006
2112
|
}
|
|
2007
2113
|
function SearchIcon(props) {
|
|
2008
|
-
return /* @__PURE__ */ (0,
|
|
2009
|
-
/* @__PURE__ */ (0,
|
|
2010
|
-
/* @__PURE__ */ (0,
|
|
2114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
|
|
2115
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { cx: "11", cy: "11", r: "8" }),
|
|
2116
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "m21 21-4.3-4.3" })
|
|
2011
2117
|
] });
|
|
2012
2118
|
}
|
|
2013
2119
|
function Link2Icon(props) {
|
|
2014
|
-
return /* @__PURE__ */ (0,
|
|
2015
|
-
/* @__PURE__ */ (0,
|
|
2016
|
-
/* @__PURE__ */ (0,
|
|
2017
|
-
/* @__PURE__ */ (0,
|
|
2120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
|
|
2121
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M9 17H7A5 5 0 0 1 7 7h2" }),
|
|
2122
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M15 7h2a5 5 0 1 1 0 10h-2" }),
|
|
2123
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "8", x2: "16", y1: "12", y2: "12" })
|
|
2018
2124
|
] });
|
|
2019
2125
|
}
|
|
2020
2126
|
function RefreshIcon(props) {
|
|
2021
|
-
return /* @__PURE__ */ (0,
|
|
2022
|
-
/* @__PURE__ */ (0,
|
|
2023
|
-
/* @__PURE__ */ (0,
|
|
2024
|
-
/* @__PURE__ */ (0,
|
|
2025
|
-
/* @__PURE__ */ (0,
|
|
2127
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
|
|
2128
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" }),
|
|
2129
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M21 3v5h-5" }),
|
|
2130
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" }),
|
|
2131
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M8 16H3v5" })
|
|
2026
2132
|
] });
|
|
2027
2133
|
}
|
|
2028
2134
|
function PinIcon(props) {
|
|
2029
|
-
return /* @__PURE__ */ (0,
|
|
2030
|
-
/* @__PURE__ */ (0,
|
|
2031
|
-
/* @__PURE__ */ (0,
|
|
2135
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
|
|
2136
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M12 17v5" }),
|
|
2137
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z" })
|
|
2032
2138
|
] });
|
|
2033
2139
|
}
|
|
2034
2140
|
function UploadIcon(props) {
|
|
2035
|
-
return /* @__PURE__ */ (0,
|
|
2036
|
-
/* @__PURE__ */ (0,
|
|
2037
|
-
/* @__PURE__ */ (0,
|
|
2038
|
-
/* @__PURE__ */ (0,
|
|
2141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
|
|
2142
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
2143
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("polyline", { points: "17 8 12 3 7 8" }),
|
|
2144
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "12", x2: "12", y1: "3", y2: "15" })
|
|
2039
2145
|
] });
|
|
2040
2146
|
}
|
|
2041
2147
|
function FolderOpenIcon(props) {
|
|
2042
|
-
return /* @__PURE__ */ (0,
|
|
2148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { ...base(props), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2" }) });
|
|
2043
2149
|
}
|
|
2044
2150
|
function ExternalLinkIcon(props) {
|
|
2045
|
-
return /* @__PURE__ */ (0,
|
|
2046
|
-
/* @__PURE__ */ (0,
|
|
2047
|
-
/* @__PURE__ */ (0,
|
|
2048
|
-
/* @__PURE__ */ (0,
|
|
2151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
|
|
2152
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M15 3h6v6" }),
|
|
2153
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M10 14 21 3" }),
|
|
2154
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })
|
|
2049
2155
|
] });
|
|
2050
2156
|
}
|
|
2051
2157
|
function ChevronDownIcon(props) {
|
|
2052
|
-
return /* @__PURE__ */ (0,
|
|
2158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { ...base(props), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "m6 9 6 6 6-6" }) });
|
|
2053
2159
|
}
|
|
2054
2160
|
function ChevronsUpDownIcon(props) {
|
|
2055
|
-
return /* @__PURE__ */ (0,
|
|
2056
|
-
/* @__PURE__ */ (0,
|
|
2057
|
-
/* @__PURE__ */ (0,
|
|
2161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
|
|
2162
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "m7 15 5 5 5-5" }),
|
|
2163
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "m7 9 5-5 5 5" })
|
|
2058
2164
|
] });
|
|
2059
2165
|
}
|
|
2060
2166
|
function CornerDownRightIcon(props) {
|
|
2061
|
-
return /* @__PURE__ */ (0,
|
|
2062
|
-
/* @__PURE__ */ (0,
|
|
2063
|
-
/* @__PURE__ */ (0,
|
|
2167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
|
|
2168
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("polyline", { points: "15 10 20 15 15 20" }),
|
|
2169
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M4 4v7a4 4 0 0 0 4 4h12" })
|
|
2064
2170
|
] });
|
|
2065
2171
|
}
|
|
2066
2172
|
function TagIcon(props) {
|
|
2067
|
-
return /* @__PURE__ */ (0,
|
|
2068
|
-
/* @__PURE__ */ (0,
|
|
2069
|
-
/* @__PURE__ */ (0,
|
|
2173
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
|
|
2174
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z" }),
|
|
2175
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { cx: "7.5", cy: "7.5", r: ".5", fill: "currentColor" })
|
|
2070
2176
|
] });
|
|
2071
2177
|
}
|
|
2072
2178
|
function DefaultEntityIcon(props) {
|
|
2073
|
-
return /* @__PURE__ */ (0,
|
|
2074
|
-
/* @__PURE__ */ (0,
|
|
2075
|
-
/* @__PURE__ */ (0,
|
|
2076
|
-
/* @__PURE__ */ (0,
|
|
2077
|
-
/* @__PURE__ */ (0,
|
|
2078
|
-
/* @__PURE__ */ (0,
|
|
2079
|
-
/* @__PURE__ */ (0,
|
|
2080
|
-
/* @__PURE__ */ (0,
|
|
2081
|
-
/* @__PURE__ */ (0,
|
|
2082
|
-
/* @__PURE__ */ (0,
|
|
2083
|
-
/* @__PURE__ */ (0,
|
|
2084
|
-
/* @__PURE__ */ (0,
|
|
2085
|
-
/* @__PURE__ */ (0,
|
|
2179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
|
|
2180
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z" }),
|
|
2181
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "m7 16.5-4.74-2.85" }),
|
|
2182
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "m7 16.5 5-3" }),
|
|
2183
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M7 16.5v5.17" }),
|
|
2184
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z" }),
|
|
2185
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "m17 16.5-5-3" }),
|
|
2186
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "m17 16.5 4.74-2.85" }),
|
|
2187
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M17 16.5v5.17" }),
|
|
2188
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z" }),
|
|
2189
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M12 8 7.26 5.15" }),
|
|
2190
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "m12 8 4.74-2.85" }),
|
|
2191
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M12 13.5V8" })
|
|
2086
2192
|
] });
|
|
2087
2193
|
}
|
|
2088
2194
|
function MaximizeIcon(props) {
|
|
2089
|
-
return /* @__PURE__ */ (0,
|
|
2090
|
-
/* @__PURE__ */ (0,
|
|
2091
|
-
/* @__PURE__ */ (0,
|
|
2092
|
-
/* @__PURE__ */ (0,
|
|
2093
|
-
/* @__PURE__ */ (0,
|
|
2195
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
|
|
2196
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M15 3h6v6" }),
|
|
2197
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M9 21H3v-6" }),
|
|
2198
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M21 3l-7 7" }),
|
|
2199
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M3 21l7-7" })
|
|
2094
2200
|
] });
|
|
2095
2201
|
}
|
|
2096
2202
|
function RestoreIcon(props) {
|
|
2097
|
-
return /* @__PURE__ */ (0,
|
|
2098
|
-
/* @__PURE__ */ (0,
|
|
2099
|
-
/* @__PURE__ */ (0,
|
|
2100
|
-
/* @__PURE__ */ (0,
|
|
2101
|
-
/* @__PURE__ */ (0,
|
|
2203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
|
|
2204
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M4 14h6v6" }),
|
|
2205
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M20 10h-6V4" }),
|
|
2206
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M14 10l7-7" }),
|
|
2207
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M3 21l7-7" })
|
|
2102
2208
|
] });
|
|
2103
2209
|
}
|
|
2104
2210
|
function GripResizeIcon(props) {
|
|
2105
|
-
return /* @__PURE__ */ (0,
|
|
2106
|
-
/* @__PURE__ */ (0,
|
|
2107
|
-
/* @__PURE__ */ (0,
|
|
2211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { ...base(props), children: [
|
|
2212
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M21 15 15 21" }),
|
|
2213
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M21 20 20 21" })
|
|
2108
2214
|
] });
|
|
2109
2215
|
}
|
|
2110
2216
|
|
|
2111
2217
|
// src/react/components/DefaultWindowShell.tsx
|
|
2112
|
-
var
|
|
2218
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
2113
2219
|
var DEFAULT_WIDTH = 440;
|
|
2114
2220
|
var DEFAULT_HEIGHT = 580;
|
|
2115
2221
|
var MIN_WIDTH = 330;
|
|
@@ -2232,7 +2338,7 @@ function DefaultWindowShell({
|
|
|
2232
2338
|
height: rect.height
|
|
2233
2339
|
};
|
|
2234
2340
|
return (0, import_react_dom.createPortal)(
|
|
2235
|
-
/* @__PURE__ */ (0,
|
|
2341
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2236
2342
|
"div",
|
|
2237
2343
|
{
|
|
2238
2344
|
ref: panelRef,
|
|
@@ -2240,7 +2346,7 @@ function DefaultWindowShell({
|
|
|
2240
2346
|
"aria-labelledby": labelId,
|
|
2241
2347
|
tabIndex: -1,
|
|
2242
2348
|
style,
|
|
2243
|
-
className: (0,
|
|
2349
|
+
className: (0, import_design_system2.cn)(
|
|
2244
2350
|
// Non-modal by design: no backdrop element exists, so the page
|
|
2245
2351
|
// behind keeps every click. `pointer-events-auto` re-asserts our
|
|
2246
2352
|
// own subtree in case a Radix surface left <body> inert.
|
|
@@ -2249,7 +2355,7 @@ function DefaultWindowShell({
|
|
|
2249
2355
|
className
|
|
2250
2356
|
),
|
|
2251
2357
|
children: [
|
|
2252
|
-
/* @__PURE__ */ (0,
|
|
2358
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2253
2359
|
"header",
|
|
2254
2360
|
{
|
|
2255
2361
|
onPointerDown: beginGesture("move"),
|
|
@@ -2259,24 +2365,24 @@ function DefaultWindowShell({
|
|
|
2259
2365
|
onDoubleClick: () => {
|
|
2260
2366
|
if (!isMobile) setMaximized((v) => !v);
|
|
2261
2367
|
},
|
|
2262
|
-
className: (0,
|
|
2368
|
+
className: (0, import_design_system2.cn)(
|
|
2263
2369
|
"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2 select-none",
|
|
2264
2370
|
isMobile ? "" : "cursor-move touch-none"
|
|
2265
2371
|
),
|
|
2266
2372
|
children: [
|
|
2267
|
-
/* @__PURE__ */ (0,
|
|
2373
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2268
2374
|
"span",
|
|
2269
2375
|
{
|
|
2270
2376
|
id: labelId,
|
|
2271
2377
|
className: "flex min-w-0 items-center gap-1.5 text-sm font-medium text-foreground",
|
|
2272
2378
|
children: [
|
|
2273
2379
|
icon,
|
|
2274
|
-
/* @__PURE__ */ (0,
|
|
2380
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "truncate", children: title })
|
|
2275
2381
|
]
|
|
2276
2382
|
}
|
|
2277
2383
|
),
|
|
2278
|
-
/* @__PURE__ */ (0,
|
|
2279
|
-
isMobile ? null : /* @__PURE__ */ (0,
|
|
2384
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "flex shrink-0 items-center gap-0.5", children: [
|
|
2385
|
+
isMobile ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2280
2386
|
"button",
|
|
2281
2387
|
{
|
|
2282
2388
|
type: "button",
|
|
@@ -2284,10 +2390,10 @@ function DefaultWindowShell({
|
|
|
2284
2390
|
onClick: () => setMaximized((v) => !v),
|
|
2285
2391
|
"aria-label": maximized ? "Restore window" : "Maximize window",
|
|
2286
2392
|
className: "flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
|
|
2287
|
-
children: maximized ? /* @__PURE__ */ (0,
|
|
2393
|
+
children: maximized ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RestoreIcon, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(MaximizeIcon, { className: "h-3.5 w-3.5" })
|
|
2288
2394
|
}
|
|
2289
2395
|
),
|
|
2290
|
-
/* @__PURE__ */ (0,
|
|
2396
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2291
2397
|
"button",
|
|
2292
2398
|
{
|
|
2293
2399
|
type: "button",
|
|
@@ -2295,15 +2401,15 @@ function DefaultWindowShell({
|
|
|
2295
2401
|
onClick: onClose,
|
|
2296
2402
|
"aria-label": "Close",
|
|
2297
2403
|
className: "flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
|
|
2298
|
-
children: /* @__PURE__ */ (0,
|
|
2404
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(XIcon, { className: "h-3.5 w-3.5" })
|
|
2299
2405
|
}
|
|
2300
2406
|
)
|
|
2301
2407
|
] })
|
|
2302
2408
|
]
|
|
2303
2409
|
}
|
|
2304
2410
|
),
|
|
2305
|
-
/* @__PURE__ */ (0,
|
|
2306
|
-
isMobile || maximized ? null : /* @__PURE__ */ (0,
|
|
2411
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "min-h-0 flex-1 overflow-hidden", children }),
|
|
2412
|
+
isMobile || maximized ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2307
2413
|
"button",
|
|
2308
2414
|
{
|
|
2309
2415
|
type: "button",
|
|
@@ -2313,7 +2419,7 @@ function DefaultWindowShell({
|
|
|
2313
2419
|
onPointerUp: endGesture,
|
|
2314
2420
|
onPointerCancel: endGesture,
|
|
2315
2421
|
className: "absolute bottom-0 right-0 flex h-4 w-4 cursor-nwse-resize touch-none items-center justify-center text-muted-foreground/60 hover:text-foreground",
|
|
2316
|
-
children: /* @__PURE__ */ (0,
|
|
2422
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(GripResizeIcon, { className: "h-3 w-3" })
|
|
2317
2423
|
}
|
|
2318
2424
|
)
|
|
2319
2425
|
]
|
|
@@ -2324,7 +2430,7 @@ function DefaultWindowShell({
|
|
|
2324
2430
|
}
|
|
2325
2431
|
|
|
2326
2432
|
// src/react/components/AssociationWindow.tsx
|
|
2327
|
-
var
|
|
2433
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
2328
2434
|
function AssociationWindow({
|
|
2329
2435
|
open,
|
|
2330
2436
|
onClose,
|
|
@@ -2337,16 +2443,16 @@ function AssociationWindow({
|
|
|
2337
2443
|
const instanceId = (0, import_react12.useId)();
|
|
2338
2444
|
const { windowShell } = useAssociationsUiPorts();
|
|
2339
2445
|
if (!open) return null;
|
|
2340
|
-
const body = /* @__PURE__ */ (0,
|
|
2341
|
-
subtitle ? /* @__PURE__ */ (0,
|
|
2446
|
+
const body = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex h-full min-h-0 flex-col gap-2 p-3", children: [
|
|
2447
|
+
subtitle ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "shrink-0 text-xs text-muted-foreground", children: subtitle }) : null,
|
|
2342
2448
|
children
|
|
2343
2449
|
] });
|
|
2344
2450
|
const windowId = `association:${scopeId}:${instanceId}`;
|
|
2345
2451
|
if (windowShell) {
|
|
2346
2452
|
const HostWindow = windowShell.Window;
|
|
2347
|
-
return /* @__PURE__ */ (0,
|
|
2453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(HostWindow, { id: windowId, title, onClose, children: body });
|
|
2348
2454
|
}
|
|
2349
|
-
return /* @__PURE__ */ (0,
|
|
2455
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2350
2456
|
DefaultWindowShell,
|
|
2351
2457
|
{
|
|
2352
2458
|
id: windowId,
|
|
@@ -2360,28 +2466,28 @@ function AssociationWindow({
|
|
|
2360
2466
|
|
|
2361
2467
|
// src/react/components/AssociationPicker.tsx
|
|
2362
2468
|
var import_react13 = require("react");
|
|
2363
|
-
var
|
|
2364
|
-
var
|
|
2469
|
+
var import_design_system3 = require("@ai-matrx/design-system");
|
|
2470
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
2365
2471
|
function AssociationPicker(props) {
|
|
2366
2472
|
const store = useAssociationsStore();
|
|
2367
2473
|
const { pickerOverrides } = useAssociationsUiPorts();
|
|
2368
2474
|
const info = store.registry.getEntityInfo(props.token);
|
|
2369
2475
|
const Icon = info.Icon ?? DefaultEntityIcon;
|
|
2370
2476
|
const Override = pickerOverrides?.[props.token];
|
|
2371
|
-
if (Override) return /* @__PURE__ */ (0,
|
|
2477
|
+
if (Override) return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Override, { ...props });
|
|
2372
2478
|
const title = `Add ${info.labelPlural}`;
|
|
2373
2479
|
const subtitle = props.filing ? `File ${props.containerLabel ?? "this"} under a ${info.label.toLowerCase()}` : props.containerLabel ? `Attach to ${props.containerLabel}` : "Click an item to attach or detach it";
|
|
2374
2480
|
if (!props.open) return null;
|
|
2375
|
-
return /* @__PURE__ */ (0,
|
|
2481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2376
2482
|
AssociationWindow,
|
|
2377
2483
|
{
|
|
2378
2484
|
open: props.open,
|
|
2379
2485
|
onClose: () => props.onOpenChange(false),
|
|
2380
2486
|
scopeId: `picker:${props.token}`,
|
|
2381
2487
|
title,
|
|
2382
|
-
icon: /* @__PURE__ */ (0,
|
|
2488
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { className: "size-3.5 text-primary" }),
|
|
2383
2489
|
subtitle,
|
|
2384
|
-
children: /* @__PURE__ */ (0,
|
|
2490
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2385
2491
|
AssociationCandidateBody,
|
|
2386
2492
|
{
|
|
2387
2493
|
token: props.token,
|
|
@@ -2406,7 +2512,7 @@ function AssociationCandidateBody({
|
|
|
2406
2512
|
onClose
|
|
2407
2513
|
}) {
|
|
2408
2514
|
void onClose;
|
|
2409
|
-
return /* @__PURE__ */ (0,
|
|
2515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2410
2516
|
EntityCandidateList,
|
|
2411
2517
|
{
|
|
2412
2518
|
token,
|
|
@@ -2437,7 +2543,11 @@ function EntityCandidateList({
|
|
|
2437
2543
|
enabled,
|
|
2438
2544
|
...search.trim() ? { search: search.trim() } : {}
|
|
2439
2545
|
});
|
|
2440
|
-
const {
|
|
2546
|
+
const {
|
|
2547
|
+
results: recentCandidates,
|
|
2548
|
+
loading: recentsLoading,
|
|
2549
|
+
failures: recentsFailures
|
|
2550
|
+
} = useUniversalEntitySearch({
|
|
2441
2551
|
query: "",
|
|
2442
2552
|
tokens: [token],
|
|
2443
2553
|
enabled: enabled && !search.trim()
|
|
@@ -2462,11 +2572,11 @@ function EntityCandidateList({
|
|
|
2462
2572
|
setBusyId(null);
|
|
2463
2573
|
}
|
|
2464
2574
|
};
|
|
2465
|
-
return /* @__PURE__ */ (0,
|
|
2466
|
-
/* @__PURE__ */ (0,
|
|
2467
|
-
/* @__PURE__ */ (0,
|
|
2468
|
-
/* @__PURE__ */ (0,
|
|
2469
|
-
|
|
2575
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
2576
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "relative mb-2", children: [
|
|
2577
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SearchIcon, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }),
|
|
2578
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2579
|
+
import_design_system3.Input,
|
|
2470
2580
|
{
|
|
2471
2581
|
value: search,
|
|
2472
2582
|
onChange: (e) => setSearch(e.target.value),
|
|
@@ -2476,46 +2586,58 @@ function EntityCandidateList({
|
|
|
2476
2586
|
}
|
|
2477
2587
|
)
|
|
2478
2588
|
] }),
|
|
2479
|
-
/* @__PURE__ */ (0,
|
|
2480
|
-
/* @__PURE__ */ (0,
|
|
2481
|
-
|
|
2482
|
-
] }) : error ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px] text-destructive", children: [
|
|
2483
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "font-medium", children: "Couldn\u2019t load items" }),
|
|
2484
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "opacity-80", children: error }),
|
|
2485
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2486
|
-
"button",
|
|
2487
|
-
{
|
|
2488
|
-
type: "button",
|
|
2489
|
-
onClick: reload,
|
|
2490
|
-
className: "mt-1 underline hover:no-underline",
|
|
2491
|
-
children: "Retry"
|
|
2492
|
-
}
|
|
2493
|
-
)
|
|
2494
|
-
] }) : visibleCount === 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ListMessage, { children: canCreate ? `Nothing to attach yet \u2014 create a new ${info.label.toLowerCase()} below.` : "Nothing to attach." }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "space-y-2", children: [
|
|
2495
|
-
visibleRecents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2496
|
-
CandidateSection,
|
|
2589
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex-1 min-h-0 overflow-y-auto -mx-1 px-1", children: [
|
|
2590
|
+
!search.trim() && !error && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2591
|
+
SearchFailureNotice,
|
|
2497
2592
|
{
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
onToggle: toggle
|
|
2593
|
+
error: null,
|
|
2594
|
+
failures: recentsFailures,
|
|
2595
|
+
operation: `Load recent ${info.labelPlural.toLowerCase()}`,
|
|
2596
|
+
origin: "associations/AssociationPicker",
|
|
2597
|
+
className: "mb-1"
|
|
2504
2598
|
}
|
|
2505
2599
|
),
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2600
|
+
(loading || recentsLoading) && visibleCount === 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(ListMessage, { children: [
|
|
2601
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SpinnerIcon, { className: "h-4 w-4 animate-spin" }),
|
|
2602
|
+
"Loading\u2026"
|
|
2603
|
+
] }) : error ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px] text-destructive", children: [
|
|
2604
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "font-medium", children: "Couldn\u2019t load items" }),
|
|
2605
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "opacity-80", children: error }),
|
|
2606
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2607
|
+
"button",
|
|
2608
|
+
{
|
|
2609
|
+
type: "button",
|
|
2610
|
+
onClick: reload,
|
|
2611
|
+
className: "mt-1 underline hover:no-underline",
|
|
2612
|
+
children: "Retry"
|
|
2613
|
+
}
|
|
2614
|
+
)
|
|
2615
|
+
] }) : visibleCount === 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ListMessage, { children: canCreate ? `Nothing to attach yet \u2014 create a new ${info.label.toLowerCase()} below.` : "Nothing to attach." }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-2", children: [
|
|
2616
|
+
visibleRecents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2617
|
+
CandidateSection,
|
|
2618
|
+
{
|
|
2619
|
+
label: "Recent",
|
|
2620
|
+
candidates: visibleRecents,
|
|
2621
|
+
attachedIds,
|
|
2622
|
+
busyId,
|
|
2623
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
2624
|
+
onToggle: toggle
|
|
2625
|
+
}
|
|
2626
|
+
),
|
|
2627
|
+
ordinaryCandidates.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2628
|
+
CandidateSection,
|
|
2629
|
+
{
|
|
2630
|
+
label: visibleRecents.length > 0 ? `All ${info.labelPlural}` : null,
|
|
2631
|
+
candidates: ordinaryCandidates,
|
|
2632
|
+
attachedIds,
|
|
2633
|
+
busyId,
|
|
2634
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
2635
|
+
onToggle: toggle
|
|
2636
|
+
}
|
|
2637
|
+
)
|
|
2638
|
+
] })
|
|
2639
|
+
] }),
|
|
2640
|
+
canCreate && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2519
2641
|
CreateAndAttachFooter,
|
|
2520
2642
|
{
|
|
2521
2643
|
token,
|
|
@@ -2535,33 +2657,33 @@ function CandidateSection({
|
|
|
2535
2657
|
icon,
|
|
2536
2658
|
onToggle
|
|
2537
2659
|
}) {
|
|
2538
|
-
return /* @__PURE__ */ (0,
|
|
2539
|
-
label && /* @__PURE__ */ (0,
|
|
2540
|
-
/* @__PURE__ */ (0,
|
|
2660
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("section", { className: "space-y-0.5", children: [
|
|
2661
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "px-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground/60", children: label }),
|
|
2662
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { className: "space-y-0.5", children: candidates.map((candidate) => {
|
|
2541
2663
|
const attached = attachedIds.has(candidate.id);
|
|
2542
2664
|
const busy = busyId === candidate.id;
|
|
2543
|
-
return /* @__PURE__ */ (0,
|
|
2665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
2544
2666
|
"button",
|
|
2545
2667
|
{
|
|
2546
2668
|
type: "button",
|
|
2547
2669
|
disabled: busy,
|
|
2548
2670
|
onClick: () => void onToggle(candidate.id, candidate.title),
|
|
2549
|
-
className: (0,
|
|
2671
|
+
className: (0, import_design_system3.cn)(
|
|
2550
2672
|
"group flex min-h-11 w-full items-center gap-2 rounded-md px-2.5 py-2 text-left text-sm transition-colors md:min-h-0",
|
|
2551
2673
|
"hover:bg-accent disabled:opacity-50",
|
|
2552
2674
|
attached && "bg-accent/40"
|
|
2553
2675
|
),
|
|
2554
2676
|
children: [
|
|
2555
2677
|
icon,
|
|
2556
|
-
/* @__PURE__ */ (0,
|
|
2557
|
-
/* @__PURE__ */ (0,
|
|
2678
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "flex-1 min-w-0 truncate text-foreground", children: candidate.title }),
|
|
2679
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2558
2680
|
"span",
|
|
2559
2681
|
{
|
|
2560
|
-
className: (0,
|
|
2682
|
+
className: (0, import_design_system3.cn)(
|
|
2561
2683
|
"flex h-5 w-5 items-center justify-center rounded-full shrink-0",
|
|
2562
2684
|
attached ? "bg-primary text-primary-foreground" : "border border-border text-muted-foreground group-hover:border-primary/60"
|
|
2563
2685
|
),
|
|
2564
|
-
children: busy ? /* @__PURE__ */ (0,
|
|
2686
|
+
children: busy ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SpinnerIcon, { className: "h-3 w-3 animate-spin" }) : attached ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CheckIcon, { className: "h-3 w-3" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PlusIcon, { className: "h-3 w-3" })
|
|
2565
2687
|
}
|
|
2566
2688
|
)
|
|
2567
2689
|
]
|
|
@@ -2617,7 +2739,7 @@ function CreateAndAttachFooter({
|
|
|
2617
2739
|
}
|
|
2618
2740
|
};
|
|
2619
2741
|
if (!editing) {
|
|
2620
|
-
return /* @__PURE__ */ (0,
|
|
2742
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
2621
2743
|
"button",
|
|
2622
2744
|
{
|
|
2623
2745
|
type: "button",
|
|
@@ -2627,10 +2749,10 @@ function CreateAndAttachFooter({
|
|
|
2627
2749
|
},
|
|
2628
2750
|
className: "mt-2 flex min-h-11 w-full shrink-0 items-center justify-center gap-1.5 rounded-md border border-dashed border-border px-3 py-2 text-sm text-muted-foreground transition-colors hover:border-primary/60 hover:text-foreground md:min-h-0",
|
|
2629
2751
|
children: [
|
|
2630
|
-
/* @__PURE__ */ (0,
|
|
2752
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PlusIcon, { className: "h-4 w-4" }),
|
|
2631
2753
|
"New ",
|
|
2632
2754
|
info.label,
|
|
2633
|
-
seed ? /* @__PURE__ */ (0,
|
|
2755
|
+
seed ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "max-w-40 truncate text-muted-foreground/70", children: [
|
|
2634
2756
|
"\u201C",
|
|
2635
2757
|
seed,
|
|
2636
2758
|
"\u201D"
|
|
@@ -2639,9 +2761,9 @@ function CreateAndAttachFooter({
|
|
|
2639
2761
|
}
|
|
2640
2762
|
);
|
|
2641
2763
|
}
|
|
2642
|
-
return /* @__PURE__ */ (0,
|
|
2643
|
-
/* @__PURE__ */ (0,
|
|
2644
|
-
|
|
2764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mt-2 flex shrink-0 items-center gap-1.5", children: [
|
|
2765
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2766
|
+
import_design_system3.Input,
|
|
2645
2767
|
{
|
|
2646
2768
|
autoFocus: true,
|
|
2647
2769
|
value: name,
|
|
@@ -2659,17 +2781,17 @@ function CreateAndAttachFooter({
|
|
|
2659
2781
|
style: { fontSize: 16 }
|
|
2660
2782
|
}
|
|
2661
2783
|
),
|
|
2662
|
-
/* @__PURE__ */ (0,
|
|
2784
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2663
2785
|
"button",
|
|
2664
2786
|
{
|
|
2665
2787
|
type: "button",
|
|
2666
2788
|
disabled: busy || !name.trim(),
|
|
2667
2789
|
onClick: () => void submit(),
|
|
2668
2790
|
className: "flex h-11 items-center gap-1 rounded-md bg-primary px-2.5 text-sm font-medium text-primary-foreground transition-opacity disabled:opacity-50 md:h-8",
|
|
2669
|
-
children: busy ? /* @__PURE__ */ (0,
|
|
2791
|
+
children: busy ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SpinnerIcon, { className: "h-3.5 w-3.5 animate-spin" }) : "Create"
|
|
2670
2792
|
}
|
|
2671
2793
|
),
|
|
2672
|
-
/* @__PURE__ */ (0,
|
|
2794
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2673
2795
|
"button",
|
|
2674
2796
|
{
|
|
2675
2797
|
type: "button",
|
|
@@ -2680,37 +2802,37 @@ function CreateAndAttachFooter({
|
|
|
2680
2802
|
},
|
|
2681
2803
|
title: "Cancel",
|
|
2682
2804
|
className: "flex h-11 w-11 items-center justify-center rounded-md border border-border text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50 md:h-8 md:w-8",
|
|
2683
|
-
children: /* @__PURE__ */ (0,
|
|
2805
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(XIcon, { className: "h-4 w-4" })
|
|
2684
2806
|
}
|
|
2685
2807
|
)
|
|
2686
2808
|
] });
|
|
2687
2809
|
}
|
|
2688
2810
|
function ListMessage({ children }) {
|
|
2689
|
-
return /* @__PURE__ */ (0,
|
|
2811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex items-center justify-center gap-2 py-8 text-[13px] text-muted-foreground", children });
|
|
2690
2812
|
}
|
|
2691
2813
|
|
|
2692
2814
|
// src/react/components/UniversalAssociationPicker.tsx
|
|
2693
2815
|
var import_react14 = require("react");
|
|
2694
|
-
var
|
|
2816
|
+
var import_design_system5 = require("@ai-matrx/design-system");
|
|
2695
2817
|
|
|
2696
2818
|
// src/react/components/entityDoors.tsx
|
|
2697
|
-
var
|
|
2698
|
-
var
|
|
2819
|
+
var import_design_system4 = require("@ai-matrx/design-system");
|
|
2820
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
2699
2821
|
function DoorRef(props) {
|
|
2700
2822
|
const { onOpen, ...refProps } = props;
|
|
2701
2823
|
const { entityDoors } = useAssociationsUiPorts();
|
|
2702
2824
|
const store = useAssociationsStore();
|
|
2703
2825
|
const HostRef = entityDoors?.EntityRef;
|
|
2704
|
-
if (HostRef) return /* @__PURE__ */ (0,
|
|
2826
|
+
if (HostRef) return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(HostRef, { ...refProps });
|
|
2705
2827
|
const name = refProps.name ?? null;
|
|
2706
2828
|
const href = store.registry.tryGetEntityInfo(refProps.token)?.hrefFor?.(refProps.id) ?? null;
|
|
2707
2829
|
if (onOpen) {
|
|
2708
|
-
return /* @__PURE__ */ (0,
|
|
2830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2709
2831
|
"button",
|
|
2710
2832
|
{
|
|
2711
2833
|
type: "button",
|
|
2712
2834
|
onClick: onOpen,
|
|
2713
|
-
className: (0,
|
|
2835
|
+
className: (0, import_design_system4.cn)(
|
|
2714
2836
|
"min-w-0 truncate text-left underline-offset-2 hover:underline",
|
|
2715
2837
|
refProps.className
|
|
2716
2838
|
),
|
|
@@ -2719,30 +2841,30 @@ function DoorRef(props) {
|
|
|
2719
2841
|
);
|
|
2720
2842
|
}
|
|
2721
2843
|
if (href) {
|
|
2722
|
-
return /* @__PURE__ */ (0,
|
|
2844
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2723
2845
|
"a",
|
|
2724
2846
|
{
|
|
2725
2847
|
href,
|
|
2726
2848
|
target: refProps.openInNewTab === false ? void 0 : "_blank",
|
|
2727
2849
|
rel: "noopener noreferrer",
|
|
2728
|
-
className: (0,
|
|
2850
|
+
className: (0, import_design_system4.cn)(
|
|
2729
2851
|
"inline-flex min-w-0 items-center gap-1 truncate underline-offset-2 hover:underline",
|
|
2730
2852
|
refProps.className
|
|
2731
2853
|
),
|
|
2732
2854
|
children: [
|
|
2733
|
-
/* @__PURE__ */ (0,
|
|
2734
|
-
/* @__PURE__ */ (0,
|
|
2855
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "min-w-0 truncate", children: name }),
|
|
2856
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ExternalLinkIcon, { className: "h-3 w-3 shrink-0 opacity-0 transition-opacity group-hover:opacity-60" })
|
|
2735
2857
|
]
|
|
2736
2858
|
}
|
|
2737
2859
|
);
|
|
2738
2860
|
}
|
|
2739
|
-
return /* @__PURE__ */ (0,
|
|
2861
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: (0, import_design_system4.cn)("min-w-0 truncate", refProps.className), children: name });
|
|
2740
2862
|
}
|
|
2741
2863
|
function UnresolvedRef({ token, id }) {
|
|
2742
2864
|
const { entityDoors } = useAssociationsUiPorts();
|
|
2743
2865
|
const HostUnresolved = entityDoors?.UnresolvedRef;
|
|
2744
|
-
if (HostUnresolved) return /* @__PURE__ */ (0,
|
|
2745
|
-
return /* @__PURE__ */ (0,
|
|
2866
|
+
if (HostUnresolved) return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(HostUnresolved, { token, id });
|
|
2867
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2746
2868
|
"span",
|
|
2747
2869
|
{
|
|
2748
2870
|
className: "inline-flex items-center rounded border border-border/60 bg-muted/40 px-1.5 py-0.5 text-[11px] text-muted-foreground",
|
|
@@ -2755,11 +2877,11 @@ function DoorControlsSlot(props) {
|
|
|
2755
2877
|
const { entityDoors } = useAssociationsUiPorts();
|
|
2756
2878
|
const store = useAssociationsStore();
|
|
2757
2879
|
const HostControls = entityDoors?.DoorControls;
|
|
2758
|
-
if (HostControls) return /* @__PURE__ */ (0,
|
|
2880
|
+
if (HostControls) return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(HostControls, { ...props });
|
|
2759
2881
|
const href = store.registry.tryGetEntityInfo(props.token)?.hrefFor?.(props.id) ?? null;
|
|
2760
2882
|
if (!href) return null;
|
|
2761
2883
|
const label = props.name ? `Open ${props.name}` : `Open this ${props.token}`;
|
|
2762
|
-
return /* @__PURE__ */ (0,
|
|
2884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2763
2885
|
"a",
|
|
2764
2886
|
{
|
|
2765
2887
|
href,
|
|
@@ -2767,22 +2889,29 @@ function DoorControlsSlot(props) {
|
|
|
2767
2889
|
rel: "noopener noreferrer",
|
|
2768
2890
|
"aria-label": label,
|
|
2769
2891
|
title: label,
|
|
2770
|
-
className: (0,
|
|
2892
|
+
className: (0, import_design_system4.cn)(
|
|
2771
2893
|
"inline-flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
|
|
2772
2894
|
props.className
|
|
2773
2895
|
),
|
|
2774
|
-
children: /* @__PURE__ */ (0,
|
|
2896
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ExternalLinkIcon, { className: "h-3 w-3" })
|
|
2775
2897
|
}
|
|
2776
2898
|
);
|
|
2777
2899
|
}
|
|
2778
2900
|
|
|
2779
2901
|
// src/react/components/UniversalAssociationPicker.tsx
|
|
2780
|
-
var
|
|
2902
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2781
2903
|
function attachedKey(token, id) {
|
|
2782
2904
|
return `${token}:${id}`;
|
|
2783
2905
|
}
|
|
2784
2906
|
function UniversalAssociationPicker(props) {
|
|
2785
|
-
const {
|
|
2907
|
+
const {
|
|
2908
|
+
attachedKeys,
|
|
2909
|
+
onAttach,
|
|
2910
|
+
onDetach,
|
|
2911
|
+
orgId,
|
|
2912
|
+
emptyQueryMode = "recents",
|
|
2913
|
+
className
|
|
2914
|
+
} = props;
|
|
2786
2915
|
const store = useAssociationsStore();
|
|
2787
2916
|
const { pickerOverrides } = useAssociationsUiPorts();
|
|
2788
2917
|
const notifier = useNotifier();
|
|
@@ -2790,12 +2919,18 @@ function UniversalAssociationPicker(props) {
|
|
|
2790
2919
|
const [query, setQuery] = (0, import_react14.useState)("");
|
|
2791
2920
|
const [browseToken, setBrowseToken] = (0, import_react14.useState)(null);
|
|
2792
2921
|
const [busyKey, setBusyKey] = (0, import_react14.useState)(null);
|
|
2793
|
-
const
|
|
2922
|
+
const [overrideOpen, setOverrideOpen] = (0, import_react14.useState)(false);
|
|
2923
|
+
const [overrideMount, setOverrideMount] = (0, import_react14.useState)(0);
|
|
2924
|
+
const { results, loading, source, failures, error } = useUniversalEntitySearch({
|
|
2794
2925
|
query,
|
|
2795
2926
|
tokens,
|
|
2796
|
-
|
|
2797
|
-
|
|
2927
|
+
enabled: browseToken === null,
|
|
2928
|
+
emptyQueryMode
|
|
2798
2929
|
});
|
|
2930
|
+
const selectToken = (next) => {
|
|
2931
|
+
setBrowseToken(next);
|
|
2932
|
+
setOverrideOpen(next !== null && Boolean(pickerOverrides?.[next]));
|
|
2933
|
+
};
|
|
2799
2934
|
const toggle = async (c) => {
|
|
2800
2935
|
const key = attachedKey(c.token, c.id);
|
|
2801
2936
|
if (busyKey) return;
|
|
@@ -2819,25 +2954,25 @@ function UniversalAssociationPicker(props) {
|
|
|
2819
2954
|
groups.set(r.token, list);
|
|
2820
2955
|
}
|
|
2821
2956
|
const BrowseOverride = browseToken ? pickerOverrides?.[browseToken] : void 0;
|
|
2822
|
-
return /* @__PURE__ */ (0,
|
|
2823
|
-
/* @__PURE__ */ (0,
|
|
2824
|
-
/* @__PURE__ */ (0,
|
|
2825
|
-
/* @__PURE__ */ (0,
|
|
2826
|
-
|
|
2957
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: (0, import_design_system5.cn)("flex min-h-0 flex-1 flex-col gap-2", className), children: [
|
|
2958
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative", children: [
|
|
2959
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SearchIcon, { className: "absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
2960
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2961
|
+
import_design_system5.Input,
|
|
2827
2962
|
{
|
|
2828
2963
|
value: query,
|
|
2829
2964
|
onChange: (e) => {
|
|
2830
2965
|
setQuery(e.target.value);
|
|
2831
|
-
if (browseToken)
|
|
2966
|
+
if (browseToken) selectToken(null);
|
|
2832
2967
|
},
|
|
2833
2968
|
placeholder: "Search everything\u2026",
|
|
2834
2969
|
className: "pl-8 text-base",
|
|
2835
2970
|
style: { fontSize: 16 }
|
|
2836
2971
|
}
|
|
2837
2972
|
),
|
|
2838
|
-
loading && browseToken === null && /* @__PURE__ */ (0,
|
|
2973
|
+
loading && browseToken === null && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SpinnerIcon, { className: "absolute right-2.5 top-1/2 h-4 w-4 -translate-y-1/2 animate-spin text-muted-foreground" })
|
|
2839
2974
|
] }),
|
|
2840
|
-
/* @__PURE__ */ (0,
|
|
2975
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2841
2976
|
"div",
|
|
2842
2977
|
{
|
|
2843
2978
|
role: "group",
|
|
@@ -2847,17 +2982,18 @@ function UniversalAssociationPicker(props) {
|
|
|
2847
2982
|
const info = store.registry.getEntityInfo(t);
|
|
2848
2983
|
const ChipIcon = info.Icon ?? DefaultEntityIcon;
|
|
2849
2984
|
const active = browseToken === t;
|
|
2850
|
-
return /* @__PURE__ */ (0,
|
|
2985
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2851
2986
|
"button",
|
|
2852
2987
|
{
|
|
2853
2988
|
type: "button",
|
|
2854
|
-
|
|
2855
|
-
|
|
2989
|
+
"aria-pressed": active,
|
|
2990
|
+
onClick: () => selectToken(active ? null : t),
|
|
2991
|
+
className: (0, import_design_system5.cn)(
|
|
2856
2992
|
"inline-flex shrink-0 items-center gap-1 rounded-md border px-1.5 py-0.5 text-[11px] transition-colors",
|
|
2857
2993
|
active ? "border-primary/50 bg-primary/10 text-foreground" : "border-border text-muted-foreground hover:text-foreground hover:bg-accent"
|
|
2858
2994
|
),
|
|
2859
2995
|
children: [
|
|
2860
|
-
/* @__PURE__ */ (0,
|
|
2996
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChipIcon, { className: "h-3 w-3" }),
|
|
2861
2997
|
info.labelPlural
|
|
2862
2998
|
]
|
|
2863
2999
|
},
|
|
@@ -2869,91 +3005,150 @@ function UniversalAssociationPicker(props) {
|
|
|
2869
3005
|
browseToken && BrowseOverride ? (
|
|
2870
3006
|
// The token's canonical host picker (e.g. the stored-files browser)
|
|
2871
3007
|
// owns per-token browsing when registered — never a plain list twin.
|
|
2872
|
-
|
|
2873
|
-
|
|
3008
|
+
// It opens in its own window; this body says where it went.
|
|
3009
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3010
|
+
"div",
|
|
2874
3011
|
{
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
3012
|
+
role: "region",
|
|
3013
|
+
"aria-label": `${store.registry.getEntityInfo(browseToken).labelPlural} window`,
|
|
3014
|
+
className: "flex flex-1 flex-col items-center justify-center gap-3 px-4 py-8 text-center",
|
|
3015
|
+
children: [
|
|
3016
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-sm text-foreground", children: overrideOpen ? `The ${store.registry.getEntityInfo(browseToken).labelPlural.toLowerCase()} window is open.` : `The ${store.registry.getEntityInfo(browseToken).labelPlural.toLowerCase()} window is closed.` }),
|
|
3017
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "max-w-xs text-[12px] text-muted-foreground", children: overrideOpen ? "Check items there to attach them; uncheck to detach. Changes save as you go." : "Reopen it to pick more, or go back to search everything." }),
|
|
3018
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-wrap items-center justify-center gap-2", children: [
|
|
3019
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3020
|
+
import_design_system5.Button,
|
|
3021
|
+
{
|
|
3022
|
+
type: "button",
|
|
3023
|
+
size: "sm",
|
|
3024
|
+
variant: overrideOpen ? "outline" : "default",
|
|
3025
|
+
onClick: () => {
|
|
3026
|
+
setOverrideOpen(true);
|
|
3027
|
+
setOverrideMount((n) => n + 1);
|
|
3028
|
+
},
|
|
3029
|
+
children: [
|
|
3030
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MaximizeIcon, { className: "mr-1.5 h-3.5 w-3.5" }),
|
|
3031
|
+
overrideOpen ? "Bring window to front" : "Reopen window"
|
|
3032
|
+
]
|
|
3033
|
+
}
|
|
3034
|
+
),
|
|
3035
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3036
|
+
import_design_system5.Button,
|
|
3037
|
+
{
|
|
3038
|
+
type: "button",
|
|
3039
|
+
size: "sm",
|
|
3040
|
+
variant: "ghost",
|
|
3041
|
+
onClick: () => selectToken(null),
|
|
3042
|
+
children: "Back to search"
|
|
3043
|
+
}
|
|
3044
|
+
)
|
|
3045
|
+
] }),
|
|
3046
|
+
overrideOpen && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3047
|
+
BrowseOverride,
|
|
3048
|
+
{
|
|
3049
|
+
open: true,
|
|
3050
|
+
onOpenChange: (open) => {
|
|
3051
|
+
if (!open) setOverrideOpen(false);
|
|
3052
|
+
},
|
|
3053
|
+
token: browseToken,
|
|
3054
|
+
orgId: orgId ?? null,
|
|
3055
|
+
attachedIds: new Set(
|
|
3056
|
+
[...attachedKeys].filter((k) => k.startsWith(`${browseToken}:`)).map((k) => k.slice(browseToken.length + 1))
|
|
3057
|
+
),
|
|
3058
|
+
onAttach: (id, title) => onAttach(browseToken, id, title),
|
|
3059
|
+
onDetach: (id) => onDetach(browseToken, id)
|
|
3060
|
+
},
|
|
3061
|
+
overrideMount
|
|
3062
|
+
)
|
|
3063
|
+
]
|
|
2886
3064
|
}
|
|
2887
3065
|
)
|
|
2888
|
-
) : browseToken ? /* @__PURE__ */ (0,
|
|
3066
|
+
) : browseToken ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex min-h-0 flex-1 flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2889
3067
|
AssociationCandidateBody,
|
|
2890
3068
|
{
|
|
2891
3069
|
token: browseToken,
|
|
2892
3070
|
enabled: true,
|
|
2893
3071
|
orgId,
|
|
2894
|
-
onClose: () =>
|
|
3072
|
+
onClose: () => selectToken(null),
|
|
2895
3073
|
attachedIds: new Set(
|
|
2896
3074
|
[...attachedKeys].filter((k) => k.startsWith(`${browseToken}:`)).map((k) => k.slice(browseToken.length + 1))
|
|
2897
3075
|
),
|
|
2898
3076
|
onAttach: (id, title) => onAttach(browseToken, id, title),
|
|
2899
3077
|
onDetach: (id) => onDetach(browseToken, id)
|
|
2900
3078
|
}
|
|
2901
|
-
) }) : /* @__PURE__ */ (0,
|
|
3079
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2902
3080
|
"div",
|
|
2903
3081
|
{
|
|
2904
3082
|
role: "region",
|
|
2905
3083
|
"aria-label": "Association search results",
|
|
2906
3084
|
className: "-mx-1 min-h-24 flex-1 overflow-y-auto overscroll-contain px-1",
|
|
2907
|
-
children:
|
|
2908
|
-
|
|
3085
|
+
children: error ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3086
|
+
SearchFailureNotice,
|
|
3087
|
+
{
|
|
3088
|
+
error,
|
|
3089
|
+
failures,
|
|
3090
|
+
operation: "Search to attach",
|
|
3091
|
+
origin: "associations/UniversalAssociationPicker"
|
|
3092
|
+
}
|
|
3093
|
+
) : results.length === 0 && failures.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "py-6 text-center text-[12px] text-muted-foreground", children: loading ? "Searching\u2026" : query.trim() ? "No matches \u2014 narrow with a type chip to browse." : "Nothing to attach yet. Type to search, or pick a type to browse." }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-2", children: [
|
|
3094
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3095
|
+
SearchFailureNotice,
|
|
3096
|
+
{
|
|
3097
|
+
error: null,
|
|
3098
|
+
failures,
|
|
3099
|
+
operation: "Search to attach",
|
|
3100
|
+
origin: "associations/UniversalAssociationPicker"
|
|
3101
|
+
}
|
|
3102
|
+
),
|
|
3103
|
+
source !== "search" && results.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "px-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground/60", children: source === "recents" ? "Recent" : "Browse" }),
|
|
2909
3104
|
[...groups.entries()].map(([token, items]) => {
|
|
2910
3105
|
const info = store.registry.getEntityInfo(token);
|
|
2911
3106
|
const GroupIcon = info.Icon ?? DefaultEntityIcon;
|
|
2912
|
-
return /* @__PURE__ */ (0,
|
|
2913
|
-
/* @__PURE__ */ (0,
|
|
2914
|
-
/* @__PURE__ */ (0,
|
|
3107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-0.5", children: [
|
|
3108
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("p", { className: "flex items-center gap-1 px-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground/70", children: [
|
|
3109
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(GroupIcon, { className: "h-3 w-3" }),
|
|
2915
3110
|
info.labelPlural
|
|
2916
3111
|
] }),
|
|
2917
|
-
/* @__PURE__ */ (0,
|
|
3112
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { className: "space-y-0.5", children: items.map((c) => {
|
|
2918
3113
|
const key = attachedKey(c.token, c.id);
|
|
2919
3114
|
const attached = attachedKeys.has(key);
|
|
2920
3115
|
const busy = busyKey === key;
|
|
2921
|
-
return /* @__PURE__ */ (0,
|
|
3116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2922
3117
|
"li",
|
|
2923
3118
|
{
|
|
2924
|
-
className: (0,
|
|
3119
|
+
className: (0, import_design_system5.cn)(
|
|
2925
3120
|
"group/entity-ref group flex items-center gap-1 rounded-md pr-1.5 transition-colors",
|
|
2926
3121
|
"hover:bg-accent",
|
|
2927
3122
|
attached && "bg-accent/40"
|
|
2928
3123
|
),
|
|
2929
3124
|
children: [
|
|
2930
|
-
/* @__PURE__ */ (0,
|
|
3125
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2931
3126
|
"button",
|
|
2932
3127
|
{
|
|
2933
3128
|
type: "button",
|
|
2934
3129
|
disabled: busy,
|
|
2935
3130
|
onClick: () => toggle(c),
|
|
2936
3131
|
title: attached ? `Detach "${c.title}"` : `Attach "${c.title}"`,
|
|
2937
|
-
className: (0,
|
|
3132
|
+
className: (0, import_design_system5.cn)(
|
|
2938
3133
|
"flex min-w-0 flex-1 items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm",
|
|
2939
3134
|
"disabled:opacity-50"
|
|
2940
3135
|
),
|
|
2941
3136
|
children: [
|
|
2942
|
-
/* @__PURE__ */ (0,
|
|
2943
|
-
/* @__PURE__ */ (0,
|
|
3137
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "min-w-0 flex-1 truncate text-foreground", children: c.title }),
|
|
3138
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2944
3139
|
"span",
|
|
2945
3140
|
{
|
|
2946
|
-
className: (0,
|
|
3141
|
+
className: (0, import_design_system5.cn)(
|
|
2947
3142
|
"flex h-5 w-5 shrink-0 items-center justify-center rounded-full",
|
|
2948
3143
|
attached ? "bg-primary text-primary-foreground" : "border border-border text-muted-foreground group-hover:border-primary/60"
|
|
2949
3144
|
),
|
|
2950
|
-
children: busy ? /* @__PURE__ */ (0,
|
|
3145
|
+
children: busy ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SpinnerIcon, { className: "h-3 w-3 animate-spin" }) : attached ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CheckIcon, { className: "h-3 w-3" }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PlusIcon, { className: "h-3 w-3" })
|
|
2951
3146
|
}
|
|
2952
3147
|
)
|
|
2953
3148
|
]
|
|
2954
3149
|
}
|
|
2955
3150
|
),
|
|
2956
|
-
/* @__PURE__ */ (0,
|
|
3151
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2957
3152
|
DoorControlsSlot,
|
|
2958
3153
|
{
|
|
2959
3154
|
token: c.token,
|
|
@@ -2976,8 +3171,8 @@ function UniversalAssociationPicker(props) {
|
|
|
2976
3171
|
|
|
2977
3172
|
// src/react/components/AttachedItemsSheet.tsx
|
|
2978
3173
|
var import_react15 = require("react");
|
|
2979
|
-
var
|
|
2980
|
-
var
|
|
3174
|
+
var import_design_system6 = require("@ai-matrx/design-system");
|
|
3175
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2981
3176
|
function metadataIsPinned(metadata) {
|
|
2982
3177
|
return metadata !== null && typeof metadata === "object" && !Array.isArray(metadata) && Reflect.get(metadata, "pinned") === true;
|
|
2983
3178
|
}
|
|
@@ -2988,9 +3183,9 @@ function AttachedItemsSheet(props) {
|
|
|
2988
3183
|
const title = info.labelPlural;
|
|
2989
3184
|
const containerName = props.container?.label ?? props.containerLabel;
|
|
2990
3185
|
const filing = props.container?.direction === "outgoing";
|
|
2991
|
-
const subtitle = props.container ? /* @__PURE__ */ (0,
|
|
3186
|
+
const subtitle = props.container ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "inline-flex min-w-0 max-w-full items-center gap-1", children: [
|
|
2992
3187
|
filing ? "What this is filed under:" : "Attached to",
|
|
2993
|
-
/* @__PURE__ */ (0,
|
|
3188
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2994
3189
|
DoorRef,
|
|
2995
3190
|
{
|
|
2996
3191
|
token: props.container.type,
|
|
@@ -3001,16 +3196,16 @@ function AttachedItemsSheet(props) {
|
|
|
3001
3196
|
)
|
|
3002
3197
|
] }) : props.containerLabel ? `Attached to ${props.containerLabel}` : "Attached items";
|
|
3003
3198
|
if (!props.open) return null;
|
|
3004
|
-
return /* @__PURE__ */ (0,
|
|
3199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3005
3200
|
AssociationWindow,
|
|
3006
3201
|
{
|
|
3007
3202
|
open: props.open,
|
|
3008
3203
|
onClose: () => props.onOpenChange(false),
|
|
3009
3204
|
scopeId: `attached:${props.token}`,
|
|
3010
3205
|
title,
|
|
3011
|
-
icon: /* @__PURE__ */ (0,
|
|
3206
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, { className: "size-3.5 text-primary" }),
|
|
3012
3207
|
subtitle,
|
|
3013
|
-
children: /* @__PURE__ */ (0,
|
|
3208
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3014
3209
|
AttachedItemsBody,
|
|
3015
3210
|
{
|
|
3016
3211
|
token: props.token,
|
|
@@ -3099,31 +3294,31 @@ function AttachedItemsBody({
|
|
|
3099
3294
|
setBusyId(null);
|
|
3100
3295
|
}
|
|
3101
3296
|
};
|
|
3102
|
-
return /* @__PURE__ */ (0,
|
|
3103
|
-
titleError ? /* @__PURE__ */ (0,
|
|
3297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
3298
|
+
titleError ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mb-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px] text-destructive", children: [
|
|
3104
3299
|
"Showing names recorded at attach time \u2014 they may be out of date.",
|
|
3105
3300
|
" ",
|
|
3106
3301
|
titleError
|
|
3107
3302
|
] }) : null,
|
|
3108
|
-
/* @__PURE__ */ (0,
|
|
3109
|
-
/* @__PURE__ */ (0,
|
|
3303
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex-1 min-h-0 overflow-y-auto -mx-1 px-1", children: links.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex items-center justify-center py-8 text-[13px] text-muted-foreground", children: "Nothing attached yet." }) : titles === null ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center justify-center gap-2 py-8 text-[13px] text-muted-foreground", children: [
|
|
3304
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SpinnerIcon, { className: "h-4 w-4 animate-spin" }),
|
|
3110
3305
|
"Loading\u2026"
|
|
3111
|
-
] }) : /* @__PURE__ */ (0,
|
|
3306
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { className: "space-y-0.5", children: links.map((link) => {
|
|
3112
3307
|
const resolved = titles.get(link.resourceId);
|
|
3113
3308
|
const missing = !titles.has(link.resourceId);
|
|
3114
3309
|
const name = resolved ?? link.label ?? (missing ? null : "Untitled");
|
|
3115
3310
|
const busy = busyId === link.resourceId;
|
|
3116
3311
|
const pinned = metadataIsPinned(link.metadata);
|
|
3117
|
-
return /* @__PURE__ */ (0,
|
|
3312
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3118
3313
|
"li",
|
|
3119
3314
|
{
|
|
3120
3315
|
className: "group/entity-ref group flex items-center gap-2 rounded-md px-2.5 py-2 text-sm transition-colors hover:bg-accent",
|
|
3121
3316
|
children: [
|
|
3122
|
-
/* @__PURE__ */ (0,
|
|
3123
|
-
/* @__PURE__ */ (0,
|
|
3317
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
3318
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "flex-1 min-w-0 truncate", children: name === null ? (
|
|
3124
3319
|
// The X beside the row stays the one-click detach.
|
|
3125
|
-
/* @__PURE__ */ (0,
|
|
3126
|
-
) : /* @__PURE__ */ (0,
|
|
3320
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(UnresolvedRef, { token, id: link.resourceId })
|
|
3321
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3127
3322
|
DoorRef,
|
|
3128
3323
|
{
|
|
3129
3324
|
token,
|
|
@@ -3133,7 +3328,7 @@ function AttachedItemsBody({
|
|
|
3133
3328
|
className: "text-foreground"
|
|
3134
3329
|
}
|
|
3135
3330
|
) }),
|
|
3136
|
-
onSetPinned ? /* @__PURE__ */ (0,
|
|
3331
|
+
onSetPinned ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3137
3332
|
"button",
|
|
3138
3333
|
{
|
|
3139
3334
|
type: "button",
|
|
@@ -3141,14 +3336,14 @@ function AttachedItemsBody({
|
|
|
3141
3336
|
onClick: () => void setPinned(link, !pinned),
|
|
3142
3337
|
title: pinned ? "Unpin (stops staying in agent context)" : "Pin \u2014 always in agent context",
|
|
3143
3338
|
"aria-label": pinned ? "Unpin" : "Pin",
|
|
3144
|
-
className: (0,
|
|
3339
|
+
className: (0, import_design_system6.cn)(
|
|
3145
3340
|
"flex h-6 w-6 shrink-0 items-center justify-center rounded-md transition-colors hover:bg-accent hover:text-foreground disabled:opacity-50",
|
|
3146
3341
|
pinned ? "text-primary" : "text-muted-foreground"
|
|
3147
3342
|
),
|
|
3148
|
-
children: /* @__PURE__ */ (0,
|
|
3343
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3149
3344
|
PinIcon,
|
|
3150
3345
|
{
|
|
3151
|
-
className: (0,
|
|
3346
|
+
className: (0, import_design_system6.cn)(
|
|
3152
3347
|
"h-3.5 w-3.5",
|
|
3153
3348
|
pinned && "fill-primary/20"
|
|
3154
3349
|
)
|
|
@@ -3156,18 +3351,18 @@ function AttachedItemsBody({
|
|
|
3156
3351
|
)
|
|
3157
3352
|
}
|
|
3158
3353
|
) : null,
|
|
3159
|
-
/* @__PURE__ */ (0,
|
|
3354
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3160
3355
|
"button",
|
|
3161
3356
|
{
|
|
3162
3357
|
type: "button",
|
|
3163
3358
|
disabled: busy,
|
|
3164
3359
|
onClick: () => void detach(link),
|
|
3165
3360
|
title: "Detach",
|
|
3166
|
-
className: (0,
|
|
3361
|
+
className: (0, import_design_system6.cn)(
|
|
3167
3362
|
"flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors",
|
|
3168
3363
|
"hover:bg-destructive/10 hover:text-destructive disabled:opacity-50"
|
|
3169
3364
|
),
|
|
3170
|
-
children: busy ? /* @__PURE__ */ (0,
|
|
3365
|
+
children: busy ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SpinnerIcon, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(XIcon, { className: "h-3.5 w-3.5" })
|
|
3171
3366
|
}
|
|
3172
3367
|
)
|
|
3173
3368
|
]
|
|
@@ -3175,14 +3370,14 @@ function AttachedItemsBody({
|
|
|
3175
3370
|
link.edgeId
|
|
3176
3371
|
);
|
|
3177
3372
|
}) }) }),
|
|
3178
|
-
onAdd ? /* @__PURE__ */ (0,
|
|
3373
|
+
onAdd ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3179
3374
|
"button",
|
|
3180
3375
|
{
|
|
3181
3376
|
type: "button",
|
|
3182
3377
|
onClick: onAdd,
|
|
3183
3378
|
className: "mt-2 flex w-full items-center justify-center gap-1.5 rounded-md border border-border px-3 py-2 text-sm text-muted-foreground transition-colors hover:border-primary/60 hover:text-foreground",
|
|
3184
3379
|
children: [
|
|
3185
|
-
/* @__PURE__ */ (0,
|
|
3380
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PlusIcon, { className: "h-4 w-4" }),
|
|
3186
3381
|
"Attach ",
|
|
3187
3382
|
info.labelPlural.toLowerCase()
|
|
3188
3383
|
]
|
|
@@ -3193,7 +3388,7 @@ function AttachedItemsBody({
|
|
|
3193
3388
|
|
|
3194
3389
|
// src/react/components/AssociationCard.tsx
|
|
3195
3390
|
var import_react16 = require("react");
|
|
3196
|
-
var
|
|
3391
|
+
var import_design_system7 = require("@ai-matrx/design-system");
|
|
3197
3392
|
|
|
3198
3393
|
// src/react/contentRoles.ts
|
|
3199
3394
|
var CONTENT_ROLES = [
|
|
@@ -3243,7 +3438,7 @@ function getContentRoleMeta(role) {
|
|
|
3243
3438
|
}
|
|
3244
3439
|
|
|
3245
3440
|
// src/react/components/AssociationCard.tsx
|
|
3246
|
-
var
|
|
3441
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
3247
3442
|
function AssociationCard({
|
|
3248
3443
|
token,
|
|
3249
3444
|
container: containerProp,
|
|
@@ -3279,58 +3474,58 @@ function AssociationCard({
|
|
|
3279
3474
|
const filing = container.direction === "outgoing";
|
|
3280
3475
|
const canAttach = info.canListCandidates && (!filing || isAssociationTargetType(token));
|
|
3281
3476
|
const canDrillIn = count > 0;
|
|
3282
|
-
return /* @__PURE__ */ (0,
|
|
3283
|
-
/* @__PURE__ */ (0,
|
|
3477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
3478
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
3284
3479
|
"div",
|
|
3285
3480
|
{
|
|
3286
|
-
className: (0,
|
|
3481
|
+
className: (0, import_design_system7.cn)(
|
|
3287
3482
|
"group relative flex items-center gap-3 overflow-hidden rounded-xl border border-border bg-card transition-all hover:border-primary/30 hover:bg-accent/40",
|
|
3288
3483
|
className
|
|
3289
3484
|
),
|
|
3290
3485
|
children: [
|
|
3291
|
-
/* @__PURE__ */ (0,
|
|
3486
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3292
3487
|
"span",
|
|
3293
3488
|
{
|
|
3294
|
-
className: (0,
|
|
3489
|
+
className: (0, import_design_system7.cn)(
|
|
3295
3490
|
"absolute inset-x-0 top-0 h-0.5 opacity-60",
|
|
3296
3491
|
role.accentBar
|
|
3297
3492
|
)
|
|
3298
3493
|
}
|
|
3299
3494
|
),
|
|
3300
|
-
/* @__PURE__ */ (0,
|
|
3495
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
3301
3496
|
"button",
|
|
3302
3497
|
{
|
|
3303
3498
|
type: "button",
|
|
3304
3499
|
disabled: !canDrillIn,
|
|
3305
3500
|
onClick: () => setListOpen(true),
|
|
3306
3501
|
title: canDrillIn ? `View the ${info.labelPlural.toLowerCase()} attached to ${container.label ?? "this"}` : void 0,
|
|
3307
|
-
className: (0,
|
|
3502
|
+
className: (0, import_design_system7.cn)(
|
|
3308
3503
|
"flex min-w-0 flex-1 items-center gap-3 px-3 py-2.5 text-left",
|
|
3309
3504
|
canDrillIn ? "cursor-pointer" : "cursor-default"
|
|
3310
3505
|
),
|
|
3311
3506
|
children: [
|
|
3312
|
-
/* @__PURE__ */ (0,
|
|
3507
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3313
3508
|
"span",
|
|
3314
3509
|
{
|
|
3315
|
-
className: (0,
|
|
3510
|
+
className: (0, import_design_system7.cn)(
|
|
3316
3511
|
"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg",
|
|
3317
3512
|
role.accentBg,
|
|
3318
3513
|
role.accentText
|
|
3319
3514
|
),
|
|
3320
|
-
children: /* @__PURE__ */ (0,
|
|
3515
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, { className: "h-4 w-4" })
|
|
3321
3516
|
}
|
|
3322
3517
|
),
|
|
3323
|
-
/* @__PURE__ */ (0,
|
|
3324
|
-
/* @__PURE__ */ (0,
|
|
3325
|
-
/* @__PURE__ */ (0,
|
|
3326
|
-
/* @__PURE__ */ (0,
|
|
3518
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "min-w-0 flex-1", children: [
|
|
3519
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "block truncate text-sm font-medium text-foreground", children: info.labelPlural }),
|
|
3520
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "block text-[11px] text-muted-foreground tabular-nums", children: loading ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "inline-flex items-center gap-1", children: [
|
|
3521
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SpinnerIcon, { className: "h-3 w-3 animate-spin" }),
|
|
3327
3522
|
"Loading\u2026"
|
|
3328
3523
|
] }) : `${count} ${container.direction === "outgoing" ? "filed under" : "attached"}` })
|
|
3329
3524
|
] })
|
|
3330
3525
|
]
|
|
3331
3526
|
}
|
|
3332
3527
|
),
|
|
3333
|
-
canAttach && /* @__PURE__ */ (0,
|
|
3528
|
+
canAttach && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3334
3529
|
"button",
|
|
3335
3530
|
{
|
|
3336
3531
|
type: "button",
|
|
@@ -3338,13 +3533,13 @@ function AssociationCard({
|
|
|
3338
3533
|
"aria-label": `Attach ${info.labelPlural.toLowerCase()}`,
|
|
3339
3534
|
title: `Attach ${info.labelPlural.toLowerCase()}`,
|
|
3340
3535
|
className: "mr-2 flex h-11 w-11 shrink-0 items-center justify-center rounded-md border border-border text-muted-foreground transition-colors hover:border-primary/60 hover:text-foreground lg:mr-3 lg:h-7 lg:w-7",
|
|
3341
|
-
children: /* @__PURE__ */ (0,
|
|
3536
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PlusIcon, { className: "h-4 w-4" })
|
|
3342
3537
|
}
|
|
3343
3538
|
)
|
|
3344
3539
|
]
|
|
3345
3540
|
}
|
|
3346
3541
|
),
|
|
3347
|
-
listOpen && /* @__PURE__ */ (0,
|
|
3542
|
+
listOpen && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3348
3543
|
AttachedItemsSheet,
|
|
3349
3544
|
{
|
|
3350
3545
|
open: listOpen,
|
|
@@ -3363,7 +3558,7 @@ function AssociationCard({
|
|
|
3363
3558
|
onSetPinned: (resourceId, pinned, role2) => setPinned(token, resourceId, pinned, role2 ?? void 0)
|
|
3364
3559
|
}
|
|
3365
3560
|
),
|
|
3366
|
-
canAttach && /* @__PURE__ */ (0,
|
|
3561
|
+
canAttach && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3367
3562
|
AssociationPicker,
|
|
3368
3563
|
{
|
|
3369
3564
|
open,
|
|
@@ -3381,8 +3576,8 @@ function AssociationCard({
|
|
|
3381
3576
|
}
|
|
3382
3577
|
|
|
3383
3578
|
// src/react/components/AssociationCardGrid.tsx
|
|
3384
|
-
var
|
|
3385
|
-
var
|
|
3579
|
+
var import_design_system8 = require("@ai-matrx/design-system");
|
|
3580
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
3386
3581
|
function AssociationCardGrid({
|
|
3387
3582
|
tokens,
|
|
3388
3583
|
excludeTokens,
|
|
@@ -3408,42 +3603,42 @@ function AssociationCardGrid({
|
|
|
3408
3603
|
const role = store.registry.getEntityInfo(token).contentRole;
|
|
3409
3604
|
return !role || !roleIds.has(role);
|
|
3410
3605
|
}) : [];
|
|
3411
|
-
return /* @__PURE__ */ (0,
|
|
3606
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: (0, import_design_system8.cn)("space-y-5", className), children: [
|
|
3412
3607
|
CONTENT_ROLES.map((role) => {
|
|
3413
3608
|
const inRole = list.filter(
|
|
3414
3609
|
(token) => store.registry.getEntityInfo(token).contentRole === role.id
|
|
3415
3610
|
);
|
|
3416
3611
|
if (inRole.length === 0) return null;
|
|
3417
|
-
return /* @__PURE__ */ (0,
|
|
3418
|
-
/* @__PURE__ */ (0,
|
|
3419
|
-
/* @__PURE__ */ (0,
|
|
3420
|
-
/* @__PURE__ */ (0,
|
|
3612
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("section", { children: [
|
|
3613
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "mb-2.5 flex items-baseline gap-3 pl-1.5", children: [
|
|
3614
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3615
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3421
3616
|
"span",
|
|
3422
3617
|
{
|
|
3423
|
-
className: (0,
|
|
3618
|
+
className: (0, import_design_system8.cn)("h-2.5 w-2.5 rounded-full", role.accentBar)
|
|
3424
3619
|
}
|
|
3425
3620
|
),
|
|
3426
|
-
/* @__PURE__ */ (0,
|
|
3621
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "text-sm font-semibold text-foreground", children: role.title })
|
|
3427
3622
|
] }),
|
|
3428
|
-
/* @__PURE__ */ (0,
|
|
3623
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "hidden text-xs text-muted-foreground sm:block", children: role.tagline })
|
|
3429
3624
|
] }),
|
|
3430
|
-
/* @__PURE__ */ (0,
|
|
3625
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3", children: inRole.map((token) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(AssociationCard, { token }, token)) })
|
|
3431
3626
|
] }, role.id);
|
|
3432
3627
|
}),
|
|
3433
|
-
roleless.length > 0 && /* @__PURE__ */ (0,
|
|
3434
|
-
/* @__PURE__ */ (0,
|
|
3435
|
-
/* @__PURE__ */ (0,
|
|
3436
|
-
/* @__PURE__ */ (0,
|
|
3628
|
+
roleless.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("section", { children: [
|
|
3629
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "mb-2.5 flex items-baseline gap-3 pl-1.5", children: [
|
|
3630
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "text-sm font-semibold text-foreground", children: "Filed under" }),
|
|
3631
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "hidden text-xs text-muted-foreground sm:block", children: "Libraries, topics and other places this is kept." })
|
|
3437
3632
|
] }),
|
|
3438
|
-
/* @__PURE__ */ (0,
|
|
3633
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3", children: roleless.map((token) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(AssociationCard, { token }, token)) })
|
|
3439
3634
|
] })
|
|
3440
3635
|
] });
|
|
3441
3636
|
}
|
|
3442
3637
|
|
|
3443
3638
|
// src/react/components/AssociationList.tsx
|
|
3444
3639
|
var import_react17 = require("react");
|
|
3445
|
-
var
|
|
3446
|
-
var
|
|
3640
|
+
var import_design_system9 = require("@ai-matrx/design-system");
|
|
3641
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
3447
3642
|
function metadataIsPinned2(metadata) {
|
|
3448
3643
|
return metadata !== null && typeof metadata === "object" && !Array.isArray(metadata) && Reflect.get(metadata, "pinned") === true;
|
|
3449
3644
|
}
|
|
@@ -3549,40 +3744,40 @@ function AssociationList(props) {
|
|
|
3549
3744
|
const grouped = groupRows(store, visibleRows);
|
|
3550
3745
|
const isLoading = adapter.status === "loading" || adapter.status === "idle";
|
|
3551
3746
|
const attachableTokens = tokenFilter ?? store.registry.listableTokens();
|
|
3552
|
-
return /* @__PURE__ */ (0,
|
|
3553
|
-
/* @__PURE__ */ (0,
|
|
3554
|
-
/* @__PURE__ */ (0,
|
|
3555
|
-
/* @__PURE__ */ (0,
|
|
3747
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: (0, import_design_system9.cn)("flex flex-col gap-2 text-foreground", props.className), children: [
|
|
3748
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center justify-between gap-2 px-1", children: [
|
|
3749
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("h3", { className: "flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: [
|
|
3750
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Link2Icon, { className: "h-3.5 w-3.5" }),
|
|
3556
3751
|
"Resources",
|
|
3557
|
-
visibleRows.length > 0 && /* @__PURE__ */ (0,
|
|
3752
|
+
visibleRows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "rounded bg-muted px-1 text-[10px] font-medium text-muted-foreground", children: visibleRows.length })
|
|
3558
3753
|
] }),
|
|
3559
|
-
/* @__PURE__ */ (0,
|
|
3560
|
-
/* @__PURE__ */ (0,
|
|
3754
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
3755
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
3561
3756
|
"button",
|
|
3562
3757
|
{
|
|
3563
3758
|
type: "button",
|
|
3564
3759
|
onClick: () => setShowUniversal((v) => !v),
|
|
3565
|
-
className: (0,
|
|
3760
|
+
className: (0, import_design_system9.cn)(
|
|
3566
3761
|
"inline-flex items-center gap-1 rounded-md border border-border px-1.5 py-0.5 text-[11px] transition-colors",
|
|
3567
3762
|
showUniversal ? "bg-accent text-foreground" : "text-muted-foreground hover:bg-accent hover:text-foreground"
|
|
3568
3763
|
),
|
|
3569
3764
|
children: [
|
|
3570
|
-
/* @__PURE__ */ (0,
|
|
3765
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PlusIcon, { className: "h-3 w-3" }),
|
|
3571
3766
|
"Add"
|
|
3572
3767
|
]
|
|
3573
3768
|
}
|
|
3574
3769
|
),
|
|
3575
|
-
/* @__PURE__ */ (0,
|
|
3770
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3576
3771
|
"button",
|
|
3577
3772
|
{
|
|
3578
3773
|
type: "button",
|
|
3579
3774
|
onClick: () => void adapter.reload(),
|
|
3580
3775
|
title: "Refresh",
|
|
3581
3776
|
className: "text-muted-foreground/60 transition-colors hover:text-foreground",
|
|
3582
|
-
children: /* @__PURE__ */ (0,
|
|
3777
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3583
3778
|
RefreshIcon,
|
|
3584
3779
|
{
|
|
3585
|
-
className: (0,
|
|
3780
|
+
className: (0, import_design_system9.cn)(
|
|
3586
3781
|
"h-3 w-3",
|
|
3587
3782
|
adapter.status === "loading" && "animate-spin"
|
|
3588
3783
|
)
|
|
@@ -3592,7 +3787,7 @@ function AssociationList(props) {
|
|
|
3592
3787
|
)
|
|
3593
3788
|
] })
|
|
3594
3789
|
] }),
|
|
3595
|
-
showUniversal && /* @__PURE__ */ (0,
|
|
3790
|
+
showUniversal && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "rounded-md border border-border/60 bg-muted/30 p-2 max-h-80 flex flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3596
3791
|
UniversalAssociationPicker,
|
|
3597
3792
|
{
|
|
3598
3793
|
tokens: attachableTokens,
|
|
@@ -3602,9 +3797,9 @@ function AssociationList(props) {
|
|
|
3602
3797
|
onDetach: (token, id) => adapter.detach(token, id)
|
|
3603
3798
|
}
|
|
3604
3799
|
) }),
|
|
3605
|
-
adapter.status === "error" && /* @__PURE__ */ (0,
|
|
3606
|
-
/* @__PURE__ */ (0,
|
|
3607
|
-
/* @__PURE__ */ (0,
|
|
3800
|
+
adapter.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center justify-between gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-2.5 py-2", children: [
|
|
3801
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "truncate text-[11px] text-destructive", children: adapter.error || "Failed to load resources" }),
|
|
3802
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3608
3803
|
"button",
|
|
3609
3804
|
{
|
|
3610
3805
|
type: "button",
|
|
@@ -3614,29 +3809,29 @@ function AssociationList(props) {
|
|
|
3614
3809
|
}
|
|
3615
3810
|
)
|
|
3616
3811
|
] }),
|
|
3617
|
-
adapter.status !== "error" && isLoading && visibleRows.length === 0 && /* @__PURE__ */ (0,
|
|
3618
|
-
/* @__PURE__ */ (0,
|
|
3619
|
-
/* @__PURE__ */ (0,
|
|
3620
|
-
/* @__PURE__ */ (0,
|
|
3812
|
+
adapter.status !== "error" && isLoading && visibleRows.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "space-y-1.5 px-1", children: [
|
|
3813
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_design_system9.Skeleton, { className: "h-3 w-20" }),
|
|
3814
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_design_system9.Skeleton, { className: "h-7 w-full rounded-md" }),
|
|
3815
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_design_system9.Skeleton, { className: "h-7 w-3/4 rounded-md" })
|
|
3621
3816
|
] }),
|
|
3622
|
-
adapter.status === "ready" && visibleRows.length === 0 && /* @__PURE__ */ (0,
|
|
3623
|
-
visibleRows.length > 0 && /* @__PURE__ */ (0,
|
|
3817
|
+
adapter.status === "ready" && visibleRows.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "px-1 py-1 text-[11px] text-muted-foreground", children: "Nothing attached yet \u2014 use Add to link anything." }),
|
|
3818
|
+
visibleRows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "space-y-2.5", children: grouped.map(({ role, tokens: tokenGroups }) => {
|
|
3624
3819
|
const roleMeta = getContentRoleMeta(role);
|
|
3625
|
-
return /* @__PURE__ */ (0,
|
|
3626
|
-
variant === "full" && /* @__PURE__ */ (0,
|
|
3627
|
-
/* @__PURE__ */ (0,
|
|
3820
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "space-y-1.5", children: [
|
|
3821
|
+
variant === "full" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1.5 px-1", children: [
|
|
3822
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3628
3823
|
"span",
|
|
3629
3824
|
{
|
|
3630
|
-
className: (0,
|
|
3825
|
+
className: (0, import_design_system9.cn)(
|
|
3631
3826
|
"h-3 w-0.5 rounded-full",
|
|
3632
3827
|
roleMeta.accentBar
|
|
3633
3828
|
)
|
|
3634
3829
|
}
|
|
3635
3830
|
),
|
|
3636
|
-
/* @__PURE__ */ (0,
|
|
3831
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3637
3832
|
"p",
|
|
3638
3833
|
{
|
|
3639
|
-
className: (0,
|
|
3834
|
+
className: (0, import_design_system9.cn)(
|
|
3640
3835
|
"text-[10px] font-semibold uppercase tracking-wider",
|
|
3641
3836
|
roleMeta.accentText
|
|
3642
3837
|
),
|
|
@@ -3646,28 +3841,28 @@ function AssociationList(props) {
|
|
|
3646
3841
|
] }),
|
|
3647
3842
|
tokenGroups.map(({ info, token, rows: tokenRows }) => {
|
|
3648
3843
|
const TokenIcon = info?.Icon ?? null;
|
|
3649
|
-
return /* @__PURE__ */ (0,
|
|
3650
|
-
/* @__PURE__ */ (0,
|
|
3651
|
-
/* @__PURE__ */ (0,
|
|
3652
|
-
TokenIcon ? /* @__PURE__ */ (0,
|
|
3844
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "space-y-0.5", children: [
|
|
3845
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center justify-between gap-1 px-1", children: [
|
|
3846
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { className: "flex items-center gap-1 text-[10px] font-medium text-muted-foreground/80", children: [
|
|
3847
|
+
TokenIcon ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TokenIcon, { className: "h-3 w-3" }) : null,
|
|
3653
3848
|
info?.labelPlural ?? titleize(token),
|
|
3654
|
-
/* @__PURE__ */ (0,
|
|
3849
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-muted-foreground/50", children: tokenRows.length })
|
|
3655
3850
|
] }),
|
|
3656
|
-
/* @__PURE__ */ (0,
|
|
3851
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
3657
3852
|
props.renderSectionActions && info ? props.renderSectionActions(info.token) : null,
|
|
3658
|
-
info?.canListCandidates && /* @__PURE__ */ (0,
|
|
3853
|
+
info?.canListCandidates && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3659
3854
|
"button",
|
|
3660
3855
|
{
|
|
3661
3856
|
type: "button",
|
|
3662
3857
|
onClick: () => setPickerToken(info.token),
|
|
3663
3858
|
title: `Add ${info.labelPlural}`,
|
|
3664
3859
|
className: "rounded p-0.5 text-muted-foreground/60 transition-colors hover:bg-accent hover:text-foreground",
|
|
3665
|
-
children: /* @__PURE__ */ (0,
|
|
3860
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PlusIcon, { className: "h-3 w-3" })
|
|
3666
3861
|
}
|
|
3667
3862
|
)
|
|
3668
3863
|
] })
|
|
3669
3864
|
] }),
|
|
3670
|
-
/* @__PURE__ */ (0,
|
|
3865
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("ul", { className: "space-y-0.5", children: tokenRows.map((row) => {
|
|
3671
3866
|
const busy = removingKeys.has(row.key);
|
|
3672
3867
|
const custom = props.renderRow?.(row, {
|
|
3673
3868
|
title: titleFor({
|
|
@@ -3680,12 +3875,12 @@ function AssociationList(props) {
|
|
|
3680
3875
|
onOpen: () => openRow(row)
|
|
3681
3876
|
});
|
|
3682
3877
|
if (custom != null) {
|
|
3683
|
-
return /* @__PURE__ */ (0,
|
|
3878
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("li", { children: custom }, row.key);
|
|
3684
3879
|
}
|
|
3685
|
-
return /* @__PURE__ */ (0,
|
|
3880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
3686
3881
|
"div",
|
|
3687
3882
|
{
|
|
3688
|
-
className: (0,
|
|
3883
|
+
className: (0, import_design_system9.cn)(
|
|
3689
3884
|
"group flex items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors hover:bg-accent",
|
|
3690
3885
|
busy && "opacity-50"
|
|
3691
3886
|
),
|
|
@@ -3694,7 +3889,7 @@ function AssociationList(props) {
|
|
|
3694
3889
|
token: row.token,
|
|
3695
3890
|
id: row.resourceId,
|
|
3696
3891
|
label: row.label
|
|
3697
|
-
}) ? /* @__PURE__ */ (0,
|
|
3892
|
+
}) ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "min-w-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(UnresolvedRef, { token: row.token, id: row.resourceId }) }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3698
3893
|
DoorRef,
|
|
3699
3894
|
{
|
|
3700
3895
|
token: row.token,
|
|
@@ -3710,9 +3905,9 @@ function AssociationList(props) {
|
|
|
3710
3905
|
className: "min-w-0 flex-1 text-foreground"
|
|
3711
3906
|
}
|
|
3712
3907
|
),
|
|
3713
|
-
row.originRefs && row.originRefs.length > 0 ? /* @__PURE__ */ (0,
|
|
3908
|
+
row.originRefs && row.originRefs.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "flex shrink-0 items-center gap-1 text-[10px] text-muted-foreground/60", children: [
|
|
3714
3909
|
"via",
|
|
3715
|
-
row.originRefs.map((origin) => /* @__PURE__ */ (0,
|
|
3910
|
+
row.originRefs.map((origin) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3716
3911
|
DoorRef,
|
|
3717
3912
|
{
|
|
3718
3913
|
token: origin.token,
|
|
@@ -3724,8 +3919,8 @@ function AssociationList(props) {
|
|
|
3724
3919
|
},
|
|
3725
3920
|
`${origin.token}:${origin.id}`
|
|
3726
3921
|
))
|
|
3727
|
-
] }) : row.originNote ? /* @__PURE__ */ (0,
|
|
3728
|
-
adapter.setPinned && info && row.removable && /* @__PURE__ */ (0,
|
|
3922
|
+
] }) : row.originNote ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "shrink-0 text-[10px] text-muted-foreground/60", children: row.originNote }) : null,
|
|
3923
|
+
adapter.setPinned && info && row.removable && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3729
3924
|
"button",
|
|
3730
3925
|
{
|
|
3731
3926
|
type: "button",
|
|
@@ -3733,14 +3928,14 @@ function AssociationList(props) {
|
|
|
3733
3928
|
onClick: () => void handlePin(row, !(row.pinned ?? false)),
|
|
3734
3929
|
title: row.pinned ? "Unpin (stops staying in agent context)" : "Pin \u2014 always in agent context",
|
|
3735
3930
|
"aria-label": row.pinned ? "Unpin" : "Pin",
|
|
3736
|
-
className: (0,
|
|
3931
|
+
className: (0, import_design_system9.cn)(
|
|
3737
3932
|
"shrink-0 rounded p-0.5 transition-colors hover:!text-foreground",
|
|
3738
3933
|
row.pinned ? "text-primary" : "text-muted-foreground/0 group-hover:text-muted-foreground"
|
|
3739
3934
|
),
|
|
3740
|
-
children: pinningKeys.has(row.key) ? /* @__PURE__ */ (0,
|
|
3935
|
+
children: pinningKeys.has(row.key) ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SpinnerIcon, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3741
3936
|
PinIcon,
|
|
3742
3937
|
{
|
|
3743
|
-
className: (0,
|
|
3938
|
+
className: (0, import_design_system9.cn)(
|
|
3744
3939
|
"h-3 w-3",
|
|
3745
3940
|
row.pinned && "fill-primary/20"
|
|
3746
3941
|
)
|
|
@@ -3748,7 +3943,7 @@ function AssociationList(props) {
|
|
|
3748
3943
|
)
|
|
3749
3944
|
}
|
|
3750
3945
|
),
|
|
3751
|
-
row.removable && /* @__PURE__ */ (0,
|
|
3946
|
+
row.removable && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3752
3947
|
"button",
|
|
3753
3948
|
{
|
|
3754
3949
|
type: "button",
|
|
@@ -3757,7 +3952,7 @@ function AssociationList(props) {
|
|
|
3757
3952
|
title: "Detach",
|
|
3758
3953
|
"aria-label": "Detach",
|
|
3759
3954
|
className: "shrink-0 rounded p-0.5 text-muted-foreground/0 transition-colors group-hover:text-muted-foreground hover:!text-destructive disabled:opacity-50",
|
|
3760
|
-
children: busy ? /* @__PURE__ */ (0,
|
|
3955
|
+
children: busy ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SpinnerIcon, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(XIcon, { className: "h-3 w-3" })
|
|
3761
3956
|
}
|
|
3762
3957
|
)
|
|
3763
3958
|
]
|
|
@@ -3768,7 +3963,7 @@ function AssociationList(props) {
|
|
|
3768
3963
|
})
|
|
3769
3964
|
] }, role);
|
|
3770
3965
|
}) }),
|
|
3771
|
-
pickerToken && /* @__PURE__ */ (0,
|
|
3966
|
+
pickerToken && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3772
3967
|
AssociationPicker,
|
|
3773
3968
|
{
|
|
3774
3969
|
open: true,
|
|
@@ -3825,8 +4020,8 @@ function titleize(token) {
|
|
|
3825
4020
|
|
|
3826
4021
|
// src/react/components/AssociationCaptureToolbar.tsx
|
|
3827
4022
|
var import_react18 = require("react");
|
|
3828
|
-
var
|
|
3829
|
-
var
|
|
4023
|
+
var import_design_system10 = require("@ai-matrx/design-system");
|
|
4024
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
3830
4025
|
function AssociationCaptureToolbar({
|
|
3831
4026
|
attach,
|
|
3832
4027
|
uploadFolderPath,
|
|
@@ -4057,10 +4252,10 @@ function AssociationCaptureToolbar({
|
|
|
4057
4252
|
}
|
|
4058
4253
|
};
|
|
4059
4254
|
const anyBuiltIn = actions.upload || actions.addFile || actions.newDocument;
|
|
4060
|
-
return /* @__PURE__ */ (0,
|
|
4255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
4061
4256
|
"div",
|
|
4062
4257
|
{
|
|
4063
|
-
className: (0,
|
|
4258
|
+
className: (0, import_design_system10.cn)(
|
|
4064
4259
|
"relative flex h-full min-h-0 flex-col",
|
|
4065
4260
|
isDragOver && "ring-2 ring-inset ring-primary/50",
|
|
4066
4261
|
className
|
|
@@ -4078,11 +4273,11 @@ function AssociationCaptureToolbar({
|
|
|
4078
4273
|
},
|
|
4079
4274
|
onDrop: handleDrop,
|
|
4080
4275
|
children: [
|
|
4081
|
-
isDragOver ? /* @__PURE__ */ (0,
|
|
4082
|
-
/* @__PURE__ */ (0,
|
|
4276
|
+
isDragOver ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "pointer-events-none absolute inset-0 z-10 grid place-items-center bg-background/70", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "flex items-center gap-2 rounded-md border border-primary/40 bg-card px-3 py-1.5 text-xs font-medium text-foreground", children: [
|
|
4277
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(UploadIcon, { className: "size-3.5 text-primary" }),
|
|
4083
4278
|
"Drop to upload & attach"
|
|
4084
4279
|
] }) }) : null,
|
|
4085
|
-
/* @__PURE__ */ (0,
|
|
4280
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4086
4281
|
"input",
|
|
4087
4282
|
{
|
|
4088
4283
|
ref: fileInputRef,
|
|
@@ -4092,9 +4287,9 @@ function AssociationCaptureToolbar({
|
|
|
4092
4287
|
onChange: handleFilesSelected
|
|
4093
4288
|
}
|
|
4094
4289
|
),
|
|
4095
|
-
showToolbar && (anyBuiltIn || extraActions) ? /* @__PURE__ */ (0,
|
|
4096
|
-
/* @__PURE__ */ (0,
|
|
4097
|
-
|
|
4290
|
+
showToolbar && (anyBuiltIn || extraActions) ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex flex-wrap items-center gap-0.5 border-b border-border/60 px-1.5 py-1", children: namingDoc ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-1 items-center gap-1.5 py-0.5", children: [
|
|
4291
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4292
|
+
import_design_system10.Input,
|
|
4098
4293
|
{
|
|
4099
4294
|
autoFocus: true,
|
|
4100
4295
|
value: docName,
|
|
@@ -4112,17 +4307,17 @@ function AssociationCaptureToolbar({
|
|
|
4112
4307
|
style: { fontSize: 16 }
|
|
4113
4308
|
}
|
|
4114
4309
|
),
|
|
4115
|
-
/* @__PURE__ */ (0,
|
|
4310
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4116
4311
|
"button",
|
|
4117
4312
|
{
|
|
4118
4313
|
type: "button",
|
|
4119
4314
|
disabled: creatingDoc || !docName.trim(),
|
|
4120
4315
|
onClick: () => void handleCreateDoc(),
|
|
4121
4316
|
className: "flex h-7 items-center rounded-md bg-primary px-2 text-[11px] font-medium text-primary-foreground disabled:opacity-50",
|
|
4122
|
-
children: creatingDoc ? /* @__PURE__ */ (0,
|
|
4317
|
+
children: creatingDoc ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SpinnerIcon, { className: "size-3.5 animate-spin" }) : "Create"
|
|
4123
4318
|
}
|
|
4124
4319
|
),
|
|
4125
|
-
/* @__PURE__ */ (0,
|
|
4320
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4126
4321
|
"button",
|
|
4127
4322
|
{
|
|
4128
4323
|
type: "button",
|
|
@@ -4135,8 +4330,8 @@ function AssociationCaptureToolbar({
|
|
|
4135
4330
|
children: "Cancel"
|
|
4136
4331
|
}
|
|
4137
4332
|
)
|
|
4138
|
-
] }) : /* @__PURE__ */ (0,
|
|
4139
|
-
actions.upload ? /* @__PURE__ */ (0,
|
|
4333
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
4334
|
+
actions.upload ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4140
4335
|
CaptureToolbarAction,
|
|
4141
4336
|
{
|
|
4142
4337
|
icon: isUploading ? SpinnerIcon : UploadIcon,
|
|
@@ -4146,7 +4341,7 @@ function AssociationCaptureToolbar({
|
|
|
4146
4341
|
disabled: isPicking || isUploading
|
|
4147
4342
|
}
|
|
4148
4343
|
) : null,
|
|
4149
|
-
actions.addFile ? /* @__PURE__ */ (0,
|
|
4344
|
+
actions.addFile ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4150
4345
|
CaptureToolbarAction,
|
|
4151
4346
|
{
|
|
4152
4347
|
icon: isPicking ? SpinnerIcon : FolderOpenIcon,
|
|
@@ -4156,8 +4351,8 @@ function AssociationCaptureToolbar({
|
|
|
4156
4351
|
disabled: isPicking || isUploading
|
|
4157
4352
|
}
|
|
4158
4353
|
) : null,
|
|
4159
|
-
(actions.upload || actions.addFile) && actions.newDocument ? /* @__PURE__ */ (0,
|
|
4160
|
-
actions.newDocument ? /* @__PURE__ */ (0,
|
|
4354
|
+
(actions.upload || actions.addFile) && actions.newDocument ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "mx-1 h-4 w-px bg-border" }) : null,
|
|
4355
|
+
actions.newDocument ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4161
4356
|
CaptureToolbarAction,
|
|
4162
4357
|
{
|
|
4163
4358
|
icon: creatingDoc ? SpinnerIcon : PlusIcon,
|
|
@@ -4181,8 +4376,8 @@ function CaptureToolbarAction({
|
|
|
4181
4376
|
disabled,
|
|
4182
4377
|
spinning
|
|
4183
4378
|
}) {
|
|
4184
|
-
return /* @__PURE__ */ (0,
|
|
4185
|
-
|
|
4379
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
4380
|
+
import_design_system10.Button,
|
|
4186
4381
|
{
|
|
4187
4382
|
type: "button",
|
|
4188
4383
|
size: "sm",
|
|
@@ -4191,7 +4386,7 @@ function CaptureToolbarAction({
|
|
|
4191
4386
|
disabled,
|
|
4192
4387
|
className: "h-7 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground",
|
|
4193
4388
|
children: [
|
|
4194
|
-
/* @__PURE__ */ (0,
|
|
4389
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon, { className: (0, import_design_system10.cn)("size-3.5", spinning && "animate-spin") }),
|
|
4195
4390
|
label
|
|
4196
4391
|
]
|
|
4197
4392
|
}
|
|
@@ -4200,7 +4395,7 @@ function CaptureToolbarAction({
|
|
|
4200
4395
|
|
|
4201
4396
|
// src/react/lazyPorts.tsx
|
|
4202
4397
|
var import_react19 = require("react");
|
|
4203
|
-
var
|
|
4398
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
4204
4399
|
function lazyComponent(load) {
|
|
4205
4400
|
return (0, import_react19.lazy)(async () => {
|
|
4206
4401
|
const loaded = await load();
|
|
@@ -4210,14 +4405,14 @@ function lazyComponent(load) {
|
|
|
4210
4405
|
function lazyWindowShell(load) {
|
|
4211
4406
|
const Loaded = lazyComponent(load);
|
|
4212
4407
|
return function LazyWindowShell(props) {
|
|
4213
|
-
return /* @__PURE__ */ (0,
|
|
4408
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react19.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Loaded, { ...props }) });
|
|
4214
4409
|
};
|
|
4215
4410
|
}
|
|
4216
4411
|
function lazyPickerOverride(load) {
|
|
4217
4412
|
const Loaded = lazyComponent(load);
|
|
4218
4413
|
return function LazyPickerOverride(props) {
|
|
4219
4414
|
if (!props.open) return null;
|
|
4220
|
-
return /* @__PURE__ */ (0,
|
|
4415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react19.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Loaded, { ...props }) });
|
|
4221
4416
|
};
|
|
4222
4417
|
}
|
|
4223
4418
|
|
|
@@ -4330,8 +4525,8 @@ function useAssociationPickerBridge(props, options = {}) {
|
|
|
4330
4525
|
|
|
4331
4526
|
// src/react/components/AssociationEntitySelect.tsx
|
|
4332
4527
|
var import_react21 = require("react");
|
|
4333
|
-
var
|
|
4334
|
-
var
|
|
4528
|
+
var import_design_system11 = require("@ai-matrx/design-system");
|
|
4529
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
4335
4530
|
function AssociationEntitySelect({
|
|
4336
4531
|
token,
|
|
4337
4532
|
adapter,
|
|
@@ -4372,26 +4567,26 @@ function AssociationEntitySelect({
|
|
|
4372
4567
|
if (id) close();
|
|
4373
4568
|
else notifier.error(`Couldn't create the ${entityLabel}`);
|
|
4374
4569
|
};
|
|
4375
|
-
return /* @__PURE__ */ (0,
|
|
4570
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
4376
4571
|
"div",
|
|
4377
4572
|
{
|
|
4378
|
-
className: (0,
|
|
4573
|
+
className: (0, import_design_system11.cn)(
|
|
4379
4574
|
"group/entity-ref flex min-w-0 items-center gap-0.5",
|
|
4380
4575
|
className
|
|
4381
4576
|
),
|
|
4382
4577
|
children: [
|
|
4383
|
-
showIcon ? /* @__PURE__ */ (0,
|
|
4578
|
+
showIcon ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
4384
4579
|
InfoIcon,
|
|
4385
4580
|
{
|
|
4386
|
-
className: (0,
|
|
4581
|
+
className: (0, import_design_system11.cn)(
|
|
4387
4582
|
"size-3.5 shrink-0",
|
|
4388
4583
|
iconClassName ?? "text-muted-foreground"
|
|
4389
4584
|
),
|
|
4390
4585
|
"aria-hidden": true
|
|
4391
4586
|
}
|
|
4392
4587
|
) : null,
|
|
4393
|
-
active ? /* @__PURE__ */ (0,
|
|
4394
|
-
|
|
4588
|
+
active ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
4589
|
+
import_design_system11.EditableLabel,
|
|
4395
4590
|
{
|
|
4396
4591
|
value: active.title,
|
|
4397
4592
|
onCommit: async (next) => {
|
|
@@ -4404,29 +4599,29 @@ function AssociationEntitySelect({
|
|
|
4404
4599
|
commitMode: "await",
|
|
4405
4600
|
activation: renameActivation,
|
|
4406
4601
|
ariaLabel: info.label,
|
|
4407
|
-
className: (0,
|
|
4602
|
+
className: (0, import_design_system11.cn)("max-w-[14rem]", labelClassName),
|
|
4408
4603
|
displayClassName: "text-xs font-medium text-foreground",
|
|
4409
4604
|
inputClassName: "text-xs font-medium"
|
|
4410
4605
|
}
|
|
4411
4606
|
) : null,
|
|
4412
|
-
active ? /* @__PURE__ */ (0,
|
|
4413
|
-
!active ? /* @__PURE__ */ (0,
|
|
4607
|
+
active ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DoorControlsSlot, { token, id: active.id, name: active.title }) : null,
|
|
4608
|
+
!active ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
4414
4609
|
"span",
|
|
4415
4610
|
{
|
|
4416
|
-
className: (0,
|
|
4611
|
+
className: (0, import_design_system11.cn)(
|
|
4417
4612
|
"truncate px-1 text-xs font-medium text-muted-foreground",
|
|
4418
4613
|
labelClassName
|
|
4419
4614
|
),
|
|
4420
4615
|
children: adapter.loading ? "\u2026" : emptyLabel ?? info.labelPlural
|
|
4421
4616
|
}
|
|
4422
4617
|
) : null,
|
|
4423
|
-
/* @__PURE__ */ (0,
|
|
4424
|
-
|
|
4618
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
4619
|
+
import_design_system11.Popover,
|
|
4425
4620
|
{
|
|
4426
4621
|
open,
|
|
4427
4622
|
onOpenChange: (next) => next ? setOpen(true) : close(),
|
|
4428
4623
|
children: [
|
|
4429
|
-
/* @__PURE__ */ (0,
|
|
4624
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system11.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
4430
4625
|
"button",
|
|
4431
4626
|
{
|
|
4432
4627
|
type: "button",
|
|
@@ -4434,28 +4629,28 @@ function AssociationEntitySelect({
|
|
|
4434
4629
|
title: `Switch or add ${info.labelPlural.toLowerCase()}`,
|
|
4435
4630
|
"aria-label": `Switch or add ${info.labelPlural.toLowerCase()}`,
|
|
4436
4631
|
children: [
|
|
4437
|
-
items.length > 1 ? /* @__PURE__ */ (0,
|
|
4632
|
+
items.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "tabular-nums", children: [
|
|
4438
4633
|
activeIndex >= 0 ? activeIndex + 1 : "\u2014",
|
|
4439
4634
|
"/",
|
|
4440
4635
|
items.length
|
|
4441
4636
|
] }) : null,
|
|
4442
|
-
/* @__PURE__ */ (0,
|
|
4637
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ChevronDownIcon, { className: "size-3 opacity-60" })
|
|
4443
4638
|
]
|
|
4444
4639
|
}
|
|
4445
4640
|
) }),
|
|
4446
|
-
/* @__PURE__ */ (0,
|
|
4447
|
-
items.length > 5 ? /* @__PURE__ */ (0,
|
|
4448
|
-
|
|
4641
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system11.PopoverContent, { sizing: "content", className: "p-0", align, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_design_system11.Command, { children: [
|
|
4642
|
+
items.length > 5 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
4643
|
+
import_design_system11.CommandInput,
|
|
4449
4644
|
{
|
|
4450
4645
|
value: query,
|
|
4451
4646
|
onValueChange: setQuery,
|
|
4452
4647
|
placeholder: `Search ${info.labelPlural.toLowerCase()}\u2026`
|
|
4453
4648
|
}
|
|
4454
4649
|
) : null,
|
|
4455
|
-
/* @__PURE__ */ (0,
|
|
4456
|
-
/* @__PURE__ */ (0,
|
|
4457
|
-
items.length > 0 ? /* @__PURE__ */ (0,
|
|
4458
|
-
|
|
4650
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_design_system11.CommandList, { children: [
|
|
4651
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system11.CommandEmpty, { children: "No match." }),
|
|
4652
|
+
items.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system11.CommandGroup, { children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
4653
|
+
import_design_system11.CommandItem,
|
|
4459
4654
|
{
|
|
4460
4655
|
value: `${item.title} ${item.id}`,
|
|
4461
4656
|
onSelect: () => {
|
|
@@ -4465,17 +4660,17 @@ function AssociationEntitySelect({
|
|
|
4465
4660
|
},
|
|
4466
4661
|
className: "group/entity-ref group gap-2",
|
|
4467
4662
|
children: [
|
|
4468
|
-
/* @__PURE__ */ (0,
|
|
4663
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
4469
4664
|
CheckIcon,
|
|
4470
4665
|
{
|
|
4471
|
-
className: (0,
|
|
4666
|
+
className: (0, import_design_system11.cn)(
|
|
4472
4667
|
"size-3.5 shrink-0",
|
|
4473
4668
|
item.id === activeId ? "opacity-100" : "opacity-0"
|
|
4474
4669
|
)
|
|
4475
4670
|
}
|
|
4476
4671
|
),
|
|
4477
|
-
/* @__PURE__ */ (0,
|
|
4478
|
-
/* @__PURE__ */ (0,
|
|
4672
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "min-w-0 flex-1 truncate", children: item.title }),
|
|
4673
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
4479
4674
|
"span",
|
|
4480
4675
|
{
|
|
4481
4676
|
className: "inline-flex shrink-0 items-center",
|
|
@@ -4483,7 +4678,7 @@ function AssociationEntitySelect({
|
|
|
4483
4678
|
e.preventDefault();
|
|
4484
4679
|
e.stopPropagation();
|
|
4485
4680
|
},
|
|
4486
|
-
children: /* @__PURE__ */ (0,
|
|
4681
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
4487
4682
|
DoorControlsSlot,
|
|
4488
4683
|
{
|
|
4489
4684
|
token,
|
|
@@ -4493,7 +4688,7 @@ function AssociationEntitySelect({
|
|
|
4493
4688
|
)
|
|
4494
4689
|
}
|
|
4495
4690
|
),
|
|
4496
|
-
adapter.detach && item.id !== activeId ? /* @__PURE__ */ (0,
|
|
4691
|
+
adapter.detach && item.id !== activeId ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
4497
4692
|
"button",
|
|
4498
4693
|
{
|
|
4499
4694
|
type: "button",
|
|
@@ -4508,7 +4703,7 @@ function AssociationEntitySelect({
|
|
|
4508
4703
|
className: "grid size-5 shrink-0 place-items-center rounded text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-destructive group-hover:opacity-100",
|
|
4509
4704
|
title: `Remove this ${entityLabel} from here (does not delete it)`,
|
|
4510
4705
|
"aria-label": `Remove ${item.title}`,
|
|
4511
|
-
children: /* @__PURE__ */ (0,
|
|
4706
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(XIcon, { className: "size-3" })
|
|
4512
4707
|
}
|
|
4513
4708
|
) : null
|
|
4514
4709
|
]
|
|
@@ -4516,9 +4711,9 @@ function AssociationEntitySelect({
|
|
|
4516
4711
|
item.id
|
|
4517
4712
|
)) }) : null
|
|
4518
4713
|
] }),
|
|
4519
|
-
createSlot !== void 0 ? /* @__PURE__ */ (0,
|
|
4520
|
-
createSlot === void 0 && adapter.createAndAttach ? /* @__PURE__ */ (0,
|
|
4521
|
-
/* @__PURE__ */ (0,
|
|
4714
|
+
createSlot !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "border-t border-border p-1", children: typeof createSlot === "function" ? createSlot(close) : createSlot }) : null,
|
|
4715
|
+
createSlot === void 0 && adapter.createAndAttach ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "border-t border-border p-1", children: creating ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1 px-1 py-0.5", children: [
|
|
4716
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
4522
4717
|
"input",
|
|
4523
4718
|
{
|
|
4524
4719
|
autoFocus: true,
|
|
@@ -4542,17 +4737,17 @@ function AssociationEntitySelect({
|
|
|
4542
4737
|
"aria-label": `New ${entityLabel} name`
|
|
4543
4738
|
}
|
|
4544
4739
|
),
|
|
4545
|
-
/* @__PURE__ */ (0,
|
|
4740
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
4546
4741
|
"button",
|
|
4547
4742
|
{
|
|
4548
4743
|
type: "button",
|
|
4549
4744
|
disabled: busy || !draftName.trim(),
|
|
4550
4745
|
onClick: () => void create(draftName),
|
|
4551
4746
|
className: "inline-flex h-6 shrink-0 items-center rounded-md px-1.5 text-[10px] font-medium text-primary transition-colors hover:bg-accent disabled:opacity-50",
|
|
4552
|
-
children: busy ? /* @__PURE__ */ (0,
|
|
4747
|
+
children: busy ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SpinnerIcon, { className: "size-3 animate-spin" }) : "Create"
|
|
4553
4748
|
}
|
|
4554
4749
|
)
|
|
4555
|
-
] }) : /* @__PURE__ */ (0,
|
|
4750
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
4556
4751
|
"button",
|
|
4557
4752
|
{
|
|
4558
4753
|
type: "button",
|
|
@@ -4563,7 +4758,7 @@ function AssociationEntitySelect({
|
|
|
4563
4758
|
},
|
|
4564
4759
|
className: "flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
|
|
4565
4760
|
children: [
|
|
4566
|
-
busy ? /* @__PURE__ */ (0,
|
|
4761
|
+
busy ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SpinnerIcon, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(PlusIcon, { className: "size-3.5" }),
|
|
4567
4762
|
query.trim() ? `Create "${query.trim()}"` : `New ${info.label}`
|
|
4568
4763
|
]
|
|
4569
4764
|
}
|
|
@@ -4579,7 +4774,7 @@ function AssociationEntitySelect({
|
|
|
4579
4774
|
|
|
4580
4775
|
// src/react/components/CategorySelect.tsx
|
|
4581
4776
|
var import_react22 = require("react");
|
|
4582
|
-
var
|
|
4777
|
+
var import_design_system12 = require("@ai-matrx/design-system");
|
|
4583
4778
|
|
|
4584
4779
|
// src/core/categoryHierarchy.ts
|
|
4585
4780
|
function buildCategoryHierarchy(categories) {
|
|
@@ -4646,7 +4841,7 @@ function buildCategoryHierarchy(categories) {
|
|
|
4646
4841
|
}
|
|
4647
4842
|
|
|
4648
4843
|
// src/react/components/CategorySelect.tsx
|
|
4649
|
-
var
|
|
4844
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
4650
4845
|
var NONE = "__none__";
|
|
4651
4846
|
var ROOT_PARENT = "__root__";
|
|
4652
4847
|
function plural(noun) {
|
|
@@ -4682,9 +4877,9 @@ function CategorySelect({
|
|
|
4682
4877
|
// The type-ahead matches the parent's name too, so someone who knows
|
|
4683
4878
|
// the branch but not the leaf still finds it.
|
|
4684
4879
|
keywords: parent ? parent.name : "",
|
|
4685
|
-
render: depth === 0 ? /* @__PURE__ */ (0,
|
|
4686
|
-
/* @__PURE__ */ (0,
|
|
4687
|
-
/* @__PURE__ */ (0,
|
|
4880
|
+
render: depth === 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "font-medium", children: category.name }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "flex items-center gap-1.5 pl-3 text-muted-foreground", children: [
|
|
4881
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CornerDownRightIcon, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
4882
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-foreground", children: category.name })
|
|
4688
4883
|
] })
|
|
4689
4884
|
})) : categories.map((category) => ({
|
|
4690
4885
|
value: category.id,
|
|
@@ -4731,9 +4926,9 @@ function CategorySelect({
|
|
|
4731
4926
|
);
|
|
4732
4927
|
return result.id;
|
|
4733
4928
|
};
|
|
4734
|
-
return /* @__PURE__ */ (0,
|
|
4735
|
-
/* @__PURE__ */ (0,
|
|
4736
|
-
|
|
4929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { children: [
|
|
4930
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
4931
|
+
import_design_system12.CreatablePicker,
|
|
4737
4932
|
{
|
|
4738
4933
|
value: value ?? (allowNone ? NONE : null),
|
|
4739
4934
|
onSelect: (next) => onChange(next === NONE ? null : next),
|
|
@@ -4748,19 +4943,19 @@ function CategorySelect({
|
|
|
4748
4943
|
emptyLabel: `No ${noun} matches that.`,
|
|
4749
4944
|
...allowCreate ? { onCreate: create } : {},
|
|
4750
4945
|
...allowCreate && hierarchy.hasHierarchy ? {
|
|
4751
|
-
createExtra: /* @__PURE__ */ (0,
|
|
4752
|
-
/* @__PURE__ */ (0,
|
|
4753
|
-
|
|
4946
|
+
createExtra: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_design_system12.Select, { value: createParentId, onValueChange: setCreateParentId, children: [
|
|
4947
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
4948
|
+
import_design_system12.SelectTrigger,
|
|
4754
4949
|
{
|
|
4755
4950
|
className: "h-7 text-xs",
|
|
4756
4951
|
"aria-label": `Put the new ${noun} under`,
|
|
4757
|
-
children: /* @__PURE__ */ (0,
|
|
4952
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system12.SelectValue, {})
|
|
4758
4953
|
}
|
|
4759
4954
|
),
|
|
4760
|
-
/* @__PURE__ */ (0,
|
|
4761
|
-
/* @__PURE__ */ (0,
|
|
4762
|
-
hierarchy.items.filter((item) => item.depth === 0).map((item) => /* @__PURE__ */ (0,
|
|
4763
|
-
|
|
4955
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_design_system12.SelectContent, { children: [
|
|
4956
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system12.SelectItem, { value: ROOT_PARENT, className: "text-xs", children: "Top level" }),
|
|
4957
|
+
hierarchy.items.filter((item) => item.depth === 0).map((item) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
4958
|
+
import_design_system12.SelectItem,
|
|
4764
4959
|
{
|
|
4765
4960
|
value: item.category.id,
|
|
4766
4961
|
className: "text-xs",
|
|
@@ -4779,20 +4974,20 @@ function CategorySelect({
|
|
|
4779
4974
|
selected === null && value !== null ? (
|
|
4780
4975
|
// A stored id whose row this reader cannot see is not "nothing chosen":
|
|
4781
4976
|
// saying so beats a blank box that looks like an unsaved field.
|
|
4782
|
-
/* @__PURE__ */ (0,
|
|
4977
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("p", { className: "mt-1 text-xs text-muted-foreground", children: [
|
|
4783
4978
|
"This ",
|
|
4784
4979
|
noun,
|
|
4785
4980
|
" is no longer available to you."
|
|
4786
4981
|
] })
|
|
4787
4982
|
) : null,
|
|
4788
|
-
error ? /* @__PURE__ */ (0,
|
|
4983
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "mt-1 text-xs text-destructive", children: error }) : null
|
|
4789
4984
|
] });
|
|
4790
4985
|
}
|
|
4791
4986
|
|
|
4792
4987
|
// src/react/components/CategoryTagPicker.tsx
|
|
4793
4988
|
var import_react23 = require("react");
|
|
4794
|
-
var
|
|
4795
|
-
var
|
|
4989
|
+
var import_design_system13 = require("@ai-matrx/design-system");
|
|
4990
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
4796
4991
|
var ROOT_PARENT2 = "__root__";
|
|
4797
4992
|
function CategoryTagPicker({
|
|
4798
4993
|
entityType,
|
|
@@ -4916,86 +5111,86 @@ function CategoryTagPicker({
|
|
|
4916
5111
|
const exactMatch = categories.some(
|
|
4917
5112
|
(c) => c.name.toLowerCase() === search.trim().toLowerCase()
|
|
4918
5113
|
);
|
|
4919
|
-
return /* @__PURE__ */ (0,
|
|
4920
|
-
selected.map((c) => /* @__PURE__ */ (0,
|
|
4921
|
-
|
|
5114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
5115
|
+
selected.map((c) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
5116
|
+
import_design_system13.Badge,
|
|
4922
5117
|
{
|
|
4923
5118
|
variant: "secondary",
|
|
4924
5119
|
className: "gap-1 pr-1 text-xs font-medium",
|
|
4925
5120
|
children: [
|
|
4926
5121
|
showHierarchy ? hierarchyById.get(c.id)?.displayName ?? c.name : c.name,
|
|
4927
|
-
/* @__PURE__ */ (0,
|
|
5122
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4928
5123
|
"button",
|
|
4929
5124
|
{
|
|
4930
5125
|
type: "button",
|
|
4931
5126
|
onClick: () => void toggle(c.id),
|
|
4932
5127
|
className: "ml-0.5 rounded-full p-0.5 hover:bg-muted-foreground/20",
|
|
4933
5128
|
"aria-label": `Remove ${c.name}`,
|
|
4934
|
-
children: /* @__PURE__ */ (0,
|
|
5129
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(XIcon, { className: "h-2.5 w-2.5" })
|
|
4935
5130
|
}
|
|
4936
5131
|
)
|
|
4937
5132
|
]
|
|
4938
5133
|
},
|
|
4939
5134
|
c.id
|
|
4940
5135
|
)),
|
|
4941
|
-
/* @__PURE__ */ (0,
|
|
4942
|
-
/* @__PURE__ */ (0,
|
|
4943
|
-
|
|
5136
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_design_system13.Popover, { open, onOpenChange: setOpen, children: [
|
|
5137
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system13.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
5138
|
+
import_design_system13.Button,
|
|
4944
5139
|
{
|
|
4945
5140
|
variant: "outline",
|
|
4946
5141
|
size: "sm",
|
|
4947
5142
|
className: "h-7 gap-1 px-2 text-xs",
|
|
4948
5143
|
children: [
|
|
4949
|
-
/* @__PURE__ */ (0,
|
|
5144
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon, { className: "h-3.5 w-3.5" }),
|
|
4950
5145
|
selected.length === 0 ? addLabel : "Edit",
|
|
4951
|
-
/* @__PURE__ */ (0,
|
|
5146
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronsUpDownIcon, { className: "h-3 w-3 opacity-50" })
|
|
4952
5147
|
]
|
|
4953
5148
|
}
|
|
4954
5149
|
) }),
|
|
4955
|
-
/* @__PURE__ */ (0,
|
|
4956
|
-
/* @__PURE__ */ (0,
|
|
4957
|
-
|
|
5150
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system13.PopoverContent, { sizing: "content", className: "p-0", align: "start", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_design_system13.Command, { shouldFilter: false, children: [
|
|
5151
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5152
|
+
import_design_system13.CommandInput,
|
|
4958
5153
|
{
|
|
4959
5154
|
placeholder: allowCreate ? "Search or create..." : "Search...",
|
|
4960
5155
|
value: search,
|
|
4961
5156
|
onValueChange: setSearch
|
|
4962
5157
|
}
|
|
4963
5158
|
),
|
|
4964
|
-
/* @__PURE__ */ (0,
|
|
4965
|
-
/* @__PURE__ */ (0,
|
|
4966
|
-
/* @__PURE__ */ (0,
|
|
4967
|
-
|
|
5159
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_design_system13.CommandList, { children: [
|
|
5160
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system13.CommandEmpty, { className: "px-2 py-3 text-xs text-muted-foreground", children: search.trim() ? "No match." : emptyText }),
|
|
5161
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system13.CommandGroup, { children: showHierarchy ? filteredHierarchy.map(({ category, depth, parent }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
5162
|
+
import_design_system13.CommandItem,
|
|
4968
5163
|
{
|
|
4969
5164
|
value: category.id,
|
|
4970
5165
|
keywords: parent ? [parent.name, category.name] : [],
|
|
4971
5166
|
onSelect: () => void toggle(category.id),
|
|
4972
|
-
className: (0,
|
|
5167
|
+
className: (0, import_design_system13.cn)("text-xs", depth === 1 && "pl-6"),
|
|
4973
5168
|
children: [
|
|
4974
|
-
/* @__PURE__ */ (0,
|
|
5169
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4975
5170
|
CheckIcon,
|
|
4976
5171
|
{
|
|
4977
|
-
className: (0,
|
|
5172
|
+
className: (0, import_design_system13.cn)(
|
|
4978
5173
|
"mr-2 h-3.5 w-3.5",
|
|
4979
5174
|
selectedIds.has(category.id) ? "opacity-100" : "opacity-0"
|
|
4980
5175
|
)
|
|
4981
5176
|
}
|
|
4982
5177
|
),
|
|
4983
|
-
depth === 1 ? /* @__PURE__ */ (0,
|
|
4984
|
-
/* @__PURE__ */ (0,
|
|
5178
|
+
depth === 1 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CornerDownRightIcon, { className: "mr-1.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }) : null,
|
|
5179
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: (0, import_design_system13.cn)(depth === 0 && "font-medium"), children: category.name })
|
|
4985
5180
|
]
|
|
4986
5181
|
},
|
|
4987
5182
|
category.id
|
|
4988
|
-
)) : filtered.map((c) => /* @__PURE__ */ (0,
|
|
4989
|
-
|
|
5183
|
+
)) : filtered.map((c) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
5184
|
+
import_design_system13.CommandItem,
|
|
4990
5185
|
{
|
|
4991
5186
|
value: c.id,
|
|
4992
5187
|
onSelect: () => void toggle(c.id),
|
|
4993
5188
|
className: "text-xs",
|
|
4994
5189
|
children: [
|
|
4995
|
-
/* @__PURE__ */ (0,
|
|
5190
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4996
5191
|
CheckIcon,
|
|
4997
5192
|
{
|
|
4998
|
-
className: (0,
|
|
5193
|
+
className: (0, import_design_system13.cn)(
|
|
4999
5194
|
"mr-2 h-3.5 w-3.5",
|
|
5000
5195
|
selectedIds.has(c.id) ? "opacity-100" : "opacity-0"
|
|
5001
5196
|
)
|
|
@@ -5006,33 +5201,33 @@ function CategoryTagPicker({
|
|
|
5006
5201
|
},
|
|
5007
5202
|
c.id
|
|
5008
5203
|
)) }),
|
|
5009
|
-
allowCreate && search.trim() && !exactMatch ? /* @__PURE__ */ (0,
|
|
5010
|
-
showHierarchy ? /* @__PURE__ */ (0,
|
|
5011
|
-
/* @__PURE__ */ (0,
|
|
5012
|
-
/* @__PURE__ */ (0,
|
|
5013
|
-
|
|
5204
|
+
allowCreate && search.trim() && !exactMatch ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_design_system13.CommandGroup, { children: [
|
|
5205
|
+
showHierarchy ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "space-y-1.5 px-2 pb-2", children: [
|
|
5206
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-[11px] font-medium text-muted-foreground", children: "Place in" }),
|
|
5207
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
5208
|
+
import_design_system13.Select,
|
|
5014
5209
|
{
|
|
5015
5210
|
value: createParentId,
|
|
5016
5211
|
onValueChange: setCreateParentId,
|
|
5017
5212
|
children: [
|
|
5018
|
-
/* @__PURE__ */ (0,
|
|
5019
|
-
/* @__PURE__ */ (0,
|
|
5020
|
-
/* @__PURE__ */ (0,
|
|
5021
|
-
hierarchy.roots.map((root) => /* @__PURE__ */ (0,
|
|
5213
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system13.SelectTrigger, { size: "sm", className: "bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system13.SelectValue, {}) }),
|
|
5214
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_design_system13.SelectContent, { children: [
|
|
5215
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system13.SelectItem, { value: ROOT_PARENT2, children: "Top level" }),
|
|
5216
|
+
hierarchy.roots.map((root) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system13.SelectItem, { value: root.id, children: root.name }, root.id))
|
|
5022
5217
|
] })
|
|
5023
5218
|
]
|
|
5024
5219
|
}
|
|
5025
5220
|
)
|
|
5026
5221
|
] }) : null,
|
|
5027
|
-
/* @__PURE__ */ (0,
|
|
5028
|
-
|
|
5222
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
5223
|
+
import_design_system13.CommandItem,
|
|
5029
5224
|
{
|
|
5030
5225
|
value: `__create__${search}`,
|
|
5031
5226
|
onSelect: () => void createAndAttach(),
|
|
5032
5227
|
disabled: creating,
|
|
5033
5228
|
className: "text-xs text-primary",
|
|
5034
5229
|
children: [
|
|
5035
|
-
creating ? /* @__PURE__ */ (0,
|
|
5230
|
+
creating ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SpinnerIcon, { className: "mr-2 h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon, { className: "mr-2 h-3.5 w-3.5" }),
|
|
5036
5231
|
"Create \u201C",
|
|
5037
5232
|
search.trim(),
|
|
5038
5233
|
"\u201D"
|
|
@@ -5048,9 +5243,9 @@ function CategoryTagPicker({
|
|
|
5048
5243
|
|
|
5049
5244
|
// src/react/components/CommentThread.tsx
|
|
5050
5245
|
var import_react24 = require("react");
|
|
5051
|
-
var
|
|
5246
|
+
var import_design_system14 = require("@ai-matrx/design-system");
|
|
5052
5247
|
var import_format = require("@ai-matrx/kit/format");
|
|
5053
|
-
var
|
|
5248
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
5054
5249
|
var AUTHOR_DOOR_TOKEN = "user";
|
|
5055
5250
|
function resolveAuthor(comment, authorDisplay) {
|
|
5056
5251
|
const base2 = {
|
|
@@ -5069,7 +5264,7 @@ function resolveAuthor(comment, authorDisplay) {
|
|
|
5069
5264
|
}
|
|
5070
5265
|
function AuthorAvatar({ author }) {
|
|
5071
5266
|
if (author.avatarUrl) {
|
|
5072
|
-
return /* @__PURE__ */ (0,
|
|
5267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5073
5268
|
"img",
|
|
5074
5269
|
{
|
|
5075
5270
|
src: author.avatarUrl,
|
|
@@ -5078,7 +5273,7 @@ function AuthorAvatar({ author }) {
|
|
|
5078
5273
|
}
|
|
5079
5274
|
);
|
|
5080
5275
|
}
|
|
5081
|
-
return /* @__PURE__ */ (0,
|
|
5276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5082
5277
|
"span",
|
|
5083
5278
|
{
|
|
5084
5279
|
"aria-hidden": true,
|
|
@@ -5093,7 +5288,7 @@ function AuthorName({
|
|
|
5093
5288
|
}) {
|
|
5094
5289
|
const DoorRef2 = entityDoors?.EntityRef;
|
|
5095
5290
|
if (DoorRef2 && author.userId) {
|
|
5096
|
-
return /* @__PURE__ */ (0,
|
|
5291
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5097
5292
|
DoorRef2,
|
|
5098
5293
|
{
|
|
5099
5294
|
token: AUTHOR_DOOR_TOKEN,
|
|
@@ -5104,7 +5299,7 @@ function AuthorName({
|
|
|
5104
5299
|
}
|
|
5105
5300
|
);
|
|
5106
5301
|
}
|
|
5107
|
-
return /* @__PURE__ */ (0,
|
|
5302
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-sm font-medium text-foreground", children: author.name });
|
|
5108
5303
|
}
|
|
5109
5304
|
function CommentComposer({
|
|
5110
5305
|
onSubmit,
|
|
@@ -5134,8 +5329,8 @@ function CommentComposer({
|
|
|
5134
5329
|
}
|
|
5135
5330
|
setBody("");
|
|
5136
5331
|
}
|
|
5137
|
-
return /* @__PURE__ */ (0,
|
|
5138
|
-
/* @__PURE__ */ (0,
|
|
5332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("form", { onSubmit: submit, className: "flex flex-col gap-1.5", children: [
|
|
5333
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5139
5334
|
"textarea",
|
|
5140
5335
|
{
|
|
5141
5336
|
value: body,
|
|
@@ -5150,8 +5345,8 @@ function CommentComposer({
|
|
|
5150
5345
|
className: "w-full resize-y rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
|
5151
5346
|
}
|
|
5152
5347
|
),
|
|
5153
|
-
error && /* @__PURE__ */ (0,
|
|
5154
|
-
|
|
5348
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5349
|
+
import_design_system14.ErrorBox,
|
|
5155
5350
|
{
|
|
5156
5351
|
className: "text-xs text-destructive",
|
|
5157
5352
|
message: error,
|
|
@@ -5160,9 +5355,9 @@ function CommentComposer({
|
|
|
5160
5355
|
origin: "associations/CommentThread"
|
|
5161
5356
|
}
|
|
5162
5357
|
),
|
|
5163
|
-
/* @__PURE__ */ (0,
|
|
5164
|
-
/* @__PURE__ */ (0,
|
|
5165
|
-
submitting && /* @__PURE__ */ (0,
|
|
5358
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
5359
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_design_system14.Button, { type: "submit", size: "sm", disabled: !body.trim() || submitting, children: [
|
|
5360
|
+
submitting && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SpinnerIcon, { className: "mr-1 h-3 w-3 animate-spin" }),
|
|
5166
5361
|
submitLabel
|
|
5167
5362
|
] }),
|
|
5168
5363
|
trailing
|
|
@@ -5195,19 +5390,19 @@ function CommentItem({
|
|
|
5195
5390
|
notifier.error(res.error ?? "Could not delete the comment");
|
|
5196
5391
|
}
|
|
5197
5392
|
}
|
|
5198
|
-
return /* @__PURE__ */ (0,
|
|
5393
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
5199
5394
|
"div",
|
|
5200
5395
|
{
|
|
5201
5396
|
"data-comment-id": comment.id,
|
|
5202
|
-
className: (0,
|
|
5397
|
+
className: (0, import_design_system14.cn)(
|
|
5203
5398
|
"flex flex-col gap-1",
|
|
5204
5399
|
depth > 0 && "border-l border-border pl-3"
|
|
5205
5400
|
),
|
|
5206
5401
|
children: [
|
|
5207
|
-
/* @__PURE__ */ (0,
|
|
5208
|
-
/* @__PURE__ */ (0,
|
|
5209
|
-
/* @__PURE__ */ (0,
|
|
5210
|
-
/* @__PURE__ */ (0,
|
|
5402
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
5403
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AuthorAvatar, { author }),
|
|
5404
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AuthorName, { author, entityDoors }),
|
|
5405
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5211
5406
|
"span",
|
|
5212
5407
|
{
|
|
5213
5408
|
className: "text-xs text-muted-foreground",
|
|
@@ -5218,7 +5413,7 @@ function CommentItem({
|
|
|
5218
5413
|
})
|
|
5219
5414
|
}
|
|
5220
5415
|
),
|
|
5221
|
-
edited && /* @__PURE__ */ (0,
|
|
5416
|
+
edited && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5222
5417
|
"span",
|
|
5223
5418
|
{
|
|
5224
5419
|
className: "text-xs text-muted-foreground",
|
|
@@ -5227,7 +5422,7 @@ function CommentItem({
|
|
|
5227
5422
|
}
|
|
5228
5423
|
)
|
|
5229
5424
|
] }),
|
|
5230
|
-
editing ? /* @__PURE__ */ (0,
|
|
5425
|
+
editing ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "pl-8", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5231
5426
|
CommentComposer,
|
|
5232
5427
|
{
|
|
5233
5428
|
initialValue: comment.body,
|
|
@@ -5239,8 +5434,8 @@ function CommentItem({
|
|
|
5239
5434
|
if (res.ok) setEditing(false);
|
|
5240
5435
|
return res;
|
|
5241
5436
|
},
|
|
5242
|
-
trailing: /* @__PURE__ */ (0,
|
|
5243
|
-
|
|
5437
|
+
trailing: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5438
|
+
import_design_system14.Button,
|
|
5244
5439
|
{
|
|
5245
5440
|
type: "button",
|
|
5246
5441
|
size: "sm",
|
|
@@ -5250,11 +5445,11 @@ function CommentItem({
|
|
|
5250
5445
|
}
|
|
5251
5446
|
)
|
|
5252
5447
|
}
|
|
5253
|
-
) }) : /* @__PURE__ */ (0,
|
|
5254
|
-
!editing && /* @__PURE__ */ (0,
|
|
5255
|
-
/* @__PURE__ */ (0,
|
|
5256
|
-
/* @__PURE__ */ (0,
|
|
5257
|
-
|
|
5448
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "whitespace-pre-wrap pl-8 text-sm text-foreground", children: comment.body }),
|
|
5449
|
+
!editing && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex items-center gap-1 pl-7", children: confirmingDelete ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
5450
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-xs text-destructive", children: "Deletes this comment for everyone." }),
|
|
5451
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
5452
|
+
import_design_system14.Button,
|
|
5258
5453
|
{
|
|
5259
5454
|
type: "button",
|
|
5260
5455
|
size: "sm",
|
|
@@ -5262,13 +5457,13 @@ function CommentItem({
|
|
|
5262
5457
|
disabled: deleting,
|
|
5263
5458
|
onClick: () => void confirmDelete(),
|
|
5264
5459
|
children: [
|
|
5265
|
-
deleting && /* @__PURE__ */ (0,
|
|
5460
|
+
deleting && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SpinnerIcon, { className: "mr-1 h-3 w-3 animate-spin" }),
|
|
5266
5461
|
"Delete"
|
|
5267
5462
|
]
|
|
5268
5463
|
}
|
|
5269
5464
|
),
|
|
5270
|
-
/* @__PURE__ */ (0,
|
|
5271
|
-
|
|
5465
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5466
|
+
import_design_system14.Button,
|
|
5272
5467
|
{
|
|
5273
5468
|
type: "button",
|
|
5274
5469
|
size: "sm",
|
|
@@ -5278,8 +5473,8 @@ function CommentItem({
|
|
|
5278
5473
|
children: "Cancel"
|
|
5279
5474
|
}
|
|
5280
5475
|
)
|
|
5281
|
-
] }) : /* @__PURE__ */ (0,
|
|
5282
|
-
/* @__PURE__ */ (0,
|
|
5476
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
5477
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5283
5478
|
"button",
|
|
5284
5479
|
{
|
|
5285
5480
|
type: "button",
|
|
@@ -5288,8 +5483,8 @@ function CommentItem({
|
|
|
5288
5483
|
children: "Reply"
|
|
5289
5484
|
}
|
|
5290
5485
|
),
|
|
5291
|
-
isOwn && /* @__PURE__ */ (0,
|
|
5292
|
-
/* @__PURE__ */ (0,
|
|
5486
|
+
isOwn && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
5487
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5293
5488
|
"button",
|
|
5294
5489
|
{
|
|
5295
5490
|
type: "button",
|
|
@@ -5298,7 +5493,7 @@ function CommentItem({
|
|
|
5298
5493
|
children: "Edit"
|
|
5299
5494
|
}
|
|
5300
5495
|
),
|
|
5301
|
-
/* @__PURE__ */ (0,
|
|
5496
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5302
5497
|
"button",
|
|
5303
5498
|
{
|
|
5304
5499
|
type: "button",
|
|
@@ -5309,9 +5504,9 @@ function CommentItem({
|
|
|
5309
5504
|
)
|
|
5310
5505
|
] })
|
|
5311
5506
|
] }) }),
|
|
5312
|
-
replying && /* @__PURE__ */ (0,
|
|
5313
|
-
/* @__PURE__ */ (0,
|
|
5314
|
-
/* @__PURE__ */ (0,
|
|
5507
|
+
replying && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-start gap-2 pl-8 pt-1", children: [
|
|
5508
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CornerDownRightIcon, { className: "mt-2 h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
5509
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5315
5510
|
CommentComposer,
|
|
5316
5511
|
{
|
|
5317
5512
|
submitLabel: "Reply",
|
|
@@ -5325,8 +5520,8 @@ function CommentItem({
|
|
|
5325
5520
|
if (res.ok) setReplying(false);
|
|
5326
5521
|
return res;
|
|
5327
5522
|
},
|
|
5328
|
-
trailing: /* @__PURE__ */ (0,
|
|
5329
|
-
|
|
5523
|
+
trailing: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5524
|
+
import_design_system14.Button,
|
|
5330
5525
|
{
|
|
5331
5526
|
type: "button",
|
|
5332
5527
|
size: "sm",
|
|
@@ -5338,7 +5533,7 @@ function CommentItem({
|
|
|
5338
5533
|
}
|
|
5339
5534
|
) })
|
|
5340
5535
|
] }),
|
|
5341
|
-
replies.length > 0 && /* @__PURE__ */ (0,
|
|
5536
|
+
replies.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex flex-col gap-3 pl-8 pt-1", children: replies.map((reply) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5342
5537
|
CommentItem,
|
|
5343
5538
|
{
|
|
5344
5539
|
comment: reply,
|
|
@@ -5378,11 +5573,11 @@ function CommentThread({
|
|
|
5378
5573
|
const thread = useComments({ token, id });
|
|
5379
5574
|
const { roots, childrenOf } = buildCommentTree(thread.comments);
|
|
5380
5575
|
const loading = (thread.status === "loading" || thread.status === "idle") && thread.comments.length === 0;
|
|
5381
|
-
return /* @__PURE__ */ (0,
|
|
5382
|
-
showHeader && /* @__PURE__ */ (0,
|
|
5383
|
-
/* @__PURE__ */ (0,
|
|
5384
|
-
/* @__PURE__ */ (0,
|
|
5385
|
-
/* @__PURE__ */ (0,
|
|
5576
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("section", { className: (0, import_design_system14.cn)("flex flex-col gap-3", className), children: [
|
|
5577
|
+
showHeader && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("header", { className: "flex items-center gap-2", children: [
|
|
5578
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h3", { className: "text-sm font-semibold text-foreground", children: "Comments" }),
|
|
5579
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-xs text-muted-foreground tabular-nums", children: thread.comments.length }),
|
|
5580
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5386
5581
|
"button",
|
|
5387
5582
|
{
|
|
5388
5583
|
type: "button",
|
|
@@ -5390,12 +5585,12 @@ function CommentThread({
|
|
|
5390
5585
|
"aria-label": "Refresh comments",
|
|
5391
5586
|
title: "Refresh comments",
|
|
5392
5587
|
className: "ml-auto flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
|
|
5393
|
-
children: thread.status === "loading" ? /* @__PURE__ */ (0,
|
|
5588
|
+
children: thread.status === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SpinnerIcon, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(RefreshIcon, { className: "h-3.5 w-3.5" })
|
|
5394
5589
|
}
|
|
5395
5590
|
)
|
|
5396
5591
|
] }),
|
|
5397
|
-
thread.error && /* @__PURE__ */ (0,
|
|
5398
|
-
|
|
5592
|
+
thread.error && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
5593
|
+
import_design_system14.ErrorBox,
|
|
5399
5594
|
{
|
|
5400
5595
|
as: "div",
|
|
5401
5596
|
className: "flex items-center gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",
|
|
@@ -5403,9 +5598,9 @@ function CommentThread({
|
|
|
5403
5598
|
operation: "Load comments",
|
|
5404
5599
|
origin: "associations/CommentThread",
|
|
5405
5600
|
children: [
|
|
5406
|
-
/* @__PURE__ */ (0,
|
|
5407
|
-
/* @__PURE__ */ (0,
|
|
5408
|
-
|
|
5601
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "min-w-0 flex-1", children: thread.error }),
|
|
5602
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5603
|
+
import_design_system14.Button,
|
|
5409
5604
|
{
|
|
5410
5605
|
type: "button",
|
|
5411
5606
|
size: "sm",
|
|
@@ -5418,10 +5613,10 @@ function CommentThread({
|
|
|
5418
5613
|
]
|
|
5419
5614
|
}
|
|
5420
5615
|
),
|
|
5421
|
-
loading ? /* @__PURE__ */ (0,
|
|
5422
|
-
/* @__PURE__ */ (0,
|
|
5423
|
-
/* @__PURE__ */ (0,
|
|
5424
|
-
] }) : roots.length === 0 && !thread.error ? /* @__PURE__ */ (0,
|
|
5616
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-3", "aria-hidden": true, "data-testid": "comments-loading", children: [
|
|
5617
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_design_system14.Skeleton, { className: "h-12 w-full" }),
|
|
5618
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_design_system14.Skeleton, { className: "h-12 w-4/5" })
|
|
5619
|
+
] }) : roots.length === 0 && !thread.error ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-sm text-muted-foreground", children: "No comments yet." }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex flex-col gap-4", children: roots.map((comment) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5425
5620
|
CommentItem,
|
|
5426
5621
|
{
|
|
5427
5622
|
comment,
|
|
@@ -5432,7 +5627,7 @@ function CommentThread({
|
|
|
5432
5627
|
},
|
|
5433
5628
|
comment.id
|
|
5434
5629
|
)) }),
|
|
5435
|
-
/* @__PURE__ */ (0,
|
|
5630
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5436
5631
|
CommentComposer,
|
|
5437
5632
|
{
|
|
5438
5633
|
onSubmit: (body) => thread.add(body, { orgId: orgId ?? null })
|