@mastra/playground-ui 31.0.0-alpha.8 → 31.0.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.
package/dist/index.es.js CHANGED
@@ -6485,6 +6485,17 @@ const comboboxStyles = {
6485
6485
  error: "text-ui-sm text-accent2"
6486
6486
  };
6487
6487
 
6488
+ const PortalContainerContext = React.createContext(null);
6489
+ function PortalContainerProvider({
6490
+ container,
6491
+ children
6492
+ }) {
6493
+ return /* @__PURE__ */ jsx(PortalContainerContext.Provider, { value: container, children });
6494
+ }
6495
+ function usePortalContainer() {
6496
+ return React.useContext(PortalContainerContext);
6497
+ }
6498
+
6488
6499
  const triggerVariantStyles = {
6489
6500
  default: comboboxStyles.triggerDefault,
6490
6501
  ghost: comboboxStyles.triggerGhost,
@@ -6507,6 +6518,8 @@ function Combobox({
6507
6518
  error
6508
6519
  }) {
6509
6520
  const selectedOption = options.find((option) => option.value === value) ?? null;
6521
+ const portalContainer = usePortalContainer();
6522
+ const resolvedContainer = container ?? portalContainer;
6510
6523
  const handleSelect = (item) => {
6511
6524
  if (item) {
6512
6525
  onValueChange?.(item.value);
@@ -6542,7 +6555,7 @@ function Combobox({
6542
6555
  ]
6543
6556
  }
6544
6557
  ),
6545
- /* @__PURE__ */ jsx(Combobox$1.Portal, { container, children: /* @__PURE__ */ jsx(Combobox$1.Positioner, { align: "start", sideOffset: 4, className: comboboxStyles.positioner, children: /* @__PURE__ */ jsxs(Combobox$1.Popup, { className: comboboxStyles.popup, children: [
6558
+ /* @__PURE__ */ jsx(Combobox$1.Portal, { container: resolvedContainer, children: /* @__PURE__ */ jsx(Combobox$1.Positioner, { align: "start", sideOffset: 4, className: comboboxStyles.positioner, children: /* @__PURE__ */ jsxs(Combobox$1.Popup, { className: comboboxStyles.popup, children: [
6546
6559
  /* @__PURE__ */ jsxs("div", { className: comboboxStyles.searchContainer, children: [
6547
6560
  /* @__PURE__ */ jsx(Search, { className: comboboxStyles.searchIcon }),
6548
6561
  /* @__PURE__ */ jsx(Combobox$1.Input, { className: comboboxStyles.searchInput, placeholder: searchPlaceholder })
@@ -7082,30 +7095,34 @@ const SelectTrigger = React.forwardRef(
7082
7095
  );
7083
7096
  SelectTrigger.displayName = "SelectTrigger";
7084
7097
  const SelectContent = React.forwardRef(
7085
- ({ className, children, position: _position, container, side = "bottom", align = "start", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(Select$1.Portal, { container: container ?? void 0, children: /* @__PURE__ */ jsx(
7086
- Select$1.Positioner,
7087
- {
7088
- className: "z-50 outline-none",
7089
- side,
7090
- align,
7091
- sideOffset,
7092
- alignItemWithTrigger: false,
7093
- children: /* @__PURE__ */ jsx(
7094
- Select$1.Popup,
7095
- {
7096
- ref,
7097
- className: cn(
7098
- "relative z-50 min-w-32 min-w-[var(--anchor-width)] max-h-dropdown-max-height max-h-[var(--available-height)] overflow-y-auto overflow-x-hidden rounded-xl border border-border1 bg-surface3 p-1 text-neutral4 shadow-dialog origin-[var(--transform-origin)]",
7099
- "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",
7100
- "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",
7101
- className
7102
- ),
7103
- ...props,
7104
- children: /* @__PURE__ */ jsx(Select$1.List, { children })
7105
- }
7106
- )
7107
- }
7108
- ) })
7098
+ ({ className, children, position: _position, container, side = "bottom", align = "start", sideOffset = 4, ...props }, ref) => {
7099
+ const portalContainer = usePortalContainer();
7100
+ const resolvedContainer = container ?? portalContainer;
7101
+ return /* @__PURE__ */ jsx(Select$1.Portal, { container: resolvedContainer ?? void 0, children: /* @__PURE__ */ jsx(
7102
+ Select$1.Positioner,
7103
+ {
7104
+ className: "z-50 outline-none",
7105
+ side,
7106
+ align,
7107
+ sideOffset,
7108
+ alignItemWithTrigger: false,
7109
+ children: /* @__PURE__ */ jsx(
7110
+ Select$1.Popup,
7111
+ {
7112
+ ref,
7113
+ className: cn(
7114
+ "relative z-50 min-w-32 min-w-[var(--anchor-width)] max-h-dropdown-max-height max-h-[var(--available-height)] overflow-y-auto overflow-x-hidden rounded-xl border border-border1 bg-surface3 p-1 text-neutral4 shadow-dialog origin-[var(--transform-origin)]",
7115
+ "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",
7116
+ "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",
7117
+ className
7118
+ ),
7119
+ ...props,
7120
+ children: /* @__PURE__ */ jsx(Select$1.List, { children })
7121
+ }
7122
+ )
7123
+ }
7124
+ ) });
7125
+ }
7109
7126
  );
7110
7127
  SelectContent.displayName = "SelectContent";
7111
7128
  const SelectItem = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
@@ -7528,47 +7545,54 @@ const DropdownMenuSubTrigger = React.forwardRef(
7528
7545
  );
7529
7546
  DropdownMenuSubTrigger.displayName = "DropdownMenuSubTrigger";
7530
7547
  const DropdownMenuSubContent = React.forwardRef(
7531
- ({ className, align = "start", alignOffset = -4, side = "right", sideOffset = 0, ...props }, ref) => /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(
7532
- Menu.Positioner,
7533
- {
7534
- align,
7535
- alignOffset,
7536
- side,
7537
- sideOffset,
7538
- className: "z-50 outline-none",
7539
- children: /* @__PURE__ */ jsx(
7540
- Menu.Popup,
7541
- {
7542
- ref,
7543
- "data-slot": "dropdown-menu-sub-content",
7544
- className: cn(popupClass, className),
7545
- ...props
7546
- }
7547
- )
7548
- }
7549
- ) })
7548
+ ({ className, align = "start", alignOffset = -4, side = "right", sideOffset = 0, ...props }, ref) => {
7549
+ const portalContainer = usePortalContainer();
7550
+ return /* @__PURE__ */ jsx(Menu.Portal, { container: portalContainer ?? void 0, children: /* @__PURE__ */ jsx(
7551
+ Menu.Positioner,
7552
+ {
7553
+ align,
7554
+ alignOffset,
7555
+ side,
7556
+ sideOffset,
7557
+ className: "z-50 outline-none",
7558
+ children: /* @__PURE__ */ jsx(
7559
+ Menu.Popup,
7560
+ {
7561
+ ref,
7562
+ "data-slot": "dropdown-menu-sub-content",
7563
+ className: cn(popupClass, className),
7564
+ ...props
7565
+ }
7566
+ )
7567
+ }
7568
+ ) });
7569
+ }
7550
7570
  );
7551
7571
  DropdownMenuSubContent.displayName = "DropdownMenuSubContent";
7552
7572
  const DropdownMenuContent = React.forwardRef(
7553
- ({ className, container, align = "start", alignOffset = 0, side = "bottom", sideOffset = 8, ...props }, ref) => /* @__PURE__ */ jsx(Menu.Portal, { container, children: /* @__PURE__ */ jsx(
7554
- Menu.Positioner,
7555
- {
7556
- align,
7557
- alignOffset,
7558
- side,
7559
- sideOffset,
7560
- className: "z-50 outline-none",
7561
- children: /* @__PURE__ */ jsx(
7562
- Menu.Popup,
7563
- {
7564
- ref,
7565
- "data-slot": "dropdown-menu-content",
7566
- className: cn(popupClass, className),
7567
- ...props
7568
- }
7569
- )
7570
- }
7571
- ) })
7573
+ ({ className, container, align = "start", alignOffset = 0, side = "bottom", sideOffset = 8, ...props }, ref) => {
7574
+ const portalContainer = usePortalContainer();
7575
+ const resolvedContainer = container ?? portalContainer ?? void 0;
7576
+ return /* @__PURE__ */ jsx(Menu.Portal, { container: resolvedContainer, children: /* @__PURE__ */ jsx(
7577
+ Menu.Positioner,
7578
+ {
7579
+ align,
7580
+ alignOffset,
7581
+ side,
7582
+ sideOffset,
7583
+ className: "z-50 outline-none",
7584
+ children: /* @__PURE__ */ jsx(
7585
+ Menu.Popup,
7586
+ {
7587
+ ref,
7588
+ "data-slot": "dropdown-menu-content",
7589
+ className: cn(popupClass, className),
7590
+ ...props
7591
+ }
7592
+ )
7593
+ }
7594
+ ) });
7595
+ }
7572
7596
  );
7573
7597
  DropdownMenuContent.displayName = "DropdownMenuContent";
7574
7598
  const DropdownMenuItem = React.forwardRef(
@@ -8625,9 +8649,11 @@ const PopoverTrigger = React.forwardRef(
8625
8649
  );
8626
8650
  PopoverTrigger.displayName = "PopoverTrigger";
8627
8651
  const PopoverContent = React.forwardRef(
8628
- ({ className, align = "center", alignOffset = 0, side = "bottom", sideOffset = 4, ...props }, ref) => {
8652
+ ({ className, container, align = "center", alignOffset = 0, side = "bottom", sideOffset = 4, ...props }, ref) => {
8629
8653
  const classNameString = typeof className === "string" ? className : void 0;
8630
- return /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(
8654
+ const portalContainer = usePortalContainer();
8655
+ const resolvedContainer = container ?? portalContainer;
8656
+ return /* @__PURE__ */ jsx(Popover$1.Portal, { container: resolvedContainer ?? void 0, children: /* @__PURE__ */ jsx(
8631
8657
  Popover$1.Positioner,
8632
8658
  {
8633
8659
  align,
@@ -12259,6 +12285,7 @@ function SideDialogRoot({
12259
12285
  className
12260
12286
  }) {
12261
12287
  const isConfirmation = variant === "confirmation";
12288
+ const [portalHost, setPortalHost] = React.useState(null);
12262
12289
  return /* @__PURE__ */ jsx(
12263
12290
  Drawer,
12264
12291
  {
@@ -12303,7 +12330,8 @@ function SideDialogRoot({
12303
12330
  )
12304
12331
  }
12305
12332
  ),
12306
- /* @__PURE__ */ jsx(
12333
+ /* @__PURE__ */ jsx(DrawerInteractive, { render: /* @__PURE__ */ jsx("div", { ref: setPortalHost, className: "absolute" }) }),
12334
+ /* @__PURE__ */ jsx(PortalContainerProvider, { container: portalHost, children: /* @__PURE__ */ jsx(
12307
12335
  "div",
12308
12336
  {
12309
12337
  className: cn("grid h-full", {
@@ -12311,7 +12339,7 @@ function SideDialogRoot({
12311
12339
  }),
12312
12340
  children
12313
12341
  }
12314
- )
12342
+ ) })
12315
12343
  ]
12316
12344
  }
12317
12345
  ) })