@kommo-crm/crm-react-ui-kit 1.1.1-beta.6 → 1.1.1-beta.8

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 (70) hide show
  1. package/dist/components/ContextMenu/ContextMenu.context.d.ts +4 -2
  2. package/dist/components/ContextMenu/ContextMenu.context.d.ts.map +1 -1
  3. package/dist/components/ContextMenu/ContextMenu.context.js +7 -4
  4. package/dist/components/ContextMenu/ContextMenu.d.ts.map +1 -1
  5. package/dist/components/ContextMenu/ContextMenu.js +102 -90
  6. package/dist/components/ContextMenu/ContextMenu.props.d.ts +22 -0
  7. package/dist/components/ContextMenu/ContextMenu.props.d.ts.map +1 -1
  8. package/dist/components/ContextMenu/components/Arrow/Arrow.js +1 -1
  9. package/dist/components/ContextMenu/components/CheckboxItem/CheckboxItem.d.ts +1 -0
  10. package/dist/components/ContextMenu/components/CheckboxItem/CheckboxItem.d.ts.map +1 -1
  11. package/dist/components/ContextMenu/components/CheckboxItem/CheckboxItem.js +45 -40
  12. package/dist/components/ContextMenu/components/CheckboxItem/CheckboxItem.props.d.ts +4 -0
  13. package/dist/components/ContextMenu/components/CheckboxItem/CheckboxItem.props.d.ts.map +1 -1
  14. package/dist/components/ContextMenu/components/Content/Content.d.ts.map +1 -1
  15. package/dist/components/ContextMenu/components/Content/Content.js +2 -2
  16. package/dist/components/ContextMenu/components/Content/index.js +1 -1
  17. package/dist/components/ContextMenu/components/Group/Group.js +1 -1
  18. package/dist/components/ContextMenu/components/Item/Item.d.ts.map +1 -1
  19. package/dist/components/ContextMenu/components/Item/Item.js +80 -75
  20. package/dist/components/ContextMenu/components/Item/Item.props.d.ts +6 -0
  21. package/dist/components/ContextMenu/components/Item/Item.props.d.ts.map +1 -1
  22. package/dist/components/ContextMenu/components/ItemIndicator/ItemIndicator.js +1 -1
  23. package/dist/components/ContextMenu/components/Label/Label.js +1 -1
  24. package/dist/components/ContextMenu/components/Portal/Portal.js +1 -1
  25. package/dist/components/ContextMenu/components/RadioGroup/RadioGroup.js +1 -1
  26. package/dist/components/ContextMenu/components/RadioItem/RadioItem.d.ts +1 -0
  27. package/dist/components/ContextMenu/components/RadioItem/RadioItem.d.ts.map +1 -1
  28. package/dist/components/ContextMenu/components/RadioItem/RadioItem.js +50 -45
  29. package/dist/components/ContextMenu/components/RadioItem/RadioItem.props.d.ts +4 -0
  30. package/dist/components/ContextMenu/components/RadioItem/RadioItem.props.d.ts.map +1 -1
  31. package/dist/components/ContextMenu/components/Separator/Separator.js +1 -1
  32. package/dist/components/ContextMenu/components/Sub/Sub.d.ts +5 -5
  33. package/dist/components/ContextMenu/components/Sub/Sub.d.ts.map +1 -1
  34. package/dist/components/ContextMenu/components/Sub/Sub.js +54 -55
  35. package/dist/components/ContextMenu/components/Sub/Sub.types.d.ts +7 -0
  36. package/dist/components/ContextMenu/components/Sub/Sub.types.d.ts.map +1 -0
  37. package/dist/components/ContextMenu/components/Sub/Sub.types.js +1 -0
  38. package/dist/components/ContextMenu/components/Sub/index.d.ts +1 -0
  39. package/dist/components/ContextMenu/components/Sub/index.d.ts.map +1 -1
  40. package/dist/components/ContextMenu/components/SubContent/SubContent.d.ts.map +1 -1
  41. package/dist/components/ContextMenu/components/SubContent/SubContent.js +26 -25
  42. package/dist/components/ContextMenu/components/SubRoot/SubRoot.d.ts.map +1 -1
  43. package/dist/components/ContextMenu/components/SubRoot/SubRoot.js +71 -66
  44. package/dist/components/ContextMenu/components/SubRoot/SubRoot.props.d.ts +8 -0
  45. package/dist/components/ContextMenu/components/SubRoot/SubRoot.props.d.ts.map +1 -1
  46. package/dist/components/ContextMenu/components/SubRoot/components/Content/Content.js +2 -2
  47. package/dist/components/ContextMenu/components/SubRoot/components/Trigger/Trigger.d.ts.map +1 -1
  48. package/dist/components/ContextMenu/components/SubRoot/components/Trigger/Trigger.js +38 -40
  49. package/dist/components/ContextMenu/components/SubTrigger/SubTrigger.js +3 -3
  50. package/dist/components/ContextMenu/components/Trigger/Trigger.js +1 -1
  51. package/dist/components/ContextMenu/hooks/index.js +1 -1
  52. package/dist/components/ContextMenu/hooks/useContentPositioning/useContentPositioning.js +1 -1
  53. package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.d.ts +2 -1
  54. package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.d.ts.map +1 -1
  55. package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.js +72 -61
  56. package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.types.d.ts +4 -0
  57. package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.types.d.ts.map +1 -1
  58. package/dist/components/ContextMenu/hooks/useContextMenuSub/useContextMenuSub.d.ts.map +1 -1
  59. package/dist/components/ContextMenu/hooks/useContextMenuSub/useContextMenuSub.js +51 -49
  60. package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.d.ts +1 -1
  61. package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.d.ts.map +1 -1
  62. package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.js +71 -63
  63. package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.types.d.ts +4 -0
  64. package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.types.d.ts.map +1 -1
  65. package/dist/components/ContextMenu/index.d.ts +1 -0
  66. package/dist/components/ContextMenu/index.d.ts.map +1 -1
  67. package/dist/components/ContextMenu/index.js +1 -1
  68. package/dist/{index-BA3njR2k.mjs → index-CYWNqEqR.mjs} +1 -1
  69. package/dist/{useContentPositioning-DO7ZotnD.mjs → useContentPositioning-BLEFxO0N.mjs} +66 -65
  70. package/package.json +1 -1
@@ -1,73 +1,84 @@
1
- import { useId as z, useState as f, useRef as d, useEffect as x } from "react";
2
- import { ContextMenuMode as o } from "../../ContextMenu.enums.js";
1
+ import { useId as N, useState as n, useRef as C, useEffect as R } from "react";
2
+ import { ContextMenuMode as l } from "../../ContextMenu.enums.js";
3
3
  import "../../providers/LevelProvider/LevelProvider.js";
4
- import { useInheritedArrowColor as D } from "../useInheritedArrowColor/useInheritedArrowColor.js";
5
- import "../../../../useContentPositioning-DO7ZotnD.mjs";
6
- import "../../components/Content/Content.utils.js";
7
4
  import "../../ContextMenu.context.js";
8
- import { useIsTouchDevice as F } from "../useIsTouchDevice/useIsTouchDevice.js";
9
- import { contextMenuBus as h } from "../../utils/contextMenuBus/contextMenuBus.js";
10
- const _ = ({
11
- mode: B,
12
- defaultOpen: R,
13
- animationDuration: I,
14
- hoverCloseDelay: T,
15
- onOpen: r
5
+ import { useInheritedArrowColor as P } from "../useInheritedArrowColor/useInheritedArrowColor.js";
6
+ import "../../../../useContentPositioning-BLEFxO0N.mjs";
7
+ import "../../components/Content/Content.utils.js";
8
+ import { useIsTouchDevice as Q } from "../useIsTouchDevice/useIsTouchDevice.js";
9
+ import { contextMenuBus as M } from "../../utils/contextMenuBus/contextMenuBus.js";
10
+ const re = ({
11
+ mode: L,
12
+ defaultOpen: y,
13
+ animationDuration: E,
14
+ hoverCloseDelay: d,
15
+ onOpen: r,
16
+ onAnimatedOpen: T
16
17
  }) => {
17
- const a = z(), [i, m] = f(R || !1), [L, c] = f(!1), [M, n] = f(!1), [y, C] = f(!1), [s, b] = f(!1), A = d(null), E = d(null), e = d(null), t = d(null), u = F() ? o.CLICK : B, H = () => {
18
+ const a = N(), [f, m] = n(y || !1), [h, o] = n(!1), [H, i] = n(!1), [v, b] = n(!1), [u, I] = n(!1), [p, w] = n(!1), q = C(null), K = C(null), e = C(null), t = C(null), s = Q() ? l.CLICK : L, V = () => {
18
19
  e.current && (clearTimeout(e.current), e.current = null), t.current && (clearTimeout(t.current), t.current = null);
19
- }, v = () => {
20
- m(!1), r == null || r(!1), n(!1), b(!1);
21
- }, K = () => {
22
- H(), u === o.HOVER || s ? (c(!1), t.current = setTimeout(() => {
23
- v();
24
- }, I)) : v();
25
- }, V = () => {
26
- H(), c(!1), m(!1), r == null || r(!1), n(!1), b(!1);
27
- }, g = (l) => {
28
- u === o.CLICK && R !== void 0 || (l ? (t.current && (clearTimeout(t.current), t.current = null), (u === o.HOVER || s) && c(!0), m(!0), r == null || r(!0), setTimeout(() => h.emit(a), 0)) : K());
29
- }, p = (l) => {
30
- C(l), g(l);
31
- }, w = () => {
32
- u !== o.HOVER && !s || (C(!1), t.current && (clearTimeout(t.current), t.current = null, c(!0)), i ? n(!0) : (e.current && (clearTimeout(e.current), e.current = null), c(!0), m(!0), r == null || r(!0), n(!0), setTimeout(() => h.emit(a), 0)));
33
- }, q = () => {
34
- u !== o.HOVER && !s || (C(!1), e.current && (clearTimeout(e.current), e.current = null), n(!1));
35
- }, S = () => {
36
- c(!0), n(!0), b(!0);
20
+ }, g = () => {
21
+ m(!1), r == null || r(!1), i(!1), I(!1);
22
+ }, k = () => {
23
+ if (V(), s === l.HOVER || u) {
24
+ if (p)
25
+ return;
26
+ o(!1), t.current = setTimeout(() => {
27
+ g();
28
+ }, E);
29
+ } else
30
+ g();
31
+ }, x = () => {
32
+ V(), o(!1), m(!1), r == null || r(!1), i(!1), I(!1);
33
+ }, B = (c) => {
34
+ s === l.CLICK && y !== void 0 || (c ? (t.current && (clearTimeout(t.current), t.current = null), (s === l.HOVER || u) && o(!0), m(!0), r == null || r(!0), setTimeout(() => M.emit(a), 0)) : k());
35
+ }, S = (c) => {
36
+ b(c), B(c);
37
+ }, j = () => {
38
+ s !== l.HOVER && !u || (b(!1), t.current && (clearTimeout(t.current), t.current = null, o(!0)), f ? i(!0) : (e.current && (clearTimeout(e.current), e.current = null), o(!0), m(!0), r == null || r(!0), i(!0), setTimeout(() => M.emit(a), 0)));
39
+ }, z = () => {
40
+ s !== l.HOVER && !u || (b(!1), i(!1), e.current && (clearTimeout(e.current), e.current = null));
41
+ }, D = () => {
42
+ o(!0), i(!0), I(!0);
43
+ }, F = (c) => {
44
+ w(c);
37
45
  };
38
- x(() => h.subscribe((k) => {
39
- k !== a && V();
40
- }), [a]), x(() => {
41
- !i || u !== o.HOVER && !s || y || (M ? e.current && (clearTimeout(e.current), e.current = null) : e.current || (e.current = setTimeout(() => {
42
- K();
43
- }, T)));
46
+ R(() => M.subscribe((J) => {
47
+ J !== a && x();
48
+ }), [a]), R(() => {
49
+ !f || s !== l.HOVER && !u || v || (H ? e.current && (clearTimeout(e.current), e.current = null) : e.current || (e.current = setTimeout(() => {
50
+ k();
51
+ }, d)));
44
52
  }, [
45
- u,
46
- i,
47
- M,
48
53
  s,
49
- T,
50
- y
51
- ]);
52
- const j = D(i, E);
54
+ f,
55
+ H,
56
+ u,
57
+ d,
58
+ v
59
+ ]), R(() => {
60
+ T == null || T(h);
61
+ }, [h]);
62
+ const G = P(f, K);
53
63
  return {
54
- open: i,
55
- mode: u,
56
- onOpenChange: g,
57
- onOpenByKeyboard: p,
58
- inheritedArrowColor: j,
59
- triggerRef: A,
60
- contentRef: E,
61
- animatedOpen: L,
62
- animationDuration: I,
63
- hoverCloseDelay: T,
64
- temporaryHoverClose: s,
65
- closeMenuImmediately: V,
66
- onMouseEnter: w,
67
- onMouseLeave: q,
68
- enableTemporaryHoverClose: S
64
+ open: f,
65
+ mode: s,
66
+ onOpenChange: B,
67
+ onOpenByKeyboard: S,
68
+ inheritedArrowColor: G,
69
+ triggerRef: q,
70
+ contentRef: K,
71
+ animatedOpen: h,
72
+ animationDuration: E,
73
+ hoverCloseDelay: d,
74
+ temporaryHoverClose: u,
75
+ closeMenuImmediately: x,
76
+ onMouseEnter: j,
77
+ onMouseLeave: z,
78
+ enableTemporaryHoverClose: D,
79
+ onChildClickOpen: F
69
80
  };
70
81
  };
71
82
  export {
72
- _ as useContextMenu
83
+ re as useContextMenu
73
84
  };
@@ -21,6 +21,10 @@ export interface UseContextMenuOptions {
21
21
  * The callback function to be called when the context menu is opened.
22
22
  */
23
23
  onOpen?: (open: boolean) => void;
24
+ /**
25
+ * The callback function to be called when the context menu is animated open.
26
+ */
27
+ onAnimatedOpen?: (open: boolean) => void;
24
28
  /**
25
29
  * Whether the context menu should close when another menu is opened.
26
30
  */
@@ -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,eAAe,EAAE,MAAM,OAAO,CAAC;AAExC,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,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC"}
1
+ {"version":3,"file":"useContextMenu.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/hooks/useContextMenu/useContextMenu.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAExC,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,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useContextMenuSub.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/hooks/useContextMenuSub/useContextMenuSub.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAErE,wBAAgB,iBAAiB,CAAC,EAChC,WAAW,EACX,IAAI,EAAE,WAAW,EACjB,WAAW,EACX,MAAM,GACP,EAAE,wBAAwB;;;;;;;8BA4EQ,OAAO;8BAsCP,OAAO;;EA6GzC"}
1
+ {"version":3,"file":"useContextMenuSub.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/hooks/useContextMenuSub/useContextMenuSub.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAErE,wBAAgB,iBAAiB,CAAC,EAChC,WAAW,EACX,IAAI,EAAE,WAAW,EACjB,WAAW,EACX,MAAM,GACP,EAAE,wBAAwB;;;;;;;8BA8EQ,OAAO;8BAsCP,OAAO;;EAyHzC"}
@@ -1,67 +1,69 @@
1
- import { useId as A, useState as n, useRef as M, useEffect as v } from "react";
2
- import { ContextMenuMode as a } from "../../ContextMenu.enums.js";
3
- import { useLevelContext as S } from "../../providers/LevelProvider/LevelProvider.js";
4
- import "../../../../useContentPositioning-DO7ZotnD.mjs";
1
+ import { useId as S, useState as C, useRef as v, useEffect as I } from "react";
2
+ import { ContextMenuMode as c } from "../../ContextMenu.enums.js";
3
+ import { useLevelContext as q } from "../../providers/LevelProvider/LevelProvider.js";
4
+ import { useContextMenuContext as j, useContextMenuRootContext as w } from "../../ContextMenu.context.js";
5
+ import "../../../../useContentPositioning-BLEFxO0N.mjs";
5
6
  import "../../components/Content/Content.utils.js";
6
- import { useIsTouchDevice as q } from "../useIsTouchDevice/useIsTouchDevice.js";
7
- import { useContextMenuContext as j } from "../../ContextMenu.context.js";
8
- function Q({
9
- displayName: d,
10
- mode: H,
11
- defaultOpen: c,
7
+ import { useIsTouchDevice as z } from "../useIsTouchDevice/useIsTouchDevice.js";
8
+ function X({
9
+ displayName: T,
10
+ mode: y,
11
+ defaultOpen: l,
12
12
  onOpen: e
13
13
  }) {
14
- const C = A(), [o, u] = n(c || !1), [K, s] = n(!1), [T, m] = n(!1), [I, i] = n(!1), r = M(null), t = M(null), V = q(), { hoverCloseDelay: h, animationDuration: b } = j(d), { activeItemId: R } = S(d), l = V ? a.CLICK : H, E = () => {
15
- r.current && (clearTimeout(r.current), r.current = null), t.current && (clearTimeout(t.current), t.current = null);
14
+ const d = S(), [s, i] = C(l || !1), [H, f] = C(!1), [R, m] = C(!1), [x, o] = C(!1), t = v(null), r = v(null), V = z(), { hoverCloseDelay: E, animationDuration: b } = j(T), { onChildClickOpen: n } = w(T), { activeItemId: K } = q(T), u = V ? c.CLICK : y, M = () => {
15
+ t.current && (clearTimeout(t.current), t.current = null), r.current && (clearTimeout(r.current), r.current = null);
16
16
  }, D = () => {
17
- E(), s(!1), u(!1), e == null || e(!1), m(!1), i(!1);
18
- }, x = () => {
19
- E(), l === a.HOVER ? (s(!1), t.current = setTimeout(() => {
20
- u(!1), e == null || e(!1), m(!1), i(!1);
21
- }, b)) : (u(!1), e == null || e(!1), m(!1), i(!1));
22
- }, y = (f) => {
23
- if (c !== void 0) {
24
- u(c), e == null || e(c), s(c), i(!1);
17
+ M(), f(!1), i(!1), e == null || e(!1), m(!1), o(!1);
18
+ }, h = () => {
19
+ M(), u === c.HOVER ? (f(!1), r.current = setTimeout(() => {
20
+ i(!1), e == null || e(!1), m(!1), o(!1);
21
+ }, b)) : (i(!1), e == null || e(!1), m(!1), o(!1));
22
+ }, L = (a) => {
23
+ if (l !== void 0) {
24
+ i(l), e == null || e(l), f(l), o(!1);
25
25
  return;
26
26
  }
27
- if (l === a.CLICK) {
28
- u(f), e == null || e(f), s(f);
27
+ if (u === c.CLICK) {
28
+ i(a), e == null || e(a), f(a);
29
29
  return;
30
30
  }
31
- f ? (t.current && (clearTimeout(t.current), t.current = null), l === a.HOVER && s(!0), u(!0), e == null || e(!0)) : x();
32
- }, L = (f) => {
33
- i(f), y(f);
34
- }, g = () => {
35
- l === a.HOVER && (i(!1), t.current && (clearTimeout(t.current), t.current = null, s(!0)), o || (r.current && (clearTimeout(r.current), r.current = null), s(!0), e == null || e(!0), u(!0)), m(!0));
31
+ a ? (r.current && (clearTimeout(r.current), r.current = null), u === c.HOVER && f(!0), i(!0), e == null || e(!0)) : h();
32
+ }, g = (a) => {
33
+ o(a), L(a);
36
34
  }, B = () => {
37
- l === a.HOVER && (i(!1), r.current && (clearTimeout(r.current), r.current = null), m(!1));
35
+ u === c.HOVER && (o(!1), r.current && (clearTimeout(r.current), r.current = null, f(!0)), s || (t.current && (clearTimeout(t.current), t.current = null), f(!0), e == null || e(!0), i(!0)), m(!0));
36
+ }, A = () => {
37
+ u === c.HOVER && (o(!1), t.current && (clearTimeout(t.current), t.current = null), m(!1));
38
38
  };
39
- return v(() => {
40
- R !== C && o && c === void 0 && D();
41
- }, [R, o, c]), v(() => {
42
- if (!(!o || l !== a.HOVER) && !I) {
43
- if (T) {
44
- r.current && (clearTimeout(r.current), r.current = null);
39
+ return I(() => {
40
+ K !== d && s && l === void 0 && D();
41
+ }, [K, s, l]), I(() => {
42
+ if (!(!s || u !== c.HOVER) && !x) {
43
+ if (R) {
44
+ t.current && (clearTimeout(t.current), t.current = null);
45
45
  return;
46
46
  }
47
- return r.current || (r.current = setTimeout(() => {
48
- x();
49
- }, h)), () => {
50
- r.current && (clearTimeout(r.current), r.current = null);
47
+ return t.current || (t.current = setTimeout(() => {
48
+ h();
49
+ }, E)), () => {
50
+ t.current && (clearTimeout(t.current), t.current = null);
51
51
  };
52
52
  }
53
- }, [l, o, T, h, I]), {
54
- open: o,
55
- setOpen: u,
56
- animatedOpen: K,
57
- startAnimation: () => s(!0),
58
- handleMouseEnter: g,
59
- handleMouseLeave: B,
60
- handleOpenChange: y,
61
- onOpenByKeyboard: L,
62
- triggerId: C
53
+ }, [u, s, R, E, x]), I(() => {
54
+ u === c.CLICK && s ? n == null || n(!0) : u === c.CLICK && !s && (n == null || n(!1));
55
+ }, [s, u]), {
56
+ open: s,
57
+ setOpen: i,
58
+ animatedOpen: H,
59
+ startAnimation: () => f(!0),
60
+ handleMouseEnter: B,
61
+ handleMouseLeave: A,
62
+ handleOpenChange: L,
63
+ onOpenByKeyboard: g,
64
+ triggerId: d
63
65
  };
64
66
  }
65
67
  export {
66
- Q as useContextMenuSub
68
+ X as useContextMenuSub
67
69
  };
@@ -1,6 +1,6 @@
1
1
  import { ContextMenuMode } from '../../ContextMenu.enums';
2
2
  import { UseContextMenuSubMenuOptions } from './useContextMenuSubMenu.types';
3
- export declare const useContextMenuSubMenu: ({ displayName, mode: rootMode, defaultOpen, animationDuration, subMenuOpen, setSubMenuOpen, hoverCloseDelay, closeRootMenuImmediately, onOpen, }: UseContextMenuSubMenuOptions) => {
3
+ export declare const useContextMenuSubMenu: ({ displayName, mode: rootMode, defaultOpen, animationDuration, subMenuOpen, setSubMenuOpen, hoverCloseDelay, closeRootMenuImmediately, onOpen, onAnimatedOpen, }: UseContextMenuSubMenuOptions) => {
4
4
  open: boolean;
5
5
  mode: "click" | "hover" | ContextMenuMode;
6
6
  onOpenChange: (value: boolean) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"useContextMenuSubMenu.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAI1D,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAE7E,eAAO,MAAM,qBAAqB,qJAU/B,4BAA4B;;;0BAyFI,OAAO;8BAyBP,OAAO;;;;;;;;2CAzCK,OAAO;;;;;CA4KrD,CAAC"}
1
+ {"version":3,"file":"useContextMenuSubMenu.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAM1D,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAE7E,eAAO,MAAM,qBAAqB,qKAW/B,4BAA4B;;;0BA2FI,OAAO;8BA6BP,OAAO;;;;;;;;2CA7CK,OAAO;;;;;CAuLrD,CAAC"}
@@ -1,72 +1,80 @@
1
- import { useId as Q, useState as C, useRef as v, useLayoutEffect as U, useEffect as R } from "react";
2
- import { ContextMenuMode as a } from "../../ContextMenu.enums.js";
3
- import { useInheritedArrowColor as W } from "../useInheritedArrowColor/useInheritedArrowColor.js";
4
- import "../../../../useContentPositioning-DO7ZotnD.mjs";
1
+ import { useId as $, useState as m, useRef as H, useLayoutEffect as k, useEffect as g } from "react";
2
+ import { ContextMenuMode as u } from "../../ContextMenu.enums.js";
3
+ import { useInheritedArrowColor as y } from "../useInheritedArrowColor/useInheritedArrowColor.js";
4
+ import "../../../../useContentPositioning-BLEFxO0N.mjs";
5
5
  import "../../components/Content/Content.utils.js";
6
- import "../../ContextMenu.context.js";
7
- import { useLevelContext as X } from "../../providers/LevelProvider/LevelProvider.js";
8
- import { useIsTouchDevice as Y } from "../useIsTouchDevice/useIsTouchDevice.js";
9
- const tr = ({
10
- displayName: j,
11
- mode: k,
12
- defaultOpen: K,
13
- animationDuration: V,
14
- subMenuOpen: m,
6
+ import { useContextMenuRootContext as A } from "../../ContextMenu.context.js";
7
+ import { useLevelContext as N } from "../../providers/LevelProvider/LevelProvider.js";
8
+ import { useIsTouchDevice as n } from "../useIsTouchDevice/useIsTouchDevice.js";
9
+ const er = ({
10
+ displayName: B,
11
+ mode: J,
12
+ defaultOpen: I,
13
+ animationDuration: w,
14
+ subMenuOpen: C,
15
15
  setSubMenuOpen: t,
16
- hoverCloseDelay: E,
17
- closeRootMenuImmediately: u,
18
- onOpen: e
16
+ hoverCloseDelay: d,
17
+ closeRootMenuImmediately: a,
18
+ onOpen: c,
19
+ onAnimatedOpen: x
19
20
  }) => {
20
- const H = Q(), [i, y] = C(m || K || !1), [g, l] = C(!1), [x, T] = C(!1), [z, h] = C(!1), [o, L] = C(!1), { activeItemId: n } = X(j), D = v(null), A = v(null), r = v(null), c = v(null), f = Y() ? a.CLICK : k, B = () => {
21
- r.current && (clearTimeout(r.current), r.current = null), c.current && (clearTimeout(c.current), c.current = null);
22
- }, I = (s = !1) => {
23
- t == null || t(!1), y(!1), e == null || e(!1), T(!1), L(!1), s && (u == null || u());
24
- }, w = () => {
25
- B(), f === a.HOVER || o ? (l(!1), c.current = setTimeout(() => {
26
- I();
27
- }, V)) : I();
28
- }, q = (s = !1) => {
29
- B(), l(!1), t == null || t(!1), e == null || e(!1), T(!1), L(!1), s && (u == null || u());
30
- }, d = (s) => {
31
- f === a.CLICK && K !== void 0 || (s ? (c.current && (clearTimeout(c.current), c.current = null), (f === a.HOVER || o) && l(!0), t == null || t(!0), e == null || e(!0)) : w());
32
- }, F = (s) => {
33
- h(s), d == null || d(s);
34
- }, G = () => {
35
- h(!1), !(f !== a.HOVER && !o) && (c.current && (clearTimeout(c.current), c.current = null, l(!0)), i || (r.current && (clearTimeout(r.current), r.current = null), l(!0), t == null || t(!0), e == null || e(!0)), T(!0));
36
- }, J = () => {
37
- h(!1), !(f !== a.HOVER && !o) && (r.current && (clearTimeout(r.current), r.current = null), T(!1));
38
- }, N = () => {
39
- l(!0), T(!0), L(!0);
21
+ const L = $(), [o, P] = m(C || I || !1), [v, i] = m(!1), [R, T] = m(!1), [Q, h] = m(!1), [l, K] = m(!1), { activeItemId: q } = N(B), { onChildClickOpen: V } = A(B), U = H(null), j = H(null), r = H(null), f = H(null), s = n() ? u.CLICK : J, z = () => {
22
+ r.current && (clearTimeout(r.current), r.current = null), f.current && (clearTimeout(f.current), f.current = null);
23
+ }, D = (e = !1) => {
24
+ t == null || t(!1), P(!1), c == null || c(!1), T(!1), K(!1), e && (a == null || a());
25
+ }, F = () => {
26
+ z(), s === u.HOVER || l ? (i(!1), f.current = setTimeout(() => {
27
+ D();
28
+ }, w)) : D();
29
+ }, G = (e = !1) => {
30
+ z(), i(!1), t == null || t(!1), c == null || c(!1), T(!1), K(!1), e && (a == null || a());
31
+ }, E = (e) => {
32
+ if (s === u.CLICK) {
33
+ if (I !== void 0)
34
+ return;
35
+ V == null || V(e);
36
+ }
37
+ e ? (f.current && (clearTimeout(f.current), f.current = null), (s === u.HOVER || l) && i(!0), t == null || t(!0), c == null || c(!0)) : F();
38
+ }, W = (e) => {
39
+ h(e), E == null || E(e);
40
+ }, X = () => {
41
+ h(!1), !(s !== u.HOVER && !l) && (f.current && (clearTimeout(f.current), f.current = null, i(!0)), o || (r.current && (clearTimeout(r.current), r.current = null), i(!0), t == null || t(!0), c == null || c(!0)), T(!0));
42
+ }, Y = () => {
43
+ h(!1), !(s !== u.HOVER && !l) && (r.current && (clearTimeout(r.current), r.current = null), T(!1));
44
+ }, Z = () => {
45
+ i(!0), T(!0), K(!0);
40
46
  };
41
- U(() => {
42
- m !== void 0 && l(m);
43
- }, [m]), R(() => {
44
- n !== H && (i || m) && q();
45
- }, [n, i, H]), R(() => {
46
- !i && !g || f !== a.HOVER && !o || z || (x ? r.current && (clearTimeout(r.current), r.current = null) : r.current || (r.current = setTimeout(() => {
47
- w();
48
- }, E)));
49
- }, [f, i, x, o, E]);
50
- const P = W(i, A);
47
+ k(() => {
48
+ C !== void 0 && i(C);
49
+ }, [C]), g(() => {
50
+ q !== L && (o || C) && G();
51
+ }, [q, o, L]), g(() => {
52
+ !o && !v || s !== u.HOVER && !l || Q || (R ? r.current && (clearTimeout(r.current), r.current = null) : r.current || (r.current = setTimeout(() => {
53
+ F();
54
+ }, d)));
55
+ }, [s, o, R, l, d]), g(() => {
56
+ x == null || x(v);
57
+ }, [v]);
58
+ const _ = y(o, j);
51
59
  return {
52
- open: i,
53
- mode: f,
54
- onOpenChange: d,
55
- onOpenByKeyboard: F,
56
- inheritedArrowColor: P,
57
- triggerRef: D,
58
- contentRef: A,
59
- animatedOpen: g,
60
- animationDuration: V,
61
- hoverCloseDelay: E,
62
- temporaryHoverClose: o,
63
- closeMenuImmediately: q,
64
- onMouseEnter: G,
65
- onMouseLeave: J,
66
- enableTemporaryHoverClose: N,
67
- triggerId: H
60
+ open: o,
61
+ mode: s,
62
+ onOpenChange: E,
63
+ onOpenByKeyboard: W,
64
+ inheritedArrowColor: _,
65
+ triggerRef: U,
66
+ contentRef: j,
67
+ animatedOpen: v,
68
+ animationDuration: w,
69
+ hoverCloseDelay: d,
70
+ temporaryHoverClose: l,
71
+ closeMenuImmediately: G,
72
+ onMouseEnter: X,
73
+ onMouseLeave: Y,
74
+ enableTemporaryHoverClose: Z,
75
+ triggerId: L
68
76
  };
69
77
  };
70
78
  export {
71
- tr as useContextMenuSubMenu
79
+ er as useContextMenuSubMenu
72
80
  };
@@ -41,6 +41,10 @@ export interface UseContextMenuSubMenuOptions {
41
41
  * The callback function to be called when the context menu is opened.
42
42
  */
43
43
  onOpen?: (open: boolean) => void;
44
+ /**
45
+ * The callback function to be called when the context menu is animated open.
46
+ */
47
+ onAnimatedOpen?: (open: boolean) => void;
44
48
  /**
45
49
  * Whether the context menu should close when another menu is opened.
46
50
  */
@@ -1 +1 @@
1
- {"version":3,"file":"useContextMenuSubMenu.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,WAAW,4BAA4B;IAC3C;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,IAAI,EAAE,mBAAmB,CAAC;IAC1B;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC;;OAEG;IACH,wBAAwB,CAAC,EAAE,CAAC,aAAa,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7D;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACjC;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC"}
1
+ {"version":3,"file":"useContextMenuSubMenu.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,WAAW,4BAA4B;IAC3C;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,IAAI,EAAE,mBAAmB,CAAC;IAC1B;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC;;OAEG;IACH,wBAAwB,CAAC,EAAE,CAAC,aAAa,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7D;;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,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC"}
@@ -3,4 +3,5 @@ export { type ContextMenuRootProps } from './ContextMenu.props';
3
3
  export { ContextMenuMode } from './ContextMenu.enums';
4
4
  export { Direction as ContextMenuDirection } from './components/Content';
5
5
  export { type ContextMenuType, type ContextMenuHandle, type ContextMenuModeType, } from './ContextMenu.types';
6
+ export { type ContextMenuSubHandle } from './components/Sub';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ContextMenu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,SAAS,IAAI,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,GACzB,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ContextMenu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,SAAS,IAAI,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,GACzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { ContextMenu as n } from "./ContextMenu.js";
2
2
  import { ContextMenuMode as x } from "./ContextMenu.enums.js";
3
- import "../../useContentPositioning-DO7ZotnD.mjs";
3
+ import "../../useContentPositioning-BLEFxO0N.mjs";
4
4
  import { Direction as p } from "./components/Content/Content.enums.js";
5
5
  import "./components/Content/Content.utils.js";
6
6
  export {
@@ -532,7 +532,7 @@ function Oe(e) {
532
532
  const [t, n] = a.useState(Bo());
533
533
  return ce(() => {
534
534
  n((r) => r ?? String(Wo++));
535
- }, [e]), t ? `radix-${t}` : "";
535
+ }, [e]), e || (t ? `radix-${t}` : "");
536
536
  }
537
537
  const Uo = ["top", "right", "bottom", "left"], ae = Math.min, V = Math.max, Je = Math.round, Ge = Math.floor, J = (e) => ({
538
538
  x: e,