@umami/react-zen 0.246.0 → 0.248.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.mjs CHANGED
@@ -20,6 +20,7 @@ import { CheckboxGroup as CheckboxGroup$1 } from '@base-ui/react/checkbox-group'
20
20
  import { Collapsible as Collapsible$1 } from '@base-ui/react/collapsible';
21
21
  import { Combobox } from '@base-ui/react/combobox';
22
22
  import { Select as Select$1 } from '@base-ui/react/select';
23
+ import { ScrollArea as ScrollArea$1 } from '@base-ui/react/scroll-area';
23
24
  import { Command as Command$1 } from 'cmdk';
24
25
  import { ContextMenu as ContextMenu$1 } from '@base-ui/react/context-menu';
25
26
  import { useForm, FormProvider, Controller, useFormContext, useFieldArray } from 'react-hook-form';
@@ -34,7 +35,6 @@ import { Progress } from '@base-ui/react/progress';
34
35
  import { Radio as Radio$1 } from '@base-ui/react/radio';
35
36
  import { RadioGroup as RadioGroup$1 } from '@base-ui/react/radio-group';
36
37
  import { Group, Panel, Separator as Separator$2 } from 'react-resizable-panels';
37
- import { ScrollArea as ScrollArea$1 } from '@base-ui/react/scroll-area';
38
38
  import { Slider as Slider$1 } from '@base-ui/react/slider';
39
39
  import { Switch as Switch$1 } from '@base-ui/react/switch';
40
40
  import { Tabs as Tabs$1 } from '@base-ui/react/tabs';
@@ -2312,10 +2312,10 @@ tv({
2312
2312
  ]
2313
2313
  });
2314
2314
  tv({
2315
- base: ["fixed inset-0", "bg-black/80 flex items-center justify-center", "z-[9999]"]
2315
+ base: ["zen-layer-modal fixed inset-0", "bg-black/80 flex items-center justify-center"]
2316
2316
  });
2317
2317
  tv({
2318
- base: "relative z-[9999]",
2318
+ base: "relative",
2319
2319
  variants: {
2320
2320
  position: {
2321
2321
  center: "",
@@ -2465,7 +2465,7 @@ var alert = tv({
2465
2465
  variant: {
2466
2466
  default: "bg-surface-base text-foreground-primary",
2467
2467
  danger: [
2468
- "bg-surface-base text-status-error",
2468
+ "border-status-error bg-surface-base text-status-error",
2469
2469
  "*:data-[slot=alert-description]:text-status-error/90"
2470
2470
  ]
2471
2471
  }
@@ -3746,7 +3746,7 @@ function List({
3746
3746
  };
3747
3747
  const classes = cn(
3748
3748
  "grid outline-none overflow-auto gap-1",
3749
- isFullscreen && "block p-3 rounded-none fixed inset-0 overflow-auto z-[9999] bg-surface-base",
3749
+ isFullscreen && "zen-layer-floating block p-3 rounded-none fixed inset-0 overflow-auto bg-surface-base",
3750
3750
  className
3751
3751
  );
3752
3752
  if (parent.kind === "select") {
@@ -3994,6 +3994,58 @@ var InputGroupTextarea = forwardRef(({ className, ...props }, ref) => /* @__PURE
3994
3994
  }
3995
3995
  ));
3996
3996
  InputGroupTextarea.displayName = "InputGroupTextarea";
3997
+ var scrollbarClasses = [
3998
+ "flex touch-none select-none justify-center rounded bg-transparent",
3999
+ "opacity-0 transition-opacity duration-200 delay-300",
4000
+ "data-[hovering]:opacity-100 data-[hovering]:delay-0",
4001
+ "data-[scrolling]:opacity-100 data-[scrolling]:delay-0"
4002
+ ];
4003
+ function ScrollArea({
4004
+ maxHeight,
4005
+ orientation = "vertical",
4006
+ className,
4007
+ style,
4008
+ children,
4009
+ ...props
4010
+ }) {
4011
+ const showVertical = orientation !== "horizontal";
4012
+ const showHorizontal = orientation !== "vertical";
4013
+ return /* @__PURE__ */ jsxs(
4014
+ ScrollArea$1.Root,
4015
+ {
4016
+ ...props,
4017
+ className: cn("relative overflow-hidden", className),
4018
+ style,
4019
+ children: [
4020
+ /* @__PURE__ */ jsx(
4021
+ ScrollArea$1.Viewport,
4022
+ {
4023
+ className: "size-full overscroll-contain rounded-[inherit] outline-none focus-visible:ring-2 focus-visible:ring-focus-ring",
4024
+ style: { maxHeight },
4025
+ children: /* @__PURE__ */ jsx(ScrollArea$1.Content, { children })
4026
+ }
4027
+ ),
4028
+ showVertical && /* @__PURE__ */ jsx(
4029
+ ScrollArea$1.Scrollbar,
4030
+ {
4031
+ orientation: "vertical",
4032
+ className: cn(scrollbarClasses, "w-1.5 mr-0.5"),
4033
+ children: /* @__PURE__ */ jsx(ScrollArea$1.Thumb, { className: "w-full rounded bg-edge-strong" })
4034
+ }
4035
+ ),
4036
+ showHorizontal && /* @__PURE__ */ jsx(
4037
+ ScrollArea$1.Scrollbar,
4038
+ {
4039
+ orientation: "horizontal",
4040
+ className: cn(scrollbarClasses, "h-1.5 mb-0.5 flex-col"),
4041
+ children: /* @__PURE__ */ jsx(ScrollArea$1.Thumb, { className: "h-full rounded bg-edge-strong" })
4042
+ }
4043
+ ),
4044
+ orientation === "both" && /* @__PURE__ */ jsx(ScrollArea$1.Corner, {})
4045
+ ]
4046
+ }
4047
+ );
4048
+ }
3997
4049
  function getItemLabel(label) {
3998
4050
  if (typeof label === "string" || typeof label === "number") {
3999
4051
  return String(label);
@@ -4011,6 +4063,7 @@ function ComboBox({
4011
4063
  label,
4012
4064
  placeholder,
4013
4065
  isDisabled,
4066
+ maxHeight,
4014
4067
  onChange,
4015
4068
  renderEmptyState,
4016
4069
  listProps,
@@ -4047,16 +4100,25 @@ function ComboBox({
4047
4100
  /* @__PURE__ */ jsx(Combobox.Input, { placeholder, render: /* @__PURE__ */ jsx(InputGroupInput, {}) }),
4048
4101
  /* @__PURE__ */ jsx(InputGroupAddon, { align: "inline-end", children: /* @__PURE__ */ jsx(Combobox.Trigger, { className: "flex size-6 shrink-0 items-center justify-center rounded text-foreground-muted hover:bg-interactive hover:text-foreground-primary", children: /* @__PURE__ */ jsx(Icon, { rotate: 90, "aria-hidden": "true", size: "sm", children: /* @__PURE__ */ jsx(icons_exports.ChevronRight, {}) }) }) })
4049
4102
  ] }),
4050
- /* @__PURE__ */ jsx(Combobox.Portal, { children: /* @__PURE__ */ jsx(Combobox.Positioner, { align: "start", sideOffset: 4, ...popoverProps, children: /* @__PURE__ */ jsxs(Combobox.Popup, { className: "zen-popover w-[var(--anchor-width)] max-w-[var(--available-width)] p-2 border border-edge rounded-md shadow-lg bg-surface-overlay outline-none", children: [
4051
- /* @__PURE__ */ jsx(ListPrimitiveProvider, { kind: "combobox", children: /* @__PURE__ */ jsx(List, { ...listProps, children: /* @__PURE__ */ jsx(Combobox.Collection, { children: (value) => {
4052
- const item = normalizedItems.find((option) => option.value === value);
4053
- if (!item) {
4054
- return null;
4055
- }
4056
- return item.element ?? /* @__PURE__ */ jsx(ListItem, { value: item.value, children: item.label }, item.value);
4057
- } }) }) }),
4058
- /* @__PURE__ */ jsx(Combobox.Empty, { children: /* @__PURE__ */ jsx("div", { className: "flex min-h-16 items-center justify-center px-4 py-3 text-center", children: renderEmptyState ? renderEmptyState({}) : /* @__PURE__ */ jsx("span", { className: "text-base text-foreground-muted", children: "No items found." }) }) })
4059
- ] }) }) })
4103
+ /* @__PURE__ */ jsx(Combobox.Portal, { children: /* @__PURE__ */ jsx(
4104
+ Combobox.Positioner,
4105
+ {
4106
+ align: "start",
4107
+ sideOffset: 4,
4108
+ ...popoverProps,
4109
+ className: cn("zen-layer-floating", popoverProps?.className),
4110
+ children: /* @__PURE__ */ jsxs(Combobox.Popup, { className: "zen-popover w-[var(--anchor-width)] max-w-[var(--available-width)] p-2 border border-edge rounded-md shadow-lg bg-surface-overlay outline-none", children: [
4111
+ /* @__PURE__ */ jsx(ListPrimitiveProvider, { kind: "combobox", children: /* @__PURE__ */ jsx(ScrollArea, { maxHeight: maxHeight ?? "min(23rem, var(--available-height))", children: /* @__PURE__ */ jsx(List, { ...listProps, className: cn("overflow-visible", listProps?.className), children: /* @__PURE__ */ jsx(Combobox.Collection, { children: (value) => {
4112
+ const item = normalizedItems.find((option) => option.value === value);
4113
+ if (!item) {
4114
+ return null;
4115
+ }
4116
+ return item.element ?? /* @__PURE__ */ jsx(ListItem, { value: item.value, children: item.label }, item.value);
4117
+ } }) }) }) }),
4118
+ /* @__PURE__ */ jsx(Combobox.Empty, { children: /* @__PURE__ */ jsx("div", { className: "flex min-h-16 items-center justify-center px-4 py-3 text-center", children: renderEmptyState ? renderEmptyState({}) : /* @__PURE__ */ jsx("span", { className: "text-base text-foreground-muted", children: "No items found." }) }) })
4119
+ ] })
4120
+ }
4121
+ ) })
4060
4122
  ] })
4061
4123
  }
4062
4124
  );
@@ -4075,16 +4137,16 @@ function Modal({
4075
4137
  ...props
4076
4138
  }) {
4077
4139
  const { kind } = useOverlayTrigger();
4078
- const popupClassName2 = cn("relative z-[9999]", placementClasses[placement], className);
4140
+ const popupClassName2 = cn("relative", placementClasses[placement], className);
4079
4141
  if (kind === "alert-dialog") {
4080
4142
  return /* @__PURE__ */ jsxs(AlertDialog$1.Portal, { ...props, children: [
4081
- /* @__PURE__ */ jsx(AlertDialog$1.Backdrop, { className: "zen-modal-overlay fixed inset-0 bg-black/80 z-[9998]" }),
4082
- /* @__PURE__ */ jsx(AlertDialog$1.Viewport, { className: "fixed inset-0 flex items-center justify-center z-[9999]", children: /* @__PURE__ */ jsx(AlertDialog$1.Popup, { className: popupClassName2, style, children }) })
4143
+ /* @__PURE__ */ jsx(AlertDialog$1.Backdrop, { className: "zen-modal-overlay zen-layer-backdrop fixed inset-0 bg-black/80" }),
4144
+ /* @__PURE__ */ jsx(AlertDialog$1.Viewport, { className: "zen-layer-modal fixed inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx(AlertDialog$1.Popup, { className: popupClassName2, style, children }) })
4083
4145
  ] });
4084
4146
  }
4085
4147
  return /* @__PURE__ */ jsxs(Dialog$1.Portal, { ...props, children: [
4086
- /* @__PURE__ */ jsx(Dialog$1.Backdrop, { className: "zen-modal-overlay fixed inset-0 bg-black/80 z-[9998]" }),
4087
- /* @__PURE__ */ jsx(Dialog$1.Viewport, { className: "fixed inset-0 flex items-center justify-center z-[9999]", children: /* @__PURE__ */ jsx(Dialog$1.Popup, { className: popupClassName2, style, children }) })
4148
+ /* @__PURE__ */ jsx(Dialog$1.Backdrop, { className: "zen-modal-overlay zen-layer-backdrop fixed inset-0 bg-black/80" }),
4149
+ /* @__PURE__ */ jsx(Dialog$1.Viewport, { className: "zen-layer-modal fixed inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx(Dialog$1.Popup, { className: popupClassName2, style, children }) })
4088
4150
  ] });
4089
4151
  }
4090
4152
  Modal.zenOverlayType = "dialog";
@@ -4118,14 +4180,8 @@ function CommandInput({ className, ...props }) {
4118
4180
  )
4119
4181
  ] });
4120
4182
  }
4121
- function CommandList({ className, ...props }) {
4122
- return /* @__PURE__ */ jsx(
4123
- Command$1.List,
4124
- {
4125
- ...props,
4126
- className: cn("max-h-[300px] overflow-y-auto overflow-x-hidden p-2", className)
4127
- }
4128
- );
4183
+ function CommandList({ maxHeight = 300, className, ...props }) {
4184
+ return /* @__PURE__ */ jsx(ScrollArea, { maxHeight, children: /* @__PURE__ */ jsx(Command$1.List, { ...props, className: cn("p-2", className) }) });
4129
4185
  }
4130
4186
  function CommandEmpty({ className, ...props }) {
4131
4187
  return /* @__PURE__ */ jsx(
@@ -4795,12 +4851,12 @@ function Popover({
4795
4851
  onOpenChange: _onOpenChange,
4796
4852
  ...props
4797
4853
  }) {
4798
- return /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(Popover$1.Positioner, { ...props, children: /* @__PURE__ */ jsx(
4854
+ return /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(Popover$1.Positioner, { ...props, className: "zen-layer-floating", children: /* @__PURE__ */ jsx(
4799
4855
  Popover$1.Popup,
4800
4856
  {
4801
4857
  className: cn(
4802
4858
  "zen-popover outline-none",
4803
- isFullscreen && "zen-popover-fullscreen block border-0 rounded-none fixed inset-0 overflow-auto z-[9999] bg-surface-base",
4859
+ isFullscreen && "zen-popover-fullscreen block border-0 rounded-none fixed inset-0 overflow-auto bg-surface-base",
4804
4860
  className
4805
4861
  ),
4806
4862
  children
@@ -4975,23 +5031,32 @@ function Tooltip({
4975
5031
  showArrow,
4976
5032
  ...props
4977
5033
  }) {
4978
- return /* @__PURE__ */ jsx(Tooltip$1.Portal, { children: /* @__PURE__ */ jsx(Tooltip$1.Positioner, { ...props, side: placement ?? side, sideOffset, children: /* @__PURE__ */ jsxs(Tooltip$1.Popup, { className: cn("zen-popover group", tooltip(), className), children: [
4979
- showArrow && /* @__PURE__ */ jsx(
4980
- Tooltip$1.Arrow,
4981
- {
4982
- style: ({ side: side2 }) => ({
4983
- width: 12,
4984
- height: 6,
4985
- ...side2 === "top" && { bottom: -6, transform: "rotate(180deg)" },
4986
- ...side2 === "bottom" && { top: -6 },
4987
- ...side2 === "left" && { right: -9, transform: "rotate(90deg)" },
4988
- ...side2 === "right" && { left: -9, transform: "rotate(-90deg)" }
4989
- }),
4990
- children: /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", viewBox: "0 0 12 6", className: "block w-full h-full", children: /* @__PURE__ */ jsx("path", { d: "M0 6 6 0l6 6Z", className: "fill-surface-inverted" }) })
4991
- }
4992
- ),
4993
- children
4994
- ] }) }) });
5034
+ return /* @__PURE__ */ jsx(Tooltip$1.Portal, { children: /* @__PURE__ */ jsx(
5035
+ Tooltip$1.Positioner,
5036
+ {
5037
+ ...props,
5038
+ className: "zen-layer-floating",
5039
+ side: placement ?? side,
5040
+ sideOffset,
5041
+ children: /* @__PURE__ */ jsxs(Tooltip$1.Popup, { className: cn("zen-popover group", tooltip(), className), children: [
5042
+ showArrow && /* @__PURE__ */ jsx(
5043
+ Tooltip$1.Arrow,
5044
+ {
5045
+ style: ({ side: side2 }) => ({
5046
+ width: 12,
5047
+ height: 6,
5048
+ ...side2 === "top" && { bottom: -6, transform: "rotate(180deg)" },
5049
+ ...side2 === "bottom" && { top: -6 },
5050
+ ...side2 === "left" && { right: -9, transform: "rotate(90deg)" },
5051
+ ...side2 === "right" && { left: -9, transform: "rotate(-90deg)" }
5052
+ }),
5053
+ children: /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", viewBox: "0 0 12 6", className: "block w-full h-full", children: /* @__PURE__ */ jsx("path", { d: "M0 6 6 0l6 6Z", className: "fill-surface-inverted" }) })
5054
+ }
5055
+ ),
5056
+ children
5057
+ ] })
5058
+ }
5059
+ ) });
4995
5060
  }
4996
5061
  function TooltipBubble({
4997
5062
  children,
@@ -5017,7 +5082,7 @@ function FloatingTooltip({ className, style, children, ...props }) {
5017
5082
  {
5018
5083
  ...props,
5019
5084
  className: cn(
5020
- "fixed pointer-events-none z-[9999] -translate-x-1/2 -translate-y-[calc(100%+10px)]",
5085
+ "zen-layer-floating fixed pointer-events-none -translate-x-1/2 -translate-y-[calc(100%+10px)]",
5021
5086
  className
5022
5087
  ),
5023
5088
  style: { ...style, left: position.x, top: position.y },
@@ -5294,7 +5359,7 @@ function HoverTrigger({
5294
5359
  render: /* @__PURE__ */ jsx("span", { onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, children: triggerElement })
5295
5360
  }
5296
5361
  ),
5297
- /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(Popover$1.Positioner, { children: /* @__PURE__ */ jsx(Popover$1.Popup, { className: "zen-popover outline-none", children: /* @__PURE__ */ jsx("div", { onMouseEnter: handleMenuEnter, onMouseLeave: handleMenuLeave, children: /* @__PURE__ */ jsx(OverlayContentProvider, { close: _close, kind: "popover", children: popupElement }) }) }) }) })
5362
+ /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(Popover$1.Positioner, { className: "zen-layer-floating", children: /* @__PURE__ */ jsx(Popover$1.Popup, { className: "zen-popover outline-none", children: /* @__PURE__ */ jsx("div", { onMouseEnter: handleMenuEnter, onMouseLeave: handleMenuLeave, children: /* @__PURE__ */ jsx(OverlayContentProvider, { close: _close, kind: "popover", children: popupElement }) }) }) }) })
5298
5363
  ] });
5299
5364
  }
5300
5365
  var breakpoints = {
@@ -5526,7 +5591,7 @@ function Toaster({ duration = 0, position = "bottom-right" }) {
5526
5591
  Column,
5527
5592
  {
5528
5593
  gap: "2",
5529
- className: cn("fixed z-[9999]", positionClasses[position]),
5594
+ className: cn("zen-layer-toast fixed", positionClasses[position]),
5530
5595
  onMouseEnter: () => setHovered(true),
5531
5596
  onMouseLeave: () => setHovered(false),
5532
5597
  children: transitions((style, item) => {
@@ -5691,10 +5756,17 @@ function Menu({
5691
5756
  );
5692
5757
  const popupContent = /* @__PURE__ */ jsx(MenuContext.Provider, { value: { selected, select }, children });
5693
5758
  if (primitiveKind === "context-menu") {
5694
- return /* @__PURE__ */ jsx(ContextMenu$1.Portal, { children: /* @__PURE__ */ jsx(ContextMenu$1.Positioner, { children: /* @__PURE__ */ jsx(ContextMenu$1.Popup, { ...props, className: cn("zen-popover", popupClassName2), children: popupContent }) }) });
5759
+ return /* @__PURE__ */ jsx(ContextMenu$1.Portal, { children: /* @__PURE__ */ jsx(ContextMenu$1.Positioner, { className: "zen-layer-floating", children: /* @__PURE__ */ jsx(ContextMenu$1.Popup, { ...props, className: cn("zen-popover", popupClassName2), children: popupContent }) }) });
5695
5760
  }
5696
5761
  if (primitiveKind === "menu") {
5697
- return /* @__PURE__ */ jsx(Menu$1.Portal, { children: /* @__PURE__ */ jsx(Menu$1.Positioner, { ...inMenubar ? { align: "start", sideOffset: 8 } : {}, children: /* @__PURE__ */ jsx(Menu$1.Popup, { ...props, className: cn("zen-popover", popupClassName2), children: popupContent }) }) });
5762
+ return /* @__PURE__ */ jsx(Menu$1.Portal, { children: /* @__PURE__ */ jsx(
5763
+ Menu$1.Positioner,
5764
+ {
5765
+ ...inMenubar ? { align: "start", sideOffset: 8 } : {},
5766
+ className: "zen-layer-floating",
5767
+ children: /* @__PURE__ */ jsx(Menu$1.Popup, { ...props, className: cn("zen-popover", popupClassName2), children: popupContent })
5768
+ }
5769
+ ) });
5698
5770
  }
5699
5771
  return /* @__PURE__ */ jsx(MenuContext.Provider, { value: { selected, select }, children: /* @__PURE__ */ jsx("div", { ...props, role: "menu", className: popupClassName2, children }) });
5700
5772
  }
@@ -5812,10 +5884,11 @@ function MenuSection({
5812
5884
  }) {
5813
5885
  const primitiveKind = useContext(MenuPrimitiveContext);
5814
5886
  const groupClassName = cn("[&:not(:last-child)]:mb-4", className);
5815
- const groupStyle = { maxHeight, overflow: maxHeight ? "auto" : void 0, ...style };
5887
+ const groupStyle = style;
5888
+ const body = maxHeight ? /* @__PURE__ */ jsx(ScrollArea, { maxHeight, children }) : children;
5816
5889
  const content = /* @__PURE__ */ jsxs(Fragment, { children: [
5817
5890
  title && (primitiveKind === "context-menu" ? /* @__PURE__ */ jsx(ContextMenu$1.GroupLabel, { className: "text-base font-bold px-2 py-1.5", children: title }) : primitiveKind === "menu" ? /* @__PURE__ */ jsx(Menu$1.GroupLabel, { className: "text-base font-bold px-2 py-1.5", children: title }) : /* @__PURE__ */ jsx("div", { className: "text-base font-bold px-2 py-1.5", children: title })),
5818
- children
5891
+ body
5819
5892
  ] });
5820
5893
  if (primitiveKind === "context-menu") {
5821
5894
  return /* @__PURE__ */ jsx(ContextMenu$1.Group, { ...props, className: groupClassName, style: groupStyle, children: content });
@@ -5955,7 +6028,7 @@ function Navbar({
5955
6028
  /* @__PURE__ */ jsx(NavigationMenu.Portal, { children: /* @__PURE__ */ jsx(
5956
6029
  NavigationMenu.Positioner,
5957
6030
  {
5958
- className: positionerClassName,
6031
+ className: cn("zen-layer-floating", positionerClassName),
5959
6032
  sideOffset: 10,
5960
6033
  collisionPadding: 16,
5961
6034
  style: {
@@ -6454,58 +6527,6 @@ function ResizableHandle({ withHandle, className, ...props }) {
6454
6527
  }
6455
6528
  );
6456
6529
  }
6457
- var scrollbarClasses = [
6458
- "flex touch-none select-none justify-center rounded bg-transparent",
6459
- "opacity-0 transition-opacity duration-200 delay-300",
6460
- "data-[hovering]:opacity-100 data-[hovering]:delay-0",
6461
- "data-[scrolling]:opacity-100 data-[scrolling]:delay-0"
6462
- ];
6463
- function ScrollArea({
6464
- maxHeight,
6465
- orientation = "vertical",
6466
- className,
6467
- style,
6468
- children,
6469
- ...props
6470
- }) {
6471
- const showVertical = orientation !== "horizontal";
6472
- const showHorizontal = orientation !== "vertical";
6473
- return /* @__PURE__ */ jsxs(
6474
- ScrollArea$1.Root,
6475
- {
6476
- ...props,
6477
- className: cn("relative overflow-hidden", className),
6478
- style,
6479
- children: [
6480
- /* @__PURE__ */ jsx(
6481
- ScrollArea$1.Viewport,
6482
- {
6483
- className: "size-full overscroll-contain rounded-[inherit] outline-none focus-visible:ring-2 focus-visible:ring-focus-ring",
6484
- style: { maxHeight },
6485
- children: /* @__PURE__ */ jsx(ScrollArea$1.Content, { children })
6486
- }
6487
- ),
6488
- showVertical && /* @__PURE__ */ jsx(
6489
- ScrollArea$1.Scrollbar,
6490
- {
6491
- orientation: "vertical",
6492
- className: cn(scrollbarClasses, "w-1.5 mr-0.5"),
6493
- children: /* @__PURE__ */ jsx(ScrollArea$1.Thumb, { className: "w-full rounded bg-edge-strong" })
6494
- }
6495
- ),
6496
- showHorizontal && /* @__PURE__ */ jsx(
6497
- ScrollArea$1.Scrollbar,
6498
- {
6499
- orientation: "horizontal",
6500
- className: cn(scrollbarClasses, "h-1.5 mb-0.5 flex-col"),
6501
- children: /* @__PURE__ */ jsx(ScrollArea$1.Thumb, { className: "h-full rounded bg-edge-strong" })
6502
- }
6503
- ),
6504
- orientation === "both" && /* @__PURE__ */ jsx(ScrollArea$1.Corner, {})
6505
- ]
6506
- }
6507
- );
6508
- }
6509
6530
  function SearchField({
6510
6531
  label,
6511
6532
  placeholder,
@@ -6572,6 +6593,24 @@ function SearchField({
6572
6593
  ] })
6573
6594
  ] });
6574
6595
  }
6596
+ function getSelectItemLabel(children, selectedValue) {
6597
+ let label;
6598
+ Children.forEach(children, (child) => {
6599
+ if (label !== void 0 || !isValidElement(child)) {
6600
+ return;
6601
+ }
6602
+ if (child.type === ListItem) {
6603
+ const props = child.props;
6604
+ const itemValue = props.value ?? props.id ?? (typeof props.children === "string" ? props.children : "");
6605
+ if (itemValue === selectedValue) {
6606
+ label = props.children;
6607
+ }
6608
+ return;
6609
+ }
6610
+ label = getSelectItemLabel(child.props.children, selectedValue);
6611
+ });
6612
+ return label;
6613
+ }
6575
6614
  function Select({
6576
6615
  value,
6577
6616
  defaultValue,
@@ -6605,6 +6644,7 @@ function Select({
6605
6644
  (item) => typeof item === "object" ? item : { label: String(item), value: item }
6606
6645
  );
6607
6646
  const collection = children || normalizedItems?.map((item) => /* @__PURE__ */ jsx(ListItem, { value: item.value, children: item.label }, item.value));
6647
+ const isEmpty = !collection || Array.isArray(collection) && collection.length === 0;
6608
6648
  return /* @__PURE__ */ jsx("div", { className: cn("flex flex-col gap-1", className), children: /* @__PURE__ */ jsxs(
6609
6649
  Select$1.Root,
6610
6650
  {
@@ -6637,7 +6677,7 @@ function Select({
6637
6677
  ),
6638
6678
  children: [
6639
6679
  /* @__PURE__ */ jsx(Select$1.Value, { placeholder, children: (selected) => {
6640
- const defaultChildren = selected ?? placeholder;
6680
+ const defaultChildren = selected == null ? placeholder : getSelectItemLabel(collection, selected) ?? selected;
6641
6681
  return typeof renderValue === "function" ? renderValue({
6642
6682
  defaultChildren,
6643
6683
  isPlaceholder: selected == null
@@ -6654,18 +6694,19 @@ function Select({
6654
6694
  sideOffset: 4,
6655
6695
  alignItemWithTrigger,
6656
6696
  ...popoverProps,
6697
+ className: cn("zen-layer-floating", popoverProps?.className),
6657
6698
  children: /* @__PURE__ */ jsx(
6658
6699
  Select$1.Popup,
6659
6700
  {
6660
6701
  className: cn(
6661
6702
  "zen-popover bg-surface-overlay border border-edge rounded-md shadow-lg outline-none",
6662
- isFullscreen && "zen-popover-fullscreen fixed inset-0 rounded-none z-[9999]"
6703
+ isFullscreen && "zen-popover-fullscreen fixed inset-0 rounded-none"
6663
6704
  ),
6664
6705
  children: /* @__PURE__ */ jsxs(Column, { gap: "2", padding: "2", children: [
6665
6706
  allowSearch && /* @__PURE__ */ jsx(
6666
6707
  SearchField,
6667
6708
  {
6668
- className: "mb-2",
6709
+ className: "-mx-2 -mt-2 w-auto rounded-t-md rounded-b-none border-0 border-b border-edge shadow-none focus-within:border-edge",
6669
6710
  value: search,
6670
6711
  onChange: setSearch,
6671
6712
  onSearch: (value2) => {
@@ -6683,18 +6724,22 @@ function Select({
6683
6724
  }
6684
6725
  ),
6685
6726
  isLoading && /* @__PURE__ */ jsx(Loading, { className: "py-8", icon: "dots", placement: "center", size: "sm" }),
6727
+ !isLoading && isEmpty && /* @__PURE__ */ jsx("div", { className: "px-2 py-8 text-center text-base text-foreground-muted", children: "No results found" }),
6686
6728
  /* @__PURE__ */ jsx(ListPrimitiveProvider, { kind: "select", children: /* @__PURE__ */ jsx(
6687
- List,
6729
+ ScrollArea,
6688
6730
  {
6689
- ...listProps,
6690
- isFullscreen,
6691
- className: cn("overflow-auto", listProps?.className),
6692
- style: {
6693
- ...listProps?.style,
6694
- maxHeight,
6695
- display: isLoading ? "none" : void 0
6696
- },
6697
- children: collection
6731
+ maxHeight,
6732
+ style: { display: isLoading || isEmpty ? "none" : void 0 },
6733
+ children: /* @__PURE__ */ jsx(
6734
+ List,
6735
+ {
6736
+ ...listProps,
6737
+ isFullscreen,
6738
+ className: cn("overflow-visible", listProps?.className),
6739
+ style: listProps?.style,
6740
+ children: collection
6741
+ }
6742
+ )
6698
6743
  }
6699
6744
  ) })
6700
6745
  ] })
@@ -6728,12 +6773,12 @@ function Sheet({
6728
6773
  ...style
6729
6774
  };
6730
6775
  return /* @__PURE__ */ jsxs(Dialog$1.Portal, { ...props, children: [
6731
- /* @__PURE__ */ jsx(Dialog$1.Backdrop, { className: "zen-modal-overlay fixed inset-0 bg-black/80 z-[9998]" }),
6732
- /* @__PURE__ */ jsx(Dialog$1.Viewport, { className: "fixed inset-0 z-[9999]", children: /* @__PURE__ */ jsx(
6776
+ /* @__PURE__ */ jsx(Dialog$1.Backdrop, { className: "zen-modal-overlay zen-layer-backdrop fixed inset-0 bg-black/80" }),
6777
+ /* @__PURE__ */ jsx(Dialog$1.Viewport, { className: "zen-layer-modal fixed inset-0", children: /* @__PURE__ */ jsx(
6733
6778
  Dialog$1.Popup,
6734
6779
  {
6735
6780
  className: cn(
6736
- "relative z-[9999] p-6 overflow-auto outline-none",
6781
+ "relative p-6 overflow-auto outline-none",
6737
6782
  "bg-surface-base border-edge shadow-xl",
6738
6783
  sideClasses[side],
6739
6784
  className