@mastra/playground-ui 69.0.0-alpha.6 → 69.0.0-alpha.7

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.
@@ -444,9 +444,21 @@ function SidebarNavHeader({ children, icon, action, className, state: stateProp,
444
444
  * `link={...}` path wraps the name internally, but custom elements bring their
445
445
  * own children, so the label needs to opt into the collapse-aware rendering.
446
446
  */
447
- function SidebarNavLabel({ children, className, state: stateProp, ...rest }) {
447
+ function SidebarNavLabel({ children, className, description, state: stateProp, ...rest }) {
448
448
  const ctx = useMaybeSidebarState();
449
449
  if ((stateProp ?? ctx?.state ?? "default") === "collapsed") return /* @__PURE__ */ jsx(VisuallyHidden, { children });
450
+ if (description != null && description !== false) return /* @__PURE__ */ jsxs("span", {
451
+ ...rest,
452
+ className: cn("flex min-w-0 flex-1 flex-col text-left", className),
453
+ children: [/* @__PURE__ */ jsx("span", {
454
+ className: "truncate",
455
+ children
456
+ }), /* @__PURE__ */ jsx("span", {
457
+ "data-slot": "sidebar-nav-description",
458
+ className: "flex min-w-0 items-center gap-1.5 truncate text-meta text-muted-foreground data-[slot=sidebar-nav-description]:[&_svg]:size-3",
459
+ children: description
460
+ })]
461
+ });
450
462
  return /* @__PURE__ */ jsx("span", {
451
463
  ...rest,
452
464
  className: cn("min-w-0 flex-1 truncate text-left", className),
@@ -468,6 +480,7 @@ var nestedExpandedItemClasses = (level) => {
468
480
  if (level === 2) return `gap-2 py-1 pr-3 pl-10 ${controlHeight.md}`;
469
481
  return `gap-2 py-1 pr-3 pl-12 ${controlHeight.md}`;
470
482
  };
483
+ var withDescriptionClasses = "has-[[data-slot=sidebar-nav-description]]:h-auto has-[[data-slot=sidebar-nav-description]]:min-h-control-lg has-[[data-slot=sidebar-nav-description]]:items-start has-[[data-slot=sidebar-nav-description]]:py-1.5 has-[[data-slot=sidebar-nav-description]]:[&>svg]:h-lh";
471
484
  var idleSurface = "rounded-lg text-muted-foreground hover:bg-fill-subtle hover:text-foreground";
472
485
  var activeSurface = "rounded-lg bg-fill text-foreground";
473
486
  var featuredSurface = "my-2 rounded-lg border border-transparent bg-brand-green text-black hover:brightness-95";
@@ -476,7 +489,7 @@ var navRowSurfaceClasses = ({ isActive, isFeatured }) => {
476
489
  if (isActive) return activeSurface;
477
490
  return idleSurface;
478
491
  };
479
- var navItemLayoutClasses = ({ isCollapsed, level = 0, size }) => cn(navItemVariants({ size }), "w-full justify-start", "[&_svg]:size-4 [&_svg]:shrink-0", focusRing, !isCollapsed && nestedExpandedItemClasses(level), isCollapsed && "gap-0 px-[13.5px] py-0");
492
+ var navItemLayoutClasses = ({ isCollapsed, level = 0, size }) => cn(navItemVariants({ size }), "w-full justify-start", "[&_svg]:size-4 [&_svg]:shrink-0", focusRing, !isCollapsed && nestedExpandedItemClasses(level), !isCollapsed && withDescriptionClasses, isCollapsed && "gap-0 px-[13.5px] py-0");
480
493
  var navItemClasses = ({ isActive, isCollapsed, isFeatured, level, size } = {}) => cn(navItemLayoutClasses({
481
494
  isCollapsed,
482
495
  level,
@@ -586,8 +599,27 @@ function NavRowTooltip({ label, children }) {
586
599
  function NavRowBody({ action, surfaceClassName, children }) {
587
600
  if (!action) return children;
588
601
  return /* @__PURE__ */ jsxs("div", {
589
- className: cn("flex min-w-0 items-center pr-1", surfaceClassName),
590
- children: [children, action]
602
+ className: cn("group/nav-row relative flex min-w-0 items-center pr-0.75 has-[[data-slot=sidebar-nav-description]]:items-start", surfaceClassName),
603
+ children: [children, /* @__PURE__ */ jsx("span", {
604
+ className: "flex shrink-0 items-center group-has-[[data-slot=sidebar-nav-description]]/nav-row:pt-0.75",
605
+ children: action
606
+ })]
607
+ });
608
+ }
609
+ /**
610
+ * An icon button for a row's `action` slot: 24px, so it keeps 3px from the row's top and
611
+ * right edges on a 30px row, with corners inset from the row's `rounded-lg` by those 3px.
612
+ *
613
+ * A row with actions is `group/nav-row` and `relative`, so hover-only actions reveal with
614
+ * `group-hover/nav-row:` without lighting up while a nested row in `subItems` is hovered.
615
+ */
616
+ function SidebarNavAction({ className, ...props }) {
617
+ return /* @__PURE__ */ jsx(Button, {
618
+ type: "button",
619
+ ...props,
620
+ variant: "ghost",
621
+ size: "icon-sm",
622
+ className: cn("size-6 rounded-[calc(var(--radius-lg)-3px)]", className)
591
623
  });
592
624
  }
593
625
  // src/ds/components/Sidebar/nav/sidebar-nav-list.tsx
@@ -1494,6 +1526,7 @@ var Sidebar = Object.assign(SidebarRoot, {
1494
1526
  MobileTrigger: SidebarMobileTrigger,
1495
1527
  Nav: SidebarNav,
1496
1528
  NavHeader: SidebarNavHeader,
1529
+ NavAction: SidebarNavAction,
1497
1530
  NavLabel: SidebarNavLabel,
1498
1531
  NavLink: SidebarNavLink,
1499
1532
  NavList: SidebarNavList,
@@ -1518,6 +1551,6 @@ function getIsLinkActive(link, pathname, siblings = []) {
1518
1551
  if (!matches(link.url)) return false;
1519
1552
  return ![...flattenLinks(link.children ?? []), ...flattenLinks(siblings)].some((other) => other.url !== link.url && other.url.length > link.url.length && matches(other.url));
1520
1553
  }
1521
- export { Sidebar, SidebarBadge, SidebarBrand, SidebarCommandHeader, SidebarFooter, SidebarFooterMeta, SidebarHeader, SidebarMeter, SidebarMobileTrigger, SidebarNav, SidebarNavHeader, SidebarNavLink, SidebarNavShowMore, SidebarNavStack, SidebarProvider, SidebarRoot, SidebarSearchTrigger, SidebarSections, SidebarTrigger, getIsLinkActive, navItemClasses, useMaybeSidebar, useMaybeSidebarState, useMobileDrawer, useSidebar };
1554
+ export { Sidebar, SidebarBadge, SidebarBrand, SidebarCommandHeader, SidebarFooter, SidebarFooterMeta, SidebarHeader, SidebarMeter, SidebarMobileTrigger, SidebarNav, SidebarNavAction, SidebarNavHeader, SidebarNavLink, SidebarNavShowMore, SidebarNavStack, SidebarProvider, SidebarRoot, SidebarSearchTrigger, SidebarSections, SidebarTrigger, getIsLinkActive, navItemClasses, useMaybeSidebar, useMaybeSidebarState, useMobileDrawer, useSidebar };
1522
1555
 
1523
1556
  //# sourceMappingURL=Sidebar.es.js.map