@milktop/react-ui 0.3.26 → 0.3.27

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/menu/Menu.js CHANGED
@@ -48,8 +48,10 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
48
48
  */
49
49
  import { createContext, useContext, useId, useRef, useState } from 'react';
50
50
  import { Menu as Ark, useMenuContext } from '@ark-ui/react/menu';
51
+ import { Portal } from '@ark-ui/react/portal';
51
52
  import '../icons.js';
52
53
  import { cx, partsOf, withParts } from '../utils.js';
54
+ import { InLayer } from '../layer.js';
53
55
  import '../theme.css';
54
56
  import './menu.css';
55
57
  const MenuContext = createContext(null);
@@ -244,10 +246,12 @@ function MenuShortcut({ items = [], labelKey = 'label', valueKey = 'value', disa
244
246
  },
245
247
  };
246
248
  const Trigger = context ? Ark.ContextTrigger : Ark.Trigger;
249
+ // Opened from a dialog or sheet, it shows on top of it (as Popover does)
250
+ const layered = useContext(InLayer) ? { 'data-layered': '' } : {};
247
251
  return (_jsxs(Ark.Root, { closeOnSelect: !keepOpen, positioning: { placement, strategy: 'fixed', gutter: 4 }, ...(open !== undefined && { open }), ...(defaultOpen !== undefined && { defaultOpen }), ...(onOpenChange && { onOpenChange: (details) => onOpenChange(details.open) }),
248
252
  // Enter on a link: Zag's own click doesn't bubble, so routers listening
249
253
  // on the document would miss it.
250
- navigate: (details) => details.node.click(), onSelect: (details) => shared.select(details.value), children: [trigger && _jsx(Trigger, { asChild: true, children: trigger }), _jsx(Ark.Positioner, { ...part('positioner'), children: _jsx(Ark.Content, { ...rest, ...part('content'), className: cx(className, classes?.content), children: _jsxs(MenuContext.Provider, { value: shared, children: [label && _jsx("div", { ...part('menu-label'), children: label }), _jsx(Entries, { items: items }), children] }) }) })] }));
254
+ navigate: (details) => details.node.click(), onSelect: (details) => shared.select(details.value), children: [trigger && _jsx(Trigger, { asChild: true, children: trigger }), _jsx(Portal, { children: _jsx(Ark.Positioner, { ...part('positioner'), ...layered, children: _jsx(Ark.Content, { ...rest, ...part('content'), ...layered, className: cx(className, classes?.content), children: _jsxs(MenuContext.Provider, { value: shared, children: [label && _jsx("div", { ...part('menu-label'), children: label }), _jsx(Entries, { items: items }), children] }) }) }) })] }));
251
255
  }
252
256
  export const Menu = withParts(MenuShortcut, {
253
257
  Item, Separator, Group, Checkbox, RadioGroup, Radio, Submenu,
@@ -4,11 +4,16 @@
4
4
  /* The positioner carries the z-index itself. Zag sets it inline as
5
5
  var(--z-index) but doesn't always fill in the variable, so set both. */
6
6
  [data-scope=menu][data-part=positioner] { z-index: 50; --z-index: 50; }
7
+ /* Opened from a dialog or sheet (100): above it, below tooltips (110). Zag copies the content's
8
+ z-index inline when it opens, so the content carries it too. */
9
+ [data-scope=menu]:is([data-part=positioner], [data-part=content])[data-layered] { z-index: 105; --z-index: 105; }
7
10
  [data-scope=menu][data-part=content] {
8
11
  z-index: 50; font-weight: 400; min-width: 12rem; padding: 0.5rem 0.25rem; box-sizing: border-box; text-align: left; outline: none;
9
12
  background: var(--ui-surface); color: var(--ui-text); font-family: var(--ui-font); font-size: 14px;
10
13
  border: 1px solid var(--ui-border); border-radius: calc(var(--ui-radius) + 2px); box-shadow: var(--ui-shadow);
11
14
  transform-origin: var(--transform-origin);
15
+ /* No taller than the room it has, scrolling inside */
16
+ max-height: var(--available-height); overflow-y: auto;
12
17
  &[data-state=open] { animation: ui-menu-in 120ms ease-out; }
13
18
  &[data-state=closed] { animation: ui-menu-out 100ms ease-in forwards; }
14
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milktop/react-ui",
3
- "version": "0.3.26",
3
+ "version": "0.3.27",
4
4
  "description": "React components on Ark UI (Zag state machines), with imba-ui's API and design",
5
5
  "license": "MIT",
6
6
  "author": "André Goldstein",