@jonmilner/ui 0.2.0 → 0.2.1
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/client.d.mts +0 -1
- package/dist/Menu/client.mjs +31 -14
- package/dist/Menu/index.mjs +46 -49
- package/dist/docs/Menu.md +1 -0
- package/dist/docs/manifest.json +1 -1
- package/package.json +1 -1
package/dist/Menu/client.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { TriggerElementProps, TriggerLookProps } from "../popup/client.mjs";
|
|
2
|
-
import { ReactNode } from "react";
|
|
3
2
|
import { Menu } from "@base-ui/react/menu";
|
|
4
3
|
//#region src/Menu/client.d.ts
|
|
5
4
|
type TriggerOwnProps = Omit<Menu.Trigger.Props, "render" | "className" | "style" | "nativeButton">;
|
package/dist/Menu/client.mjs
CHANGED
|
@@ -1,27 +1,44 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { splitStyleProps as e } from "../styles/split-style-props.mjs";
|
|
3
|
+
import { Box as t } from "../Box/index.mjs";
|
|
4
|
+
import { triggerElement as n, usePopupScope as r } from "../popup/client.mjs";
|
|
5
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
6
|
+
import { Menu as a } from "@base-ui/react/menu";
|
|
5
7
|
//#region src/Menu/client.tsx
|
|
6
|
-
function
|
|
7
|
-
let { ref: d } =
|
|
8
|
-
return /* @__PURE__ */
|
|
9
|
-
disabled:
|
|
10
|
-
openOnHover:
|
|
8
|
+
function o({ disabled: e = !1, openOnHover: t, delay: o, closeDelay: s, handle: c, payload: l, ...u }) {
|
|
9
|
+
let { ref: d } = r();
|
|
10
|
+
return /* @__PURE__ */ i(a.Trigger, {
|
|
11
|
+
disabled: e,
|
|
12
|
+
openOnHover: t,
|
|
11
13
|
delay: o,
|
|
12
14
|
closeDelay: s,
|
|
13
15
|
handle: c,
|
|
14
16
|
payload: l,
|
|
15
17
|
ref: d,
|
|
16
|
-
render:
|
|
18
|
+
render: n(u)
|
|
17
19
|
});
|
|
18
20
|
}
|
|
19
|
-
function
|
|
20
|
-
let { container:
|
|
21
|
-
return /* @__PURE__ */
|
|
22
|
-
container:
|
|
21
|
+
function s({ children: e }) {
|
|
22
|
+
let { container: t } = r();
|
|
23
|
+
return /* @__PURE__ */ i(a.Portal, {
|
|
24
|
+
container: t,
|
|
23
25
|
children: e
|
|
24
26
|
});
|
|
25
27
|
}
|
|
28
|
+
function c(n) {
|
|
29
|
+
return /* @__PURE__ */ i(a.Positioner, {
|
|
30
|
+
...n,
|
|
31
|
+
collisionPadding: 8,
|
|
32
|
+
render: (n, { open: r }) => {
|
|
33
|
+
let [, a] = e(n);
|
|
34
|
+
return /* @__PURE__ */ i(t, {
|
|
35
|
+
...a,
|
|
36
|
+
"aria-hidden": !r || void 0,
|
|
37
|
+
zIndex: "popover"
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
sideOffset: 4
|
|
41
|
+
});
|
|
42
|
+
}
|
|
26
43
|
//#endregion
|
|
27
|
-
export {
|
|
44
|
+
export { s as MenuPortal, c as MenuPositioner, o as MenuTrigger };
|
package/dist/Menu/index.mjs
CHANGED
|
@@ -3,57 +3,54 @@ 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 { MenuPortal as a,
|
|
7
|
-
import { item as
|
|
8
|
-
import { jsx as
|
|
9
|
-
import { Children as
|
|
10
|
-
import { Menu as
|
|
6
|
+
import { MenuPortal as a, MenuPositioner as o, MenuTrigger as s } from "./client.mjs";
|
|
7
|
+
import { item as c, popup as l, separator as u } from "./Menu.css.mjs";
|
|
8
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
9
|
+
import { Children as p } from "react";
|
|
10
|
+
import { Menu as m } from "@base-ui/react/menu";
|
|
11
11
|
//#region src/Menu/index.tsx
|
|
12
|
-
function
|
|
13
|
-
return /* @__PURE__ */
|
|
12
|
+
function h({ children: e, ...t }) {
|
|
13
|
+
return /* @__PURE__ */ d(i, { children: /* @__PURE__ */ d(m.Root, {
|
|
14
14
|
...t,
|
|
15
15
|
children: e
|
|
16
16
|
}) });
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
let [
|
|
20
|
-
return /* @__PURE__ */
|
|
18
|
+
function g({ side: r = "bottom", align: i = "start", backgroundColor: s = "bgRaised", borderRadius: c = "med", boxShadow: u = "med", padding: f = "4", className: p, style: h, ...g }) {
|
|
19
|
+
let [_, v] = t(g);
|
|
20
|
+
return /* @__PURE__ */ d(a, { children: /* @__PURE__ */ d(o, {
|
|
21
21
|
align: i,
|
|
22
|
-
collisionPadding: 8,
|
|
23
|
-
render: /* @__PURE__ */ u(n, { zIndex: "popover" }),
|
|
24
22
|
side: r,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
style: m
|
|
23
|
+
children: /* @__PURE__ */ d(m.Popup, {
|
|
24
|
+
...v,
|
|
25
|
+
render: /* @__PURE__ */ d(n, {
|
|
26
|
+
backgroundColor: s,
|
|
27
|
+
borderRadius: c,
|
|
28
|
+
boxShadow: u,
|
|
29
|
+
padding: f,
|
|
30
|
+
..._,
|
|
31
|
+
className: e(l, p),
|
|
32
|
+
style: h
|
|
36
33
|
})
|
|
37
34
|
})
|
|
38
35
|
}) });
|
|
39
36
|
}
|
|
40
|
-
function
|
|
37
|
+
function _({ variant: i = "neutral", display: a = "flex", alignItems: o = "center", gap: s = "8", minBlockSize: l = "sm", paddingInline: u = "12", borderRadius: f = "sm", color: h = i === "danger" ? "danger" : "fg", className: g, style: _, children: v, ...y }) {
|
|
41
38
|
let [b, x] = t(y);
|
|
42
|
-
return /* @__PURE__ */
|
|
39
|
+
return /* @__PURE__ */ d(m.Item, {
|
|
43
40
|
...x,
|
|
44
|
-
render: /* @__PURE__ */
|
|
41
|
+
render: /* @__PURE__ */ d(n, {
|
|
45
42
|
display: a,
|
|
46
43
|
alignItems: o,
|
|
47
|
-
gap:
|
|
44
|
+
gap: s,
|
|
48
45
|
minBlockSize: l,
|
|
49
|
-
paddingInline:
|
|
50
|
-
borderRadius:
|
|
46
|
+
paddingInline: u,
|
|
47
|
+
borderRadius: f,
|
|
51
48
|
color: h,
|
|
52
49
|
...b,
|
|
53
|
-
className: e(
|
|
50
|
+
className: e(c, g),
|
|
54
51
|
style: _
|
|
55
52
|
}),
|
|
56
|
-
children:
|
|
53
|
+
children: p.map(v, (e) => typeof e == "string" || typeof e == "number" ? /* @__PURE__ */ d(r, {
|
|
57
54
|
as: "span",
|
|
58
55
|
font: "label",
|
|
59
56
|
size: "sm",
|
|
@@ -61,30 +58,30 @@ function g({ variant: i = "neutral", display: a = "flex", alignItems: o = "cente
|
|
|
61
58
|
}) : e)
|
|
62
59
|
});
|
|
63
60
|
}
|
|
64
|
-
function
|
|
65
|
-
let [c,
|
|
66
|
-
return /* @__PURE__ */
|
|
67
|
-
...
|
|
68
|
-
render: /* @__PURE__ */
|
|
61
|
+
function v({ marginBlock: r = "4", marginInline: i = "8", className: a, style: o, ...s }) {
|
|
62
|
+
let [c, l] = t(s);
|
|
63
|
+
return /* @__PURE__ */ d(m.Separator, {
|
|
64
|
+
...l,
|
|
65
|
+
render: /* @__PURE__ */ d(n, {
|
|
69
66
|
marginBlock: r,
|
|
70
67
|
marginInline: i,
|
|
71
68
|
...c,
|
|
72
|
-
className: e(
|
|
69
|
+
className: e(u, a),
|
|
73
70
|
style: o
|
|
74
71
|
})
|
|
75
72
|
});
|
|
76
73
|
}
|
|
77
|
-
function
|
|
74
|
+
function y({ label: e, className: i, style: a, children: o, ...s }) {
|
|
78
75
|
let [c, l] = t(s);
|
|
79
|
-
return /* @__PURE__ */
|
|
76
|
+
return /* @__PURE__ */ f(m.Group, {
|
|
80
77
|
...l,
|
|
81
|
-
render: /* @__PURE__ */
|
|
78
|
+
render: /* @__PURE__ */ d(n, {
|
|
82
79
|
...c,
|
|
83
80
|
className: i,
|
|
84
81
|
style: a
|
|
85
82
|
}),
|
|
86
|
-
children: [/* @__PURE__ */
|
|
87
|
-
render: /* @__PURE__ */
|
|
83
|
+
children: [/* @__PURE__ */ d(m.GroupLabel, {
|
|
84
|
+
render: /* @__PURE__ */ d(r, {
|
|
88
85
|
as: "div",
|
|
89
86
|
color: "fgMuted",
|
|
90
87
|
font: "label",
|
|
@@ -96,12 +93,12 @@ function v({ label: e, className: i, style: a, children: o, ...s }) {
|
|
|
96
93
|
}), o]
|
|
97
94
|
});
|
|
98
95
|
}
|
|
99
|
-
var
|
|
100
|
-
Trigger:
|
|
101
|
-
Popup:
|
|
102
|
-
Item:
|
|
103
|
-
Separator:
|
|
104
|
-
Group:
|
|
96
|
+
var b = Object.assign(h, {
|
|
97
|
+
Trigger: s,
|
|
98
|
+
Popup: g,
|
|
99
|
+
Item: _,
|
|
100
|
+
Separator: v,
|
|
101
|
+
Group: y
|
|
105
102
|
});
|
|
106
103
|
//#endregion
|
|
107
|
-
export {
|
|
104
|
+
export { b as Menu };
|
package/dist/docs/Menu.md
CHANGED
|
@@ -92,6 +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
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.
|
|
96
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.
|
|
97
98
|
|
package/dist/docs/manifest.json
CHANGED