@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.
@@ -0,0 +1,51 @@
1
+ /* State-change motion lives in CSS so the switch does not need React state just
2
+ * to time a visual-only settling effect. Base UI swaps `data-checked` and
3
+ * `data-unchecked`; distinct animation names make each direction restart. */
4
+
5
+ @keyframes switch-thumb-settle-on {
6
+ 0% {
7
+ transform: scaleY(1);
8
+ }
9
+
10
+ 48% {
11
+ transform: scaleY(0.8);
12
+ }
13
+
14
+ 100% {
15
+ transform: scaleY(1);
16
+ }
17
+ }
18
+
19
+ @keyframes switch-thumb-settle-off {
20
+ 0% {
21
+ transform: scaleY(1);
22
+ }
23
+
24
+ 48% {
25
+ transform: scaleY(0.8);
26
+ }
27
+
28
+ 100% {
29
+ transform: scaleY(1);
30
+ }
31
+ }
32
+
33
+ .switch-thumb-motion {
34
+ transform: scaleY(1);
35
+ transform-origin: center;
36
+ }
37
+
38
+ .switch-thumb-motion[data-checked] {
39
+ animation: switch-thumb-settle-on 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
40
+ }
41
+
42
+ .switch-thumb-motion[data-unchecked] {
43
+ animation: switch-thumb-settle-off 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
44
+ }
45
+
46
+ @media (prefers-reduced-motion: reduce) {
47
+ .switch-thumb-motion[data-checked],
48
+ .switch-thumb-motion[data-unchecked] {
49
+ animation: none;
50
+ }
51
+ }
@@ -447,9 +447,21 @@ function SidebarNavHeader({ children, icon, action, className, state: stateProp,
447
447
  * `link={...}` path wraps the name internally, but custom elements bring their
448
448
  * own children, so the label needs to opt into the collapse-aware rendering.
449
449
  */
450
- function SidebarNavLabel({ children, className, state: stateProp, ...rest }) {
450
+ function SidebarNavLabel({ children, className, description, state: stateProp, ...rest }) {
451
451
  const ctx = useMaybeSidebarState();
452
452
  if ((stateProp ?? ctx?.state ?? "default") === "collapsed") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_visually_hidden.VisuallyHidden, { children });
453
+ if (description != null && description !== false) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
454
+ ...rest,
455
+ className: require_utils.cn("flex min-w-0 flex-1 flex-col text-left", className),
456
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
457
+ className: "truncate",
458
+ children
459
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
460
+ "data-slot": "sidebar-nav-description",
461
+ className: "flex min-w-0 items-center gap-1.5 truncate text-meta text-muted-foreground data-[slot=sidebar-nav-description]:[&_svg]:size-3",
462
+ children: description
463
+ })]
464
+ });
453
465
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
454
466
  ...rest,
455
467
  className: require_utils.cn("min-w-0 flex-1 truncate text-left", className),
@@ -471,6 +483,7 @@ var nestedExpandedItemClasses = (level) => {
471
483
  if (level === 2) return `gap-2 py-1 pr-3 pl-10 ${require_primitives_control_size.controlHeight.md}`;
472
484
  return `gap-2 py-1 pr-3 pl-12 ${require_primitives_control_size.controlHeight.md}`;
473
485
  };
486
+ 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";
474
487
  var idleSurface = "rounded-lg text-muted-foreground hover:bg-fill-subtle hover:text-foreground";
475
488
  var activeSurface = "rounded-lg bg-fill text-foreground";
476
489
  var featuredSurface = "my-2 rounded-lg border border-transparent bg-brand-green text-black hover:brightness-95";
@@ -479,7 +492,7 @@ var navRowSurfaceClasses = ({ isActive, isFeatured }) => {
479
492
  if (isActive) return activeSurface;
480
493
  return idleSurface;
481
494
  };
482
- var navItemLayoutClasses = ({ isCollapsed, level = 0, size }) => require_utils.cn(navItemVariants({ size }), "w-full justify-start", "[&_svg]:size-4 [&_svg]:shrink-0", require_primitives_transitions.focusRing, !isCollapsed && nestedExpandedItemClasses(level), isCollapsed && "gap-0 px-[13.5px] py-0");
495
+ var navItemLayoutClasses = ({ isCollapsed, level = 0, size }) => require_utils.cn(navItemVariants({ size }), "w-full justify-start", "[&_svg]:size-4 [&_svg]:shrink-0", require_primitives_transitions.focusRing, !isCollapsed && nestedExpandedItemClasses(level), !isCollapsed && withDescriptionClasses, isCollapsed && "gap-0 px-[13.5px] py-0");
483
496
  var navItemClasses = ({ isActive, isCollapsed, isFeatured, level, size } = {}) => require_utils.cn(navItemLayoutClasses({
484
497
  isCollapsed,
485
498
  level,
@@ -589,8 +602,27 @@ function NavRowTooltip({ label, children }) {
589
602
  function NavRowBody({ action, surfaceClassName, children }) {
590
603
  if (!action) return children;
591
604
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
592
- className: require_utils.cn("flex min-w-0 items-center pr-1", surfaceClassName),
593
- children: [children, action]
605
+ className: require_utils.cn("group/nav-row relative flex min-w-0 items-center pr-0.75 has-[[data-slot=sidebar-nav-description]]:items-start", surfaceClassName),
606
+ children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
607
+ className: "flex shrink-0 items-center group-has-[[data-slot=sidebar-nav-description]]/nav-row:pt-0.75",
608
+ children: action
609
+ })]
610
+ });
611
+ }
612
+ /**
613
+ * An icon button for a row's `action` slot: 24px, so it keeps 3px from the row's top and
614
+ * right edges on a 30px row, with corners inset from the row's `rounded-lg` by those 3px.
615
+ *
616
+ * A row with actions is `group/nav-row` and `relative`, so hover-only actions reveal with
617
+ * `group-hover/nav-row:` without lighting up while a nested row in `subItems` is hovered.
618
+ */
619
+ function SidebarNavAction({ className, ...props }) {
620
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Button.Button, {
621
+ type: "button",
622
+ ...props,
623
+ variant: "ghost",
624
+ size: "icon-sm",
625
+ className: require_utils.cn("size-6 rounded-[calc(var(--radius-lg)-3px)]", className)
594
626
  });
595
627
  }
596
628
  // src/ds/components/Sidebar/nav/sidebar-nav-list.tsx
@@ -1497,6 +1529,7 @@ var Sidebar = Object.assign(SidebarRoot, {
1497
1529
  MobileTrigger: SidebarMobileTrigger,
1498
1530
  Nav: SidebarNav,
1499
1531
  NavHeader: SidebarNavHeader,
1532
+ NavAction: SidebarNavAction,
1500
1533
  NavLabel: SidebarNavLabel,
1501
1534
  NavLink: SidebarNavLink,
1502
1535
  NavList: SidebarNavList,
@@ -1531,6 +1564,7 @@ exports.SidebarHeader = SidebarHeader;
1531
1564
  exports.SidebarMeter = SidebarMeter;
1532
1565
  exports.SidebarMobileTrigger = SidebarMobileTrigger;
1533
1566
  exports.SidebarNav = SidebarNav;
1567
+ exports.SidebarNavAction = SidebarNavAction;
1534
1568
  exports.SidebarNavHeader = SidebarNavHeader;
1535
1569
  exports.SidebarNavLink = SidebarNavLink;
1536
1570
  exports.SidebarNavShowMore = SidebarNavShowMore;