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

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 (40) 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 +83 -80
  6. package/dist/components/ContextMenu/ContextMenu.props.d.ts +14 -0
  7. package/dist/components/ContextMenu/ContextMenu.props.d.ts.map +1 -1
  8. package/dist/components/ContextMenu/components/CheckboxItem/CheckboxItem.js +1 -1
  9. package/dist/components/ContextMenu/components/Content/Content.d.ts.map +1 -1
  10. package/dist/components/ContextMenu/components/Content/Content.js +1 -1
  11. package/dist/components/ContextMenu/components/Content/index.js +1 -1
  12. package/dist/components/ContextMenu/components/Item/Item.d.ts.map +1 -1
  13. package/dist/components/ContextMenu/components/Item/Item.js +75 -71
  14. package/dist/components/ContextMenu/components/RadioItem/RadioItem.js +1 -1
  15. package/dist/components/ContextMenu/components/Sub/Sub.js +2 -1
  16. package/dist/components/ContextMenu/components/SubRoot/SubRoot.d.ts.map +1 -1
  17. package/dist/components/ContextMenu/components/SubRoot/SubRoot.js +67 -64
  18. package/dist/components/ContextMenu/components/SubRoot/SubRoot.props.d.ts +4 -0
  19. package/dist/components/ContextMenu/components/SubRoot/SubRoot.props.d.ts.map +1 -1
  20. package/dist/components/ContextMenu/components/SubRoot/components/Content/Content.js +1 -1
  21. package/dist/components/ContextMenu/components/SubRoot/components/Trigger/Trigger.d.ts.map +1 -1
  22. package/dist/components/ContextMenu/components/SubRoot/components/Trigger/Trigger.js +38 -40
  23. package/dist/components/ContextMenu/components/SubTrigger/SubTrigger.js +2 -2
  24. package/dist/components/ContextMenu/hooks/index.js +1 -1
  25. package/dist/components/ContextMenu/hooks/useContentPositioning/useContentPositioning.js +1 -1
  26. package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.d.ts +2 -1
  27. package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.d.ts.map +1 -1
  28. package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.js +72 -61
  29. package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.types.d.ts +4 -0
  30. package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.types.d.ts.map +1 -1
  31. package/dist/components/ContextMenu/hooks/useContextMenuSub/useContextMenuSub.d.ts.map +1 -1
  32. package/dist/components/ContextMenu/hooks/useContextMenuSub/useContextMenuSub.js +51 -49
  33. package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.d.ts +1 -1
  34. package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.d.ts.map +1 -1
  35. package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.js +71 -63
  36. package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.types.d.ts +4 -0
  37. package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.types.d.ts.map +1 -1
  38. package/dist/components/ContextMenu/index.js +1 -1
  39. package/dist/{useContentPositioning-DO7ZotnD.mjs → useContentPositioning-DAKfbddS.mjs} +66 -65
  40. package/package.json +1 -1
@@ -1,94 +1,97 @@
1
- import { jsx as p } from "react/jsx-runtime";
2
- import { forwardRef as E, useImperativeHandle as N } from "react";
3
- import { R as T } from "../../../../index-BA3njR2k.mjs";
4
- import { useContextMenuContext as w, ContextMenuProvider as L } from "../../ContextMenu.context.js";
5
- import { ContextMenuMode as P } from "../../ContextMenu.enums.js";
6
- import { useContextMenuSubMenu as j } from "../../hooks/useContextMenuSubMenu/useContextMenuSubMenu.js";
7
- import "../../../../useContentPositioning-DO7ZotnD.mjs";
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { forwardRef as N, useImperativeHandle as T } from "react";
3
+ import { R as w } from "../../../../index-BA3njR2k.mjs";
4
+ import { useContextMenuContext as L, ContextMenuProvider as P } from "../../ContextMenu.context.js";
5
+ import { ContextMenuMode as j } from "../../ContextMenu.enums.js";
6
+ import { useContextMenuSubMenu as B } from "../../hooks/useContextMenuSubMenu/useContextMenuSubMenu.js";
7
+ import "../../../../useContentPositioning-DAKfbddS.mjs";
8
8
  import "../Content/Content.utils.js";
9
9
  import "../../providers/LevelProvider/LevelProvider.js";
10
- import { useContextMenuItemContext as B } from "../Item/Item.context.js";
11
- import { Trigger as K } from "./components/Trigger/Trigger.js";
12
- import { Content as V } from "./components/Content/Content.js";
13
- const e = "ContextMenu.SubRoot", t = E(
10
+ import { useContextMenuItemContext as K } from "../Item/Item.context.js";
11
+ import { Trigger as V } from "./components/Trigger/Trigger.js";
12
+ import { Content as Y } from "./components/Content/Content.js";
13
+ const o = "ContextMenu.SubRoot", t = N(
14
14
  ({
15
- children: a,
16
- mode: l = P.HOVER,
17
- onOpen: M,
18
- defaultOpen: d,
19
- isCloseWithRootMenu: C = !1,
20
- ...f
21
- }, x) => {
15
+ children: l,
16
+ mode: M = j.HOVER,
17
+ onOpen: d,
18
+ onAnimatedOpen: C,
19
+ defaultOpen: f,
20
+ isCloseWithRootMenu: c = !1,
21
+ ...x
22
+ }, y) => {
22
23
  const {
23
24
  animationDuration: n,
24
25
  hoverCloseDelay: r,
25
- closeMenuImmediately: c
26
- } = w(e), { subMenuOpen: o, setSubMenuOpen: m } = B(e), y = C ? c : void 0, {
27
- mode: b,
28
- open: R,
26
+ closeMenuImmediately: O
27
+ } = L(o), { subMenuOpen: e, setSubMenuOpen: m } = K(o), b = c ? O : void 0, {
28
+ mode: R,
29
+ open: i,
29
30
  onOpenChange: g,
30
- triggerRef: O,
31
- contentRef: I,
32
- inheritedArrowColor: v,
33
- animatedOpen: S,
34
- temporaryHoverClose: h,
35
- closeMenuImmediately: i,
36
- onMouseEnter: H,
37
- onMouseLeave: A,
31
+ triggerRef: I,
32
+ contentRef: v,
33
+ inheritedArrowColor: S,
34
+ animatedOpen: h,
35
+ temporaryHoverClose: H,
36
+ closeMenuImmediately: s,
37
+ onMouseEnter: A,
38
+ onMouseLeave: D,
38
39
  enableTemporaryHoverClose: u,
39
- triggerId: D,
40
- onOpenByKeyboard: s
41
- } = j({
42
- displayName: e,
43
- mode: l,
44
- defaultOpen: d,
45
- onOpen: M,
40
+ triggerId: E,
41
+ onOpenByKeyboard: p
42
+ } = B({
43
+ displayName: o,
44
+ mode: M,
45
+ defaultOpen: f,
46
+ onOpen: d,
47
+ onAnimatedOpen: C,
46
48
  animationDuration: n,
47
- subMenuOpen: o,
49
+ subMenuOpen: e,
48
50
  setSubMenuOpen: m,
49
51
  hoverCloseDelay: r,
50
- closeRootMenuImmediately: y
52
+ closeRootMenuImmediately: b
51
53
  });
52
- return N(x, () => ({
53
- closeMenuImmediately: i,
54
+ return T(y, () => ({
55
+ closeMenuImmediately: s,
54
56
  enableTemporaryHoverClose: u,
55
- onOpenByKeyboard: s
56
- })), /* @__PURE__ */ p(
57
- L,
57
+ onOpenByKeyboard: p
58
+ })), /* @__PURE__ */ a(
59
+ P,
58
60
  {
59
- mode: b,
60
- triggerRef: O,
61
- contentRef: I,
62
- inheritedArrowColor: v,
63
- animatedOpen: S,
61
+ mode: R,
62
+ triggerRef: I,
63
+ contentRef: v,
64
+ inheritedArrowColor: S,
65
+ animatedOpen: h,
64
66
  animationDuration: n,
65
67
  hoverCloseDelay: r,
66
- temporaryHoverClose: h,
67
- closeMenuImmediately: i,
68
- onMouseEnter: H,
69
- onMouseLeave: A,
68
+ temporaryHoverClose: H,
69
+ closeMenuImmediately: s,
70
+ onMouseEnter: A,
71
+ onMouseLeave: D,
70
72
  enableTemporaryHoverClose: u,
71
- subMenuOpen: o,
73
+ subMenuOpen: e,
72
74
  setSubMenuOpen: m,
73
- triggerId: D,
74
- onOpenByKeyboard: s,
75
- children: /* @__PURE__ */ p(
76
- T,
75
+ triggerId: E,
76
+ onOpenByKeyboard: p,
77
+ isOpen: e || i,
78
+ children: /* @__PURE__ */ a(
79
+ w,
77
80
  {
78
- open: R || o,
81
+ open: i || e,
79
82
  onOpenChange: g,
80
83
  modal: !1,
81
- ...f,
82
- children: a
84
+ ...x,
85
+ children: l
83
86
  }
84
87
  )
85
88
  }
86
89
  );
87
90
  }
88
91
  );
89
- t.displayName = e;
90
- t.Trigger = K;
91
- t.Content = V;
92
+ t.displayName = o;
93
+ t.Trigger = V;
94
+ t.Content = Y;
92
95
  export {
93
96
  t as SubRoot
94
97
  };
@@ -5,6 +5,10 @@ export type ContextMenuSubRootProps = Omit<RadixDropdownMenuRootProps, 'onOpenCh
5
5
  * Called whenever the open state of the menu changes.
6
6
  */
7
7
  onOpen?: (open: boolean) => void;
8
+ /**
9
+ * Called whenever the animated open state of the menu changes.
10
+ */
11
+ onAnimatedOpen?: (open: boolean) => void;
8
12
  /**
9
13
  * Defines how the menu is triggered.
10
14
  *
@@ -1 +1 @@
1
- {"version":3,"file":"SubRoot.props.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/components/SubRoot/SubRoot.props.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,IAAI,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAErG,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,0BAA0B,EAC1B,cAAc,GAAG,OAAO,CACzB,GAAG;IACF;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACjC;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC"}
1
+ {"version":3,"file":"SubRoot.props.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/components/SubRoot/SubRoot.props.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,IAAI,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAErG,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,0BAA0B,EAC1B,cAAc,GAAG,OAAO,CACzB,GAAG;IACF;;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;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC"}
@@ -8,7 +8,7 @@ import { LevelProvider as X } from "../../../../providers/LevelProvider/LevelPro
8
8
  import { useContextMenuContext as Y } from "../../../../ContextMenu.context.js";
9
9
  import { ContextMenuMode as g } from "../../../../ContextMenu.enums.js";
10
10
  import { focusParentItem as q } from "../../../../utils/focusParentItem/focusParentItem.js";
11
- import { u as J, s as K } from "../../../../../../useContentPositioning-DO7ZotnD.mjs";
11
+ import { u as J, s as K } from "../../../../../../useContentPositioning-DAKfbddS.mjs";
12
12
  import { Direction as Q } from "../../../Content/Content.enums.js";
13
13
  import { directionToSide as U } from "../../../Content/Content.utils.js";
14
14
  const x = "ContextMenu.Content", V = L(
@@ -1 +1 @@
1
- {"version":3,"file":"Trigger.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/ContextMenu/components/SubRoot/components/Trigger/Trigger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAe1C,eAAO,MAAM,OAAO,kMA+EnB,CAAC"}
1
+ {"version":3,"file":"Trigger.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/ContextMenu/components/SubRoot/components/Trigger/Trigger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAe1C,eAAO,MAAM,OAAO,kMA6EnB,CAAC"}
@@ -1,72 +1,70 @@
1
- import { jsx as c } from "react/jsx-runtime";
2
- import { forwardRef as v } from "react";
3
- import { T as y } from "../../../../../../index-BA3njR2k.mjs";
4
- import { mergeRefs as A } from "../../../../../../lib/utils.js";
5
- import { useContextMenuContext as E } from "../../../../ContextMenu.context.js";
6
- import { ContextMenuMode as H } from "../../../../ContextMenu.enums.js";
1
+ import { jsx as b } from "react/jsx-runtime";
2
+ import { forwardRef as c } from "react";
3
+ import { T as v } from "../../../../../../index-BA3njR2k.mjs";
4
+ import { mergeRefs as y } from "../../../../../../lib/utils.js";
5
+ import { useContextMenuContext as A } from "../../../../ContextMenu.context.js";
6
+ import { ContextMenuMode as E } from "../../../../ContextMenu.enums.js";
7
7
  import "../../../../providers/LevelProvider/LevelProvider.js";
8
- import "../../../../../../useContentPositioning-DO7ZotnD.mjs";
8
+ import "../../../../../../useContentPositioning-DAKfbddS.mjs";
9
9
  import "../../../Content/Content.utils.js";
10
- import { useContextMenuItemFocus as h } from "../../../../hooks/useContextMenuItemFocus/useContextMenuItemFocus.js";
11
- const s = "ContextMenu.Trigger", j = v(
10
+ import { useContextMenuItemFocus as j } from "../../../../hooks/useContextMenuItemFocus/useContextMenuItemFocus.js";
11
+ const a = "ContextMenu.Trigger", D = c(
12
12
  ({
13
- className: d,
14
- children: x,
13
+ className: x,
14
+ children: u,
15
15
  onFocus: r,
16
16
  onBlur: e,
17
- onMouseEnter: i,
18
- onMouseLeave: o,
19
- onPointerDown: g,
20
- ...u
21
- }, C) => {
17
+ onMouseEnter: o,
18
+ onMouseLeave: i,
19
+ onPointerDown: m,
20
+ ...C
21
+ }, n) => {
22
22
  const {
23
- triggerRef: n,
24
- mode: M,
23
+ triggerRef: M,
24
+ mode: d,
25
25
  onMouseEnter: R,
26
26
  onMouseLeave: T,
27
27
  triggerId: N
28
- } = E(s), {
29
- dataHighlighted: b,
30
- onFocus: m,
31
- onMouseEnter: p,
32
- onBlur: a,
33
- onMouseLeave: f
34
- } = h({
35
- displayName: s,
28
+ } = A(a), {
29
+ onFocus: p,
30
+ onMouseEnter: f,
31
+ onBlur: g,
32
+ onMouseLeave: s
33
+ } = j({
34
+ displayName: a,
36
35
  id: N || "",
37
36
  isDisabled: !1,
38
37
  onMouseEnter: R,
39
38
  onMouseLeave: T
40
39
  });
41
- return /* @__PURE__ */ c(
42
- y,
40
+ return /* @__PURE__ */ b(
41
+ v,
43
42
  {
44
- ref: A(n, C),
45
- className: d,
46
- "data-highlighted": b,
43
+ ref: y(M, n),
44
+ className: x,
47
45
  onPointerDown: (t) => {
48
- M === H.HOVER && t.preventDefault(), t.stopPropagation(), g == null || g(t);
46
+ d === E.HOVER && t.preventDefault(), t.stopPropagation(), m == null || m(t);
49
47
  },
50
48
  onMouseEnter: (t) => {
51
- p == null || p(t), i == null || i(t);
49
+ f == null || f(t), o == null || o(t);
52
50
  },
53
51
  onMouseLeave: (t) => {
54
- f == null || f(t), o == null || o(t);
52
+ s == null || s(t), i == null || i(t);
55
53
  },
56
54
  onFocus: (t) => {
57
- t.preventDefault(), t.stopPropagation(), m == null || m(), r == null || r(t);
55
+ t.preventDefault(), t.stopPropagation(), p == null || p(), r == null || r(t);
58
56
  },
59
57
  onBlur: (t) => {
60
- a == null || a(), e == null || e(t);
58
+ g == null || g(), e == null || e(t);
61
59
  },
62
60
  "data-submenu-trigger": !0,
63
- ...u,
64
- children: x
61
+ ...C,
62
+ children: u
65
63
  }
66
64
  );
67
65
  }
68
66
  );
69
- j.displayName = s;
67
+ D.displayName = a;
70
68
  export {
71
- j as Trigger
69
+ D as Trigger
72
70
  };
@@ -6,9 +6,9 @@ import { useLevelContext as q } from "../../providers/LevelProvider/LevelProvide
6
6
  import { useContextMenuSubContext as D } from "../Sub/Sub.context.js";
7
7
  import { hasItemIcon as V } from "../../utils/hasItemIcon/hasItemIcon.js";
8
8
  import { ContextMenuMode as i } from "../../ContextMenu.enums.js";
9
- import "../../../../useContentPositioning-DO7ZotnD.mjs";
10
- import "../Content/Content.utils.js";
11
9
  import "../../ContextMenu.context.js";
10
+ import "../../../../useContentPositioning-DAKfbddS.mjs";
11
+ import "../Content/Content.utils.js";
12
12
  import { useContextMenuItemFocus as W } from "../../hooks/useContextMenuItemFocus/useContextMenuItemFocus.js";
13
13
  import '../../../../assets/SubTrigger.css';const Y = "_sub_trigger_ip3hq_1", w = {
14
14
  sub_trigger: Y
@@ -1,7 +1,7 @@
1
1
  import { useContextMenu as t } from "./useContextMenu/useContextMenu.js";
2
2
  import { useContextMenuSubMenu as u } from "./useContextMenuSubMenu/useContextMenuSubMenu.js";
3
3
  import { useInheritedArrowColor as s } from "./useInheritedArrowColor/useInheritedArrowColor.js";
4
- import { u as m } from "../../../useContentPositioning-DO7ZotnD.mjs";
4
+ import { u as m } from "../../../useContentPositioning-DAKfbddS.mjs";
5
5
  import { useContextMenuSub as p } from "./useContextMenuSub/useContextMenuSub.js";
6
6
  import { useContextMenuItemFocus as i } from "./useContextMenuItemFocus/useContextMenuItemFocus.js";
7
7
  import { useIsTouchDevice as c } from "./useIsTouchDevice/useIsTouchDevice.js";
@@ -1,5 +1,5 @@
1
1
  import "react";
2
- import { u as n } from "../../../../useContentPositioning-DO7ZotnD.mjs";
2
+ import { u as n } from "../../../../useContentPositioning-DAKfbddS.mjs";
3
3
  import "../../components/Content/Content.enums.js";
4
4
  import "../../components/Content/Content.utils.js";
5
5
  export {
@@ -1,6 +1,6 @@
1
1
  import { ContextMenuMode } from '../../ContextMenu.enums';
2
2
  import { UseContextMenuOptions } from './useContextMenu.types';
3
- export declare const useContextMenu: ({ mode: rootMode, defaultOpen, animationDuration, hoverCloseDelay, onOpen, }: UseContextMenuOptions) => {
3
+ export declare const useContextMenu: ({ mode: rootMode, defaultOpen, animationDuration, hoverCloseDelay, onOpen, onAnimatedOpen, }: UseContextMenuOptions) => {
4
4
  open: boolean;
5
5
  mode: ContextMenuMode;
6
6
  onOpenChange: (value: boolean) => void;
@@ -16,5 +16,6 @@ export declare const useContextMenu: ({ mode: rootMode, defaultOpen, animationDu
16
16
  onMouseEnter: () => void;
17
17
  onMouseLeave: () => void;
18
18
  enableTemporaryHoverClose: () => void;
19
+ onChildClickOpen: (value: boolean) => void;
19
20
  };
20
21
  //# sourceMappingURL=useContextMenu.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useContextMenu.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/hooks/useContextMenu/useContextMenu.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAI1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,eAAO,MAAM,cAAc,iFAMxB,qBAAqB;;;0BA8EW,OAAO;8BA2BP,OAAO;;;;;;;;;;;;CAmIzC,CAAC"}
1
+ {"version":3,"file":"useContextMenu.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/hooks/useContextMenu/useContextMenu.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAI1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,eAAO,MAAM,cAAc,iGAOxB,qBAAqB;;;0BAmFW,OAAO;8BA2BP,OAAO;;;;;;;;;;;;8BAmEH,OAAO;CA8E7C,CAAC"}
@@ -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-DAKfbddS.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"}