@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.
Files changed (48) hide show
  1. package/dist/ContextMenu-CeyT26LX.mjs +229 -0
  2. package/dist/components/ContextMenu/ContextMenu.d.ts +2 -2
  3. package/dist/components/ContextMenu/ContextMenu.d.ts.map +1 -1
  4. package/dist/components/ContextMenu/ContextMenu.js +5 -5
  5. package/dist/components/ContextMenu/ContextMenu.props.d.ts +19 -3
  6. package/dist/components/ContextMenu/ContextMenu.props.d.ts.map +1 -1
  7. package/dist/components/ContextMenu/components/CheckboxItem/CheckboxItem.js +1 -1
  8. package/dist/components/ContextMenu/components/Content/Content.d.ts.map +1 -1
  9. package/dist/components/ContextMenu/components/Content/Content.js +1 -1
  10. package/dist/components/ContextMenu/components/Content/index.js +1 -1
  11. package/dist/components/ContextMenu/components/Item/Item.js +1 -1
  12. package/dist/components/ContextMenu/components/Label/Label.js +1 -1
  13. package/dist/components/ContextMenu/components/RadioItem/RadioItem.js +1 -1
  14. package/dist/components/ContextMenu/components/Sub/Sub.js +1 -1
  15. package/dist/components/ContextMenu/components/Sub/Sub.props.d.ts +3 -3
  16. package/dist/components/ContextMenu/components/Sub/Sub.props.d.ts.map +1 -1
  17. package/dist/components/ContextMenu/components/Sub/hooks/useContextMenuSub/useContextMenuSub.d.ts.map +1 -1
  18. package/dist/components/ContextMenu/components/Sub/hooks/useContextMenuSub/useContextMenuSub.js +80 -88
  19. package/dist/components/ContextMenu/components/Sub/hooks/useContextMenuSub/useContextMenuSub.types.d.ts +2 -2
  20. package/dist/components/ContextMenu/components/Sub/hooks/useContextMenuSub/useContextMenuSub.types.d.ts.map +1 -1
  21. package/dist/components/ContextMenu/components/Sub/index.js +1 -1
  22. package/dist/components/ContextMenu/components/SubContent/SubContent.js +1 -1
  23. package/dist/components/ContextMenu/components/SubRoot/components/Content/Content.js +1 -1
  24. package/dist/components/ContextMenu/components/SubRoot/components/Trigger/Trigger.js +1 -1
  25. package/dist/components/ContextMenu/components/SubRoot/hooks/useContextMenuSubMenu/useContextMenuSubMenu.js +1 -1
  26. package/dist/components/ContextMenu/components/SubTrigger/SubTrigger.js +1 -1
  27. package/dist/components/ContextMenu/hooks/index.js +1 -1
  28. package/dist/components/ContextMenu/hooks/useContentPositioning/useContentPositioning.d.ts.map +1 -1
  29. package/dist/components/ContextMenu/hooks/useContentPositioning/useContentPositioning.js +1 -1
  30. package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.d.ts.map +1 -1
  31. package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.js +142 -133
  32. package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.types.d.ts +14 -2
  33. package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.types.d.ts.map +1 -1
  34. package/dist/components/ContextMenu/hooks/useContextMenu/utils/contextMenuBus/contextMenuBus.d.ts +3 -1
  35. package/dist/components/ContextMenu/hooks/useContextMenu/utils/contextMenuBus/contextMenuBus.d.ts.map +1 -1
  36. package/dist/components/ContextMenu/hooks/useContextMenu/utils/contextMenuBus/contextMenuBus.js +16 -10
  37. package/dist/components/ContextMenu/hooks/useContextMenu/utils/contextMenuBus/contextMenuBus.types.d.ts +4 -0
  38. package/dist/components/ContextMenu/hooks/useContextMenu/utils/contextMenuBus/contextMenuBus.types.d.ts.map +1 -1
  39. package/dist/components/ContextMenu/hooks/useContextMenuItemFocus/useContextMenuItemFocus.d.ts.map +1 -1
  40. package/dist/components/ContextMenu/hooks/useContextMenuItemFocus/useContextMenuItemFocus.js +47 -42
  41. package/dist/components/ContextMenu/index.js +1 -1
  42. package/dist/components/List/List.js +1 -1
  43. package/dist/components/Select/components/List/List.js +1 -1
  44. package/dist/index-DBS3EIVR.mjs +273 -0
  45. package/dist/{useContentPositioning-DfyirIME.mjs → useContentPositioning-Dfjbylz5.mjs} +456 -451
  46. package/package.json +3 -3
  47. package/dist/ContextMenu-BUiakpJf.mjs +0 -223
  48. package/dist/index-BH2CXQ4d.mjs +0 -257
@@ -1,164 +1,173 @@
1
- import { useId as ce, useState as a, useRef as d, useEffect as M } from "react";
2
- import { a as ie, b as le } from "../../../../index-BH2CXQ4d.mjs";
3
- import { useFocusChange as fe } from "../../../../hooks/useFocusChange/useFocusChange.js";
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 v } from "./utils/contextMenuBus/contextMenuBus.js";
6
- const Re = (z) => {
6
+ import { contextMenuBus as h } from "./utils/contextMenuBus/contextMenuBus.js";
7
+ const De = (X) => {
7
8
  const {
8
- mode: G,
9
- defaultOpen: P,
10
- animationDuration: O,
11
- hoverCloseDelay: A,
12
- isOpen: I,
13
- onOpen: r,
14
- onAnimatedOpen: F,
15
- onAiming: J,
16
- onFocusOutside: N,
17
- isAimingTolerance: Q,
18
- isAimingIdleTimeout: U
19
- } = z, T = ce(), [s, R] = a(
20
- I ?? P ?? !1
21
- ), [B, u] = a(!1), [D, p] = a(!1), [x, H] = a(!1), [S, X] = a(!1), [Y, Z] = a(null), [_, K] = a(!1), [k, $] = a(null), C = d(!1), q = d(null), t = d(null), o = d(null), V = d(!1), m = d(null), l = d(!1), g = d(N), c = ie() ? i.CLICK : G, { isAiming: b, ref: y } = le({
22
- isEnabled: s && c === i.HOVER,
23
- onChange: J,
24
- tolerance: Q,
25
- idleTimeout: U
26
- }), f = () => {
27
- t.current && (clearTimeout(t.current), t.current = null), o.current && (clearTimeout(o.current), o.current = null), m.current && (clearInterval(m.current), m.current = null);
28
- }, E = () => {
29
- f(), l.current = !1, R(!1), r == null || r(!1), p(!1), C.current = !1, K(!1);
30
- }, W = () => {
31
- if (f(), c === i.HOVER) {
32
- if (S && Y === i.CLICK || k !== null)
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 (D) {
35
- u(!1), o.current = setTimeout(() => {
36
- E();
37
- }, O);
43
+ if (K) {
44
+ f(!1), c.current = setTimeout(() => {
45
+ m();
46
+ }, C);
38
47
  return;
39
48
  }
40
- l.current = !0, m.current || (m.current = setInterval(() => {
41
- if (C.current) {
42
- f(), l.current = !1, u(!0);
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
- E();
51
- }, L = (e = !1) => {
52
- V.current = e, f(), u(!1), R(!1), r == null || r(!1), p(!1);
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
- M(() => {
55
- if (!s) {
56
- const e = setTimeout(() => {
57
- V.current = !1;
58
- }, 0);
59
- return () => {
60
- clearTimeout(e);
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
- }, [s]);
64
- const ee = (e) => {
65
- K(e);
66
- }, j = (e) => {
67
- c === i.CLICK && P !== void 0 || (e ? (o.current && (clearTimeout(o.current), o.current = null), c === i.HOVER && u(!0), R(!0), r == null || r(!0), setTimeout(() => {
68
- I !== !1 && v.emit({
69
- id: T,
70
- isAiming: b
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
- M(() => I === !1 ? void 0 : v.subscribe(({ id: n }) => {
97
- n !== T && L(!0);
98
- }), [T, I]), M(() => {
99
- !s || c !== i.HOVER || x || (D ? t.current && (clearTimeout(t.current), t.current = null) : t.current || (t.current = setTimeout(() => {
100
- W();
101
- }, A)));
102
- }, [c, s, D, A, x]), M(() => {
103
- F == null || F(B);
104
- }, [B]);
105
- const ue = () => {
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
- y.current && e.push(y.current);
108
- const n = Array.from(
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(...n), e;
115
+ return e.push(...t), e;
112
116
  };
113
- return fe({
114
- elements: s ? [y, q] : [],
115
- enabled: s,
117
+ return Ie({
118
+ elements: l ? [F, z] : [],
119
+ enabled: l,
116
120
  onFocusOutside: (e) => {
117
- var w;
118
- const n = e.target;
119
- if (!s || n === document.body)
121
+ var U;
122
+ const t = e.target;
123
+ if (!l || t === document.body)
120
124
  return;
121
- if (!ue().some((h) => n ? h === n || h.contains(n) : !1)) {
122
- let h = !1;
123
- const oe = {
124
- target: n,
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
- h = !0;
130
+ p = !0;
127
131
  },
128
132
  get defaultPrevented() {
129
- return h;
133
+ return p;
130
134
  }
131
135
  };
132
- if ((w = g.current) == null || w.call(g, oe), h)
136
+ if ((U = M.current) == null || U.call(M, he), p)
133
137
  return;
134
- L(!0);
138
+ k({ preventFocusRestore: !0 });
135
139
  }
136
140
  }
137
141
  }), {
138
- isOpen: s,
139
- mode: c,
140
- onOpenChange: j,
141
- onOpenByKeyboard: te,
142
- triggerRef: q,
143
- contentRef: y,
144
- isAnimatedOpen: B,
145
- animationDuration: O,
146
- hoverCloseDelay: A,
147
- closeMenuImmediately: L,
148
- onContentEnter: ne,
149
- onContentLeave: re,
150
- onChildOpen: se,
151
- onSubmenuOpen: ee,
152
- isRootContentBlocked: _,
153
- isChildOpen: S,
154
- itemWithFocusedInput: k,
155
- setItemWithFocusedInput: $,
156
- shouldPreventFocusRestore: () => V.current,
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
- g.current = e;
159
- }
165
+ M.current = e;
166
+ },
167
+ isChildAiming: oe,
168
+ onChildAiming: ie
160
169
  };
161
170
  };
162
171
  export {
163
- Re as useContextMenu
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
- isAimingTolerance: number;
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
- isAimingIdleTimeout: number;
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;;;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c,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;IACjE;;OAEG;IACH,yBAAyB,EAAE,MAAM,OAAO,CAAC;IACzC;;OAEG;IACH,iBAAiB,EAAE,CACjB,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC,GAAG,SAAS,KACtD,IAAI,CAAC;CACX"}
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,eAAe,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,iBAAiB,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G;IACH,iBAAiB,EAAE,CACjB,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC,GAAG,SAAS,KACtD,IAAI,CAAC;IACV;;OAEG;IACH,aAAa,EAAE,MAAM,OAAO,CAAC;IAC7B;;OAEG;IACH,aAAa,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C"}
@@ -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,EACtB,MAAM,wBAAwB,CAAC;AAkChC,eAAO,MAAM,cAAc;oBAlBJ,qBAAqB,KAAG,IAAI;oBAU5B,sBAAsB,KAAG,CAAC,MAAM,IAAI,CAAC;8BAhBvC,OAAO;;CAiC3B,CAAC"}
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"}
@@ -1,18 +1,24 @@
1
- let t = [], n = null, s = null;
2
- const r = (e) => {
3
- t.forEach((i) => i(e)), n = e.isAiming, s = e.id;
4
- }, u = (e) => (t.push(e), () => {
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
- }), c = {
7
- emit: r,
8
- subscribe: u,
10
+ }), m = {
11
+ emit: u,
12
+ emitAimingChange: g,
13
+ subscribe: c,
14
+ subscribeAimingChange: l,
9
15
  get isAiming() {
10
- return n;
16
+ return s;
11
17
  },
12
18
  get activeMenuId() {
13
- return s;
19
+ return r;
14
20
  }
15
21
  };
16
22
  export {
17
- c as contextMenuBus
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"}
@@ -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,CA2HjC,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"}
@@ -1,66 +1,71 @@
1
- import { useState as M, useLayoutEffect as E } from "react";
2
- import { useLevelContext as H } from "../../providers/LevelProvider/LevelProvider.js";
3
- const j = (d) => {
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: y,
6
- id: u,
7
- isDisabled: o,
8
- hasSubmenu: F,
9
- onMouseEnter: v,
10
- onMouseLeave: l,
11
- onFocus: p,
12
- onBlur: I,
13
- onPointerEnter: n,
14
- onPointerLeave: b,
15
- onPointerMove: D,
16
- isSelectable: a = !0,
17
- subMenuTriggerId: S
18
- } = d, [L, s] = M(!1), { setActiveItemId: x, activeItemId: r, isAiming: t, isChildAiming: f } = H(y);
19
- return E(() => {
20
- F ? (r === null || r !== S && u !== r) && s(!1) : u !== r && s(!1);
21
- }, [r, S, F, u]), {
22
- dataHighlighted: L && a && !o ? "" : void 0,
23
- onFocus: (e) => {
24
- const c = (t == null ? void 0 : t()) || (f == null ? void 0 : f());
25
- a && !o && !c && (x(u), s(!o)), p == null || p(e);
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: (e) => {
28
- const c = (t == null ? void 0 : t()) || (f == null ? void 0 : f());
29
- a && !o && !c && (x(u), s(!o)), c || v == null || v(e);
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: (e) => {
32
- const c = (t == null ? void 0 : t()) || (f == null ? void 0 : f());
33
- a && !o && !c && s(!1), I == null || I(e);
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: (e) => {
36
- const c = (t == null ? void 0 : t()) || (f == null ? void 0 : f());
37
- a && !o && !c && s(!1), c || l == null || l(e);
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: (e) => {
44
- e.preventDefault(), n == null || n(e);
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: (e) => {
51
- e.preventDefault(), b == null || b(e);
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: (e) => {
58
- e.preventDefault();
59
- const c = (t == null ? void 0 : t()) || (f == null ? void 0 : f());
60
- a && !o && !c && (x(u), s(!o)), c || D == null || D(e);
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
- j as useContextMenuItemFocus
70
+ w as useContextMenuItemFocus
66
71
  };
@@ -1,4 +1,4 @@
1
- import { C as t } from "../../ContextMenu-BUiakpJf.mjs";
1
+ import { C as t } from "../../ContextMenu-CeyT26LX.mjs";
2
2
  export {
3
3
  t as ContextMenu
4
4
  };
@@ -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-BH2CXQ4d.mjs";
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-BH2CXQ4d.mjs";
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";