@milktop/react-ui 0.3.26 → 0.3.28
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 +5 -1
- package/dist/menu/menu.css +8 -1
- package/dist/popover/popover.css +6 -4
- package/package.json +1 -1
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,
|
package/dist/menu/menu.css
CHANGED
|
@@ -4,11 +4,18 @@
|
|
|
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). */
|
|
8
|
+
[data-scope=menu][data-part=positioner][data-layered] { z-index: 105; --z-index: 105; }
|
|
9
|
+
/* Zag copies the content's z-index onto the positioner when it opens. It numbers each open layer
|
|
10
|
+
(--layer-index), so one opened from another sits above it, whichever portal came first in the page. */
|
|
11
|
+
[data-scope=menu][data-part=content][data-layered] { z-index: calc(105 + var(--layer-index, 0)); }
|
|
7
12
|
[data-scope=menu][data-part=content] {
|
|
8
|
-
z-index: 50; font-weight: 400; min-width: 12rem; padding: 0.5rem 0.25rem; box-sizing: border-box; text-align: left; outline: none;
|
|
13
|
+
z-index: calc(50 + var(--layer-index, 0)); font-weight: 400; min-width: 12rem; padding: 0.5rem 0.25rem; box-sizing: border-box; text-align: left; outline: none;
|
|
9
14
|
background: var(--ui-surface); color: var(--ui-text); font-family: var(--ui-font); font-size: 14px;
|
|
10
15
|
border: 1px solid var(--ui-border); border-radius: calc(var(--ui-radius) + 2px); box-shadow: var(--ui-shadow);
|
|
11
16
|
transform-origin: var(--transform-origin);
|
|
17
|
+
/* No taller than the room it has, scrolling inside */
|
|
18
|
+
max-height: var(--available-height); overflow-y: auto;
|
|
12
19
|
&[data-state=open] { animation: ui-menu-in 120ms ease-out; }
|
|
13
20
|
&[data-state=closed] { animation: ui-menu-out 100ms ease-in forwards; }
|
|
14
21
|
}
|
package/dist/popover/popover.css
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
/* The positioner carries the z-index itself. Zag sets it inline as
|
|
3
3
|
var(--z-index) but doesn't always fill in the variable, so set both. */
|
|
4
4
|
[data-scope=popover][data-part=positioner] { z-index: 50; --z-index: 50; }
|
|
5
|
-
/* Opened from a dialog or sheet (100): above it, below tooltips (110).
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
/* Opened from a dialog or sheet (100): above it, below tooltips (110). */
|
|
6
|
+
[data-scope=popover][data-part=positioner][data-layered] { z-index: 105; --z-index: 105; }
|
|
7
|
+
/* Zag copies the content's z-index onto the positioner when it opens. It numbers each open layer
|
|
8
|
+
(--layer-index), so one opened from another sits above it, whichever portal came first in the page. */
|
|
9
|
+
[data-scope=popover][data-part=content][data-layered] { z-index: calc(105 + var(--layer-index, 0)); }
|
|
10
|
+
[data-scope=popover][data-part=content] { z-index: calc(50 + var(--layer-index, 0)); position: relative; width: 18rem; max-width: calc(100vw - 32px);
|
|
9
11
|
padding: 1rem; box-sizing: border-box; outline: none; font-weight: 400;
|
|
10
12
|
background: var(--ui-surface); color: var(--ui-text); font-family: var(--ui-font); font-size: 14px;
|
|
11
13
|
border: 1px solid var(--ui-border); border-radius: calc(var(--ui-radius) + 2px); box-shadow: var(--ui-shadow);
|