@the-portland-company/shell 0.50.1 → 0.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-chrome.cjs +76 -35
- package/dist/app-chrome.cjs.map +1 -1
- package/dist/app-chrome.js +1 -1
- package/dist/{chunk-PQ6WZTAX.js → chunk-II5K6QT6.js} +78 -37
- package/dist/chunk-II5K6QT6.js.map +1 -0
- package/dist/native.cjs +76 -35
- package/dist/native.cjs.map +1 -1
- package/dist/native.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-PQ6WZTAX.js.map +0 -1
package/dist/app-chrome.cjs
CHANGED
|
@@ -54,6 +54,20 @@ function resolveBrandGlyph(name) {
|
|
|
54
54
|
return GLYPHS[name.trim().toLowerCase()] ?? null;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
// src/native/orgFilter.ts
|
|
58
|
+
var ORG_FILTER_THRESHOLD = 8;
|
|
59
|
+
function filterOrgs(orgs, query) {
|
|
60
|
+
const q = normalize(query);
|
|
61
|
+
if (!q) return [...orgs];
|
|
62
|
+
return orgs.filter((o) => normalize(o.name ?? "").includes(q) || o.id.toLowerCase().startsWith(q));
|
|
63
|
+
}
|
|
64
|
+
function shouldShowOrgFilter(count) {
|
|
65
|
+
return count > ORG_FILTER_THRESHOLD;
|
|
66
|
+
}
|
|
67
|
+
function normalize(s) {
|
|
68
|
+
return s.normalize("NFD").replace(/[̀-ͯ]/g, "").toLowerCase().trim();
|
|
69
|
+
}
|
|
70
|
+
|
|
57
71
|
// src/theme-preference.ts
|
|
58
72
|
var THEME_STORAGE_KEY = "politogy_theme";
|
|
59
73
|
var THEME_COOKIE = "politogy_theme";
|
|
@@ -1768,6 +1782,7 @@ function NavSidebar({
|
|
|
1768
1782
|
return null;
|
|
1769
1783
|
}, [nav.items, pathname, activeFn]);
|
|
1770
1784
|
const [openGroup, setOpenGroup] = react.useState(activeGroupKey);
|
|
1785
|
+
const [orgFilter, setOrgFilter] = react.useState("");
|
|
1771
1786
|
react.useEffect(() => {
|
|
1772
1787
|
setOpenGroup(activeGroupKey);
|
|
1773
1788
|
}, [activeGroupKey]);
|
|
@@ -1839,43 +1854,69 @@ function NavSidebar({
|
|
|
1839
1854
|
] }),
|
|
1840
1855
|
/* @__PURE__ */ jsxRuntime.jsx(ChevronDown, {})
|
|
1841
1856
|
] }),
|
|
1842
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
"button",
|
|
1857
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute left-0 right-0 z-40 mt-1 max-h-[min(60vh,520px)] overflow-y-auto rounded-xl border border-[color:var(--line)] bg-[color:var(--panel-elevated)] py-1 shadow-[var(--shadow-soft)]", children: [
|
|
1858
|
+
shouldShowOrgFilter(org.organizations.length) ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sticky top-0 z-10 bg-[color:var(--panel-elevated)] px-2 pb-1 pt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1859
|
+
"input",
|
|
1846
1860
|
{
|
|
1847
|
-
type: "
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1861
|
+
type: "search",
|
|
1862
|
+
value: orgFilter,
|
|
1863
|
+
onChange: (e) => setOrgFilter(e.target.value),
|
|
1864
|
+
onKeyDown: (e) => {
|
|
1865
|
+
if (e.key === "Escape") {
|
|
1866
|
+
setOrgFilter("");
|
|
1867
|
+
e.currentTarget.closest("details")?.removeAttribute("open");
|
|
1868
|
+
}
|
|
1851
1869
|
},
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1870
|
+
placeholder: `Filter ${org.organizations.length} organizations`,
|
|
1871
|
+
"aria-label": "Filter organizations",
|
|
1872
|
+
autoComplete: "off",
|
|
1873
|
+
className: "w-full rounded-lg border border-[color:var(--line)] bg-[color:var(--panel)] px-3 py-1.5 text-sm text-[color:var(--foreground)] placeholder:text-[color:var(--muted)] focus:outline-none focus:ring-2 focus:ring-[color:var(--color-accent)]"
|
|
1874
|
+
}
|
|
1875
|
+
) }) : null,
|
|
1876
|
+
filterOrgs(org.organizations, orgFilter).length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "px-3 py-2 text-sm text-[color:var(--muted)]", children: [
|
|
1877
|
+
"No organization matches \u201C",
|
|
1878
|
+
orgFilter,
|
|
1879
|
+
"\u201D."
|
|
1880
|
+
] }) : null,
|
|
1881
|
+
filterOrgs(org.organizations, orgFilter).map((o) => {
|
|
1882
|
+
const selected = o.id === org.id;
|
|
1883
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1884
|
+
"button",
|
|
1885
|
+
{
|
|
1886
|
+
type: "button",
|
|
1887
|
+
onClick: (e) => {
|
|
1888
|
+
e.currentTarget.closest("details")?.removeAttribute("open");
|
|
1889
|
+
setOrgFilter("");
|
|
1890
|
+
if (!selected) org.onSwitch?.(o.id);
|
|
1891
|
+
},
|
|
1892
|
+
"aria-current": selected ? "true" : void 0,
|
|
1893
|
+
className: [
|
|
1894
|
+
"flex w-full items-center gap-2.5 px-3 py-2 text-left text-sm",
|
|
1895
|
+
selected ? "font-semibold text-[color:var(--color-accent)]" : "font-medium text-[color:var(--foreground)] hover:bg-[color:var(--panel)]"
|
|
1896
|
+
].join(" "),
|
|
1897
|
+
children: [
|
|
1898
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1899
|
+
"span",
|
|
1900
|
+
{
|
|
1901
|
+
style: { backgroundColor: o.brandColor || ORG_PILL_DEFAULT },
|
|
1902
|
+
className: "flex h-6 w-6 shrink-0 items-center justify-center overflow-hidden rounded-full text-[10px] font-bold text-white",
|
|
1903
|
+
children: resolveOrgLogoUrl(o.logoUrl) ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1904
|
+
"img",
|
|
1905
|
+
{
|
|
1906
|
+
src: resolveOrgLogoUrl(o.logoUrl),
|
|
1907
|
+
alt: "",
|
|
1908
|
+
className: "h-full w-full object-cover"
|
|
1909
|
+
}
|
|
1910
|
+
) : (o.name ?? "Org").slice(0, 2).toUpperCase()
|
|
1911
|
+
}
|
|
1912
|
+
),
|
|
1913
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { title: o.name ?? o.id, className: "truncate", children: o.name ?? o.id.slice(0, 8) })
|
|
1914
|
+
]
|
|
1915
|
+
},
|
|
1916
|
+
o.id
|
|
1917
|
+
);
|
|
1918
|
+
})
|
|
1919
|
+
] })
|
|
1879
1920
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1880
1921
|
"button",
|
|
1881
1922
|
{
|