@jonmilner/ui 0.2.0 → 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.
@@ -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)}._393eil0:focus-visible{outline:var(--space-2) solid var(--color-focus);outline-offset:var(--space-2)}._393eil0[data-starting-style],._393eil0[data-ending-style]{opacity:0;scale:calc(1 - var(--scale-med))}._393eil1{cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none}._393eil1:focus-visible{outline:var(--space-2) solid var(--color-focus);outline-offset:var(--space-2)}._393eil1[data-highlighted]{background-color:light-dark(var(--color-bg-muted),color-mix(in srgb, var(--color-fg) 10%, var(--color-bg-raised)))}._393eil1[aria-disabled=true]{color:var(--color-fg-muted);cursor:not-allowed}._393eil2{border-block-start:var(--space-1) solid var(--color-border)}@media (forced-colors:active){._393eil1[data-highlighted]{forced-color-adjust:none;color:highlighttext;background-color:highlight}._393eil1[aria-disabled=true]{color:graytext}}}
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}}}
@@ -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 { t as item, e as popup, n as separator };
8
+ export { n as item, t as popup, e as positioner, r as separator };
@@ -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">;
@@ -1,27 +1,47 @@
1
1
  "use client";
2
- import { triggerElement as e, usePopupScope as t } from "../popup/client.mjs";
3
- import { jsx as n } from "react/jsx-runtime";
4
- import { Menu as r } from "@base-ui/react/menu";
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";
5
9
  //#region src/Menu/client.tsx
6
- function i({ disabled: i = !1, openOnHover: a, delay: o, closeDelay: s, handle: c, payload: l, ...u }) {
7
- let { ref: d } = t();
8
- return /* @__PURE__ */ n(r.Trigger, {
9
- disabled: i,
10
- openOnHover: a,
11
- delay: o,
12
- closeDelay: s,
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, {
13
+ disabled: e,
14
+ openOnHover: t,
15
+ delay: n,
16
+ closeDelay: a,
13
17
  handle: c,
14
18
  payload: l,
15
19
  ref: d,
16
- render: e(u)
20
+ render: r(u)
17
21
  });
18
22
  }
19
- function a({ children: e }) {
20
- let { container: i } = t();
21
- return /* @__PURE__ */ n(r.Portal, {
22
- container: i,
23
+ function l({ children: e }) {
24
+ let { container: t } = i();
25
+ return /* @__PURE__ */ o(s.Portal, {
26
+ container: t,
23
27
  children: e
24
28
  });
25
29
  }
30
+ function u(r) {
31
+ return /* @__PURE__ */ o(s.Positioner, {
32
+ ...r,
33
+ collisionPadding: 8,
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),
40
+ zIndex: "popover"
41
+ });
42
+ },
43
+ sideOffset: 4
44
+ });
45
+ }
26
46
  //#endregion
27
- export { a as MenuPortal, i as MenuTrigger };
47
+ export { l as MenuPortal, u as MenuPositioner, c as MenuTrigger };
@@ -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, MenuTrigger as o } from "./client.mjs";
7
- import { item as s, popup as c, separator as l } from "./Menu.css.mjs";
8
- import { jsx as u, jsxs as d } from "react/jsx-runtime";
9
- import { Children as f } from "react";
10
- import { Menu as p } from "@base-ui/react/menu";
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
+ 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 m({ children: e, ...t }) {
13
- return /* @__PURE__ */ u(i, { children: /* @__PURE__ */ u(p.Root, {
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 h({ side: r = "bottom", align: i = "start", backgroundColor: o = "bgRaised", borderRadius: s = "med", boxShadow: l = "med", padding: d = "4", className: f, style: m, ...h }) {
19
- let [g, _] = t(h);
20
- return /* @__PURE__ */ u(a, { children: /* @__PURE__ */ u(p.Positioner, {
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
+ let [_, v] = t(g);
20
+ return /* @__PURE__ */ d(c, { children: /* @__PURE__ */ d(l, {
21
21
  align: i,
22
- collisionPadding: 8,
23
- render: /* @__PURE__ */ u(n, { zIndex: "popover" }),
24
22
  side: r,
25
- sideOffset: 4,
26
- children: /* @__PURE__ */ u(p.Popup, {
27
- ..._,
28
- render: /* @__PURE__ */ u(n, {
29
- backgroundColor: o,
23
+ children: /* @__PURE__ */ d(m.Popup, {
24
+ ...v,
25
+ render: /* @__PURE__ */ d(n, {
26
+ backgroundColor: a,
30
27
  borderRadius: s,
31
- boxShadow: l,
32
- padding: d,
33
- ...g,
34
- className: e(c, f),
35
- style: m
28
+ boxShadow: u,
29
+ padding: f,
30
+ ..._,
31
+ className: e(o, p),
32
+ style: h
36
33
  })
37
34
  })
38
35
  }) });
39
36
  }
40
- function g({ variant: i = "neutral", display: a = "flex", alignItems: o = "center", gap: c = "8", minBlockSize: l = "sm", paddingInline: d = "12", borderRadius: m = "sm", color: h = i === "danger" ? "danger" : "fg", className: g, style: _, children: v, ...y }) {
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 }) {
41
38
  let [b, x] = t(y);
42
- return /* @__PURE__ */ u(p.Item, {
39
+ return /* @__PURE__ */ d(m.Item, {
43
40
  ...x,
44
- render: /* @__PURE__ */ u(n, {
45
- display: a,
46
- alignItems: o,
41
+ render: /* @__PURE__ */ d(n, {
42
+ display: o,
43
+ alignItems: s,
47
44
  gap: c,
48
45
  minBlockSize: l,
49
- paddingInline: d,
50
- borderRadius: m,
46
+ paddingInline: u,
47
+ borderRadius: f,
51
48
  color: h,
52
49
  ...b,
53
- className: e(s, g),
50
+ className: e(a, g),
54
51
  style: _
55
52
  }),
56
- children: f.map(v, (e) => typeof e == "string" || typeof e == "number" ? /* @__PURE__ */ u(r, {
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 _({ marginBlock: r = "4", marginInline: i = "8", className: a, style: o, ...s }) {
65
- let [c, d] = t(s);
66
- return /* @__PURE__ */ u(p.Separator, {
67
- ...d,
68
- render: /* @__PURE__ */ u(n, {
61
+ function v({ marginBlock: r = "4", marginInline: i = "8", className: a, style: o, ...c }) {
62
+ let [l, u] = t(c);
63
+ return /* @__PURE__ */ d(m.Separator, {
64
+ ...u,
65
+ render: /* @__PURE__ */ d(n, {
69
66
  marginBlock: r,
70
67
  marginInline: i,
71
- ...c,
72
- className: e(l, a),
68
+ ...l,
69
+ className: e(s, a),
73
70
  style: o
74
71
  })
75
72
  });
76
73
  }
77
- function v({ label: e, className: i, style: a, children: o, ...s }) {
74
+ function y({ label: e, className: i, style: a, children: o, ...s }) {
78
75
  let [c, l] = t(s);
79
- return /* @__PURE__ */ d(p.Group, {
76
+ return /* @__PURE__ */ f(m.Group, {
80
77
  ...l,
81
- render: /* @__PURE__ */ u(n, {
78
+ render: /* @__PURE__ */ d(n, {
82
79
  ...c,
83
80
  className: i,
84
81
  style: a
85
82
  }),
86
- children: [/* @__PURE__ */ u(p.GroupLabel, {
87
- render: /* @__PURE__ */ u(r, {
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 y = Object.assign(m, {
100
- Trigger: o,
101
- Popup: h,
102
- Item: g,
103
- Separator: _,
104
- Group: v
96
+ var b = Object.assign(h, {
97
+ Trigger: u,
98
+ Popup: g,
99
+ Item: _,
100
+ Separator: v,
101
+ Group: y
105
102
  });
106
103
  //#endregion
107
- export { y as Menu };
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. Nothing in it is in the tab order. 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
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "./manifest.schema.json",
3
3
  "package": "@jonmilner/ui",
4
- "version": "0.2.0",
4
+ "version": "0.2.2",
5
5
  "components": [
6
6
  {
7
7
  "name": "AlertDialog",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jonmilner/ui",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "files": [
5
5
  "dist",
6
6
  "THIRD_PARTY_NOTICES.md"