@ledgerhq/lumen-ui-react 0.1.34 → 0.1.36

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.
Files changed (103) hide show
  1. package/dist/index.js +187 -182
  2. package/dist/lib/Components/AmountDisplay/AmountDisplay.d.ts +1 -1
  3. package/dist/lib/Components/AmountDisplay/AmountDisplay.d.ts.map +1 -1
  4. package/dist/lib/Components/AmountDisplay/AmountDisplay.js +117 -78
  5. package/dist/lib/Components/AmountDisplay/index.d.ts +1 -1
  6. package/dist/lib/Components/AmountDisplay/index.d.ts.map +1 -1
  7. package/dist/lib/Components/AmountDisplay/types.d.ts +16 -3
  8. package/dist/lib/Components/AmountDisplay/types.d.ts.map +1 -1
  9. package/dist/lib/Components/Card/types.d.ts +1 -1
  10. package/dist/lib/Components/DescriptionItem/DescriptionItem.d.ts +45 -0
  11. package/dist/lib/Components/DescriptionItem/DescriptionItem.d.ts.map +1 -0
  12. package/dist/lib/Components/DescriptionItem/DescriptionItem.js +98 -0
  13. package/dist/lib/Components/DescriptionItem/index.d.ts +3 -0
  14. package/dist/lib/Components/DescriptionItem/index.d.ts.map +1 -0
  15. package/dist/lib/Components/DescriptionItem/types.d.ts +58 -0
  16. package/dist/lib/Components/DescriptionItem/types.d.ts.map +1 -0
  17. package/dist/lib/Components/DotIcon/DotIcon.d.ts +1 -1
  18. package/dist/lib/Components/DotIcon/DotIcon.d.ts.map +1 -1
  19. package/dist/lib/Components/DotIcon/DotIcon.js +48 -37
  20. package/dist/lib/Components/DotIcon/types.d.ts +6 -0
  21. package/dist/lib/Components/DotIcon/types.d.ts.map +1 -1
  22. package/dist/lib/Components/DotSymbol/DotSymbol.d.ts +1 -1
  23. package/dist/lib/Components/DotSymbol/DotSymbol.d.ts.map +1 -1
  24. package/dist/lib/Components/DotSymbol/DotSymbol.js +42 -31
  25. package/dist/lib/Components/DotSymbol/types.d.ts +6 -0
  26. package/dist/lib/Components/DotSymbol/types.d.ts.map +1 -1
  27. package/dist/lib/Components/MediaButton/MediaButton.d.ts +3 -3
  28. package/dist/lib/Components/MediaButton/MediaButton.d.ts.map +1 -1
  29. package/dist/lib/Components/MediaButton/MediaButton.js +42 -40
  30. package/dist/lib/Components/MediaButton/types.d.ts +5 -5
  31. package/dist/lib/Components/MediaButton/types.d.ts.map +1 -1
  32. package/dist/lib/Components/MediaImage/MediaImage.d.ts +1 -1
  33. package/dist/lib/Components/MediaImage/MediaImage.d.ts.map +1 -1
  34. package/dist/lib/Components/MediaImage/MediaImage.js +40 -29
  35. package/dist/lib/Components/MediaImage/types.d.ts +6 -0
  36. package/dist/lib/Components/MediaImage/types.d.ts.map +1 -1
  37. package/dist/lib/Components/Menu/Menu.d.ts +11 -16
  38. package/dist/lib/Components/Menu/Menu.d.ts.map +1 -1
  39. package/dist/lib/Components/Menu/Menu.js +186 -125
  40. package/dist/lib/Components/Menu/types.d.ts +50 -145
  41. package/dist/lib/Components/Menu/types.d.ts.map +1 -1
  42. package/dist/lib/Components/NavBar/CoinCapsule.d.ts +2 -2
  43. package/dist/lib/Components/NavBar/CoinCapsule.d.ts.map +1 -1
  44. package/dist/lib/Components/NavBar/CoinCapsule.js +4 -4
  45. package/dist/lib/Components/NavBar/NavBar.d.ts +4 -4
  46. package/dist/lib/Components/NavBar/NavBar.d.ts.map +1 -1
  47. package/dist/lib/Components/NavBar/NavBar.js +10 -2
  48. package/dist/lib/Components/NavBar/types.d.ts +2 -2
  49. package/dist/lib/Components/NavBar/types.d.ts.map +1 -1
  50. package/dist/lib/Components/Popover/Popover.d.ts +2 -2
  51. package/dist/lib/Components/Popover/types.d.ts +6 -3
  52. package/dist/lib/Components/Popover/types.d.ts.map +1 -1
  53. package/dist/lib/Components/index.d.ts +2 -1
  54. package/dist/lib/Components/index.d.ts.map +1 -1
  55. package/dist/node_modules/@base-ui/react/esm/composite/item/CompositeItem.js +30 -0
  56. package/dist/node_modules/@base-ui/react/esm/composite/item/useCompositeItem.js +34 -0
  57. package/dist/node_modules/@base-ui/react/esm/context-menu/root/ContextMenuRootContext.js +14 -0
  58. package/dist/node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingFocusManager.js +10 -10
  59. package/dist/node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFocus.js +97 -0
  60. package/dist/node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverFloatingInteraction.js +10 -10
  61. package/dist/node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverReferenceInteraction.js +2 -2
  62. package/dist/node_modules/@base-ui/react/esm/floating-ui-react/utils/element.js +31 -20
  63. package/dist/node_modules/@base-ui/react/esm/menu/checkbox-item/MenuCheckboxItem.js +78 -0
  64. package/dist/node_modules/@base-ui/react/esm/menu/checkbox-item/MenuCheckboxItemContext.js +14 -0
  65. package/dist/node_modules/@base-ui/react/esm/menu/checkbox-item/MenuCheckboxItemDataAttributes.js +6 -0
  66. package/dist/node_modules/@base-ui/react/esm/menu/checkbox-item-indicator/MenuCheckboxItemIndicator.js +44 -0
  67. package/dist/node_modules/@base-ui/react/esm/menu/group/MenuGroup.js +28 -0
  68. package/dist/node_modules/@base-ui/react/esm/menu/group/MenuGroupContext.js +14 -0
  69. package/dist/node_modules/@base-ui/react/esm/menu/group-label/MenuGroupLabel.js +29 -0
  70. package/dist/node_modules/@base-ui/react/esm/menu/item/MenuItem.js +47 -0
  71. package/dist/node_modules/@base-ui/react/esm/menu/item/useMenuItem.js +50 -0
  72. package/dist/node_modules/@base-ui/react/esm/menu/item/useMenuItemCommonProps.js +49 -0
  73. package/dist/node_modules/@base-ui/react/esm/menu/popup/MenuPopup.js +89 -0
  74. package/dist/node_modules/@base-ui/react/esm/menu/portal/MenuPortal.js +24 -0
  75. package/dist/node_modules/@base-ui/react/esm/menu/portal/MenuPortalContext.js +14 -0
  76. package/dist/node_modules/@base-ui/react/esm/menu/positioner/MenuPositioner.js +174 -0
  77. package/dist/node_modules/@base-ui/react/esm/menu/positioner/MenuPositionerContext.js +14 -0
  78. package/dist/node_modules/@base-ui/react/esm/menu/radio-group/MenuRadioGroup.js +45 -0
  79. package/dist/node_modules/@base-ui/react/esm/menu/radio-group/MenuRadioGroupContext.js +14 -0
  80. package/dist/node_modules/@base-ui/react/esm/menu/radio-item/MenuRadioItem.js +75 -0
  81. package/dist/node_modules/@base-ui/react/esm/menu/radio-item/MenuRadioItemContext.js +14 -0
  82. package/dist/node_modules/@base-ui/react/esm/menu/radio-item-indicator/MenuRadioItemIndicator.js +44 -0
  83. package/dist/node_modules/@base-ui/react/esm/menu/root/MenuRoot.js +271 -0
  84. package/dist/node_modules/@base-ui/react/esm/menu/root/MenuRootContext.js +14 -0
  85. package/dist/node_modules/@base-ui/react/esm/menu/store/MenuStore.js +109 -0
  86. package/dist/node_modules/@base-ui/react/esm/menu/submenu-root/MenuSubmenuRoot.js +21 -0
  87. package/dist/node_modules/@base-ui/react/esm/menu/submenu-root/MenuSubmenuRootContext.js +10 -0
  88. package/dist/node_modules/@base-ui/react/esm/menu/submenu-trigger/MenuSubmenuTrigger.js +101 -0
  89. package/dist/node_modules/@base-ui/react/esm/menu/trigger/MenuTrigger.js +207 -0
  90. package/dist/node_modules/@base-ui/react/esm/menu/utils/findRootOwnerId.js +10 -0
  91. package/dist/node_modules/@base-ui/react/esm/menu/utils/stateAttributesMapping.js +15 -0
  92. package/dist/node_modules/@base-ui/react/esm/menubar/MenubarContext.js +10 -0
  93. package/dist/node_modules/@base-ui/react/esm/popover/root/PopoverRoot.js +11 -11
  94. package/dist/node_modules/@base-ui/react/esm/popover/store/PopoverStore.js +7 -7
  95. package/dist/node_modules/@base-ui/react/esm/popover/trigger/PopoverTrigger.js +11 -11
  96. package/dist/node_modules/@base-ui/react/esm/utils/constants.js +11 -10
  97. package/dist/node_modules/@base-ui/react/esm/utils/reason-parts.js +11 -8
  98. package/dist/node_modules/@base-ui/react/esm/utils/useMixedToggleClickHandler.js +25 -0
  99. package/dist/node_modules/@base-ui/utils/esm/detectBrowser.js +7 -8
  100. package/dist/node_modules/@base-ui/utils/esm/fastHooks.js +43 -0
  101. package/dist/node_modules/@base-ui/utils/esm/store/useStore.js +54 -13
  102. package/dist/package.json +2 -3
  103. package/package.json +4 -5
@@ -20,9 +20,9 @@ import { CLICK_TRIGGER_IDENTIFIER as Ye } from "../../utils/constants.js";
20
20
  import { resolveRef as L } from "../../utils/resolveRef.js";
21
21
  import { jsxs as Ze, jsx as Ie } from "react/jsx-runtime";
22
22
  import { isTypeableCombobox as he, getFloatingFocusElement as ke, contains as d, activeElement as M, isTypeableElement as et, getTarget as re } from "../utils/element.js";
23
- import { getTabbableOptions as se, isOutsideEvent as Le, getNextTabbable as tt, getPreviousTabbable as nt } from "../utils/tabbable.js";
24
- import { getNodeAncestors as Ce, getNodeChildren as Oe } from "../utils/nodes.js";
25
- import { isVirtualClick as rt, isVirtualPointerEvent as ot, stopEvent as st } from "../utils/event.js";
23
+ import { getNodeAncestors as Le, getNodeChildren as Ce } from "../utils/nodes.js";
24
+ import { isVirtualClick as tt, isVirtualPointerEvent as nt, stopEvent as rt } from "../utils/event.js";
25
+ import { isOutsideEvent as Oe, getNextTabbable as ot, getPreviousTabbable as st, getTabbableOptions as se } from "../utils/tabbable.js";
26
26
  import { isElementVisible as ut } from "../utils/composite.js";
27
27
  import { triggerHover as it, outsidePress as ct, focusOut as at } from "../../utils/reason-parts.js";
28
28
  function ft(t, v) {
@@ -85,7 +85,7 @@ function Kt(t) {
85
85
  if (f || !m)
86
86
  return;
87
87
  function e(b) {
88
- b.key === "Tab" && d(s, M(N(s))) && D().length === 0 && !I && st(b);
88
+ b.key === "Tab" && d(s, M(N(s))) && D().length === 0 && !I && rt(b);
89
89
  }
90
90
  const c = N(s);
91
91
  return c.addEventListener("keydown", e), () => {
@@ -124,7 +124,7 @@ function Kt(t) {
124
124
  function p(l) {
125
125
  const n = l.relatedTarget, H = l.currentTarget, $ = re(l);
126
126
  queueMicrotask(() => {
127
- const Ee = S(), ge = x.context.triggerElements, He = k(), We = n?.hasAttribute(Fe("focus-guard")) && [Y.current, Z.current, u?.beforeInsideRef.current, u?.afterInsideRef.current, u?.beforeOutsideRef.current, u?.afterOutsideRef.current, L(q), L(V)].includes(n), _e = !(d(a, n) || d(i, n) || d(n, i) || d(u?.portalNode, n) || He.some((R) => R === n || d(R, n)) || n != null && ge.hasElement(n) || ge.hasMatchingElement((R) => d(R, n)) || We || y && (Oe(y.nodesRef.current, Ee).find((R) => d(R.context?.elements.floating, n) || d(R.context?.elements.domReference, n)) || Ce(y.nodesRef.current, Ee).find((R) => [R.context?.elements.floating, ke(R.context?.elements.floating)].includes(n) || R.context?.elements.domReference === n)));
127
+ const Ee = S(), ge = x.context.triggerElements, He = k(), We = n?.hasAttribute(Fe("focus-guard")) && [Y.current, Z.current, u?.beforeInsideRef.current, u?.afterInsideRef.current, u?.beforeOutsideRef.current, u?.afterOutsideRef.current, L(q), L(V)].includes(n), _e = !(d(a, n) || d(i, n) || d(n, i) || d(u?.portalNode, n) || He.some((R) => R === n || d(R, n)) || n != null && ge.hasElement(n) || ge.hasMatchingElement((R) => d(R, n)) || We || y && (Ce(y.nodesRef.current, Ee).find((R) => d(R.context?.elements.floating, n) || d(R.context?.elements.domReference, n)) || Le(y.nodesRef.current, Ee).find((R) => [R.context?.elements.floating, ke(R.context?.elements.floating)].includes(n) || R.context?.elements.domReference === n)));
128
128
  if (H === a && s && Ae(s, A), O && H !== a && !bt($) && M(e) === e.body) {
129
129
  if (P(s) && (s.focus(), O === "popup")) {
130
130
  me.request(() => {
@@ -170,7 +170,7 @@ function Kt(t) {
170
170
  }, [f, a, i, s, m, y, u, x, G, O, D, I, S, A, w, de, be, me, V, q, k]), E.useEffect(() => {
171
171
  if (f || !i || !T)
172
172
  return;
173
- const e = Array.from(u?.portalNode?.querySelectorAll(`[${Fe("portal")}]`) || []), b = (y ? Ce(y.nodesRef.current, S()) : []).find((n) => he(n.context?.elements.domReference || null))?.context?.elements.domReference, o = [...[i, ...e, Y.current, Z.current, u?.beforeOutsideRef.current, u?.afterOutsideRef.current, ...k()], b, L(q), L(V), I ? a : null].filter((n) => n != null), r = xe(o, {
173
+ const e = Array.from(u?.portalNode?.querySelectorAll(`[${Fe("portal")}]`) || []), b = (y ? Le(y.nodesRef.current, S()) : []).find((n) => he(n.context?.elements.domReference || null))?.context?.elements.domReference, o = [...[i, ...e, Y.current, Z.current, u?.beforeOutsideRef.current, u?.afterOutsideRef.current, ...k()], b, L(q), L(V), I ? a : null].filter((n) => n != null), r = xe(o, {
174
174
  ariaHidden: m || I,
175
175
  mark: !1
176
176
  }), g = [i, ...e].filter((n) => n != null), l = xe(g);
@@ -199,7 +199,7 @@ function Kt(t) {
199
199
  if (o.open || (le.current = ft(o.nativeEvent, X.current)), o.reason === it && o.nativeEvent.type === "mouseleave" && (F.current = !0), o.reason === ct)
200
200
  if (o.nested)
201
201
  F.current = !1;
202
- else if (rt(o.nativeEvent) || ot(o.nativeEvent))
202
+ else if (tt(o.nativeEvent) || nt(o.nativeEvent))
203
203
  F.current = !1;
204
204
  else {
205
205
  let r = !1;
@@ -225,7 +225,7 @@ function Kt(t) {
225
225
  }
226
226
  return () => {
227
227
  J.off("openchange", b);
228
- const o = M(e), r = k(), g = d(i, o) || r.some((n) => n === o || d(n, o)) || y && Oe(y.nodesRef.current, S(), !1).some((n) => d(n.context?.elements.floating, o)), l = p();
228
+ const o = M(e), r = k(), g = d(i, o) || r.some((n) => n === o || d(n, o)) || y && Ce(y.nodesRef.current, S(), !1).some((n) => d(n.context?.elements.floating, o)), l = p();
229
229
  queueMicrotask(() => {
230
230
  const n = dt(l), H = typeof B.current != "boolean";
231
231
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -268,13 +268,13 @@ function Kt(t) {
268
268
  if (m) {
269
269
  const c = K();
270
270
  ne(c[c.length - 1]);
271
- } else u?.portalNode && (F.current = !1, Le(e, u.portalNode) ? tt(a)?.focus() : L(q ?? u.beforeOutsideRef)?.focus());
271
+ } else u?.portalNode && (F.current = !1, Oe(e, u.portalNode) ? ot(a)?.focus() : L(q ?? u.beforeOutsideRef)?.focus());
272
272
  }
273
273
  }), h, pe && /* @__PURE__ */ Ie(ye, {
274
274
  "data-type": "inside",
275
275
  ref: qe,
276
276
  onFocus: (e) => {
277
- m ? ne(K()[0]) : u?.portalNode && (G && (F.current = !0), Le(e, u.portalNode) ? nt(a)?.focus() : L(V ?? u.afterOutsideRef)?.focus());
277
+ m ? ne(K()[0]) : u?.portalNode && (G && (F.current = !0), Oe(e, u.portalNode) ? st(a)?.focus() : L(V ?? u.afterOutsideRef)?.focus());
278
278
  }
279
279
  })]
280
280
  });
@@ -0,0 +1,97 @@
1
+ import * as s from "react";
2
+ import { getWindow as D, isElement as R, isHTMLElement as k } from "../../../../../@floating-ui/utils/dist/floating-ui.utils.dom.js";
3
+ import { isMac as x, isSafari as O } from "../../../../utils/esm/detectBrowser.js";
4
+ import { useTimeout as S } from "../../../../utils/esm/useTimeout.js";
5
+ import { ownerDocument as A } from "../../../../utils/esm/owner.js";
6
+ import { createChangeEventDetails as T } from "../../utils/createBaseUIEventDetails.js";
7
+ import { createAttribute as C } from "../utils/createAttribute.js";
8
+ import { activeElement as F, contains as L, isTargetInsideEnabledTrigger as h, getTarget as B, isTypeableElement as K, matchesFocusVisible as P } from "../utils/element.js";
9
+ import { triggerFocus as b, triggerPress as V, escapeKey as G } from "../../utils/reason-parts.js";
10
+ const y = x && O;
11
+ function Q(d, M = {}) {
12
+ const t = "rootStore" in d ? d.rootStore : d, {
13
+ events: g,
14
+ dataRef: w
15
+ } = t.context, {
16
+ enabled: i = !0,
17
+ delay: l
18
+ } = M, u = s.useRef(!1), a = s.useRef(null), E = S(), p = s.useRef(!0);
19
+ s.useEffect(() => {
20
+ const r = t.select("domReferenceElement");
21
+ if (!i)
22
+ return;
23
+ const e = D(r);
24
+ function n() {
25
+ const o = t.select("domReferenceElement");
26
+ !t.select("open") && k(o) && o === F(A(o)) && (u.current = !0);
27
+ }
28
+ function f() {
29
+ p.current = !0;
30
+ }
31
+ function c() {
32
+ p.current = !1;
33
+ }
34
+ return e.addEventListener("blur", n), y && (e.addEventListener("keydown", f, !0), e.addEventListener("pointerdown", c, !0)), () => {
35
+ e.removeEventListener("blur", n), y && (e.removeEventListener("keydown", f, !0), e.removeEventListener("pointerdown", c, !0));
36
+ };
37
+ }, [t, i]), s.useEffect(() => {
38
+ if (!i)
39
+ return;
40
+ function r(e) {
41
+ if (e.reason === V || e.reason === G) {
42
+ const n = t.select("domReferenceElement");
43
+ R(n) && (a.current = n, u.current = !0);
44
+ }
45
+ }
46
+ return g.on("openchange", r), () => {
47
+ g.off("openchange", r);
48
+ };
49
+ }, [g, i, t]);
50
+ const v = s.useMemo(() => ({
51
+ onMouseLeave() {
52
+ u.current = !1, a.current = null;
53
+ },
54
+ onFocus(r) {
55
+ const e = r.currentTarget;
56
+ if (u.current) {
57
+ if (a.current === e)
58
+ return;
59
+ u.current = !1, a.current = null;
60
+ }
61
+ const n = B(r.nativeEvent);
62
+ if (R(n)) {
63
+ if (y && !r.relatedTarget) {
64
+ if (!p.current && !K(n))
65
+ return;
66
+ } else if (!P(n))
67
+ return;
68
+ }
69
+ const f = h(r.relatedTarget, t.context.triggerElements), {
70
+ nativeEvent: c,
71
+ currentTarget: o
72
+ } = r, m = typeof l == "function" ? l() : l;
73
+ if (t.select("open") && f || m === 0 || m === void 0) {
74
+ t.setOpen(!0, T(b, c, o));
75
+ return;
76
+ }
77
+ E.start(m, () => {
78
+ u.current || t.setOpen(!0, T(b, c, o));
79
+ });
80
+ },
81
+ onBlur(r) {
82
+ u.current = !1, a.current = null;
83
+ const e = r.relatedTarget, n = r.nativeEvent, f = R(e) && e.hasAttribute(C("focus-guard")) && e.getAttribute("data-type") === "outside";
84
+ E.start(0, () => {
85
+ const c = t.select("domReferenceElement"), o = F(c ? c.ownerDocument : document);
86
+ !e && o === c || L(w.current.floatingContext?.refs.floating.current, o) || L(c, o) || f || h(e ?? o, t.context.triggerElements) || t.setOpen(!1, T(b, n));
87
+ });
88
+ }
89
+ }), [w, t, E, l]);
90
+ return s.useMemo(() => i ? {
91
+ reference: v,
92
+ trigger: v
93
+ } : {}, [i, v]);
94
+ }
95
+ export {
96
+ Q as useFocus
97
+ };
@@ -6,30 +6,30 @@ import { useTimeout as w } from "../../../../utils/esm/useTimeout.js";
6
6
  import { ownerDocument as H } from "../../../../utils/esm/owner.js";
7
7
  import { createChangeEventDetails as b } from "../../utils/createBaseUIEventDetails.js";
8
8
  import { useFloatingTree as M, useFloatingParentNodeId as N } from "../components/FloatingTree.js";
9
- import { useHoverInteractionSharedState as x, clearSafePolygonPointerEventsMutation as W, isInteractiveElement as $, applySafePolygonPointerEventsMutation as j } from "./useHoverInteractionSharedState.js";
10
- import { isClickLikeOpenEvent as q, getDelay as z } from "./useHoverShared.js";
11
- import { isTargetInsideEnabledTrigger as A, getTarget as B } from "../utils/element.js";
9
+ import { useHoverInteractionSharedState as x, applySafePolygonPointerEventsMutation as W, clearSafePolygonPointerEventsMutation as $, isInteractiveElement as j } from "./useHoverInteractionSharedState.js";
10
+ import { getDelay as q, isClickLikeOpenEvent as z } from "./useHoverShared.js";
12
11
  import { triggerHover as R } from "../../utils/reason-parts.js";
13
12
  import { getNodeChildren as k } from "../utils/nodes.js";
13
+ import { getTarget as A, isTargetInsideEnabledTrigger as B } from "../utils/element.js";
14
14
  function ne(p, D = {}) {
15
15
  const r = "rootStore" in p ? p.rootStore : p, u = r.useState("open"), f = r.useState("floatingElement"), g = r.useState("domReferenceElement"), {
16
16
  dataRef: E
17
17
  } = r.context, {
18
18
  enabled: m = !0,
19
19
  closeDelay: T = 0
20
- } = D, e = x(r), n = M(), c = N(), I = d(() => q(E.current.openEvent?.type, e.interactedInside)), C = d(() => {
20
+ } = D, e = x(r), n = M(), c = N(), I = d(() => z(E.current.openEvent?.type, e.interactedInside)), C = d(() => {
21
21
  const t = E.current.openEvent?.type;
22
22
  return t?.includes("mouse") && t !== "mousedown";
23
- }), S = d((t) => A(t, r.context.triggerElements)), L = y.useCallback((t) => {
24
- const s = z(T, "close", e.pointerType), a = () => {
23
+ }), S = d((t) => B(t, r.context.triggerElements)), L = y.useCallback((t) => {
24
+ const s = q(T, "close", e.pointerType), a = () => {
25
25
  r.setOpen(!1, b(R, t)), n?.events.emit("floating.closed", t);
26
26
  };
27
27
  s ? e.openChangeTimeout.start(s, a) : (e.openChangeTimeout.clear(), a());
28
28
  }, [T, r, e, n]), i = d(() => {
29
- W(e);
29
+ $(e);
30
30
  }), v = d((t) => {
31
- const s = B(t);
32
- if (!$(s)) {
31
+ const s = A(t);
32
+ if (!j(s)) {
33
33
  e.interactedInside = !1;
34
34
  return;
35
35
  }
@@ -42,7 +42,7 @@ function ne(p, D = {}) {
42
42
  const t = g, s = f, a = H(f), o = n?.nodesRef.current.find((O) => O.id === c)?.context?.elements.floating;
43
43
  o && (o.style.pointerEvents = "");
44
44
  const l = e.handleCloseOptions?.getScope?.() ?? e.pointerEventsScopeElement ?? o ?? t.closest("[data-rootownerid]") ?? a.body;
45
- return j(e, {
45
+ return W(e, {
46
46
  scopeElement: l,
47
47
  referenceElement: t,
48
48
  floatingElement: s
@@ -7,10 +7,10 @@ import { ownerDocument as B } from "../../../../utils/esm/owner.js";
7
7
  import { createChangeEventDetails as d } from "../../utils/createBaseUIEventDetails.js";
8
8
  import { useFloatingTree as K } from "../components/FloatingTree.js";
9
9
  import { useHoverInteractionSharedState as Q, clearSafePolygonPointerEventsMutation as U } from "./useHoverInteractionSharedState.js";
10
- import { getDelay as Y, getRestMs as N, isClickLikeOpenEvent as Z } from "./useHoverShared.js";
10
+ import { isClickLikeOpenEvent as Z, getDelay as Y, getRestMs as N } from "./useHoverShared.js";
11
+ import { isTargetInsideEnabledTrigger as ee, contains as P } from "../utils/element.js";
11
12
  import { isMouseLikePointerType as W } from "../utils/event.js";
12
13
  import { triggerHover as g } from "../../utils/reason-parts.js";
13
- import { contains as P, isTargetInsideEnabledTrigger as ee } from "../utils/element.js";
14
14
  const te = {
15
15
  current: null
16
16
  };
@@ -1,12 +1,13 @@
1
1
  import { isShadowRoot as i, isHTMLElement as u, isElement as s } from "../../../../../@floating-ui/utils/dist/floating-ui.utils.dom.js";
2
- import { TYPEABLE_SELECTOR as a, FOCUSABLE_ATTRIBUTE as o } from "./constants.js";
2
+ import { isJSDOM as a } from "../../../../utils/esm/detectBrowser.js";
3
+ import { FOCUSABLE_ATTRIBUTE as o, TYPEABLE_SELECTOR as c } from "./constants.js";
3
4
  function d(t) {
4
5
  let e = t.activeElement;
5
6
  for (; e?.shadowRoot?.activeElement != null; )
6
7
  e = e.shadowRoot.activeElement;
7
8
  return e;
8
9
  }
9
- function c(t, e) {
10
+ function f(t, e) {
10
11
  if (!t || !e)
11
12
  return !1;
12
13
  const r = e.getRootNode?.();
@@ -22,21 +23,21 @@ function c(t, e) {
22
23
  }
23
24
  return !1;
24
25
  }
25
- function h(t, e) {
26
+ function g(t, e) {
26
27
  if (!s(t))
27
28
  return !1;
28
29
  const r = t;
29
30
  if (e.hasElement(r))
30
31
  return !r.hasAttribute("data-trigger-disabled");
31
32
  for (const [, n] of e.entries())
32
- if (c(n, r))
33
+ if (f(n, r))
33
34
  return !n.hasAttribute("data-trigger-disabled");
34
35
  return !1;
35
36
  }
36
- function b(t) {
37
+ function E(t) {
37
38
  return "composedPath" in t ? t.composedPath()[0] : t.target;
38
39
  }
39
- function g(t, e) {
40
+ function T(t, e) {
40
41
  if (e == null)
41
42
  return !1;
42
43
  if ("composedPath" in t)
@@ -44,26 +45,36 @@ function g(t, e) {
44
45
  const r = t;
45
46
  return r.target != null && e.contains(r.target);
46
47
  }
47
- function E(t) {
48
+ function p(t) {
48
49
  return t.matches("html,body");
49
50
  }
50
- function f(t) {
51
- return u(t) && t.matches(a);
51
+ function l(t) {
52
+ return u(t) && t.matches(c);
52
53
  }
53
- function T(t) {
54
- return t ? t.getAttribute("role") === "combobox" && f(t) : !1;
54
+ function A(t) {
55
+ return t ? t.getAttribute("role") === "combobox" && l(t) : !1;
55
56
  }
56
- function p(t) {
57
+ function R(t) {
58
+ if (!t || a)
59
+ return !0;
60
+ try {
61
+ return t.matches(":focus-visible");
62
+ } catch {
63
+ return !0;
64
+ }
65
+ }
66
+ function w(t) {
57
67
  return t ? t.hasAttribute(o) ? t : t.querySelector(`[${o}]`) || t : null;
58
68
  }
59
69
  export {
60
70
  d as activeElement,
61
- c as contains,
62
- p as getFloatingFocusElement,
63
- b as getTarget,
64
- g as isEventTargetWithin,
65
- E as isRootElement,
66
- h as isTargetInsideEnabledTrigger,
67
- T as isTypeableCombobox,
68
- f as isTypeableElement
71
+ f as contains,
72
+ w as getFloatingFocusElement,
73
+ E as getTarget,
74
+ T as isEventTargetWithin,
75
+ p as isRootElement,
76
+ g as isTargetInsideEnabledTrigger,
77
+ A as isTypeableCombobox,
78
+ l as isTypeableElement,
79
+ R as matchesFocusVisible
69
80
  };
@@ -0,0 +1,78 @@
1
+ import * as c from "react";
2
+ import { useStableCallback as A } from "../../../../utils/esm/useStableCallback.js";
3
+ import { useControlled as O } from "../../../../utils/esm/useControlled.js";
4
+ import { MenuCheckboxItemContext as S } from "./MenuCheckboxItemContext.js";
5
+ import { useMenuItem as U, REGULAR_ITEM as B } from "../item/useMenuItem.js";
6
+ import { useCompositeListItem as D } from "../../composite/list/useCompositeListItem.js";
7
+ import { useMenuRootContext as L } from "../root/MenuRootContext.js";
8
+ import { useRenderElement as _ } from "../../utils/useRenderElement.js";
9
+ import { useBaseUiId as j } from "../../utils/useBaseUiId.js";
10
+ import { itemMapping as w } from "../utils/stateAttributesMapping.js";
11
+ import { useMenuPositionerContext as y } from "../positioner/MenuPositionerContext.js";
12
+ import { createChangeEventDetails as G } from "../../utils/createBaseUIEventDetails.js";
13
+ import { jsx as T } from "react/jsx-runtime";
14
+ import { itemPress as V } from "../../utils/reason-parts.js";
15
+ const q = /* @__PURE__ */ c.forwardRef(function(r, a) {
16
+ const {
17
+ render: F,
18
+ className: H,
19
+ id: d,
20
+ label: l,
21
+ nativeButton: u = !1,
22
+ disabled: t = !1,
23
+ closeOnClick: p = !1,
24
+ checked: f,
25
+ defaultChecked: C,
26
+ onCheckedChange: h,
27
+ ...k
28
+ } = r, s = D({
29
+ label: l
30
+ }), x = y(!0), I = j(d), {
31
+ store: o
32
+ } = L(), n = o.useState("isActive", s.index), M = o.useState("itemProps"), [e, b] = O({
33
+ controlled: f,
34
+ default: C ?? !1,
35
+ name: "MenuCheckboxItem",
36
+ state: "checked"
37
+ }), {
38
+ getItemProps: v,
39
+ itemRef: P
40
+ } = U({
41
+ closeOnClick: p,
42
+ disabled: t,
43
+ highlighted: n,
44
+ id: I,
45
+ store: o,
46
+ nativeButton: u,
47
+ nodeId: x?.nodeId,
48
+ itemMetadata: B
49
+ }), i = c.useMemo(() => ({
50
+ disabled: t,
51
+ highlighted: n,
52
+ checked: e
53
+ }), [t, n, e]), g = A((R) => {
54
+ const m = {
55
+ ...G(V, R.nativeEvent),
56
+ preventUnmountOnClose: () => {
57
+ }
58
+ };
59
+ h?.(!e, m), !m.isCanceled && b((N) => !N);
60
+ }), E = _("div", r, {
61
+ state: i,
62
+ stateAttributesMapping: w,
63
+ props: [M, {
64
+ role: "menuitemcheckbox",
65
+ "aria-checked": e,
66
+ onClick: g
67
+ }, k, v],
68
+ ref: [P, a, s.ref]
69
+ });
70
+ return /* @__PURE__ */ T(S.Provider, {
71
+ value: i,
72
+ children: E
73
+ });
74
+ });
75
+ process.env.NODE_ENV !== "production" && (q.displayName = "MenuCheckboxItem");
76
+ export {
77
+ q as MenuCheckboxItem
78
+ };
@@ -0,0 +1,14 @@
1
+ import n from "../../../../utils/esm/formatErrorMessage.js";
2
+ import * as t from "react";
3
+ const o = /* @__PURE__ */ t.createContext(void 0);
4
+ process.env.NODE_ENV !== "production" && (o.displayName = "MenuCheckboxItemContext");
5
+ function s() {
6
+ const e = t.useContext(o);
7
+ if (e === void 0)
8
+ throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: MenuCheckboxItemContext is missing. MenuCheckboxItem parts must be placed within <Menu.CheckboxItem>." : n(30));
9
+ return e;
10
+ }
11
+ export {
12
+ o as MenuCheckboxItemContext,
13
+ s as useMenuCheckboxItemContext
14
+ };
@@ -0,0 +1,6 @@
1
+ let h = /* @__PURE__ */ (function(d) {
2
+ return d.checked = "data-checked", d.unchecked = "data-unchecked", d.disabled = "data-disabled", d.highlighted = "data-highlighted", d;
3
+ })({});
4
+ export {
5
+ h as MenuCheckboxItemDataAttributes
6
+ };
@@ -0,0 +1,44 @@
1
+ import * as o from "react";
2
+ import { useMenuCheckboxItemContext as m } from "../checkbox-item/MenuCheckboxItemContext.js";
3
+ import { useRenderElement as p } from "../../utils/useRenderElement.js";
4
+ import { itemMapping as u } from "../utils/stateAttributesMapping.js";
5
+ import { useTransitionStatus as h } from "../../utils/useTransitionStatus.js";
6
+ import { useOpenChangeComplete as f } from "../../utils/useOpenChangeComplete.js";
7
+ const l = /* @__PURE__ */ o.forwardRef(function(t, r) {
8
+ const {
9
+ render: b,
10
+ className: C,
11
+ keepMounted: i = !1,
12
+ ...s
13
+ } = t, e = m(), n = o.useRef(null), {
14
+ transitionStatus: c,
15
+ setMounted: a
16
+ } = h(e.checked);
17
+ f({
18
+ open: e.checked,
19
+ ref: n,
20
+ onComplete() {
21
+ e.checked || a(!1);
22
+ }
23
+ });
24
+ const d = {
25
+ checked: e.checked,
26
+ disabled: e.disabled,
27
+ highlighted: e.highlighted,
28
+ transitionStatus: c
29
+ };
30
+ return p("span", t, {
31
+ state: d,
32
+ ref: [r, n],
33
+ stateAttributesMapping: u,
34
+ props: {
35
+ "aria-hidden": !0,
36
+ ...s
37
+ },
38
+ enabled: i || e.checked
39
+ });
40
+ });
41
+ process.env.NODE_ENV !== "production" && (l.displayName = "MenuCheckboxItemIndicator");
42
+ export {
43
+ l as MenuCheckboxItemIndicator
44
+ };
@@ -0,0 +1,28 @@
1
+ import * as e from "react";
2
+ import { useRenderElement as l } from "../../utils/useRenderElement.js";
3
+ import { MenuGroupContext as p } from "./MenuGroupContext.js";
4
+ import { jsx as d } from "react/jsx-runtime";
5
+ const i = /* @__PURE__ */ e.forwardRef(function(r, t) {
6
+ const {
7
+ render: c,
8
+ className: f,
9
+ ...n
10
+ } = r, [s, o] = e.useState(void 0), u = e.useMemo(() => ({
11
+ setLabelId: o
12
+ }), [o]), a = l("div", r, {
13
+ ref: t,
14
+ props: {
15
+ role: "group",
16
+ "aria-labelledby": s,
17
+ ...n
18
+ }
19
+ });
20
+ return /* @__PURE__ */ d(p.Provider, {
21
+ value: u,
22
+ children: a
23
+ });
24
+ });
25
+ process.env.NODE_ENV !== "production" && (i.displayName = "MenuGroup");
26
+ export {
27
+ i as MenuGroup
28
+ };
@@ -0,0 +1,14 @@
1
+ import n from "../../../../utils/esm/formatErrorMessage.js";
2
+ import * as o from "react";
3
+ const t = /* @__PURE__ */ o.createContext(void 0);
4
+ process.env.NODE_ENV !== "production" && (t.displayName = "MenuGroupContext");
5
+ function u() {
6
+ const e = o.useContext(t);
7
+ if (e === void 0)
8
+ throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: MenuGroupRootContext is missing. Menu group parts must be used within <Menu.Group>." : n(31));
9
+ return e;
10
+ }
11
+ export {
12
+ t as MenuGroupContext,
13
+ u as useMenuGroupRootContext
14
+ };
@@ -0,0 +1,29 @@
1
+ import * as u from "react";
2
+ import { useIsoLayoutEffect as p } from "../../../../utils/esm/useIsoLayoutEffect.js";
3
+ import { useRenderElement as i } from "../../utils/useRenderElement.js";
4
+ import { useBaseUiId as a } from "../../utils/useBaseUiId.js";
5
+ import { useMenuGroupRootContext as m } from "../group/MenuGroupContext.js";
6
+ const d = /* @__PURE__ */ u.forwardRef(function(r, t) {
7
+ const {
8
+ className: c,
9
+ render: l,
10
+ id: n,
11
+ ...s
12
+ } = r, e = a(n), {
13
+ setLabelId: o
14
+ } = m();
15
+ return p(() => (o(e), () => {
16
+ o(void 0);
17
+ }), [o, e]), i("div", r, {
18
+ ref: t,
19
+ props: {
20
+ id: e,
21
+ role: "presentation",
22
+ ...s
23
+ }
24
+ });
25
+ });
26
+ process.env.NODE_ENV !== "production" && (d.displayName = "MenuGroupLabel");
27
+ export {
28
+ d as MenuGroupLabel
29
+ };
@@ -0,0 +1,47 @@
1
+ import * as M from "react";
2
+ import { useMenuItem as R, REGULAR_ITEM as P } from "./useMenuItem.js";
3
+ import { useMenuRootContext as x } from "../root/MenuRootContext.js";
4
+ import { useRenderElement as C } from "../../utils/useRenderElement.js";
5
+ import { useBaseUiId as E } from "../../utils/useBaseUiId.js";
6
+ import { useCompositeListItem as v } from "../../composite/list/useCompositeListItem.js";
7
+ import { useMenuPositionerContext as N } from "../positioner/MenuPositionerContext.js";
8
+ const g = /* @__PURE__ */ M.forwardRef(function(t, i) {
9
+ const {
10
+ render: b,
11
+ className: A,
12
+ id: n,
13
+ label: m,
14
+ nativeButton: u = !1,
15
+ disabled: o = !1,
16
+ closeOnClick: a = !0,
17
+ ...d
18
+ } = t, s = v({
19
+ label: m
20
+ }), c = N(!0), p = E(n), {
21
+ store: e
22
+ } = x(), r = e.useState("isActive", s.index), f = e.useState("itemProps"), {
23
+ getItemProps: l,
24
+ itemRef: I
25
+ } = R({
26
+ closeOnClick: a,
27
+ disabled: o,
28
+ highlighted: r,
29
+ id: p,
30
+ store: e,
31
+ nativeButton: u,
32
+ nodeId: c?.nodeId,
33
+ itemMetadata: P
34
+ });
35
+ return C("div", t, {
36
+ state: {
37
+ disabled: o,
38
+ highlighted: r
39
+ },
40
+ props: [f, d, l],
41
+ ref: [I, i, s.ref]
42
+ });
43
+ });
44
+ process.env.NODE_ENV !== "production" && (g.displayName = "MenuItem");
45
+ export {
46
+ g as MenuItem
47
+ };
@@ -0,0 +1,50 @@
1
+ import * as t from "react";
2
+ import { useMergedRefs as b } from "../../../../utils/esm/useMergedRefs.js";
3
+ import { useMenuItemCommonProps as I } from "./useMenuItemCommonProps.js";
4
+ import { useButton as P } from "../../use-button/useButton.js";
5
+ import { mergeProps as h } from "../../merge-props/mergeProps.js";
6
+ const E = {
7
+ type: "regular-item"
8
+ };
9
+ function k(i) {
10
+ const {
11
+ closeOnClick: c,
12
+ disabled: f = !1,
13
+ highlighted: p,
14
+ id: a,
15
+ store: o,
16
+ typingRef: g = o.context.typingRef,
17
+ nativeButton: l,
18
+ itemMetadata: e,
19
+ nodeId: R
20
+ } = i, r = t.useRef(null), {
21
+ getButtonProps: n,
22
+ buttonRef: d
23
+ } = P({
24
+ disabled: f,
25
+ focusableWhenDisabled: !0,
26
+ native: l,
27
+ composite: !0
28
+ }), s = I({
29
+ closeOnClick: c,
30
+ highlighted: p,
31
+ id: a,
32
+ nodeId: R,
33
+ store: o,
34
+ typingRef: g,
35
+ itemRef: r,
36
+ itemMetadata: e
37
+ }), m = t.useCallback((M) => h(s, {
38
+ onMouseEnter() {
39
+ e.type === "submenu-trigger" && e.setActive();
40
+ }
41
+ }, M, n), [s, n, e]), u = b(r, d);
42
+ return t.useMemo(() => ({
43
+ getItemProps: m,
44
+ itemRef: u
45
+ }), [m, u]);
46
+ }
47
+ export {
48
+ E as REGULAR_ITEM,
49
+ k as useMenuItem
50
+ };