@umami/react-zen 0.247.0 → 0.249.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
@@ -2243,7 +2243,8 @@ var button = tv({
2243
2243
  default: [
2244
2244
  "bg-interactive text-foreground-primary",
2245
2245
  "hover:bg-interactive-hover",
2246
- "pressed:bg-interactive-pressed"
2246
+ "pressed:bg-interactive-pressed",
2247
+ "disabled:text-foreground-disabled"
2247
2248
  ],
2248
2249
  primary: [
2249
2250
  "bg-primary text-primary-foreground",
@@ -2255,16 +2256,26 @@ var button = tv({
2255
2256
  "bg-surface-base border-edge shadow-sm text-foreground-primary",
2256
2257
  "hover:border-edge-strong",
2257
2258
  "pressed:bg-surface-raised",
2258
- "disabled:bg-surface-disabled"
2259
+ "disabled:bg-surface-disabled disabled:text-foreground-disabled"
2260
+ ],
2261
+ quiet: [
2262
+ "bg-transparent",
2263
+ "hover:bg-interactive",
2264
+ "pressed:bg-interactive-hover",
2265
+ "disabled:text-foreground-disabled"
2259
2266
  ],
2260
- quiet: ["bg-transparent", "hover:bg-interactive", "pressed:bg-interactive-hover"],
2261
2267
  danger: [
2262
2268
  "bg-status-error text-white",
2263
2269
  "hover:opacity-90",
2264
2270
  "pressed:opacity-80",
2265
2271
  "disabled:opacity-50"
2266
2272
  ],
2267
- zero: ["bg-transparent border-0", "hover:bg-transparent", "pressed:bg-transparent"]
2273
+ zero: [
2274
+ "bg-transparent border-0",
2275
+ "hover:bg-transparent",
2276
+ "pressed:bg-transparent",
2277
+ "disabled:text-foreground-disabled"
2278
+ ]
2268
2279
  },
2269
2280
  size: {
2270
2281
  xs: "text-sm py-1 px-2",
@@ -2312,10 +2323,10 @@ tv({
2312
2323
  ]
2313
2324
  });
2314
2325
  tv({
2315
- base: ["fixed inset-0", "bg-black/80 flex items-center justify-center", "z-[9999]"]
2326
+ base: ["zen-layer-modal fixed inset-0", "bg-black/80 flex items-center justify-center"]
2316
2327
  });
2317
2328
  tv({
2318
- base: "relative z-[9999]",
2329
+ base: "relative",
2319
2330
  variants: {
2320
2331
  position: {
2321
2332
  center: "",
@@ -2669,6 +2680,7 @@ function Button({
2669
2680
  size = "md",
2670
2681
  render,
2671
2682
  preventFocusOnPress: _preventFocusOnPress = true,
2683
+ nativeButton,
2672
2684
  isDisabled,
2673
2685
  disabled,
2674
2686
  onPress,
@@ -2678,6 +2690,7 @@ function Button({
2678
2690
  ...props
2679
2691
  }) {
2680
2692
  const buttonClassName = button({ variant, size, className });
2693
+ const isNativeButton = nativeButton ?? (render === void 0 || isValidElement(render) && render.type === "button");
2681
2694
  const handleClick = (event) => {
2682
2695
  onClick?.(event);
2683
2696
  if (!event.defaultPrevented) {
@@ -2690,6 +2703,7 @@ function Button({
2690
2703
  ...props,
2691
2704
  "data-slot": "button",
2692
2705
  render,
2706
+ nativeButton: isNativeButton,
2693
2707
  disabled: isDisabled ?? disabled,
2694
2708
  className: buttonClassName,
2695
2709
  onClick: handleClick,
@@ -3201,7 +3215,7 @@ function Breadcrumb({ children, className, isDisabled, ...props }) {
3201
3215
  "aria-disabled": isDisabled || void 0,
3202
3216
  className: cn(
3203
3217
  "flex items-center text-base gap-3 list-none",
3204
- "[&_a]:text-foreground-muted [&_a]:no-underline [&_a]:font-normal [&_a]:p-2",
3218
+ "[&_a]:text-foreground-muted [&_a]:no-underline [&_a]:font-normal",
3205
3219
  "[&_a:hover]:text-foreground-primary",
3206
3220
  "last:[&>span]:hidden",
3207
3221
  className
@@ -3746,7 +3760,7 @@ function List({
3746
3760
  };
3747
3761
  const classes = cn(
3748
3762
  "grid outline-none overflow-auto gap-1",
3749
- isFullscreen && "block p-3 rounded-none fixed inset-0 overflow-auto z-[9999] bg-surface-base",
3763
+ isFullscreen && "zen-layer-floating block p-3 rounded-none fixed inset-0 overflow-auto bg-surface-base",
3750
3764
  className
3751
3765
  );
3752
3766
  if (parent.kind === "select") {
@@ -4100,23 +4114,25 @@ function ComboBox({
4100
4114
  /* @__PURE__ */ jsx(Combobox.Input, { placeholder, render: /* @__PURE__ */ jsx(InputGroupInput, {}) }),
4101
4115
  /* @__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
4116
  ] }),
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) => {
4117
+ /* @__PURE__ */ jsx(Combobox.Portal, { children: /* @__PURE__ */ jsx(
4118
+ Combobox.Positioner,
4119
+ {
4120
+ align: "start",
4121
+ sideOffset: 4,
4122
+ ...popoverProps,
4123
+ className: cn("zen-layer-floating", popoverProps?.className),
4124
+ 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: [
4125
+ /* @__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
4126
  const item = normalizedItems.find((option) => option.value === value);
4111
4127
  if (!item) {
4112
4128
  return null;
4113
4129
  }
4114
4130
  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
- ] }) }) })
4131
+ } }) }) }) }),
4132
+ /* @__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." }) }) })
4133
+ ] })
4134
+ }
4135
+ ) })
4120
4136
  ] })
4121
4137
  }
4122
4138
  );
@@ -4135,16 +4151,16 @@ function Modal({
4135
4151
  ...props
4136
4152
  }) {
4137
4153
  const { kind } = useOverlayTrigger();
4138
- const popupClassName2 = cn("relative z-[9999]", placementClasses[placement], className);
4154
+ const popupClassName2 = cn("relative", placementClasses[placement], className);
4139
4155
  if (kind === "alert-dialog") {
4140
4156
  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 }) })
4157
+ /* @__PURE__ */ jsx(AlertDialog$1.Backdrop, { className: "zen-modal-overlay zen-layer-backdrop fixed inset-0 bg-black/80" }),
4158
+ /* @__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
4159
  ] });
4144
4160
  }
4145
4161
  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 }) })
4162
+ /* @__PURE__ */ jsx(Dialog$1.Backdrop, { className: "zen-modal-overlay zen-layer-backdrop fixed inset-0 bg-black/80" }),
4163
+ /* @__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
4164
  ] });
4149
4165
  }
4150
4166
  Modal.zenOverlayType = "dialog";
@@ -4849,12 +4865,12 @@ function Popover({
4849
4865
  onOpenChange: _onOpenChange,
4850
4866
  ...props
4851
4867
  }) {
4852
- return /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(Popover$1.Positioner, { ...props, children: /* @__PURE__ */ jsx(
4868
+ return /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(Popover$1.Positioner, { ...props, className: "zen-layer-floating", children: /* @__PURE__ */ jsx(
4853
4869
  Popover$1.Popup,
4854
4870
  {
4855
4871
  className: cn(
4856
4872
  "zen-popover outline-none",
4857
- isFullscreen && "zen-popover-fullscreen block border-0 rounded-none fixed inset-0 overflow-auto z-[9999] bg-surface-base",
4873
+ isFullscreen && "zen-popover-fullscreen block border-0 rounded-none fixed inset-0 overflow-auto bg-surface-base",
4858
4874
  className
4859
4875
  ),
4860
4876
  children
@@ -5029,23 +5045,32 @@ function Tooltip({
5029
5045
  showArrow,
5030
5046
  ...props
5031
5047
  }) {
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
- ] }) }) });
5048
+ return /* @__PURE__ */ jsx(Tooltip$1.Portal, { children: /* @__PURE__ */ jsx(
5049
+ Tooltip$1.Positioner,
5050
+ {
5051
+ ...props,
5052
+ className: "zen-layer-floating",
5053
+ side: placement ?? side,
5054
+ sideOffset,
5055
+ children: /* @__PURE__ */ jsxs(Tooltip$1.Popup, { className: cn("zen-popover group", tooltip(), className), children: [
5056
+ showArrow && /* @__PURE__ */ jsx(
5057
+ Tooltip$1.Arrow,
5058
+ {
5059
+ style: ({ side: side2 }) => ({
5060
+ width: 12,
5061
+ height: 6,
5062
+ ...side2 === "top" && { bottom: -6, transform: "rotate(180deg)" },
5063
+ ...side2 === "bottom" && { top: -6 },
5064
+ ...side2 === "left" && { right: -9, transform: "rotate(90deg)" },
5065
+ ...side2 === "right" && { left: -9, transform: "rotate(-90deg)" }
5066
+ }),
5067
+ 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" }) })
5068
+ }
5069
+ ),
5070
+ children
5071
+ ] })
5072
+ }
5073
+ ) });
5049
5074
  }
5050
5075
  function TooltipBubble({
5051
5076
  children,
@@ -5071,7 +5096,7 @@ function FloatingTooltip({ className, style, children, ...props }) {
5071
5096
  {
5072
5097
  ...props,
5073
5098
  className: cn(
5074
- "fixed pointer-events-none z-[9999] -translate-x-1/2 -translate-y-[calc(100%+10px)]",
5099
+ "zen-layer-floating fixed pointer-events-none -translate-x-1/2 -translate-y-[calc(100%+10px)]",
5075
5100
  className
5076
5101
  ),
5077
5102
  style: { ...style, left: position.x, top: position.y },
@@ -5348,7 +5373,7 @@ function HoverTrigger({
5348
5373
  render: /* @__PURE__ */ jsx("span", { onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, children: triggerElement })
5349
5374
  }
5350
5375
  ),
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 }) }) }) }) })
5376
+ /* @__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
5377
  ] });
5353
5378
  }
5354
5379
  var breakpoints = {
@@ -5580,7 +5605,7 @@ function Toaster({ duration = 0, position = "bottom-right" }) {
5580
5605
  Column,
5581
5606
  {
5582
5607
  gap: "2",
5583
- className: cn("fixed z-[9999]", positionClasses[position]),
5608
+ className: cn("zen-layer-toast fixed", positionClasses[position]),
5584
5609
  onMouseEnter: () => setHovered(true),
5585
5610
  onMouseLeave: () => setHovered(false),
5586
5611
  children: transitions((style, item) => {
@@ -5745,10 +5770,18 @@ function Menu({
5745
5770
  );
5746
5771
  const popupContent = /* @__PURE__ */ jsx(MenuContext.Provider, { value: { selected, select }, children });
5747
5772
  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 }) }) });
5773
+ 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
5774
  }
5750
5775
  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 }) }) });
5776
+ return /* @__PURE__ */ jsx(Menu$1.Portal, { children: /* @__PURE__ */ jsx(
5777
+ Menu$1.Positioner,
5778
+ {
5779
+ sideOffset: 4,
5780
+ ...inMenubar ? { align: "start" } : {},
5781
+ className: "zen-layer-floating",
5782
+ children: /* @__PURE__ */ jsx(Menu$1.Popup, { ...props, className: cn("zen-popover", popupClassName2), children: popupContent })
5783
+ }
5784
+ ) });
5752
5785
  }
5753
5786
  return /* @__PURE__ */ jsx(MenuContext.Provider, { value: { selected, select }, children: /* @__PURE__ */ jsx("div", { ...props, role: "menu", className: popupClassName2, children }) });
5754
5787
  }
@@ -5908,10 +5941,7 @@ function Menubar({ isDisabled, className, children, ...props }) {
5908
5941
  {
5909
5942
  ...props,
5910
5943
  disabled: isDisabled,
5911
- className: cn(
5912
- "flex items-center gap-1 p-1 rounded-md border border-edge bg-surface-base shadow-sm w-fit",
5913
- className
5914
- ),
5944
+ className: cn("flex items-center gap-1 w-fit", className),
5915
5945
  children
5916
5946
  }
5917
5947
  );
@@ -6010,7 +6040,7 @@ function Navbar({
6010
6040
  /* @__PURE__ */ jsx(NavigationMenu.Portal, { children: /* @__PURE__ */ jsx(
6011
6041
  NavigationMenu.Positioner,
6012
6042
  {
6013
- className: positionerClassName,
6043
+ className: cn("zen-layer-floating", positionerClassName),
6014
6044
  sideOffset: 10,
6015
6045
  collisionPadding: 16,
6016
6046
  style: {
@@ -6575,6 +6605,24 @@ function SearchField({
6575
6605
  ] })
6576
6606
  ] });
6577
6607
  }
6608
+ function getSelectItemLabel(children, selectedValue) {
6609
+ let label;
6610
+ Children.forEach(children, (child) => {
6611
+ if (label !== void 0 || !isValidElement(child)) {
6612
+ return;
6613
+ }
6614
+ if (child.type === ListItem) {
6615
+ const props = child.props;
6616
+ const itemValue = props.value ?? props.id ?? (typeof props.children === "string" ? props.children : "");
6617
+ if (itemValue === selectedValue) {
6618
+ label = props.children;
6619
+ }
6620
+ return;
6621
+ }
6622
+ label = getSelectItemLabel(child.props.children, selectedValue);
6623
+ });
6624
+ return label;
6625
+ }
6578
6626
  function Select({
6579
6627
  value,
6580
6628
  defaultValue,
@@ -6641,7 +6689,7 @@ function Select({
6641
6689
  ),
6642
6690
  children: [
6643
6691
  /* @__PURE__ */ jsx(Select$1.Value, { placeholder, children: (selected) => {
6644
- const defaultChildren = selected ?? placeholder;
6692
+ const defaultChildren = selected == null ? placeholder : getSelectItemLabel(collection, selected) ?? selected;
6645
6693
  return typeof renderValue === "function" ? renderValue({
6646
6694
  defaultChildren,
6647
6695
  isPlaceholder: selected == null
@@ -6658,12 +6706,13 @@ function Select({
6658
6706
  sideOffset: 4,
6659
6707
  alignItemWithTrigger,
6660
6708
  ...popoverProps,
6709
+ className: cn("zen-layer-floating", popoverProps?.className),
6661
6710
  children: /* @__PURE__ */ jsx(
6662
6711
  Select$1.Popup,
6663
6712
  {
6664
6713
  className: cn(
6665
6714
  "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]"
6715
+ isFullscreen && "zen-popover-fullscreen fixed inset-0 rounded-none"
6667
6716
  ),
6668
6717
  children: /* @__PURE__ */ jsxs(Column, { gap: "2", padding: "2", children: [
6669
6718
  allowSearch && /* @__PURE__ */ jsx(
@@ -6736,12 +6785,12 @@ function Sheet({
6736
6785
  ...style
6737
6786
  };
6738
6787
  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(
6788
+ /* @__PURE__ */ jsx(Dialog$1.Backdrop, { className: "zen-modal-overlay zen-layer-backdrop fixed inset-0 bg-black/80" }),
6789
+ /* @__PURE__ */ jsx(Dialog$1.Viewport, { className: "zen-layer-modal fixed inset-0", children: /* @__PURE__ */ jsx(
6741
6790
  Dialog$1.Popup,
6742
6791
  {
6743
6792
  className: cn(
6744
- "relative z-[9999] p-6 overflow-auto outline-none",
6793
+ "relative p-6 overflow-auto outline-none",
6745
6794
  "bg-surface-base border-edge shadow-xl",
6746
6795
  sideClasses[side],
6747
6796
  className