@jonmilner/ui 0.2.1 → 0.2.2
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.css +1 -1
- package/dist/Menu/Menu.css.mjs +2 -2
- package/dist/Menu/client.mjs +26 -23
- package/dist/Menu/index.mjs +18 -18
- package/dist/docs/Menu.md +1 -1
- package/dist/docs/manifest.json +1 -1
- package/package.json +1 -1
package/dist/Menu/Menu.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
@layer tokens, reset, atoms, components.box, components.checkbox, components.clickable, components.icon, components.icon-button, components.inline, components.stack, components.text, components.badge, components.button, components.chip, components.field, components.heading, components.dialog, components.alert-dialog, components.menu, components.multiselect, components.search-field, components.tabs, components.tag, components.toast;
|
|
2
|
-
@layer components.menu{._393eil0{border:var(--space-1) solid var(--color-border);transform-origin:var(--transform-origin);transition:opacity var(--duration-fast) var(--easing-standard), scale var(--duration-fast) var(--easing-enter)}.
|
|
2
|
+
@layer components.menu{:where(._393eil0[data-closed])>[data-base-ui-focus-guard]{visibility:hidden}._393eil1{border:var(--space-1) solid var(--color-border);transform-origin:var(--transform-origin);transition:opacity var(--duration-fast) var(--easing-standard), scale var(--duration-fast) var(--easing-enter)}._393eil1:focus-visible{outline:var(--space-2) solid var(--color-focus);outline-offset:var(--space-2)}._393eil1[data-starting-style],._393eil1[data-ending-style]{opacity:0;scale:calc(1 - var(--scale-med))}._393eil2{cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none}._393eil2:focus-visible{outline:var(--space-2) solid var(--color-focus);outline-offset:var(--space-2)}._393eil2[data-highlighted]{background-color:light-dark(var(--color-bg-muted),color-mix(in srgb, var(--color-fg) 10%, var(--color-bg-raised)))}._393eil2[aria-disabled=true]{color:var(--color-fg-muted);cursor:not-allowed}._393eil3{border-block-start:var(--space-1) solid var(--color-border)}@media (forced-colors:active){._393eil2[data-highlighted]{forced-color-adjust:none;color:highlighttext;background-color:highlight}._393eil2[aria-disabled=true]{color:graytext}}}
|
package/dist/Menu/Menu.css.mjs
CHANGED
|
@@ -3,6 +3,6 @@ import "./Menu.css";
|
|
|
3
3
|
/* empty css */
|
|
4
4
|
/* empty css */
|
|
5
5
|
//#region src/Menu/Menu.css.ts
|
|
6
|
-
var e = "_393eil0", t = "_393eil1", n = "_393eil2";
|
|
6
|
+
var e = "_393eil0", t = "_393eil1", n = "_393eil2", r = "_393eil3";
|
|
7
7
|
//#endregion
|
|
8
|
-
export {
|
|
8
|
+
export { n as item, t as popup, e as positioner, r as separator };
|
package/dist/Menu/client.mjs
CHANGED
|
@@ -1,39 +1,42 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { join as e } from "../styles/join.mjs";
|
|
3
|
+
import { splitStyleProps as t } from "../styles/split-style-props.mjs";
|
|
4
|
+
import { Box as n } from "../Box/index.mjs";
|
|
5
|
+
import { triggerElement as r, usePopupScope as i } from "../popup/client.mjs";
|
|
6
|
+
import { positioner as a } from "./Menu.css.mjs";
|
|
7
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
8
|
+
import { Menu as s } from "@base-ui/react/menu";
|
|
7
9
|
//#region src/Menu/client.tsx
|
|
8
|
-
function
|
|
9
|
-
let { ref: d } =
|
|
10
|
-
return /* @__PURE__ */
|
|
10
|
+
function c({ disabled: e = !1, openOnHover: t, delay: n, closeDelay: a, handle: c, payload: l, ...u }) {
|
|
11
|
+
let { ref: d } = i();
|
|
12
|
+
return /* @__PURE__ */ o(s.Trigger, {
|
|
11
13
|
disabled: e,
|
|
12
14
|
openOnHover: t,
|
|
13
|
-
delay:
|
|
14
|
-
closeDelay:
|
|
15
|
+
delay: n,
|
|
16
|
+
closeDelay: a,
|
|
15
17
|
handle: c,
|
|
16
18
|
payload: l,
|
|
17
19
|
ref: d,
|
|
18
|
-
render:
|
|
20
|
+
render: r(u)
|
|
19
21
|
});
|
|
20
22
|
}
|
|
21
|
-
function
|
|
22
|
-
let { container: t } =
|
|
23
|
-
return /* @__PURE__ */
|
|
23
|
+
function l({ children: e }) {
|
|
24
|
+
let { container: t } = i();
|
|
25
|
+
return /* @__PURE__ */ o(s.Portal, {
|
|
24
26
|
container: t,
|
|
25
27
|
children: e
|
|
26
28
|
});
|
|
27
29
|
}
|
|
28
|
-
function
|
|
29
|
-
return /* @__PURE__ */
|
|
30
|
-
...
|
|
30
|
+
function u(r) {
|
|
31
|
+
return /* @__PURE__ */ o(s.Positioner, {
|
|
32
|
+
...r,
|
|
31
33
|
collisionPadding: 8,
|
|
32
|
-
render: (
|
|
33
|
-
let [,
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
-
...
|
|
36
|
-
"aria-hidden": !
|
|
34
|
+
render: (r, { open: i }) => {
|
|
35
|
+
let [, s] = t(r);
|
|
36
|
+
return /* @__PURE__ */ o(n, {
|
|
37
|
+
...s,
|
|
38
|
+
"aria-hidden": !i || void 0,
|
|
39
|
+
className: e(a, s.className),
|
|
37
40
|
zIndex: "popover"
|
|
38
41
|
});
|
|
39
42
|
},
|
|
@@ -41,4 +44,4 @@ function c(n) {
|
|
|
41
44
|
});
|
|
42
45
|
}
|
|
43
46
|
//#endregion
|
|
44
|
-
export {
|
|
47
|
+
export { l as MenuPortal, u as MenuPositioner, c as MenuTrigger };
|
package/dist/Menu/index.mjs
CHANGED
|
@@ -3,8 +3,8 @@ import { splitStyleProps as t } from "../styles/split-style-props.mjs";
|
|
|
3
3
|
import { Box as n } from "../Box/index.mjs";
|
|
4
4
|
import { Text as r } from "../Text/index.mjs";
|
|
5
5
|
import { PopupScope as i } from "../popup/client.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { item as a, popup as o, separator as s } from "./Menu.css.mjs";
|
|
7
|
+
import { MenuPortal as c, MenuPositioner as l, MenuTrigger as u } from "./client.mjs";
|
|
8
8
|
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
9
9
|
import { Children as p } from "react";
|
|
10
10
|
import { Menu as m } from "@base-ui/react/menu";
|
|
@@ -15,39 +15,39 @@ function h({ children: e, ...t }) {
|
|
|
15
15
|
children: e
|
|
16
16
|
}) });
|
|
17
17
|
}
|
|
18
|
-
function g({ side: r = "bottom", align: i = "start", backgroundColor:
|
|
18
|
+
function g({ side: r = "bottom", align: i = "start", backgroundColor: a = "bgRaised", borderRadius: s = "med", boxShadow: u = "med", padding: f = "4", className: p, style: h, ...g }) {
|
|
19
19
|
let [_, v] = t(g);
|
|
20
|
-
return /* @__PURE__ */ d(
|
|
20
|
+
return /* @__PURE__ */ d(c, { children: /* @__PURE__ */ d(l, {
|
|
21
21
|
align: i,
|
|
22
22
|
side: r,
|
|
23
23
|
children: /* @__PURE__ */ d(m.Popup, {
|
|
24
24
|
...v,
|
|
25
25
|
render: /* @__PURE__ */ d(n, {
|
|
26
|
-
backgroundColor:
|
|
27
|
-
borderRadius:
|
|
26
|
+
backgroundColor: a,
|
|
27
|
+
borderRadius: s,
|
|
28
28
|
boxShadow: u,
|
|
29
29
|
padding: f,
|
|
30
30
|
..._,
|
|
31
|
-
className: e(
|
|
31
|
+
className: e(o, p),
|
|
32
32
|
style: h
|
|
33
33
|
})
|
|
34
34
|
})
|
|
35
35
|
}) });
|
|
36
36
|
}
|
|
37
|
-
function _({ variant: i = "neutral", display:
|
|
37
|
+
function _({ variant: i = "neutral", display: o = "flex", alignItems: s = "center", gap: c = "8", minBlockSize: l = "sm", paddingInline: u = "12", borderRadius: f = "sm", color: h = i === "danger" ? "danger" : "fg", className: g, style: _, children: v, ...y }) {
|
|
38
38
|
let [b, x] = t(y);
|
|
39
39
|
return /* @__PURE__ */ d(m.Item, {
|
|
40
40
|
...x,
|
|
41
41
|
render: /* @__PURE__ */ d(n, {
|
|
42
|
-
display:
|
|
43
|
-
alignItems:
|
|
44
|
-
gap:
|
|
42
|
+
display: o,
|
|
43
|
+
alignItems: s,
|
|
44
|
+
gap: c,
|
|
45
45
|
minBlockSize: l,
|
|
46
46
|
paddingInline: u,
|
|
47
47
|
borderRadius: f,
|
|
48
48
|
color: h,
|
|
49
49
|
...b,
|
|
50
|
-
className: e(
|
|
50
|
+
className: e(a, g),
|
|
51
51
|
style: _
|
|
52
52
|
}),
|
|
53
53
|
children: p.map(v, (e) => typeof e == "string" || typeof e == "number" ? /* @__PURE__ */ d(r, {
|
|
@@ -58,15 +58,15 @@ function _({ variant: i = "neutral", display: a = "flex", alignItems: o = "cente
|
|
|
58
58
|
}) : e)
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
-
function v({ marginBlock: r = "4", marginInline: i = "8", className: a, style: o, ...
|
|
62
|
-
let [
|
|
61
|
+
function v({ marginBlock: r = "4", marginInline: i = "8", className: a, style: o, ...c }) {
|
|
62
|
+
let [l, u] = t(c);
|
|
63
63
|
return /* @__PURE__ */ d(m.Separator, {
|
|
64
|
-
...
|
|
64
|
+
...u,
|
|
65
65
|
render: /* @__PURE__ */ d(n, {
|
|
66
66
|
marginBlock: r,
|
|
67
67
|
marginInline: i,
|
|
68
|
-
...
|
|
69
|
-
className: e(
|
|
68
|
+
...l,
|
|
69
|
+
className: e(s, a),
|
|
70
70
|
style: o
|
|
71
71
|
})
|
|
72
72
|
});
|
|
@@ -94,7 +94,7 @@ function y({ label: e, className: i, style: a, children: o, ...s }) {
|
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
var b = Object.assign(h, {
|
|
97
|
-
Trigger:
|
|
97
|
+
Trigger: u,
|
|
98
98
|
Popup: g,
|
|
99
99
|
Item: _,
|
|
100
100
|
Separator: v,
|
package/dist/docs/Menu.md
CHANGED
|
@@ -92,7 +92,7 @@ A list of actions that opens from a button: a row's "Edit, Duplicate, Delete", a
|
|
|
92
92
|
|
|
93
93
|
- The trigger has `aria-haspopup="menu"` and `aria-expanded`; the popup is `role="menu"` labelled by the trigger, items are `role="menuitem"`, groups are `role="group"` named by their label.
|
|
94
94
|
- Opening from the keyboard focuses the first item; from the pointer, the popup. Focus stays in the menu until it closes, then returns to the trigger.
|
|
95
|
-
- A closed menu stays on the page while it fades out, but is `aria-hidden` from the moment it closes, so a menu opened during the fade (the next row's) is the only one a screen reader or a role query finds. Focus stays in it until the fade ends, then returns to the trigger.
|
|
95
|
+
- A closed menu stays on the page while it fades out, but is `aria-hidden` from the moment it closes, so a menu opened during the fade (the next row's) is the only one a screen reader or a role query finds. Nothing in it is in the tab order. Focus stays in it until the fade ends, then returns to the trigger.
|
|
96
96
|
- The highlighted item gets a fill (`bgMuted` in light mode; in dark mode `bgRaised` with 10% `fg` mixed in, since `bgMuted` sits too close to the popup there), and the shared focus ring when reached from the keyboard. Under forced colors it is `Highlight` with `HighlightText`, disabled items are `GrayText`, and the popup keeps its border.
|
|
97
97
|
- The danger item's `danger` color passes 4.5:1 on the popup and on the highlight fill in every preset (`Menu.test.tsx` checks it, with `fg` and `fgMuted`); the word ("Delete") carries the meaning, not the color.
|
|
98
98
|
|
package/dist/docs/manifest.json
CHANGED