@ledgerhq/lumen-ui-react 0.1.35 → 0.1.37
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/index.js +108 -109
- package/dist/lib/Components/AmountDisplay/AmountDisplay.d.ts +1 -1
- package/dist/lib/Components/AmountDisplay/AmountDisplay.d.ts.map +1 -1
- package/dist/lib/Components/AmountDisplay/AmountDisplay.js +117 -78
- package/dist/lib/Components/AmountDisplay/index.d.ts +1 -1
- package/dist/lib/Components/AmountDisplay/index.d.ts.map +1 -1
- package/dist/lib/Components/AmountDisplay/types.d.ts +16 -3
- package/dist/lib/Components/AmountDisplay/types.d.ts.map +1 -1
- package/dist/lib/Components/AmountInput/AmountInput.d.ts +1 -1
- package/dist/lib/Components/AmountInput/AmountInput.d.ts.map +1 -1
- package/dist/lib/Components/AmountInput/AmountInput.js +127 -77
- package/dist/lib/Components/AmountInput/types.d.ts +12 -0
- package/dist/lib/Components/AmountInput/types.d.ts.map +1 -1
- package/dist/lib/Components/Avatar/Avatar.d.ts +1 -1
- package/dist/lib/Components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/lib/Components/Avatar/Avatar.js +47 -60
- package/dist/lib/Components/Button/BaseButton.d.ts +2 -2
- package/dist/lib/Components/Button/Button.js +10 -10
- package/dist/lib/Components/Card/Card.js +12 -12
- package/dist/lib/Components/DataTable/DataTable.js +2 -2
- package/dist/lib/Components/Divider/Divider.js +4 -4
- package/dist/lib/Components/DotCount/DotCount.js +4 -4
- package/dist/lib/Components/DotIcon/DotIcon.d.ts +3 -2
- package/dist/lib/Components/DotIcon/DotIcon.d.ts.map +1 -1
- package/dist/lib/Components/DotIcon/DotIcon.js +55 -40
- package/dist/lib/Components/DotIcon/types.d.ts +7 -1
- package/dist/lib/Components/DotIcon/types.d.ts.map +1 -1
- package/dist/lib/Components/DotIndicator/DotIndicator.js +14 -14
- package/dist/lib/Components/DotIndicator/types.d.ts +2 -2
- package/dist/lib/Components/DotSymbol/DotSymbol.d.ts +1 -1
- package/dist/lib/Components/DotSymbol/DotSymbol.d.ts.map +1 -1
- package/dist/lib/Components/DotSymbol/DotSymbol.js +50 -35
- package/dist/lib/Components/DotSymbol/types.d.ts +7 -1
- package/dist/lib/Components/DotSymbol/types.d.ts.map +1 -1
- package/dist/lib/Components/Icon/Icon.js +4 -4
- package/dist/lib/Components/Icon/createIcon.js +4 -4
- package/dist/lib/Components/InteractiveIcon/InteractiveIcon.js +4 -4
- package/dist/lib/Components/Link/Link.js +6 -6
- package/dist/lib/Components/ListItem/ListItem.js +3 -3
- package/dist/lib/Components/MediaButton/MediaButton.d.ts +3 -3
- package/dist/lib/Components/MediaButton/MediaButton.d.ts.map +1 -1
- package/dist/lib/Components/MediaButton/MediaButton.js +44 -42
- package/dist/lib/Components/MediaButton/types.d.ts +5 -5
- package/dist/lib/Components/MediaButton/types.d.ts.map +1 -1
- package/dist/lib/Components/MediaImage/MediaImage.d.ts +1 -1
- package/dist/lib/Components/MediaImage/MediaImage.d.ts.map +1 -1
- package/dist/lib/Components/MediaImage/MediaImage.js +45 -32
- package/dist/lib/Components/MediaImage/types.d.ts +7 -1
- package/dist/lib/Components/MediaImage/types.d.ts.map +1 -1
- package/dist/lib/Components/Menu/Menu.d.ts +11 -16
- package/dist/lib/Components/Menu/Menu.d.ts.map +1 -1
- package/dist/lib/Components/Menu/Menu.js +186 -125
- package/dist/lib/Components/Menu/types.d.ts +50 -145
- package/dist/lib/Components/Menu/types.d.ts.map +1 -1
- package/dist/lib/Components/NavBar/CoinCapsule.d.ts +2 -2
- package/dist/lib/Components/NavBar/CoinCapsule.d.ts.map +1 -1
- package/dist/lib/Components/NavBar/CoinCapsule.js +1 -1
- package/dist/lib/Components/NavBar/NavBar.d.ts +4 -4
- package/dist/lib/Components/NavBar/NavBar.d.ts.map +1 -1
- package/dist/lib/Components/NavBar/NavBar.js +34 -26
- package/dist/lib/Components/NavBar/types.d.ts +2 -2
- package/dist/lib/Components/NavBar/types.d.ts.map +1 -1
- package/dist/lib/Components/Popover/Popover.d.ts +2 -2
- package/dist/lib/Components/Popover/Popover.js +6 -6
- package/dist/lib/Components/Popover/types.d.ts +6 -3
- package/dist/lib/Components/Popover/types.d.ts.map +1 -1
- package/dist/lib/Components/SideBar/SideBar.js +9 -9
- package/dist/lib/Components/Skeleton/Skeleton.js +4 -4
- package/dist/lib/Components/Table/Table.js +1 -1
- package/dist/lib/Components/Table/utils/useThrottledScrollBottom.js +3 -3
- package/dist/lib/Symbols/Icons/Lightbulb.js +3 -3
- package/dist/libs/utils-shared/dist/index.js +107 -107
- package/dist/node_modules/@base-ui/react/esm/composite/item/CompositeItem.js +30 -0
- package/dist/node_modules/@base-ui/react/esm/composite/item/useCompositeItem.js +34 -0
- package/dist/node_modules/@base-ui/react/esm/context-menu/root/ContextMenuRootContext.js +14 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingFocusManager.js +10 -10
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFocus.js +97 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverFloatingInteraction.js +10 -10
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverReferenceInteraction.js +2 -2
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/utils/element.js +31 -20
- package/dist/node_modules/@base-ui/react/esm/menu/checkbox-item/MenuCheckboxItem.js +78 -0
- package/dist/node_modules/@base-ui/react/esm/menu/checkbox-item/MenuCheckboxItemContext.js +14 -0
- package/dist/node_modules/@base-ui/react/esm/menu/checkbox-item/MenuCheckboxItemDataAttributes.js +6 -0
- package/dist/node_modules/@base-ui/react/esm/menu/checkbox-item-indicator/MenuCheckboxItemIndicator.js +44 -0
- package/dist/node_modules/@base-ui/react/esm/menu/group/MenuGroup.js +28 -0
- package/dist/node_modules/@base-ui/react/esm/menu/group/MenuGroupContext.js +14 -0
- package/dist/node_modules/@base-ui/react/esm/menu/group-label/MenuGroupLabel.js +29 -0
- package/dist/node_modules/@base-ui/react/esm/menu/item/MenuItem.js +47 -0
- package/dist/node_modules/@base-ui/react/esm/menu/item/useMenuItem.js +50 -0
- package/dist/node_modules/@base-ui/react/esm/menu/item/useMenuItemCommonProps.js +49 -0
- package/dist/node_modules/@base-ui/react/esm/menu/popup/MenuPopup.js +89 -0
- package/dist/node_modules/@base-ui/react/esm/menu/portal/MenuPortal.js +24 -0
- package/dist/node_modules/@base-ui/react/esm/menu/portal/MenuPortalContext.js +14 -0
- package/dist/node_modules/@base-ui/react/esm/menu/positioner/MenuPositioner.js +174 -0
- package/dist/node_modules/@base-ui/react/esm/menu/positioner/MenuPositionerContext.js +14 -0
- package/dist/node_modules/@base-ui/react/esm/menu/radio-group/MenuRadioGroup.js +45 -0
- package/dist/node_modules/@base-ui/react/esm/menu/radio-group/MenuRadioGroupContext.js +14 -0
- package/dist/node_modules/@base-ui/react/esm/menu/radio-item/MenuRadioItem.js +75 -0
- package/dist/node_modules/@base-ui/react/esm/menu/radio-item/MenuRadioItemContext.js +14 -0
- package/dist/node_modules/@base-ui/react/esm/menu/radio-item-indicator/MenuRadioItemIndicator.js +44 -0
- package/dist/node_modules/@base-ui/react/esm/menu/root/MenuRoot.js +271 -0
- package/dist/node_modules/@base-ui/react/esm/menu/root/MenuRootContext.js +14 -0
- package/dist/node_modules/@base-ui/react/esm/menu/store/MenuStore.js +109 -0
- package/dist/node_modules/@base-ui/react/esm/menu/submenu-root/MenuSubmenuRoot.js +21 -0
- package/dist/node_modules/@base-ui/react/esm/menu/submenu-root/MenuSubmenuRootContext.js +10 -0
- package/dist/node_modules/@base-ui/react/esm/menu/submenu-trigger/MenuSubmenuTrigger.js +101 -0
- package/dist/node_modules/@base-ui/react/esm/menu/trigger/MenuTrigger.js +207 -0
- package/dist/node_modules/@base-ui/react/esm/menu/utils/findRootOwnerId.js +10 -0
- package/dist/node_modules/@base-ui/react/esm/menu/utils/stateAttributesMapping.js +15 -0
- package/dist/node_modules/@base-ui/react/esm/menubar/MenubarContext.js +10 -0
- package/dist/node_modules/@base-ui/react/esm/popover/root/PopoverRoot.js +11 -11
- package/dist/node_modules/@base-ui/react/esm/popover/store/PopoverStore.js +7 -7
- package/dist/node_modules/@base-ui/react/esm/popover/trigger/PopoverTrigger.js +11 -11
- package/dist/node_modules/@base-ui/react/esm/utils/constants.js +11 -10
- package/dist/node_modules/@base-ui/react/esm/utils/reason-parts.js +11 -8
- package/dist/node_modules/@base-ui/react/esm/utils/useMixedToggleClickHandler.js +25 -0
- package/dist/node_modules/@base-ui/utils/esm/detectBrowser.js +7 -8
- package/dist/node_modules/@base-ui/utils/esm/fastHooks.js +43 -0
- package/dist/node_modules/@base-ui/utils/esm/store/useStore.js +54 -13
- package/dist/package.json +4 -5
- package/package.json +4 -5
|
@@ -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
|
+
};
|
package/dist/node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverFloatingInteraction.js
CHANGED
|
@@ -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,
|
|
10
|
-
import {
|
|
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(() =>
|
|
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) =>
|
|
24
|
-
const s =
|
|
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
|
-
|
|
29
|
+
$(e);
|
|
30
30
|
}), v = d((t) => {
|
|
31
|
-
const s =
|
|
32
|
-
if (
|
|
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
|
|
45
|
+
return W(e, {
|
|
46
46
|
scopeElement: l,
|
|
47
47
|
referenceElement: t,
|
|
48
48
|
floatingElement: s
|
package/dist/node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverReferenceInteraction.js
CHANGED
|
@@ -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 {
|
|
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 {
|
|
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
|
|
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
|
|
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 (
|
|
33
|
+
if (f(n, r))
|
|
33
34
|
return !n.hasAttribute("data-trigger-disabled");
|
|
34
35
|
return !1;
|
|
35
36
|
}
|
|
36
|
-
function
|
|
37
|
+
function E(t) {
|
|
37
38
|
return "composedPath" in t ? t.composedPath()[0] : t.target;
|
|
38
39
|
}
|
|
39
|
-
function
|
|
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
|
|
48
|
+
function p(t) {
|
|
48
49
|
return t.matches("html,body");
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
-
return u(t) && t.matches(
|
|
51
|
+
function l(t) {
|
|
52
|
+
return u(t) && t.matches(c);
|
|
52
53
|
}
|
|
53
|
-
function
|
|
54
|
-
return t ? t.getAttribute("role") === "combobox" &&
|
|
54
|
+
function A(t) {
|
|
55
|
+
return t ? t.getAttribute("role") === "combobox" && l(t) : !1;
|
|
55
56
|
}
|
|
56
|
-
function
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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,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
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as p from "react";
|
|
2
|
+
import { isMac as C } from "../../../../utils/esm/detectBrowser.js";
|
|
3
|
+
import { useContextMenuRootContext as d } from "../../context-menu/root/ContextMenuRootContext.js";
|
|
4
|
+
import { itemPress as g } from "../../utils/reason-parts.js";
|
|
5
|
+
function b(M) {
|
|
6
|
+
const {
|
|
7
|
+
closeOnClick: m,
|
|
8
|
+
highlighted: a,
|
|
9
|
+
id: f,
|
|
10
|
+
nodeId: n,
|
|
11
|
+
store: r,
|
|
12
|
+
typingRef: l,
|
|
13
|
+
itemRef: i,
|
|
14
|
+
itemMetadata: u
|
|
15
|
+
} = M, {
|
|
16
|
+
events: s
|
|
17
|
+
} = r.useState("floatingTreeRoot"), e = d(!0), o = e !== void 0;
|
|
18
|
+
return p.useMemo(() => ({
|
|
19
|
+
id: f,
|
|
20
|
+
role: "menuitem",
|
|
21
|
+
tabIndex: a ? 0 : -1,
|
|
22
|
+
onKeyDown(t) {
|
|
23
|
+
t.key === " " && l?.current && t.preventDefault();
|
|
24
|
+
},
|
|
25
|
+
onMouseMove(t) {
|
|
26
|
+
n && s.emit("itemhover", {
|
|
27
|
+
nodeId: n,
|
|
28
|
+
target: t.currentTarget
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
onClick(t) {
|
|
32
|
+
m && s.emit("close", {
|
|
33
|
+
domEvent: t,
|
|
34
|
+
reason: g
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
onMouseUp(t) {
|
|
38
|
+
if (e) {
|
|
39
|
+
const c = e.initialCursorPointRef.current;
|
|
40
|
+
if (e.initialCursorPointRef.current = null, o && c && Math.abs(t.clientX - c.x) <= 1 && Math.abs(t.clientY - c.y) <= 1 || o && !C && t.button === 2)
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
i.current && r.context.allowMouseUpTriggerRef.current && (!o || t.button === 2) && (!u || u.type === "regular-item") && i.current.click();
|
|
44
|
+
}
|
|
45
|
+
}), [m, a, f, s, n, r, l, i, e, o, u]);
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
b as useMenuItemCommonProps
|
|
49
|
+
};
|