@umami/react-zen 0.247.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
@@ -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: "",
@@ -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") {
@@ -4100,23 +4100,25 @@ function ComboBox({
4100
4100
  /* @__PURE__ */ jsx(Combobox.Input, { placeholder, render: /* @__PURE__ */ jsx(InputGroupInput, {}) }),
4101
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, {}) }) }) })
4102
4102
  ] }),
4103
- /* @__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: [
4104
- /* @__PURE__ */ jsx(ListPrimitiveProvider, { kind: "combobox", children: /* @__PURE__ */ jsx(ScrollArea, { maxHeight: maxHeight ?? "min(23rem, var(--available-height))", children: /* @__PURE__ */ jsx(
4105
- List,
4106
- {
4107
- ...listProps,
4108
- className: cn("overflow-visible", listProps?.className),
4109
- children: /* @__PURE__ */ jsx(Combobox.Collection, { children: (value) => {
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) => {
4110
4112
  const item = normalizedItems.find((option) => option.value === value);
4111
4113
  if (!item) {
4112
4114
  return null;
4113
4115
  }
4114
4116
  return item.element ?? /* @__PURE__ */ jsx(ListItem, { value: item.value, children: item.label }, item.value);
4115
- } })
4116
- }
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
- ] }) }) })
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
+ ) })
4120
4122
  ] })
4121
4123
  }
4122
4124
  );
@@ -4135,16 +4137,16 @@ function Modal({
4135
4137
  ...props
4136
4138
  }) {
4137
4139
  const { kind } = useOverlayTrigger();
4138
- const popupClassName2 = cn("relative z-[9999]", placementClasses[placement], className);
4140
+ const popupClassName2 = cn("relative", placementClasses[placement], className);
4139
4141
  if (kind === "alert-dialog") {
4140
4142
  return /* @__PURE__ */ jsxs(AlertDialog$1.Portal, { ...props, children: [
4141
- /* @__PURE__ */ jsx(AlertDialog$1.Backdrop, { className: "zen-modal-overlay fixed inset-0 bg-black/80 z-[9998]" }),
4142
- /* @__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 }) })
4143
4145
  ] });
4144
4146
  }
4145
4147
  return /* @__PURE__ */ jsxs(Dialog$1.Portal, { ...props, children: [
4146
- /* @__PURE__ */ jsx(Dialog$1.Backdrop, { className: "zen-modal-overlay fixed inset-0 bg-black/80 z-[9998]" }),
4147
- /* @__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 }) })
4148
4150
  ] });
4149
4151
  }
4150
4152
  Modal.zenOverlayType = "dialog";
@@ -4849,12 +4851,12 @@ function Popover({
4849
4851
  onOpenChange: _onOpenChange,
4850
4852
  ...props
4851
4853
  }) {
4852
- 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(
4853
4855
  Popover$1.Popup,
4854
4856
  {
4855
4857
  className: cn(
4856
4858
  "zen-popover outline-none",
4857
- 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",
4858
4860
  className
4859
4861
  ),
4860
4862
  children
@@ -5029,23 +5031,32 @@ function Tooltip({
5029
5031
  showArrow,
5030
5032
  ...props
5031
5033
  }) {
5032
- 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: [
5033
- showArrow && /* @__PURE__ */ jsx(
5034
- Tooltip$1.Arrow,
5035
- {
5036
- style: ({ side: side2 }) => ({
5037
- width: 12,
5038
- height: 6,
5039
- ...side2 === "top" && { bottom: -6, transform: "rotate(180deg)" },
5040
- ...side2 === "bottom" && { top: -6 },
5041
- ...side2 === "left" && { right: -9, transform: "rotate(90deg)" },
5042
- ...side2 === "right" && { left: -9, transform: "rotate(-90deg)" }
5043
- }),
5044
- 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" }) })
5045
- }
5046
- ),
5047
- children
5048
- ] }) }) });
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
+ ) });
5049
5060
  }
5050
5061
  function TooltipBubble({
5051
5062
  children,
@@ -5071,7 +5082,7 @@ function FloatingTooltip({ className, style, children, ...props }) {
5071
5082
  {
5072
5083
  ...props,
5073
5084
  className: cn(
5074
- "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)]",
5075
5086
  className
5076
5087
  ),
5077
5088
  style: { ...style, left: position.x, top: position.y },
@@ -5348,7 +5359,7 @@ function HoverTrigger({
5348
5359
  render: /* @__PURE__ */ jsx("span", { onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, children: triggerElement })
5349
5360
  }
5350
5361
  ),
5351
- /* @__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 }) }) }) }) })
5352
5363
  ] });
5353
5364
  }
5354
5365
  var breakpoints = {
@@ -5580,7 +5591,7 @@ function Toaster({ duration = 0, position = "bottom-right" }) {
5580
5591
  Column,
5581
5592
  {
5582
5593
  gap: "2",
5583
- className: cn("fixed z-[9999]", positionClasses[position]),
5594
+ className: cn("zen-layer-toast fixed", positionClasses[position]),
5584
5595
  onMouseEnter: () => setHovered(true),
5585
5596
  onMouseLeave: () => setHovered(false),
5586
5597
  children: transitions((style, item) => {
@@ -5745,10 +5756,17 @@ function Menu({
5745
5756
  );
5746
5757
  const popupContent = /* @__PURE__ */ jsx(MenuContext.Provider, { value: { selected, select }, children });
5747
5758
  if (primitiveKind === "context-menu") {
5748
- 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 }) }) });
5749
5760
  }
5750
5761
  if (primitiveKind === "menu") {
5751
- 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
+ ) });
5752
5770
  }
5753
5771
  return /* @__PURE__ */ jsx(MenuContext.Provider, { value: { selected, select }, children: /* @__PURE__ */ jsx("div", { ...props, role: "menu", className: popupClassName2, children }) });
5754
5772
  }
@@ -6010,7 +6028,7 @@ function Navbar({
6010
6028
  /* @__PURE__ */ jsx(NavigationMenu.Portal, { children: /* @__PURE__ */ jsx(
6011
6029
  NavigationMenu.Positioner,
6012
6030
  {
6013
- className: positionerClassName,
6031
+ className: cn("zen-layer-floating", positionerClassName),
6014
6032
  sideOffset: 10,
6015
6033
  collisionPadding: 16,
6016
6034
  style: {
@@ -6575,6 +6593,24 @@ function SearchField({
6575
6593
  ] })
6576
6594
  ] });
6577
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
+ }
6578
6614
  function Select({
6579
6615
  value,
6580
6616
  defaultValue,
@@ -6641,7 +6677,7 @@ function Select({
6641
6677
  ),
6642
6678
  children: [
6643
6679
  /* @__PURE__ */ jsx(Select$1.Value, { placeholder, children: (selected) => {
6644
- const defaultChildren = selected ?? placeholder;
6680
+ const defaultChildren = selected == null ? placeholder : getSelectItemLabel(collection, selected) ?? selected;
6645
6681
  return typeof renderValue === "function" ? renderValue({
6646
6682
  defaultChildren,
6647
6683
  isPlaceholder: selected == null
@@ -6658,12 +6694,13 @@ function Select({
6658
6694
  sideOffset: 4,
6659
6695
  alignItemWithTrigger,
6660
6696
  ...popoverProps,
6697
+ className: cn("zen-layer-floating", popoverProps?.className),
6661
6698
  children: /* @__PURE__ */ jsx(
6662
6699
  Select$1.Popup,
6663
6700
  {
6664
6701
  className: cn(
6665
6702
  "zen-popover bg-surface-overlay border border-edge rounded-md shadow-lg outline-none",
6666
- isFullscreen && "zen-popover-fullscreen fixed inset-0 rounded-none z-[9999]"
6703
+ isFullscreen && "zen-popover-fullscreen fixed inset-0 rounded-none"
6667
6704
  ),
6668
6705
  children: /* @__PURE__ */ jsxs(Column, { gap: "2", padding: "2", children: [
6669
6706
  allowSearch && /* @__PURE__ */ jsx(
@@ -6736,12 +6773,12 @@ function Sheet({
6736
6773
  ...style
6737
6774
  };
6738
6775
  return /* @__PURE__ */ jsxs(Dialog$1.Portal, { ...props, children: [
6739
- /* @__PURE__ */ jsx(Dialog$1.Backdrop, { className: "zen-modal-overlay fixed inset-0 bg-black/80 z-[9998]" }),
6740
- /* @__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(
6741
6778
  Dialog$1.Popup,
6742
6779
  {
6743
6780
  className: cn(
6744
- "relative z-[9999] p-6 overflow-auto outline-none",
6781
+ "relative p-6 overflow-auto outline-none",
6745
6782
  "bg-surface-base border-edge shadow-xl",
6746
6783
  sideClasses[side],
6747
6784
  className