@kommo-crm/crm-react-ui-kit 1.3.0-beta.1 → 1.3.0-beta.3
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/ContextMenu-CeyT26LX.mjs +229 -0
- package/dist/components/ContextMenu/ContextMenu.d.ts +2 -2
- package/dist/components/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/components/ContextMenu/ContextMenu.js +5 -5
- package/dist/components/ContextMenu/ContextMenu.props.d.ts +19 -3
- package/dist/components/ContextMenu/ContextMenu.props.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/CheckboxItem/CheckboxItem.js +1 -1
- package/dist/components/ContextMenu/components/Content/Content.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/Content/Content.js +1 -1
- package/dist/components/ContextMenu/components/Content/index.js +1 -1
- package/dist/components/ContextMenu/components/Item/Item.js +1 -1
- package/dist/components/ContextMenu/components/Label/Label.js +1 -1
- package/dist/components/ContextMenu/components/RadioItem/RadioItem.js +1 -1
- package/dist/components/ContextMenu/components/Sub/Sub.js +1 -1
- package/dist/components/ContextMenu/components/Sub/Sub.props.d.ts +3 -3
- package/dist/components/ContextMenu/components/Sub/Sub.props.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/Sub/hooks/useContextMenuSub/useContextMenuSub.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/Sub/hooks/useContextMenuSub/useContextMenuSub.js +80 -88
- package/dist/components/ContextMenu/components/Sub/hooks/useContextMenuSub/useContextMenuSub.types.d.ts +2 -2
- package/dist/components/ContextMenu/components/Sub/hooks/useContextMenuSub/useContextMenuSub.types.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/Sub/index.js +1 -1
- package/dist/components/ContextMenu/components/SubContent/SubContent.js +1 -1
- package/dist/components/ContextMenu/components/SubRoot/components/Content/Content.js +1 -1
- package/dist/components/ContextMenu/components/SubRoot/components/Trigger/Trigger.js +1 -1
- package/dist/components/ContextMenu/components/SubRoot/hooks/useContextMenuSubMenu/useContextMenuSubMenu.js +1 -1
- package/dist/components/ContextMenu/components/SubTrigger/SubTrigger.js +1 -1
- package/dist/components/ContextMenu/hooks/index.js +1 -1
- package/dist/components/ContextMenu/hooks/useContentPositioning/useContentPositioning.d.ts.map +1 -1
- package/dist/components/ContextMenu/hooks/useContentPositioning/useContentPositioning.js +1 -1
- package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.d.ts.map +1 -1
- package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.js +142 -133
- package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.types.d.ts +14 -2
- package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.types.d.ts.map +1 -1
- package/dist/components/ContextMenu/hooks/useContextMenu/utils/contextMenuBus/contextMenuBus.d.ts +3 -1
- package/dist/components/ContextMenu/hooks/useContextMenu/utils/contextMenuBus/contextMenuBus.d.ts.map +1 -1
- package/dist/components/ContextMenu/hooks/useContextMenu/utils/contextMenuBus/contextMenuBus.js +16 -10
- package/dist/components/ContextMenu/hooks/useContextMenu/utils/contextMenuBus/contextMenuBus.types.d.ts +4 -0
- package/dist/components/ContextMenu/hooks/useContextMenu/utils/contextMenuBus/contextMenuBus.types.d.ts.map +1 -1
- package/dist/components/ContextMenu/hooks/useContextMenuItemFocus/useContextMenuItemFocus.d.ts.map +1 -1
- package/dist/components/ContextMenu/hooks/useContextMenuItemFocus/useContextMenuItemFocus.js +47 -42
- package/dist/components/ContextMenu/index.js +1 -1
- package/dist/components/List/List.js +1 -1
- package/dist/components/Select/components/List/List.js +1 -1
- package/dist/index-DBS3EIVR.mjs +273 -0
- package/dist/{useContentPositioning-DfyirIME.mjs → useContentPositioning-Dfjbylz5.mjs} +456 -451
- package/package.json +3 -3
- package/dist/ContextMenu-BUiakpJf.mjs +0 -223
- package/dist/index-BH2CXQ4d.mjs +0 -257
|
@@ -1,164 +1,173 @@
|
|
|
1
|
-
import { useId as
|
|
2
|
-
import { a as
|
|
3
|
-
import { useFocusChange as
|
|
1
|
+
import { useId as Ce, useState as a, useRef as o, useEffect as E } from "react";
|
|
2
|
+
import { a as pe, b as Re } from "../../../../index-DBS3EIVR.mjs";
|
|
3
|
+
import { useFocusChange as Ie } from "../../../../hooks/useFocusChange/useFocusChange.js";
|
|
4
|
+
import { noop as ge } from "../../../../utils/noop/noop.js";
|
|
4
5
|
import { ContextMenuMode as i } from "../../ContextMenu.enums.js";
|
|
5
|
-
import { contextMenuBus as
|
|
6
|
-
const
|
|
6
|
+
import { contextMenuBus as h } from "./utils/contextMenuBus/contextMenuBus.js";
|
|
7
|
+
const De = (X) => {
|
|
7
8
|
const {
|
|
8
|
-
mode:
|
|
9
|
-
defaultOpen:
|
|
10
|
-
animationDuration:
|
|
11
|
-
hoverCloseDelay:
|
|
12
|
-
isOpen:
|
|
13
|
-
onOpen:
|
|
14
|
-
onAnimatedOpen:
|
|
15
|
-
onAiming:
|
|
16
|
-
onFocusOutside:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} =
|
|
20
|
-
|
|
21
|
-
), [
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
9
|
+
mode: Y,
|
|
10
|
+
defaultOpen: x,
|
|
11
|
+
animationDuration: C,
|
|
12
|
+
hoverCloseDelay: H,
|
|
13
|
+
isOpen: R,
|
|
14
|
+
onOpen: s,
|
|
15
|
+
onAnimatedOpen: V,
|
|
16
|
+
onAiming: B,
|
|
17
|
+
onFocusOutside: Z,
|
|
18
|
+
aimingTolerance: _,
|
|
19
|
+
aimingIdleTimeout: $
|
|
20
|
+
} = X, I = Ce(), [l, y] = a(
|
|
21
|
+
R ?? x ?? !1
|
|
22
|
+
), [D, f] = a(!1), [ee, q] = a(!1), [K, g] = a(!1), [W, L] = a(!1), [j, te] = a(!1), [ne, re] = a(null), [se, A] = a(!1), [w, ue] = a(null), d = o(!1), z = o(null), n = o(null), c = o(null), P = o(!1), r = o(!1), T = o(null), O = o(!1), S = o(!1), G = o(ge), M = o(Z), u = pe() ? i.CLICK : Y, b = () => {
|
|
23
|
+
n.current && (clearTimeout(n.current), n.current = null), c.current && (clearTimeout(c.current), c.current = null), T.current && (clearTimeout(T.current), T.current = null);
|
|
24
|
+
}, m = () => {
|
|
25
|
+
b(), r.current = !1, y(!1), s == null || s(!1), g(!1), d.current = !1, A(!1);
|
|
26
|
+
}, ce = (e) => {
|
|
27
|
+
B == null || B(e), h.emitAimingChange(e), !e && r.current && !d.current && !O.current && (r.current = !1, f(!1), c.current = setTimeout(() => {
|
|
28
|
+
m();
|
|
29
|
+
}, C));
|
|
30
|
+
}, { isAiming: v, ref: F } = Re({
|
|
31
|
+
isEnabled: l && u === i.HOVER,
|
|
32
|
+
onChange: ce,
|
|
33
|
+
tolerance: _,
|
|
34
|
+
idleTimeout: $
|
|
35
|
+
}), oe = () => O.current, ie = (e) => {
|
|
36
|
+
O.current = e, !e && r.current && !d.current && !v() && (r.current = !1, f(!1), c.current = setTimeout(() => {
|
|
37
|
+
m();
|
|
38
|
+
}, C));
|
|
39
|
+
}, J = () => {
|
|
40
|
+
if (b(), q(!1), u === i.HOVER) {
|
|
41
|
+
if (j && ne === i.CLICK || w !== null)
|
|
33
42
|
return;
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
},
|
|
43
|
+
if (K) {
|
|
44
|
+
f(!1), c.current = setTimeout(() => {
|
|
45
|
+
m();
|
|
46
|
+
}, C);
|
|
38
47
|
return;
|
|
39
48
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
b() || (f(), l.current = !1, u(!1), o.current = setTimeout(() => {
|
|
46
|
-
E();
|
|
47
|
-
}, O));
|
|
48
|
-
}, 50));
|
|
49
|
+
r.current = !0, !v() && !O.current && (r.current = !1, f(!1), c.current = setTimeout(() => {
|
|
50
|
+
m();
|
|
51
|
+
}, C));
|
|
49
52
|
} else
|
|
50
|
-
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
+
m();
|
|
54
|
+
}, k = ({
|
|
55
|
+
preventFocusRestore: e = !1,
|
|
56
|
+
skipAnimationFlag: t = !1
|
|
57
|
+
}) => {
|
|
58
|
+
P.current = e, b(), r.current = !1, q(t), f(!1), y(!1), s == null || s(!1), g(!1), d.current = !1, A(!1);
|
|
53
59
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
E(() => {
|
|
61
|
+
l || (P.current = !1);
|
|
62
|
+
}, [l]);
|
|
63
|
+
const le = (e) => {
|
|
64
|
+
A(e);
|
|
65
|
+
}, N = (e) => {
|
|
66
|
+
if (!(u === i.CLICK && x !== void 0)) {
|
|
67
|
+
if (e) {
|
|
68
|
+
c.current && (clearTimeout(c.current), c.current = null), r.current && (b(), r.current = !1), u === i.HOVER && f(!0), y(!0), s == null || s(!0), R !== !1 && h.emit({
|
|
69
|
+
id: I,
|
|
70
|
+
isAiming: v
|
|
71
|
+
});
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
u === i.HOVER ? J() : m();
|
|
62
75
|
}
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
id:
|
|
70
|
-
isAiming:
|
|
71
|
-
});
|
|
72
|
-
}, 0)) : W());
|
|
73
|
-
}, te = (e) => {
|
|
74
|
-
H(e), j(e);
|
|
75
|
-
}, ne = () => {
|
|
76
|
-
var e, n;
|
|
77
|
-
c !== i.HOVER || (n = (e = v).isAiming) != null && n.call(e) && v.activeMenuId !== T || (H(!1), f(), l.current = !1, s ? (p(!0), C.current = !0, u(!0)) : (t.current && (clearTimeout(t.current), t.current = null), u(!0), R(!0), r == null || r(!0), p(!0), C.current = !0, setTimeout(() => {
|
|
78
|
-
I !== !1 && v.emit({
|
|
79
|
-
id: T,
|
|
80
|
-
isAiming: b
|
|
76
|
+
}, fe = (e) => {
|
|
77
|
+
L(e), N(e);
|
|
78
|
+
}, Q = () => {
|
|
79
|
+
var e, t;
|
|
80
|
+
S.current = !0, !(u !== i.HOVER || (t = (e = h).isAiming) != null && t.call(e) && h.activeMenuId !== I) && (L(!1), b(), r.current = !1, l ? (g(!0), d.current = !0, f(!0)) : (n.current && (clearTimeout(n.current), n.current = null), f(!0), y(!0), s == null || s(!0), g(!0), d.current = !0, T.current = setTimeout(() => {
|
|
81
|
+
T.current = null, R !== !1 && h.emit({
|
|
82
|
+
id: I,
|
|
83
|
+
isAiming: v
|
|
81
84
|
});
|
|
82
85
|
}, 0)));
|
|
83
|
-
}, re = () => {
|
|
84
|
-
c === i.HOVER && (H(!1), p(!1), C.current = !1, t.current && (clearTimeout(t.current), t.current = null), l.current && !m.current && (m.current = setInterval(() => {
|
|
85
|
-
if (C.current) {
|
|
86
|
-
f(), l.current = !1, u(!0);
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
b() || (f(), l.current = !1, u(!1), o.current = setTimeout(() => {
|
|
90
|
-
E();
|
|
91
|
-
}, O));
|
|
92
|
-
}, 50)));
|
|
93
|
-
}, se = (e, n) => {
|
|
94
|
-
e || K(!1), X(e), Z(n);
|
|
95
86
|
};
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
|
|
87
|
+
G.current = Q;
|
|
88
|
+
const ae = () => {
|
|
89
|
+
S.current = !1, u === i.HOVER && (L(!1), g(!1), d.current = !1, n.current && (clearTimeout(n.current), n.current = null), r.current && !v() && !O.current && (r.current = !1, f(!1), c.current = setTimeout(() => {
|
|
90
|
+
m();
|
|
91
|
+
}, C)));
|
|
92
|
+
}, de = (e, t) => {
|
|
93
|
+
e || A(!1), te(e), re(t);
|
|
94
|
+
};
|
|
95
|
+
E(() => R === !1 ? void 0 : h.subscribe(({ id: t }) => {
|
|
96
|
+
t !== I && k({
|
|
97
|
+
preventFocusRestore: !0,
|
|
98
|
+
skipAnimationFlag: !0
|
|
99
|
+
});
|
|
100
|
+
}), [I, R]), E(() => u !== i.HOVER ? void 0 : h.subscribeAimingChange((t) => {
|
|
101
|
+
!t && S.current && G.current();
|
|
102
|
+
}), [u]), E(() => {
|
|
103
|
+
!l || u !== i.HOVER || W || (K ? n.current && (clearTimeout(n.current), n.current = null) : n.current || (n.current = setTimeout(() => {
|
|
104
|
+
J();
|
|
105
|
+
}, H)));
|
|
106
|
+
}, [u, l, K, H, W]), E(() => {
|
|
107
|
+
V == null || V(D);
|
|
108
|
+
}, [D]);
|
|
109
|
+
const me = () => {
|
|
106
110
|
const e = [];
|
|
107
|
-
|
|
108
|
-
const
|
|
111
|
+
F.current && e.push(F.current);
|
|
112
|
+
const t = Array.from(
|
|
109
113
|
document.querySelectorAll("[data-menu-level]")
|
|
110
114
|
);
|
|
111
|
-
return e.push(...
|
|
115
|
+
return e.push(...t), e;
|
|
112
116
|
};
|
|
113
|
-
return
|
|
114
|
-
elements:
|
|
115
|
-
enabled:
|
|
117
|
+
return Ie({
|
|
118
|
+
elements: l ? [F, z] : [],
|
|
119
|
+
enabled: l,
|
|
116
120
|
onFocusOutside: (e) => {
|
|
117
|
-
var
|
|
118
|
-
const
|
|
119
|
-
if (!
|
|
121
|
+
var U;
|
|
122
|
+
const t = e.target;
|
|
123
|
+
if (!l || t === document.body)
|
|
120
124
|
return;
|
|
121
|
-
if (!
|
|
122
|
-
let
|
|
123
|
-
const
|
|
124
|
-
target:
|
|
125
|
+
if (!me().some((p) => t ? p === t || p.contains(t) : !1)) {
|
|
126
|
+
let p = !1;
|
|
127
|
+
const he = {
|
|
128
|
+
target: t,
|
|
125
129
|
preventDefault: () => {
|
|
126
|
-
|
|
130
|
+
p = !0;
|
|
127
131
|
},
|
|
128
132
|
get defaultPrevented() {
|
|
129
|
-
return
|
|
133
|
+
return p;
|
|
130
134
|
}
|
|
131
135
|
};
|
|
132
|
-
if ((
|
|
136
|
+
if ((U = M.current) == null || U.call(M, he), p)
|
|
133
137
|
return;
|
|
134
|
-
|
|
138
|
+
k({ preventFocusRestore: !0 });
|
|
135
139
|
}
|
|
136
140
|
}
|
|
137
141
|
}), {
|
|
138
|
-
isOpen:
|
|
139
|
-
mode:
|
|
140
|
-
onOpenChange:
|
|
141
|
-
onOpenByKeyboard:
|
|
142
|
-
triggerRef:
|
|
143
|
-
contentRef:
|
|
144
|
-
isAnimatedOpen:
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
142
|
+
isOpen: l,
|
|
143
|
+
mode: u,
|
|
144
|
+
onOpenChange: N,
|
|
145
|
+
onOpenByKeyboard: fe,
|
|
146
|
+
triggerRef: z,
|
|
147
|
+
contentRef: F,
|
|
148
|
+
isAnimatedOpen: D,
|
|
149
|
+
skipAnimation: ee,
|
|
150
|
+
animationDuration: C,
|
|
151
|
+
hoverCloseDelay: H,
|
|
152
|
+
closeMenuImmediately: (e) => {
|
|
153
|
+
k({ preventFocusRestore: e });
|
|
154
|
+
},
|
|
155
|
+
onContentEnter: Q,
|
|
156
|
+
onContentLeave: ae,
|
|
157
|
+
onChildOpen: de,
|
|
158
|
+
onSubmenuOpen: le,
|
|
159
|
+
isRootContentBlocked: se,
|
|
160
|
+
isChildOpen: j,
|
|
161
|
+
itemWithFocusedInput: w,
|
|
162
|
+
setItemWithFocusedInput: ue,
|
|
163
|
+
shouldPreventFocusRestore: () => P.current,
|
|
157
164
|
setOnFocusOutside: (e) => {
|
|
158
|
-
|
|
159
|
-
}
|
|
165
|
+
M.current = e;
|
|
166
|
+
},
|
|
167
|
+
isChildAiming: oe,
|
|
168
|
+
onChildAiming: ie
|
|
160
169
|
};
|
|
161
170
|
};
|
|
162
171
|
export {
|
|
163
|
-
|
|
172
|
+
De as useContextMenu
|
|
164
173
|
};
|
|
@@ -50,12 +50,12 @@ export interface UseContextMenuOptions {
|
|
|
50
50
|
* Tolerance in pixels for detecting cursor movement toward the menu.
|
|
51
51
|
* Higher values make the detection more lenient.
|
|
52
52
|
*/
|
|
53
|
-
|
|
53
|
+
aimingTolerance: number;
|
|
54
54
|
/**
|
|
55
55
|
* Timeout in milliseconds before considering cursor movement as idle.
|
|
56
56
|
* Used to reset aiming state when cursor stops moving.
|
|
57
57
|
*/
|
|
58
|
-
|
|
58
|
+
aimingIdleTimeout: number;
|
|
59
59
|
}
|
|
60
60
|
export interface UseContextMenuResult {
|
|
61
61
|
/**
|
|
@@ -86,6 +86,10 @@ export interface UseContextMenuResult {
|
|
|
86
86
|
* Whether the context menu is animated open.
|
|
87
87
|
*/
|
|
88
88
|
isAnimatedOpen: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Whether to skip animation when closing.
|
|
91
|
+
*/
|
|
92
|
+
skipAnimation: boolean;
|
|
89
93
|
/**
|
|
90
94
|
* The duration of the animation.
|
|
91
95
|
*/
|
|
@@ -138,5 +142,13 @@ export interface UseContextMenuResult {
|
|
|
138
142
|
* Sets the callback for when focus moves outside the menu.
|
|
139
143
|
*/
|
|
140
144
|
setOnFocusOutside: (callback: ((event: FocusChangeEvent) => void) | undefined) => void;
|
|
145
|
+
/**
|
|
146
|
+
* Returns whether any child submenu is being aimed at.
|
|
147
|
+
*/
|
|
148
|
+
isChildAiming: () => boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Called when a child submenu's aiming state changes.
|
|
151
|
+
*/
|
|
152
|
+
onChildAiming: (aiming: boolean) => void;
|
|
141
153
|
}
|
|
142
154
|
//# sourceMappingURL=useContextMenu.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useContextMenu.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/hooks/useContextMenu/useContextMenu.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,IAAI,EAAE,eAAe,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACjC;;OAEG;IACH,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACnD;;;OAGG;IACH,
|
|
1
|
+
{"version":3,"file":"useContextMenu.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/hooks/useContextMenu/useContextMenu.types.ts"],"names":[],"mappings":"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"}
|
package/dist/components/ContextMenu/hooks/useContextMenu/utils/contextMenuBus/contextMenuBus.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { ContextMenuBusCallback, ContextMenuBusPayload } from './contextMenuBus.types';
|
|
1
|
+
import { ContextMenuBusCallback, ContextMenuBusPayload, ContextMenuBusAimingChangeCallback } from './contextMenuBus.types';
|
|
2
2
|
export declare const contextMenuBus: {
|
|
3
3
|
emit: (payload: ContextMenuBusPayload) => void;
|
|
4
|
+
emitAimingChange: (aiming: boolean) => void;
|
|
4
5
|
subscribe: (cb: ContextMenuBusCallback) => (() => void);
|
|
6
|
+
subscribeAimingChange: (cb: ContextMenuBusAimingChangeCallback) => (() => void);
|
|
5
7
|
readonly isAiming: (() => boolean) | null;
|
|
6
8
|
readonly activeMenuId: string | null;
|
|
7
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contextMenuBus.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/ContextMenu/hooks/useContextMenu/utils/contextMenuBus/contextMenuBus.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"contextMenuBus.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/ContextMenu/hooks/useContextMenu/utils/contextMenuBus/contextMenuBus.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,kCAAkC,EACnC,MAAM,wBAAwB,CAAC;AAuDhC,eAAO,MAAM,cAAc;oBAtCJ,qBAAqB,KAAG,IAAI;+BAUjB,OAAO,KAAG,IAAI;oBAOzB,sBAAsB,KAAG,CAAC,MAAM,IAAI,CAAC;gCAYtD,kCAAkC,KACrC,CAAC,MAAM,IAAI,CAAC;8BApCM,OAAO;;CAuD3B,CAAC"}
|
package/dist/components/ContextMenu/hooks/useContextMenu/utils/contextMenuBus/contextMenuBus.js
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
|
-
let t = [],
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
},
|
|
1
|
+
let n = [], t = [], s = null, r = null;
|
|
2
|
+
const u = (e) => {
|
|
3
|
+
n.forEach((i) => i(e)), s = e.isAiming, r = e.id;
|
|
4
|
+
}, g = (e) => {
|
|
5
|
+
t.forEach((i) => i(e));
|
|
6
|
+
}, c = (e) => (n.push(e), () => {
|
|
7
|
+
n = n.filter((i) => i !== e);
|
|
8
|
+
}), l = (e) => (t.push(e), () => {
|
|
5
9
|
t = t.filter((i) => i !== e);
|
|
6
|
-
}),
|
|
7
|
-
emit:
|
|
8
|
-
|
|
10
|
+
}), m = {
|
|
11
|
+
emit: u,
|
|
12
|
+
emitAimingChange: g,
|
|
13
|
+
subscribe: c,
|
|
14
|
+
subscribeAimingChange: l,
|
|
9
15
|
get isAiming() {
|
|
10
|
-
return
|
|
16
|
+
return s;
|
|
11
17
|
},
|
|
12
18
|
get activeMenuId() {
|
|
13
|
-
return
|
|
19
|
+
return r;
|
|
14
20
|
}
|
|
15
21
|
};
|
|
16
22
|
export {
|
|
17
|
-
|
|
23
|
+
m as contextMenuBus
|
|
18
24
|
};
|
|
@@ -16,4 +16,8 @@ export type ContextMenuBusPayload = {
|
|
|
16
16
|
* Callback function for context menu bus subscribers.
|
|
17
17
|
*/
|
|
18
18
|
export type ContextMenuBusCallback = (payload: ContextMenuBusPayload) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Callback function for aiming state change subscribers.
|
|
21
|
+
*/
|
|
22
|
+
export type ContextMenuBusAimingChangeCallback = (aiming: boolean) => void;
|
|
19
23
|
//# sourceMappingURL=contextMenuBus.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contextMenuBus.types.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/ContextMenu/hooks/useContextMenu/utils/contextMenuBus/contextMenuBus.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,QAAQ,EAAE,MAAM,OAAO,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,EAAE,qBAAqB,KAAK,IAAI,CAAC"}
|
|
1
|
+
{"version":3,"file":"contextMenuBus.types.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/ContextMenu/hooks/useContextMenu/utils/contextMenuBus/contextMenuBus.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,QAAQ,EAAE,MAAM,OAAO,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,EAAE,qBAAqB,KAAK,IAAI,CAAC;AAE9E;;GAEG;AACH,MAAM,MAAM,kCAAkC,GAAG,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC"}
|
package/dist/components/ContextMenu/hooks/useContextMenuItemFocus/useContextMenuItemFocus.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useContextMenuItemFocus.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/hooks/useContextMenuItemFocus/useContextMenuItemFocus.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,8BAA8B,EAC9B,6BAA6B,EAC9B,MAAM,iCAAiC,CAAC;AAEzC;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,uBAAuB,GAAI,CAAC,SAAS,WAAW,WAClD,8BAA8B,CAAC,CAAC,CAAC,KACzC,6BAA6B,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"useContextMenuItemFocus.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/hooks/useContextMenuItemFocus/useContextMenuItemFocus.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,8BAA8B,EAC9B,6BAA6B,EAC9B,MAAM,iCAAiC,CAAC;AAEzC;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,uBAAuB,GAAI,CAAC,SAAS,WAAW,WAClD,8BAA8B,CAAC,CAAC,CAAC,KACzC,6BAA6B,CAAC,CAAC,CAmKjC,CAAC"}
|
package/dist/components/ContextMenu/hooks/useContextMenuItemFocus/useContextMenuItemFocus.js
CHANGED
|
@@ -1,66 +1,71 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { useLevelContext as
|
|
3
|
-
const
|
|
1
|
+
import { useState as R, useRef as H, useLayoutEffect as N, useEffect as T } from "react";
|
|
2
|
+
import { useLevelContext as d } from "../../providers/LevelProvider/LevelProvider.js";
|
|
3
|
+
const w = (E) => {
|
|
4
4
|
const {
|
|
5
|
-
displayName:
|
|
6
|
-
id:
|
|
7
|
-
isDisabled:
|
|
8
|
-
hasSubmenu:
|
|
9
|
-
onMouseEnter:
|
|
10
|
-
onMouseLeave:
|
|
11
|
-
onFocus:
|
|
12
|
-
onBlur:
|
|
13
|
-
onPointerEnter:
|
|
14
|
-
onPointerLeave:
|
|
15
|
-
onPointerMove:
|
|
16
|
-
isSelectable:
|
|
17
|
-
subMenuTriggerId:
|
|
18
|
-
} =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
5
|
+
displayName: L,
|
|
6
|
+
id: a,
|
|
7
|
+
isDisabled: u,
|
|
8
|
+
hasSubmenu: k,
|
|
9
|
+
onMouseEnter: I,
|
|
10
|
+
onMouseLeave: p,
|
|
11
|
+
onFocus: b,
|
|
12
|
+
onBlur: D,
|
|
13
|
+
onPointerEnter: x,
|
|
14
|
+
onPointerLeave: F,
|
|
15
|
+
onPointerMove: S,
|
|
16
|
+
isSelectable: o = !0,
|
|
17
|
+
subMenuTriggerId: y
|
|
18
|
+
} = E, [M, r] = R(!1), n = H(null), { setActiveItemId: l, activeItemId: s, isAiming: e, isChildAiming: t } = d(L), v = () => {
|
|
19
|
+
n.current && (clearInterval(n.current), n.current = null);
|
|
20
|
+
};
|
|
21
|
+
return N(() => {
|
|
22
|
+
k ? (s === null || s !== y && a !== s) && r(!1) : a !== s && r(!1);
|
|
23
|
+
}, [s, y, k, a]), T(() => () => v(), []), {
|
|
24
|
+
dataHighlighted: M && o && !u ? "" : void 0,
|
|
25
|
+
onFocus: (c) => {
|
|
26
|
+
const f = (e == null ? void 0 : e()) || (t == null ? void 0 : t());
|
|
27
|
+
o && !u && !f && (l(a), r(!u)), b == null || b(c);
|
|
26
28
|
},
|
|
27
|
-
onMouseEnter: (
|
|
28
|
-
const
|
|
29
|
-
|
|
29
|
+
onMouseEnter: (c) => {
|
|
30
|
+
const f = (e == null ? void 0 : e()) || (t == null ? void 0 : t());
|
|
31
|
+
o && !u && !f && (l(a), r(!u)), f && o && !u && (v(), n.current = setInterval(() => {
|
|
32
|
+
!(e != null && e()) && !(t != null && t()) && (l(a), r(!0), v());
|
|
33
|
+
}, 16)), f || I == null || I(c);
|
|
30
34
|
},
|
|
31
|
-
onBlur: (
|
|
32
|
-
const
|
|
33
|
-
|
|
35
|
+
onBlur: (c) => {
|
|
36
|
+
const f = (e == null ? void 0 : e()) || (t == null ? void 0 : t());
|
|
37
|
+
o && !u && !f && r(!1), D == null || D(c);
|
|
34
38
|
},
|
|
35
|
-
onMouseLeave: (
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
onMouseLeave: (c) => {
|
|
40
|
+
v();
|
|
41
|
+
const f = (e == null ? void 0 : e()) || (t == null ? void 0 : t());
|
|
42
|
+
o && !u && !f && r(!1), f || p == null || p(c);
|
|
38
43
|
},
|
|
39
44
|
/**
|
|
40
45
|
* This is necessary to disable the standard focus behavior
|
|
41
46
|
* when hovering over an item and similar elements in Radix.
|
|
42
47
|
*/
|
|
43
|
-
onPointerEnter: (
|
|
44
|
-
|
|
48
|
+
onPointerEnter: (c) => {
|
|
49
|
+
c.preventDefault(), x == null || x(c);
|
|
45
50
|
},
|
|
46
51
|
/**
|
|
47
52
|
* This is necessary to disable the standard focus behavior
|
|
48
53
|
* when hovering over an item and similar elements in Radix.
|
|
49
54
|
*/
|
|
50
|
-
onPointerLeave: (
|
|
51
|
-
|
|
55
|
+
onPointerLeave: (c) => {
|
|
56
|
+
c.preventDefault(), F == null || F(c);
|
|
52
57
|
},
|
|
53
58
|
/**
|
|
54
59
|
* This is necessary to disable the standard focus behavior
|
|
55
60
|
* when hovering over an item and similar elements in Radix.
|
|
56
61
|
*/
|
|
57
|
-
onPointerMove: (
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
62
|
+
onPointerMove: (c) => {
|
|
63
|
+
c.preventDefault();
|
|
64
|
+
const f = (e == null ? void 0 : e()) || (t == null ? void 0 : t());
|
|
65
|
+
o && !u && !f && (l(a), r(!u)), f || S == null || S(c);
|
|
61
66
|
}
|
|
62
67
|
};
|
|
63
68
|
};
|
|
64
69
|
export {
|
|
65
|
-
|
|
70
|
+
w as useContextMenuItemFocus
|
|
66
71
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _ } from "react/jsx-runtime";
|
|
2
2
|
import N, { forwardRef as g } from "react";
|
|
3
3
|
import { c as u } from "../../index-L8X2o7IH.mjs";
|
|
4
|
-
import { c as x } from "../../index-
|
|
4
|
+
import { c as x } from "../../index-DBS3EIVR.mjs";
|
|
5
5
|
import { useThemeClassName as C } from "../../hooks/useThemeClassName/useThemeClassName.js";
|
|
6
6
|
import { CustomScrollClassName as y } from "../../stylesheets/utils/BaseClasses/BaseClasses.js";
|
|
7
7
|
import { noop as o } from "../../utils/noop/noop.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as c } from "react/jsx-runtime";
|
|
2
2
|
import u, { forwardRef as k, useMemo as A, useRef as E, useCallback as m, useEffect as H } from "react";
|
|
3
|
-
import { u as N } from "../../../../index-
|
|
3
|
+
import { u as N } from "../../../../index-DBS3EIVR.mjs";
|
|
4
4
|
import { Portal as P } from "../../../Portal/Portal.js";
|
|
5
5
|
import { List as _ } from "../../../List/List.js";
|
|
6
6
|
import { mergeRefs as y } from "../../../../lib/utils.js";
|