@tangle-network/sandbox-ui 0.41.0 → 0.42.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.
@@ -1543,9 +1543,9 @@ function DashboardLayoutInner({
1543
1543
  );
1544
1544
  const activePanel = panels.find((p) => p.mode === mode);
1545
1545
  const buildSidebarContent = React6.useCallback(
1546
- (showLabels) => /* @__PURE__ */ jsxs13(Fragment8, { children: [
1546
+ (showLabels, allowCollapse) => /* @__PURE__ */ jsxs13(Fragment8, { children: [
1547
1547
  /* @__PURE__ */ jsxs13(SidebarRail, { wide: showLabels, children: [
1548
- /* @__PURE__ */ jsx14(SidebarRailHeader, { children: onLogoClick ? /* @__PURE__ */ jsx14(
1548
+ /* @__PURE__ */ jsx14(SidebarRailHeader, { className: cn(showLabels && "justify-start px-3"), children: onLogoClick ? /* @__PURE__ */ jsx14(
1549
1549
  "button",
1550
1550
  {
1551
1551
  type: "button",
@@ -1573,12 +1573,17 @@ function DashboardLayoutInner({
1573
1573
  children: /* @__PURE__ */ jsx14(Logo, { variant, size: "sm", iconOnly: true })
1574
1574
  }
1575
1575
  ) }),
1576
- /* @__PURE__ */ jsx14(SidebarRailNav, { children: navItems.map((item, i) => {
1576
+ /* @__PURE__ */ jsx14(SidebarRailNav, { className: showLabels ? "px-2" : void 0, children: navItems.map((item, i) => {
1577
1577
  const isMode = modeSet.has(item.id);
1578
1578
  const prevIsMode = i > 0 && modeSet.has(navItems[i - 1].id);
1579
1579
  const showSep = i > 0 && isMode && !prevIsMode;
1580
1580
  return /* @__PURE__ */ jsxs13(React6.Fragment, { children: [
1581
- showSep && /* @__PURE__ */ jsx14(RailSeparator, {}),
1581
+ showSep && /* @__PURE__ */ jsx14(
1582
+ RailSeparator,
1583
+ {
1584
+ className: showLabels ? "w-full" : void 0
1585
+ }
1586
+ ),
1582
1587
  isMode ? /* @__PURE__ */ jsx14(
1583
1588
  RailModeButton,
1584
1589
  {
@@ -1601,10 +1606,18 @@ function DashboardLayoutInner({
1601
1606
  )
1602
1607
  ] }, item.id);
1603
1608
  }) }),
1604
- /* @__PURE__ */ jsxs13(SidebarRailFooter, { children: [
1609
+ /* @__PURE__ */ jsxs13(SidebarRailFooter, { className: cn(showLabels && "items-stretch px-2"), children: [
1610
+ allowCollapse && /* @__PURE__ */ jsx14(
1611
+ RailCollapseToggle,
1612
+ {
1613
+ collapsed: railCollapsed,
1614
+ showLabel: showLabels,
1615
+ onToggle: toggleRail
1616
+ }
1617
+ ),
1605
1618
  onSettingsClick ? /* @__PURE__ */ jsx14(RailButton, { icon: SettingsIconSmall, label: "Settings", onClick: onSettingsClick, showLabel: showLabels }) : /* @__PURE__ */ jsx14(RailButton, { icon: SettingsIconSmall, label: "Settings", showLabel: showLabels, asChild: true, children: /* @__PURE__ */ jsx14(Link, { href: settingsHref, to: settingsHref }) }),
1606
1619
  railFooter,
1607
- /* @__PURE__ */ jsx14(RailSeparator, {}),
1620
+ /* @__PURE__ */ jsx14(RailSeparator, { className: showLabels ? "w-full" : void 0 }),
1608
1621
  /* @__PURE__ */ jsx14(
1609
1622
  ProfileAvatar,
1610
1623
  {
@@ -1613,6 +1626,7 @@ function DashboardLayoutInner({
1613
1626
  onLogout,
1614
1627
  onSettingsClick,
1615
1628
  settingsHref,
1629
+ showDetails: showLabels,
1616
1630
  LinkComponent,
1617
1631
  children: profileMenuItems
1618
1632
  }
@@ -1651,10 +1665,10 @@ function DashboardLayoutInner({
1651
1665
  ]
1652
1666
  );
1653
1667
  const sidebarContent = React6.useMemo(
1654
- () => buildSidebarContent(labeledRail && !railCollapsed),
1668
+ () => buildSidebarContent(labeledRail && !railCollapsed, labeledRail),
1655
1669
  [buildSidebarContent, labeledRail, railCollapsed]
1656
1670
  );
1657
- const mobileSidebarContent = React6.useMemo(() => buildSidebarContent(true), [buildSidebarContent]);
1671
+ const mobileSidebarContent = React6.useMemo(() => buildSidebarContent(true, false), [buildSidebarContent]);
1658
1672
  return /* @__PURE__ */ jsxs13("div", { className: cn("min-h-screen bg-background text-foreground", className), children: [
1659
1673
  /* @__PURE__ */ jsxs13(
1660
1674
  "nav",
@@ -1783,8 +1797,8 @@ function DashboardLayoutInner({
1783
1797
  footer
1784
1798
  ] });
1785
1799
  }
1786
- function DashboardLayout({ defaultPanelOpen, defaultMode, labeledRail, ...props }) {
1787
- return /* @__PURE__ */ jsx14(SidebarProvider, { defaultPanelOpen, defaultMode, labeledRail, hasPanels: (props.panels?.length ?? 0) > 0, children: /* @__PURE__ */ jsx14(DashboardLayoutInner, { defaultPanelOpen, defaultMode, labeledRail, ...props }) });
1800
+ function DashboardLayout({ defaultPanelOpen, defaultMode, labeledRail, defaultRailCollapsed, ...props }) {
1801
+ return /* @__PURE__ */ jsx14(SidebarProvider, { defaultPanelOpen, defaultMode, labeledRail, defaultRailCollapsed, hasPanels: (props.panels?.length ?? 0) > 0, children: /* @__PURE__ */ jsx14(DashboardLayoutInner, { defaultPanelOpen, defaultMode, labeledRail, ...props }) });
1788
1802
  }
1789
1803
 
1790
1804
  // src/dashboard/sidebar-layout.tsx
@@ -681,6 +681,12 @@ interface DashboardLayoutProps {
681
681
  * toggles between icon-only and labeled instead of navigating.
682
682
  */
683
683
  labeledRail?: boolean;
684
+ /**
685
+ * Initial rail-collapsed state when `labeledRail` is set and the rail is
686
+ * uncontrolled. Defaults to expanded (`false`). Pass `true` to start on the
687
+ * compact icon rail — the user's choice then persists to localStorage.
688
+ */
689
+ defaultRailCollapsed?: boolean;
684
690
  footer?: React.ReactNode;
685
691
  defaultPanelOpen?: boolean;
686
692
  defaultMode?: string;
@@ -702,7 +708,7 @@ interface DashboardLayoutProps {
702
708
  onMarkAllRead?: () => void;
703
709
  };
704
710
  }
705
- declare function DashboardLayout({ defaultPanelOpen, defaultMode, labeledRail, ...props }: DashboardLayoutProps): react_jsx_runtime.JSX.Element;
711
+ declare function DashboardLayout({ defaultPanelOpen, defaultMode, labeledRail, defaultRailCollapsed, ...props }: DashboardLayoutProps): react_jsx_runtime.JSX.Element;
706
712
 
707
713
  /** A sub-destination revealed inside a nav item's right-flyout. */
708
714
  interface SidebarLayoutFlyoutItem {
package/dist/dashboard.js CHANGED
@@ -52,7 +52,7 @@ import {
52
52
  canAdminSandbox,
53
53
  parseInsufficientBalance,
54
54
  useSidebar
55
- } from "./chunk-6UDHPI2R.js";
55
+ } from "./chunk-KCWIC3SJ.js";
56
56
  import {
57
57
  BillingDashboard,
58
58
  InfoPanel,
package/dist/index.js CHANGED
@@ -138,7 +138,7 @@ import {
138
138
  canAdminSandbox,
139
139
  parseInsufficientBalance,
140
140
  useSidebar
141
- } from "./chunk-6UDHPI2R.js";
141
+ } from "./chunk-KCWIC3SJ.js";
142
142
  import {
143
143
  usePtySession
144
144
  } from "./chunk-77WVVJA4.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/sandbox-ui",
3
- "version": "0.41.0",
3
+ "version": "0.42.0",
4
4
  "description": "Unified UI component library for Tangle Sandbox — primitives, chat, dashboard, terminal, editor, and workspace components",
5
5
  "repository": {
6
6
  "type": "git",