@mastra/playground-ui 29.0.0-alpha.9 → 29.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.css CHANGED
@@ -183,7 +183,6 @@
183
183
  --blur-xs: 4px;
184
184
  --blur-sm: 8px;
185
185
  --blur-md: 12px;
186
- --blur-xl: 24px;
187
186
  --default-transition-duration: .15s;
188
187
  --default-transition-timing-function: cubic-bezier(.4, 0, .2, 1);
189
188
  --default-font-family: var(--font-sans);
@@ -1256,6 +1255,10 @@
1256
1255
  height: calc(100vh - 6rem) !important;
1257
1256
  }
1258
1257
 
1258
+ .h-\[var\(--collapsible-panel-height\)\] {
1259
+ height: var(--collapsible-panel-height);
1260
+ }
1261
+
1259
1262
  .h-auto {
1260
1263
  height: auto;
1261
1264
  }
@@ -1858,10 +1861,6 @@
1858
1861
  min-width: var(--spacing-80);
1859
1862
  }
1860
1863
 
1861
- .min-w-\[8rem\] {
1862
- min-width: 8rem;
1863
- }
1864
-
1865
1864
  .min-w-\[12rem\] {
1866
1865
  min-width: 12rem;
1867
1866
  }
@@ -4181,12 +4180,6 @@
4181
4180
  backdrop-filter: var(--tw-backdrop-blur, ) var(--tw-backdrop-brightness, ) var(--tw-backdrop-contrast, ) var(--tw-backdrop-grayscale, ) var(--tw-backdrop-hue-rotate, ) var(--tw-backdrop-invert, ) var(--tw-backdrop-opacity, ) var(--tw-backdrop-saturate, ) var(--tw-backdrop-sepia, );
4182
4181
  }
4183
4182
 
4184
- .backdrop-blur-xl {
4185
- --tw-backdrop-blur: blur(var(--blur-xl));
4186
- -webkit-backdrop-filter: var(--tw-backdrop-blur, ) var(--tw-backdrop-brightness, ) var(--tw-backdrop-contrast, ) var(--tw-backdrop-grayscale, ) var(--tw-backdrop-hue-rotate, ) var(--tw-backdrop-invert, ) var(--tw-backdrop-opacity, ) var(--tw-backdrop-saturate, ) var(--tw-backdrop-sepia, );
4187
- backdrop-filter: var(--tw-backdrop-blur, ) var(--tw-backdrop-brightness, ) var(--tw-backdrop-contrast, ) var(--tw-backdrop-grayscale, ) var(--tw-backdrop-hue-rotate, ) var(--tw-backdrop-invert, ) var(--tw-backdrop-opacity, ) var(--tw-backdrop-saturate, ) var(--tw-backdrop-sepia, );
4188
- }
4189
-
4190
4183
  .backdrop-blur-xs {
4191
4184
  --tw-backdrop-blur: blur(var(--blur-xs));
4192
4185
  -webkit-backdrop-filter: var(--tw-backdrop-blur, ) var(--tw-backdrop-brightness, ) var(--tw-backdrop-contrast, ) var(--tw-backdrop-grayscale, ) var(--tw-backdrop-hue-rotate, ) var(--tw-backdrop-invert, ) var(--tw-backdrop-opacity, ) var(--tw-backdrop-saturate, ) var(--tw-backdrop-sepia, );
@@ -4199,6 +4192,12 @@
4199
4192
  transition-duration: var(--tw-duration, var(--default-transition-duration));
4200
4193
  }
4201
4194
 
4195
+ .transition-\[height\] {
4196
+ transition-property: height;
4197
+ transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
4198
+ transition-duration: var(--tw-duration, var(--default-transition-duration));
4199
+ }
4200
+
4202
4201
  .transition-\[transform\,scale\,opacity\] {
4203
4202
  transition-property: transform, scale, opacity;
4204
4203
  transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
@@ -5431,6 +5430,10 @@
5431
5430
  opacity: .5;
5432
5431
  }
5433
5432
 
5433
+ .data-\[ending-style\]\:h-0[data-ending-style] {
5434
+ height: var(--spacing-0);
5435
+ }
5436
+
5434
5437
  .data-\[ending-style\]\:scale-95[data-ending-style] {
5435
5438
  --tw-scale-x: 95%;
5436
5439
  --tw-scale-y: 95%;
@@ -5675,6 +5678,10 @@
5675
5678
  --tw-enter-translate-y: calc(1*var(--spacing));
5676
5679
  }
5677
5680
 
5681
+ .data-\[starting-style\]\:h-0[data-starting-style] {
5682
+ height: var(--spacing-0);
5683
+ }
5684
+
5678
5685
  .data-\[starting-style\]\:scale-95[data-starting-style] {
5679
5686
  --tw-scale-x: 95%;
5680
5687
  --tw-scale-y: 95%;
@@ -5760,10 +5767,6 @@
5760
5767
  --tw-exit-translate-x: calc(1 / 4*100%);
5761
5768
  }
5762
5769
 
5763
- .data-\[state\=closed\]\:slide-out-to-top-1[data-state="closed"] {
5764
- --tw-exit-translate-y: calc(1*var(--spacing)*-1);
5765
- }
5766
-
5767
5770
  .data-\[state\=open\]\:animate-in[data-state="open"] {
5768
5771
  animation: enter var(--tw-animation-duration, var(--tw-duration, .15s))var(--tw-ease, ease)var(--tw-animation-delay, 0s)var(--tw-animation-iteration-count, 1)var(--tw-animation-direction, normal)var(--tw-animation-fill-mode, none);
5769
5772
  }
@@ -5806,10 +5809,6 @@
5806
5809
  --tw-enter-translate-x: calc(1 / 4*100%);
5807
5810
  }
5808
5811
 
5809
- .data-\[state\=open\]\:slide-in-from-top-1[data-state="open"] {
5810
- --tw-enter-translate-y: calc(1*var(--spacing)*-1);
5811
- }
5812
-
5813
5812
  .data-\[state\=unchecked\]\:translate-x-0[data-state="unchecked"] {
5814
5813
  --tw-translate-x: var(--spacing-0);
5815
5814
  translate: var(--tw-translate-x) var(--tw-translate-y);
@@ -7091,7 +7090,7 @@
7091
7090
  height: var(--height-table-row-small);
7092
7091
  }
7093
7092
 
7094
- .\[\&\[data-state\=open\]\>svg\]\:rotate-90[data-state="open"] > svg {
7093
+ .\[\&\[data-panel-open\]\>svg\]\:rotate-90[data-panel-open] > svg {
7095
7094
  rotate: 90deg;
7096
7095
  }
7097
7096
 
package/dist/index.es.js CHANGED
@@ -17,9 +17,9 @@ import { autocompletion } from '@codemirror/autocomplete';
17
17
  import { CheckIcon as CheckIcon$1, CopyIcon, Wand2, ShieldX, LogIn, Check, ChevronsUpDown, Search, X, ChevronDown, Circle, TriangleAlertIcon, SearchIcon, XIcon, TrendingUpIcon, TrendingDownIcon, EllipsisVerticalIcon, SaveIcon, Trash2Icon, LockIcon, ListFilterPlusIcon, ArrowLeftIcon, FilterIcon, PlusIcon, ChevronRightIcon, Monitor, Sun, Moon, CalendarIcon, CircleAlertIcon, InfoIcon as InfoIcon$1, ArrowRightIcon, Type, Hash, ToggleLeft, AlignLeft, Braces, List, MenuIcon, PanelRightIcon, KeyboardIcon, AlignLeftIcon, AlignJustifyIcon, ArrowUpIcon, ArrowDownIcon, ChevronsRightIcon, ChevronLeftIcon, ClockIcon, BanIcon, FileTextIcon, OctagonAlertIcon, LightbulbIcon, ChevronRight, Folder, File, ListTreeIcon, CornerDownRightIcon, AlertTriangle, CircleXIcon, ExpandIcon, ExternalLinkIcon, Link2Icon, Ban, ListX, ChevronsLeft, ChevronsRight, ChevronLeft, Text, TextSearch, EqualNot, Equal, Plus, Component, ArrowRight, ArrowLeft, LogsIcon as LogsIcon$1, EyeIcon, GaugeIcon, BrainIcon, ChevronUpIcon, ChevronDownIcon, ChevronsUpIcon, ChevronsDownIcon, FoldVerticalIcon, UnfoldVerticalIcon, ChevronsDownUpIcon, ChevronsUpDownIcon, CircleGaugeIcon, FileInputIcon, FileOutputIcon, BracesIcon, CircleSlashIcon } from 'lucide-react';
18
18
  import { toast as toast$1, Toaster as Toaster$1 } from 'sonner';
19
19
  import { useMastraClient } from '@mastra/react';
20
- import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
20
+ import { AlertDialog as AlertDialog$1 } from '@base-ui/react/alert-dialog';
21
21
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
22
- import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
22
+ import { Collapsible as Collapsible$1 } from '@base-ui/react/collapsible';
23
23
  import { Combobox as Combobox$1 } from '@base-ui/react/combobox';
24
24
  export { Combobox as ComboboxPrimitive } from '@base-ui/react/combobox';
25
25
  import { Command as Command$1 } from 'cmdk';
@@ -47,7 +47,6 @@ import { DragDropContext, Droppable, Draggable } from '@hello-pangea/dnd';
47
47
  import { MergeView } from '@codemirror/merge';
48
48
  import { format as format$1 } from 'date-fns/format';
49
49
  import { isToday } from 'date-fns/isToday';
50
- import { Portal, SubContent } from '@radix-ui/react-dropdown-menu';
51
50
  import { SearchCursor } from '@codemirror/search';
52
51
  import { ResponsiveContainer, LineChart, CartesianGrid, XAxis, YAxis, Tooltip as Tooltip$2, Line } from 'recharts';
53
52
  import { usePanelRef, Panel, Separator as Separator$1 } from 'react-resizable-panels';
@@ -6036,9 +6035,7 @@ const Textarea = React.forwardRef(
6036
6035
  );
6037
6036
  Textarea.displayName = "Textarea";
6038
6037
 
6039
- const AlertDialogRoot = AlertDialogPrimitive.Root;
6040
- const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
6041
- const AlertDialogPortal = AlertDialogPrimitive.Portal;
6038
+ const AlertDialogRoot = AlertDialog$1.Root;
6042
6039
  function AlertDialog({
6043
6040
  open,
6044
6041
  onOpenChange,
@@ -6046,21 +6043,30 @@ function AlertDialog({
6046
6043
  }) {
6047
6044
  return /* @__PURE__ */ jsx(AlertDialogRoot, { open, onOpenChange, children });
6048
6045
  }
6046
+ const AlertDialogTrigger = React.forwardRef(
6047
+ ({ asChild, children, ...props }, ref) => {
6048
+ const renderProps = asChild && React.isValidElement(children) ? { render: children } : {};
6049
+ return /* @__PURE__ */ jsx(AlertDialog$1.Trigger, { ref, ...renderProps, ...props, children: asChild ? void 0 : children });
6050
+ }
6051
+ );
6052
+ AlertDialogTrigger.displayName = "AlertDialogTrigger";
6053
+ const AlertDialogPortal = AlertDialog$1.Portal;
6049
6054
  const AlertDialogOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
6050
- AlertDialogPrimitive.Overlay,
6055
+ AlertDialog$1.Backdrop,
6051
6056
  {
6052
6057
  ref,
6053
6058
  className: cn("dialog-overlay-anim fixed inset-0 z-50 bg-overlay backdrop-blur-xs", className),
6054
6059
  ...props
6055
6060
  }
6056
6061
  ));
6057
- AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
6062
+ AlertDialogOverlay.displayName = "AlertDialogOverlay";
6058
6063
  const AlertDialogContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs(AlertDialogPortal, { children: [
6059
6064
  /* @__PURE__ */ jsx(AlertDialogOverlay, {}),
6060
6065
  /* @__PURE__ */ jsx(
6061
- AlertDialogPrimitive.Content,
6066
+ AlertDialog$1.Popup,
6062
6067
  {
6063
6068
  ref,
6069
+ "data-slot": "alert-dialog-content",
6064
6070
  className: cn(
6065
6071
  "dialog-content-anim",
6066
6072
  "fixed left-[50%] top-[50%] z-50 grid translate-x-[-50%] translate-y-[-50%]",
@@ -6072,35 +6078,41 @@ const AlertDialogContent = React.forwardRef(({ className, ...props }, ref) => /*
6072
6078
  }
6073
6079
  )
6074
6080
  ] }));
6075
- AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
6081
+ AlertDialogContent.displayName = "AlertDialogContent";
6076
6082
  const AlertDialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx("div", { className: cn("flex flex-col gap-0.5 px-4 py-3 text-left", className), ...props });
6077
6083
  AlertDialogHeader.displayName = "AlertDialogHeader";
6078
6084
  const AlertDialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx("div", { className: cn("flex flex-col-reverse gap-1.5 px-4 py-2.5 sm:flex-row sm:justify-end", className), ...props });
6079
6085
  AlertDialogFooter.displayName = "AlertDialogFooter";
6080
6086
  const AlertDialogBody = ({ className, ...props }) => /* @__PURE__ */ jsx("div", { className: cn("overflow-y-auto px-4 py-3.5 max-h-[50vh]", className), ...props });
6081
6087
  AlertDialogBody.displayName = "AlertDialogBody";
6082
- const AlertDialogTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(AlertDialogPrimitive.Title, { ref, className: cn("text-ui-md font-medium", className), ...props }));
6083
- AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
6084
- const AlertDialogDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(AlertDialogPrimitive.Description, { ref, className: cn("text-ui-sm text-neutral3", className), ...props }));
6085
- AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;
6086
- const AlertDialogAction = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
6087
- AlertDialogPrimitive.Action,
6088
- {
6089
- ref,
6090
- className: cn(buttonVariants({ variant: "primary", size: "default" }), className),
6091
- ...props
6092
- }
6093
- ));
6094
- AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
6095
- const AlertDialogCancel = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
6096
- AlertDialogPrimitive.Cancel,
6097
- {
6098
- ref,
6099
- className: cn(buttonVariants({ variant: "default", size: "default" }), className),
6100
- ...props
6101
- }
6102
- ));
6103
- AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
6088
+ const AlertDialogTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(AlertDialog$1.Title, { ref, className: cn("text-ui-md font-medium", className), ...props }));
6089
+ AlertDialogTitle.displayName = "AlertDialogTitle";
6090
+ const AlertDialogDescription = React.forwardRef(
6091
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx(AlertDialog$1.Description, { ref, className: cn("text-ui-sm text-neutral3", className), ...props })
6092
+ );
6093
+ AlertDialogDescription.displayName = "AlertDialogDescription";
6094
+ const AlertDialogAction = React.forwardRef(
6095
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
6096
+ AlertDialog$1.Close,
6097
+ {
6098
+ ref,
6099
+ className: cn(buttonVariants({ variant: "primary", size: "default" }), className),
6100
+ ...props
6101
+ }
6102
+ )
6103
+ );
6104
+ AlertDialogAction.displayName = "AlertDialogAction";
6105
+ const AlertDialogCancel = React.forwardRef(
6106
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
6107
+ AlertDialog$1.Close,
6108
+ {
6109
+ ref,
6110
+ className: cn(buttonVariants({ variant: "default", size: "default" }), className),
6111
+ ...props
6112
+ }
6113
+ )
6114
+ );
6115
+ AlertDialogCancel.displayName = "AlertDialogCancel";
6104
6116
  AlertDialog.Trigger = AlertDialogTrigger;
6105
6117
  AlertDialog.Portal = AlertDialogPortal;
6106
6118
  AlertDialog.Overlay = AlertDialogOverlay;
@@ -6143,41 +6155,54 @@ const Checkbox = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__
6143
6155
  ));
6144
6156
  Checkbox.displayName = CheckboxPrimitive.Root.displayName;
6145
6157
 
6146
- const Collapsible = CollapsiblePrimitive.Root;
6147
- const CollapsibleTrigger = React__default.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(
6148
- CollapsiblePrimitive.CollapsibleTrigger,
6149
- {
6150
- ref,
6151
- className: cn(
6152
- "-outline-offset-2",
6153
- transitions.colors,
6154
- focusRing.visible,
6155
- "hover:text-neutral5",
6156
- "[&>svg]:transition-transform [&>svg]:duration-normal [&>svg]:ease-out-custom",
6157
- "[&[data-state=open]>svg]:rotate-90",
6158
- className
6159
- ),
6160
- ...props,
6161
- children
6162
- }
6163
- ));
6164
- CollapsibleTrigger.displayName = CollapsiblePrimitive.CollapsibleTrigger.displayName;
6165
- const CollapsibleContent = React__default.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(
6166
- CollapsiblePrimitive.CollapsibleContent,
6167
- {
6168
- ref,
6169
- className: cn(
6170
- "overflow-hidden",
6171
- "data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:slide-in-from-top-1",
6172
- "data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-1",
6173
- "duration-normal ease-out-custom",
6174
- className
6175
- ),
6176
- ...props,
6177
- children
6158
+ const Collapsible = Collapsible$1.Root;
6159
+ const CollapsibleTrigger = React__default.forwardRef(
6160
+ ({ className, asChild, children, ...props }, ref) => {
6161
+ const renderProps = asChild && React__default.isValidElement(children) ? { render: children } : {};
6162
+ return /* @__PURE__ */ jsx(
6163
+ Collapsible$1.Trigger,
6164
+ {
6165
+ ref,
6166
+ "data-slot": "collapsible-trigger",
6167
+ className: cn(
6168
+ "-outline-offset-2",
6169
+ transitions.colors,
6170
+ focusRing.visible,
6171
+ "hover:text-neutral5",
6172
+ "[&>svg]:transition-transform [&>svg]:duration-normal [&>svg]:ease-out-custom",
6173
+ "[&[data-panel-open]>svg]:rotate-90",
6174
+ className
6175
+ ),
6176
+ ...renderProps,
6177
+ ...props,
6178
+ children: asChild ? void 0 : children
6179
+ }
6180
+ );
6178
6181
  }
6179
- ));
6180
- CollapsibleContent.displayName = CollapsiblePrimitive.CollapsibleContent.displayName;
6182
+ );
6183
+ CollapsibleTrigger.displayName = "CollapsibleTrigger";
6184
+ const CollapsibleContent = React__default.forwardRef(
6185
+ ({ className, children, ...props }, ref) => (
6186
+ // Base UI animates the panel's `height` between 0 and `--collapsible-panel-height`.
6187
+ // Padding/margin/borders must live on an inner wrapper — if applied to the panel
6188
+ // itself they keep it from collapsing to 0, which makes the animation jump.
6189
+ /* @__PURE__ */ jsx(
6190
+ Collapsible$1.Panel,
6191
+ {
6192
+ ref,
6193
+ "data-slot": "collapsible-content",
6194
+ className: cn(
6195
+ "overflow-hidden",
6196
+ "h-[var(--collapsible-panel-height)] transition-[height] duration-normal ease-out-custom",
6197
+ "data-[starting-style]:h-0 data-[ending-style]:h-0"
6198
+ ),
6199
+ ...props,
6200
+ children: /* @__PURE__ */ jsx("div", { className, children })
6201
+ }
6202
+ )
6203
+ )
6204
+ );
6205
+ CollapsibleContent.displayName = "CollapsibleContent";
6181
6206
 
6182
6207
  const comboboxStyles = {
6183
6208
  /** Root wrapper */
@@ -12915,15 +12940,6 @@ const Tree = Object.assign(TreeRoot, {
12915
12940
  });
12916
12941
 
12917
12942
  const SUBMENU_SEARCH_THRESHOLD = 6;
12918
- const subContentClass = cn(
12919
- "bg-surface5 backdrop-blur-xl z-50 min-w-[8rem] overflow-auto rounded-lg p-2 shadow-md",
12920
- "data-[state=open]:animate-in data-[state=closed]:animate-out",
12921
- "data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0",
12922
- "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95"
12923
- );
12924
- function PortalSubContent({ className, children, ...props }) {
12925
- return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(SubContent, { className: cn(subContentClass, className), ...props, children }) });
12926
- }
12927
12943
  function SubMenuSearch({
12928
12944
  value,
12929
12945
  onChange,
@@ -13028,7 +13044,7 @@ function SelectDataFilter({
13028
13044
  /* @__PURE__ */ jsx("span", { className: cn("truncate"), children: cat.label }),
13029
13045
  selectedCount > 0 && /* @__PURE__ */ jsx("span", { className: cn("ml-auto text-ui-sm text-accent1"), children: selectedCount })
13030
13046
  ] }),
13031
- /* @__PURE__ */ jsxs(PortalSubContent, { className: cn("max-h-[20rem]"), children: [
13047
+ /* @__PURE__ */ jsxs(DropdownMenu.SubContent, { className: cn("max-h-[20rem]"), children: [
13032
13048
  cat.values.length >= searchThreshold && /* @__PURE__ */ jsx(SubMenuSearch, { value: subSearch, onChange: setSubSearch, label: `Search ${cat.label.toLowerCase()}` }),
13033
13049
  mode === "single" ? /* @__PURE__ */ jsx(DropdownMenu.RadioGroup, { value: selected[0] ?? "", onValueChange: (val) => handleSelect(cat.id, val, mode), children: cat.values.filter((v) => !subSearch || v.label.toLowerCase().includes(subSearch.toLowerCase())).map((v) => /* @__PURE__ */ jsx(DropdownMenu.RadioItem, { value: v.value, children: /* @__PURE__ */ jsx("span", { className: cn("truncate"), children: v.label }) }, v.value)) }) : cat.values.filter((v) => !subSearch || v.label.toLowerCase().includes(subSearch.toLowerCase())).map((v) => /* @__PURE__ */ jsx(
13034
13050
  DropdownMenu.CheckboxItem,
@@ -13092,7 +13108,7 @@ function SelectDataFilter({
13092
13108
  }
13093
13109
  return /* @__PURE__ */ jsxs(DropdownMenu.Sub, { children: [
13094
13110
  /* @__PURE__ */ jsx(DropdownMenu.SubTrigger, { children: group.label }),
13095
- /* @__PURE__ */ jsx(PortalSubContent, { className: cn("max-h-[20rem]"), children: group.items.map((cat) => renderCategory(cat)) })
13111
+ /* @__PURE__ */ jsx(DropdownMenu.SubContent, { className: cn("max-h-[20rem]"), children: group.items.map((cat) => renderCategory(cat)) })
13096
13112
  ] }, group.key);
13097
13113
  }),
13098
13114
  activeFilterCount > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -16740,18 +16756,70 @@ function MetricsProvider({
16740
16756
  return /* @__PURE__ */ jsx(MetricsContext.Provider, { value, children });
16741
16757
  }
16742
16758
 
16759
+ const METRICS_PRESETS = [
16760
+ "last-24h",
16761
+ "last-3d",
16762
+ "last-7d",
16763
+ "last-14d",
16764
+ "last-30d",
16765
+ "custom"
16766
+ ];
16767
+ function toPickerPreset(preset) {
16768
+ switch (preset) {
16769
+ case "3d":
16770
+ return "last-3d";
16771
+ case "7d":
16772
+ return "last-7d";
16773
+ case "14d":
16774
+ return "last-14d";
16775
+ case "30d":
16776
+ return "last-30d";
16777
+ case "custom":
16778
+ return "custom";
16779
+ default:
16780
+ return "last-24h";
16781
+ }
16782
+ }
16783
+ function fromPickerPreset(preset) {
16784
+ switch (preset) {
16785
+ case "last-3d":
16786
+ return "3d";
16787
+ case "last-7d":
16788
+ return "7d";
16789
+ case "last-14d":
16790
+ return "14d";
16791
+ case "last-30d":
16792
+ return "30d";
16793
+ case "custom":
16794
+ return "custom";
16795
+ default:
16796
+ return "24h";
16797
+ }
16798
+ }
16743
16799
  function DateRangeSelector() {
16744
- const { datePreset, setDatePreset } = useMetrics();
16800
+ const { datePreset, setDatePreset, customRange, setCustomRange } = useMetrics();
16801
+ const presetRef = useRef(datePreset);
16802
+ presetRef.current = datePreset;
16803
+ const customRangeRef = useRef(customRange);
16804
+ customRangeRef.current = customRange;
16745
16805
  return /* @__PURE__ */ jsx(
16746
- SelectFieldBlock,
16806
+ DateTimeRangePicker,
16747
16807
  {
16748
- name: "date-range",
16749
- labelIsHidden: true,
16750
- value: datePreset,
16751
- options: DATE_PRESETS.map((p) => ({ label: p.label, value: p.value })),
16752
- onValueChange: (value) => {
16753
- if (isValidPreset(value)) setDatePreset(value);
16754
- }
16808
+ preset: toPickerPreset(datePreset),
16809
+ onPresetChange: (next) => {
16810
+ const mapped = fromPickerPreset(next);
16811
+ presetRef.current = mapped;
16812
+ setDatePreset(mapped);
16813
+ },
16814
+ dateFrom: customRange?.from,
16815
+ dateTo: customRange?.to,
16816
+ onDateChange: (value, type) => {
16817
+ if (presetRef.current !== "custom") return;
16818
+ const next = { ...customRangeRef.current, [type]: value };
16819
+ customRangeRef.current = next;
16820
+ setCustomRange(next);
16821
+ },
16822
+ presets: METRICS_PRESETS
16755
16823
  }
16756
16824
  );
16757
16825
  }