@mastra/playground-ui 30.0.0-alpha.5 → 30.0.0-alpha.8

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/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # @mastra/playground-ui
2
2
 
3
+ ## 30.0.0-alpha.8
4
+
5
+ ### Patch Changes
6
+
7
+ - Exported ContextMenu from the package entry so it can be imported alongside other Base UI primitives. ([#17062](https://github.com/mastra-ai/mastra/pull/17062))
8
+
9
+ - Updated dependencies [[`c35b962`](https://github.com/mastra-ai/mastra/commit/c35b9625c7e854fcfdeee226a3338a750d0ff211), [`c35b962`](https://github.com/mastra-ai/mastra/commit/c35b9625c7e854fcfdeee226a3338a750d0ff211), [`9be1545`](https://github.com/mastra-ai/mastra/commit/9be1545475eb81a716169bb1281a37853cc739e0), [`4084113`](https://github.com/mastra-ai/mastra/commit/408411370fc48a822e8b616b3b63f9409774e0e9), [`bc01b1b`](https://github.com/mastra-ai/mastra/commit/bc01b1bfafe381d90af909f8bce7eeb4eee779f2), [`1120b4f`](https://github.com/mastra-ai/mastra/commit/1120b4fa928552c6ee1751efa5603d955841e766)]:
10
+ - @mastra/core@1.37.0-alpha.8
11
+ - @mastra/client-js@1.21.0-alpha.8
12
+ - @mastra/react@0.4.1-alpha.8
13
+
14
+ ## 30.0.0-alpha.7
15
+
16
+ ### Patch Changes
17
+
18
+ - Design-system additions to support theming: ([#17059](https://github.com/mastra-ai/mastra/pull/17059))
19
+ - `Avatar` now accepts optional `color` and `textColor` props for per-instance tinting, and falls back to the initial when the image fails to load.
20
+ - `Searchbar` accepts an optional `className` to let consumers tune layout without forking.
21
+ - `TabList` accepts a `style` prop and the active-tab indicator now reads from the `--tab-indicator-color` CSS variable, letting parents theme the indicator (e.g. per-agent accent color).
22
+ - `stringToColor` now accepts any `number` for the `lightness` argument and defaults to `90` instead of `75` for a lighter fallback chip.
23
+ - Global `body` rule enables `font-smoothing` / `-webkit-font-smoothing` for crisper UI text.
24
+
25
+ - Updated dependencies [[`f1b9f87`](https://github.com/mastra-ai/mastra/commit/f1b9f87a00505f15d4fe39f92de287674adc2198), [`168fa09`](https://github.com/mastra-ai/mastra/commit/168fa09d6b39114cb8c13bd06f1dccb9bc81c6cd), [`af2e1f8`](https://github.com/mastra-ai/mastra/commit/af2e1f8e2a2d2c4ba75167d5c93ca44395639eff)]:
26
+ - @mastra/react@0.4.1-alpha.7
27
+ - @mastra/core@1.37.0-alpha.7
28
+ - @mastra/client-js@1.21.0-alpha.7
29
+
30
+ ## 30.0.0-alpha.6
31
+
32
+ ### Patch Changes
33
+
34
+ - Updated dependencies [[`0cbece9`](https://github.com/mastra-ai/mastra/commit/0cbece9d832cb134a74cdbf3682d390a058215a4), [`7dfe1bc`](https://github.com/mastra-ai/mastra/commit/7dfe1bcfe71d261a6fd6bbf29b1dec49d78fb98f), [`70cb714`](https://github.com/mastra-ai/mastra/commit/70cb7149c8f16f478e15b58498254a53181750a4), [`7f9da22`](https://github.com/mastra-ai/mastra/commit/7f9da22efd5aa595e138a31de55a5f0f2f28b33d)]:
35
+ - @mastra/core@1.37.0-alpha.6
36
+ - @mastra/client-js@1.21.0-alpha.6
37
+ - @mastra/react@0.4.1-alpha.6
38
+
3
39
  ## 30.0.0-alpha.5
4
40
 
5
41
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  require('./index.css');const jsxRuntime = require('react/jsx-runtime');
6
- const tokens = require('./tokens.cjs.js');
7
6
  const React = require('react');
7
+ const tokens = require('./tokens.cjs.js');
8
8
  const tooltip = require('@base-ui/react/tooltip');
9
9
  const langJson = require('@codemirror/lang-json');
10
10
  const langMarkdown = require('@codemirror/lang-markdown');
@@ -25,6 +25,7 @@ const collapsible = require('@base-ui/react/collapsible');
25
25
  const combobox = require('@base-ui/react/combobox');
26
26
  const cmdk = require('cmdk');
27
27
  const dialog = require('@base-ui/react/dialog');
28
+ const contextMenu = require('@base-ui/react/context-menu');
28
29
  const select = require('@base-ui/react/select');
29
30
  const tabs = require('@base-ui/react/tabs');
30
31
  const drawer = require('@base-ui/react/drawer');
@@ -3423,17 +3424,31 @@ const sizeClasses$4 = {
3423
3424
  md: "h-avatar-md w-avatar-md",
3424
3425
  lg: "h-avatar-lg w-avatar-lg"
3425
3426
  };
3426
- const Avatar = ({ src, name, size = "sm", interactive = false }) => {
3427
+ const Avatar = ({ src, name, size = "sm", interactive = false, color, textColor }) => {
3428
+ const [didError, setDidError] = React.useState(false);
3429
+ const initial = name.trim()[0]?.toUpperCase() ?? "A";
3430
+ const showImage = Boolean(src) && !didError;
3431
+ const showFallbackTint = !showImage && Boolean(color);
3427
3432
  return /* @__PURE__ */ jsxRuntime.jsx(
3428
3433
  "div",
3429
3434
  {
3430
3435
  className: cn(
3431
3436
  sizeClasses$4[size],
3432
- "border border-border1 bg-surface3 shrink-0 overflow-hidden rounded-full flex items-center justify-center",
3437
+ "border border-border1 shrink-0 overflow-hidden rounded-full flex items-center justify-center",
3438
+ !showFallbackTint && "bg-surface3",
3433
3439
  transitions.all,
3434
3440
  interactive && "cursor-pointer hover:scale-105 hover:border-neutral2 hover:shadow-sm"
3435
3441
  ),
3436
- children: src ? /* @__PURE__ */ jsxRuntime.jsx("img", { src, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-md", className: "text-center text-neutral4", children: name[0].toUpperCase() })
3442
+ style: showFallbackTint ? { backgroundColor: color } : void 0,
3443
+ children: showImage ? /* @__PURE__ */ jsxRuntime.jsx("img", { src, alt: name, className: "h-full w-full object-cover", onError: () => setDidError(true) }) : /* @__PURE__ */ jsxRuntime.jsx(
3444
+ Txt,
3445
+ {
3446
+ variant: "ui-md",
3447
+ className: cn("text-center", !showFallbackTint && "text-neutral4"),
3448
+ style: showFallbackTint && textColor ? { color: textColor } : void 0,
3449
+ children: initial
3450
+ }
3451
+ )
3437
3452
  }
3438
3453
  );
3439
3454
  };
@@ -6694,6 +6709,187 @@ const CommandShortcut = ({ className, ...props }) => {
6694
6709
  };
6695
6710
  CommandShortcut.displayName = "CommandShortcut";
6696
6711
 
6712
+ const ContextMenuRoot = contextMenu.ContextMenu.Root;
6713
+ const ContextMenuGroup = contextMenu.ContextMenu.Group;
6714
+ const ContextMenuPortal = contextMenu.ContextMenu.Portal;
6715
+ const ContextMenuSub = contextMenu.ContextMenu.SubmenuRoot;
6716
+ const ContextMenuRadioGroup = contextMenu.ContextMenu.RadioGroup;
6717
+ const itemClass$1 = cn(
6718
+ "relative flex cursor-pointer select-none items-center gap-2.5 rounded-lg px-2 py-1.5 text-ui-smd leading-ui-sm transition-colors text-neutral4 hover:text-neutral6 focus:text-neutral6 hover:bg-surface4 focus:bg-surface4 data-[highlighted]:bg-surface4 data-[highlighted]:text-neutral6 data-disabled:cursor-not-allowed data-disabled:opacity-50 data-disabled:hover:bg-transparent data-disabled:hover:text-neutral4 data-disabled:focus:bg-transparent data-disabled:focus:text-neutral4 data-disabled:data-[highlighted]:bg-transparent data-disabled:data-[highlighted]:text-neutral4 [&>span]:truncate [&_svg]:size-4 [&_svg]:shrink-0 outline-none focus:outline-none focus-visible:outline-none focus-visible:ring-0",
6719
+ "[&>svg]:w-[1.1em] [&>svg]:h-[1.1em] [&>svg]:opacity-60 [&:hover>svg]:opacity-100"
6720
+ );
6721
+ const popupClass$1 = cn(
6722
+ "bg-surface3 text-neutral4 z-50 min-w-44 max-h-[min(20rem,var(--available-height))] overflow-x-hidden overflow-y-auto rounded-xl border border-border1 p-1 shadow-dialog origin-[var(--transform-origin)] outline-none",
6723
+ "data-[open]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[open]:fade-in-0 data-[closed]:zoom-out-95 data-[open]:zoom-in-95",
6724
+ "data-[side=bottom]:slide-in-from-top-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1"
6725
+ );
6726
+ const ContextMenuTrigger = contextMenu.ContextMenu.Trigger;
6727
+ const ContextMenuContent = React__namespace.forwardRef(
6728
+ ({ className, align = "start", alignOffset = 4, side, sideOffset = 0, container, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(contextMenu.ContextMenu.Portal, { container, children: /* @__PURE__ */ jsxRuntime.jsx(
6729
+ contextMenu.ContextMenu.Positioner,
6730
+ {
6731
+ align,
6732
+ alignOffset,
6733
+ side,
6734
+ sideOffset,
6735
+ className: "z-50 outline-none",
6736
+ children: /* @__PURE__ */ jsxRuntime.jsx(
6737
+ contextMenu.ContextMenu.Popup,
6738
+ {
6739
+ ref,
6740
+ "data-slot": "context-menu-content",
6741
+ className: cn(popupClass$1, className),
6742
+ ...props
6743
+ }
6744
+ )
6745
+ }
6746
+ ) })
6747
+ );
6748
+ ContextMenuContent.displayName = "ContextMenuContent";
6749
+ const ContextMenuItem = React__namespace.forwardRef(
6750
+ ({ className, inset, variant = "default", onSelect, onClick, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
6751
+ contextMenu.ContextMenu.Item,
6752
+ {
6753
+ ref,
6754
+ "data-inset": inset ? "" : void 0,
6755
+ "data-variant": variant,
6756
+ onClick: (event) => {
6757
+ onClick?.(event);
6758
+ onSelect?.(event);
6759
+ },
6760
+ className: cn(
6761
+ itemClass$1,
6762
+ inset && "pl-8",
6763
+ "data-[variant=destructive]:text-accent2 data-[variant=destructive]:hover:bg-accent2/10 data-[variant=destructive]:hover:text-accent2 data-[variant=destructive]:data-[highlighted]:bg-accent2/10 data-[variant=destructive]:data-[highlighted]:text-accent2",
6764
+ className
6765
+ ),
6766
+ ...props
6767
+ }
6768
+ )
6769
+ );
6770
+ ContextMenuItem.displayName = "ContextMenuItem";
6771
+ const ContextMenuCheckboxItem = React__namespace.forwardRef(
6772
+ ({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
6773
+ contextMenu.ContextMenu.CheckboxItem,
6774
+ {
6775
+ ref,
6776
+ checked,
6777
+ className: cn(itemClass$1, "w-full", className),
6778
+ ...props,
6779
+ children: [
6780
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border border-border2 flex h-4 w-4 items-center justify-center rounded-sm", children: /* @__PURE__ */ jsxRuntime.jsx(contextMenu.ContextMenu.CheckboxItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, {}) }) }),
6781
+ children
6782
+ ]
6783
+ }
6784
+ )
6785
+ );
6786
+ ContextMenuCheckboxItem.displayName = "ContextMenuCheckboxItem";
6787
+ const ContextMenuRadioItem = React__namespace.forwardRef(
6788
+ ({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
6789
+ contextMenu.ContextMenu.RadioItem,
6790
+ {
6791
+ ref,
6792
+ className: cn(
6793
+ "relative flex cursor-pointer select-none items-center rounded-lg py-1.5 pl-8 pr-2 text-ui-smd leading-ui-sm transition-colors text-neutral4 hover:text-neutral6 focus:text-neutral6 hover:bg-surface4 focus:bg-surface4 data-[highlighted]:bg-surface4 data-[highlighted]:text-neutral6 data-disabled:cursor-not-allowed data-disabled:opacity-50 data-disabled:hover:bg-transparent data-disabled:hover:text-neutral4 data-disabled:focus:bg-transparent data-disabled:focus:text-neutral4 data-disabled:data-[highlighted]:bg-transparent data-disabled:data-[highlighted]:text-neutral4 outline-none focus:outline-none focus-visible:outline-none focus-visible:ring-0",
6794
+ className
6795
+ ),
6796
+ ...props,
6797
+ children: [
6798
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(contextMenu.ContextMenu.RadioItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Circle, { className: "h-2 w-2 fill-current" }) }) }),
6799
+ children
6800
+ ]
6801
+ }
6802
+ )
6803
+ );
6804
+ ContextMenuRadioItem.displayName = "ContextMenuRadioItem";
6805
+ const ContextMenuLabel = React__namespace.forwardRef(
6806
+ ({ className, inset, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
6807
+ "div",
6808
+ {
6809
+ ref,
6810
+ className: cn(
6811
+ "px-2 pt-1.5 pb-1 text-ui-xs font-medium uppercase tracking-wider text-neutral3",
6812
+ inset && "pl-8",
6813
+ className
6814
+ ),
6815
+ ...props
6816
+ }
6817
+ )
6818
+ );
6819
+ ContextMenuLabel.displayName = "ContextMenuLabel";
6820
+ const ContextMenuSeparator = React__namespace.forwardRef(
6821
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(contextMenu.ContextMenu.Separator, { ref, className: cn("bg-border1 -mx-1 my-1 h-px", className), ...props })
6822
+ );
6823
+ ContextMenuSeparator.displayName = "ContextMenuSeparator";
6824
+ const ContextMenuShortcut = ({ className, ...props }) => {
6825
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("ml-auto text-xs tracking-widest opacity-60", className), ...props });
6826
+ };
6827
+ ContextMenuShortcut.displayName = "ContextMenuShortcut";
6828
+ const ContextMenuSubTrigger = React__namespace.forwardRef(
6829
+ ({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
6830
+ contextMenu.ContextMenu.SubmenuTrigger,
6831
+ {
6832
+ ref,
6833
+ className: cn(
6834
+ itemClass$1,
6835
+ "data-[popup-open]:bg-surface4 data-[popup-open]:text-neutral6",
6836
+ inset && "pl-8",
6837
+ className
6838
+ ),
6839
+ ...props,
6840
+ children: [
6841
+ children,
6842
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-auto pl-2", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "-rotate-90 opacity-50" }) })
6843
+ ]
6844
+ }
6845
+ )
6846
+ );
6847
+ ContextMenuSubTrigger.displayName = "ContextMenuSubTrigger";
6848
+ const ContextMenuSubContent = React__namespace.forwardRef(
6849
+ ({ className, align = "start", alignOffset = -4, side = "right", sideOffset = -4, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(contextMenu.ContextMenu.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
6850
+ contextMenu.ContextMenu.Positioner,
6851
+ {
6852
+ align,
6853
+ alignOffset,
6854
+ side,
6855
+ sideOffset,
6856
+ className: "z-50 outline-none",
6857
+ children: /* @__PURE__ */ jsxRuntime.jsx(
6858
+ contextMenu.ContextMenu.Popup,
6859
+ {
6860
+ ref,
6861
+ "data-slot": "context-menu-sub-content",
6862
+ className: cn(popupClass$1, className),
6863
+ ...props
6864
+ }
6865
+ )
6866
+ }
6867
+ ) })
6868
+ );
6869
+ ContextMenuSubContent.displayName = "ContextMenuSubContent";
6870
+ function ContextMenu({
6871
+ open,
6872
+ defaultOpen,
6873
+ onOpenChange,
6874
+ children
6875
+ }) {
6876
+ return /* @__PURE__ */ jsxRuntime.jsx(ContextMenuRoot, { open, defaultOpen, onOpenChange, children });
6877
+ }
6878
+ ContextMenu.Trigger = ContextMenuTrigger;
6879
+ ContextMenu.Content = ContextMenuContent;
6880
+ ContextMenu.Group = ContextMenuGroup;
6881
+ ContextMenu.Portal = ContextMenuPortal;
6882
+ ContextMenu.Item = ContextMenuItem;
6883
+ ContextMenu.CheckboxItem = ContextMenuCheckboxItem;
6884
+ ContextMenu.RadioItem = ContextMenuRadioItem;
6885
+ ContextMenu.Label = ContextMenuLabel;
6886
+ ContextMenu.Separator = ContextMenuSeparator;
6887
+ ContextMenu.Shortcut = ContextMenuShortcut;
6888
+ ContextMenu.Sub = ContextMenuSub;
6889
+ ContextMenu.SubContent = ContextMenuSubContent;
6890
+ ContextMenu.SubTrigger = ContextMenuSubTrigger;
6891
+ ContextMenu.RadioGroup = ContextMenuRadioGroup;
6892
+
6697
6893
  function isSelectItem(node) {
6698
6894
  return React__namespace.isValidElement(node) && node.type?.displayName === "SelectItem";
6699
6895
  }
@@ -6839,20 +7035,21 @@ const tabListVariants = cva("flex items-center relative text-ui-lg", {
6839
7035
  variant: "line"
6840
7036
  }
6841
7037
  });
6842
- const TabList = ({ children, className, variant, sticky }) => {
7038
+ const TabList = ({ children, className, variant, sticky, style }) => {
6843
7039
  const resolvedVariant = variant ?? "line";
6844
7040
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full overflow-x-auto", sticky && "sticky top-0 z-10 bg-surface2"), children: /* @__PURE__ */ jsxRuntime.jsxs(
6845
7041
  tabs.Tabs.List,
6846
7042
  {
6847
7043
  "data-variant": resolvedVariant,
6848
7044
  className: cn("group/tabs-list", tabListVariants({ variant: resolvedVariant }), className),
7045
+ style,
6849
7046
  children: [
6850
7047
  children,
6851
7048
  resolvedVariant === "line" && /* @__PURE__ */ jsxRuntime.jsx(
6852
7049
  tabs.Tabs.Indicator,
6853
7050
  {
6854
7051
  className: cn(
6855
- "absolute bottom-0 left-0 bg-neutral3",
7052
+ "absolute bottom-0 left-0 bg-[var(--tab-indicator-color,var(--neutral3))]",
6856
7053
  "w-[var(--active-tab-width)] h-0.5",
6857
7054
  "transition-all duration-200 ease-in-out"
6858
7055
  ),
@@ -6863,7 +7060,7 @@ const TabList = ({ children, className, variant, sticky }) => {
6863
7060
  tabs.Tabs.Indicator,
6864
7061
  {
6865
7062
  className: cn(
6866
- "absolute top-1/2 left-0 z-0 rounded-full bg-surface4",
7063
+ "absolute top-1/2 left-0 z-0 rounded-full bg-[var(--tab-indicator-color,var(--surface4))]",
6867
7064
  "w-[var(--active-tab-width)] h-[calc(100%-0.5rem)]",
6868
7065
  "transition-all duration-200 ease-in-out"
6869
7066
  ),
@@ -9272,7 +9469,14 @@ const searchbarSizeClasses = {
9272
9469
  lg: formElementSizes.lg,
9273
9470
  default: formElementSizes.default
9274
9471
  };
9275
- const Searchbar = ({ onSearch, label, placeholder, debounceMs = 300, size = "md" }) => {
9472
+ const Searchbar = ({
9473
+ onSearch,
9474
+ label,
9475
+ placeholder,
9476
+ debounceMs = 300,
9477
+ size = "md",
9478
+ className
9479
+ }) => {
9276
9480
  const id = React.useId();
9277
9481
  const inputRef = React.useRef(null);
9278
9482
  const debouncedSearch = useDebounce.useDebouncedCallback((value) => {
@@ -9309,7 +9513,8 @@ const Searchbar = ({ onSearch, label, placeholder, debounceMs = 300, size = "md"
9309
9513
  formElementFocusWithin,
9310
9514
  transitions.all,
9311
9515
  "hover:border-neutral2",
9312
- searchbarSizeClasses[size]
9516
+ searchbarSizeClasses[size],
9517
+ className
9313
9518
  ),
9314
9519
  children: [
9315
9520
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.SearchIcon, { className: cn("text-neutral3 h-4 w-4", transitions.colors) }),
@@ -15751,7 +15956,7 @@ const isValidJson = (str) => {
15751
15956
  }
15752
15957
  };
15753
15958
 
15754
- const stringToColor = (str, lightness = 75, saturation = 100) => {
15959
+ const stringToColor = (str, lightness = 90, saturation = 100) => {
15755
15960
  let hash = 0;
15756
15961
  for (let i = 0; i < str.length; i++) {
15757
15962
  hash = str.charCodeAt(i) + ((hash << 5) - hash);
@@ -22204,6 +22409,7 @@ exports.CommandShortcut = CommandShortcut;
22204
22409
  exports.CommitIcon = CommitIcon;
22205
22410
  exports.ContentBlock = ContentBlock;
22206
22411
  exports.ContentBlocks = ContentBlocks;
22412
+ exports.ContextMenu = ContextMenu;
22207
22413
  exports.CopyButton = CopyButton;
22208
22414
  exports.CrossIcon = CrossIcon;
22209
22415
  exports.Crumb = Crumb;