@kommo-crm/crm-react-ui-kit 1.3.0-beta.2 → 1.3.0-beta.4

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 (20) hide show
  1. package/dist/{ContextMenu-CeyT26LX.mjs → ContextMenu-DFahDlEy.mjs} +79 -78
  2. package/dist/components/ContextMenu/ContextMenu.js +1 -1
  3. package/dist/components/ContextMenu/components/Sub/Sub.d.ts.map +1 -1
  4. package/dist/components/ContextMenu/components/Sub/Sub.js +1 -1
  5. package/dist/components/ContextMenu/components/Sub/hooks/useContextMenuSub/useContextMenuSub.d.ts.map +1 -1
  6. package/dist/components/ContextMenu/components/Sub/hooks/useContextMenuSub/useContextMenuSub.js +21 -20
  7. package/dist/components/ContextMenu/components/Sub/hooks/useContextMenuSub/useContextMenuSub.types.d.ts +4 -0
  8. package/dist/components/ContextMenu/components/Sub/hooks/useContextMenuSub/useContextMenuSub.types.d.ts.map +1 -1
  9. package/dist/components/ContextMenu/components/Sub/index.js +1 -1
  10. package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.d.ts.map +1 -1
  11. package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.js +102 -97
  12. package/dist/components/ContextMenu/hooks/useContextMenu/utils/contextMenuBus/contextMenuBus.d.ts +3 -1
  13. package/dist/components/ContextMenu/hooks/useContextMenu/utils/contextMenuBus/contextMenuBus.d.ts.map +1 -1
  14. package/dist/components/ContextMenu/hooks/useContextMenu/utils/contextMenuBus/contextMenuBus.js +16 -10
  15. package/dist/components/ContextMenu/hooks/useContextMenu/utils/contextMenuBus/contextMenuBus.types.d.ts +4 -0
  16. package/dist/components/ContextMenu/hooks/useContextMenu/utils/contextMenuBus/contextMenuBus.types.d.ts.map +1 -1
  17. package/dist/components/ContextMenu/hooks/useContextMenuItemFocus/useContextMenuItemFocus.d.ts.map +1 -1
  18. package/dist/components/ContextMenu/hooks/useContextMenuItemFocus/useContextMenuItemFocus.js +47 -42
  19. package/dist/components/ContextMenu/index.js +1 -1
  20. package/package.json +2 -2
@@ -22,45 +22,46 @@ import { ItemIndicator as ie } from "./components/ContextMenu/components/ItemInd
22
22
  import { RadioGroup as re } from "./components/ContextMenu/components/RadioGroup/RadioGroup.js";
23
23
  import { RadioItem as me } from "./components/ContextMenu/components/RadioItem/RadioItem.js";
24
24
  import { Separator as se } from "./components/ContextMenu/components/Separator/Separator.js";
25
- import { ItemIcon as pe } from "./components/ContextMenu/components/ItemIcon/ItemIcon.js";
26
- import { __experimental_SubRoot as ae } from "./components/ContextMenu/components/SubRoot/SubRoot.js";
25
+ import { ItemIcon as ae } from "./components/ContextMenu/components/ItemIcon/ItemIcon.js";
26
+ import { __experimental_SubRoot as pe } from "./components/ContextMenu/components/SubRoot/SubRoot.js";
27
27
  import { DISPLAY_NAME as ue, ContextMenuRootProvider as de, ContextMenuProvider as le } from "./components/ContextMenu/ContextMenu.context.js";
28
28
  import { useContextMenuSub as ce } from "./components/ContextMenu/components/Sub/hooks/useContextMenuSub/useContextMenuSub.js";
29
- import { ContextMenuSubProvider as Ce, DISPLAY_NAME as L } from "./components/ContextMenu/components/Sub/Sub.context.js";
30
- const N = (p) => {
29
+ import { ContextMenuSubProvider as Ce, DISPLAY_NAME as N } from "./components/ContextMenu/components/Sub/Sub.context.js";
30
+ const T = (s) => {
31
31
  const {
32
32
  children: a,
33
- mode: t = z.HOVER,
33
+ mode: p = z.HOVER,
34
34
  onOpen: e,
35
- defaultOpen: i,
35
+ defaultOpen: t,
36
36
  shouldCloseRootMenuOnSelect: u = !0,
37
37
  shouldCloseCurrentMenuOnSelect: d = !0,
38
38
  onAiming: l,
39
- aimingTolerance: c = T,
40
- aimingIdleTimeout: C = v,
39
+ aimingTolerance: c = v,
40
+ aimingIdleTimeout: C = P,
41
41
  ...O
42
- } = p, {
43
- isOpen: r,
44
- setIsOpen: f,
45
- isAnimatedOpen: o,
46
- handleContentEnter: I,
47
- handleContentLeave: h,
48
- handleOpenChange: m,
49
- triggerId: g,
50
- onOpenByKeyboard: A,
51
- contentRef: M,
52
- triggerRef: R,
53
- onChildOpen: S,
54
- onSubRootOpen: b,
55
- closeMenuImmediately: s,
56
- itemWithFocusedInput: E,
57
- setItemWithFocusedInput: D,
58
- isAiming: _,
59
- handlePointerDownOutside: x
42
+ } = s, {
43
+ mode: f,
44
+ isOpen: i,
45
+ setIsOpen: o,
46
+ isAnimatedOpen: I,
47
+ handleContentEnter: h,
48
+ handleContentLeave: r,
49
+ handleOpenChange: g,
50
+ triggerId: A,
51
+ onOpenByKeyboard: M,
52
+ contentRef: R,
53
+ triggerRef: S,
54
+ onChildOpen: b,
55
+ onSubRootOpen: m,
56
+ closeMenuImmediately: E,
57
+ itemWithFocusedInput: D,
58
+ setItemWithFocusedInput: _,
59
+ isAiming: x,
60
+ handlePointerDownOutside: y
60
61
  } = ce({
61
- displayName: L,
62
- mode: t,
63
- defaultOpen: i,
62
+ displayName: N,
63
+ mode: p,
64
+ defaultOpen: t,
64
65
  onOpen: e,
65
66
  onAiming: l,
66
67
  aimingTolerance: c,
@@ -69,31 +70,31 @@ const N = (p) => {
69
70
  return /* @__PURE__ */ n(
70
71
  Ce,
71
72
  {
72
- mode: t,
73
- isOpen: r,
74
- setIsOpen: f,
75
- isAnimatedOpen: o,
76
- defaultOpen: i,
77
- onContentEnter: I,
78
- onContentLeave: h,
79
- onOpenByKeyboard: A,
80
- triggerId: g,
81
- contentRef: M,
82
- triggerRef: R,
83
- onChildOpen: S,
84
- onSubRootOpen: b,
73
+ mode: f,
74
+ isOpen: i,
75
+ setIsOpen: o,
76
+ isAnimatedOpen: I,
77
+ defaultOpen: t,
78
+ onContentEnter: h,
79
+ onContentLeave: r,
80
+ onOpenByKeyboard: M,
81
+ triggerId: A,
82
+ contentRef: R,
83
+ triggerRef: S,
84
+ onChildOpen: b,
85
+ onSubRootOpen: m,
85
86
  shouldCloseRootMenuOnSelect: u,
86
87
  shouldCloseCurrentMenuOnSelect: d,
87
- closeMenuImmediately: s,
88
- itemWithFocusedInput: E,
89
- setItemWithFocusedInput: D,
90
- isAiming: _,
91
- onPointerDownOutside: x,
88
+ closeMenuImmediately: E,
89
+ itemWithFocusedInput: D,
90
+ setItemWithFocusedInput: _,
91
+ isAiming: x,
92
+ onPointerDownOutside: y,
92
93
  children: /* @__PURE__ */ n(
93
94
  B,
94
95
  {
95
- open: r,
96
- onOpenChange: m,
96
+ open: i,
97
+ onOpenChange: g,
97
98
  ...O,
98
99
  children: a
99
100
  }
@@ -101,38 +102,38 @@ const N = (p) => {
101
102
  }
102
103
  );
103
104
  };
104
- N.displayName = L;
105
- const Oe = 200, fe = 150, T = 20, v = 200, y = (p) => {
105
+ T.displayName = N;
106
+ const Oe = 200, fe = 150, v = 20, P = 200, L = (s) => {
106
107
  const {
107
108
  children: a,
108
- mode: t,
109
+ mode: p,
109
110
  isOpen: e,
110
- defaultOpen: i,
111
+ defaultOpen: t,
111
112
  shouldCloseCurrentMenuOnSelect: u = !0,
112
113
  onOpen: d,
113
114
  onAnimatedOpen: l,
114
115
  onAiming: c,
115
- aimingTolerance: C = T,
116
- aimingIdleTimeout: O = v,
117
- ...r
118
- } = p, {
119
- mode: f,
116
+ aimingTolerance: C = v,
117
+ aimingIdleTimeout: O = P,
118
+ ...f
119
+ } = s, {
120
+ mode: i,
120
121
  isOpen: o,
121
122
  triggerRef: I,
122
123
  contentRef: h,
123
- isAnimatedOpen: m,
124
+ isAnimatedOpen: r,
124
125
  skipAnimation: g,
125
126
  animationDuration: A,
126
127
  hoverCloseDelay: M,
127
128
  isRootContentBlocked: R,
128
129
  isChildOpen: S,
129
130
  itemWithFocusedInput: b,
130
- closeMenuImmediately: s,
131
+ closeMenuImmediately: m,
131
132
  onOpenChange: E,
132
133
  onContentEnter: D,
133
134
  onContentLeave: _,
134
135
  onOpenByKeyboard: x,
135
- onChildOpen: P,
136
+ onChildOpen: y,
136
137
  onSubmenuOpen: F,
137
138
  setItemWithFocusedInput: G,
138
139
  shouldPreventFocusRestore: U,
@@ -140,8 +141,8 @@ const Oe = 200, fe = 150, T = 20, v = 200, y = (p) => {
140
141
  isChildAiming: Y,
141
142
  onChildAiming: k
142
143
  } = j({
143
- mode: t,
144
- defaultOpen: i,
144
+ mode: p,
145
+ defaultOpen: t,
145
146
  animationDuration: fe,
146
147
  hoverCloseDelay: Oe,
147
148
  isOpen: e,
@@ -152,29 +153,29 @@ const Oe = 200, fe = 150, T = 20, v = 200, y = (p) => {
152
153
  aimingIdleTimeout: O
153
154
  }), { navigationContentRef: w } = V({
154
155
  isOpen: e ?? o,
155
- isAnimatedOpen: m
156
+ isAnimatedOpen: r
156
157
  });
157
158
  return /* @__PURE__ */ n(
158
159
  de,
159
160
  {
160
- closeRootMenuImmediately: s,
161
+ closeRootMenuImmediately: m,
161
162
  navigationContentRef: w,
162
163
  children: /* @__PURE__ */ n(
163
164
  le,
164
165
  {
165
- mode: f,
166
+ mode: i,
166
167
  triggerRef: I,
167
168
  contentRef: h,
168
- isAnimatedOpen: m,
169
+ isAnimatedOpen: r,
169
170
  skipAnimation: g,
170
171
  animationDuration: A,
171
172
  hoverCloseDelay: M,
172
- closeMenuImmediately: s,
173
+ closeMenuImmediately: m,
173
174
  onContentEnter: D,
174
175
  onContentLeave: _,
175
176
  onOpenByKeyboard: x,
176
177
  shouldCloseCurrentMenuOnSelect: u,
177
- onChildOpen: P,
178
+ onChildOpen: y,
178
179
  isOpen: o,
179
180
  onSubmenuOpen: F,
180
181
  isRootContentBlocked: R,
@@ -191,7 +192,7 @@ const Oe = 200, fe = 150, T = 20, v = 200, y = (p) => {
191
192
  open: e ?? o,
192
193
  onOpenChange: E,
193
194
  modal: !1,
194
- ...r,
195
+ ...f,
195
196
  children: a
196
197
  }
197
198
  )
@@ -199,14 +200,14 @@ const Oe = 200, fe = 150, T = 20, v = 200, y = (p) => {
199
200
  )
200
201
  }
201
202
  );
202
- }, Ve = Object.assign(y, {
203
+ }, Ve = Object.assign(L, {
203
204
  displayName: ue,
204
- Root: y,
205
- experimental_SubRoot: ae,
205
+ Root: L,
206
+ experimental_SubRoot: pe,
206
207
  Trigger: $,
207
208
  Content: H,
208
209
  Portal: q,
209
- Sub: N,
210
+ Sub: T,
210
211
  SubTrigger: J,
211
212
  SubContent: Q,
212
213
  Arrow: X,
@@ -219,11 +220,11 @@ const Oe = 200, fe = 150, T = 20, v = 200, y = (p) => {
219
220
  RadioItem: me,
220
221
  ItemIndicator: ie,
221
222
  Separator: se,
222
- ItemIcon: pe
223
+ ItemIcon: ae
223
224
  });
224
225
  export {
225
226
  Ve as C,
226
- T as D,
227
- N as S,
228
- v as a
227
+ v as D,
228
+ T as S,
229
+ P as a
229
230
  };
@@ -9,7 +9,7 @@ import "./providers/SubMenuProvider/SubMenuProvider.js";
9
9
  import "./hooks/useContextMenuKeyboardNavigation/useContextMenuKeyboardNavigation.js";
10
10
  import "./components/Trigger/Trigger.js";
11
11
  import "./components/Portal/Portal.js";
12
- import { C as b, a as c, D as d } from "../../ContextMenu-CeyT26LX.mjs";
12
+ import { C as b, a as c, D as d } from "../../ContextMenu-DFahDlEy.mjs";
13
13
  import "./components/SubTrigger/SubTrigger.js";
14
14
  import "./components/SubContent/SubContent.js";
15
15
  import "./components/Arrow/Arrow.js";
@@ -1 +1 @@
1
- {"version":3,"file":"Sub.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/components/Sub/Sub.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,eAAO,MAAM,GAAG;YAAW,QAAQ;;CA2ElC,CAAC"}
1
+ {"version":3,"file":"Sub.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/components/Sub/Sub.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,eAAO,MAAM,GAAG;YAAW,QAAQ;;CA4ElC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import "react/jsx-runtime";
2
2
  import "../../../../index-aPaPKjUe.mjs";
3
3
  import "../../ContextMenu.enums.js";
4
- import { S as a } from "../../../../ContextMenu-CeyT26LX.mjs";
4
+ import { S as a } from "../../../../ContextMenu-DFahDlEy.mjs";
5
5
  import "./hooks/useContextMenuSub/useContextMenuSub.js";
6
6
  import "./Sub.context.js";
7
7
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"useContextMenuSub.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/ContextMenu/components/Sub/hooks/useContextMenuSub/useContextMenuSub.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,2BAA2B,CAAC;AAEnC,eAAO,MAAM,iBAAiB,YACnB,wBAAwB,KAChC,uBAydF,CAAC"}
1
+ {"version":3,"file":"useContextMenuSub.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/ContextMenu/components/Sub/hooks/useContextMenuSub/useContextMenuSub.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,2BAA2B,CAAC;AAEnC,eAAO,MAAM,iBAAiB,YACnB,wBAAwB,KAChC,uBA0dF,CAAC"}
@@ -19,54 +19,54 @@ const Re = (z) => {
19
19
  isAnimatedOpen: k,
20
20
  onChildAiming: h,
21
21
  isChildAiming: v
22
- } = me(W), D = ie(), [s, f] = m(o || !1), [U, u] = m(!1), [H, R] = m(!1), [V, d] = m(!1), [A, X] = m(!1), [b, Y] = m(null), [q, Z] = m(!1), [y, _] = m(null), r = g(null), c = g(null), B = g(null), w = g(!0), a = g(!1), I = g(!1), $ = oe(), { hoverCloseDelay: P, animationDuration: E } = ae(W), l = $ ? i.CLICK : G, C = (t) => {
22
+ } = me(W), D = ie(), [s, f] = m(o || !1), [U, c] = m(!1), [H, R] = m(!1), [V, d] = m(!1), [A, X] = m(!1), [b, Y] = m(null), [q, Z] = m(!1), [y, _] = m(null), r = g(null), l = g(null), B = g(null), w = g(!0), a = g(!1), I = g(!1), $ = oe(), { hoverCloseDelay: P, animationDuration: E } = ae(W), u = $ ? i.CLICK : G, C = (t) => {
23
23
  setTimeout(() => S == null ? void 0 : S(t), 0);
24
24
  }, K = () => {
25
- r.current && (clearTimeout(r.current), r.current = null), c.current && (clearTimeout(c.current), c.current = null);
25
+ r.current && (clearTimeout(r.current), r.current = null), l.current && (clearTimeout(l.current), l.current = null);
26
26
  }, F = () => {
27
27
  K(), a.current = !1, f(!1), e == null || e(!1), C(!1), R(!1), I.current = !1, d(!1);
28
28
  }, M = () => {
29
- K(), u(!1), f(!1), e == null || e(!1), C(!1), R(!1), I.current = !1, d(!1);
29
+ K(), c(!1), f(!1), e == null || e(!1), C(!1), R(!1), I.current = !1, d(!1);
30
30
  }, ee = (t) => {
31
- p == null || p(t), h == null || h(t), !t && a.current && !I.current && (a.current = !1, u(!1), c.current = setTimeout(() => {
31
+ p == null || p(t), h == null || h(t), !t && a.current && !I.current && (a.current = !1, c(!1), l.current = setTimeout(() => {
32
32
  F();
33
33
  }, E));
34
34
  }, { isAiming: L, ref: te } = fe({
35
- isEnabled: s && l === i.HOVER,
35
+ isEnabled: s && u === i.HOVER,
36
36
  onChange: ee,
37
37
  tolerance: J,
38
38
  idleTimeout: Q
39
39
  }), O = () => {
40
- if (K(), l === i.HOVER) {
40
+ if (K(), u === i.HOVER) {
41
41
  if (A && b === i.CLICK || y !== null)
42
42
  return;
43
43
  if (H) {
44
- u(!1), c.current = setTimeout(() => {
44
+ c(!1), l.current = setTimeout(() => {
45
45
  f(!1), e == null || e(!1), C(!1), R(!1), I.current = !1, d(!1);
46
46
  }, E);
47
47
  return;
48
48
  }
49
- a.current = !0, L() || (a.current = !1, u(!1), c.current = setTimeout(() => {
49
+ a.current = !0, L() || (a.current = !1, c(!1), l.current = setTimeout(() => {
50
50
  F();
51
51
  }, E));
52
52
  } else
53
53
  M();
54
54
  }, j = (t) => {
55
55
  if (o !== void 0) {
56
- f(o), e == null || e(o), C(o), u(o), d(!1);
56
+ f(o), e == null || e(o), C(o), c(o), d(!1);
57
57
  return;
58
58
  }
59
- if (l === i.CLICK || V) {
60
- f(t), e == null || e(t), C(t), setTimeout(() => u(t), 0);
59
+ if (u === i.CLICK || V) {
60
+ f(t), e == null || e(t), C(t), setTimeout(() => c(t), 0);
61
61
  return;
62
62
  }
63
- t ? (c.current && (clearTimeout(c.current), c.current = null), f(!0), e == null || e(!0), u(!0), C(!0)) : O();
63
+ t ? (l.current && (clearTimeout(l.current), l.current = null), f(!0), e == null || e(!0), c(!0), C(!0)) : O();
64
64
  }, re = (t) => {
65
65
  d(t);
66
66
  }, se = () => {
67
- l !== i.HOVER || L() && x !== D || v != null && v() && !s || (d(!1), K(), a.current = !1, s ? (R(!0), I.current = !0, u(!0)) : (r.current && (clearTimeout(r.current), r.current = null), u(!0), e == null || e(!0), C(!0), f(!0), R(!0), I.current = !0));
67
+ u !== i.HOVER || L() && x !== D || v != null && v() && !s || (d(!1), K(), a.current = !1, s ? (R(!0), I.current = !0, c(!0)) : (r.current && (clearTimeout(r.current), r.current = null), c(!0), e == null || e(!0), C(!0), f(!0), R(!0), I.current = !0));
68
68
  }, ne = () => {
69
- l === i.HOVER && (d(!1), R(!1), I.current = !1, r.current && (clearTimeout(r.current), r.current = null), a.current && !L() && (a.current = !1, u(!1), c.current = setTimeout(() => {
69
+ u === i.HOVER && (d(!1), R(!1), I.current = !1, r.current && (clearTimeout(r.current), r.current = null), a.current && !L() && (a.current = !1, c(!1), l.current = setTimeout(() => {
70
70
  F();
71
71
  }, E)));
72
72
  }, ue = (t, N) => {
@@ -80,7 +80,7 @@ const Re = (z) => {
80
80
  return T(() => {
81
81
  (x !== D || q) && s && o === void 0 && M();
82
82
  }, [x, s, o]), T(() => {
83
- if (!(!s || l !== i.HOVER || V)) {
83
+ if (!(!s || u !== i.HOVER || V)) {
84
84
  if (H) {
85
85
  r.current && (clearTimeout(r.current), r.current = null);
86
86
  return;
@@ -91,9 +91,9 @@ const Re = (z) => {
91
91
  r.current && (clearTimeout(r.current), r.current = null);
92
92
  };
93
93
  }
94
- }, [l, s, H, P, V]), T(() => {
95
- n == null || n(s, l);
96
- }, [s, l]), T(() => {
94
+ }, [u, s, H, P, V]), T(() => {
95
+ n == null || n(s, u);
96
+ }, [s, u]), T(() => {
97
97
  y !== null && (n == null || n(!0, i.CLICK));
98
98
  }, [y]), T(() => {
99
99
  if (b !== null) {
@@ -101,7 +101,7 @@ const Re = (z) => {
101
101
  w.current = !1;
102
102
  return;
103
103
  }
104
- A && b === i.CLICK ? n == null || n(!0, b) : n == null || n(s, l);
104
+ A && b === i.CLICK ? n == null || n(!0, b) : n == null || n(s, u);
105
105
  }
106
106
  }, [A, b]), T(() => {
107
107
  j(s), s || h == null || h(!1);
@@ -124,7 +124,8 @@ const Re = (z) => {
124
124
  closeMenuImmediately: M,
125
125
  itemWithFocusedInput: y,
126
126
  setItemWithFocusedInput: _,
127
- isAiming: L
127
+ isAiming: L,
128
+ mode: u
128
129
  };
129
130
  };
130
131
  export {
@@ -107,5 +107,9 @@ export interface UseContextMenuSubResult {
107
107
  * Returns whether the cursor is currently moving toward the submenu.
108
108
  */
109
109
  isAiming: () => boolean;
110
+ /**
111
+ * The mode of the submenu.
112
+ */
113
+ mode: ContextMenuModeType;
110
114
  }
111
115
  //# sourceMappingURL=useContextMenuSub.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useContextMenuSub.types.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/ContextMenu/components/Sub/hooks/useContextMenuSub/useContextMenuSub.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAE/E,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,IAAI,EAAE,mBAAmB,CAAC;IAC1B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,SAAS,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IAC7C;;OAEG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B;;OAEG;IACH,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B;;OAEG;IACH,gBAAgB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C;;OAEG;IACH,wBAAwB,EAAE,CAAC,CAAC,EAAE,uBAAuB,KAAK,IAAI,CAAC;IAC/D;;OAEG;IACH,gBAAgB,EAAE,CAAC,gBAAgB,EAAE,OAAO,KAAK,IAAI,CAAC;IACtD;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,UAAU,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;IACtC;;OAEG;IACH,UAAU,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;IACtC;;OAEG;IACH,WAAW,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC3E;;OAEG;IACH,aAAa,EAAE,CAAC,aAAa,EAAE,OAAO,KAAK,IAAI,CAAC;IAChD;;OAEG;IACH,oBAAoB,EAAE,MAAM,IAAI,CAAC;IACjC;;OAEG;IACH,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC;;OAEG;IACH,uBAAuB,EAAE,CAAC,oBAAoB,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACvE;;OAEG;IACH,QAAQ,EAAE,MAAM,OAAO,CAAC;CACzB"}
1
+ {"version":3,"file":"useContextMenuSub.types.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/ContextMenu/components/Sub/hooks/useContextMenuSub/useContextMenuSub.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAE/E,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,IAAI,EAAE,mBAAmB,CAAC;IAC1B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,SAAS,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IAC7C;;OAEG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B;;OAEG;IACH,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B;;OAEG;IACH,gBAAgB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C;;OAEG;IACH,wBAAwB,EAAE,CAAC,CAAC,EAAE,uBAAuB,KAAK,IAAI,CAAC;IAC/D;;OAEG;IACH,gBAAgB,EAAE,CAAC,gBAAgB,EAAE,OAAO,KAAK,IAAI,CAAC;IACtD;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,UAAU,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;IACtC;;OAEG;IACH,UAAU,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;IACtC;;OAEG;IACH,WAAW,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC3E;;OAEG;IACH,aAAa,EAAE,CAAC,aAAa,EAAE,OAAO,KAAK,IAAI,CAAC;IAChD;;OAEG;IACH,oBAAoB,EAAE,MAAM,IAAI,CAAC;IACjC;;OAEG;IACH,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC;;OAEG;IACH,uBAAuB,EAAE,CAAC,oBAAoB,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACvE;;OAEG;IACH,QAAQ,EAAE,MAAM,OAAO,CAAC;IACxB;;OAEG;IACH,IAAI,EAAE,mBAAmB,CAAC;CAC3B"}
@@ -1,4 +1,4 @@
1
- import { S } from "../../../../ContextMenu-CeyT26LX.mjs";
1
+ import { S } from "../../../../ContextMenu-DFahDlEy.mjs";
2
2
  export {
3
3
  S as Sub
4
4
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useContextMenu.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/hooks/useContextMenu/useContextMenu.tsx"],"names":[],"mappings":"AAYA,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAEhC;;;GAGG;AACH,eAAO,MAAM,cAAc,YAChB,qBAAqB,KAC7B,oBAokBF,CAAC"}
1
+ {"version":3,"file":"useContextMenu.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/hooks/useContextMenu/useContextMenu.tsx"],"names":[],"mappings":"AAcA,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAEhC;;;GAGG;AACH,eAAO,MAAM,cAAc,YAChB,qBAAqB,KAC7B,oBA+lBF,CAAC"}
@@ -1,168 +1,173 @@
1
- import { useId as me, useState as f, useRef as a, useEffect as F } from "react";
2
- import { a as he, b as Ce } from "../../../../index-DBS3EIVR.mjs";
3
- import { useFocusChange as pe } 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 y } from "./utils/contextMenuBus/contextMenuBus.js";
6
- const Fe = (N) => {
6
+ import { contextMenuBus as h } from "./utils/contextMenuBus/contextMenuBus.js";
7
+ const De = (X) => {
7
8
  const {
8
- mode: Q,
9
- defaultOpen: k,
10
- animationDuration: h,
9
+ mode: Y,
10
+ defaultOpen: x,
11
+ animationDuration: C,
11
12
  hoverCloseDelay: H,
12
- isOpen: p,
13
+ isOpen: R,
13
14
  onOpen: s,
14
15
  onAnimatedOpen: V,
15
16
  onAiming: B,
16
- onFocusOutside: U,
17
- aimingTolerance: X,
18
- aimingIdleTimeout: Y
19
- } = N, I = me(), [o, M] = f(
20
- p ?? k ?? !1
21
- ), [D, l] = f(!1), [Z, x] = f(!1), [K, R] = f(!1), [q, L] = f(!1), [W, _] = f(!1), [$, ee] = f(null), [te, E] = f(!1), [j, ne] = f(null), d = a(!1), w = a(null), n = a(null), u = a(null), P = a(!1), r = a(!1), T = a(null), g = a(!1), b = a(U), c = he() ? i.CLICK : Q, O = () => {
22
- n.current && (clearTimeout(n.current), n.current = null), u.current && (clearTimeout(u.current), u.current = null), T.current && (clearTimeout(T.current), T.current = null);
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);
23
24
  }, m = () => {
24
- O(), r.current = !1, M(!1), s == null || s(!1), R(!1), d.current = !1, E(!1);
25
- }, re = (e) => {
26
- B == null || B(e), !e && r.current && !d.current && !g.current && (r.current = !1, l(!1), u.current = setTimeout(() => {
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(() => {
27
28
  m();
28
- }, h));
29
- }, { isAiming: v, ref: A } = Ce({
30
- isEnabled: o && c === i.HOVER,
31
- onChange: re,
32
- tolerance: X,
33
- idleTimeout: Y
34
- }), se = () => g.current, ue = (e) => {
35
- g.current = e, !e && r.current && !d.current && !v() && (r.current = !1, l(!1), u.current = setTimeout(() => {
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(() => {
36
37
  m();
37
- }, h));
38
- }, z = () => {
39
- if (O(), x(!1), c === i.HOVER) {
40
- if (W && $ === i.CLICK || j !== null)
38
+ }, C));
39
+ }, J = () => {
40
+ if (b(), q(!1), u === i.HOVER) {
41
+ if (j && ne === i.CLICK || w !== null)
41
42
  return;
42
43
  if (K) {
43
- l(!1), u.current = setTimeout(() => {
44
+ f(!1), c.current = setTimeout(() => {
44
45
  m();
45
- }, h);
46
+ }, C);
46
47
  return;
47
48
  }
48
- r.current = !0, !v() && !g.current && (r.current = !1, l(!1), u.current = setTimeout(() => {
49
+ r.current = !0, !v() && !O.current && (r.current = !1, f(!1), c.current = setTimeout(() => {
49
50
  m();
50
- }, h));
51
+ }, C));
51
52
  } else
52
53
  m();
53
- }, S = ({
54
+ }, k = ({
54
55
  preventFocusRestore: e = !1,
55
56
  skipAnimationFlag: t = !1
56
57
  }) => {
57
- P.current = e, O(), r.current = !1, x(t), l(!1), M(!1), s == null || s(!1), R(!1), d.current = !1, E(!1);
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);
58
59
  };
59
- F(() => {
60
- o || (P.current = !1);
61
- }, [o]);
62
- const oe = (e) => {
63
- E(e);
64
- }, G = (e) => {
65
- if (!(c === i.CLICK && k !== void 0)) {
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)) {
66
67
  if (e) {
67
- u.current && (clearTimeout(u.current), u.current = null), r.current && (O(), r.current = !1), c === i.HOVER && l(!0), M(!0), s == null || s(!0), p !== !1 && y.emit({
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({
68
69
  id: I,
69
70
  isAiming: v
70
71
  });
71
72
  return;
72
73
  }
73
- c === i.HOVER ? z() : m();
74
+ u === i.HOVER ? J() : m();
74
75
  }
75
- }, ce = (e) => {
76
- L(e), G(e);
77
- }, ie = () => {
76
+ }, fe = (e) => {
77
+ L(e), N(e);
78
+ }, Q = () => {
78
79
  var e, t;
79
- c !== i.HOVER || (t = (e = y).isAiming) != null && t.call(e) && y.activeMenuId !== I || (L(!1), O(), r.current = !1, o ? (R(!0), d.current = !0, l(!0)) : (n.current && (clearTimeout(n.current), n.current = null), l(!0), M(!0), s == null || s(!0), R(!0), d.current = !0, T.current = setTimeout(() => {
80
- T.current = null, p !== !1 && y.emit({
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({
81
82
  id: I,
82
83
  isAiming: v
83
84
  });
84
85
  }, 0)));
85
- }, le = () => {
86
- c === i.HOVER && (L(!1), R(!1), d.current = !1, n.current && (clearTimeout(n.current), n.current = null), r.current && !v() && !g.current && (r.current = !1, l(!1), u.current = setTimeout(() => {
86
+ };
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(() => {
87
90
  m();
88
- }, h)));
89
- }, fe = (e, t) => {
90
- e || E(!1), _(e), ee(t);
91
+ }, C)));
92
+ }, de = (e, t) => {
93
+ e || A(!1), te(e), re(t);
91
94
  };
92
- F(() => p === !1 ? void 0 : y.subscribe(({ id: t }) => {
93
- t !== I && S({
95
+ E(() => R === !1 ? void 0 : h.subscribe(({ id: t }) => {
96
+ t !== I && k({
94
97
  preventFocusRestore: !0,
95
98
  skipAnimationFlag: !0
96
99
  });
97
- }), [I, p]), F(() => {
98
- !o || c !== i.HOVER || q || (K ? n.current && (clearTimeout(n.current), n.current = null) : n.current || (n.current = setTimeout(() => {
99
- z();
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();
100
105
  }, H)));
101
- }, [c, o, K, H, q]), F(() => {
106
+ }, [u, l, K, H, W]), E(() => {
102
107
  V == null || V(D);
103
108
  }, [D]);
104
- const ae = () => {
109
+ const me = () => {
105
110
  const e = [];
106
- A.current && e.push(A.current);
111
+ F.current && e.push(F.current);
107
112
  const t = Array.from(
108
113
  document.querySelectorAll("[data-menu-level]")
109
114
  );
110
115
  return e.push(...t), e;
111
116
  };
112
- return pe({
113
- elements: o ? [A, w] : [],
114
- enabled: o,
117
+ return Ie({
118
+ elements: l ? [F, z] : [],
119
+ enabled: l,
115
120
  onFocusOutside: (e) => {
116
- var J;
121
+ var U;
117
122
  const t = e.target;
118
- if (!o || t === document.body)
123
+ if (!l || t === document.body)
119
124
  return;
120
- if (!ae().some((C) => t ? C === t || C.contains(t) : !1)) {
121
- let C = !1;
122
- const de = {
125
+ if (!me().some((p) => t ? p === t || p.contains(t) : !1)) {
126
+ let p = !1;
127
+ const he = {
123
128
  target: t,
124
129
  preventDefault: () => {
125
- C = !0;
130
+ p = !0;
126
131
  },
127
132
  get defaultPrevented() {
128
- return C;
133
+ return p;
129
134
  }
130
135
  };
131
- if ((J = b.current) == null || J.call(b, de), C)
136
+ if ((U = M.current) == null || U.call(M, he), p)
132
137
  return;
133
- S({ preventFocusRestore: !0 });
138
+ k({ preventFocusRestore: !0 });
134
139
  }
135
140
  }
136
141
  }), {
137
- isOpen: o,
138
- mode: c,
139
- onOpenChange: G,
140
- onOpenByKeyboard: ce,
141
- triggerRef: w,
142
- contentRef: A,
142
+ isOpen: l,
143
+ mode: u,
144
+ onOpenChange: N,
145
+ onOpenByKeyboard: fe,
146
+ triggerRef: z,
147
+ contentRef: F,
143
148
  isAnimatedOpen: D,
144
- skipAnimation: Z,
145
- animationDuration: h,
149
+ skipAnimation: ee,
150
+ animationDuration: C,
146
151
  hoverCloseDelay: H,
147
152
  closeMenuImmediately: (e) => {
148
- S({ preventFocusRestore: e });
153
+ k({ preventFocusRestore: e });
149
154
  },
150
- onContentEnter: ie,
151
- onContentLeave: le,
152
- onChildOpen: fe,
153
- onSubmenuOpen: oe,
154
- isRootContentBlocked: te,
155
- isChildOpen: W,
156
- itemWithFocusedInput: j,
157
- setItemWithFocusedInput: ne,
155
+ onContentEnter: Q,
156
+ onContentLeave: ae,
157
+ onChildOpen: de,
158
+ onSubmenuOpen: le,
159
+ isRootContentBlocked: se,
160
+ isChildOpen: j,
161
+ itemWithFocusedInput: w,
162
+ setItemWithFocusedInput: ue,
158
163
  shouldPreventFocusRestore: () => P.current,
159
164
  setOnFocusOutside: (e) => {
160
- b.current = e;
165
+ M.current = e;
161
166
  },
162
- isChildAiming: se,
163
- onChildAiming: ue
167
+ isChildAiming: oe,
168
+ onChildAiming: ie
164
169
  };
165
170
  };
166
171
  export {
167
- Fe as useContextMenu
172
+ De as useContextMenu
168
173
  };
@@ -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-CeyT26LX.mjs";
1
+ import { C as t } from "../../ContextMenu-DFahDlEy.mjs";
2
2
  export {
3
3
  t as ContextMenu
4
4
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kommo-crm/crm-react-ui-kit",
3
3
  "description": "Ready-to-use React components which implements Kommo design",
4
- "version": "1.3.0-beta.2",
4
+ "version": "1.3.0-beta.4",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "engines": {
@@ -221,4 +221,4 @@
221
221
  "react-dom": "^18.0"
222
222
  },
223
223
  "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
224
- }
224
+ }