@fluid-app/portal-sdk 0.1.139 → 0.1.140

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1742,46 +1742,26 @@ function filterRepOnlySections(sections) {
1742
1742
  //#region src/shell/QuickLinksDropdown.tsx
1743
1743
  function QuickLinksDropdown({ onNavigate }) {
1744
1744
  const [open, setOpen] = (0, react.useState)(false);
1745
- const panelRef = (0, react.useRef)(null);
1746
- const buttonRef = (0, react.useRef)(null);
1747
- const close = (0, react.useCallback)(() => setOpen(false), []);
1748
- (0, react.useEffect)(() => {
1749
- if (!open) return;
1750
- const handleMouseDown = (e) => {
1751
- if (panelRef.current && !panelRef.current.contains(e.target) && buttonRef.current && !buttonRef.current.contains(e.target)) close();
1752
- };
1753
- const handleKeyDown = (e) => {
1754
- if (e.key === "Escape") close();
1755
- };
1756
- document.addEventListener("mousedown", handleMouseDown);
1757
- document.addEventListener("keydown", handleKeyDown);
1758
- return () => {
1759
- document.removeEventListener("mousedown", handleMouseDown);
1760
- document.removeEventListener("keydown", handleKeyDown);
1761
- };
1762
- }, [open, close]);
1763
1745
  const { isCustomer } = require_ShareablesScreen.useUserType();
1764
1746
  const sections = (0, react.useMemo)(() => {
1765
1747
  const all = getSystemNavigationBySection();
1766
1748
  return isCustomer ? filterRepOnlySections(all) : all;
1767
1749
  }, [isCustomer]);
1768
- const handleItemClick = (slug) => {
1769
- onNavigate(slug);
1770
- close();
1771
- };
1772
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1773
- className: "relative",
1774
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1775
- ref: buttonRef,
1776
- type: "button",
1777
- onClick: () => setOpen((prev) => !prev),
1778
- className: "text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground flex shrink-0 items-center justify-center rounded-md p-2",
1779
- "aria-label": "Quick links",
1780
- "aria-expanded": open,
1781
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.LayoutGrid, { className: "h-4 w-4" })
1782
- }), open && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1783
- ref: panelRef,
1784
- className: "border-border bg-background absolute top-full right-0 z-50 mt-1 w-[700px] max-w-[90vw] overflow-hidden rounded-lg border shadow-lg",
1750
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Popover, {
1751
+ open,
1752
+ onOpenChange: setOpen,
1753
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.PopoverTrigger, {
1754
+ asChild: true,
1755
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Button, {
1756
+ variant: "ghost",
1757
+ size: "sm",
1758
+ className: "text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground shrink-0",
1759
+ "aria-label": "Quick links",
1760
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.LayoutGrid, { className: "h-4 w-4" })
1761
+ })
1762
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.PopoverContent, {
1763
+ align: "end",
1764
+ className: "w-175 max-w-[90vw] overflow-hidden rounded-lg p-0 shadow-lg",
1785
1765
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1786
1766
  className: "flex flex-col",
1787
1767
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -1799,13 +1779,16 @@ function QuickLinksDropdown({ onNavigate }) {
1799
1779
  children: sectionName
1800
1780
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1801
1781
  className: "grid grid-cols-4 gap-2",
1802
- children: items.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1803
- type: "button",
1804
- onClick: () => handleItemClick(item.slug),
1805
- className: "text-sidebar-foreground hover:bg-sidebar-primary hover:text-sidebar-primary-foreground flex items-center gap-2 rounded-lg px-3 py-2 text-sm transition-colors",
1782
+ children: items.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Button, {
1783
+ variant: "ghost",
1784
+ className: "text-sidebar-foreground hover:bg-sidebar-primary hover:text-sidebar-primary-foreground h-auto justify-start gap-2 rounded-lg px-3 py-2 text-sm",
1785
+ onClick: () => {
1786
+ if (item.slug) onNavigate(item.slug);
1787
+ setOpen(false);
1788
+ },
1806
1789
  children: [item.icon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RepIcon, {
1807
1790
  name: item.icon,
1808
- className: "text-muted-foreground h-4 w-4 shrink-0"
1791
+ className: "h-4 w-4 shrink-0"
1809
1792
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1810
1793
  className: "truncate",
1811
1794
  children: item.label
@@ -1833,12 +1816,12 @@ function SdkMobileQuickLinksGrid({ onNavigate }) {
1833
1816
  children: sectionName
1834
1817
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1835
1818
  className: "grid grid-cols-3 gap-2",
1836
- children: items.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1837
- type: "button",
1819
+ children: items.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Button, {
1820
+ variant: "ghost",
1821
+ className: "text-sidebar-foreground hover:bg-sidebar-primary hover:text-sidebar-primary-foreground h-auto flex-col gap-1 rounded-lg p-2",
1838
1822
  onClick: () => {
1839
1823
  if (item.slug) onNavigate(item.slug);
1840
1824
  },
1841
- className: "text-sidebar-foreground hover:bg-sidebar-primary hover:text-sidebar-primary-foreground flex h-auto flex-col items-center gap-1 rounded-lg p-2",
1842
1825
  children: [item.icon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RepIcon, {
1843
1826
  name: item.icon,
1844
1827
  className: "size-5"